芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/public_html/invoicer.pulsehost.co.uk/public/build/assets/View-BIDzNcoZ.js
import{a8 as M,L as N,v as O,f as P,H as L,P as ee,k as E,r as c,o as a,c as B,b as r,a as t,w as n,l,t as h,m as i,N as G,O as X,K as u,J as q,p as V,Z as te,E as se,a5 as J,z as ae,n as le,a7 as ne,M as oe,e as re,Q as S}from"./main-WS8l16KQ.js";import{L as ce}from"./LoadingIcon-CwHf8WZC.js";import{_ as ie}from"./LineChart-D50EaxrS.js";import{_ as ue}from"./CustomerIndexDropdown-CqPzpnw2.js";const de={class:"fixed top-0 left-0 hidden h-full pt-16 pb-[6.6rem] ml-56 bg-white xl:ml-64 w-88 xl:block"},me={class:"flex items-center justify-between px-4 pt-8 pb-2 border border-gray-200 border-solid height-full"},_e={class:"flex mb-6 ml-3",role:"group","aria-label":"First group"},pe={class:"px-4 py-3 pb-2 mb-2 text-sm border-b border-gray-200 border-solid"},fe={class:"px-2"},he={class:"px-2"},ye={class:"flex-1 font-bold text-right whitespace-nowrap"},ge={key:0,class:"flex justify-center p-4 items-center"},ve={key:1,class:"flex justify-center px-4 mt-5 text-sm text-gray-600"},be={__name:"CustomerViewSidebar",setup(R){const k=M(),s=N(),{t:m}=O.useI18n();let p=P(!1),e=L({orderBy:null,orderByField:null,searchText:null});const d=P(null),C=P(1),_=P(1),I=P(null);b=ee.debounce(b,500);const y=E(()=>e.orderBy==="asc"||e.orderBy==null);E(()=>y.value?m("general.ascending"):m("general.descending"));function $(o){return s.params.id==o}async function v(o,g=!1){if(p.value)return;let T={};e.searchText!==""&&e.searchText!==null&&e.searchText!==void 0&&(T.display_name=e.searchText),e.orderBy!==null&&e.orderBy!==void 0&&(T.orderBy=e.orderBy),e.orderByField!==null&&e.orderByField!==void 0&&(T.orderByField=e.orderByField),p.value=!0;let A=await k.fetchCustomers({page:o,...T,limit:15});p.value=!1,d.value=d.value?d.value:[],d.value=[...d.value,...A.data.data],C.value=o||1,_.value=A.data.meta.last_page;let F=d.value.find(j=>j.id==s.params.id);g==!1&&!F&&C.value<_.value&&Object.keys(T).length===0&&v(++C.value),F&&setTimeout(()=>{g==!1&&w()},500)}function w(){const o=document.getElementById(`customer-${s.params.id}`);o&&(o.scrollIntoView({behavior:"smooth"}),o.classList.add("shake"),D())}function D(){I.value.addEventListener("scroll",o=>{o.target.scrollTop>0&&o.target.scrollTop+o.target.clientHeight>o.target.scrollHeight-200&&C.value<_.value&&v(++C.value,!0)})}async function b(){d.value=[],v()}function f(){return e.orderBy==="asc"?(e.orderBy="desc",b(),!0):(e.orderBy="asc",b(),!0)}return v(),(o,g)=>{var Y;const T=c("BaseIcon"),A=c("BaseInput"),F=c("BaseButton"),j=c("BaseRadio"),U=c("BaseInputGroup"),z=c("BaseDropdownItem"),K=c("BaseDropdown"),H=c("BaseText"),Q=c("BaseFormatMoney"),Z=c("router-link");return a(),B("div",de,[r("div",me,[t(A,{modelValue:l(e).searchText,"onUpdate:modelValue":g[0]||(g[0]=x=>l(e).searchText=x),placeholder:o.$t("general.search"),"container-class":"mb-6",type:"text",variant:"gray",onInput:g[1]||(g[1]=x=>b())},{default:n(()=>[t(T,{name:"SearchIcon",class:"text-gray-500"})]),_:1},8,["modelValue","placeholder"]),r("div",_e,[t(K,{"close-on-select":!1,position:"bottom-start","width-class":"w-40","position-class":"left-0"},{activator:n(()=>[t(F,{variant:"gray"},{default:n(()=>[t(T,{name:"FilterIcon"})]),_:1})]),default:n(()=>[r("div",pe,h(o.$t("general.sort_by")),1),r("div",fe,[t(z,{class:"flex px-1 py-2 mt-1 cursor-pointer hover:rounded-md"},{default:n(()=>[t(U,{class:"pt-2 -mt-4"},{default:n(()=>[t(j,{id:"filter_create_date",modelValue:l(e).orderByField,"onUpdate:modelValue":[g[2]||(g[2]=x=>l(e).orderByField=x),b],label:o.$t("customers.create_date"),size:"sm",name:"filter",value:"invoices.created_at"},null,8,["modelValue","label"])]),_:1})]),_:1})]),r("div",he,[t(z,{class:"flex px-1 cursor-pointer hover:rounded-md"},{default:n(()=>[t(U,{class:"pt-2 -mt-4"},{default:n(()=>[t(j,{id:"filter_display_name",modelValue:l(e).orderByField,"onUpdate:modelValue":[g[3]||(g[3]=x=>l(e).orderByField=x),b],label:o.$t("customers.display_name"),size:"sm",name:"filter",value:"name"},null,8,["modelValue","label"])]),_:1})]),_:1})])]),_:1}),t(F,{class:"ml-1",size:"md",variant:"gray",onClick:f},{default:n(()=>[y.value?(a(),i(T,{key:0,name:"SortAscendingIcon"})):(a(),i(T,{key:1,name:"SortDescendingIcon"}))]),_:1})])]),r("div",{ref_key:"customerListSection",ref:I,class:"h-full overflow-y-scroll border-l border-gray-200 border-solid sidebar base-scroll"},[(a(!0),B(G,null,X(d.value,(x,W)=>(a(),B("div",{key:W},[x?(a(),i(Z,{key:0,id:"customer-"+x.id,to:`/admin/customers/${x.id}/view`,class:q(["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":$(x.id)}]),style:{"border-top":"1px solid rgba(185, 193, 209, 0.41)"}},{default:n(()=>[r("div",null,[t(H,{text:x.name,class:"pr-2 text-sm not-italic font-normal leading-5 text-black capitalize truncate"},null,8,["text"]),x.contact_name?(a(),i(H,{key:0,text:x.contact_name,class:"mt-1 text-xs not-italic font-medium leading-5 text-gray-600"},null,8,["text"])):u("",!0)]),r("div",ye,[t(Q,{amount:x.due_amount!==null?x.due_amount:0,currency:x.currency},null,8,["amount","currency"])])]),_:2},1032,["id","to","class"])):u("",!0)]))),128)),l(p)?(a(),B("div",ge,[t(ce,{class:"h-6 m-1 animate-spin text-primary-400"})])):u("",!0),!((Y=d.value)!=null&&Y.length)&&!l(p)?(a(),B("p",ve,h(o.$t("customers.no_matching_customers")),1)):u("",!0)],512)])}}},xe={class:"pt-6 mt-5 border-t border-solid lg:pt-8 md:pt-4 border-gray-200"},Be={key:0,class:"text-sm font-bold leading-5 text-black non-italic"},$e={key:0},we={key:1},ke={key:1,class:"text-sm font-bold leading-5 text-black non-italic"},Ce={__name:"CustomerInfo",setup(R){const k=M(),s=E(()=>k.selectedViewCustomer),m=E(()=>k.isFetchingViewData),p=E(()=>{var e,d;return(e=s==null?void 0:s.value)!=null&&e.fields?(d=s==null?void 0:s.value)==null?void 0:d.fields:[]});return(e,d)=>{const C=c("BaseHeading"),_=c("BaseDescriptionListItem"),I=c("BaseDescriptionList"),y=c("BaseCustomerAddressDisplay");return a(),B("div",xe,[t(C,null,{default:n(()=>[V(h(e.$t("customers.basic_info")),1)]),_:1}),t(I,null,{default:n(()=>{var $,v,w;return[s.value.name?(a(),i(_,{key:0,"content-loading":m.value,label:e.$t("customers.display_name"),value:($=s.value)==null?void 0:$.name},null,8,["content-loading","label","value"])):u("",!0),s.value.contact_name?(a(),i(_,{key:1,"content-loading":m.value,label:e.$t("customers.primary_contact_name"),value:(v=s.value)==null?void 0:v.contact_name},null,8,["content-loading","label","value"])):u("",!0),s.value.email?(a(),i(_,{key:2,"content-loading":m.value,label:e.$t("customers.email"),value:(w=s.value)==null?void 0:w.email},null,8,["content-loading","label","value"])):u("",!0)]}),_:1}),t(I,{class:"mt-5"},{default:n(()=>{var $,v,w,D,b,f,o;return[t(_,{"content-loading":m.value,label:e.$t("wizard.currency"),value:($=s.value)!=null&&$.currency?`${(w=(v=s.value)==null?void 0:v.currency)==null?void 0:w.code} (${(b=(D=s.value)==null?void 0:D.currency)==null?void 0:b.symbol})`:""},null,8,["content-loading","label","value"]),s.value.phone?(a(),i(_,{key:0,"content-loading":m.value,label:e.$t("customers.phone_number"),value:(f=s.value)==null?void 0:f.phone},null,8,["content-loading","label","value"])):u("",!0),s.value.website?(a(),i(_,{key:1,"content-loading":m.value,label:e.$t("customers.website"),value:(o=s.value)==null?void 0:o.website},null,8,["content-loading","label","value"])):u("",!0)]}),_:1}),s.value.billing||s.value.shipping?(a(),i(C,{key:0,class:"mt-8"},{default:n(()=>[V(h(e.$t("customers.address")),1)]),_:1})):u("",!0),t(I,{class:"mt-5"},{default:n(()=>[s.value.billing?(a(),i(_,{key:0,"content-loading":m.value,label:e.$t("customers.billing_address")},{default:n(()=>[t(y,{address:s.value.billing},null,8,["address"])]),_:1},8,["content-loading","label"])):u("",!0),s.value.shipping?(a(),i(_,{key:1,"content-loading":m.value,label:e.$t("customers.shipping_address")},{default:n(()=>[t(y,{address:s.value.shipping},null,8,["address"])]),_:1},8,["content-loading","label"])):u("",!0)]),_:1}),p.value.length>0?(a(),i(C,{key:1,class:"mt-8"},{default:n(()=>[V(h(e.$t("settings.custom_fields.title")),1)]),_:1})):u("",!0),t(I,{class:"mt-5"},{default:n(()=>[(a(!0),B(G,null,X(p.value,($,v)=>(a(),i(_,{key:v,"content-loading":m.value,label:$.custom_field.label},{default:n(()=>[$.type==="Switch"?(a(),B("p",Be,[$.default_answer===1?(a(),B("span",$e,h(e.$t("general.yes")),1)):(a(),B("span",we,h(e.$t("general.no")),1))])):(a(),B("p",ke,h($.default_answer),1))]),_:2},1032,["content-loading","label"]))),128))]),_:1})])}}},Te={},Ee={class:"col-span-12 xl:col-span-9 xxl:col-span-10"},Ie={class:"flex justify-between mt-1 mb-6"},De={class:"grid col-span-12 mt-6 text-center xl:mt-0 sm:grid-cols-4 xl:text-right xl:col-span-3 xl:grid-cols-1 xxl:col-span-2"},Se={class:"flex flex-col items-center justify-center px-6 py-2 lg:justify-end lg:items-end"},Ve={class:"flex flex-col items-center justify-center px-6 py-2 lg:justify-end lg:items-end"},Ae={class:"flex flex-col items-center justify-center px-6 py-2 lg:justify-end lg:items-end"},Pe={class:"flex flex-col items-center justify-center px-6 py-2 lg:justify-end lg:items-end"};function Fe(R,k){const s=c("BaseContentPlaceholdersText"),m=c("BaseContentPlaceholdersBox"),p=c("BaseContentPlaceholders");return a(),i(p,{class:"grid grid-cols-12"},{default:n(()=>[r("div",Ee,[r("div",Ie,[t(s,{class:"h-10 w-36",lines:1}),t(s,{class:"h-10 w-40 !mt-0",lines:1})]),t(m,{class:"h-80 xl:h-72 sm:w-full"})]),r("div",De,[r("div",Se,[t(s,{class:"h-3 w-14 xl:h-4",lines:1}),t(s,{class:"w-20 h-5 xl:h-6",lines:1})]),r("div",Ve,[t(s,{class:"h-3 w-14 xl:h-4",lines:1}),t(s,{class:"w-20 h-5 xl:h-6",lines:1})]),r("div",Ae,[t(s,{class:"h-3 w-14 xl:h-4",lines:1}),t(s,{class:"w-20 h-5 xl:h-6",lines:1})]),r("div",Pe,[t(s,{class:"h-3 w-14 xl:h-4",lines:1}),t(s,{class:"w-20 h-5 xl:h-6",lines:1})])])]),_:1})}const je=te(Te,[["render",Fe]]),Re={key:1,class:"grid grid-cols-12"},Le={class:"col-span-12 xl:col-span-9 xxl:col-span-10"},Me={class:"flex justify-between mt-1 mb-6"},Ne={class:"flex items-center"},Oe={class:"w-40 h-10"},Ue={class:"grid col-span-12 mt-6 text-center xl:mt-0 sm:grid-cols-4 xl:text-right xl:col-span-3 xl:grid-cols-1 xxl:col-span-2"},ze={class:"px-6 py-2"},He={class:"text-xs leading-5 lg:text-sm"},Ye=r("br",null,null,-1),Ge={key:0,class:"block mt-1 text-xl font-semibold leading-8"},Xe={class:"px-6 py-2"},qe={class:"text-xs leading-5 lg:text-sm"},Je=r("br",null,null,-1),Ke={key:0,class:"block mt-1 text-xl font-semibold leading-8",style:{color:"#00c99c"}},Qe={class:"px-6 py-2"},Ze={class:"text-xs leading-5 lg:text-sm"},We=r("br",null,null,-1),et={key:0,class:"block mt-1 text-xl font-semibold leading-8",style:{color:"#fb7178"}},tt={class:"px-6 py-2"},st={class:"text-xs leading-5 lg:text-sm"},at=r("br",null,null,-1),lt={key:0,class:"block mt-1 text-xl font-semibold leading-8",style:{color:"#5851d8"}},nt={__name:"CustomerChart",setup(R){se();const k=M();J("utils");const{t:s}=O.useI18n(),m=N();let p=P(!1),e=L({}),d=L({}),C=L([{label:s("dateRange.this_year"),value:"This year"},{label:s("dateRange.previous_year"),value:"Previous year"}]),_=P("This year");const I=E(()=>e.expenseTotals?e.expenseTotals:[]),y=E(()=>e.netProfits?e.netProfits:[]),$=E(()=>e&&e.months?e.months:[]),v=E(()=>e.receiptTotals?e.receiptTotals:[]),w=E(()=>e.invoiceTotals?e.invoiceTotals:[]);ae(m,()=>{m.params.id&&D(),_.value="This year"},{immediate:!0});async function D(){p.value=!1;let f=await k.fetchViewCustomer({id:m.params.id});f.data&&(Object.assign(e,f.data.meta.chartData),Object.assign(d,f.data.data)),p.value=!0}async function b(f){let o={id:m.params.id};f==="Previous year"?o.previous_year=!0:o.this_year=!0;let g=await k.fetchViewCustomer(o);return g.data.meta.chartData&&Object.assign(e,g.data.meta.chartData),!0}return(f,o)=>{const g=c("BaseIcon"),T=c("BaseMultiselect"),A=c("BaseFormatMoney"),F=c("BaseCard");return a(),i(F,{class:"flex flex-col mt-6"},{default:n(()=>[l(k).isFetchingViewData?(a(),i(je,{key:0})):(a(),B("div",Re,[r("div",Le,[r("div",Me,[r("h6",Ne,[t(g,{name:"ChartSquareBarIcon",class:"h-5 text-primary-400"}),V(" "+h(f.$t("dashboard.monthly_chart.title")),1)]),r("div",Oe,[t(T,{modelValue:l(_),"onUpdate:modelValue":o[0]||(o[0]=j=>le(_)?_.value=j:_=j),options:l(C),"allow-empty":!1,"show-labels":!1,placeholder:f.$t("dashboard.select_year"),"can-deselect":!1,onSelect:b},null,8,["modelValue","options","placeholder"])])]),l(p)?(a(),i(ie,{key:0,invoices:w.value,expenses:I.value,receipts:v.value,income:y.value,labels:$.value,class:"sm:w-full"},null,8,["invoices","expenses","receipts","income","labels"])):u("",!0)]),r("div",Ue,[r("div",ze,[r("span",He,h(f.$t("dashboard.chart_info.total_sales")),1),Ye,l(p)?(a(),B("span",Ge,[t(A,{amount:l(e).salesTotal,currency:l(d).currency},null,8,["amount","currency"])])):u("",!0)]),r("div",Xe,[r("span",qe,h(f.$t("dashboard.chart_info.total_receipts")),1),Je,l(p)?(a(),B("span",Ke,[t(A,{amount:l(e).totalExpenses,currency:l(d).currency},null,8,["amount","currency"])])):u("",!0)]),r("div",Qe,[r("span",Ze,h(f.$t("dashboard.chart_info.total_expense")),1),We,l(p)?(a(),B("span",et,[t(A,{amount:l(e).totalExpenses,currency:l(d).currency},null,8,["amount","currency"])])):u("",!0)]),r("div",tt,[r("span",st,h(f.$t("dashboard.chart_info.net_income")),1),at,l(p)?(a(),B("span",lt,[t(A,{amount:l(e).netProfit,currency:l(d).currency},null,8,["amount","currency"])])):u("",!0)])])])),t(Ce)]),_:1})}}},ut={__name:"View",setup(R){J("utils"),ne();const k=M(),s=oe();O.useI18n();const m=re(),p=N();P(null);const e=E(()=>k.selectedViewCustomer.customer?k.selectedViewCustomer.customer.name:"");let d=E(()=>k.isFetchingViewData);function C(){return s.hasAbilities([S.CREATE_ESTIMATE,S.CREATE_INVOICE,S.CREATE_PAYMENT,S.CREATE_EXPENSE])}function _(){return s.hasAbilities([S.DELETE_CUSTOMER,S.EDIT_CUSTOMER])}function I(){m.push("/admin/customers")}return(y,$)=>{const v=c("BaseButton"),w=c("router-link"),D=c("BaseIcon"),b=c("BaseDropdownItem"),f=c("BaseDropdown"),o=c("BasePageHeader"),g=c("BasePage");return a(),i(g,{class:"xl:pl-96"},{default:n(()=>[t(o,{title:e.value},{actions:n(()=>[l(s).hasAbilities(l(S).EDIT_CUSTOMER)?(a(),i(w,{key:0,to:`/admin/customers/${l(p).params.id}/edit`},{default:n(()=>[t(v,{class:"mr-3",variant:"primary-outline","content-loading":l(d)},{default:n(()=>[V(h(y.$t("general.edit")),1)]),_:1},8,["content-loading"])]),_:1},8,["to"])):u("",!0),C()?(a(),i(f,{key:1,position:"bottom-end","content-loading":l(d)},{activator:n(()=>[t(v,{class:"mr-3",variant:"primary","content-loading":l(d)},{default:n(()=>[V(h(y.$t("customers.new_transaction")),1)]),_:1},8,["content-loading"])]),default:n(()=>[l(s).hasAbilities(l(S).CREATE_ESTIMATE)?(a(),i(w,{key:0,to:`/admin/estimates/create?customer=${y.$route.params.id}`},{default:n(()=>[t(b,{class:""},{default:n(()=>[t(D,{name:"DocumentIcon",class:"mr-3 text-gray-600"}),V(" "+h(y.$t("estimates.new_estimate")),1)]),_:1})]),_:1},8,["to"])):u("",!0),l(s).hasAbilities(l(S).CREATE_INVOICE)?(a(),i(w,{key:1,to:`/admin/invoices/create?customer=${y.$route.params.id}`},{default:n(()=>[t(b,null,{default:n(()=>[t(D,{name:"DocumentTextIcon",class:"mr-3 text-gray-600"}),V(" "+h(y.$t("invoices.new_invoice")),1)]),_:1})]),_:1},8,["to"])):u("",!0),l(s).hasAbilities(l(S).CREATE_PAYMENT)?(a(),i(w,{key:2,to:`/admin/payments/create?customer=${y.$route.params.id}`},{default:n(()=>[t(b,null,{default:n(()=>[t(D,{name:"CreditCardIcon",class:"mr-3 text-gray-600"}),V(" "+h(y.$t("payments.new_payment")),1)]),_:1})]),_:1},8,["to"])):u("",!0),l(s).hasAbilities(l(S).CREATE_EXPENSE)?(a(),i(w,{key:3,to:`/admin/expenses/create?customer=${y.$route.params.id}`},{default:n(()=>[t(b,null,{default:n(()=>[t(D,{name:"CalculatorIcon",class:"mr-3 text-gray-600"}),V(" "+h(y.$t("expenses.new_expense")),1)]),_:1})]),_:1},8,["to"])):u("",!0)]),_:1},8,["content-loading"])):u("",!0),_()?(a(),i(ue,{key:2,class:q({"ml-3":l(d)}),row:l(k).selectedViewCustomer,"load-data":I},null,8,["class","row"])):u("",!0)]),_:1},8,["title"]),t(be),t(nt)]),_:1})}}};export{ut as default};