feat: Aggiungi funzionalità di eliminazione per clienti e preventivi con gestione delle dipendenze
This commit is contained in:
Vendored
+1
-1
@@ -5,7 +5,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="icon" type="image/jpeg" href="/kreios-logo.jpg" />
|
||||
<title>Il tuo preventivo · Krèios</title>
|
||||
<script type="module" crossorigin src="/assets/index-D5nts1N1.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-CnLA_o5j.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-vT7pz0E4.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -146,7 +146,7 @@ onMounted(loadCarrello)
|
||||
|
||||
<div class="card">
|
||||
<div class="totale-row">
|
||||
<span>Totale <span class="iva-nota">IVA 22% inclusa</span></span>
|
||||
<span>Totale <span class="iva-nota">Prezzi IVA esclusa</span></span>
|
||||
<span>{{ formatEuro(carrello.totale) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -22,8 +22,17 @@ async function request(path, options = {}) {
|
||||
export const api = {
|
||||
getCarrello: (token) => request(`/carrello/${token}`),
|
||||
rimuoviItem: (token, itemId) => request(`/carrello/${token}/item/${itemId}`, { method: 'DELETE' }),
|
||||
conferma: (token, dati) =>
|
||||
request(`/carrello/${token}/conferma`, { method: 'POST', body: JSON.stringify(dati) }),
|
||||
// Se l'utente era loggato nel configuratore, passiamo il suo token al backend così
|
||||
// il preventivo viene agganciato al suo record cliente esistente invece di crearne
|
||||
// uno nuovo (è lo stesso token usato per precompilare l'anagrafica).
|
||||
conferma: (token, dati) => {
|
||||
const headers = {}
|
||||
const clienteToken = resolveClienteToken()
|
||||
if (clienteToken) {
|
||||
headers.Authorization = `Bearer ${clienteToken}`
|
||||
}
|
||||
return request(`/carrello/${token}/conferma`, { method: 'POST', body: JSON.stringify(dati), headers })
|
||||
},
|
||||
// Dati anagrafici del cliente loggato nel configuratore, per precompilare il checkout.
|
||||
me: (clienteToken) =>
|
||||
request('/auth/me', { headers: { Authorization: `Bearer ${clienteToken}` } }),
|
||||
|
||||
Reference in New Issue
Block a user