File manager - Edit - /home/autoph/.trash/assets/index-30b0f2ae.js
Back
import{S as D}from"./StockReceivingService-41cc516d.js";import{T as K,s as W,L as X}from"./index-09409e71.js";import{B as O}from"./index-a5aa51c8.js";import{_ as F,r as m,o as d,d as p,e as u,g as f,f as e,I as l,h as q,J as I,G as k,b as v,w as Z,c as y,K as $,L as U,M as ee,N as te}from"./index-9809eabd.js";import{D as V,C as se,E as oe}from"./DeleteButton-a35f309f.js";import{S as T,U as re}from"./UpdateButton-a4d97754.js";import{V as A}from"./ViewButton-6d7b726a.js";import{I as E,F as ae}from"./vue-flatpickr.min-312faf18.js";import{P as ie}from"./ProcessButton-b1bc1834.js";import{F as L}from"./index-6ec21a5a.js";import"./index-0a3abe15.js";import"./vue-cleave.min-6fce3276.js";import{P as le}from"./index-a6ca9342.js";import{I as ne}from"./index-5ecfb783.js";import{L as Y}from"./Loading-8db5248e.js";import{F as ce,l as de}from"./lodash-55491229.js";import{T as ue}from"./index-eb93d4d3.js";import{C as me}from"./CloseButton-50a00ab5.js";import{V as _e}from"./array-2d279bb5.js";import{f as he}from"./file-type-pdf-a9709057.js";import{f as pe}from"./file-type-excel-3a83eaab.js";import{h as R}from"./moment-a9aaa855.js";import{B as fe}from"./index-4ddfce4f.js";import"./xhebrhsj-21ad2b9f.js";import"./_commonjsHelpers-de833af9.js";import"./es.string.replace-2e300990.js";/* empty css */const ge={components:{Loading:Y,FormModal:L,FormGroup:ce,TextInput:K,TextArea:ue,SubmitButton:T,CloseButton:me,UpdateButton:re,DeleteButton:V,ViewButton:A,Button:O,Info:E,FlatPickr:ae,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(a=>({prf_id:a.prf_id,prf_dtl_id:a.prf_dtl_id,canvass_id:a.canvass_id,po_header_id:a.po_header_id,po_dtl_id:a.id,company_id:a.company_id,dealer_code:a.dealer.code,dealer_name:a.dealer.name,dealer_id:a.dealer_id,asset_item_id:a.asset_item.id,asset_item_name:a.asset_item.name,uom:a.asset_item.uom,quantity:a.quantity,unit_cost:a.unit_cost,total_cost:a.total_cost,quantity_received:a.quantity_received,quantity_balance:a.quantity_balance}));let s=this.selected_item_list.map(a=>a.po_dtl_id),r=t.filter(a=>!s.includes(a.po_dtl_id)&&a.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,a)=>{t.append(`file_attachment[${a}]`,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 D.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 D.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},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 a=t.target.files;this.form[s]=a,this.form.file_attachment_names=Array.from(a).map(o=>o.name),this.form[r]=[],Array.from(a).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.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),a=this.selected_item_list[t],o=a.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(a),console.log(" Initial Quantity :"+o+" current available quantity "+n+" current input receive "+r),isNaN(r)||r<0?(a.error="Input must be a valid number",a.quantity_received=0):r>n?a.error=`Quantity must not be greater than available quantity (${n})`:(a.error="",a.quantity_received=r),console.log("final item ..."),console.log(a),console.log("final selected item..."),console.log(this.selected_item_list),this.computeTotal(),this.validateForm()},validateForm(){this.isFormValid=this.selected_item_list.every(t=>t.error==="")}},mounted(){}},_=t=>($("data-v-a4f92f67"),t=t(),U(),t),ve=_(()=>e("div",{class:"w-full flex justify-between pr-4"},[e("div",{class:"text-xl"},"Stock Receiving")],-1)),be={class:"grid grid-flow-col gap-1 p-3 bg-primary-800 text-white"},ye={class:"col-span-1"},we=_(()=>e("label",{class:"block"},"Vendor : ",-1)),xe={class:"col-span-1"},Ce=_(()=>e("label",{class:"block"},"Company : ",-1)),Pe={class:"col-span-1"},Re=_(()=>e("label",{class:"block"},"Contact Person : ",-1)),Ie=_(()=>e("br",null,null,-1)),ke={class:"col-span-1"},De=_(()=>e("label",{class:"block"},"Terms : ",-1)),Be=_(()=>e("br",null,null,-1)),Me={class:"space-y-4"},Se={class:"border border-primary-800 min-h-48"},qe=_(()=>e("div",{class:"bg-slate-400 p-2"},[e("div",{class:"text-xl text-slate-900 font-serif italic text-normal"}," Active Items ")],-1)),Oe={class:"table-container"},Fe={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-48"},Ve=["onDblclick"],Te={class:"text-center"},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:"border border-primary-800 min-h-48"},je=_(()=>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)),ze={class:"row-star-2 table-container"},He={class:"w-full"},Je=_(()=>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)),Ke={class:"h-64"},We=["onDblclick"],Xe={class:"text-center",scope:"col"},Ze={class:"text-center",scope:"col"},et={class:"text-center",scdrop:"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"},at={key:0,class:"text-red-500 text-sm mx-auto"},it={class:"my-2"},lt={class:"w-full my-5"},nt={class:"sticky top-0"},ct=_(()=>e("td",null,null,-1)),dt=_(()=>e("td",null,null,-1)),ut=_(()=>e("td",null,null,-1)),mt=_(()=>e("td",null,null,-1)),_t=_(()=>e("th",{class:"text-right border border-slate-200 ..."},"Total",-1)),ht={class:"text-center border border-slate-200 ..."},pt=_(()=>e("tbody",{class:"h-64"},null,-1)),ft={class:"grid grid-cols-1 lg:grid-cols-7 gap-4 p"},gt={class:"grid grid-cols-4 gap-4"},vt={class:"w-full flex justify-between relative"},bt=_(()=>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)),yt={class:"flex gap-1 justify-end mt-4"};function wt(t,s,r,a,o,n){const h=m("TextInput"),x=m("Loading"),g=m("FormGroup"),B=m("Button"),C=m("SubmitButton"),M=m("FormModal");return d(),p("div",null,[u(M,{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(()=>[e("div",null,[e("div",be,[e("div",ye,[we,e("span",null,l(o.form.supplier_name),1)]),e("div",xe,[Ce,e("span",null,l(o.form.company_name),1)]),e("div",Pe,[Re,e("span",null,l(o.form.contact_person),1),q(),Ie,e("span",null,"#"+l(o.form.contact_no),1)]),e("div",ke,[De,e("span",null,l(o.form.terms),1),q(),Be])]),e("section",Me,[e("div",Se,[qe,e("div",Oe,[e("table",Fe,[$e,e("tbody",Ue,[(d(!0),p(I,null,k(n.activePoItems,(i,b)=>(d(),p("tr",{key:b,onDblclick:w=>n.addReceiveItem(i)},[e("td",Te,l(i.dealer_code)+" - "+l(i.dealer_name),1),e("td",Ae,l(i.asset_item_name),1),e("td",Ee,l(i.uom),1),e("td",Le,l(i.quantity),1),e("td",Ye,l(i.unit_cost),1),e("td",Qe,l(i.quantity_received!==null?i.quantity_received:0),1),e("td",Ne,l(i.quantity_balance),1)],40,Ve))),128))])])])]),e("div",Ge,[je,e("div",ze,[e("table",He,[Je,e("tbody",Ke,[(d(!0),p(I,null,k(o.selected_item_list,(i,b)=>(d(),p("tr",{key:b,class:"hover:bg-slate-100",onDblclick:w=>n.removeSelectedItem(b)},[e("td",Xe,l(i.dealer_name),1),e("td",Ze,l(i.asset_item_name),1),e("td",et,l(i.uom),1),e("td",tt,l(i.quantity),1),e("td",st,l(i.unit_cost),1),e("td",ot,l(i.quantity_balance),1),e("td",rt,[u(h,{type:"number",placeholder:"Input received quantity",class:"h-10 w-1/2 mx-auto",classInput:"h-[48px] w-full",modelValue:i.quantity_received,"onUpdate:modelValue":w=>i.quantity_received=w,modelModifiers:{number:!0},onInput:w=>n.validateAndComputeTotal(b,w)},null,8,["modelValue","onUpdate:modelValue","onInput"]),i.error?(d(),p("span",at,[e("p",it,l(i.error),1)])):v("",!0)])],40,We))),128))])]),e("table",lt,[e("thead",nt,[e("tr",null,[ct,dt,ut,mt,_t,e("th",ht,l(o.totalCost),1)])]),pt])]),e("form",{onSubmit:s[5]||(s[5]=Z((...i)=>t.confirmSubmit&&t.confirmSubmit(...i),["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",ft,[u(g,{class:"lg:col-span-2",label:"DR#",isRequired:!0},{default:f(()=>[e("div",null,[u(h,{type:"text",placeholder:"Input DR no.",modelValue:o.form.dr_no,"onUpdate:modelValue":s[0]||(s[0]=i=>o.form.dr_no=i),error:o.errors.dr_no,classInput:"h-[48px]"},null,8,["modelValue","error"])])]),_:1}),u(g,{class:"lg:col-span-2",label:"INVOICE#",isRequired:!0},{default:f(()=>[e("div",null,[u(h,{type:"text",placeholder:"Input invoice no.",modelValue:o.form.invoice_no,"onUpdate:modelValue":s[1]||(s[1]=i=>o.form.invoice_no=i),error:o.errors.invoice_no,classInput:"h-[48px]"},null,8,["modelValue","error"])])]),_:1}),u(g,{label:"Invoice Amount",isRequired:!0,class:"lg:col-span-1",labelClass:"px-2"},{default:f(()=>[u(h,{type:"text",placeholder:"Input invoice amount",modelValue:o.form.invoice_amount,"onUpdate:modelValue":s[2]||(s[2]=i=>o.form.invoice_amount=i),error:o.errors.invoice_amount,classInput:"h-[48px]"},null,8,["modelValue","error"])]),_:1})]),e("div",gt,[u(g,{label:"Attachment",isRequired:!0,labelClass:"px-2"},{default:f(()=>[e("div",vt,[e("input",{type:"file",id:"file_attachment",name:"file_attachment",onChange:s[3]||(s[3]=i=>n.handleMainImageUpload(i,"file_attachment","file_attachment_previews")),ref:"file_attachment",class:"absolute inset-0 opacity-0 w-full h-full cursor-pointer",multiple:""},null,544),bt,u(B,{onClick:s[4]||(s[4]=i=>n.Clearfile_attachment("file_attachment","file_attachment_previews")),btnClass:"bg-red-500 mx-1 text-gray-100 min-h-3 pt-2"},{default:f(()=>[q(" Clear ")]),_:1})])]),_:1})]),e("div",null,[e("ul",null,[(d(!0),p(I,null,k(o.form.file_attachment_names,(i,b)=>(d(),p("li",{key:b},l(i),1))),128))])]),e("div",yt,[u(C,{onClick:n.submitForm,disabled:!o.isFormValid},null,8,["onClick","disabled"])])],32)])])])]),_:1},8,["active","onClose","themeClass"])])}const xt=F(ge,[["render",wt],["__scopeId","data-v-a4f92f67"]]);const Ct={components:{Layout:X,Loading:Y,Pagination:le,InputGroup:ne,ViewButton:A,CreateButton:se,EditButton:oe,DeleteButton:V,ProcessButton:ie,Form:xt,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:R()}},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 D.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,a)=>({"#":(this.serverOptions.page-1)*this.serverOptions.rowsPerPage+(a+1),...r,needed_at:R(r.needed_at).format("MMM D, YYYY"),created_at:R(r.created_at).format("MMM D, YYYY"),overdue:this.currentDate.isAfter(R(r.needed_at))})),this.totalItems=t.data.total??0}).finally(()=>{this.state.isLoading=!1,this.state.isMounted=!0})},async deliveryInfo(){await D.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=>($("data-v-16872edc"),t=t(),U(),t),Pt={class:"p-6 bg-[url('@/assets/images/background/shopping.jpg')] bg-cover bg-[center]"},Rt={class:"bg-white bg-opacity-[0.8] p-4 rounded-md md:flex items-center"},It={class:"flex-1 md:mb-0 mb-3"},kt={class:"md:flex md:space-x-3 items-center flex-none rtl:space-x-reverse float-right"},Dt={key:0},Bt={key:1,class:"flex gap-1"},Mt={key:2,class:"flex gap-1"},St={key:3,class:"flex gap-1"},qt={key:4,class:"flex gap-1"},Ot={class:"py-4 px-3 flex justify-end"},Ft={class:"space-y-3 p-6"},$t={class:"text-xl"},Ut=P(()=>e("span",{class:"text-primary-700"},"Reference No: ",-1)),Vt={class:"text-2xl font-semibold text-primary-500"},Tt={class:""},At=P(()=>e("span",null,"Requested by: ",-1)),Et={class:"font-bold"},Lt={class:""},Yt=P(()=>e("span",null,"Company: ",-1)),Qt={class:"font-bold"},Nt={class:""},Gt=P(()=>e("span",null,"Dealership: ",-1)),jt={class:"font-bold"},zt={class:""},Ht=P(()=>e("span",null,"Department: ",-1)),Jt={class:"font-bold"},Kt={class:""},Wt=P(()=>e("span",null,"Purpose: ",-1)),Xt={class:"font-bold"},Zt={class:"flex gap-2 justify-center border p-4 bg-primary-100 shadow"};function es(t,s,r,a,o,n){const h=m("InputGroup"),x=m("Button"),g=m("Loading"),B=m("Tooltip"),C=m("Badge"),M=m("ViewButton"),i=m("Pagination"),b=m("vue-good-table"),w=m("Card"),Q=m("Form"),N=m("ProcessForm"),G=m("EditButton"),j=m("ProcessButton"),z=m("FormModal"),H=m("Layout"),J=ee("tooltip");return d(),y(H,{breadcrumbs:o.breadcrumbs},{nocard:f(()=>[u(w,{noborder:""},{default:f(()=>[e("div",Pt,[e("div",Rt,[e("h6",It,l(o.title),1),e("div",kt,[u(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"]),u(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),u(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",Dt,[(d(!0),p(I,null,k(c.row.items,S=>(d(),p("div",{key:S.id},[e("span",null,l(S.expense_category_name),1)]))),128))])):v("",!0),c.column.field=="name"?te((d(),p("div",Bt,[u(B,{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",Mt,[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",St,[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",qt,[u(M,{title:"Receive",onClick:S=>n.createRecord(c.row)},null,8,["onClick"])])):v("",!0)]),"pagination-bottom":f(c=>[e("div",Ot,[u(i,{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}),u(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"]),u(N,{onCloseModal:t.closeProcessModal,ref:"processModal",onReload:s[3]||(s[3]=c=>n.fetchRecords())},null,8,["onCloseModal"]),u(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",Ft,[e("div",$t,[Ut,e("span",Vt,l(o.rowData.reference_no),1)]),e("div",Tt,[At,e("span",Et,l(o.rowData.requested_by_name),1)]),e("div",Lt,[Yt,e("span",Qt,l(o.rowData.company_name),1)]),e("div",Nt,[Gt,e("span",jt,l(o.rowData.dealership_name),1)]),e("div",zt,[Ht,e("span",Jt,l(o.rowData.department_name),1)]),e("div",Kt,[Wt,e("span",Xt,l(o.rowData.purpose),1)])]),e("div",Zt,[u(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"}),u(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 Ds=F(Ct,[["render",es],["__scopeId","data-v-16872edc"]]);export{Ds as default};
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings