PageSourceSearch

https://office-supply-connect.lovable.app/assets/SavedQuotesPage-DjAava9m.js

js office-supply-connect.lovable.app collected 2026-10-03 03:35:16 UTC 5,324 bytes, 6 lines download raw bytes

1import{c as _,n as k,t as D,u as L,r as m,j as e,A as x,Y as c,B as t,L as h,H as S,D as P,C as u,e as p,a1 as z,o as A,F as I,f as Q,a_ as T,I as R,bo as B}from"./index-CSZt44S3.js";import{D as E,a as F,b as H,c as M,d as V}from"./dialog-6oDXanGQ.js";import{u as Z}from"./useSavedQuotes-RCCTciL_.js";import{C as G}from"./calendar-DqeCkg4a.js";import{T as O}from"./trash-2-xyianaF0.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Y=_("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);function q(){const{user:j}=k(),o=D(),{quotes:n,loading:v,updateQuote:g,deleteQuote:N}=Z(),{addItem:f,clearCart:$}=L(),[l,i]=m.useState(null),[r,d]=m.useState(""),w=s=>{!s.items||s.items.length===0||(s.items.forEach(a=>{const y={id:a.product_id||a.id,name:a.product_name||a.name,sku:a.product_sku||a.sku||"",image_url:a.product_image_url||a.image_url||null,brand:a.brand||null,recommended_sale_price:a.unit_price||a.price||0,min_order_quantity:1,order_multiple:1};f(y,a.quantity||1,a.unit_price||a.price||0)}),B({title:"Preventivo caricato",description:`${s.items.length} prodotti aggiunti al carrello`}),o("/cart"))},C=async()=>{!l||!r.trim()||(await g(l.id,{name:r.trim()}),i(null))},b=async s=>{await N(s)};return j?e.jsxs(x,{children:[e.jsxs(S,{children:[e.jsx("title",{children:"Preventivi Salvati - Zinconeoffice"}),e.jsx("meta",{name:"description",content:"Gestisci i tuoi preventivi salvati su Zinconeoffice. Ricaricali nel carrello in qualsiasi momento."})]}),e.jsxs("div",{className:"container py-8 max-w-4xl",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsx(t,{variant:"ghost",size:"icon",onClick:()=>o(-1),children:e.jsx(P,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-2",children:[e.jsx(c,{className:"h-8 w-8"}),"Preventivi salvati"]}),e.jsxs("p",{className:"text-muted-foreground",children:[n.length," preventivi"]})]})]}),v?e.jsx("div",{className:"space-y-4",children:[...Array(3)].map((s,a)=>e.jsx(u,{children:e.jsx(p,{className:"p-6",children:e.jsx(z,{className:"h-16 w-full"})})},a))}):n.length===0?e.jsxs("div",{className:"text-center py-16",children:[e.jsx(c,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground"}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Nessun preventivo"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"Salva un preventivo dal carrello per ritrovarlo qui."}),e.jsx(t,{asChild:!0,children:e.jsx(h,{to:"/catalog",children:"Vai al catalogo"})})]}):e.jsx("div",{className:"space-y-4",children:n.map(s=>{var a;return e.jsx(u,{className:"hover:shadow-md transition-shadow",children:e.jsx(p,{className:"p-5",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{className:"space-y-1 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-semibold text-lg",children:s.name}),e.jsx(A,{variant:"secondary",className:"text-xs capitalize",children:s.status})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(G,{className:"h-3.5 w-3.5"}),new Date(s.updated_at).toLocaleDateString("it-IT")]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(I,{className:"h-3.5 w-3.5"}),((a=s.items)==null?void 0:a.length)||0," articoli"]})]}),s.notes&&e.jsx("p",{className:"text-sm text-muted-foreground italic",children:s.notes})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-xl font-bold",children:Q(s.total)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"+ IVA"})]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsxs(t,{size:"sm",className:"gap-1",onClick:()=>w(s),children:[e.jsx(T,{className:"h-4 w-4"}),"Carica"]}),e.jsx(t,{size:"icon",variant:"ghost",className:"h-9 w-9",onClick:()=>{i(s),d(s.name)},children:e.jsx(Y,{className:"h-4 w-4"})}),e.jsx(t,{size:"icon",variant:"ghost",className:"h-9 w-9 text-muted-foreground hover:text-destructive",onClick:()=>b(s.id),children:e.jsx(O,{className:"h-4 w-4"})})]})]})]})})},s.id)})}),e.jsx(E,{open:!!l,onOpenChange:()=>i(null),children:e.jsxs(F,{children:[e.jsx(H,{children:e.jsx(M,{children:"Rinomina preventivo"})}),e.jsx(R,{value:r,onChange:s=>d(s.target.value),placeholder:"Nome preventivo"}),e.jsxs(V,{children:[e.jsx(t,{variant:"outline",onClick:()=>i(null),children:"Annulla"}),e.jsx(t,{onClick:C,children:"Salva"})]})]})})]})]}):e.jsx(x,{children:e.jsxs("div",{className:"container py-12 text-center",children:[e.jsx(c,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground"}),e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Preventivi salvati"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"Accedi per visualizzare i tuoi preventivi"}),e.jsx(t,{asChild:!0,children:e.jsx(h,{to:"/auth?redirect=/quotes",children:"Accedi"})})]})})}export{q as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.