import{j as m,_ as j}from"./_plugin-vue_export-helper-DmjF0He4.js";import{d as h,o as e,a as r,f as t,t as n,j as a,i as l,F as y,n as k,D as v}from"./app-bWy6VYs1.js";import"./index-CMWG4mbA.js";const x={class:"print-container"},f={class:"print-header"},g={class:"company-info"},C={class:"company-name"},D={key:0},N={key:1},w={class:"jobcard-title"},F={class:"jobcard-number"},S={class:"info-grid"},B={class:"info-section"},R={key:0},T={key:1},J={key:2},P={class:"info-section"},I={key:0},L={key:1},U={key:2},V={key:0,class:"description-section"},q={class:"line-items"},A={class:"text-right"},E={class:"text-right"},Q={class:"text-right"},$={class:"totals"},z={class:"total-row"},G={key:0,class:"total-row"},H={class:"total-row final"},K={key:1,class:"notes-section"},M={key:2,class:"terms-section"},O=h({__name:"Print",props:{jobcard:{},currentCompany:{}},setup(u){const o=u,p=i=>i.charAt(0).toUpperCase()+i.slice(1).replace("_"," "),c=i=>i?new Date(i).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"",b=()=>{window.print()},_=()=>{v.visit(m.show(o.jobcard.id).url)};return(i,s)=>(e(),r("div",x,[t("div",f,[t("div",g,[t("div",C,n(o.currentCompany.name),1),o.currentCompany.email?(e(),r("div",D,n(o.currentCompany.email),1)):a("",!0),o.currentCompany.phone?(e(),r("div",N,n(o.currentCompany.phone),1)):a("",!0)]),t("div",w,n(o.jobcard.title),1),t("div",F,"Jobcard #"+n(o.jobcard.job_number),1)]),t("div",S,[t("div",B,[s[0]||(s[0]=t("h3",null,"Customer Information",-1)),t("p",null,[t("strong",null,n(o.jobcard.customer.name),1)]),o.jobcard.customer.email?(e(),r("p",R,n(o.jobcard.customer.email),1)):a("",!0),o.jobcard.customer.phone?(e(),r("p",T,n(o.jobcard.customer.phone),1)):a("",!0),o.jobcard.customer.address?(e(),r("p",J,n(o.jobcard.customer.address),1)):a("",!0)]),t("div",P,[s[5]||(s[5]=t("h3",null,"Jobcard Details",-1)),t("p",null,[s[1]||(s[1]=t("strong",null,"Status:",-1)),l(" "+n(p(o.jobcard.status)),1)]),o.jobcard.start_date?(e(),r("p",I,[s[2]||(s[2]=t("strong",null,"Start Date:",-1)),l(" "+n(c(o.jobcard.start_date)),1)])):a("",!0),o.jobcard.due_date?(e(),r("p",L,[s[3]||(s[3]=t("strong",null,"Due Date:",-1)),l(" "+n(c(o.jobcard.due_date)),1)])):a("",!0),o.jobcard.completed_date?(e(),r("p",U,[s[4]||(s[4]=t("strong",null,"Completed:",-1)),l(" "+n(c(o.jobcard.completed_date)),1)])):a("",!0)])]),o.jobcard.description?(e(),r("div",V,[s[6]||(s[6]=t("h3",null,"Description",-1)),t("p",null,n(o.jobcard.description),1)])):a("",!0),t("div",q,[s[10]||(s[10]=t("h3",null,"Line Items",-1)),t("table",null,[s[7]||(s[7]=t("thead",null,[t("tr",null,[t("th",null,"Description"),t("th",{class:"text-right"},"Qty"),t("th",{class:"text-right"},"Unit Price"),t("th",{class:"text-right"},"Total")])],-1)),t("tbody",null,[(e(!0),r(y,null,k(o.jobcard.line_items,d=>(e(),r("tr",{key:d.id},[t("td",null,n(d.description)+n(d.product?.sku||d.product?.barcode?` (${d.product.sku||d.product.barcode})`:""),1),t("td",A,n(d.quantity),1),t("td",E,"R"+n(Number(d.unit_price).toFixed(2)),1),t("td",Q,"R"+n(Number(d.total).toFixed(2)),1)]))),128))])]),t("div",$,[t("div",z,[s[8]||(s[8]=t("span",null,"Subtotal:",-1)),t("span",null,"R"+n(Number(o.jobcard.subtotal||0).toFixed(2)),1)]),o.jobcard.tax_rate>0?(e(),r("div",G,[t("span",null,"Tax ("+n(o.jobcard.tax_rate)+"%):",1),t("span",null,"R"+n(Number(o.jobcard.tax_amount||0).toFixed(2)),1)])):a("",!0),t("div",H,[s[9]||(s[9]=t("span",null,"Total:",-1)),t("span",null,"R"+n(Number(o.jobcard.total||0).toFixed(2)),1)])])]),o.jobcard.notes?(e(),r("div",K,[s[11]||(s[11]=t("h3",null,"Notes",-1)),t("p",null,n(o.jobcard.notes),1)])):a("",!0),o.jobcard.terms_conditions?(e(),r("div",M,[s[12]||(s[12]=t("h3",null,"Terms & Conditions",-1)),t("p",null,n(o.jobcard.terms_conditions),1)])):a("",!0),t("div",{class:"print-actions"},[t("button",{onClick:b,class:"print-btn"},"Print"),t("button",{onClick:_,class:"back-btn"},"Back to Jobcard")])]))}}),Z=j(O,[["__scopeId","data-v-8a1195ee"]]);export{Z as default};
