import{_ as C,T as v,U as Q,d as p,o as d,e as u,w as o,h as a,aj as M,ak as q,j as m,t as c,f as y,p as V,O as j,F as x,i as P,m as L,cp as B}from"./index.cf09daef.js";import{Q as l}from"./QTd.c5fb967f.js";import{Q as w}from"./QTr.159c73e8.js";import{Q as F}from"./QPage.17eab31b.js";import{R as N,u as k}from"./ReportsTable.c88a60d3.js";import{u as O}from"./mixins.6734cf6a.js";import"./member.21f498a7.js";import"./StateSelect.29046ffe.js";import"./index.becf6c0c.js";import"./CitySelect.44fd570a.js";import"./BaseSectionSkeleton.c10f267e.js";import"./QSkeleton.b65f9727.js";import"./page.e779678f.js";import"./QExpansionItem.c46f740a.js";import"./QMenu.c2e9b9fc.js";import"./selection.5d5b72c0.js";import"./SkeletonSinglePage.c6d95753.js";const{subtractFromDate:S,formatDate:g,getDateDiff:U,extractDate:E}=B,$=new Date,b=(e=$,t)=>{let i=6;return typeof e=="string"&&(e=E(e,"YYYY/MM/DD")),t&&(i=U(e,t,"days")+1),L.exports.range(0,i).map(h=>{let s=S(e,{days:h});return{id:g(s,"DD"),label:g(s,"DD/MM/YYYY"),month:g(s,"MM"),year:g(s,"YYYY"),checked:!1,total:void 0,total_paid:void 0,rolling:void 0,rolling_total:void 0,end_date:void 0,end_date_total:void 0,free:void 0,cancelled_total:void 0,cancelled:void 0,type:null}})},A=b(),z={components:{ReportsTable:N},mixins:[O],data(){return{loaded:!0,rows:A,pagination:{loaded:!0}}},methods:{...v(k,["reportsDaily"]),onChangeDate(e){console.func("pages/admins/members/ReportsDayPage:methods.onChangeDate()",arguments);const{date:t}=e.pagination;typeof t=="object"&&t?this.rows=b(t.to,t.from):t?this.rows=b(t):this.rows=b()},onRequest(e,t){console.func("pages/admins/members/ReportsDayPage:methods.onRequest()",arguments),Object.assign(t.row,{total:void 0,rolling:void 0,rolling_total:void 0,end_date:void 0,end_date_total:void 0,free:void 0,cancelled_total:void 0,cancelled:void 0,type:void 0,expand:!1}),e&&this.reportsDaily({day:t.row.id,month:t.row.month,year:t.row.year}).then(i=>{Object.assign(t.row,i)}).catch(i=>{this.$core.error(i,{title:"Error"})})},onLoad(e,t){if(console.func("pages/admins/members/ReportsDayPage:methods.onLoad()",arguments),e.row.expand&&t===e.row.type){e.row.expand=!1;return}else e.row.expand=!1,e.row.type=null;this.$nextTick(()=>{e.row.type=t,e.row.expand=!0})}},computed:{...Q(k,["toolbar","dailyReportColumns"])}},G={key:1};function H(e,t,i,h,s,_){const D=p("base-btn"),R=p("reports-table"),T=p("base-table"),Y=p("base-section");return d(),u(F,{padding:""},{default:o(()=>[a(Y,{"no-row":""},{default:o(()=>[a(T,{"rows-per-page-options":[0],loaded:s.loaded,rows:s.rows,columns:e.dailyReportColumns,toolbar:e.toolbar,pagination:s.pagination,"hide-pagination":"","no-filter":"",onRequest:_.onChangeDate,"no-responsive":""},{"top-left":o(()=>[a(M,{class:"q-pa-none"},{default:o(()=>[a(q,{class:"text-weight-medium"},{default:o(()=>[m(c(e.$t("label.dailyReports")),1)]),_:1})]),_:1})]),body:o(n=>[a(w,{props:n},{default:o(()=>[(d(!0),y(x,null,V(n.cols,r=>(d(),u(l,{key:r.name,props:n},{default:o(()=>[r.name==="id"?(d(),u(j,{key:0,dense:"",modelValue:n.row.checked,"onUpdate:modelValue":[f=>n.row.checked=f,f=>_.onRequest(f,n)],label:r.value},null,8,["modelValue","onUpdate:modelValue","label"])):(d(),y(x,{key:1},[r.value&&r.load?(d(),u(D,{key:0,link:"",color:"black",onClick:f=>_.onLoad(n,r.name),flat:"",dense:"",label:r.value},null,8,["onClick","label"])):(d(),y("span",G,c(r.value),1))],64))]),_:2},1032,["props"]))),128))]),_:2},1032,["props"]),n.row.expand?(d(),u(w,{key:0,props:n},{default:o(()=>[a(l,{class:"q-pa-none",colspan:"100%"},{default:o(()=>[a(R,{"no-responsive":"",type:n.row.type,day:n.row.id,month:n.row.month,year:n.row.year},null,8,["type","day","month","year"])]),_:2},1024)]),_:2},1032,["props"])):P("",!0)]),"bottom-row":o(()=>[a(w,null,{default:o(()=>[a(l,{align:"center",class:"text-bold",colspan:"2"}),a(l,{align:"center",class:"text-bold",colspan:"1"},{default:o(()=>[m(c(e.getTotal("rolling_total")),1)]),_:1}),a(l,{align:"center",class:"text-bold",colspan:"1"}),a(l,{align:"center",class:"text-bold",colspan:"1"},{default:o(()=>[m(c(e.getTotal("end_date_total")),1)]),_:1}),a(l,{align:"center",class:"text-bold",colspan:"1"}),a(l,{align:"center",class:"text-bold",colspan:"1"}),a(l,{align:"center",class:"text-bold",colspan:"1"},{default:o(()=>[m(c(e.getTotal("cancelled_total")),1)]),_:1}),a(l,{align:"center",class:"text-bold",colspan:"1"}),a(l,{align:"center",class:"text-bold",colspan:"1"},{default:o(()=>[m(c(e.getTotal("total_paid")),1)]),_:1})]),_:1})]),_:1},8,["loaded","rows","columns","toolbar","pagination","onRequest"])]),_:1})]),_:1})}var ue=C(z,[["render",H]]);export{ue as default};
