Skip to content

Commit

Permalink
fix: factura autocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
ClimenteA committed Sep 29, 2022
1 parent f46c545 commit 85661b8
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 34 deletions.
10 changes: 5 additions & 5 deletions assets/public/creeaza-factura.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -83,7 +83,7 @@ function proceseazaRawData(request) {
// Mithril


const clientElemIds = ['adresaClient',
const clientElemIds = ['adresaClient', 'cifFurnizor',
'cifClient', 'emailClient', 'ibanClient',
'nrRegComClient', 'telefonClient']

Expand Down Expand Up @@ -179,7 +179,7 @@ class ClientForm {
view(v) {

return [
m('label', { 'for': 'numeClient' }, [
m('label', { for: 'numeClient' }, [
m('span', 'Nume'),
m('input', {
list: "clienti",
Expand Down Expand Up @@ -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() })
])
]
}
Expand Down
File renamed without changes.
21 changes: 11 additions & 10 deletions assets/templates/factura.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ <h5 style="color:var(--secondary);">Factura</h5>
</div>

</div>

<!--
<div class="grid">
<label for="moneda">
Moneda
<input list="monezi" style="text-transform:uppercase" type="text" id="moneda" name="moneda"
Expand All @@ -59,7 +60,7 @@ <h5 style="color:var(--secondary);">Factura</h5>
</select>
</label>
</div>
</div> -->


<div class="grid" style="margin-top: 2rem;">
Expand Down Expand Up @@ -205,17 +206,17 @@ <h5 style="color:var(--secondary);margin-top:2rem;">Produse/Servicii</h5>
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",
Expand Down
4 changes: 2 additions & 2 deletions clienti/clienti.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
15 changes: 0 additions & 15 deletions factura/factura.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{})
})

}
4 changes: 2 additions & 2 deletions types/dateidentificare.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down

0 comments on commit 85661b8

Please sign in to comment.