PageSourceSearch

https://flyttfabriken.vercel.app/_next/static/chunks/13897.9d0e26784bae7b9b.js

js flyttfabriken.vercel.app collected 2026-10-03 06:59:02 UTC 29,053 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[13897],{3998:(e,t,s)=>{s.d(t,{$:()=>o,r:()=>i});var a=s(95155);s(12115);var l=s(83101),r=s(38540),n=s(64269);let i=(0,l.F)("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",outline:"border border-input bg-background text-foreground shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"text-foreground hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function o(e){let{className:t,variant:s="default",size:l="default",asChild:o=!1,...c}=e,d=o?r.bL:"button";return(0,a.jsx)(d,{"data-slot":"button","data-variant":s,"data-size":l,className:(0,n.cn)(i({variant:s,size:l,className:t})),...c})}},6191:(e,t,s)=>{s.d(t,{A:()=>a});let a=(0,s(71847).A)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},7125:(e,t,s)=>{s.d(t,{A:()=>a});let a=(0,s(71847).A)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]])},13897:(e,t,s)=>{s.r(t),s.d(t,{InvoiceArticleMappingModal:()=>h});var a=s(95155),l=s(12115),r=s(51834),n=s(3998),i=s(95740),o=s(7125),c=s(6191),d=s(42529),u=s(35299),x=s(95125),m=s(4661);let p=e=>e.startsWith("v3:");function h(e){let{open:t,onClose:s,jobIds:h,includeCleaning:g,selection:f,onSuccess:v}=e,[b,j]=(0,l.useState)(!1),[y,N]=(0,l.useState)(!1),[k,w]=(0,l.useState)([]),[S,A]=(0,l.useState)([]),[M,F]=(0,l.useState)({}),[T,P]=(0,l.useState)(null),[E,C]=(0,l.useState)("gross"),[D,L]=(0,l.useState)(null),[z,_]=(0,l.useState)([]),q=(0,l.useMemo)(()=>{let e={};for(let t of S)t&&null!=t.ArticleNumber&&(e[String(t.ArticleNumber)]=t);return e},[S]),R=(0,l.useMemo)(()=>k.map(e=>{let t=M[e.key],s=t?q[t]:void 0,a="number"==typeof e.price&&isFinite(e.price)?e.price:0,l=((e,t,s)=>{let a=Number(e||0);if(!Number.isFinite(a))return 0;if("net"===s)return Math.round(100*a)/100;let l=Number(t||0);return Math.round(a/(l>0&&Number.isFinite(l)?1+l/100:1)*100)/100})(a,"number"==typeof e.vat&&isFinite(e.vat)?e.vat:25,E),r=Math.round(l*e.quantity*100)/100,n=(null==s?void 0:s.Description)&&s.Description.trim().length>0?s.Description:e.label,i="number"==typeof e.originalPrice?e.originalPrice:a,o=""===e._quantityRaw?"":e.quantity;return{...e,unitPriceCalc:l,unitPriceGross:a,unitPriceNet:l,rowTotal:r,displayLabel:n,originalPrice:i,quantityDisplay:o}}),[k,M,q,E]),O=(0,l.useMemo)(()=>R.reduce((e,t)=>e+t.rowTotal,0),[R]);(0,l.useMemo)(()=>null!=T?Math.round((O-T)*100)/100:0,[O,T]);let V=k.length>0&&k.every(e=>p(e.key)),H=(0,l.useMemo)(()=>f&&0!==f.length?f.map(e=>"".concat(e.jobId,":").concat(e.jobType||"",":").concat(e.reportId||"",":").concat(e.serviceJobId||"")).sort().join("|"):"",[f]);(0,l.useEffect)(()=>{t&&(async()=>{var e,t,s,a,l,r,n,i,o,c,d;try{j(!0),w([]),A([]),_([]),F({}),P(null),C("gross"),L(null);let c=await x.A.post("/api/invoicing/fortnox/preview-combined",{jobIds:h,includeCleaning:g,selection:f}),d=(null==c||null==(e=c.data)?void 0:e.articles)||[],u=((null==c||null==(t=c.data)?void 0:t.items)||[]).map(e=>
1({...e,originalPrice:"number"==typeof e.originalPrice?e.originalPrice:e.price,custom:!1}));C((null==c||null==(s=c.data)?void 0:s.priceMode)==="net"?"net":"gross"),A(d),w(u),_((null==c||null==(a=c.data)?void 0:a.reportedSummaries)||[]),L((null==c||null==(l=c.data)?void 0:l.rutSummary)||null);let m=u.reduce((e,t)=>e+t.price*t.quantity,0),p="number"==typeof(null==c||null==(r=c.data)?void 0:r.invoiceTargetTotalNet)?c.data.invoiceTargetTotalNet:"number"==typeof(null==c||null==(n=c.data)?void 0:n.targetTotalNet)?c.data.targetTotalNet:"number"==typeof(null==c||null==(i=c.data)?void 0:i.targetTotal)?c.data.targetTotal:m;P(Math.round(100*p)/100);let v={};for(let e of u){let t=(null==(o=e.aiSuggestion)?void 0:o.articleNumber)||e.defaultArticleNumber||"";t&&(v[e.key]=String(t))}F(v)}catch(e){console.error(e),(0,m.wJ)("Fel vid h\xe4mtning av fakturaunderlag",(null==e||null==(d=e.response)||null==(c=d.data)?void 0:c.error)||(null==e?void 0:e.message)||"Ok\xe4nt fel")}finally{j(!1)}})()},[t,h,g,H,f]);let W=(0,l.useMemo)(()=>S.map(e=>({value:String(e.ArticleNumber),label:"".concat(e.ArticleNumber," – ").concat(e.Description||"").concat(e.Unit?" (".concat(e.Unit,")"):"").concat("number"==typeof e.SalesPrice?" \xb7 ".concat(e.SalesPrice," kr"):"")})),[S]),I=(e,t)=>{if(!p(e))if(""===t||null==t)w(t=>t.map(t=>t.key===e?{...t,quantity:0,_quantityRaw:""}:t));else{let s="string"==typeof t?parseFloat(t):t,a=Number.isFinite(s)&&s>=0?s:0;w(t=>t.map(t=>t.key===e?{...t,quantity:a,_quantityRaw:void 0}:t))}},$=async()=>{var e,t,a,l,r,n,i;try{N(!0);let l={},r={};for(let e of R)l[e.key]=e.unitPriceCalc,r[e.key]=e.quantity;let o=k.filter(e=>e.custom).map(e=>({key:e.key,label:e.label,unit:e.unit,vat:e.vat})),c=k.map(e=>({key:e.key,label:e.label,unit:e.unit,vat:e.vat,quantity:e.quantity,price:e.price,custom:e.custom||!1,rutEligible:!0===e.rutEligible,houseWorkType:e.houseWorkType,houseWorkHoursToReport:e.houseWorkHoursToReport})),d=await x.A.post("/api/invoicing/fortnox/create-combined",{jobIds:h,includeCleaning:g,selection:f,selectedArticles:M,selectedUnitPrices:l,selectedQuantities:r,customRows:o,allItems:c}),u=null==d||null==(e=d.data)?void 0:e.documentNumber;if(u){let e=(n=null==d||null==(t=d.data)?void 0:t.rutAskedAmount,i=null==d||null==(a=d.data)?void 0:a.taxReductionAttach,Number(n)>0&&(null==i?void 0:i.ok)!==!0);null==v||v(String(u),e),s()}}catch(e){console.error(e),(0,m.wJ)("Fel vid skapande av faktura",(null==e||null==(r=e.response)||null==(l=r.data)?void 0:l.error)||(null==e?void 0:e.message)||"Ok\xe4nt fel")}finally{N(!1)}};return(0,a.jsx)(r.lG,{open:t,onOpenChange:e=>{e||s()},children:(0,a.jsxs)(r.Cf,{className:"sm:max-w-6xl !bg-slate-900 !border-slate-700 text-slate-100",children:[(0,a.jsxs)(r.c7,{className:"flex flex-row items-center justify-between",children:[(0,a.jsxs)(r.L3,{className:"text-cyan-300 flex items-center gap-2",children:[(0,a.jsx)(i.A,{className:"h-5 w-5"})," V\xe4lj Fortnox-artiklar"]}),(0,a.jsx)("span",{className:"text-xs text-slate-400 mr-8",children:"Priser exkl. moms"})]}),b?(0,a.jsxs)("div",{className:"py-8 flex flex-col items-center justify-center gap-4",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("div",{className:"h-16 w-16 rounded-full border-4 border-slate-700/50 border-t-cyan-400 animate-spin"}),(0,a.jsx)("div",{className:"absolute inset-0 h-16 w-16 rounded-full border-4 border-transparent border-t-cyan-400/30 animate-spin",style:{animationDirection:"reverse",animationDuration:"1.5s"}})]}),(0,a.jsx)("span",{className:"text-slate-400 text-sm",children:"H\xe4mtar artiklar & f\xf6rslag..."}),(0,a.jsx)("div",{className:"w-full mt-4 rounded-lg border border-slate-800 overflow-hidden animate-pulse",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-slate-800/60",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"text-left px-3 py-2 w-[220px]",children:(0,a.jsx)("div",{className:"h-4 w-20 bg-slate-700/60 rounded"})}),(0,a.jsx)("th",{className:"text-left px-3 py-2 w-[200px]",children:(0,a.jsx)("div",{className:"h-4 w-24 bg-slate-700/60 rounded"})}),(0,a.jsx)("th",{className:"text-right px-3 py-2 w-[110px]",children:(0,a.jsx)("div",{className:"h-4 w-12 bg-slate-700/60 rounded ml-auto"})}),(0,a.jsx)("th",{className:"text-left px-3 py-2 w-[80px]",children:(0,a.jsx)("div",{className:"h-4 w-12 bg-slate-700/60 rounded"})}),(0,a.jsx)("th",{className:"text-right px-3 py-2 w-[120px]",children:(0,a.jsx)("div",{className:"h-4 w-14 bg-slate-700/60 rounded ml-auto"})}),(0,a.jsx)("th",{className:"text-right px-3 py-2 w-[140px]",children:(0,a.jsx)("div",{className:"h-4 w-16 bg-slate-700/60 rounded ml-auto"})}),(0,a.jsx)("th",{className:"text-right px-3 py-2 w-[80px]",children:(0,a.jsx)("div",{className:"h-4 w-12 bg-slate-700/60 rounded ml-auto"})}),(0,a.jsx)("th",{className:"px-3 py-2 w-[80px]"})]})}),(0,a.jsx)("tbody",{children:[1,2,3].map(e=>(0,a.jsxs)("tr",{className:"border-t border-slate-800/70",children:[(0,a.jsx)("td",{className:"px-3 py-3",children:(0,a.jsx)("div",{className:"h-8 w-full bg-slate-800/80 rounded"})}),(0,a.jsx)("td",{className:"px-3 py-3",children:(0,a.jsx)("div",{className:"h-4 w-3/4 bg-slate-800/60 rounded"})}),(0,a.jsx)("td",{className:"px-3 py-3",children:(0,a.jsx)("div",{className:"h-8 w-full bg-slate-800/80 rounded"})}),(0,a.jsx)("td",{className:"px-3 py-3",children:(0,a.jsx)("div",{className:"h-4 w-8 bg-slate-800/60 rounded"})}),(0,a.jsx)("td",{className:"px-3 py-3",children:(0,a.jsx)("div",{className:"h-4 w-16 bg-slate-800/60 rounded ml-auto"})}),(0,a.jsx)("td",{className:"px-3 py-3",children:(0,a.jsx)("div",{className:"h-4 w-20 bg-slate-800/60 rounded ml-auto"})}),(0,a.jsx)("td",{className:"px-3 py-3",children:(0,a.jsx)("div",{className:"h-4 w-10 bg-slate-800/60 rounded ml-auto"})}),(0,a.jsx)("td",{className:"px-3 py-3",children:(0,a.jsx)("div",{className:"h-6 w-6 bg-slate-800/40 rounded mx-auto"})})]},e))})]})})]}):(0,a.jsxs)("div",{className:"mt-2",children:[z.length>0&&(0,a.jsxs)("div",{className:"mb-3 p-2 bg-slate-800/40 border border-slate-700/50 rounded-lg",children:[(0,a.jsx)("div",{className:"text-xs text-slate-400 mb-1.5 font-medium",children:"Rapporterade v\xe4rden"}),(0,a.jsx)("div",{className:"flex flex-col gap-1 text-xs",children:z.map((e,t)=>{var s;
1let r="moving"===e.jobType?"Flytt":"express"===e.jobType?"Express":"packing"===e.jobType?"Pack":"cleaning"===e.jobType?"St\xe4d":"delivery"===e.jobType?"Delivery":"pickup"===e.jobType?"Pickup":"storage"===e.jobType?"Magasinering":e.jobType,n="express"===e.jobType,i="cleaning"===e.jobType,o="delivery"===e.jobType||"pickup"===e.jobType,c="storage"===e.jobType,d=e.squareMeters||0,u=e.boxes||0;return(0,a.jsxs)("div",{className:"flex items-center gap-2 text-slate-300",children:[(0,a.jsxs)("span",{className:"text-cyan-400 font-medium",children:[r,":"]}),i?(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)("span",{children:[d," m\xb2"]})}):c?(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("span",{children:"Magasinhyra"})}):o?(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)("span",{children:[u," l\xe5dor"]})}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("span",{children:[e.workers," pers"]}),(0,a.jsx)("span",{className:"text-slate-500",children:"\xb7"}),"moving"===e.jobType&&Number(e.travelHours||0)>0?(0,a.jsxs)("span",{className:"font-medium text-slate-200",children:[Number(e.workHours||e.hours).toLocaleString("sv-SE")," h arbete"," + ",Number(e.travelHours).toLocaleString("sv-SE")," h restid"," = ",Number(e.invoiceHours||e.hours).toLocaleString("sv-SE")," h fakturerat"]}):(0,a.jsxs)("span",{children:[e.hours,"h"]}),!n&&e.cars>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-slate-500",children:"\xb7"}),(0,a.jsxs)("span",{children:[e.cars," bil",1!==e.cars?"ar":""]})]}),e.mileageCost>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-slate-500",children:"\xb7"}),(0,a.jsxs)("span",{children:["Mil: ",e.mileageCost," kr"]})]}),e.weekendSurcharge>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-slate-500",children:"\xb7"}),(0,a.jsxs)("span",{className:"text-amber-400",children:["Helg: ",e.weekendSurcharge," kr"]})]}),e.obSurcharge>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-slate-500",children:"\xb7"}),(0,a.jsxs)("span",{className:"text-yellow-400",children:["OB: ",e.obSurcharge," kr"]})]}),null==(s=e.addons)?void 0:s.map((e,t)=>(0,a.jsxs)(l.Fragment,{children:[(0,a.jsx)("span",{className:"text-slate-500",children:"\xb7"}),(0,a.jsxs)("span",{className:"text-purple-400",children:[e.name,": ",e.cost.toLocaleString("sv-SE")," kr"]})]},t)),e.discountPercentage>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-slate-500",children:"\xb7"}),(0,a.jsxs)("span",{className:"text-rose-400",children:["Rabatt: -",e.discountPercentage,"%",e.discountAmount>0?" (".concat(e.discountAmount.toLocaleString("sv-SE")," kr)"):""]})]})]}),!o&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-slate-500",children:"\xb7"}),(0,a.jsxs)("span",{className:"text-emerald-400 font-medium",children:["Tot: ",e.finalTotalAfterDiscount.toLocaleString("sv-SE")," kr"]})]})]},t)})})]}),(0,a.jsx)("div",{className:"max-h-[60vh] overflow-auto rounded-lg border border-slate-800",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-slate-800/60 text-slate-300 sticky top-0",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"text-left px-3 py-2 w-[220px]",children:"Artikelnr"}),(0,a.jsx)("th",{className:"text-left px-3 py-2 w-[200px]",children:"Ben\xe4mning"}),(0,a.jsx)("th",{className:"text-right px-3 py-2 w-[110px]",children:"Antal"}),(0,a.jsx)("th",{className:"text-left px-3 py-2 w-[80px]",children:"Enhet"}),(0,a.jsx)("th",{className:"text-right px-3 py-2 w-[120px]",children:"\xc1-pris"}),(0,a.jsx)("th",{className:"text-right px-3 py-2 w-[140px]",children:"Summa"}),(0,a.jsx)("th",{className:"text-right px-3 py-2 w-[80px]",children:"Moms"}),(0,a.jsx)("th",{className:"px-3 py-2 w-[80px]"})]})}),(0,a.jsx)("tbody",{children:R.map(e=>(0,a.jsxs)("tr",{className:"border-t border-slate-800/70",children:[(0,a.jsx)("td",{className:"px-3 py-2 text-slate-100",children:(0,a.jsxs)("select",{value:M[e.key]||"",onChange:t=>{var s,a;return s=e.key,a=t.target.value,void(F(e=>{let t={...e};return a?t[s]=a:delete t[s],t}),a&&w(e=>e.map(e=>{if(e.key!==s)return e;let t=q[a];if(!t||p(e.key))return e;let l=t.Unit&&String(t.Unit).trim().length>0?String(t.Unit):e.unit,r="number"==typeof t.VAT&&isFinite(t.VAT)?t.VAT:e.vat,n=e.price,i=t.SalesPrice,o="number"==typeof i?i:Number(String(null!=i?i:"").replace(",","."));return Number.isFinite(o)&&o>=0&&(n=((e,t,s)=>{let a=Number(e||0);if(!Number.isFinite(a))return 0;if("net"===s)return Math.round(100*a)/100;let l=Number(t||0);return Math.round(a*(l>0&&Number.isFinite(l)?1+l/100:1)*100)/100})(o,r,E)),{...e,price:n,unit:l,vat:r}}
1)))},className:"w-full bg-slate-800/80 border border-slate-700 rounded px-2 py-1 text-slate-100",children:[(0,a.jsx)("option",{value:"",children:"— V\xe4lj —"}),W.map(t=>(0,a.jsx)("option",{value:t.value,children:t.label},"".concat(e.key,"-").concat(t.value)))]})}),(0,a.jsx)("td",{className:"px-3 py-2 text-slate-100",children:e.custom&&!M[e.key]?(0,a.jsx)("span",{className:"text-slate-500 italic text-sm",children:"V\xe4lj artikel..."}):(0,a.jsx)("span",{children:e.displayLabel})}),(0,a.jsx)("td",{className:"px-3 py-2 text-right text-slate-200",children:e.custom&&!M[e.key]?(0,a.jsx)("span",{className:"text-slate-500",children:"-"}):p(e.key)?(0,a.jsx)("span",{title:"Antalet h\xe4mtas fr\xe5n rapporten",children:e.quantity}):(0,a.jsxs)("div",{className:"relative inline-flex w-28",children:[(0,a.jsxs)("div",{className:"absolute inset-y-0 left-0 flex items-center",children:[(0,a.jsx)("button",{type:"button",onClick:()=>I(e.key,(e.quantity||0)-.5),className:"h-full px-2 text-slate-100 hover:text-white transition-colors",children:(0,a.jsx)(o.A,{className:"w-3 h-3"})}),(0,a.jsx)("div",{className:"h-[70%] w-px bg-white/20 rounded-full"}),(0,a.jsx)("button",{type:"button",onClick:()=>I(e.key,(e.quantity||0)+.5),className:"h-full px-2 text-slate-100 hover:text-white transition-colors",children:(0,a.jsx)(c.A,{className:"w-3 h-3"})}),(0,a.jsx)("div",{className:"h-[70%] w-px bg-white/20 rounded-full"})]}),(0,a.jsx)("input",{type:"number",min:0,step:.5,value:e.quantityDisplay,onChange:t=>I(e.key,t.target.value),className:"w-full text-center pl-16 pr-2 py-1 rounded-lg bg-slate-900/60 border border-slate-700 text-slate-100 focus:outline-none focus:ring-1 focus:ring-cyan-400/60 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"})]})}),(0,a.jsx)("td",{className:"px-3 py-2 text-slate-300",children:e.custom&&!M[e.key]?(0,a.jsx)("span",{className:"text-slate-500",children:"-"}):(0,a.jsx)("span",{children:e.unit})}),(0,a.jsx)("td",{className:"px-3 py-2 text-right text-slate-200",children:e.custom&&!M[e.key]?(0,a.jsx)("span",{className:"text-slate-500",children:"-"}):e.unitPriceCalc.toFixed(2)}),(0,a.jsx)("td",{className:"px-3 py-2 text-right text-slate-200",children:e.custom&&!M[e.key]?(0,a.jsx)("span",{className:"text-slate-500",children:"-"}):e.rowTotal.toFixed(2)}),(0,a.jsx)("td",{className:"px-3 py-2 text-right text-slate-200",children:e.custom&&!M[e.key]?(0,a.jsx)("span",{className:"text-slate-500",children:"-"}):"".concat(e.vat,"%")}),(0,a.jsx)("td",{className:"px-3 py-2",children:(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[e.aiSuggestion&&(0,a.jsxs)("span",{title:e.aiSuggestion.reason||"AI-f\xf6rslag",className:"inline-flex items-center gap-1 text-emerald-400 text-xs",children:[(0,a.jsx)(d.A,{className:"h-4 w-4"})," AI"]}),p(e.key)?(0,a.jsx)("span",{className:"text-xs text-slate-500",title:"Pris och antal h\xe4mtas fr\xe5n rapporten",children:"Fr\xe5n rapport"}):(0,a.jsx)("button",{type:"button",onClick:()=>{var t;p(t=e.key)||(w(e=>e.filter(e=>e.key!==t)),F(e=>{let s={...e};return delete s[t],s}))},className:"text-xs text-red-400 hover:text-red-300",children:"Ta bort"})]})})]},e.key))}),D&&D.applicants.length>0&&(0,a.jsx)("tfoot",{children:D.applicants.map(e=>(0,a.jsxs)("tr",{className:"border-t border-emerald-500/30 bg-emerald-500/5",children:[(0,a.jsx)("td",{className:"px-3 py-2 text-xs font-semibold uppercase tracking-wide text-emerald-300",children:"RUT"}),(0,a.jsxs)("td",{colSpan:4,className:"px-3 py-2",children:[(0,a.jsx)("div",{className:"font-medium text-slate-100",children:"Prelimin\xe4r skattereduktion"}),(0,a.jsxs)("div",{className:"text-xs text-slate-400",children:[e.name,e.personalNumber?" (".concat(e.personalNumber,")"):""]})]}),(0,a.jsxs)("td",{className:"px-3 py-2 text-right font-semibold tabular-nums text-emerald-300",children:["−",e.amount.toLocaleString("sv-SE")," kr"]}),(0,a.jsx)("td",{className:"px-3 py-2 text-right text-slate-500",children:"—"}),(0,a.jsx)("td",{className:"px-3 py-2 text-right text-xs text-slate-500",children:"L\xe5st"})]},"".concat(e.personalNumber,"-").concat(e.name)))})]})})]}),!b&&(0,a.jsxs)("div",{className:"mt-3 flex flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[!V&&(0,a.jsx)(n.$,{type:"button",variant:"outline",size:"sm",onClick:()=>{let e="custom:".concat(Date.now(),":").concat(Math.random().toString(36).slice(2,8));w(t=>[...t,{key:e,label:"Extra rad",unit:"st",quantity:1,price:0,vat:25,originalPrice
1:0,custom:!0}])},className:"border-dashed border-slate-600 text-slate-200 hover:text-slate-100 hover:border-slate-400",children:"+ L\xe4gg till rad"}),D?(0,a.jsxs)("div",{className:"flex w-full flex-wrap items-center justify-end gap-x-5 gap-y-1 rounded-lg border border-slate-700 bg-slate-800/60 px-3 py-2 text-xs md:ml-auto md:w-auto",children:[(0,a.jsxs)("span",{className:"whitespace-nowrap text-slate-400",children:["Exkl. moms ",(0,a.jsxs)("strong",{className:"ml-1 font-medium text-slate-200",children:[D.subtotalExcludingVat.toLocaleString("sv-SE",{minimumFractionDigits:2})," kr"]})]}),(0,a.jsxs)("span",{className:"whitespace-nowrap text-slate-400",children:["Moms ",(0,a.jsxs)("strong",{className:"ml-1 font-medium text-slate-200",children:[D.vat.toLocaleString("sv-SE",{minimumFractionDigits:2})," kr"]})]}),(0,a.jsxs)("span",{className:"whitespace-nowrap text-slate-400",children:["Fullpris ",(0,a.jsxs)("strong",{className:"ml-1 font-medium text-slate-100",children:[D.fullPriceIncludingVat.toLocaleString("sv-SE",{minimumFractionDigits:2})," kr"]})]}),Math.abs(D.roundOff)>=.01&&(0,a.jsxs)("span",{className:"whitespace-nowrap text-slate-400",children:["\xd6resavrundning ",(0,a.jsxs)("strong",{className:"ml-1 font-medium text-slate-200",children:[D.roundOff>0?"+":"",D.roundOff.toLocaleString("sv-SE",{minimumFractionDigits:2})," kr"]})]}),(0,a.jsx)("span",{className:"hidden h-6 w-px bg-slate-700 md:block"}),(0,a.jsxs)("span",{className:"ml-auto whitespace-nowrap text-base font-semibold text-cyan-300 md:ml-0",children:["Att betala\xa0 ",D.amountToPay.toLocaleString("sv-SE")," kr"]})]}):(0,a.jsx)("div",{className:"inline-flex flex-col items-end gap-1 px-3 py-2 rounded-md bg-slate-800/60 border border-slate-700",children:(0,a.jsxs)("div",{className:"flex items-baseline gap-3",children:[(0,a.jsx)("span",{className:"text-xs text-slate-400",children:"Fakturarader (fullt pris)"}),(0,a.jsxs)("span",{className:"text-lg font-semibold text-cyan-300",children:[O.toFixed(2)," kr"]})]})})]}),(0,a.jsxs)(r.Es,{className:"mt-4 flex items-center justify-end gap-2",children:[(0,a.jsx)(n.$,{variant:"outline",onClick:s,children:"Avbryt"}),(0,a.jsx)(n.$,{onClick:$,disabled:y||b,className:"bg-gradient-to-r from-cyan-600 to-blue-600 hover:from-cyan-700 hover:to-blue-700 text-white",children:y?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.A,{className:"h-4 w-4 animate-spin"})," Skapar faktura..."]}):"Skapa faktura"})]})]})})}},38540:(e,t,s)=>{s.d(t,{bL:()=>n});var a=s(12115),l=s(94446),r=s(95155),n=function(e){let t=function(e){let t=a.forwardRef((e,t)=>{let{children:s,...r}=e;if(a.isValidElement(s)){var n;let e,i,o=(n=s,(i=(e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?n.ref:(i=(e=Object.getOwnPropertyDescriptor(n,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?n.props.ref:n.props.ref||n.ref),c=function(e,t){let s={...t};for(let a in t){let l=e[a],r=t[a];/^on[A-Z]/.test(a)?l&&r?s[a]=(...e)=>{let t=r(...e);return l(...e),t}:l&&(s[a]=l):"style"===a?s[a]={...l,...r}:"className"===a&&(s[a]=[l,r].filter(Boolean).join(" "))}return{...e,...s}}(r,s.props);return s.type!==a.Fragment&&(c.ref=t?(0,l.t)(t,o):o),a.cloneElement(s,c)}return a.Children.count(s)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}(e),s=a.forwardRef((e,s)=>{let{children:l,...n}=e,i=a.Children.toArray(l),c=i.find(o);if(c){let e=c.props.children,l=i.map(t=>t!==c?t:a.Children.count(e)>1?a.Children.only(null):a.isValidElement(e)?e.props.children:null);return(0,r.jsx)(t,{...n,ref:s,children:a.isValidElement(e)?a.cloneElement(e,void 0,l):null})}return(0,r.jsx)(t,{...n,ref:s,children:l})});return s.displayName=`${e}.Slot`,s}("Slot"),i=Symbol("radix.slottable");function o(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===i}},42529:(e,t,s)=>{s.d(t,{A:()=>a});let a=(0,s(71847).A)("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},51834:(e,t,s)=>{s.d(t,{Cf:()=>h,Es:()=>f,HM:()=>m,L3:()=>v,c7:()=>g,lG:()=>u,rr:()=>b});var a=s(95155),l=s(12115),r=s(93409),n=s(65229),i=s(20063),o=s(64269),c=s(70064),d=s(66911);function u(e){let{open:t,defaultOpen:s,onOpenChange:n,modal:o=!0,...u}=e,[x,m]=l.useState(null!=s&&s),p=void 0!==t,h=p?t:x,g=(0,c.k)(),f=(0,i.usePathname)(),v=l.useRef(null),b=l.useRef(!1);h?null==v.current?(v.current=f,b.current=!1):g&&v.current!==f&&(b.current=!0):(v.current=null,b.current=!1);let j=!!(h&&g&&!b.current&&v.current===f),y=!!(o&&j);return l.useEffect(()=>{if(!y)return;let e=(0,d.yu)();return()=>(0,d.Bg)(e)},[y]),(0,a.jsx)(r.bL,{"data-slot":"dialog",open:j,onOpenChange:e=>{p||m(e),null==n||n(e)},modal:y,...u})}function x(e){let{...t}=e;return(0,a.jsx)(r.ZL,{"data-slot":"dialog-portal",...t})}function m(e){let{...t}=e,{onClick:s,onPointerDown:l,onMouseDown:n,onKeyDown:i,...o}=t,c=(e,t)=>{var s;null==(s=e.stopPropagation)||s.call(e),null==t||t(e)};return(0,a.jsx)(r.bm,{"data-slot":"dialog-close",onClick:e=>c(e,s),onPointerDown:e=>c(e,l),onMouseDown:e=>c(e,n),onKeyDown:e=>c(e,i),...o})}function p(e){let{className:t,blockOutsideClick:s=!0,...l}=e,n={...s?{onPointerDown:e=>{e.preventDefault(),e.stopPropagation()},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>{e.preventDefault(),e.stopPropagation()}}:{},onWheel:e=>{e.preventDefault(),e.stopPropagation()},onTouchMove:e=>{e.preventDefault(),e.stopPropagation()}};return(0,a.jsx)(r.hJ,{"data-slot":"dialog-overlay",className:(0,o.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-[100000000] bg-black/60 backdrop-blur-xl pointer-events-auto",t),...n,...l})}function h(e){let{className:t,children:s,showCloseButton:l=!0,allowOutsideClose:i=!1,overlayClassName:d,...u}=e,m=(0,c.k)();return(0,a.jsx)(x,{"data-slot":"dialog-portal",forceMount:!m||void 0,children:(0,a.jsxs)("div",{hidden:!m,"aria-hidden":!m,inert:!m||void 0,style:m?void 0:{display:"none",pointerEvents:"none"},children:[(0,a.jsx)(p,{forceMount:!m||void 0,hidden:!m,"aria-hidden":!m,blockOutsideClick:!i,className:d}),(0,a.jsxs)(r.UC,{forceMount:!m||void 0,hidden:!m,"aria-hidden":!m,"data-slot":"dialog-content",className:(0,o.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-[100000001] grid w-full max-w-[calc(100%-2rem)] gap-4 roun
1ded-lg border border-slate-200 dark:border-slate-700 p-6 shadow-lg duration-200 pointer-events-auto",t),...u,children:[s,l&&(0,a.jsxs)(r.bm,{"data-slot":"dialog-close",className:"absolute top-4 right-4 inline-flex items-center justify-center rounded-full p-2 shadow-sm opacity-90 hover:opacity-100 bg-slate-200/80 text-slate-900 dark:bg-slate-700/80 dark:text-slate-100 ring-1 ring-slate-300/60 dark:ring-slate-600/60 transition-colors focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[(0,a.jsx)(n.A,{}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})})}function g(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"dialog-header",className:(0,o.cn)("flex flex-col gap-2 text-center sm:text-left",t),...s})}function f(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"dialog-footer",className:(0,o.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...s})}function v(e){let{className:t,...s}=e;return(0,a.jsx)(r.hE,{"data-slot":"dialog-title",className:(0,o.cn)("text-lg leading-none font-semibold",t),...s})}function b(e){let{className:t,...s}=e;return(0,a.jsx)(r.VY,{"data-slot":"dialog-description",className:(0,o.cn)("text-muted-foreground text-sm",t),...s})}},70064:(e,t,s)=>{s.d(t,{$:()=>n,k:()=>i});var a=s(95155),l=s(12115);let r=(0,l.createContext)(!0);function n(e){let{active:t,children:s}=e;return(0,a.jsx)(r.Provider,{value:t,children:s})}function i(){return(0,l.useContext)(r)}},83101:(e,t,s)=>{s.d(t,{F:()=>n});var a=s(2821);let l=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,r=a.$,n=(e,t)=>s=>{var a;if((null==t?void 0:t.variants)==null)return r(e,null==s?void 0:s.class,null==s?void 0:s.className);let{variants:n,defaultVariants:i}=t,o=Object.keys(n).map(e=>{let t=null==s?void 0:s[e],a=null==i?void 0:i[e];if(null===t)return null;let r=l(t)||l(a);return n[e][r]}),c=s&&Object.entries(s).reduce((e,t)=>{let[s,a]=t;return void 0===a||(e[s]=a),e},{});return r(e,o,null==t||null==(a=t.compoundVariants)?void 0:a.reduce((e,t)=>{let{class:s,className:a,...l}=t;return Object.entries(l).every(e=>{let[t,s]=e;return Array.isArray(s)?s.includes({...i,...c}[t]):({...i,...c})[t]===s})?[...e,s,a]:e},[]),null==s?void 0:s.class,null==s?void 0:s.className)}},95740:(e,t,s)=>{s.d(t,{A:()=>a});let a=(0,s(71847).A)("sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]])}}]);

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.