芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/public_html/invoicer.pulsehost.co.uk/public/build/assets/Dashboard-BLeFFgIs.js
import{D as F,_ as R,a as W}from"./EstimateIcon-D7p0cM8S.js";import{o as r,c as C,J as j,b as t,Z as S,r as d,m as p,w as i,a as s,a2 as z,t as h,a3 as q,a4 as H,s as U,a1 as Z,a5 as N,E as O,M as T,l as e,Q as _,K as w,p as g,v as L,f as B,z as J,k as V,a6 as M,L as K,e as Q,X}from"./main-WS8l16KQ.js";import{_ as Y}from"./LineChart-D50EaxrS.js";import{_ as G}from"./InvoiceIndexDropdown-CjyfKQRg.js";import{_ as tt}from"./EstimateIndexDropdown-CleJd-3F.js";const et=t("circle",{cx:"25",cy:"25",r:"25",fill:"#EAF1FB"},null,-1),at=t("path",{d:"M28.2656 23.0547C27.3021 24.0182 26.1302 24.5 24.75 24.5C23.3698 24.5 22.1849 24.0182 21.1953 23.0547C20.2318 22.0651 19.75 20.8802 19.75 19.5C19.75 18.1198 20.2318 16.9479 21.1953 15.9844C22.1849 14.9948 23.3698 14.5 24.75 14.5C26.1302 14.5 27.3021 14.9948 28.2656 15.9844C29.2552 16.9479 29.75 18.1198 29.75 19.5C29.75 20.8802 29.2552 22.0651 28.2656 23.0547ZM28.2656 25.75C29.6979 25.75 30.9219 26.2708 31.9375 27.3125C32.9792 28.3281 33.5 29.5521 33.5 30.9844V32.625C33.5 33.1458 33.3177 33.5885 32.9531 33.9531C32.5885 34.3177 32.1458 34.5 31.625 34.5H17.875C17.3542 34.5 16.9115 34.3177 16.5469 33.9531C16.1823 33.5885 16 33.1458 16 32.625V30.9844C16 29.5521 16.5078 28.3281 17.5234 27.3125C18.5651 26.2708 19.8021 25.75 21.2344 25.75H21.8984C22.8099 26.1667 23.7604 26.375 24.75 26.375C25.7396 26.375 26.6901 26.1667 27.6016 25.75H28.2656Z",fill:"currentColor"},null,-1),st=[et,at],ot={__name:"CustomerIcon",props:{colorClass:{type:String,default:"text-primary-500"}},setup(u){return(a,o)=>(r(),C("svg",{width:"50",height:"50",viewBox:"0 0 50 50",class:j(u.colorClass),fill:"none",xmlns:"http://www.w3.org/2000/svg"},st,2))}},lt={},nt={class:"flex items-center"};function ct(u,a){const o=d("BaseContentPlaceholdersText"),n=d("BaseContentPlaceholdersBox"),c=d("BaseContentPlaceholders");return r(),p(c,{rounded:!0,class:"relative flex justify-between w-full p-3 bg-white rounded shadow lg:col-span-3 xl:p-4"},{default:i(()=>[t("div",null,[s(o,{class:"h-5 -mb-1 w-14 xl:mb-6 xl:h-7",lines:1}),s(o,{class:"h-3 w-28 xl:h-4",lines:1})]),t("div",nt,[s(n,{circle:!0,class:"w-10 h-10 xl:w-12 xl:h-12"})])]),_:1})}const rt=S(lt,[["render",ct]]),it={},dt={class:"flex items-center"};function ut(u,a){const o=d("BaseContentPlaceholdersText"),n=d("BaseContentPlaceholdersBox"),c=d("BaseContentPlaceholders");return r(),p(c,{rounded:!0,class:"relative flex justify-between w-full p-3 bg-white rounded shadow lg:col-span-2 xl:p-4"},{default:i(()=>[t("div",null,[s(o,{class:"w-12 h-5 -mb-1 xl:mb-6 xl:h-7",lines:1}),s(o,{class:"w-20 h-3 xl:h-4",lines:1})]),t("div",dt,[s(n,{circle:!0,class:"w-10 h-10 xl:w-12 xl:h-12"})])]),_:1})}const mt=S(it,[["render",ut]]),_t={class:"text-xl font-semibold leading-tight text-black xl:text-3xl"},ht={class:"block mt-1 text-sm leading-tight text-gray-500 xl:text-lg"},pt={class:"flex items-center"},I={__name:"DashboardStatsItem",props:{iconComponent:{type:Object,required:!0},loading:{type:Boolean,default:!1},route:{type:String,required:!0},label:{type:String,required:!0},large:{type:Boolean,default:!1}},setup(u){return(a,o)=>{const n=d("router-link");return u.loading?u.large?(r(),p(rt,{key:1})):(r(),p(mt,{key:2})):(r(),p(n,{key:0,class:j(["relative flex justify-between p-3 bg-white rounded shadow hover:bg-gray-50 xl:p-4 lg:col-span-2",{"lg:!col-span-3":u.large}]),to:u.route},{default:i(()=>[t("div",null,[t("span",_t,[z(a.$slots,"default")]),t("span",ht,h(u.label),1)]),t("div",pt,[(r(),p(q(u.iconComponent),{class:"w-10 h-10 xl:w-12 xl:h-12"}))])]),_:3},8,["class","to"]))}}},k=(u=!1)=>(u?window.pinia.defineStore:H)({id:"dashboard",state:()=>({stats:{totalAmountDue:0,totalCustomerCount:0,totalInvoiceCount:0,totalEstimateCount:0},chartData:{months:[],invoiceTotals:[],expenseTotals:[],receiptTotals:[],netIncomeTotals:[]},totalSales:null,totalReceipts:null,totalExpenses:null,totalNetIncome:null,recentDueInvoices:[],recentEstimates:[],isDashboardDataLoaded:!1}),actions:{loadData(o){return new Promise((n,c)=>{U.get("/api/v1/dashboard",{params:o}).then(l=>{this.stats.totalAmountDue=l.data.total_amount_due,this.stats.totalCustomerCount=l.data.total_customer_count,this.stats.totalInvoiceCount=l.data.total_invoice_count,this.stats.totalEstimateCount=l.data.total_estimate_count,this.chartData&&l.data.chart_data&&(this.chartData.months=l.data.chart_data.months,this.chartData.invoiceTotals=l.data.chart_data.invoice_totals,this.chartData.expenseTotals=l.data.chart_data.expense_totals,this.chartData.receiptTotals=l.data.chart_data.receipt_totals,this.chartData.netIncomeTotals=l.data.chart_data.net_income_totals),this.totalSales=l.data.total_sales,this.totalReceipts=l.data.total_receipts,this.totalExpenses=l.data.total_expenses,this.totalNetIncome=l.data.total_net_income,this.recentDueInvoices=l.data.recent_due_invoices,this.recentEstimates=l.data.recent_estimates,this.isDashboardDataLoaded=!0,n(l)}).catch(l=>{Z(l),c(l)})})}}})(),bt={class:"grid gap-6 sm:grid-cols-2 lg:grid-cols-9 xl:gap-8"},ft={__name:"DashboardStats",setup(u){N("utils");const a=k(),o=O(),n=T();return(c,l)=>{const f=d("BaseFormatMoney");return r(),C("div",bt,[e(n).hasAbilities(e(_).VIEW_INVOICE)?(r(),p(I,{key:0,"icon-component":F,loading:!e(a).isDashboardDataLoaded,route:"/admin/invoices",large:!0,label:c.$t("dashboard.cards.due_amount")},{default:i(()=>[s(f,{amount:e(a).stats.totalAmountDue,currency:e(o).selectedCompanyCurrency},null,8,["amount","currency"])]),_:1},8,["loading","label"])):w("",!0),e(n).hasAbilities(e(_).VIEW_CUSTOMER)?(r(),p(I,{key:1,"icon-component":ot,loading:!e(a).isDashboardDataLoaded,route:"/admin/customers",label:e(a).stats.totalCustomerCount<=1?c.$t("dashboard.cards.customers",1):c.$t("dashboard.cards.customers",2)},{default:i(()=>[g(h(e(a).stats.totalCustomerCount),1)]),_:1},8,["loading","label"])):w("",!0),e(n).hasAbilities(e(_).VIEW_INVOICE)?(r(),p(I,{key:2,"icon-component":R,loading:!e(a).isDashboardDataLoaded,route:"/admin/invoices",label:e(a).stats.totalInvoiceCount<=1?c.$t("dashboard.cards.invoices",1):c.$t("dashboard.cards.invoices",2)},{default:i(()=>[g(h(e(a).stats.totalInvoiceCount),1)]),_:1},8,["loading","label"])):w("",!0),e(n).hasAbilities(e(_).VIEW_ESTIMATE)?(r(),p(I,{key:3,"icon-component":W,loading:!e(a).isDashboardDataLoaded,route:"/admin/estimates",label:e(a).stats.totalEstimateCount<=1?c.$t("dashboard.cards.estimates",1):c.$t("dashboard.cards.estimates",2)},{default:i(()=>[g(h(e(a).stats.totalEstimateCount),1)]),_:1},8,["loading","label"])):w("",!0)])}}},xt={},gt={class:"grid grid-cols-1 col-span-10 px-4 py-5 lg:col-span-7 xl:col-span-8 sm:p-8"},yt={class:"flex items-center justify-between mb-2 xl:mb-4"},Ct={class:"grid grid-cols-3 col-span-10 text-center border-t border-l border-gray-200 border-solid lg:border-t-0 lg:text-right lg:col-span-3 xl:col-span-2 lg:grid-cols-1"},vt={class:"flex flex-col items-center justify-center p-6 lg:justify-end lg:items-end"},wt={class:"flex flex-col items-center justify-center p-6 lg:justify-end lg:items-end"},$t={class:"flex flex-col items-center justify-center p-6 lg:justify-end lg:items-end"},Dt={class:"flex flex-col items-center justify-center col-span-3 p-6 border-t border-gray-200 border-solid lg:justify-end lg:items-end lg:col-span-1"};function Et(u,a){const o=d("BaseContentPlaceholdersText"),n=d("BaseContentPlaceholdersBox"),c=d("BaseContentPlaceholders");return r(),p(c,{class:"grid grid-cols-10 mt-8 bg-white rounded shadow"},{default:i(()=>[t("div",gt,[t("div",yt,[s(o,{class:"h-10 w-36",lines:1}),s(o,{class:"h-10 w-36 !mt-0",lines:1})]),s(n,{class:"h-80 xl:h-72 sm:w-full"})]),t("div",Ct,[t("div",vt,[s(o,{class:"h-3 w-14 xl:h-4",lines:1}),s(o,{class:"w-20 h-5 xl:h-6",lines:1})]),t("div",wt,[s(o,{class:"h-3 w-14 xl:h-4",lines:1}),s(o,{class:"w-20 h-5 xl:h-6",lines:1})]),t("div",$t,[s(o,{class:"h-3 w-14 xl:h-4",lines:1}),s(o,{class:"w-20 h-5 xl:h-6",lines:1})]),t("div",Dt,[s(o,{class:"h-3 w-14 xl:h-4",lines:1}),s(o,{class:"w-20 h-5 xl:h-6",lines:1})])])]),_:1})}const It=S(xt,[["render",Et]]),Bt={key:0,class:"grid grid-cols-10 mt-8 bg-white rounded shadow"},Tt={class:"grid grid-cols-1 col-span-10 px-4 py-5 lg:col-span-7 xl:col-span-8 sm:p-6"},St={class:"flex justify-between mt-1 mb-4 flex-col md:flex-row"},kt={class:"flex items-center sw-section-title h-10"},At={class:"w-full my-2 md:m-0 md:w-40 h-10"},Pt={class:"grid grid-cols-3 col-span-10 text-center border-t border-l border-gray-200 border-solid lg:border-t-0 lg:text-right lg:col-span-3 xl:col-span-2 lg:grid-cols-1"},Vt={class:"p-6"},Mt={class:"text-xs leading-5 lg:text-sm"},jt=t("br",null,null,-1),Nt={class:"block mt-1 text-xl font-semibold leading-8 lg:text-2xl"},Ot={class:"p-6"},Lt={class:"text-xs leading-5 lg:text-sm"},Ft=t("br",null,null,-1),Rt={class:"block mt-1 text-xl font-semibold leading-8 lg:text-2xl text-green-400"},Wt={class:"p-6"},zt={class:"text-xs leading-5 lg:text-sm"},qt=t("br",null,null,-1),Ht={class:"block mt-1 text-xl font-semibold leading-8 lg:text-2xl text-red-400"},Ut={class:"col-span-3 p-6 border-t border-gray-200 border-solid lg:col-span-1"},Zt={class:"text-xs leading-5 lg:text-sm"},Jt=t("br",null,null,-1),Kt={class:"block mt-1 text-xl font-semibold leading-8 lg:text-2xl text-primary-500"},Qt={__name:"DashboardChart",setup(u){const a=k(),o=O(),{t:n}=L.useI18n();N("utils");const c=T(),l=B([{label:n("dateRange.this_year"),value:"This year"},{label:n("dateRange.previous_year"),value:"Previous year"}]),f=B("This year");J(f,b=>{b==="Previous year"?D({previous_year:!0}):D()},{immediate:!0});async function D(b){c.hasAbilities(_.DASHBOARD)&&await a.loadData(b)}return(b,$)=>{const x=d("BaseIcon"),v=d("BaseMultiselect"),y=d("BaseFormatMoney");return r(),C("div",null,[e(a).isDashboardDataLoaded?(r(),C("div",Bt,[t("div",Tt,[t("div",St,[t("h6",kt,[s(x,{name:"ChartSquareBarIcon",class:"text-primary-400 mr-1"}),g(" "+h(b.$t("dashboard.monthly_chart.title")),1)]),t("div",At,[s(v,{modelValue:f.value,"onUpdate:modelValue":$[0]||($[0]=E=>f.value=E),options:l.value,"allow-empty":!1,"show-labels":!1,placeholder:b.$t("dashboard.select_year"),"can-deselect":!1},null,8,["modelValue","options","placeholder"])])]),s(Y,{invoices:e(a).chartData.invoiceTotals,expenses:e(a).chartData.expenseTotals,receipts:e(a).chartData.receiptTotals,income:e(a).chartData.netIncomeTotals,labels:e(a).chartData.months,class:"sm:w-full"},null,8,["invoices","expenses","receipts","income","labels"])]),t("div",Pt,[t("div",Vt,[t("span",Mt,h(b.$t("dashboard.chart_info.total_sales")),1),jt,t("span",Nt,[s(y,{amount:e(a).totalSales,currency:e(o).selectedCompanyCurrency},null,8,["amount","currency"])])]),t("div",Ot,[t("span",Lt,h(b.$t("dashboard.chart_info.total_receipts")),1),Ft,t("span",Rt,[s(y,{amount:e(a).totalReceipts,currency:e(o).selectedCompanyCurrency},null,8,["amount","currency"])])]),t("div",Wt,[t("span",zt,h(b.$t("dashboard.chart_info.total_expense")),1),qt,t("span",Ht,[s(y,{amount:e(a).totalExpenses,currency:e(o).selectedCompanyCurrency},null,8,["amount","currency"])])]),t("div",Ut,[t("span",Zt,h(b.$t("dashboard.chart_info.net_income")),1),Jt,t("span",Kt,[s(y,{amount:e(a).totalNetIncome,currency:e(o).selectedCompanyCurrency},null,8,["amount","currency"])])])])])):(r(),p(It,{key:1}))])}}},Xt={class:"grid grid-cols-1 gap-6 mt-10 xl:grid-cols-2"},Yt={key:0,class:"due-invoices"},Gt={class:"relative z-10 flex items-center justify-between mb-3"},te={class:"mb-0 text-xl font-semibold leading-normal"},ee={key:1,class:"recent-estimates"},ae={class:"relative z-10 flex items-center justify-between mb-3"},se={class:"mb-0 text-xl font-semibold leading-normal"},oe={__name:"DashboardTable",setup(u){const a=k(),{t:o}=L.useI18n(),n=T(),c=B(null),l=B(null),f=V(()=>[{key:"formattedDueDate",label:o("dashboard.recent_invoices_card.due_on")},{key:"user",label:o("dashboard.recent_invoices_card.customer")},{key:"due_amount",label:o("dashboard.recent_invoices_card.amount_due")},{key:"actions",tdClass:"text-right text-sm font-medium pl-0",thClass:"text-right pl-0",sortable:!1}]),D=V(()=>[{key:"formattedEstimateDate",label:o("dashboard.recent_estimate_card.date")},{key:"user",label:o("dashboard.recent_estimate_card.customer")},{key:"total",label:o("dashboard.recent_estimate_card.amount_due")},{key:"actions",tdClass:"text-right text-sm font-medium pl-0",thClass:"text-right pl-0",sortable:!1}]);function b(){return n.hasAbilities([_.DELETE_INVOICE,_.EDIT_INVOICE,_.VIEW_INVOICE,_.SEND_INVOICE])}function $(){return n.hasAbilities([_.CREATE_ESTIMATE,_.EDIT_ESTIMATE,_.VIEW_ESTIMATE,_.SEND_ESTIMATE])}return(x,v)=>{const y=d("BaseButton"),E=d("router-link"),A=d("BaseFormatMoney"),P=d("BaseTable");return r(),C("div",null,[t("div",Xt,[e(n).hasAbilities(e(_).VIEW_INVOICE)?(r(),C("div",Yt,[t("div",Gt,[t("h6",te,h(x.$t("dashboard.recent_invoices_card.title")),1),s(y,{size:"sm",variant:"primary-outline",onClick:v[0]||(v[0]=m=>x.$router.push("/admin/invoices"))},{default:i(()=>[g(h(x.$t("dashboard.recent_invoices_card.view_all")),1)]),_:1})]),s(P,{data:e(a).recentDueInvoices,columns:f.value,loading:!e(a).isDashboardDataLoaded},M({"cell-user":i(({row:m})=>[s(E,{to:{path:`invoices/${m.data.id}/view`},class:"font-medium text-primary-500"},{default:i(()=>[g(h(m.data.customer.name),1)]),_:2},1032,["to"])]),"cell-due_amount":i(({row:m})=>[s(A,{amount:m.data.due_amount,currency:m.data.customer.currency},null,8,["amount","currency"])]),_:2},[b()?{name:"cell-actions",fn:i(({row:m})=>[s(G,{row:m.data,table:c.value},null,8,["row","table"])]),key:"0"}:void 0]),1032,["data","columns","loading"])])):w("",!0),e(n).hasAbilities(e(_).VIEW_ESTIMATE)?(r(),C("div",ee,[t("div",ae,[t("h6",se,h(x.$t("dashboard.recent_estimate_card.title")),1),s(y,{variant:"primary-outline",size:"sm",onClick:v[1]||(v[1]=m=>x.$router.push("/admin/estimates"))},{default:i(()=>[g(h(x.$t("dashboard.recent_estimate_card.view_all")),1)]),_:1})]),s(P,{data:e(a).recentEstimates,columns:D.value,loading:!e(a).isDashboardDataLoaded},M({"cell-user":i(({row:m})=>[s(E,{to:{path:`estimates/${m.data.id}/view`},class:"font-medium text-primary-500"},{default:i(()=>[g(h(m.data.customer.name),1)]),_:2},1032,["to"])]),"cell-total":i(({row:m})=>[s(A,{amount:m.data.total,currency:m.data.customer.currency},null,8,["amount","currency"])]),_:2},[$()?{name:"cell-actions",fn:i(({row:m})=>[s(tt,{row:m.data,table:l.value},null,8,["row","table"])]),key:"0"}:void 0]),1032,["data","columns","loading"])])):w("",!0)])])}}},de={__name:"Dashboard",setup(u){const a=K(),o=T(),n=Q();return X(()=>{a.meta.ability&&!o.hasAbilities(a.meta.ability)?n.push({name:"account.settings"}):a.meta.isOwner&&!o.currentUser.is_owner&&n.push({name:"account.settings"})}),(c,l)=>{const f=d("BasePage");return r(),p(f,null,{default:i(()=>[s(ft),s(Qt),s(oe)]),_:1})}}};export{de as default};