File manager - Edit - /home/autoph/public_html/projects/ahg-hr/assets/index.75e040a3.js
Back
import{w as ae,L as le}from"./index.e90b797d.js";import{C as ce}from"./index.609bcb7c.js";import{B as G}from"./index.1e572db2.js";import{B as de}from"./index.8925dff3.js";import{I as U}from"./index.a5110576.js";import{I as pe}from"./index.d1aceaee.js";import{l as me}from"./lodash.adf89e63.js";import{a as x,_ as P,r as n,o as a,c as v,w as m,j as _,d as r,k as q,e as i,b as h,f as b,t as g,m as D,h as E,F as O}from"./index.3a33b88d.js";import{F as Y}from"./index.f8c90c2f.js";import{F as W}from"./index.8531a646.js";/* empty css */import{T as N}from"./index.a785f83f.js";import{T as H}from"./index.aaf22f12.js";import{C as M}from"./CloseButton.d312e091.js";import{D as Q}from"./DenyButton.b6eeb370.js";/* empty css */import{S as L}from"./SubmitButton.16c237a6.js";import{U as Z}from"./UpdateButton.285ca87f.js";import"./jspdf.es.min.763284f3.js";/* empty css */import{V as F}from"./array.0146f311.js";import{L as j}from"./Loading.d8a54a1a.js";import{A as K}from"./ApproverService.fd062fd5.js";import{F as J}from"./FileService.3bf05a89.js";import{M as X}from"./Multiselect.c4704026.js";import{C as ee}from"./index.ecbbc19d.js";import{F as te}from"./index.25258c66.js";import{p as se,j as oe}from"./scr-1.d9aaecca.js";import{A as ue}from"./main.esm.786d3a20.js";import{V as re}from"./ViewButton.a3057bdc.js";import{E as z}from"./EmployeeOffsetService.e4fc6909.js";import{m as fe,p as he,x as ge,I as ve,y as _e}from"./tabs.0182c6c2.js";import{D as ye}from"./DeleteButton.3d4df072.js";import{E as xe}from"./EditButton.5d564d58.js";import{P as we}from"./index.1269b959.js";import"./logo-black.7c15feb3.js";import"./logo-white.b04c5a89.js";import"./transition.bee8c07d.js";import"./vue-cleave.min.88d00a75.js";import"./es.string.replace.f897d4b0.js";import"./index.212d4b04.js";import"./ck-white.4bf441fa.js";const V="https://staging-ahg-hr-api.autohub.ph/api/v1/offset-approval",be="https://staging-ahg-hr-api.autohub.ph/api/v1/update-offset-approval",$="https://staging-ahg-hr-api.autohub.ph/api/v1/offset-earning-approval",Ae="https://staging-ahg-hr-api.autohub.ph/api/v1/update-offset-earning-approval",R={fetchRecords(e={}){return x.get(`${V}`,{params:e})},fetchRecord(e){return x.get(`${V}/${e}`)},async create(e){return x.post(`${V}`,e)},async update(e,t){return x.put(`${V}/${e}`,t)},async updateApprover(e,t){return x.put(`${be}/${e}`,t)},async remove(e){return x.delete(`${V}/${e}`)},fetchEarningRecords(e={}){return x.get(`${$}`,{params:e})},fetchEarningRecord(e){return x.get(`${$}/${e}`)},async createEarning(e){return x.post(`${$}`,e)},async updateEarning(e,t){return x.put(`${$}/${e}`,t)},async updateEarningApprover(e,t){return x.put(`${Ae}/${e}`,t)},async removeEarning(e){return x.delete(`${$}/${e}`)}};const Ce={components:{FileType:te,DenyButton:Q,FormModal:W,FormGroup:Y,TextInput:N,Textarea:H,SubmitButton:L,UpdateButton:Z,CloseButton:M,Loading:j,Multiselect:X,Icon:U,Checkbox:ee},data(){return{currentEmployeeId:this.$store.userSettings.getActiveUser.employees?this.$store.userSettings.getActiveUser.employees.employee_id:"",currentClassificationId:this.$store.userSettings.getActiveUser.employees?this.$store.userSettings.getActiveUser.employees.classification_id:"",currentRecommendingId:"",currentApprovingId:"",btnTitle:"",recommendingOptions:[],approvingOptions:[],recommending:"",approving:"",status:[],recommending:"",approving:"",form:{date:"",from_from:"",to_time:"",destination:"",description:"",attachment:"",recommending_id:"",approver_id:""},errors:{},state:{isEdit:!1,isSaving:!1,isLoading:!1},fileIcons:{pdf:se,jpg:oe,default:""}}},methods:{getFileTypeImage(e){if(typeof e=="string"){if(!e)return this.fileIcons.default;const t=e.substring(e.lastIndexOf(".")+1).toLowerCase();return this.fileIcons[t]||this.fileIcons.default}},async viewAttachment(e){if(this.state.isDownloading)return;this.state.isDownloading=!0;let t=await J.Reader2("employee-overtime",e),s;if(e.endsWith(".pdf"))s="application/pdf";else if(e.endsWith(".png"))s="image/png";else if(e.endsWith(".jpg")||e.endsWith(".jpeg"))s="image/jpeg";else if(e.endsWith(".svg"))s="image/svg+xml";else throw new Error("Unsupported file type");const l=atob(t),o=new Array(l.length);for(let p=0;p<l.length;p++)o[p]=l.charCodeAt(p);const c=new Uint8Array(o),u=new Blob([c],{type:s}),y=URL.createObjectURL(u);window.open(y),this.state.isLoadingPDF=!1},handleMainImageUpload(){const e=event.target.files[0];this.form.attachment=e;const t=new FileReader;t.onload=()=>{e.type.startsWith("image/")?this.form.imageView=t.result:e.type==="application/pdf"?this.form.imageView=this.pdf_file_view:e.type==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"&&(this.form.imageView=this.excel_file_view)},console.log(e),t.readAsDataURL(e)},async loadRecord(e){this.resetForm(),this.form=e,this.form.date=new Date(e.date).toLocaleDateString("en-CA").split("T")[0],console.log(this.$store.userSettings.getActiveUser.employees.classification_id),console.log(this.currentClassificationId),this.currentRecommendingId=e.recommending?e.recommending[0].employee_id:"",this.currentApprovingId=e.approving?e.approving[0].employee_id:"",this.recommending=e.recommending?e.recommending[0].firstname+" "+e.recommending[0].lastname:"",this.approving=e.approving?e.approving[0].firstname+" "+e.approving[0].lastname:"",this.currentApprovingId==this.currentEmployeeId&&this.form.approver_id==this.currentEmployeeId?this.btnTitle="Approve":this.currentRecommendingId==this.currentEmployeeId&&this.form.status<1&&(this.btnTitle="Submit For Approval"),this.currentClassificationId>=3&&await K.fetchEmployeeApprover(e.employee_id).then(t=>{if(t.status==200)console.log(t),this.recommendingOptions=t.data.map((s,l)=>({value:s.employee_id,label:s.firstname+" "+s.lastname})),this.approvingOptions=t.data.filter(s=>s.classification_id>=3).map((s,l)=>({value:s.employee_id,label:s.firstname+" "+s.lastname}));else throw new Error("Failed to fetch employee approvers")})},closeModal(){this.state.showModal=!1},resetForm(){this.state.isEdit=!1,this.form={date:"",days:"",hours:"",description:"",attachment:"",recommending_id:this.form.recommending_id,approver_id:this.form.approver_id}},reload(){return this.$emit("reload")},async updateApproverRecord(){this.state.isSaving=!0;const e=this.form.id;let t={recommending_id:this.form.recommending_id,approver_id:this.form.approver_id};await R.updateEarningApprover(e,t).then(s=>{s.status==201?(this.$swal.fire({title:"Great!",text:"Record successfully updated.",icon:"success",timer:2e3}),this.state.showModal=!1,this.state.isSaving=!0):this.$swal.fire({title:"Ooops! something is wrong.",text:"Please contact system administrator",icon:"error",timer:2e3}),this.reload()}).catch(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})})},async saveRecord(){this.state.isSaving=!0;const e=this.form.id;await R.updateEarning(e,this.status).then(t=>{t.status==201?(this.$swal.fire({title:"Great!",text:"Record successfully updated.",icon:"success",timer:2e3}),this.state.isSaving=!1,this.state.showModal=!1):this.$swal.fire({title:"Ooops! something is wrong.",text:"Please contact system administrator",icon:"error",timer:2e3}),this.reload()}).catch(t=>{t.response.status==422?this.$swal.fire({title:"Ooops! something is wrong.",text:t.response.data.message,icon:"warning"}):this.$swal.fire({title:"Ooops! something is wrong.",text:"Please contact system administrator",icon:"error",timer:2e3})})},async submitForm(){this.form.recommending_id==this.currentEmployeeId&&(this.status={status:1}),this.form.approver_id==this.currentEmployeeId&&(this.status={status:2});try{this.$swal.fire({title:"Are you sure you want to save submit this record?",text:"",icon:"question",showCancelButton:!0,confirmButtonColor:"#34c38f",cancelButtonColor:"#f46a6a",confirmButtonText:"Yes",cancelButtonText:"No"}).then(e=>{e.value&&this.saveRecord()})}catch(e){if(e instanceof F){const t={};e.inner.forEach(s=>{t[s.path]=s.message}),this.errors=t}}},async updateApproverForm(){try{this.$swal.fire({title:"Are you sure you want to update the approver of this record?",text:"",icon:"question",showCancelButton:!0,confirmButtonColor:"#34c38f",cancelButtonColor:"#f46a6a",confirmButtonText:"Yes",cancelButtonText:"No"}).then(e=>{e.value&&this.updateApproverRecord()})}catch(e){if(e instanceof F){const t={};e.inner.forEach(s=>{t[s.path]=s.message}),this.errors=t}}},async denyForm(){this.status={status:99};try{this.$swal.fire({title:"Are you sure you want to deny this record?",text:"",icon:"question",showCancelButton:!0,confirmButtonColor:"#34c38f",cancelButtonColor:"#f46a6a",confirmButtonText:"Yes",cancelButtonText:"No",html:` <textarea id="swal-input" style="width: 100%; height: 80px; padding: 8px; border: 1px solid #ced4da; border-radius: 4px;" placeholder="Enter reason"></textarea>`,preConfirm:()=>{const e=document.getElementById("swal-input").value;return e?this.denied_reason=e:(this.$swal.showValidationMessage("The reason field is required"),!1)}}).then(e=>{this.status={status:99,denied_reason:this.denied_reason},e.value&&this.saveRecord()})}catch(e){if(e instanceof F){const t={};e.inner.forEach(s=>{t[s.path]=s.message}),this.errors=t}}}},mounted(){}},Re={class:"text-slate-600 dark:text-slate-400 text-sm font-normal"},Ie={class:"grid grid-cols-12 gap-4"},Ee={class:"col-span-6"},ke={class:"col-span-6"},Fe={class:"col-span-12"},Se={class:"col-span-12"},Te={key:1},Be={class:"grid grid-cols-12 justify-center items-center"},De={class:"col-span-8 flex justify-between items-center gap-4"},Oe={class:"col-span-6 flex justify-center items-center gap-4"},Ve={class:"font-bold"},$e={class:"col-span-6 flex justify-center items-center gap-4"},Pe={class:"font-bold"},Ue={key:2},Me={class:"grid grid-cols-12 gap-4"},Le={class:"col-span-6"},je={class:"relative"},ze={class:"col-span-6"},Ge={class:"relative"},qe={class:"flex gap-1 justify-end pt-16"},Ye={key:0,class:"flex gap-1 justify-end"},We={key:1,class:"flex gap-1 justify-end"};function Ne(e,t,s,l,o,c){const u=n("Loading"),y=n("flat-pickr"),p=n("FormGroup"),A=n("TextInput"),k=n("FileType"),S=n("Textarea"),C=n("Multiselect"),I=n("UpdateButton"),T=n("DenyButton"),B=n("CloseButton"),f=n("FormModal");return a(),v(f,{title:"View Record",active:o.state.showModal,sideTitle:this.form.status==0?"for recommendation":this.form.status==1?"for approval":this.form.status==2?"approved":this.form.status==99?"denied":"",badgeColor:this.form.status==0?"warning":this.form.status==1?"info":this.form.status==2?"success":this.form.status==99?"danger":"",onSubmit:e.confirmSubmit,onClose:c.closeModal,themeClass:"bg-gray-800",sizeClass:"lg:w-2/4"},{default:m(()=>[o.state.isEdit&&o.state.isLoading?(a(),v(u,{key:0,text:"Fetching record"})):_("",!0),r("div",Re,[r("form",{onSubmit:t[6]||(t[6]=q((...d)=>e.confirmSubmit&&e.confirmSubmit(...d),["prevent"])),class:"space-y-4",enctype:"multipart/form-data"},[o.state.isSaving?(a(),v(u,{key:0,text:"Saving record"})):_("",!0),r("div",Ie,[r("div",Ee,[i(p,{label:"Date",isRequired:!0},{default:m(()=>[i(y,{modelValue:o.form.date,"onUpdate:modelValue":t[0]||(t[0]=d=>o.form.date=d),class:"form-control h-[48px]",id:"date",placeholder:"yyyy, dd M"},null,8,["modelValue"])]),_:1})]),r("div",ke,[i(p,{label:"Hours",isRequired:!0},{default:m(()=>[i(A,{type:"text",modelValue:o.form.hours,"onUpdate:modelValue":t[1]||(t[1]=d=>o.form.hours=d),error:o.errors.hours,classInput:"h-[48px]"},null,8,["modelValue","error"])]),_:1})]),r("div",Fe,[i(p,{label:"Attachment"},{default:m(()=>[typeof o.form.attachment=="string"?(a(),h("div",{key:0,class:"flex items-center gap-2 mt-2 cursor-pointer",onClick:t[2]||(t[2]=d=>c.viewAttachment(o.form.attachment))},[i(k,{image:c.getFileTypeImage(o.form.attachment)},null,8,["image"]),b(" "+g(o.form.attachment),1)])):_("",!0)]),_:1})]),r("div",Se,[i(p,{label:"Remarks"},{default:m(()=>[i(S,{name:"pn4",placeholder:"Textarea",modelValue:o.form.description,"onUpdate:modelValue":t[3]||(t[3]=d=>o.form.description=d)},null,8,["modelValue"])]),_:1})])]),o.currentClassificationId<=2?(a(),h("div",Te,[r("div",Be,[r("div",De,[r("div",Oe,[t[7]||(t[7]=b(" Recommending: ")),r("p",Ve,g(o.recommending),1)]),r("div",$e,[t[8]||(t[8]=b(" Approving: ")),r("p",Pe,g(o.approving),1)])])])])):(a(),h("div",Ue,[r("div",Me,[r("div",Le,[i(p,{label:"Recommending"},{default:m(()=>[r("div",je,[i(C,{modelValue:o.form.recommending_id,"onUpdate:modelValue":t[4]||(t[4]=d=>o.form.recommending_id=d),"close-on-select":!0,searchable:!0,id:"recommending_id",options:o.recommendingOptions},null,8,["modelValue","options"])])]),_:1})]),r("div",ze,[i(p,{label:"Approver"},{default:m(()=>[r("div",Ge,[i(C,{modelValue:o.form.approver_id,"onUpdate:modelValue":t[5]||(t[5]=d=>o.form.approver_id=d),"close-on-select":!0,searchable:!0,id:"approver_id",options:o.approvingOptions},null,8,["modelValue","options"])])]),_:1})])])])),r("div",qe,[this.form.status==0&&o.currentRecommendingId==o.currentEmployeeId||o.currentApprovingId==o.currentEmployeeId&&this.form.status==1&&o.currentApprovingId==this.form.approver_id||this.form.approver_id==this.form.recommending_id&&o.currentApprovingId==this.form.approver_id&&o.currentEmployeeId==this.form.approver_id?(a(),h("div",Ye,[this.form.status<=1?(a(),v(I,{key:0,onClick:c.submitForm,text:o.btnTitle},null,8,["onClick","text"])):_("",!0),this.form.status<=1?(a(),v(T,{key:1,onClick:c.denyForm,text:"Deny"},null,8,["onClick"])):_("",!0)])):this.form.status==0&&o.currentApprovingId==o.currentEmployeeId||o.currentApprovingId!=this.form.approver_id?(a(),h("div",We,[this.form.status<=1?(a(),v(I,{key:0,onClick:c.updateApproverForm,text:"Update Approver"},null,8,["onClick"])):_("",!0)])):_("",!0),i(B,{onClick:c.closeModal},null,8,["onClick"])])],32)])]),_:1},8,["active","sideTitle","badgeColor","onSubmit","onClose"])}const ie=P(Ce,[["render",Ne],["__scopeId","data-v-d12b3d0d"]]);const He={components:{FileType:te,FormModal:W,FormGroup:Y,TextInput:N,Textarea:H,SubmitButton:L,UpdateButton:Z,DenyButton:Q,CloseButton:M,Loading:j,Multiselect:X,Icon:U,Checkbox:ee},data(){return{currentEmployeeId:this.$store.userSettings.getActiveUser.employees?this.$store.userSettings.getActiveUser.employees.employee_id:"",currentClassificationId:this.$store.userSettings.getActiveUser.employees?this.$store.userSettings.getActiveUser.employees.classification_id:"",currentRecommendingId:"",currentApprovingId:"",btnTitle:"",recommendingOptions:[],approvingOptions:[],recommending:"",approving:"",status:[],form:{date_from:"",date_to:"",from_time:"",to_time:"",destination:"",description:"",attachment:"",recommending_id:"",approver_id:""},errors:{},state:{isEdit:!1,isSaving:!1,isLoading:!1},fileIcons:{pdf:se,jpg:oe,default:""}}},methods:{getFileTypeImage(e){if(typeof e=="string"){if(!e)return this.fileIcons.default;const t=e.substring(e.lastIndexOf(".")+1).toLowerCase();return this.fileIcons[t]||this.fileIcons.default}},async viewAttachment(e){if(this.state.isDownloading)return;this.state.isDownloading=!0;let t=await J.Reader2("employee-overtime",e),s;if(e.endsWith(".pdf"))s="application/pdf";else if(e.endsWith(".png"))s="image/png";else if(e.endsWith(".jpg")||e.endsWith(".jpeg"))s="image/jpeg";else if(e.endsWith(".svg"))s="image/svg+xml";else throw new Error("Unsupported file type");const l=atob(t),o=new Array(l.length);for(let p=0;p<l.length;p++)o[p]=l.charCodeAt(p);const c=new Uint8Array(o),u=new Blob([c],{type:s}),y=URL.createObjectURL(u);window.open(y),this.state.isLoadingPDF=!1},handleMainImageUpload(){const e=event.target.files[0];this.form.attachment=e;const t=new FileReader;t.onload=()=>{e.type.startsWith("image/")?this.form.imageView=t.result:e.type==="application/pdf"?this.form.imageView=this.pdf_file_view:e.type==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"&&(this.form.imageView=this.excel_file_view)},console.log(e),t.readAsDataURL(e)},async loadRecord(e){this.resetForm(),this.form=e,this.form.date_from=new Date(e.date_from).toLocaleDateString("en-CA").split("T")[0],this.form.date_to=new Date(e.date_to).toLocaleDateString("en-CA").split("T")[0],this.currentRecommendingId=e.recommending?e.recommending[0].employee_id:"",this.currentApprovingId=e.approving?e.approving[0].employee_id:"",this.recommending=e.recommending?e.recommending[0].firstname+" "+e.recommending[0].lastname:"",this.approving=e.approving?e.approving[0].firstname+" "+e.approving[0].lastname:"",this.currentRecommendingId==this.currentEmployeeId&&this.form.status<1?this.btnTitle="Submit For Approval":this.currentApprovingId==this.currentEmployeeId&&(this.btnTitle="Approve"),this.currentClassificationId>=3&&await K.fetchEmployeeApprover(e.employee_id).then(t=>{if(t.status==200)this.recommendingOptions=t.data.map((s,l)=>({value:s.employee_id,label:s.firstname+" "+s.lastname})),this.approvingOptions=t.data.filter(s=>s.classification_id>=3).map((s,l)=>({value:s.employee_id,label:s.firstname+" "+s.lastname}));else throw new Error("Failed to fetch employee approvers")})},closeModal(){this.state.showModal=!1},resetForm(){this.state.isEdit=!1,this.form={date_from:"",date_to:"",from_time:"",to_time:"",days:"",hours:"",description:"",attachment:"",recommending_id:this.form.recommending_id,approver_id:this.form.approver_id}},reload(){return this.$emit("reload")},async updateApproverRecord(){this.state.isSaving=!0;const e=this.form.id;this.state.isSaving=!1;let t={recommending_id:this.form.recommending_id,approver_id:this.form.approver_id};await R.updateApprover(e,t).then(s=>{s.status==201?(this.$swal.fire({title:"Great!",text:"Record successfully updated.",icon:"success",timer:2e3}),this.state.showModal=!1):this.$swal.fire({title:"Ooops! something is wrong.",text:"Please contact system administrator",icon:"error",timer:2e3}),this.reload()}).catch(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})})},async saveRecord(){this.state.isSaving=!0;const e=this.form.id;await R.update(e,this.status).then(t=>{t.status==201?(this.$swal.fire({title:"Great!",text:"Record successfully updated.",icon:"success",timer:2e3}),this.state.isSaving=!1,this.state.showModal=!1):this.$swal.fire({title:"Ooops! something is wrong.",text:"Please contact system administrator",icon:"error",timer:2e3}),this.reload()}).catch(t=>{t.response.status==422?this.$swal.fire({title:"Ooops! something is wrong.",text:t.response.data.message,icon:"warning"}):this.$swal.fire({title:"Ooops! something is wrong.",text:"Please contact system administrator",icon:"error",timer:2e3})})},async submitForm(){this.form.recommending_id==this.currentEmployeeId&&(this.status={status:1}),this.form.approver_id==this.currentEmployeeId&&(this.status={status:2});try{this.$swal.fire({title:"Are you sure you want to save submit this record?",text:"",icon:"question",showCancelButton:!0,confirmButtonColor:"#34c38f",cancelButtonColor:"#f46a6a",confirmButtonText:"Yes",cancelButtonText:"No"}).then(e=>{e.value&&this.saveRecord()})}catch(e){if(e instanceof F){const t={};e.inner.forEach(s=>{t[s.path]=s.message}),this.errors=t}}},async updateApproverForm(){try{this.$swal.fire({title:"Are you sure you want to update the approver of this record?",text:"",icon:"question",showCancelButton:!0,confirmButtonColor:"#34c38f",cancelButtonColor:"#f46a6a",confirmButtonText:"Yes",cancelButtonText:"No"}).then(e=>{e.value&&this.updateApproverRecord()})}catch(e){if(e instanceof F){const t={};e.inner.forEach(s=>{t[s.path]=s.message}),this.errors=t}}},async denyForm(){this.status={status:99};try{this.$swal.fire({title:"Are you sure you want to deny this record?",text:"",icon:"question",showCancelButton:!0,confirmButtonColor:"#34c38f",cancelButtonColor:"#f46a6a",confirmButtonText:"Yes",cancelButtonText:"No",html:` <textarea id="swal-input" style="width: 100%; height: 80px; padding: 8px; border: 1px solid #ced4da; border-radius: 4px;" placeholder="Enter reason"></textarea>`,preConfirm:()=>{const e=document.getElementById("swal-input").value;return e?this.denied_reason=e:(this.$swal.showValidationMessage("The reason field is required"),!1)}}).then(e=>{this.status={status:99,denied_reason:this.denied_reason},e.value&&this.saveRecord()})}catch(e){if(e instanceof F){const t={};e.inner.forEach(s=>{t[s.path]=s.message}),this.errors=t}}}},mounted(){}},Qe={class:"text-slate-600 dark:text-slate-400 text-sm font-normal"},Ze={class:"grid grid-cols-12 gap-4"},Ke={class:"col-span-6"},Je={class:"text-[#ed539f]"},Xe={class:"col-span-6"},et={class:"text-[#ed539f]"},tt={class:"col-span-6"},st={class:"col-span-12"},ot={class:"col-span-12"},rt={key:1},it={class:"grid grid-cols-12 justify-center items-center"},nt={class:"col-span-8 flex justify-between items-center gap-4"},at={class:"col-span-6 flex justify-center items-center gap-4"},lt={class:"font-bold"},ct={class:"col-span-6 flex justify-center items-center gap-4"},dt={class:"font-bold"},pt={key:2},mt={class:"grid grid-cols-12 gap-4"},ut={class:"col-span-6"},ft={class:"relative"},ht={class:"col-span-6"},gt={class:"relative"},vt={class:"flex gap-1 justify-end pt-8"},_t={key:0,class:"flex gap-1 justify-end"},yt={key:1,class:"flex gap-1 justify-end"};function xt(e,t,s,l,o,c){const u=n("Loading"),y=n("flat-pickr"),p=n("FormGroup"),A=n("TextInput"),k=n("FileType"),S=n("Textarea"),C=n("Multiselect"),I=n("UpdateButton"),T=n("DenyButton"),B=n("CloseButton"),f=n("FormModal");return a(),v(f,{title:"View Record",active:o.state.showModal,sideTitle:this.form.status==0?"for recommendation":this.form.status==1?"for approval":this.form.status==2?"approved":this.form.status==99?"denied":"",badgeColor:this.form.status==0?"warning":this.form.status==1?"info":this.form.status==2?"success":this.form.status==99?"danger":"",onSubmit:e.confirmSubmit,onClose:c.closeModal,themeClass:"bg-gray-800",sizeClass:"lg:w-2/4"},{default:m(()=>[o.state.isEdit&&o.state.isLoading?(a(),v(u,{key:0,text:"Fetching record"})):_("",!0),r("div",Qe,[r("form",{onSubmit:t[7]||(t[7]=q((...d)=>e.confirmSubmit&&e.confirmSubmit(...d),["prevent"])),class:"space-y-4",enctype:"multipart/form-data"},[o.state.isSaving?(a(),v(u,{key:0,text:"Saving record"})):_("",!0),r("div",Ze,[r("div",Ke,[i(p,{label:"Date From",isRequired:!0},{default:m(()=>[i(y,{modelValue:o.form.date_from,"onUpdate:modelValue":t[0]||(t[0]=d=>o.form.date_from=d),class:"form-control h-[48px]",id:"date_from",placeholder:"yyyy, dd M"},null,8,["modelValue"])]),_:1}),r("div",Je,g(o.errors.date_from),1)]),r("div",Xe,[i(p,{label:"Date To",isRequired:!0},{default:m(()=>[i(y,{modelValue:o.form.date_to,"onUpdate:modelValue":t[1]||(t[1]=d=>o.form.date_to=d),class:"form-control h-[48px]",id:"date_to",placeholder:"yyyy, dd M"},null,8,["modelValue"])]),_:1}),r("div",et,g(o.errors.date_to),1)]),r("div",tt,[i(p,{label:"Hours",isRequired:!0},{default:m(()=>[i(A,{type:"text",modelValue:o.form.hours,"onUpdate:modelValue":t[2]||(t[2]=d=>o.form.hours=d),error:o.errors.hours,classInput:"h-[48px]"},null,8,["modelValue","error"])]),_:1})]),r("div",st,[i(p,{label:"Attachment"},{default:m(()=>[typeof o.form.attachment=="string"?(a(),h("div",{key:0,class:"flex items-center gap-2 mt-2 cursor-pointer",onClick:t[3]||(t[3]=d=>c.viewAttachment(o.form.attachment))},[i(k,{image:c.getFileTypeImage(o.form.attachment)},null,8,["image"]),b(" "+g(o.form.attachment),1)])):_("",!0)]),_:1})]),r("div",ot,[i(p,{label:"Remarks"},{default:m(()=>[i(S,{name:"pn4",placeholder:"Textarea",modelValue:o.form.description,"onUpdate:modelValue":t[4]||(t[4]=d=>o.form.description=d)},null,8,["modelValue"])]),_:1})])]),o.currentClassificationId<=2?(a(),h("div",rt,[r("div",it,[r("div",nt,[r("div",at,[t[8]||(t[8]=b(" Recommending: ")),r("p",lt,g(o.recommending),1)]),r("div",ct,[t[9]||(t[9]=b(" Approving: ")),r("p",dt,g(o.approving),1)])])])])):(a(),h("div",pt,[r("div",mt,[r("div",ut,[i(p,{label:"Recommending"},{default:m(()=>[r("div",ft,[i(C,{modelValue:o.form.recommending_id,"onUpdate:modelValue":t[5]||(t[5]=d=>o.form.recommending_id=d),"close-on-select":!0,searchable:!0,id:"recommending_id",options:o.recommendingOptions},null,8,["modelValue","options"])])]),_:1})]),r("div",ht,[i(p,{label:"Approver"},{default:m(()=>[r("div",gt,[i(C,{modelValue:o.form.approver_id,"onUpdate:modelValue":t[6]||(t[6]=d=>o.form.approver_id=d),"close-on-select":!0,searchable:!0,id:"approver_id",options:o.approvingOptions},null,8,["modelValue","options"])])]),_:1})])])])),r("div",vt,[this.form.status==0&&o.currentRecommendingId==o.currentEmployeeId||o.currentApprovingId==o.currentEmployeeId&&this.form.status==1&&o.currentApprovingId==this.form.approver_id||this.form.approver_id==this.form.recommending_id&&o.currentApprovingId==this.form.approver_id&&o.currentEmployeeId==this.form.approver_id?(a(),h("div",_t,[this.form.status<=1?(a(),v(I,{key:0,onClick:c.submitForm,text:o.btnTitle},null,8,["onClick","text"])):_("",!0),i(T,{onClick:c.denyForm,text:"Deny"},null,8,["onClick"])])):this.form.status==0&&o.currentApprovingId==o.currentEmployeeId||o.currentApprovingId!=this.form.approver_id?(a(),h("div",yt,[this.form.status<=1?(a(),v(I,{key:0,onClick:c.updateApproverForm,text:"Update Approver"},null,8,["onClick"])):_("",!0)])):_("",!0),i(B,{onClick:c.closeModal},null,8,["onClick"])])],32)])]),_:1},8,["active","sideTitle","badgeColor","onSubmit","onClose"])}const ne=P(He,[["render",xt],["__scopeId","data-v-8c857588"]]);const wt={props:["params"],components:{ViewButton:re},methods:{view(){this.params.context.componentParent.viewRecord(this.params.data)}}},bt={class:"flex space-x-2"};function At(e,t,s,l,o,c){const u=n("ViewButton");return a(),h("div",bt,[i(u,{onClick:c.view},null,8,["onClick"])])}const Ct=P(wt,[["render",At],["__scopeId","data-v-1e9f2ea9"]]),Rt={components:{Availment:ne,Earning:ie,Button:G,ActionCellRendererApprover:Ct,AgGridVue:ue,TabGroup:fe,TabList:he,Tab:ge,TabPanels:ve,TabPanel:_e,Icon:U},props:{earnings:{type:Object,required:!0},availment:{type:Object,required:!0},statisticsEarning:{type:Object,required:!0},statisticsAvailment:{type:Object,required:!0}},data(){return{paginationPageSize:10,paginationPageSizeSelector:[10,25,50],colDefs:[{field:"#",flex:1},{field:"employee id",filter:!0,floatingFilter:!0,flex:2},{field:"name",filter:!0,floatingFilter:!0,flex:2},{field:"date",filter:!0,floatingFilter:!0,flex:2},{field:"hours",filter:!0,floatingFilter:!0,flex:2},{field:"date created",filter:!0,floatingFilter:!0},{headerName:"Status",field:"status",filter:!0,floatingFilter:!0,valueGetter:e=>{switch(e.data.status){case 0:return"For Recommendation";case 1:return"For Approval";case 2:return e.data.validated==1?"Validated":e.data.validated==99?"Denied":"For Validation";case 99:return"Denied";default:return""}},cellRenderer:e=>{switch(e.value){case"For Recommendation":return'<span class="inline-block rounded-full text-xs capitalize whitespace-nowrap text-center py-1 text-yellow-600 bg-gray-100 px-4">For Recommendation</span>';case"For Approval":return'<span class="inline-block rounded-full text-xs capitalize whitespace-nowrap text-center py-1 text-blue-600 bg-gray-100 px-4">For Approval</span>';case"Validated":return'<div class="inline-block rounded-full text-xs capitalize whitespace-nowrap text-center py-1 bg-gray-100 text-green-600 px-4">Approved & Validated</div>';case"For Validation":return'<div class="inline-block rounded-full text-xs capitalize whitespace-nowrap text-center py-1 bg-gray-100 text-fuchsia-600 px-4">For Validation</div>';case"Denied":return'<span class="inline-block rounded-full text-xs capitalize whitespace-nowrap text-center py-1 text-red-600 bg-gray-100 px-4">Denied</span>';default:return""}}},{headerName:"Actions",cellRenderer:"ActionCellRendererApprover",flex:1,cellRendererParams:{context:{componentParent:this}}}],colDefsAvailment:[{field:"#",flex:1},{field:"employee id",filter:!0,floatingFilter:!0,flex:2},{field:"name",filter:!0,floatingFilter:!0,flex:2},{field:"date coverage",filter:!0,floatingFilter:!0,flex:2},{field:"time coverage",filter:!0,floatingFilter:!0,flex:2},{field:"date created",filter:!0,floatingFilter:!0},{headerName:"Status",field:"status",filter:!0,floatingFilter:!0,valueGetter:e=>{switch(e.data.status){case 0:return"For Recommendation";case 1:return"For Approval";case 2:return"Approved";case 99:return"Denied";default:return""}},cellRenderer:e=>{switch(e.value){case"For Recommendation":return'<span class="inline-block rounded-full text-xs capitalize whitespace-nowrap text-center py-1 text-yellow-600 bg-gray-100 px-4">For Recommendation</span>';case"For Approval":return'<span class="inline-block rounded-full text-xs capitalize whitespace-nowrap text-center py-1 text-blue-600 bg-gray-100 px-4">For Approval</span>';case"Approved":return'<div class="inline-block rounded-full text-xs capitalize whitespace-nowrap text-center py-1 bg-gray-100 text-green-600 px-4">Approved</div>';case"Denied":return'<span class="inline-block rounded-full text-xs capitalize whitespace-nowrap text-center py-1 text-red-600 bg-gray-100 px-4">Denied</span>';default:return""}}},{headerName:"Actions",cellRenderer:"ActionCellRendererApprover",flex:1,cellRendererParams:{context:{componentParent:this}}}],buttons:[{title:"Earn Offset",icon:"hugeicons:money-receive-01"},{title:"Avail Offset",icon:"hugeicons:money-send-flow-01"}],state:{isLoading:!1,isEdit:!1,isDeleting:!1}}},methods:{reload(){return this.$emit("reload")},onGridReady(e){this.gridApi=e.api},exportToCsv(){this.gridApi?this.gridApi.exportDataAsCsv({onlySelected:!1,columnKeys:this.colDefs.filter(e=>e.field!=="actions").map(e=>e.field)}):console.error("Grid API is not ready.")},viewRecord(e){let t=e.ref;t=="earning"?(this.$refs.earning.resetForm(),this.$refs.earning.loadRecord(e),this.$refs.earning.state.showModal=!0):t=="availment"&&(this.$refs.availment.resetForm(),this.$refs.availment.loadRecord(e),this.$refs.availment.state.showModal=!0)},createRecord(e){e=="earning"?(this.$refs.earning.resetForm(),this.$refs.earning.state.showModal=!0):e=="availment"&&(this.$refs.availment.resetForm(),this.$refs.availment.availableOffset=this.statistics[0].count,this.$refs.availment.totalOffset=this.statistics[1].count,this.$refs.availment.state.showModal=!0)},async deleteRecord(e){let t=e.id,s=e.ref,l="";s=="earning"?l=z.removeEarning:s=="availment"&&(l=z.remove),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(o=>{console.log(o.value),o.value&&(this.state.isDeleting=!0,l(t).then(c=>{c.status==200&&(this.$swal.fire({title:"Yaaay!",text:"Record has been deleted successfully.",type:"success",icon:"success",timer:2e3}),this.reloadRecords())}))}).catch(o=>{o.response&&o.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})})}}},It={class:"text-3xl relative top-[1px] ltr:mr-1 rtl:ml-1"},Et={class:"grid grid-cols-1 gap-4 pb-4 md:grid-cols-3"},kt={class:E("h-14 w-14 flex items-center justify-center rounded-md text-4xl mb-4 shadow-lg bg-white")},Ft={class:"text-md font-semibold text-slate-700 dark:text-white mb-2"},St={class:"flex justify-center gap-4"},Tt={class:"text-xs font-medium text-slate-500 dark:text-white mb-1"},Bt={class:"text-2xl text-slate-900 dark:text-white font-semibold"},Dt={class:"ag-grid-toolbar flex items-center justify-between px-4 py-2 bg-gray-100 border-b rounded-t-xl border-gray-200"},Ot={class:"flex items-center gap-4"},Vt={class:"relative z-10 flex items-center transition-colors duration-300 group-hover:text-white"},$t={class:"grid grid-cols-1 gap-4 pb-4 md:grid-cols-3"},Pt={class:E("h-14 w-14 flex items-center justify-center rounded-md text-4xl mb-4 shadow-lg bg-white")},Ut={class:"text-md font-semibold text-slate-700 dark:text-white mb-2"},Mt={class:"flex justify-center gap-4"},Lt={class:"text-xs font-medium text-slate-500 dark:text-white mb-1"},jt={class:"text-2xl text-slate-900 dark:text-white font-semibold"},zt={class:"ag-grid-toolbar flex items-center justify-between px-4 py-2 bg-gray-100 border-b rounded-t-xl border-gray-200"},Gt={class:"flex items-center gap-4"},qt={class:"relative z-10 flex items-center transition-colors duration-300 group-hover:text-white"};function Yt(e,t,s,l,o,c){const u=n("Icon"),y=n("Tab"),p=n("TabList"),A=n("Button"),k=n("ag-grid-vue"),S=n("Earning"),C=n("TabPanel"),I=n("Availment"),T=n("TabPanels"),B=n("TabGroup");return a(),v(B,null,{default:m(()=>[i(p,{class:"lg:space-x-8 md:space-x-4 space-x-0 rtl:space-x-reverse"},{default:m(()=>[(a(!0),h(O,null,D(o.buttons,(f,d)=>(a(),v(y,{as:"template",key:d},{default:m(w=>[r("button",{class:E([[w.selected?"text-primary-500 before:w-full":"text-slate-500 before:w-0 dark:text-slate-300"],"inline-flex items-center text-sm font-medium mb-7 capitalize bg-white dark:bg-slate-800 ring-0 focus:ring-0 focus:outline-none px-2 transition duration-150 before:transition-all before:duration-150 relative before:absolute before:left-1/2 before:bottom-[-6px] before:h-[1.5px] before:bg-primary-500 before:-translate-x-1/2"])},[r("span",It,[i(u,{icon:f.icon},null,8,["icon"])]),b(" "+g(f.title),1)],2)]),_:2},1024))),128))]),_:1}),i(T,null,{default:m(()=>[i(C,null,{default:m(()=>[r("div",Et,[(a(!0),h(O,null,D(s.statisticsEarning,(f,d)=>(a(),h("div",{key:d,class:E([f.bg,"flex flex-col items-center rounded-lg p-2 bg-opacity-[0.15] dark:bg-opacity-50 text-center shadow-md hover:shadow-xl transition-transform transform hover:scale-101 w-full"])},[r("div",kt,[i(u,{icon:f.icon,class:E(["text-2xl",f.text])},null,8,["icon","class"])]),r("div",Ft,g(f.title),1),r("div",St,[(a(!0),h(O,null,D(f.count,w=>(a(),h("div",{key:w.type},[r("div",Tt,g(w.type),1),r("div",Bt,g(w.total),1)]))),128))])],2))),128))]),r("div",Dt,[t[4]||(t[4]=r("div",{class:"flex items-center justify-center gap-4 text-gray-900"}," Earning of offset ",-1)),r("div",Ot,[i(A,{icon:"mdi:microsoft-excel",text:"Export to CSV",btnClass:"relative overflow-hidden font-normal px-4 py-2 rounded-lg shadow-md bg-white text-gray-900 border group transition-colors duration-300 group-hover:border-green-500",iconClass:"text-2xl",onClick:c.exportToCsv},{default:m(()=>[t[3]||(t[3]=r("span",{class:"absolute inset-0 bg-green-500 transition-transform duration-300 transform -translate-x-full group-hover:translate-x-0"},null,-1)),r("span",Vt,[i(u,{icon:"mdi:microsoft-excel",class:"text-2xl mr-2"}),t[2]||(t[2]=b(" Export to CSV "))])]),_:1},8,["onClick"])])]),i(k,{ref:"agGrid",rowData:s.earnings,columnDefs:o.colDefs,style:{height:"500px"},class:"ag-theme-quartz",pagination:!0,paginationPageSize:o.paginationPageSize,paginationPageSizeSelector:o.paginationPageSizeSelector,onGridReady:c.onGridReady},null,8,["rowData","columnDefs","paginationPageSize","paginationPageSizeSelector","onGridReady"]),i(S,{onCloseModal:t[0]||(t[0]=f=>o.state.showModal=!1),ref:"earning",onReload:c.reload},null,8,["onReload"])]),_:1}),i(C,null,{default:m(()=>[r("div",$t,[(a(!0),h(O,null,D(s.statisticsAvailment,(f,d)=>(a(),h("div",{key:d,class:E([f.bg,"flex flex-col items-center rounded-lg p-2 bg-opacity-[0.15] dark:bg-opacity-50 text-center shadow-md hover:shadow-xl transition-transform transform hover:scale-101 w-full"])},[r("div",Pt,[i(u,{icon:f.icon,class:E(["text-2xl",f.text])},null,8,["icon","class"])]),r("div",Ut,g(f.title),1),r("div",Mt,[(a(!0),h(O,null,D(f.count,w=>(a(),h("div",{key:w.type},[r("div",Lt,g(w.type),1),r("div",jt,g(w.total),1)]))),128))])],2))),128))]),r("div",zt,[t[7]||(t[7]=r("div",{class:"flex items-center justify-center gap-4 text-gray-900"}," Offset Availment ",-1)),r("div",Gt,[i(A,{icon:"mdi:microsoft-excel",text:"Export to CSV",btnClass:"relative overflow-hidden font-normal px-4 py-2 rounded-lg shadow-md bg-white text-gray-900 border group transition-colors duration-300 group-hover:border-green-500",iconClass:"text-2xl",onClick:c.exportToCsv},{default:m(()=>[t[6]||(t[6]=r("span",{class:"absolute inset-0 bg-green-500 transition-transform duration-300 transform -translate-x-full group-hover:translate-x-0"},null,-1)),r("span",qt,[i(u,{icon:"mdi:microsoft-excel",class:"text-2xl mr-2"}),t[5]||(t[5]=b(" Export to CSV "))])]),_:1},8,["onClick"])])]),i(k,{ref:"agGrid",rowData:s.availment,columnDefs:o.colDefsAvailment,style:{height:"500px"},class:"ag-theme-quartz",pagination:!0,paginationPageSize:o.paginationPageSize,paginationPageSizeSelector:o.paginationPageSizeSelector,onGridReady:c.onGridReady},null,8,["rowData","columnDefs","paginationPageSize","paginationPageSizeSelector","onGridReady"]),i(I,{onCloseModal:t[1]||(t[1]=f=>o.state.showModal=!1),ref:"availment",onReload:c.reload},null,8,["onReload"])]),_:1})]),_:1})]),_:1})}const Wt=P(Rt,[["render",Yt]]);const Nt={mixins:[ae],components:{TabIcon:Wt,Pagination:we,Card:ce,Button:G,Badge:de,Layout:le,Icon:U,ViewButton:re,SubmitButton:L,CloseButton:M,EditButton:xe,DeleteButton:ye,Availment:ne,Earning:ie,InputGroup:pe,Loading:j},data(){return{earnings:[],breadcrumbs:[{text:"Home",href:"/"},{text:"Timekeeping",href:"/attendance/employee-offset"},{text:"Offset Application",active:!0}],statisticsEarning:[{title:"Pending",count:[{total:0}],bg:"bg-primary-500",text:"text-primary-500",percent:"1.67% ",icon:"heroicons-outline:clock"},{title:"Approved",count:[{total:0}],bg:"bg-info-500",text:"text-info-500",percent:"25.67% ",icon:"heroicons-outline:menu-alt-1"},{title:"Denied",count:[{total:0}],bg:"bg-warning-500",text:"text-warning-500",percent:"8.67%",icon:"heroicons-outline:chart-pie"}],statisticsAvailment:[{title:"Pending",count:[{total:0}],bg:"bg-primary-500",text:"text-primary-500",percent:"1.67% ",icon:"heroicons-outline:clock"},{title:"Approved",count:[{total:0}],bg:"bg-info-500",text:"text-info-500",percent:"25.67% ",icon:"heroicons-outline:menu-alt-1"},{title:"Denied",count:[{total:0}],bg:"bg-warning-500",text:"text-warning-500",percent:"8.67%",icon:"heroicons-outline:chart-pie"}],perPageOptions:[{value:"10",label:"10"},{value:"50",label:"50"},{value:"100",label:"100"}],items:[],totalItems:0,searchQuery:null,serverOptions:{page:1,rowsPerPage:10,sortBy:"status",sortType:"asc"},state:{isLoading:!1,isEdit:!1,isDeleting:!1}}},watch:{serverOptions:{handler(){console.log(`perPage: ${this.serverOptions.rowsPerPage}`),this.fetchRecords()},deep:!0},searchQuery:me.debounce(function(){this.fetchRecords()},800)},computed:{perPage:function(){return this.serverOptions.rowsPerPage}},methods:{formatDate(e){const t=new Date(e),s=new Date(t.toLocaleString("en-US",{timeZone:"UTC"})),l=new Date(s.toLocaleString("en-US",{timeZone:"Asia/Singapore"})),o=l.getFullYear(),c=String(l.getMonth()+1).padStart(2,"0"),u=String(l.getDate()).padStart(2,"0");return`${o}-${c}-${u}`},async fetchEarningRecords(){this.state.isLoading=!0,await R.fetchEarningRecords({keyword:this.searchQuery,page:this.serverOptions.page,per_page:this.serverOptions.rowsPerPage,sortBy:this.serverOptions.sortBy,sortType:this.serverOptions.sortType}).then(e=>{let t=e.data.data;this.earnings=t.map((s,l)=>(this.statisticsEarning[0].count[0].total=s.pending,this.statisticsEarning[1].count[0].total=s.approved,this.statisticsEarning[2].count[0].total=s.denied,{...s,"#":l+1,"employee id":s.employee_id,name:s.employee.firstname+" "+s.employee.lastname,date:this.$formatDate(s.date),hours:s.hours,"date created":this.$formatDate(s.created_at),status:s.status,ref:"earning"}))}).finally(()=>{this.state.isLoading=!1})},async fetchRecords(){this.state.isLoading=!0,await R.fetchRecords({keyword:this.searchQuery,page:this.serverOptions.page,per_page:this.serverOptions.rowsPerPage,sortBy:this.serverOptions.sortBy,sortType:this.serverOptions.sortType}).then(e=>{let t=e.data.data;this.items=t.map((s,l)=>(this.statisticsAvailment[0].count[0].total=s.pending,this.statisticsAvailment[1].count[0].total=s.approved,this.statisticsAvailment[2].count[0].total=s.denied,{...s,"#":l+1,"employee id":s.employee_id,name:s.employee.firstname+" "+s.employee.lastname,"date coverage":s.date_from===s.date_to?this.$formatDate(s.date_from):this.$formatDate(s.date_from)+" - "+this.$formatDate(s.date_to)+(s.half_day?s.meridiem?" (PM)":" (AM)":""),"time coverage":this.$formatTime(s.from_time)+" - "+this.$formatTime(s.to_time)+" ("+s.hours+" Hours)","date created":this.$formatDate(s.created_at),status:s.status,ref:"availment"}))}).finally(()=>{this.state.isLoading=!1})},reload(){this.$emit("reload")},handlePageChange(e){console.log(e),console.log(this.serverOptions.page),this.serverOptions.page!=e&&(this.serverOptions.page=e)},handlePerPageChange(e){this.serverOptions.page=1,this.serverOptions.rowsPerPage=e},onSortChange(e){console.log(e),e[0].type!="none"&&(this.serverOptions.sortBy=e[0].field,this.serverOptions.sortType=e[0].type)},async deleteRecord(e,t){let s="";t=="earning"?s=R.removeEarning:t=="availment"&&(s=R.remove),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(l=>{console.log(l.value),l.value&&(this.state.isDeleting=!0,s(e).then(o=>{o.status==200&&(this.$swal.fire({title:"Yaaay!",text:"Record has been deleted successfully.",type:"success",icon:"success",timer:2e3}),this.fetchRecords(),this.fetchEarningRecords())}))}).catch(l=>{l.response&&l.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.reload(),this.state.isDeleting=!1})},createRecord(e){console.log(e),e=="earning"?(console.log("try"),this.$refs.earning.resetForm(),this.$refs.earning.state.showModal=!0):e=="availment"&&(this.$refs.availment.resetForm(),this.$refs.availment.state.showModal=!0)},viewRecord(e,t){t=="earning"?(this.$refs.earning.resetForm(),this.$refs.earning.loadRecord(e),this.$refs.earning.state.showModal=!0):t=="availment"&&(this.$refs.availment.resetForm(),this.$refs.availment.loadRecord(e),this.$refs.availment.state.showModal=!0)},handlePageChange(e){console.log(e),console.log(this.serverOptions.page),this.serverOptions.page!=e&&(this.serverOptions.page=e)},handlePerPageChange(e){this.serverOptions.page=1,this.serverOptions.rowsPerPage=e}},mounted(){this.fetchRecords(),this.fetchEarningRecords()}},Ht={class:"space-y-4 mt-4"},Qt={class:"flex-1 md:mb-0 mb-3"};function Zt(e,t,s,l,o,c){const u=n("TabIcon"),y=n("Card"),p=n("Loading"),A=n("Layout");return a(),v(A,{breadcrumbs:o.breadcrumbs},{default:m(()=>[r("div",Ht,[i(y,{title:"Offset Applications"},{default:m(()=>[r("h6",Qt,g(e.title),1),i(u,{earnings:o.earnings,availment:o.items,statisticsEarning:o.statisticsEarning,statisticsAvailment:o.statisticsAvailment},null,8,["earnings","availment","statisticsEarning","statisticsAvailment"]),t[0]||(t[0]=r("div",{class:"grid grid-cols-2 gap-6 mt-4"},null,-1))]),_:1}),o.state.isLoading?(a(),v(p,{key:0,text:"Fetching records"})):_("",!0)])]),_:1},8,["breadcrumbs"])}const Ms=P(Nt,[["render",Zt],["__scopeId","data-v-dc2c6825"]]);export{Ms as default};
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0.04 |
proxy
|
phpinfo
|
Settings