File manager - Edit - /home/autoph/.trash/assets/index-2ba99387.js
Back
import{S as B}from"./StockReceivingService-864dfe49.js";import{T as K,s as W,L as X}from"./index-09aec724.js";import{B as O}from"./index-29f1b736.js";import{_ as F,r as u,o as d,d as p,e as m,g as f,f as e,I as l,h as k,J as R,G as I,b as v,w as Z,c as y,K as V,L as $,M as ee,N as te}from"./index-f7a80f5a.js";import{D as U,C as se,E as oe}from"./DeleteButton-85e113e8.js";import{S as T,U as re}from"./UpdateButton-a21096f0.js";import{V as A}from"./ViewButton-f4342a67.js";import{I as E,F as ie}from"./vue-flatpickr.min-4d3c95b2.js";import{P as ae}from"./ProcessButton-91d71e04.js";import{F as L}from"./index-a024a0da.js";import"./index-2d8a3f66.js";import"./vue-cleave.min-538935a7.js";import{P as le}from"./index-19226ff8.js";import{I as ne}from"./index-2a9f082a.js";import{L as Y}from"./Loading-354bb089.js";import{F as ce,l as de}from"./lodash-bc56efa2.js";import{T as me}from"./index-7c52dce3.js";import{C as ue}from"./CloseButton-68d4684b.js";import{V as _e}from"./array-81fad990.js";import{f as he}from"./file-type-pdf-a9709057.js";import{f as pe}from"./file-type-excel-3a83eaab.js";import{h as M}from"./moment-a9aaa855.js";import{B as fe}from"./index-63dd9abd.js";import"./xhebrhsj-c0546f05.js";import"./es.string.replace-38cd9dd0.js";/* empty css */const ge={components:{Loading:Y,FormModal:L,FormGroup:ce,TextInput:K,TextArea:me,SubmitButton:T,CloseButton:ue,UpdateButton:re,DeleteButton:U,ViewButton:A,Button:O,Info:E,FlatPickr:ie,Multiselect:W},data(){return{companyOptions:[],SupplierOptions:[],termsOptions:[],items:[],po_item_list:[],selected_item_list:[],totalCost:0,isFormValid:!0,form:{pdf_file_view:he,excel_file_view:pe,file_attachment:null,file_attachment_preview:null,file_attachment_names:"",company_id:null,company_name:"",dealership_name:"",supplier_id:null,dealer_id:null,terms_id:null,delivery_date:"",contact_person:"",mobile:"",email:"",items_received:null},errors:{},currentPage:1,totalPages:1,state:{isEdit:!1,isLoading:!1,isSubmitting:!1,isSaving:!1,showModal:!1,showUnserveModal:!1}}},computed:{activePoItems(){if(console.log("execute computed activePoItems..."),this.form.po_dtl){console.log("PO DTL "),console.log(this.form.po_dtl);let t=this.po_item_list;t=this.form.po_dtl.map(i=>({prf_id:i.prf_id,prf_dtl_id:i.prf_dtl_id,canvass_id:i.canvass_id,po_header_id:i.po_header_id,po_dtl_id:i.id,company_id:i.company_id,dealer_code:i.dealer.code,dealer_name:i.dealer.name,dealer_id:i.dealer_id,asset_item_id:i.asset_item.id,asset_item_name:i.asset_item.name,uom:i.asset_item.uom,quantity:i.quantity,unit_cost:i.unit_cost,total_cost:i.total_cost,quantity_received:i.quantity_received,quantity_balance:i.quantity_balance}));let s=this.selected_item_list.map(i=>i.po_dtl_id),r=t.filter(i=>!s.includes(i.po_dtl_id)&&i.quantity_balance>0);return console.log("current selected asset item list.. is"),console.log(this.selected_item_list),r}return[]}},methods:{async submitForm(){this.errors=[],this.state.isSubmitting=!0;try{this.$swal.fire({title:"Are you sure you want to save this record?",text:"",icon:"question",showCancelButton:!0,confirmButtonColor:"#34c38f",cancelButtonColor:"#f46a6a",confirmButtonText:"Yes",cancelButtonText:"No"}).then(t=>{t.value?(console.log("saving...."),this.saveRecord()):this.state.showModal=!1})}catch(t){if(t instanceof _e){const s={};t.inner.forEach(r=>{s[r.path]=r.message}),this.errors=s}this.state.isSaving=!1}},async saveRecord(){console.log("saving record...."),console.log(this.form),this.state.isSaving=!0;let t=new FormData;if(Object.keys(this.form).forEach(s=>{s==="file_attachment"&&this.form[s]instanceof FileList?Array.from(this.form[s]).forEach((r,i)=>{t.append(`file_attachment[${i}]`,r)}):t.append(s,this.form[s])}),this.selected_item_list&&this.selected_item_list.forEach((s,r)=>{t.append(`items_received[${r}][po_header_id]`,s.po_header_id),t.append(`items_received[${r}][po_dtl_id]`,s.po_dtl_id),t.append(`items_received[${r}][prf_id]`,s.prf_id),t.append(`items_received[${r}][prf_dtl_id]`,s.prf_dtl_id),t.append(`items_received[${r}][canvass_id]`,s.canvass_id),t.append(`items_received[${r}][asset_item_id]`,s.asset_item_id),t.append(`items_received[${r}][dealer_id]`,s.dealer_id),t.append(`items_received[${r}][quantity]`,s.quantity),t.append(`items_received[${r}][unit_cost]`,s.unit_cost),t.append(`items_received[${r}][quantity_received]`,s.quantity_received)}),this.state.isSubmitting=!1,!this.state.isEdit)console.log("dito saving...."),await B.create(t).then(s=>{s.status==201?(this.$swal.fire({title:"Great!",text:"Record successfully saved.",icon:"success",timer:2e3}),this.closeModal(),this.reload()):this.$swal.fire({title:"Ooops! something is wrong.",text:"Please contact system administrator",icon:"error",timer:2e3})}).catch(s=>{console.log(s),s.response.status==422?this.$swal.fire({title:"Ooops! something is wrong.",text:s.response.data.message,icon:"warning"}):this.$swal.fire({title:"Ooops! something is wrong.",text:"Please contact system administrator",icon:"error",timer:2e3})}).finally(()=>{this.state.isSaving=!1,this.state.isSubmitting=!1});else{console.log("dafads");const s=this.form.id;await B.update(s,t).then(r=>{r.status==201?(this.$swal.fire({title:"Great!",text:"Record successfully updated.",type:"success",icon:"success",timer:2e3}),this.state.showModal=!1):this.$swal.fire({title:"Ooops! something is wrong.",text:"Please contact system administrator",type:"error",icon:"error",timer:2e3})}).catch(r=>{console.log(r),r.response.status==422?this.$swal.fire({title:"Ooops! something is wrong.",text:r.response.data.message,type:"error",icon:"error"}):this.$swal.fire({title:"Ooops! something is wrong.",text:"Please contact system administrator",type:"error",icon:"error",timer:2e3})}).finally(()=>{this.state.isSaving=!1,this.state.isSubmitting=!1,this.reload()})}},async Unserved(t){this.state.showUnserveModal=!0,console.log("data raw..."),console.log(t)},loadRecord(t){this.resetForm(),this.state.isEdit=!1;let s=Object.assign({},t);this.form=s,this.totalCost=0},resetForm(){console.log("reseting form data...."),this.state.isEdit=!1,this.form={po_no:null,company_id:null,supplier_id:null,terms:null,instructions:null,delivery_date:null,selected_item_list:[],items:[]}},removeItem(t){this.$swal.fire({title:"Are you sure?",text:"You want to remove this item?",icon:"warning",showCancelButton:!0,confirmButtonColor:"#34c38f",cancelButtonColor:"#f46a6a",confirmButtonText:"Yes, remove it!",background:this.$store.themeSettingsStore.isDark?"#1e293b":"#fff"}).then(s=>{s.value&&this.form.items.splice(t,1)})},closeModal(){this.state.showModal=!1,this.selected_item_list=[]},reload(){this.$emit("reload")},handleMainImageUpload(t,s,r){const i=t.target.files;this.form[s]=i,this.form.file_attachment_names=Array.from(i).map(o=>o.name),this.form[r]=[],Array.from(i).forEach(o=>{const n=new FileReader;n.onload=()=>{let h="";o.type.startsWith("image/")?h=n.result:o.type==="application/pdf"?h=this.pdf_file_view:(o.type==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"||o.type==="application/vnd.ms-excel")&&(h=this.excel_file_view),this.form[r].push(h)},n.readAsDataURL(o)})},Clearfile_attachment(t,s){this.$refs[t].value=null,this.form.file_attachment=null,this.form.file_attachment_names=[],this.form[s]=[]},addReceiveItem(t){this.$swal.fire({title:"Are you sure?",text:"You want to add this item?",icon:"warning",showCancelButton:!0,confirmButtonColor:"#34c38f",cancelButtonColor:"#f46a6a",confirmButtonText:"Yes!",background:this.$store.themeSettingsStore.isDark?"#1e293b":"#fff"}).then(s=>{if(s.value){let r={...t};r.quantity_received=r.quantity_balance,r.error="",this.selected_item_list.push(r),this.computeTotal(),this.form.invoice_amount=this.totalCost,this.validateForm()}})},removeSelectedItem(t){this.selected_item_list.splice(t,1),this.computeTotal(),this.validateForm()},computeTotal(){this.totalCost=this.selected_item_list.reduce((t,s)=>t+s.quantity_received*s.unit_cost,0)},closeRowModal(){this.state.showUnserveModal=!1},validateAndComputeTotal(t,s){const r=Number(s.target.value),i=this.selected_item_list[t],o=i.quantity_balance;this.selected_item_list.reduce((h,x,g)=>(console.log("sum "+h+" selected item "+x+" idx "+g),g!==t?(console.log("dito sum 1"),h+(x.quantity_received||0)):(console.log("dito sum2 "+h),h)),0);const n=o;console.log("current index "+t),console.log("current item index : "),console.log(i),console.log(" Initial Quantity :"+o+" current available quantity "+n+" current input receive "+r),isNaN(r)||r<0?(i.error="Input must be a valid number",i.quantity_received=0):r>n?i.error=`Quantity must not be greater than available quantity (${n})`:r==0?i.error="Quantity must be greater than 0":(i.error="",i.quantity_received=r),console.log("final item ..."),console.log(i),console.log("final selected item..."),console.log(this.selected_item_list),this.computeTotal(),this.form.invoice_amount=this.totalCost,this.validateForm()},validateForm(){this.isFormValid=this.selected_item_list.every(t=>t.error==="")}},mounted(){}},_=t=>(V("data-v-7643b2d6"),t=t(),$(),t),ve=_(()=>e("div",{class:"w-full flex justify-between pr-4"},[e("div",{class:"text-xl"},"Stock Receiving")],-1)),be=_(()=>e("div",{class:"mb-4 p-4 bg-blue-100 border border-blue-300 rounded-md flex items-center space-x-2"},[e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-6 w-6 text-pink-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M13 16h-1v-4h-1m0-4h.01M12 12h.01M12 8v.01M13 12h-1m-2 4h2v-4m1 0V8.01m1 12h1m0-8h-.01M16 16h1v-4h1m0-4h-.01M16 8V7m0 12v-1m-8 1v-1m0-12V7m-4 12v-1M4 8V7m0 12v-1M4 8V7m12 5h-1m0 0h1"})]),e("p",{class:"text-pink-400 text-sm"},[k(" Please "),e("strong",null,"double-click on any row"),k(" to proceed with the selected item. ")])],-1)),ye={class:"grid grid-flow-col gap-1 p-2 bg-primary-800 text-white"},we={class:"col-span-1"},xe=_(()=>e("label",{class:"block"},"Vendor : ",-1)),Ce={class:"col-span-1"},Pe=_(()=>e("label",{class:"block"},"Company : ",-1)),ke={class:"col-span-1"},Me=_(()=>e("label",{class:"block"},"Contact Person : ",-1)),Re=_(()=>e("br",null,null,-1)),Ie={class:"col-span-1"},Be=_(()=>e("label",{class:"block"},"Terms : ",-1)),De=_(()=>e("br",null,null,-1)),Se={class:"space-y-4"},qe={class:"border border-primary-800 min-h-48"},Oe=_(()=>e("div",{class:"bg-slate-400 p-2"},[e("div",{class:"text-xl text-slate-900 font-serif italic text-normal"}," Active Items ")],-1)),Fe={class:"table-container"},Ve={class:"w-full"},$e=_(()=>e("thead",{class:"sticky top-0"},[e("tr",null,[e("th",{class:"text-center border border-slate-200 ..."},"Dealer"),e("th",{class:"text-center border border-slate-200 ..."},"Item Description"),e("th",{class:"text-center border border-slate-200 ..."},"Uom"),e("th",{class:"text-center border border-slate-200 ..."},"PO Qty"),e("th",{class:"text-center border border-slate-200 ..."},"Unit cost"),e("th",{class:"text-center border border-slate-200 ..."},"Received Qty "),e("th",{class:"text-center border border-slate-200 ..."},"Remaining Qty")])],-1)),Ue={class:"h-32"},Te=["onDblclick"],Ae={class:"text-center"},Ee={class:"text-center"},Le={class:"text-center"},Ye={class:"text-center"},Qe={class:"text-center"},Ne={class:"text-center"},Ge={class:"text-center"},je={class:"border border-primary-800 min-h-48"},ze=_(()=>e("div",{class:"bg-slate-400 p-2"},[e("div",{class:"text-xl text-slate-900 font-serif italic text-normal"}," Receiving Item's ")],-1)),He={class:"row-star-2 table-container"},Je={class:"w-full"},Ke=_(()=>e("thead",{class:"sticky top-0"},[e("tr",null,[e("th",{class:"text-center border border-slate-200 ..."},"Dealer"),e("th",{class:"text-center border border-slate-200 ..."},"Item Description"),e("th",{class:"text-center border border-slate-200 ..."},"Uom"),e("th",{class:"text-center border border-slate-200 ..."},"PO Qty"),e("th",{class:"text-center border border-slate-200 ..."},"Unit cost"),e("th",{class:"text-center border border-slate-200 ..."},"Remaining Qty"),e("th",{class:"text-center border border-slate-200 ..."},"Receive Qty")])],-1)),We={class:"h-64"},Xe=["onDblclick"],Ze={class:"text-center",scope:"col"},et={class:"text-center",scope:"col"},tt={class:"text-center",scdrop:"col"},st={class:"text-center",scdrop:"col"},ot={class:"text-center",scdrop:"col"},rt={class:"text-center",scdrop:"col"},it={class:"text-center",scdrop:"col"},at={key:0,class:"text-red-500 text-sm mx-auto"},lt={class:"my-2"},nt={class:"w-full my-5"},ct={class:"sticky top-0"},dt=_(()=>e("td",null,null,-1)),mt=_(()=>e("td",null,null,-1)),ut=_(()=>e("td",null,null,-1)),_t=_(()=>e("td",null,null,-1)),ht=_(()=>e("th",{class:"text-right border border-slate-200 ..."},"Total",-1)),pt={class:"text-center border border-slate-200 ..."},ft=_(()=>e("tbody",{class:"h-64"},null,-1)),gt={class:"grid grid-cols-1 lg:grid-cols-7 gap-4 p"},vt={class:"grid grid-cols-4 gap-4"},bt={class:"w-full flex justify-between relative"},yt=_(()=>e("div",{class:"bg-white rounded border border-gray-300 p-0 flex-grow items-center flex justify-between"},[e("span",{class:"mr-2 pl-2 text-sm text-slate-500"},"Choose a file..."),e("button",{type:"button",class:"px-4 py-2 bg-slate-200 text-slate-500 rounded hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2"}," Browse ")],-1)),wt={class:"flex gap-1 justify-end mt-4"};function xt(t,s,r,i,o,n){const h=u("TextInput"),x=u("Loading"),g=u("FormGroup"),D=u("Button"),C=u("SubmitButton"),S=u("FormModal");return d(),p("div",null,[m(S,{title:null,active:o.state.showModal,onClose:n.closeModal,themeClass:o.state.isEdit?"bg-primary-600":"bg-primary-800",sizeClass:"w-full h-full"},{header:f(()=>[ve]),default:f(()=>[be,e("div",null,[e("div",ye,[e("div",we,[xe,e("span",null,l(o.form.supplier_name),1)]),e("div",Ce,[Pe,e("span",null,l(o.form.company_name),1)]),e("div",ke,[Me,e("span",null,l(o.form.contact_person),1),k(),Re,e("span",null,"#"+l(o.form.contact_no),1)]),e("div",Ie,[Be,e("span",null,l(o.form.terms),1),k(),De])]),e("section",Se,[e("div",qe,[Oe,e("div",Fe,[e("table",Ve,[$e,e("tbody",Ue,[(d(!0),p(R,null,I(n.activePoItems,(a,b)=>(d(),p("tr",{key:b,onDblclick:w=>n.addReceiveItem(a)},[e("td",Ae,l(a.dealer_code)+" - "+l(a.dealer_name),1),e("td",Ee,l(a.asset_item_name),1),e("td",Le,l(a.uom),1),e("td",Ye,l(a.quantity),1),e("td",Qe,l(a.unit_cost),1),e("td",Ne,l(a.quantity_received!==null?a.quantity_received:0),1),e("td",Ge,l(a.quantity_balance),1)],40,Te))),128))])])])]),e("div",je,[ze,e("div",He,[e("table",Je,[Ke,e("tbody",We,[(d(!0),p(R,null,I(o.selected_item_list,(a,b)=>(d(),p("tr",{key:b,class:"hover:bg-slate-100",onDblclick:w=>n.removeSelectedItem(b)},[e("td",Ze,l(a.dealer_name),1),e("td",et,l(a.asset_item_name),1),e("td",tt,l(a.uom),1),e("td",st,l(a.quantity),1),e("td",ot,l(a.unit_cost),1),e("td",rt,l(a.quantity_balance),1),e("td",it,[m(h,{type:"number",placeholder:"Input received quantity",class:"h-10 w-1/2 mx-auto",classInput:"h-[48px] w-full",modelValue:a.quantity_received,"onUpdate:modelValue":w=>a.quantity_received=w,modelModifiers:{number:!0},onInput:w=>n.validateAndComputeTotal(b,w)},null,8,["modelValue","onUpdate:modelValue","onInput"]),a.error?(d(),p("span",at,[e("p",lt,l(a.error),1)])):v("",!0)])],40,Xe))),128))])]),e("table",nt,[e("thead",ct,[e("tr",null,[dt,mt,ut,_t,ht,e("th",pt,l(o.totalCost),1)])]),ft])]),e("form",{onSubmit:s[5]||(s[5]=Z((...a)=>t.confirmSubmit&&t.confirmSubmit(...a),["prevent"])),enctype:"multipart/form-data",class:"my-5 p-5"},[o.state.isLoading?(d(),y(x,{key:0,text:"Fetching items"})):v("",!0),e("div",gt,[m(g,{class:"lg:col-span-2",label:"DR#",isRequired:!0},{default:f(()=>[e("div",null,[m(h,{type:"text",placeholder:"Input DR no.",modelValue:o.form.dr_no,"onUpdate:modelValue":s[0]||(s[0]=a=>o.form.dr_no=a),error:o.errors.dr_no,classInput:"h-[48px]"},null,8,["modelValue","error"])])]),_:1}),m(g,{class:"lg:col-span-2",label:"INVOICE#",isRequired:!0},{default:f(()=>[e("div",null,[m(h,{type:"text",placeholder:"Input invoice no.",modelValue:o.form.invoice_no,"onUpdate:modelValue":s[1]||(s[1]=a=>o.form.invoice_no=a),error:o.errors.invoice_no,classInput:"h-[48px]"},null,8,["modelValue","error"])])]),_:1}),m(g,{label:"Invoice Amount",isRequired:!0,class:"lg:col-span-1",labelClass:"px-2"},{default:f(()=>[m(h,{type:"text",placeholder:"Input invoice amount",modelValue:o.form.invoice_amount,"onUpdate:modelValue":s[2]||(s[2]=a=>o.form.invoice_amount=a),error:o.errors.invoice_amount,classInput:"h-[48px]"},null,8,["modelValue","error"])]),_:1})]),e("div",vt,[m(g,{label:"Attachment",isRequired:!0,labelClass:"px-2"},{default:f(()=>[e("div",bt,[e("input",{type:"file",id:"file_attachment",name:"file_attachment",onChange:s[3]||(s[3]=a=>n.handleMainImageUpload(a,"file_attachment","file_attachment_previews")),ref:"file_attachment",class:"absolute inset-0 opacity-0 w-full h-full cursor-pointer",multiple:""},null,544),yt,m(D,{onClick:s[4]||(s[4]=a=>n.Clearfile_attachment("file_attachment","file_attachment_previews")),btnClass:"bg-red-500 mx-1 text-gray-100 min-h-3 pt-2"},{default:f(()=>[k(" Clear ")]),_:1})])]),_:1})]),e("div",null,[e("ul",null,[(d(!0),p(R,null,I(o.form.file_attachment_names,(a,b)=>(d(),p("li",{key:b},l(a),1))),128))])]),e("div",wt,[m(C,{onClick:n.submitForm,disabled:!o.isFormValid},null,8,["onClick","disabled"])])],32)])])])]),_:1},8,["active","onClose","themeClass"])])}const Ct=F(ge,[["render",xt],["__scopeId","data-v-7643b2d6"]]);const Pt={components:{Layout:X,Loading:Y,Pagination:le,InputGroup:ne,ViewButton:A,CreateButton:se,EditButton:oe,DeleteButton:U,ProcessButton:ae,Form:Ct,Badge:fe,Button:O,Info:E,FormModal:L,SubmitButton:T},data(){return{title:"Active PO (waiting for delivery)",breadcrumbs:[{text:"Home",href:"/"},{text:"Transactions",href:"/transactions/stock-receving"},{text:"Stock Receiving",active:!0}],rowData:{},state:{isEdit:!1,isLoading:!1,isLoadingPDF:!1,isMounted:!1,isResetError:!1,isSubmitted:!1,showModal:!1,showRowModal:!1,isDeleting:!1},canvass_id_array:[],items:[],error:[],totalItems:0,columns:[{label:"#",field:"#",tdClass:"text-center w-[20px]",sortable:!1},{label:"Ref. Code",field:"reference_code"},{label:"Company",field:"company_name"},{label:"Supplier/Vendor",field:"supplier_name"},{label:"Created",field:"created_at"},{label:"Date Needed",field:"needed_at"},{label:"Action",field:"action",tdClass:"self-center w-[100px]",sortable:!1}],perPageOptions:[{value:"10",label:"10"},{value:"50",label:"50"},{value:"100",label:"100"}],searchQuery:this.$route.query.s??"",serverOptions:{page:1,rowsPerPage:10,sortBy:"purchase_orders.created_at",sortType:"desc"},currentDate:M()}},watch:{serverOptions:{handler(){console.log(`perPage: ${this.serverOptions.rowsPerPage}`),this.fetchRecords()},deep:!0},searchQuery:de.debounce(function(){this.fetchRecords()},1e3),$route(t,s){t.query!==s.query&&(this.searchQuery=t.query.s)}},computed:{perPage:function(){return this.serverOptions.rowsPerPage},activeUser:function(){return this.$store.userSettings.getActiveUser??null},activeCompany:function(){return this.$store.userSettings.getActiveCompany??null},activeDealership:function(){return this.$store.userSettings.getActiveDealership??null},roleGroups:function(){return this.activeUser?this.activeUser.roles.flatMap(t=>t.group_id):null},departmentAccess:function(){return this.activeUser&&this.activeUser.department_access?this.activeUser.department_access.flatMap(t=>t.id):null},employeeInfo:function(){if(this.activeUser.employee){let t=this.activeUser.employee;return{user_id:this.activeUser.id,asa_id:this.activeUser.asa_id,company_id:t.company_id,dealership_id:t.dealer_id,department_id:t.department_id}}return null}},methods:{async fetchRecords(){this.state.isLoading=!0,this.state.isMounted=!1,console.log("this.activeUser"),console.log(this.activeUser),await B.fetchRecords({keyword:this.searchQuery,page:this.serverOptions.page,per_page:this.serverOptions.rowsPerPage,sortBy:this.serverOptions.sortBy,sortType:this.serverOptions.sortType,company_id:this.activeCompany,dealership_id:this.activeDealership,departments:this.departmentAccess,role_groups:this.roleGroups,employee:this.employeeInfo}).then(t=>{console.log("response.. items"),console.log(t);let s=t.data.data;this.items=s.map((r,i)=>({"#":(this.serverOptions.page-1)*this.serverOptions.rowsPerPage+(i+1),...r,needed_at:M(r.needed_at).format("MMM D, YYYY"),created_at:M(r.created_at).format("MMM D, YYYY"),overdue:this.currentDate.isAfter(M(r.needed_at))})),this.totalItems=t.data.total??0}).finally(()=>{this.state.isLoading=!1,this.state.isMounted=!0})},async deliveryInfo(){await B.de},handlePageChange(t){console.log(t),console.log(this.serverOptions.page),this.serverOptions.page!=t&&(this.serverOptions.page=t)},handlePerPageChange(t){this.serverOptions.page=1,this.serverOptions.rowsPerPage=t},onSortChange(t){console.log(t),t[0].type!="none"&&(this.serverOptions.sortBy=t[0].field,this.serverOptions.sortType=t[0].type)},createRecord(t){console.log("dataset..."),console.log(t),this.$refs.form.resetForm(),this.$refs.form.loadRecord(t),this.$refs.form.state.showModal=!0},editRecord(t){this.$refs.form.loadRecord(t),this.$refs.form.state.showModal=!0},processRecord(t){this.$refs.processModal.resetData(),this.$refs.processModal.loadRecord(t),this.$refs.processModal.state.showModal=!0},async deleteRecord(t){this.$swal.fire({title:"Are you sure?",text:"You want to delete this record?",icon:"warning",showCancelButton:!0,confirmButtonColor:"#34c38f",cancelButtonColor:"#f46a6a",confirmButtonText:"Yes, delete it!",background:this.$store.themeSettingsStore.isDark?"#1e293b":"#fff"}).then(s=>{s.value&&(this.state.isDeleting=!0,PurchaseRequest.remove(t).then(r=>{r.status==200&&(this.$swal.fire({title:"Great!",text:"Record has been deleted successfully.",type:"success",icon:"success",timer:2e3}),this.fetchRecords())}).catch(r=>{r.response&&r.response.status==401&&this.$swal.fire({title:"Ooops! something is wrong.",text:"Error deleting record. Please contact system administrator",type:"error",icon:"error",timer:2e3})}).finally(()=>{this.state.isDeleting=!1}))})},closeRowModal(){this.state.showRowModal=!1}},mounted(){this.fetchRecords()}},P=t=>(V("data-v-16872edc"),t=t(),$(),t),kt={class:"p-6 bg-[url('@/assets/images/background/shopping.jpg')] bg-cover bg-[center]"},Mt={class:"bg-white bg-opacity-[0.8] p-4 rounded-md md:flex items-center"},Rt={class:"flex-1 md:mb-0 mb-3"},It={class:"md:flex md:space-x-3 items-center flex-none rtl:space-x-reverse float-right"},Bt={key:0},Dt={key:1,class:"flex gap-1"},St={key:2,class:"flex gap-1"},qt={key:3,class:"flex gap-1"},Ot={key:4,class:"flex gap-1"},Ft={class:"py-4 px-3 flex justify-end"},Vt={class:"space-y-3 p-6"},$t={class:"text-xl"},Ut=P(()=>e("span",{class:"text-primary-700"},"Reference No: ",-1)),Tt={class:"text-2xl font-semibold text-primary-500"},At={class:""},Et=P(()=>e("span",null,"Requested by: ",-1)),Lt={class:"font-bold"},Yt={class:""},Qt=P(()=>e("span",null,"Company: ",-1)),Nt={class:"font-bold"},Gt={class:""},jt=P(()=>e("span",null,"Dealership: ",-1)),zt={class:"font-bold"},Ht={class:""},Jt=P(()=>e("span",null,"Department: ",-1)),Kt={class:"font-bold"},Wt={class:""},Xt=P(()=>e("span",null,"Purpose: ",-1)),Zt={class:"font-bold"},es={class:"flex gap-2 justify-center border p-4 bg-primary-100 shadow"};function ts(t,s,r,i,o,n){const h=u("InputGroup"),x=u("Button"),g=u("Loading"),D=u("Tooltip"),C=u("Badge"),S=u("ViewButton"),a=u("Pagination"),b=u("vue-good-table"),w=u("Card"),Q=u("Form"),N=u("ProcessForm"),G=u("EditButton"),j=u("ProcessButton"),z=u("FormModal"),H=u("Layout"),J=ee("tooltip");return d(),y(H,{breadcrumbs:o.breadcrumbs},{nocard:f(()=>[m(w,{noborder:""},{default:f(()=>[e("div",kt,[e("div",Mt,[e("h6",Rt,l(o.title),1),e("div",It,[m(h,{modelValue:o.searchQuery,"onUpdate:modelValue":s[0]||(s[0]=c=>o.searchQuery=c),placeholder:"Search",type:"text",prependIcon:"heroicons-outline:search",class:"btn-outline-secondary",merged:""},null,8,["modelValue"]),m(x,{icon:"heroicons-outline:filter",text:"Filter",btnClass:" btn-outline-secondary text-slate-600 dark:border-slate-700 dark:text-slate-300 font-normal btn-sm ",iconClass:"text-lg"})])])]),e("div",null,[o.state.isLoading?(d(),y(g,{key:0,searching:!0,text:"Fetching records"})):v("",!0),o.state.isLoadingPDF?(d(),y(g,{key:1,searching:!0,text:"Preparing pdf document"})):v("",!0),o.state.isDeleting?(d(),y(g,{key:2,text:"Deleting record"})):v("",!0),m(b,{columns:o.columns,styleClass:"vgt-table table-head v-middle",mode:"remote",rows:o.items,search:!0,"sort-options":{enabled:!1},"pagination-options":{enabled:!0},onSortChange:n.onSortChange,"max-height":"600px","row-style-class":"hover:bg-primary-100",onClick:t.createReacord},{"table-row":f(c=>[c.column.field=="expense_category_name"||c.column.field=="item_type"?(d(),p("div",Bt,[(d(!0),p(R,null,I(c.row.items,q=>(d(),p("div",{key:q.id},[e("span",null,l(q.expense_category_name),1)]))),128))])):v("",!0),c.column.field=="name"?te((d(),p("div",Dt,[m(D,{title:c.row.shortened_name,content:c.row.name,placement:"bottom",btnClass:"border-0 font-medium p-1",arrow:"",theme:"secondary-900"},null,8,["title","content"])])),[[J,c.row.name]]):v("",!0),c.column.field=="disclaimer"?(d(),p("div",St,[c.row.disclaimer==1?(d(),y(C,{key:0,label:"Yes",badgeClass:"bg-blue-700 text-blue-700 bg-opacity-[0.12] m-1"})):(d(),y(C,{key:1,label:"No",badgeClass:"bg-red-700 text-red-700 bg-opacity-[0.12] m-1"}))])):v("",!0),c.column.field=="status"?(d(),p("div",qt,[c.row.status==1?(d(),y(C,{key:0,label:c.row.status_name,badgeClass:"bg-amber-700 text-amber-700 bg-opacity-[0.12] m-1"},null,8,["label"])):(d(),y(C,{key:1,label:c.row.status_name,badgeClass:"bg-blue-700 text-blue-700 bg-opacity-[0.12] m-1"},null,8,["label"]))])):v("",!0),c.column.field=="action"?(d(),p("div",Ot,[m(S,{title:"Receive",onClick:q=>n.createRecord(c.row)},null,8,["onClick"])])):v("",!0)]),"pagination-bottom":f(c=>[e("div",Ft,[m(a,{total:o.totalItems,current:o.serverOptions.page,"per-page":o.serverOptions.rowsPerPage,onPageChanged:n.handlePageChange,pageChanged:c.pageChanged,perPageChanged:o.serverOptions.rowsPerPage,enableSelect:"",perPageOptions:o.perPageOptions,onChangePerPage:n.handlePerPageChange},null,8,["total","current","per-page","onPageChanged","pageChanged","perPageChanged","perPageOptions","onChangePerPage"])])]),_:1},8,["columns","rows","onSortChange","onClick"])])]),_:1}),m(Q,{editData:t.editData,onCloseModal:s[1]||(s[1]=c=>o.state.showModal=!1),ref:"form",onReload:s[2]||(s[2]=c=>n.fetchRecords())},null,8,["editData"]),m(N,{onCloseModal:t.closeProcessModal,ref:"processModal",onReload:s[3]||(s[3]=c=>n.fetchRecords())},null,8,["onCloseModal"]),m(z,{title:"Purchase Request",active:o.state.showRowModal,onClose:n.closeRowModal,themeClass:"bg-primary-500",sizeClass:"lg:w-1/2",bodyClass:"p-0"},{default:f(()=>[e("div",Vt,[e("div",$t,[Ut,e("span",Tt,l(o.rowData.reference_no),1)]),e("div",At,[Et,e("span",Lt,l(o.rowData.requested_by_name),1)]),e("div",Yt,[Qt,e("span",Nt,l(o.rowData.company_name),1)]),e("div",Gt,[jt,e("span",zt,l(o.rowData.dealership_name),1)]),e("div",Ht,[Jt,e("span",Kt,l(o.rowData.department_name),1)]),e("div",Wt,[Xt,e("span",Zt,l(o.rowData.purpose),1)])]),e("div",es,[m(G,{onClick:s[4]||(s[4]=c=>n.editRecord(o.rowData)),btnClass:"bg-primary-50 border border-primary-800 text-primary-800",title:"Edit Record",text:"Edit"}),m(j,{onClick:s[5]||(s[5]=c=>n.processRecord(o.rowData)),btnClass:"bg-primary-800 text-primary-50",title:"Process Record",titleTheme:"primary-500",text:"Process"})])]),_:1},8,["active","onClose"])]),_:1},8,["breadcrumbs"])}const Is=F(Pt,[["render",ts],["__scopeId","data-v-16872edc"]]);export{Is as default};
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings