"use strict";(self["webpackChunkacctg_ui"]=self["webpackChunkacctg_ui"]||[]).push([[6818],{6818:function(t,a,e){e.r(a),e.d(a,{default:function(){return D}});e(560);var n=e(6252),l=e(2262),s=e(9963),o=(e(7303),e(7810)),r=e(4530),c=e(2201),u=e(7530),i=e(466);const d=(0,n.uE)('<div class="d-flex justify-content-between align-items-center mb-4"><h2>Journals</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),m={class:"row"},h={class:"d-flex col-8 col-md-5 align-items-center mb-4"},p=(0,n._)("div",{class:"flex-pill text-nowrap"},"Transaction Dates: ",-1),v=(0,n._)("span",null,"-",-1),w={class:"d-flex col-3 col-md-6 align-items-center mb-4"},f={class:"row"},b=(0,n._)("thead",null,[(0,n._)("tr",null,[(0,n._)("th",{style:{width:"12%"}},"Posted Date"),(0,n._)("th",{style:{width:"12%"}},"Trans Date"),(0,n._)("th",{style:{width:"15%"}},"Voucher #"),(0,n._)("th",null,"Particulars"),(0,n._)("th",{style:{width:"15%"}},"Amount"),(0,n._)("th",{style:{width:"8%"}},"Status")])],-1),_="journalVoucherTable";var y={__name:"JournalList",setup(t){const a=(0,c.tv)(),e=(0,l.iH)([{data:"postedDate"},{data:"transDate"},{data:"reference"},{data:"particulars"},{data:"amount"},{data:null,render:function(t,a,e,n){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>`}}]),y=(0,l.qj)({});let g=(0,l.qj)({from:j(),to:j()});const D=()=>{a.push({name:"journalNew"})};function x(t){const e=window.$("#journalVoucherTable").DataTable();e.on("click","tr",(function(t){const n=e.row(this).data();void 0!==n&&a.push({name:"journalDetails",params:{code:n.code}})}))}function j(){let t=(new Date).getDate(),a=(new Date).getMonth()+1;return a<10&&(a="0"+a),t<10&&(t="0"+t),(new Date).getFullYear()+"-"+a+"-"+t}const U=async()=>{let t=await(0,u.Z)("journal_entry","list").addPayload("conditions",{type:"journal:"+g.from+":"+g.to}).execute();if(t){if(t.data.code)return void await i.w.failedAlert("Failed to retrieve list!","SERVER ERROR");let a=t.data.data,e=[];for(let t in a){let n={code:a[t].code,entryDate:a[t].entry_date,postedDate:a[t].posted_date,transDate:a[t].transaction_date,reference:a[t].reference_number,particulars:a[t].particulars,amount:a[t].amount,status:a[t].status};e.push(n)}y.value=e,console.log(t.data.data)}};return(0,n.bv)((async()=>{x(),await U()})),(t,a)=>((0,n.wg)(),(0,n.iD)("div",null,[d,(0,n._)("div",m,[(0,n._)("div",h,[p,(0,n.wy)((0,n._)("input",{type:"date",class:"form-control form-control-sm mx-2","onUpdate:modelValue":a[0]||(a[0]=t=>(0,l.SU)(g).from=t)},null,512),[[s.nr,(0,l.SU)(g).from]]),v,(0,n.wy)((0,n._)("input",{type:"date",class:"form-control form-control-sm mx-2","onUpdate:modelValue":a[1]||(a[1]=t=>(0,l.SU)(g).to=t)},null,512),[[s.nr,(0,l.SU)(g).to]]),(0,n._)("button",{class:"btn btn-primary btn-sm",onClick:U},"Generate")]),(0,n._)("div",w,[(0,n._)("span",null,[(0,n._)("button",{onClick:D,class:"btn btn-sm btn-success"},[(0,n.Wm)((0,l.SU)(o.GN),{icon:"plus"}),(0,n.Uk)(" New Voucher ")])])])]),(0,n._)("div",f,[(0,n._)("div",null,[(0,n.Wm)(r.Z,{columns:e.value,"table-id":_,data:y.value,class:"ar-list-table journal-voucher-table"},{tableHeader:(0,n.w5)((()=>[b])),_:1},8,["columns","data"])])])]))}};const g=y;var D=g}}]);
//# sourceMappingURL=6818.73f060df.js.map