"use strict";(self["webpackChunkacctg_ui"]=self["webpackChunkacctg_ui"]||[]).push([[5723],{5723:function(t,e,a){a.r(e),a.d(e,{default:function(){return g}});a(560);var s=a(6252),n=a(2262),l=a(9963),o=(a(7303),a(7810)),r=a(4530),c=a(2201),i=a(8291),u=a(7530),d=a(466);const m=(0,s.uE)('<div class="d-flex justify-content-between align-items-center mb-4"><h2>Disbursements</h2><span><button class="btn btn-sm btn-primary mx-1"><svg xmlns="http://www.w3.org/2000/svg" width="1.3em" height="1.3em" viewBox="0 0 24 24"><path fill="white" d="M19 8h-1V3H6v5H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3M8 5h8v3H8zm8 12v2H8v-4h8zm2-2v-2H6v2H4v-4c0-.55.45-1 1-1h14c.55 0 1 .45 1 1v4z"></path><circle cx="18" cy="11.5" r="1" fill="white"></circle></svg> Print </button></span></div>',1),h={class:"row"},p={class:"d-flex col-8 col-md-5 align-items-center mb-4"},w=(0,s._)("div",{class:"flex-pill text-nowrap"},"Transaction Dates: ",-1),v=(0,s._)("span",null,"-",-1),b={class:"d-flex col-3 col-md-6 align-items-center mb-4"},f={class:"row"},_=(0,s._)("thead",null,[(0,s._)("tr",null,[(0,s._)("th",{style:{width:"12%"}},"Posted Date"),(0,s._)("th",{style:{width:"12%"}},"Trans Date"),(0,s._)("th",{style:{width:"15%"}},"Voucher #"),(0,s._)("th",null,"Particulars"),(0,s._)("th",{style:{width:"15%"}},"Amount"),(0,s._)("th",{style:{width:"8%"}},"Status")])],-1);var y={__name:"DisbursementList",setup(t){const e=(0,n.qj)({}),a=(0,n.iH)([]),y=(0,c.tv)(),D=(0,n.iH)([{data:"postedDate"},{data:"transDate"},{data:"reference"},{data:"particulars"},{data:"amount"},{data:null,render:function(t,e,a,s){return"posted"===t.status?`<span style="color: #009e1a" class="fw-bold"> ${t.status.toUpperCase()}</span>`:`<span class="fw-bold" style="color: #999999"> ${t.status.toUpperCase()}</span>`}}]);let g=(0,n.qj)({from:U(),to:U()});function x(t){const e=window.$("#disbursementVoucherTable").DataTable();e.on("click","tr",(function(t){const a=e.row(this).data();void 0!==a&&y.push({name:"disbursementDetails",params:{code:a.code}})}))}function U(){let t=(new Date).getDate(),e=(new Date).getMonth()+1;return e<10&&(e="0"+e),t<10&&(t="0"+t),(new Date).getFullYear()+"-"+e+"-"+t}const H=async()=>{a.value=await(0,i.go)("entities",null,null,"all")},k=async()=>{let t=await(0,u.Z)("journal_entry","list").addPayload("conditions",{type:"disbursement:"+g.from+":"+g.to}).execute();if(t){if(t.data.code)return void await d.w.failedAlert("Failed to retrieve list!","SERVER ERROR");let a=t.data.data,s=[];for(let t in a){let e={code:a[t].code,postedDate:a[t].posted_date,entryDate:a[t].entry_date,transDate:a[t].transaction_date,reference:a[t].reference_number,particulars:a[t].particulars,amount:a[t].amount,status:a[t].status};s.push(e)}e.value=s,console.log(e)}},V=()=>{y.push({name:"disbursementNew"})};return(0,s.bv)((async()=>{x(),await H(),await k()})),(t,a)=>((0,s.wg)(),(0,s.iD)("div",null,[m,(0,s._)("div",h,[(0,s._)("div",p,[w,(0,s.wy)((0,s._)("input",{type:"date",class:"form-control form-control-sm mx-2","onUpdate:modelValue":a[0]||(a[0]=t=>(0,n.SU)(g).from=t)},null,512),[[l.nr,(0,n.SU)(g).from]]),v,(0,s.wy)((0,s._)("input",{type:"date",class:"form-control form-control-sm mx-2","onUpdate:modelValue":a[1]||(a[1]=t=>(0,n.SU)(g).to=t)},null,512),[[l.nr,(0,n.SU)(g).to]]),(0,s._)("button",{class:"btn btn-primary btn-sm",onClick:k},"Generate")]),(0,s._)("div",b,[(0,s._)("span",null,[(0,s._)("button",{onClick:V,class:"btn btn-sm btn-success"},[(0,s.Wm)((0,n.SU)(o.GN),{icon:"plus"}),(0,s.Uk)(" New Voucher ")])])])]),(0,s._)("div",f,[(0,s._)("div",null,[(0,s.Wm)(r.Z,{columns:D.value,"table-id":"disbursementVoucherTable",data:e.value,class:"ar-list-table journal-voucher-table"},{tableHeader:(0,s.w5)((()=>[_])),_:1},8,["columns","data"])])])]))}};const D=y;var g=D}}]);
//# sourceMappingURL=5723.bbbf8897.js.map