From 85661b8983f9d7ed3ab3bfb733b696dbd6c634d2 Mon Sep 17 00:00:00 2001 From: ClimenteA Date: Thu, 29 Sep 2022 17:51:05 +0300 Subject: [PATCH] fix: factura autocomplete --- assets/public/creeaza-factura.js | 10 ++++----- .../{factura_pdf.html => _factura_pdf.html} | 0 assets/templates/factura.html | 21 ++++++++++--------- clienti/clienti.go | 4 ++-- factura/factura.go | 15 ------------- types/dateidentificare.go | 4 ++-- 6 files changed, 20 insertions(+), 34 deletions(-) rename assets/templates/{factura_pdf.html => _factura_pdf.html} (100%) diff --git a/assets/public/creeaza-factura.js b/assets/public/creeaza-factura.js index a72430a..c8072cb 100644 --- a/assets/public/creeaza-factura.js +++ b/assets/public/creeaza-factura.js @@ -73,7 +73,7 @@ function proceseazaRawData(request) { dateFactura['data_emitere'] = dateFactura.data dateFactura['data_scadenta'] = new Date(date.setMonth(date.getMonth() + 1)).toISOString().split("T")[0] - dateFactura['nota'] = dateFactura.nota ? "Nota: " + dateFactura.nota : "" + dateFactura['nota'] = dateFactura.nota return dateFactura @@ -83,7 +83,7 @@ function proceseazaRawData(request) { // Mithril -const clientElemIds = ['adresaClient', +const clientElemIds = ['adresaClient', 'cifFurnizor', 'cifClient', 'emailClient', 'ibanClient', 'nrRegComClient', 'telefonClient'] @@ -179,7 +179,7 @@ class ClientForm { view(v) { return [ - m('label', { 'for': 'numeClient' }, [ + m('label', { for: 'numeClient' }, [ m('span', 'Nume'), m('input', { list: "clienti", @@ -212,9 +212,9 @@ class DateComp { view(v) { return [ - m('label', { "for": "data" }, [ + m('label', { for: "data" }, [ m('span', "Data factura"), - m("input", { "type": "date", "id": "data", "name": "data", "required": true, "value": this.getCurrentDate() }) + m("input", { type: "date", id: "data", name: "data", required: true, value: this.getCurrentDate() }) ]) ] } diff --git a/assets/templates/factura_pdf.html b/assets/templates/_factura_pdf.html similarity index 100% rename from assets/templates/factura_pdf.html rename to assets/templates/_factura_pdf.html diff --git a/assets/templates/factura.html b/assets/templates/factura.html index 2a094e1..4bd598e 100644 --- a/assets/templates/factura.html +++ b/assets/templates/factura.html @@ -34,9 +34,10 @@
Factura
- +
@@ -205,17 +206,17 @@
Produse/Servicii
console.log("factura", factura); let extraData = { - serie: factura.data.serie, - numar: parseInt(factura.data.numar), - data: factura.data.data, - suma: parseFloat(factura.data.totalFactura), + serie: factura.serie, + numar: parseInt(factura.numar), + data: factura.data, + suma: parseFloat(factura.totalFactura), } - let dateFurnizor = { ...factura.data.furnizor, ...{ is_client: false }, ...extraData }; - let dateClient = { ...factura.data.client, ...{ is_client: true }, ...extraData }; + let dateFurnizor = { ...factura.furnizor, ...{ is_client: false }, ...extraData }; + let dateClient = { ...factura.client, ...{ is_client: true }, ...extraData }; - console.log("dateFurnizor", dateFurnizor) - console.log("dateClient", dateClient) + console.log("dateFurnizor", dateFurnizor); + console.log("dateClient", dateClient); m.request({ method: "POST", diff --git a/clienti/clienti.go b/clienti/clienti.go index 52efe5f..03faf27 100644 --- a/clienti/clienti.go +++ b/clienti/clienti.go @@ -153,7 +153,7 @@ func handleClientsRequests(app fiber.App, store session.Store) { Suma: di.Suma, Nume: di.Nume, NrRegCom: di.NrRegCom, - CIFVAT: di.CIFVAT, + CIF: di.CIF, Adresa: di.Adresa, Telefon: di.Telefon, Email: di.Email, @@ -204,7 +204,7 @@ func handleClientsRequests(app fiber.App, store session.Store) { Suma: di.Suma, Nume: di.Nume, NrRegCom: di.NrRegCom, - CIFVAT: di.CIFVAT, + CIF: di.CIF, Adresa: di.Adresa, Telefon: di.Telefon, Email: di.Email, diff --git a/factura/factura.go b/factura/factura.go index 11d8351..45f8624 100644 --- a/factura/factura.go +++ b/factura/factura.go @@ -26,19 +26,4 @@ func handleInvoicePage(app fiber.App, store session.Store) { return c.Render("factura", fiber.Map{}, "base") }) - app.Get("/factura-pdf", func(c *fiber.Ctx) error { - - sess, err := store.Get(c) - if err != nil { - panic(err) - } - - currentUserPath := sess.Get("currentUser") - if currentUserPath == nil { - return c.Redirect("/login") - } - - return c.Render("factura_pdf", fiber.Map{}) - }) - } diff --git a/types/dateidentificare.go b/types/dateidentificare.go index bf55c37..0f3293a 100644 --- a/types/dateidentificare.go +++ b/types/dateidentificare.go @@ -6,8 +6,8 @@ type DateIdentificare struct { Data string `json:"data"` Suma float64 `json:"suma"` Nume string `json:"nume"` - NrRegCom string `json:"nr_reg_com"` - CIFVAT string `json:"cif_vat"` + NrRegCom string `json:"nrRegCom"` + CIF string `json:"cif"` Adresa string `json:"adresa"` Telefon string `json:"telefon"` Email string `json:"email"`