PageSourceSearch

https://ahanprice.com/_nuxt/DTbw2jQr.js

js ahanprice.com collected 2026-09-25 07:53:53 UTC 15,826 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Debo9iKX.js","./CkHvFIio.js"])))=>i.map(i=>d[i]);
2import{u as $,a as S,w as O,b as K,c as r,d as t,e as R,f as b,t as a,n as T,g as k,h as U,F as Y,r as Q,i as X,j,k as Z,_ as W,l as tt,o as l}from"./CkHvFIio.js";import{_ as et}from"./Ber5nfFh.js";import{_ as st}from"./DlAUqK2U.js";const ot={class:"min-h-screen bg-slate-100 py-6 px-4 sm:px-6 lg:px-8 print:p-0 print:bg-white dir-rtl ss02"},at={class:"max-w-5xl mx-auto"},nt={key:0,class:"flex justify-center items-center py-20 print:hidden"},rt={key:1,class:"bg-red-50 border border-red-200 text-red-700 p-6 rounded-xl text-center print:hidden"},lt={key:2},it={class:"flex flex-wrap items-center justify-between gap-3 mb-4 print:hidden"},dt={class:"flex items-center gap-2"},ct=["disabled"],ut=["disabled"],pt={key:0,class:"w-4 h-4 border-2 border-emerald-600 border-t-transparent rounded-full animate-spin"},xt={key:1,class:"w-4 h-4 text-emerald-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},mt=["disabled"],bt={key:0,class:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"},vt={key:1,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ft={class:"overflow-x-auto"},ht={class:"flex flex-col sm:flex-row justify-between items-start sm:items-center pb-6 border-b border-slate-200 gap-4"},gt={class:"text-right sm:text-left bg-slate-50 sm:bg-transparent p-3 sm:p-0 rounded-xl w-full sm:w-auto border sm:border-none border-slate-100"},_t={class:"text-xs text-slate-600 space-y-1"},yt={class:"font-bold text-slate-900"},wt={class:"font-bold text-slate-900"},kt={key:0},jt={class:"font-bold text-slate-900"},Pt={class:"bg-slate-50/80 p-3.5 rounded-xl border border-slate-100"},Nt={class:"font-bold text-slate-900 text-sm mb-1"},Mt={class:"text-slate-600 space-y-1 leading-relaxed"},Ct={key:0},Tt={key:1},Wt={key:2},It={key:0,class:"bg-slate-50/80 p-3.5 rounded-xl border border-slate-100 flex items-start gap-3 print:hidden"},Vt=["src"],Dt={key:1,class:"w-10 h-10 rounded-full bg-blue-100 text-blue-700 font-bold flex items-center justify-center text-sm mt-1"},At={class:"flex-1"},Et={class:"font-bold text-slate-900 text-sm mb-0.5"},Rt={class:"text-slate-500 text-xs"},Bt={class:"py-6"},Ft={class:"flex items-center justify-between mb-3"},Ht={class:"text-xs text-slate-500 font-medium"},Jt={class:"overflow-x-auto rounded-xl border border-slate-200"},Gt={class:"w-full text-right text-xs"},qt={class:"divide-y divide-slate-200 text-primary-900"},zt={key:0},Lt={class:"py-3 px-2 text-center font-bold text-slate-500"},$t={class:"py-3 px-3 font-medium text-slate-900"},St={class:"py-3 px-2 text-center text-slate-600"},Ot={class:"py-3 px-2 text-center font-bold"},Kt={class:"py-3 px-3 text-center"},Ut={class:"py-3 px-3 text-center font-medium"},Yt={class:"py-3 px-3 text-center text-slate-600"},Qt={class:"py-3 px-3 text-center font-bold text-blue-700"},Xt={class:"grid grid-cols-1 md:grid-cols-12 gap-4 items-center bg-slate-900 text-white rounded-xl p-4 text-xs"},Zt={class:"md:col-span-8 space-y-1.5"},te={key:0,class:"text-slate-300"},ee={class:"text-slate-200 text-xs leading-relaxed"},se={class:"md:col-span-4 border-t md:border-t-0 md:border-r border-slate-700 pt-3 md:pt-0 md:pr-4 space-y-1.5 text-left dir-ltr"},oe={class:"flex justify-between items-center text-slate-300 dir-rtl"},ae={class:"font-bold"},ne={class:"flex justify-between items-center text-amber-400 dir-rtl"},re={class:"font-bold"},le={class:"flex justify-between items-center text-emerald-400 font-extrabold text-sm border-t border-slate-700 pt-1.5 dir-rtl"},ie={class:"text-base"},de={__name:"[id]",async setup(ce){let P,I;const V=$(),D=S(),N=j(()=>V.params.id||V.query.id),{data:C,pending:B,error:F}=([P,I]=O(()=>X("/api/user/invoice/view",{query:{id:N.value},key:`invoice-${N.value}`},"$hiJsivK8gg")),P=await P,I(),P),o=j(()=>C.value?C.value.data||C.value:null);K({title:"مشاهده پیش فاکتور"});const H=j(()=>o.value?.items?o.value.items.map((s,e)=>{const n=Number(s.quantity||0),d=Number(s.unitPrice||s.price||0),u=Number(s.totalPrice||n*d),x=Number(s.tax||Math.round(u*.1)),f=Number(s.grandTotal||u+x);return{no:s.no||e+1,title:s.title||s.productTitle||s.productName||`محصول کد ${s.productId||""}`,unit:s.unit||"کیلوگرم",quantity:n,unitPrice:d,lineTotal:u,lineTax:x,lineGrandTotal:f}}):[]),A=j(()=>
2{if(!o.value)return{subtotal:0,taxAmount:0};const s=Number(o.value.amount||0),e=Number(o.value.tax||10),n=s/(1+e/100),d=Math.round(n),u=Math.round(s-n);return{subtotal:d,taxAmount:u}}),J=s=>{if(s==null||isNaN(s)||s===0)return"صفر";const e=["","یک","دو","سه","چهار","پنج","شش","هفت","هشت","نه"],n=["","ده","بیست","سی","چهل","پنجاه","شصت","هفتاد","هشتاد","نود"],d=["","صد","دویست","سیصد","چهارصد","پانصد","ششصد","هفتصد","هشتصد","نهصد"],u=["ده","یازده","دوازده","سیزده","چهارده","پانزده","شانزده","هفده","هیجده","نوزده"],x=[""," هزار"," میلیون"," میلیارد"," تریلیون"],f=c=>{let i="";const h=Math.floor(c/100),g=Math.floor(c%100/10),_=c%10;return h>0&&(i+=d[h]),g===1?(i&&(i+=" و "),i+=u[_]):(g>1&&(i&&(i+=" و "),i+=n[g]),_>0&&(i&&(i+=" و "),i+=e[_])),i};let m=Math.abs(Math.floor(s));const w=[];for(;m>0;)w.push(m%1e3),m=Math.floor(m/1e3);const M=[];for(let c=w.length-1;c>=0;c--){const i=w[c];if(i>0){const h=f(i),g=x[c]||"";M.push(h+g)}}return M.join(" و ")},G=j(()=>{const s=Number(o.value?.amount||0);return s?`${J(s)} ریال`:"صفر ریال"}),y=tt(null),p=Z({print:!1,jpg:!1,pdf:!1}),v=s=>s==null?"۰":new Intl.NumberFormat("fa-IR").format(s),E=()=>{window.history.length>1?D.back():D.push("/user/invoice/list")},q=()=>{typeof window<"u"&&window.print()},z=async()=>{if(!y.value)return;const s=y.value,e=s.style.width,n=s.style.maxWidth;try{p.jpg=!0,s.style.width="1024px",s.style.maxWidth="none";const{toJpeg:d}=await W(async()=>{const{toJpeg:f}=await import("./DiJDg7Rm.js");return{toJpeg:f}},[],import.meta.url),u=await d(s,{quality:.95,backgroundColor:"#ffffff",cacheBust:!0,pixelRatio:2,width:1024}),x=document.createElement("a");x.download=`Invoice-${o.value?.invoiceNumber||N.value}.jpg`,x.href=u,x.click()}catch{}finally{s.style.width=e,s.style.maxWidth=n,p.jpg=!1}},L=async()=>{if(!y.value)return;const s=y.value,e=s.style.width,n=s.style.maxWidth;try{p.pdf=!0,s.style.width="1024px",s.style.maxWidth="none";const{toJpeg:d}=await W(async()=>{const{toJpeg:_}=await import("./DiJDg7Rm.js");return{toJpeg:_}},[],import.meta.url),u=await W(()=>import("./Debo9iKX.js").then(_=>_.j),__vite__mapDeps([0,1]),import.meta.url),x=u.jsPDF||u.default,f=await d(s,{quality:.98,backgroundColor:"#ffffff",pixelRatio:2,width:1024}),m=new x({orientation:"portrait",unit:"mm",format:"a4"}),w=m.internal.pageSize.getWidth(),M=m.internal.pageSize.getHeight(),c=10,i=w-c*2,h=m.getImageProperties(f),g=h.height*i/h.width;m.addImage(f,"JPEG",c,c,i,Math.min(g,M-c*2)),m.save(`Invoice-${o.value?.invoiceNumber||N.value}.pdf`)}catch{}finally{s.style.width=e,s.style.maxWidth=n,p.pdf=!1}};return(s,e)=>(l(),r("div",ot,[t("div",at,[R(B)?(l(),r("div",nt,[...e[0]||(e[0]=[t("div",{class:"animate-spin rounded-full h-10 w-10 border-b-2 border-blue-600"},null,-1),t("span",{class:"mr-3 text-slate-600 font-medium text-sm"},"در حال دریافت اطلاعات فاکتور...",-1)])])):R(F)||!o.value?(l(),r("div",rt,[e[1]||(e[1]=t("p",{class:"font-bold text-lg"},"خطا در دریافت اطلاعات فاکتور",-1)),e[2]||(e[2]=t("p",{class:"text-sm mt-1"},"امکان بازخوانی فاکتور مورد نظر وجود ندارد.",-1)),t("button",{onClick:E,class:"mt-4 px-4 py-2 bg-red-600 text-white rounded-xl text-sm font-medium hover:bg-red-700 transition"}," بازگشت ")])):(l(),r("div",lt,[t("div",it,[t("button",{onClick:E,class:"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-slate-700 bg-white border border-slate-300 rounded-xl hover:bg-slate-50 transition shadow-sm"},[...e[3]||(e[3]=[t("svg",{class:"w-4 h-4 transform rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M14 5l7 7m0 0l-7 7m7-7H3"})],-1),b(" بازگشت ",-1)])]),t("div",dt,[t("button",{onClick:q,disabled:p.print,class:"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-slate-700 bg-white border border-slate-300 rounded-xl hover:bg-slate-50 transition shadow-sm disabled:opacity-50"},[...e[4]||(e[4]=[t("svg",{class:"w-4 h-4 text-slate-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z"})],-1),b(" چاپ فاکتور ",-1)])],8,ct),t("button",{onClick:z,disabled:p.jpg,class:"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-slate-700 bg-white border border-slate-300 rounded-xl hover:bg-slate-50 transition shadow-sm disabled:opacity-50"},[p.jpg?(l(),r("div",pt)):(l(),r("svg",xt,[...e[5]||(e[5]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"},null,-1)])])),b(" "+a(p.jpg?"درحال ساخت JPG...":"دانلود JPG"),1)],8,ut),t("button",{onClick:L,disabled:p.pdf,class:"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-xl hover:bg-blue-700 transition shadow-sm disabled:opacity-50"},[p.pdf?(l(),r("div",bt)):(l(),r("svg",vt,[...e[6]||(e[6]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"},null,-1)])])),b(" "+a(p.pdf?"درحال ساخت PDF...":"دانلود PDF"),1)],8,mt)])]),t("div",ft,[t("div",{id:"printable-invoice",ref_key:"invoiceCardRef",ref:y,class:"bg-white rounded-xl shadow-xl border border-slate-200 p-6 md:p-10 print:shadow-none print:border-none print:p-0 print:rounded-none"},[t("div",ht,[e[10]||(e[10]=t("div",{class:"flex items-center gap-3"},[t("img",{src:et,alt:"لوگو آهن پرایس",class:"h-16 object-contain"})],-1)),t("div",gt,[t("div",{class:T(["inline-flex items-center gap-1.5 px-3 py-1 rounded-lg text-xs font-bold mb-2",o.value.isVerified?"bg-emerald-100 text-emerald-800":"bg-amber-100 text-amber-800"])},[t("span",{class:T(["w-2 h-2 rounded-full",o.value.isVerified?"bg-emerald-500":"bg-amber-500"])},null,2),b(" وضعیت فاکتور: "+a(o.value.isVerified?"تایید شده":"در انتظار تایید"),1)],2),t("div",_t,[t("div",null,[e[7]||(e[7]=b("شماره فاکتور: ",-1)),t("span",yt,a(o.value.invoiceNumber||"---"),1)]),t("div",null,[e[8]||(e[8]=b("تاریخ صدور: ",-1)),t("span",wt,a(o.value.date||"---"),1)]),o.value.verifiedAt?(l(),r("div",kt,[e[9]||(e[9]=b("تاریخ تایید: ",-1)),t("span",jt,a(o.value.verifiedAt),1)])):k("",!0)])])]),t("div",{class:T([{"md:grid-cols-3":o.value.author?.id!=o.value.customer?.id},"grid grid-cols-1 md:grid-cols-2 print:grid-cols-2 gap-4 py-6 border-b border-slate-200 text-xs"])},[e[13]||(e[13]=U('<div class="bg-slate-50/80 p-3.5 rounded-xl border border-slate-100" data-v-87ae0b5e><div class="font-bold text-blue-600 mb-1.5" data-v-87ae0b5e>فروشنده</div><div class="font-bold text-slate-900 text-sm mb-1" data-v-87ae0b5e>آهن پرایس</div><div class="text-slate-600 space-y-1 leading-relaxed" data-v-87ae0b5e><p data-v-87ae0b5e>تهران، شادآباد، ۴۵ متری زرند، مجتمع پارسه، پلاک ۱۳</p><p data-v-87ae0b5e>تلفن: <span class="font-bold dir-ltr inline-block" data-v-87ae0b5e>021-54103</span></p></div></div>
2',1)),t("div",Pt,[e[11]||(e[11]=t("div",{class:"font-bold text-emerald-600 mb-1.5"},"خریدار / مشتری",-1)),t("div",Nt,a(o.value.customer?.name||"---"),1),t("div",Mt,[o.value.customer?.rolename?(l(),r("p",Ct,"مجموعه: "+a(o.value.customer.rolename),1)):k("",!0),o.value.customer?.address?(l(),r("p",Tt,"آدرس: "+a(o.value.customer.address),1)):(l(),r("p",Wt,"آدرس: ثبت نشده"))])]),o.value.author?.id!=o.value.customer?.id?(l(),r("div",It,[o.value.author?.avatar?(l(),r("img",{key:0,src:o.value.author.avatar,alt:"آواتار کارشناس",class:"w-10 h-10 rounded-full object-cover border border-slate-200 mt-1"},null,8,Vt)):(l(),r("div",Dt,a(o.value.author?.name?o.value.author.name.charAt(0):"Ú©"),1)),t("div",At,[e[12]||(e[12]=t("div",{class:"font-bold text-purple-600 mb-1.5"},"کارشناس فروش",-1)),t("div",Et,a(o.value.author?.name||"کارشناس سیستم"),1),t("div",Rt,a(o.value.author?.rolename||o.value.author?.role||"دپارتمان فروش"),1)])])):k("",!0)],2),t("div",Bt,[t("div",Ft,[e[14]||(e[14]=t("h3",{class:"text-xs font-bold text-primary-900"},"اقلام پیش‌فاکتور",-1)),t("span",Ht,"تعداد اقلام: "+a(o.value.items?.length||0),1)]),t("div",Jt,[t("table",Gt,[e[16]||(e[16]=t("thead",{class:"bg-primary-900 text-white font-bold"},[t("tr",null,[t("th",{class:"py-3 px-2 text-center w-10"},"ردیف"),t("th",{class:"py-3 px-3"},"عنوان محصول"),t("th",{class:"py-3 px-2 text-center"},"واحد"),t("th",{class:"py-3 px-2 text-center"},"مقدار"),t("th",{class:"py-3 px-3 text-center"},"مبلغ واحد (ریال)"),t("th",{class:"py-3 px-3 text-center"},"مبلغ کل (ریال)"),t("th",{class:"py-3 px-3 text-center"},"ارزش افزوده (Û±Û°Ùª)"),t("th",{class:"py-3 px-3 text-center"},"جمع کل (ریال)")])],-1)),t("tbody",qt,[!o.value.items||o.value.items.length===0?(l(),r("tr",zt,[...e[15]||(e[15]=[t("td",{colspan:"8",class:"py-8 text-center text-slate-400"}," هیچ محصولی ثبت نشده است.",-1)])])):k("",!0),(l(!0),r(Y,null,Q(H.value,(n,d)=>(l(),r("tr",{key:d,class:"hover:bg-slate-50/80 transition-colors"},[t("td",Lt,a(n.no),1),t("td",$t,a(n.title),1),t("td",St,a(n.unit),1),t("td",Ot,a(v(n.quantity)),1),t("td",Kt,a(v(n.unitPrice)),1),t("td",Ut,a(v(n.lineTotal)),1),t("td",Yt,a(v(n.lineTax)),1),t("td",Qt,a(v(n.lineGrandTotal)),1)]))),128))])])])]),t("div",Xt,[t("div",Zt,[o.value.description?(l(),r("div",te,[e[17]||(e[17]=t("span",{class:"font-bold text-amber-400"},"توضیحات:",-1)),b(" "+a(o.value.description),1)])):k("",!0),t("div",ee,[e[18]||(e[18]=t("span",{class:"font-bold text-emerald-400"},"مبلغ به حروف:",-1)),b(" "+a(G.value),1)])]),t("div",se,[t("div",oe,[e[19]||(e[19]=t("span",null,"جمع کل اقلام:",-1)),t("span",ae,a(v(A.value.subtotal))+" ریال",1)]),t("div",ne,[e[20]||(e[20]=t("span",null,"جمع ارزش افزوده (Û±Û°Ùª):",-1)),t("span",re,a(v(A.value.taxAmount))+" ریال",1)]),t("div",le,[e[21]||(e[21]=t("span",null,"مبلغ قابل پرداخت:",-1)),t("span",ie,a(v(o.value.amount))+" ریال",1)])])]),e[22]||(e[22]=t("div",{class:"text-center text-xs text-rose-600 font-bold bg-rose-50 py-3 px-4 rounded-xl border border-rose-100 my-6"}," لطفاً برای ثبت نهایی پیش‌فاکتور، از طریق شماره تلفن (02154103) مراتب را به کارشناس مربوطه اطلاع دهید. ",-1)),e[23]||(e[23]=t("div",{class:"border-t border-slate-200 pt-4 flex flex-wrap justify-between items-center text-xs text-slate-400 gap-2"},[t("div",null,"آهن پرایس - ahanprice.com"),t("div",null,"تلفن: 02154103"),t("div",null,"ایمیل: [email protected]")],-1))],512)])]))])]))}},me=st(de,[["__scopeId","data-v-87ae0b5e"]]);export{me 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.