芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/public_html/invoicer.pulsehost.co.uk/public/build/assets/View-B1NOW8xw.js
import{L as W,v as X,H as C,f as v,a5 as Y,u as Z,k as B,z as ee,P as te,r as i,o as u,m as y,w as s,a,l as n,J as j,p as z,t as p,K as V,b as l,bn as S,bo as oe,c as k,O as ae,N as se}from"./main-WS8l16KQ.js";import{u as ne}from"./invoice-DVTYh_ZQ.js";import{u as re}from"./global-hjd3yXo5.js";import"./auth-BcagBUX6.js";const le={class:"fixed top-0 left-0 hidden h-full pt-16 pb-4 bg-white w-88 xl:block"},ie={class:"flex items-center justify-between px-4 pt-8 pb-6 border border-gray-200 border-solid"},de={class:"flex ml-3",role:"group","aria-label":"First group"},ce={class:"px-4 py-1 pb-2 mb-2 text-sm border-b border-gray-200 border-solid"},ue={class:"px-2"},me={class:"px-2"},pe={class:"px-2"},_e={class:"h-full pb-32 overflow-y-scroll border-l border-gray-200 border-solid sw-scroll"},fe={class:"flex-2"},ve={class:"mb-1 not-italic font-medium leading-5 text-gray-500 capitalize text-md"},ye={class:"flex-1 whitespace-nowrap right"},be={class:"text-sm text-right text-gray-500 non-italic"},he={key:0,class:"flex justify-center px-4 mt-5 text-sm text-gray-600"},ge={class:"flex flex-col min-h-0 mt-8 overflow-hidden",style:{height:"75vh"}},Be=["src"],ke={__name:"View",setup(Ie){const m=W(),d=ne(),_=re(),{tm:F}=X.useI18n();let b=C({}),t=C({orderBy:"",orderByField:"",invoice_number:""});v(null),v(null);let I=v(!1),L=v(!1);v(!1),Y("utils"),Z();const N=B(()=>d.selectedViewInvoice),$=B(()=>t.orderBy==="asc"||t.orderBy==null);B(()=>$.value?F("general.ascending"):F("general.descending"));const P=B(()=>b.unique_hash?`/invoices/pdf/${b.unique_hash}`:!1);ee(m,()=>{D()}),U(),D(),c=te.debounce(c,500);function R(e){return m.params.id==e}async function U(){await d.fetchInvoices({limit:"all"},_.companySlug),setTimeout(()=>{E()},500)}async function D(){if(m&&m.params.id){let e=await d.fetchViewInvoice({id:m.params.id},_.companySlug);e.data&&Object.assign(b,e.data.data)}}function E(){const e=document.getElementById(`invoice-${m.params.id}`);e&&(e.scrollIntoView({behavior:"smooth"}),e.classList.add("shake"))}async function c(){let e={};t.invoice_number!==""&&t.invoice_number!==null&&t.invoice_number!==void 0&&(e.invoice_number=t.invoice_number),t.orderBy!==null&&t.orderBy!==void 0&&(e.orderBy=t.orderBy),t.orderByField!==null&&t.orderByField!==void 0&&(e.orderByField=t.orderByField),I.value=!0;try{let r=await d.searchInvoice(e,_.companySlug);I.value=!1,r.data.data&&(d.invoices=r.data.data)}catch{I.value=!1}}function T(){return t.orderBy==="asc"?(t.orderBy="desc",c(),!0):(t.orderBy="asc",c(),!0)}function q(){router.push({name:"invoice.portal.payment",params:{id:d.selectedViewInvoice.id,company:d.selectedViewInvoice.company.slug}})}return(e,r)=>{const f=i("BaseIcon"),h=i("BaseButton"),A=i("BasePageHeader"),G=i("BaseInput"),w=i("BaseRadio"),x=i("BaseInputGroup"),H=i("BaseInvoiceStatusLabel"),M=i("BaseInvoiceStatusBadge"),O=i("BaseFormatMoney"),J=i("router-link"),K=i("BasePage");return u(),y(K,{class:"xl:pl-96"},{default:s(()=>[a(A,{title:N.value.invoice_number},{actions:s(()=>{var o,g;return[a(h,{disabled:n(L),variant:"primary-outline",class:"mr-2",tag:"a",href:`/invoices/pdf/${n(b).unique_hash}`,download:""},{left:s(Q=>[a(f,{name:"DownloadIcon",class:j(Q.class)},null,8,["class"]),z(" "+p(e.$t("invoices.download")),1)]),_:1},8,["disabled","href"]),((g=(o=n(d))==null?void 0:o.selectedViewInvoice)==null?void 0:g.paid_status)!=="PAID"&&n(_).enabledModules.includes("Payments")?(u(),y(h,{key:0,variant:"primary",onClick:q},{default:s(()=>[z(p(e.$t("invoices.pay_invoice")),1)]),_:1})):V("",!0)]}),_:1},8,["title"]),l("div",le,[l("div",ie,[a(G,{modelValue:n(t).invoice_number,"onUpdate:modelValue":r[0]||(r[0]=o=>n(t).invoice_number=o),placeholder:e.$t("general.search"),type:"text",variant:"gray",onInput:c},{right:s(()=>[a(f,{name:"SearchIcon",class:"h-5 text-gray-400"})]),_:1},8,["modelValue","placeholder"]),l("div",de,[a(oe,{position:"bottom-start","width-class":"w-50","position-class":"left-0"},{activator:s(()=>[a(h,{variant:"gray"},{default:s(()=>[a(f,{name:"FilterIcon",class:"h-5"})]),_:1})]),default:s(()=>[l("div",ce,p(e.$t("general.sort_by")),1),l("div",ue,[a(S,{class:"pt-3 rounded-md hover:rounded-md"},{default:s(()=>[a(x,{class:"-mt-3 font-normal"},{default:s(()=>[a(w,{id:"filter_invoice_date",modelValue:n(t).orderByField,"onUpdate:modelValue":[r[1]||(r[1]=o=>n(t).orderByField=o),c],label:e.$t("invoices.invoice_date"),name:"filter",size:"sm",value:"invoice_date"},null,8,["modelValue","label"])]),_:1})]),_:1})]),l("div",me,[a(S,{class:"pt-3 rounded-md hover:rounded-md"},{default:s(()=>[a(x,{class:"-mt-3 font-normal"},{default:s(()=>[a(w,{id:"filter_due_date",modelValue:n(t).orderByField,"onUpdate:modelValue":[r[2]||(r[2]=o=>n(t).orderByField=o),c],label:e.$t("invoices.due_date"),name:"filter",size:"sm",value:"due_date"},null,8,["modelValue","label"])]),_:1})]),_:1})]),l("div",pe,[a(S,{class:"pt-3 rounded-md hover:rounded-md"},{default:s(()=>[a(x,{class:"-mt-3 font-normal"},{default:s(()=>[a(w,{id:"filter_invoice_number",modelValue:n(t).orderByField,"onUpdate:modelValue":[r[3]||(r[3]=o=>n(t).orderByField=o),c],label:e.$t("invoices.invoice_number"),size:"sm",name:"filter",value:"invoice_number"},null,8,["modelValue","label"])]),_:1})]),_:1})])]),_:1}),a(h,{class:"ml-1",variant:"white",onClick:T},{default:s(()=>[$.value?(u(),y(f,{key:0,name:"SortAscendingIcon",class:"h-5"})):(u(),y(f,{key:1,name:"SortDescendingIcon",class:"h-5"}))]),_:1})])]),l("div",_e,[(u(!0),k(se,null,ae(n(d).invoices,(o,g)=>(u(),y(J,{id:"invoice-"+o.id,key:g,to:`/${n(_).companySlug}/customer/invoices/${o.id}/view`,class:j(["flex justify-between p-4 items-center cursor-pointer hover:bg-gray-100 border-l-4 border-transparent",{"bg-gray-100 border-l-4 border-primary-500 border-solid":R(o.id)}]),style:{"border-bottom":"1px solid rgba(185, 193, 209, 0.41)"}},{default:s(()=>[l("div",fe,[l("div",ve,p(o.invoice_number),1),a(M,{status:o.status},{default:s(()=>[a(H,{status:o.status},null,8,["status"])]),_:2},1032,["status"])]),l("div",ye,[a(O,{class:"mb-2 text-xl not-italic font-semibold leading-8 text-right text-gray-900 block",amount:o.total,currency:o.currency},null,8,["amount","currency"]),l("div",be,p(o.formatted_invoice_date),1)])]),_:2},1032,["id","to","class"]))),128)),n(d).invoices.length?V("",!0):(u(),k("p",he,p(e.$t("invoices.no_matching_invoices")),1))])]),l("div",ge,[P.value?(u(),k("iframe",{key:0,ref:"report",src:P.value,class:"flex-1 border border-gray-400 border-solid rounded-md",onClick:r[4]||(r[4]=(...o)=>e.ViewReportsPDF&&e.ViewReportsPDF(...o))},null,8,Be)):V("",!0)])]),_:1})}}};export{ke as default};