1import{r as o,j as e}from"./index-BzPuTbLk.js";import{E as he}from"./jspdf.es.min-Cmv1E2Cg.js";import{F as ge}from"./file-text-BnSX2-DV.js";import{C as be}from"./circle-plus-DI_2BArf.js";import{T as fe}from"./trash-2-DJiNXjxe.js";import{E as je}from"./eye-CZMQmEpS.js";import{D as Ne}from"./download-djpbWvJa.js";import"./FooterTailwind-enAT_Y5V.js";import"./button-C52vHxr1.js";import"./anime.es-DjbxoOUh.js";const Ae=()=>{const[le,O]=o.useState(!1),[w,B]=o.useState(""),[F,q]=o.useState(""),[S,M]=o.useState(""),[C,U]=o.useState(""),[I,V]=o.useState(""),[k,W]=o.useState(""),[T,G]=o.useState(""),[E,Y]=o.useState(""),[b,H]=o.useState(`INV-${Date.now().toString().slice(-6)}`),[L,Q]=o.useState(new Date().toISOString().split("T")[0]),[n,de]=o.useState("USD"),[f,K]=o.useState(""),[j,J]=o.useState(""),[N,X]=o.useState(""),[v,Z]=o.useState(""),[P,_]=o.useState(""),[l,D]=o.useState([{id:"1",description:"",quantity:1,weight:"",rate:0,amount:0}]),[c,ee]=o.useState(0),[m,se]=o.useState(0),[x,te]=o.useState(0),[u,re]=o.useState(0),[p,ne]=o.useState(0),[h,oe]=o.useState(""),[g,ae]=o.useState(""),A=(s,r="success")=>{const t=document.createElement("div");t.className=`fixed top-4 right-4 px-6 py-3 rounded-lg shadow-lg text-white z-50 ${r==="success"?"bg-green-500":"bg-red-500"}`,t.textContent=s,document.body.appendChild(t),setTimeout(()=>{t.remove()},3e3)},ce=s=>{var t;const r=(t=s.target.files)==null?void 0:t[0];if(r){const d=new FileReader;d.onloadend=()=>{U(d.result)},d.readAsDataURL(r)}},me=()=>{const s={id:Date.now().toString(),description:"",quantity:1,weight:"",rate:0,amount:0};D([...l,s])},xe=s=>{l.length>1&&D(l.filter(r=>r.id!==s))},$=(s,r,t)=>{D(l.map(d=>{if(d.id===s){const a={...d,[r]:t};return(r==="quantity"||r==="rate")&&(a.amount=a.quantity*a.rate),a}return d}))},y=()=>l.reduce((s,r)=>s+r.amount,0),R=()=>y()*c/100,z=()=>y()+R()+m+x+u+p,ie=()=>!w||!I||!b?(A("Please fill in all required fields","error"),!1):l.length===0||!l[0].description?(A("Please add at least one cargo item","error"),!1):!0,ue=()=>{if(!ie())return;const s=new he("p","mm","a4"),r=s.internal.pageSize.getWidth();let t=20;if(s.setFontSize(20),s.setTextColor(116,86,218),s.text(w,20,t),s.setFontSize(16),s.setTextColor(0,0,0),s.text("INVOICE",r-60,t),t+=10,s.setFontSize(10),s.text(`#${b}`,r-60,t),t+=6,s.text(`Date: ${L}`,r-60,t),t=35,s.setFontSize(10),F&&s.text(F,20,t),t+=6,S&&s.text(S,20,t),t+=15,s.setFontSize(12),s.setFont(void 0,"bold"),s.text("BILL TO:",20,t),t+=7,s.setFont(void 0,"normal"),s.setFontSize(10),s.text(I,20,t),t+=6,k){const i=s.splitTextToSize(k,80);s.text(i,20,t),t+=i.length*6}T&&(s.text(T,20,t),t+=6);const d=56;s.setFontSize(12),s.setFont(void 0,"bold"),s.text("SHIPMENT DETAILS:",r-80,d),s.setFont(void 0,"normal"),s.setFontSize(10);let a=d+7;if(f&&(s.text(`Mode: ${f}`,r-80,a),a+=6),j&&(s.text(`Tracking: ${j}`,r-80,a),a+=6),N&&(s.text(`Origin: ${N}`,r-80,a),a+=6),v&&(s.text(`Destination: ${v}`,r-80,a),a+=6),t+=10,s.setFontSize(10),s.setFont(void 0,"bold"),s.text("Description",20,t),s.text("Qty",100,t),s.text("Weight",120,t),s.text("Rate",150,t),s.text("Amount",r-30,t,{align:"right"}),t+=2,s.line(20,t,r-20,t),t+=8,s.setFont(void 0,"normal"),l.forEach(i=>{s.text(i.description.substring(0,30),20,t),s.text(i.quantity.toString(),100,t),s.text(i.weight||"-",120,t),s.text(`${n} ${i.rate.toFixed(2)}`,150,t),s.text(`${n} ${i.amount.toFixed(2)}`,r-30,t,{align:"right"}),t+=7}),t+=5,s.line(r-90,t,r-20,t),t+=8,s.text("Subtotal:",r-90,t),s.text(`${n} ${y().toFixed(2)}`,r-30,t,{align:"right"}),t+=7,c>0&&(s.text(`Tax (${c}%):`,r-90,t),s.text(`${n} ${R().toFixed(2)}`,r-30,t,{align:"right"}),t+=7),m>0&&(s.text("Fuel Surcharge:",r-90,t),s.text(`${n} ${m.toFixed(2)}`,r-30,t,{align:"right"}),t+=7),x>0&&(s.text("Customs Fee:",r-90,t),s.text(`${n} ${x.toFixed(2)}`,r-30,t,{align:"right"}),t+=7),u>0&&(s.text("Insurance:",r-90,t),s.text(`${n} ${u.toFixed(2)}`,r-30,t,{align:"right"}),t+=7),p>0&&(s.text("Additional Charges:",r-90,t),s.text(`${n} ${p.toFixed(2)}`,r-30,t,{align:"right"}),t+=7),t+=2,s.setFont(void 0,"bold"),s.setFontSize(12),s.text("TOTAL:",r-90,t),s.text(`${n} ${z().toFixed(2)}`,r-30,t,{align:"right"}),h||g){if(t+=15,s.setFontSize(10),h){s.setFont(void 0,"bold"),s.text("Notes:",20,t),t+=6,s.setFont(void 0,"normal");const i=s.splitTextToSize(h,r-40);s.text(i,20,t),t+=i.length*6+5}if(g){s.setFont(void 0,"bold"),s.text("Payment Terms:",20,t),t+=6,s.setFont(void 0,"normal");const i=s.splitTextToSize(g,r-40);s.text(i,20,t)}}s.save(`${b}.pdf`),A("Invoice generated successfully!")},pe=()=>{confirm("Are you sure you want to reset the form?")&&(B(""),q(""),M(""),U(""),V(""),W(""),G(""),Y(""),H(`INV-${Date.now().toString().slice(-6)}`),Q(new Date().toISOString().split("T")[0]),K(""),J(""),X(""),Z(""),_(""),D([{id:"1",description:"",quantity:1,weight:"",rate:0,amount:0}]),ee(0),se(0),te(0),re(0),ne(0),oe(""),ae(""),A("Form reset successfully"))};return e.jsx("div",{className:"bg-gradient-to-br from-muted/30 via-white to-purple-50/30 py-8 px-4",children:e.jsxs("div",{className:"max-w-7xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsxs("div",{className:"flex items-center justify-center gap-3 mb-2",children:[e.jsx(ge,{className:"h-10 w-10 text-primary"}),e.jsx("h1",{className:"text-4xl font-bold text-foreground",children:"Shipping Invoice Generator"})]}),e.jsx("p",{className:"text-muted-foreground text-lg",children:"Create professional shipping invoices in seconds"})]}),le?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{id:"invoice-preview",className:"bg-white p-12 rounded-lg shadow-2xl max-w-4xl mx-auto",children:[e.jsxs("div",{className:"flex justify-between items-start mb-8 pb-6 border-b-2 border-primary",children:[e.jsxs("div",{children:[C&&e.jsx("img",{src:C,alt:"Logo",className:"h-16 mb-4"}),e.jsx("h2",{className:"text-3xl font-bold mb-2 text-primary",children:w}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:F}),e.jsx("p",{className:"text-sm text-muted-foreground",children:S})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("h1",{className:"text-4xl font-bold mb-2 text-foreground",children:"INVOICE"}),e.jsxs("p",{className:"text-lg font-semibold text-primary",children:["#",b]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Date: ",L]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-8 mb-8",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-lg mb-2 text-primary",children:"BILL TO:"}),e.jsx("p",{className:"font-semibold text-foreground",children:I}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:k}),e.jsx("p",{className:"text-sm text-muted-foreground",children:T}),E&&e.jsxs("p",{className:"text-sm mt-2",children:[e.jsx("span",{className:"font-semibold",children:"Ref:"})," ",E]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-lg mb-2 text-primary",children:"SHIPMENT DETAILS:"}),f&&e.jsxs("p",{className:"text-sm",children:[e.jsx("span",{className:"font-semibold",children:"Mode:"})," ",f]}),j&&e.jsxs("p",{className:"text-sm",children:[e.jsx("span",{className:"font-semibold",children:"Tracking:"})," ",j]}),N&&e.jsxs("p",{className:"text-sm",children:[e.jsx("span",{className:"font-semibold",children:"Origin:"})," ",N]}),v&&e.jsxs("p",{className:"text-sm",children:[e.jsx("span",{className:"font-semibold",children:"Destination:"})," ",v]}),P&&e.jsxs("p",{className:"text-sm",children:[e.jsx("span",{className:"font-semibold",children:"Delivery:"})," ",P]})]})]}),e.jsx("div",{className:"mb-8",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-muted",children:[e.jsx("th",{className:"text-left p-3 font-bold text-foreground",children:"Description"}),e.jsx("th",{className:"text-center p-3 font-bold text-foreground",children:"Qty"}),e.jsx("th",{className:"text-center p-3 font-bold text-foreground",children:"Weight"}),e.jsx("th",{className:"text-right p-3 font-bold text-foreground",children:"Rate"}),e.jsx("th",{className:"text-right p-3 font-bold text-foreground",children:"Amount"})]})}),e.jsx("tbody",{children:l.map((s,r)=>e.jsxs("tr",{className:r%2===0?"bg-muted/50":"",children:[e.jsx("td",{className:"p-3 text-sm",children:s.description}),e.jsx("td",{className:"p-3 text-sm text-center",children:s.quantity}),e.jsx("td",{className:"p-3 text-sm text-center",children:s.weight}),e.jsxs("td",{className:"p-3 text-sm text-right",children:[n," ",s.rate.toFixed(2)]}),e.jsxs("td",{className:"p-3 text-sm text-right font-semibold",children:[n," ",s.amount.toFixed(2)]})]},s.id))})]})}),e.jsx("div",{className:"flex justify-end mb-8",children:e.jsxs("div",{className:"w-80",children:[e.jsxs("div",{className:"flex justify-between py-2 border-b",children:[e.jsx("span",{className:"text-muted-foreground",children:"Subtotal:"}),e.jsxs("span",{className:"font-semibold",children:[n," ",y().toFixed(2)]})]}),c>0&&e.jsxs("div",{className:"flex justify-between py-2 border-b",children:[e.jsxs("span",{className:"text-muted-foreground",children:["Tax (",c,"%):"]}),e.jsxs("span",{className:"font-semibold",children:[n," ",R().toFixed(2)]})]}),m>0&&e.jsxs("div",{className:"flex justify-between py-2 border-b",children:[e.jsx("span",{className:"text-muted-foreground",children:"Fuel Surcharge:"}),e.jsxs("span",{className:"font-semibold",children:[n," ",m.toFixed(2)]})]}),x>0&&e.jsxs("div",{className:"flex justify-between py-2 border-b",children:[e.jsx("span",{className:"text-muted-foreground",children:"Customs Fee:"}),e.jsxs("span",{className:"font-semibold",children:[n," ",x.toFixed(2)]})]}),u>0&&e.jsxs("div",{className:"flex justify-between py-2 border-b",children:[e.jsx("span",{className:"text-muted-foreground",children:"Insurance:"}),e.jsxs("span",{className:"font-semibold",children:[n," ",u.toFixed(2)]})]}),p>0&&e.jsxs("div",{className:"flex justify-between py-2 border-b",children:[e.jsx("span",{className:"text-muted-foreground",children:"Additional Charges:"}),e.jsxs("span",{className:"font-semibold",children:[n," ",p.toFixed(2)]})]}),e.jsxs("div",{className:"flex justify-between py-4 mt-2 bg-lime-400",children:[e.jsx("span",{className:"font-bold text-lg px-3 text-foreground",children:"TOTAL:"}),e.jsxs("span",{className:"font-bold text-2xl px-3 text-foreground",children:[n," ",z().toFixed(2)]})]})]})}),(h||g)&&e.jsxs("div",{className:"border-t-2 pt-6 border-primary",children:[h&&e.jsxs("div",{className:"mb-4",children:[e.jsx("h4",{className:"font-bold mb-2 text-primary",children:"Notes:"}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:h})]}),g&&e.jsxs("div",{children:[e.jsx("h4",{className:"font-bold mb-2 text-primary",children:"Payment Terms:"}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:g})]})]}),e.jsxs("div",{className:"mt-8 pt-6 border-t text-center text-xs text-muted-foreground",children:["Generated on ",new Date().toLocaleStr
1ing()," | Invoice #",b]})]}),e.jsxs("div",{className:"flex gap-4 justify-center pb-8",children:[e.jsx("button",{onClick:()=>O(!1),className:"flex items-center gap-2 px-6 py-3 border-2 border-border text-foreground rounded-lg hover:bg-muted/50 transition font-medium",children:"Back to Edit"}),e.jsxs("button",{onClick:ue,className:"flex items-center gap-2 px-6 py-3 bg-lime-500 text-foreground rounded-lg hover:bg-lime-600 transition font-bold",children:[e.jsx(Ne,{className:"h-5 w-5"}),"Download PDF"]})]})]}):e.jsxs("div",{className:"grid gap-6",children:[e.jsxs("div",{className:"bg-white border border-border rounded-xl shadow-lg overflow-hidden",children:[e.jsxs("div",{className:"bg-muted/50 px-6 py-4 border-b border-border",children:[e.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Business Information"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Your company details and branding"})]}),e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"businessName",className:"block text-sm font-medium text-foreground",children:"Business Name *"}),e.jsx("input",{id:"businessName",type:"text",value:w,onChange:s=>B(s.target.value),placeholder:"Enter your business name",className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"businessContact",className:"block text-sm font-medium text-foreground",children:"Contact"}),e.jsx("input",{id:"businessContact",type:"text",value:S,onChange:s=>M(s.target.value),placeholder:"Phone / Email",className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"businessAddress",className:"block text-sm font-medium text-foreground",children:"Address"}),e.jsx("textarea",{id:"businessAddress",value:F,onChange:s=>q(s.target.value),placeholder:"Enter your business address",rows:2,className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition resize-none"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"logo",className:"block text-sm font-medium text-foreground",children:"Company Logo"}),e.jsx("input",{id:"logo",type:"file",accept:"image/*",onChange:ce,className:"w-full px-4 py-2 border border-border rounded-lg cursor-pointer file:mr-4 file:py-2 file:px-4 file:rounded-lg file:border-0 file:bg-muted/50 file:text-foreground hover:file:bg-muted"}),C&&e.jsx("img",{src:C,alt:"Logo preview",className:"h-16 w-auto mt-2 rounded border border-border"})]})]})]}),e.jsxs("div",{className:"bg-white border border-border rounded-xl shadow-lg overflow-hidden",children:[e.jsxs("div",{className:"bg-muted/50 px-6 py-4 border-b border-border",children:[e.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Client Information"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Customer and shipment details"})]}),e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"clientName",className:"block text-sm font-medium text-foreground",children:"Client Name *"}),e.jsx("input",{id:"clientName",type:"text",value:I,onChange:s=>V(s.target.value),placeholder:"Enter client name",className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"clientContact",className:"block text-sm font-medium text-foreground",children:"Contact"}),e.jsx("input",{id:"clientContact",type:"text",value:T,onChange:s=>G(s.target.value),placeholder:"Phone / Email",className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"clientAddress",className:"block text-sm font-medium text-foreground",children:"Client Address"}),e.jsx("textarea",{id:"clientAddress",value:k,onChange:s=>W(s.target.value),placeholder:"Enter client address",rows:2,className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition resize-none"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"shipmentRef",className:"block text-sm font-medium text-foreground",children:"Shipment Reference ID"}),e.jsx("input",{id:"shipmentRef",type:"text",value:E,onChange:s=>Y(s.target.value),placeholder:"e.g., SHIP-2024-001",className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition"})]})]})]}),e.jsxs("div",{className:"bg-white border border-border rounded-xl shadow-lg overflow-hidden",children:[e.jsxs("div",{className:"bg-muted/50 px-6 py-4 border-b border-border",children:[e.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Invoice & Shipment Details"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Invoice and shipping information"})]}),e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsxs("div",{className:"grid md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"invoiceNumber",className:"block text-sm font-medium text-foreground",children:"Invoice Number *"}),e.jsx("input",{id:"invoiceNumber",type:"text",value:b,onChange:s=>H(s.target.value),className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"invoiceDate",className:"block text-sm font-medium text-foreground",children:"Invoice Date"}),e.jsx("input",{id:"invoiceDate",type:"date",value:L,onChange:s=>Q(s.target.value),className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"currency",className:"block text-sm font-medium text-foreground",children:"Currency"}),e.jsxs("select",{id:"currency",value:n,onChange:s=>de(s.target.value),className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition bg-white",children:[e.jsx("option",{value:"USD",children:"USD ($)"}),e.jsx("option",{value:"EUR",children:"EUR (â¬)"}),e.jsx("option",{value:"GBP",children:"GBP (£)"}),e.jsx("option",{value:"INR",children:"INR (â¹)"})]})]})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"shipmentMode",className:"block text-sm font-medium text-foreground",children:"Shipment Mode"}),e.jsxs("select",{id:"shipmentMode",value:f,onChange:s=>K(s.target.value),className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition bg-white",children:[e.jsx("option",{value:"",children:"Select mode"}),e.jsx("option",{value:"Air",children:"Air"}),e.jsx("option",{value:"Sea",children:"Sea"}),e.jsx("option",{value:"Land",children:"Land"}),e.jsx("option",{value:"Rail",children:"Rail"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"trackingNumber",className:"block text-sm font-medium text-foreground",children:"Tracking Number"}),e.jsx("input",{id:"trackingNumber",type:"text",value:j,onChange:s=>J(s.target.value),placeholder:"Enter tracking number",className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition"})]})]}),e.jsxs("div",{className:"grid md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"origin",className:"block text-sm font-medium text-foreground",children:"Origin"}),e.jsx("input",{id:"origin",type:"text",value:N,onChange:s=>X(s.target.value),placeholder:"e.g., New York, USA",className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"destination",className:"block text-sm font-medium text-foreground",children:"Destination"}
1),e.jsx("input",{id:"destination",type:"text",value:v,onChange:s=>Z(s.target.value),placeholder:"e.g., London, UK",className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"deliveryDate",className:"block text-sm font-medium text-foreground",children:"Delivery Date"}),e.jsx("input",{id:"deliveryDate",type:"date",value:P,onChange:s=>_(s.target.value),className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition"})]})]})]})]}),e.jsxs("div",{className:"bg-white border border-border rounded-xl shadow-lg overflow-hidden",children:[e.jsxs("div",{className:"bg-muted/50 px-6 py-4 border-b border-border flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Itemized Cargo"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"List all cargo items for this shipment"})]}),e.jsxs("button",{onClick:me,className:"flex items-center gap-2 px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition font-medium",children:[e.jsx(be,{className:"h-4 w-4"}),"Add Item"]})]}),e.jsx("div",{className:"p-6",children:e.jsx("div",{className:"space-y-4",children:l.map((s,r)=>e.jsxs("div",{className:"grid gap-4 p-4 border border-border rounded-lg bg-muted/50/30",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"font-semibold text-sm text-foreground",children:["Item ",r+1]}),l.length>1&&e.jsx("button",{onClick:()=>xe(s.id),className:"text-red-600 hover:text-red-700 p-2 hover:bg-red-50 rounded transition",children:e.jsx(fe,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"grid md:grid-cols-5 gap-3",children:[e.jsxs("div",{className:"md:col-span-2 space-y-2",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground",children:"Description"}),e.jsx("input",{type:"text",value:s.description,onChange:t=>$(s.id,"description",t.target.value),placeholder:"Item description",className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground",children:"Quantity"}),e.jsx("input",{type:"number",min:"1",value:s.quantity,onChange:t=>$(s.id,"quantity",parseInt(t.target.value)||0),className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground",children:"Weight/Volume"}),e.jsx("input",{type:"text",value:s.weight,onChange:t=>$(s.id,"weight",t.target.value),placeholder:"e.g., 100kg",className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"block text-sm font-medium text-foreground",children:["Rate (",n,")"]}),e.jsx("input",{type:"number",min:"0",step:"0.01",value:s.rate,onChange:t=>$(s.id,"rate",parseFloat(t.target.value)||0),className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition"})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs("div",{className:"text-right",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Amount: "}),e.jsxs("span",{className:"text-lg font-bold text-lime-600",children:[n," ",s.amount.toFixed(2)]})]})})]},s.id))})})]}),e.jsxs("div",{className:"bg-white border border-border rounded-xl shadow-lg overflow-hidden",children:[e.jsxs("div",{className:"bg-muted/50 px-6 py-4 border-b border-border",children:[e.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Taxes & Additional Charges"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Add any applicable surcharges and fees"})]}),e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"grid md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"taxRate",className:"block text-sm font-medium text-foreground",children:"Tax Rate (%)"}),e.jsx("input",{id:"taxRate",type:"number",min:"0",step:"0.1",value:c,onChange:s=>ee(parseFloat(s.target.value)||0),className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{htmlFor:"fuelSurcharge",className:"block text-sm font-medium text-foreground",children:["Fuel Surcharge (",n,")"]}),e.jsx("input",{id:"fuelSurcharge",type:"number",min:"0",step:"0.01",value:m,onChange:s=>se(parseFloat(s.target.value)||0),className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{htmlFor:"customsFee",className:"block text-sm font-medium text-foreground",children:["Customs Fee (",n,")"]}),e.jsx("input",{id:"customsFee",type:"number",min:"0",step:"0.01",value:x,onChange:s=>te(parseFloat(s.target.value)||0),className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{htmlFor:"insurance",className:"block text-sm font-medium text-foreground",children:["Insurance (",n,")"]}),e.jsx("input",{id:"insurance",type:"number",min:"0",step:"0.01",value:u,onChange:s=>re(parseFloat(s.target.value)||0),className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{htmlFor:"additionalCharges",className:"block text-sm font-medium text-foreground",children:["Additional Charges (",n,")"]}),e.jsx("input",{id:"additionalCharges",type:"number",min:"0",step:"0.01",value:p,onChange:s=>ne(parseFloat(s.target.value)||0),className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition"})]})]})})]}),e.jsx("div",{className:"bg-gradient-to-br from-muted/30 to-white border border-lime-400 rounded-xl shadow-xl overflow-hidden",children:e.jsxs("div",{className:"px-6 py-4",children:[e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-4",children:"Invoice Summary"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between text-lg",children:[e.jsx("span",{className:"text-muted-foreground",children:"Subtotal:"}),e.jsxs("span",{className:"font-semibold text-foreground",children:[n," ",y().toFixed(2)]})]}),e.jsxs("div",{className:"flex justify-between text-lg",children:[e.jsxs("span",{className:"text-muted-foreground",children:["Tax (",c,"%):"]}),e.jsxs("span",{className:"font-semibold text-foreground",children:[n," ",R().toFixed(2)]})]}),e.jsxs("div",{className:"flex justify-between text-lg",children:[e.jsx("span",{className:"text-muted-foreground",children:"Additional Charges:"}),e.jsxs("span",{className:"font-semibold text-foreground",children:[n," ",(m+x+u+p).toFixed(2)]})]}),e.jsxs("div",{className:"border-t-2 border-lime-400 pt-3 flex justify-between text-2xl",children:[e.jsx("span",{className:"font-bold text-foreground",children:"Total:"}),e.jsxs("span",{className:"font-bold text-lime-600",children:[n," ",z().toFixed(2)]})]})]})]})}),e.jsxs("div",{className:"bg-white border border-border rounded-xl shadow-lg overflow-hidden",children:[e.jsxs("div",{className:"bg-muted/50 px-6 py-4 border-b border-border",children:[e.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Notes & Payment Terms"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Additional information and disclaimers"})]}),e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"notes",className:"block text-sm font-medium text-foreground",children:"Shipment Notes"}),e.jsx("textarea",{id:"notes",value:h,onChange:s=>oe(s.target.value),placeholder:"Any special instructions or notes about the shipment...",rows:3,className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition resize-none"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"terms",className:"block text-sm font-medium text-foreground",children:"Payment Terms"}),e.jsx("textarea",{id:"terms",value:g,onChange:s=>ae(s.target.value),placeholder:"Payment terms, delivery disclaimers, etc...",rows:3,className:"w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition resize-none"})]})]})]}),e.jsxs("div",{className:"flex gap-4 justify-center pb-8",children:[e.jsx("button",{onClick:pe,className:"flex items-center gap-2 px-6 py-3 border-2 border-border text-foreground rounded-lg hover:bg-muted/50 transition font-medium",children:"Reset Form"}),e.jsxs("button",{onClick:()=>{ie()&&O(!0)},className:"flex items-center gap-2 px-6 py-3 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition font-medium",children:[e.jsx(je,{className:"h-5 w-5"}),"Preview Invoice"]})]})]})]})})};export{Ae 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.