File manager - Edit - /home/autoph/public_html/projects/ahg-hr/assets/index.56bbce2d.js
Back
import{w as P,L as z}from"./index.15d773bc.js";import{C as N}from"./index.b5116294.js";import{B as G}from"./index.9affbcc7.js";import{B as H}from"./index.de756f91.js";import{I as S}from"./index.39289473.js";import{I as q}from"./index.38283705.js";import"./lodash.0a0ce71b.js";import{_ as M,r as c,o as a,c as y,w as f,j as g,d as r,k as Y,e as i,p as D,s as I,b as p,f as E,t as h,m as R,h as T,F as B}from"./index.0409e1b2.js";import{E as W}from"./EmployeeOvertimeService.c55ffed2.js";import{O as C}from"./OvertimeApprovalService.3441239d.js";import{C as O}from"./CloseButton.5f2b3ff2.js";import{E as Z}from"./EditButton.16b17e01.js";/* empty css */import{S as L}from"./SubmitButton.16346f33.js";import{V as J}from"./ViewButton.074b6bc6.js";import"./jspdf.es.min.4dda79e8.js";/* empty css *//* empty css */import"./vue-cleave.min.18e79662.js";import{V as b}from"./array.6ad60c2c.js";import{L as U}from"./Loading.490cab57.js";import"./vue-quill.snow.d79094c0.js";/* empty css */import{F as K}from"./index.209240bf.js";import{F as Q}from"./index.e35ce9e9.js";import{T as X}from"./index.535682d0.js";import{T as $}from"./index.61dcb620.js";import{D as ee}from"./DenyButton.1fd46c88.js";import{U as te}from"./UpdateButton.24df4af0.js";import{A as oe}from"./ApproverService.3b1246b2.js";import{F as se}from"./FileService.5c843715.js";import{M as re}from"./Multiselect.bcca6a98.js";import{F as ie}from"./index.a38b0ff2.js";import{C as ne}from"./index.67fe51d0.js";import{f as ae}from"./apiUtils.2219b302.js";import{p as le,j as de}from"./scr-1.d9aaecca.js";import{A as ce}from"./main.esm.afa68281.js";import{P as me}from"./index.9cd030c0.js";import{A as pe}from"./ActionCellRendererApprover.853c6829.js";import"./logo-black.7c15feb3.js";import"./logo-white.b04c5a89.js";import"./transition.31efaf2a.js";import"./EmployeeService.a7f96e81.js";import"./es.string.replace.33548c32.js";import"./Loading.vue_vue_type_style_index_0_scoped_cbded5a2_lang.ea365faf.js";import"./index.3560e594.js";import"./ck-white.4bf441fa.js";import"./CompanyService.ee45576d.js";import"./DealershipService.a21b6e26.js";import"./DepartmentService.17b85813.js";import"./DivisionService.be1e8ff3.js";import"./EmploymentTypeService.16c01f9c.js";import"./GroupService.14a6f45e.js";import"./JobClassficationService.9b8fcf51.js";import"./JobTitleService.cf3393b5.js";import"./SectionService.dff129b2.js";import"./SupportingDocumentService.c1e6c225.js";import"./UnitService.dbf1cfee.js";import"./CitizenshipService.90c91de2.js";import"./CivilStatusService.71578228.js";import"./ReligionService.915283e9.js";const ue={components:{FileType:ie,DenyButton:ee,FormModal:Q,FormGroup:K,TextInput:X,Textarea:$,SubmitButton:L,UpdateButton:te,CloseButton:O,Loading:U,Multiselect:re,Icon:S,Checkbox:ne},data(){return{companyOptions:[],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_from:"",to_time:"",hours:"",charge_to:"",meal:"",transportation:"",meal_amount:"",transportation_amount:"",description:"",attachment:"",recommending_id:"",approver_id:""},errors:{},state:{isEdit:!1,isSaving:!1,isLoading:!1,isCompanyLoading:!1,isLoadRecord:!1,isDownloading:!1},fileIcons:{pdf:le,jpg:de,default:""}}},methods:{getFileTypeImage(t){if(typeof t=="string"){if(!t)return this.fileIcons.default;const e=t.substring(t.lastIndexOf(".")+1).toLowerCase();return this.fileIcons[e]||this.fileIcons.default}},async viewAttachment(t){if(this.state.isDownloading)return;this.state.isDownloading=!0;let e=await se.Reader2("employee-overtime",t),s;if(t.endsWith(".pdf"))s="application/pdf";else if(t.endsWith(".png"))s="image/png";else if(t.endsWith(".jpg")||t.endsWith(".jpeg"))s="image/jpeg";else if(t.endsWith(".svg"))s="image/svg+xml";else throw new Error("Unsupported file type");const l=atob(e),o=new Array(l.length);for(let m=0;m<l.length;m++)o[m]=l.charCodeAt(m);const d=new Uint8Array(o),u=new Blob([d],{type:s}),_=URL.createObjectURL(u);window.open(_),this.state.isLoadingPDF=!1},async fetchCompanyRecords(){try{this.state.isCompanyLoading=!0,this.companyOptions=await ae()}catch(t){console.error("Failed to fetch company data:",t)}finally{this.state.isCompanyLoading=!1}},handleMainImageUpload(){const t=event.target.files[0];this.form.attachment=t;const e=new FileReader;e.onload=()=>{t.type.startsWith("image/")?this.form.imageView=e.result:t.type==="application/pdf"?this.form.imageView=this.pdf_file_view:t.type==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"&&(this.form.imageView=this.excel_file_view)},e.readAsDataURL(t)},async loadRecord(t){this.resetForm(),this.form=t,this.form.meal=t.meal==1,this.form.transportation=t.transportation==1,this.currentRecommendingId=t.recommending?t.recommending[0].employee_id:"",this.currentApprovingId=t.approving?t.approving[0].employee_id:"",this.recommending=t.recommending?t.recommending[0].firstname+" "+t.recommending[0].lastname:"",this.approving=t.approving?t.approving[0].firstname+" "+t.approving[0].lastname:"",console.log(this.currentRecommendingId+this.currentEmployeeId),this.currentRecommendingId==this.currentEmployeeId&&this.form.status==0&&(this.btnTitle="Submit For Approval"),this.currentApprovingId==this.currentEmployeeId&&(this.btnTitle="Approve"),this.currentClassificationId>=3&&(console.log("dito"),await oe.fetchEmployeeApprover(t.employee_id).then(e=>{if(e.status==200)this.recommendingOptions=e.data.map((s,l)=>({value:s.employee_id,label:s.firstname+" "+s.lastname})),this.approvingOptions=e.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:"",charge_to:"",hours:"",meal:"",transportation:"",meal_amount:"",transportation_amount:"",description:"",attachment:"",recommending_id:"",approver_id:""}},reload(){return this.$emit("reload")},async updateApproverRecord(){this.state.isSaving=!0;const t=this.form.id;this.state.isSaving=!1;let e={recommending_id:this.form.recommending_id,approver_id:this.form.approver_id};await C.updateApprover(t,e).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 t=this.form.id,e={status:this.status,meal:this.form.meal,transportation:this.form.transportation};await C.update(t,e).then(s=>{s.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(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 updateMealOrTranspoAmount(){const t=this.form.id;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(e=>{e.value&&(this.mealOrTranspoValue={meal:this.form.meal,transportation:this.form.transportation,meal_amount:this.form.meal_amount,transportation_amount:this.form.transportation_amount},C.update(t,this.mealOrTranspoValue).then(s=>{s.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(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})}))})}catch(e){if(e instanceof b){const s={};e.inner.forEach(l=>{s[l.path]=l.message}),this.errors=s}}},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(t=>{t.value&&this.saveRecord()})}catch(t){if(t instanceof b){const e={};t.inner.forEach(s=>{e[s.path]=s.message}),this.errors=e}}},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(t=>{t.value&&this.updateApproverRecord()})}catch(t){if(t instanceof b){const e={};t.inner.forEach(s=>{e[s.path]=s.message}),this.errors=e}}},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 t=document.getElementById("swal-input").value;return t?this.denied_reason=t:(this.$swal.showValidationMessage("The reason field is required"),!1)}}).then(t=>{this.status={status:99,denied_reason:this.denied_reason},t.value&&this.saveRecord()})}catch(t){if(t instanceof b){const e={};t.inner.forEach(s=>{e[s.path]=s.message}),this.errors=e}}},calculateHours(){const t=this.form.from_time,e=this.form.to_time;if(t&&e){const[s,l]=this.form.from_time.split(":").map(Number),[o,d]=this.form.to_time.split(":").map(Number);let u=o-s;u+=(d-l)/60,u<0&&(u+=24),this.form.hours=u}}},mounted(){this.fetchCompanyRecords()},watch:{"form.from_time":{handler:"calculateHours",immediate:!0},"form.to_time":{handler:"calculateHours",immediate:!0}}},fe={class:"text-slate-600 dark:text-slate-400 text-sm font-normal"},he={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 gap-6"},ge={class:"flex items-center gap-4"},_e={class:"flex justify-between items-center w-full"},ve={class:"flex items-center cursor-pointer"},ye=["checked","disabled"],xe={class:"flex items-center gap-4"},we={class:"flex justify-between items-center w-full"},be={class:"flex items-center cursor-pointer"},Ce=["checked","disabled"],ke={class:"grid grid-cols-1"},Ae={class:"grid grid-cols-1"},Fe={class:"col-span-6"},Ve={key:1},Te={class:"grid grid-cols-12 gap-4"},De={class:"col-span-6 flex items-center p-4 bg-gray-100 rounded-lg shadow-md"},Ie={class:"flex-shrink-0 mr-4"},Re=["src"],Be={key:1,class:"w-16 h-16 rounded-full object-cover bg-black-200 flex justify-center items-center"},Se={class:"text-left"},Me={class:"text-sm font-semibold text-gray-600"},Ee={class:"text-lg font-bold text-gray-900"},Oe={key:0,class:"text-sm text-gray-900"},Le={key:1,class:"text-sm text-gray-900"},Ue={key:0,class:"col-span-6 flex items-center p-4 bg-gray-100 rounded-lg shadow-md"},je={class:"flex-shrink-0 mr-4"},Pe=["src"],ze={key:1,class:"w-16 h-16 rounded-full object-cover bg-black-200 flex justify-center items-center"},Ne={class:"text-left"},Ge={class:"text-lg font-bold text-gray-900"},He={class:"text-sm text-gray-900"},qe={key:2},Ye={class:"grid grid-cols-12 gap-4"},We={class:"col-span-6"},Ze={class:"relative"},Je={class:"col-span-6"},Ke={class:"relative"},Qe={class:"flex gap-1 justify-end pt-8"},Xe={key:0,class:"flex gap-1 justify-end"},$e={key:1,class:"flex gap-1 justify-end"};function et(t,e,s,l,o,d){const u=c("Loading"),_=c("flat-pickr"),m=c("FormGroup"),k=c("TextInput"),x=c("Multiselect"),A=c("Textarea"),F=c("FileType"),v=c("UpdateButton"),V=c("DenyButton"),w=c("CloseButton"),j=c("FormModal");return a(),y(j,{title:"View Record",active:o.state.showModal,sideTitle:this.form.status==0?"For recommendation":this.form.status==1?"For approval":this.form.status==2&&this.form.validated==1?"Approved & validated":this.form.status==2&&this.form.validated==99?"Denied":this.form.status==2?"for validation":this.form.status==99?"Denied":"",badgeColor:this.form.status==0?"warning":this.form.status==1?"info":this.form.status==2&&this.form.validated==1?"success":this.form.status==2&&this.form.validated==99?"danger":this.form.status==2?"purple":this.form.status==99?"danger":"",onSubmit:t.confirmSubmit,onClose:d.closeModal,themeClass:"bg-gray-800",sizeClass:"lg:w-2/4"},{default:f(()=>[o.state.isEdit&&o.state.isLoading?(a(),y(u,{key:0,text:"Fetching record"})):g("",!0),r("div",fe,[r("form",{onSubmit:e[12]||(e[12]=Y((...n)=>t.confirmSubmit&&t.confirmSubmit(...n),["prevent"])),class:"space-y-4",enctype:"multipart/form-data"},[o.state.isSaving?(a(),y(u,{key:0,text:"Saving record"})):g("",!0),r("div",he,[r("div",null,[i(m,{label:"From Date",isRequired:!0},{default:f(()=>[i(_,{modelValue:o.form.date_from,"onUpdate:modelValue":e[0]||(e[0]=n=>o.form.date_from=n),class:"form-control h-12",id:"date_from",placeholder:"yyyy, dd M",disabled:!0},null,8,["modelValue"])]),_:1})]),r("div",null,[i(m,{label:"To Date",isRequired:!0},{default:f(()=>[i(_,{modelValue:o.form.date_to,"onUpdate:modelValue":e[1]||(e[1]=n=>o.form.date_to=n),class:"form-control h-12",id:"date_to",placeholder:"yyyy, dd M",disabled:!0},null,8,["modelValue"])]),_:1})]),r("div",null,[i(m,{label:"From Time",isRequired:!0},{default:f(()=>[i(_,{modelValue:o.form.from_time,"onUpdate:modelValue":e[2]||(e[2]=n=>o.form.from_time=n),class:"form-control h-12",placeholder:"From time",onChange:d.calculateHours,config:{enableTime:!0,noCalendar:!0,dateFormat:"H:i"},disabled:!0},null,8,["modelValue","onChange"])]),_:1})]),r("div",null,[i(m,{label:"To Time",isRequired:!0},{default:f(()=>[i(_,{modelValue:o.form.to_time,"onUpdate:modelValue":e[3]||(e[3]=n=>o.form.to_time=n),class:"form-control h-12",placeholder:"To time",onChange:d.calculateHours,config:{enableTime:!0,noCalendar:!0,dateFormat:"H:i"},disabled:!0},null,8,["modelValue","onChange"])]),_:1})]),r("div",null,[i(m,{label:"Hours"},{default:f(()=>[i(k,{type:"text",modelValue:o.form.hours,"onUpdate:modelValue":e[4]||(e[4]=n=>o.form.hours=n),error:o.errors.hours,classInput:"h-12",disabled:!0},null,8,["modelValue","error"])]),_:1})]),r("div",null,[i(m,{label:"Charge To"},{default:f(()=>[i(x,{modelValue:o.form.charge_to,"onUpdate:modelValue":e[5]||(e[5]=n=>o.form.charge_to=n),error:o.errors.charge_to,classInput:"h-12",options:o.companyOptions,loading:t.isCompanyLoading,disabled:!0},null,8,["modelValue","error","options","loading"])]),_:1})]),r("div",ge,[r("div",_e,[r("div",null,[r("label",ve,[D(r("input",{type:"checkbox",class:"peer h-6 w-6 cursor-pointer rounded-full bg-slate-100 border border-slate-300 checked:bg-blue-500 checked:border-blue-500",checked:o.form.meal,"onUpdate:modelValue":e[6]||(e[6]=n=>o.form.meal=n),disabled:o.form.status!=1},null,8,ye),[[I,o.form.meal]]),e[13]||(e[13]=r("span",{class:"absolute text-white opacity-0 peer-checked:opacity-100"},[r("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",stroke:"currentColor","stroke-width":"1"},[r("path",{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"})])],-1)),e[14]||(e[14]=r("span",{class:"ml-2 text-slate-500 dark:text-slate-400 text-sm"},"Meal",-1))])])])]),r("div",xe,[r("div",we,[r("div",null,[r("label",be,[D(r("input",{type:"checkbox",class:"peer h-6 w-6 cursor-pointer rounded-full bg-slate-100 border border-slate-300 checked:bg-blue-500 checked:border-blue-500",checked:o.form.transportation,"onUpdate:modelValue":e[7]||(e[7]=n=>o.form.transportation=n),disabled:o.form.status!=1},null,8,Ce),[[I,o.form.transportation]]),e[15]||(e[15]=r("span",{class:"absolute text-white opacity-0 peer-checked:opacity-100"},[r("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",stroke:"currentColor","stroke-width":"1"},[r("path",{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"})])],-1)),e[16]||(e[16]=r("span",{class:"ml-2 text-slate-500 dark:text-slate-400 text-sm"},"Transportation",-1))])])])])]),r("div",ke,[r("div",Ae,[i(m,{label:"Outputs/Deliverables"},{default:f(()=>[i(A,{placeholder:"Outputs/Deliverables",modelValue:o.form.description,"onUpdate:modelValue":e[8]||(e[8]=n=>o.form.description=n),disabled:!0},null,8,["modelValue"])]),_:1})]),r("div",Fe,[i(m,{label:"Attachment"},{default:f(()=>[typeof o.form.attachment=="string"?(a(),p("div",{key:0,class:"flex items-center gap-2 mt-2 cursor-pointer",onClick:e[9]||(e[9]=n=>d.viewAttachment(o.form.attachment))},[i(F,{image:d.getFileTypeImage(o.form.attachment)},null,8,["image"]),E(" "+h(o.form.attachment),1)])):g("",!0)]),_:1})])]),o.currentClassificationId<=2?(a(),p("div",Ve,[r("div",Te,[r("div",De,[r("div",Ie,[t.recommending_img?(a(),p("img",{key:0,src:t.recommending_img,alt:"Profile",class:"w-16 h-16 rounded-full object-cover"},null,8,Re)):(a(),p("div",Be," No Image "))]),r("div",Se,[r("div",Me,h(o.form.allow_higher_approval||o.form.days>2?"Recommending":"Approving"),1),r("div",Ee,h(o.recommending),1),o.form.allow_higher_approval||o.form.days>2?(a(),p("div",Oe,h(o.form.recommended_at?"Date: ("+this.$formatDateTime(o.form.recommended_at)+")":""),1)):(a(),p("div",Le,h(o.form.approved_at?"Date: ("+this.$formatDateTime(o.form.approved_at)+")":""),1))])]),o.form.allow_higher_approval||o.form.days>2?(a(),p("div",Ue,[r("div",je,[t.approving_img?(a(),p("img",{key:0,src:t.approving_img,alt:"Profile",class:"w-16 h-16 rounded-full object-cover"},null,8,Pe)):(a(),p("div",ze," No Image "))]),r("div",Ne,[e[17]||(e[17]=r("div",{class:"text-sm font-semibold text-gray-600"},"Approving",-1)),r("div",Ge,h(o.approving),1),r("div",He,h(o.form.approved_at?"Date: ("+this.$formatDateTime(o.form.approved_at)+")":""),1)])])):g("",!0)])])):(a(),p("div",qe,[r("div",Ye,[r("div",We,[i(m,{label:"Recommending"},{default:f(()=>[r("div",Ze,[i(x,{modelValue:o.form.recommending_id,"onUpdate:modelValue":e[10]||(e[10]=n=>o.form.recommending_id=n),"close-on-select":!0,searchable:!0,id:"recommending_id",options:o.recommendingOptions},null,8,["modelValue","options"])])]),_:1})]),r("div",Je,[i(m,{label:"Approver"},{default:f(()=>[r("div",Ke,[i(x,{modelValue:o.form.approver_id,"onUpdate:modelValue":e[11]||(e[11]=n=>o.form.approver_id=n),"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(),p("div",Xe,[this.form.status<=1?(a(),y(v,{key:0,onClick:d.submitForm,text:o.btnTitle},null,8,["onClick","text"])):g("",!0),this.form.status!=2?(a(),y(V,{key:1,onClick:d.denyForm,text:"Deny"},null,8,["onClick"])):g("",!0)])):this.form.status==0&&o.currentApprovingId==o.currentEmployeeId||o.currentApprovingId!=this.form.approver_id?(a(),p("div",$e,[this.form.status<=1?(a(),y(v,{key:0,onClick:d.updateApproverForm,text:"Update Approver"},null,8,["onClick"])):g("",!0)])):g("",!0),i(w,{onClick:d.closeModal},null,8,["onClick"])])],32)])]),_:1},8,["active","sideTitle","badgeColor","onSubmit","onClose"])}const tt=M(ue,[["render",et],["__scopeId","data-v-5010dcef"]]);const ot={mixins:[P],components:{ActionCellRendererApprover:pe,AgGridVue:ce,Pagination:me,Card:N,Button:G,Badge:H,Layout:z,Icon:S,SubmitButton:L,CloseButton:O,EditButton:Z,ViewButton:J,View:tt,InputGroup:q,Loading:U},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:4},{field:"date coverage",filter:!0,floatingFilter:!0,flex:3},{field:"time coverage",filter:!0,floatingFilter:!0,flex:3},{field:"meal_label",headerName:"Meal",filter:!0,floatingFilter:!0,flex:2},{field:"transportation_label",headerName:"Transportation",filter:!0,floatingFilter:!0,flex:2},{field:"date created",filter:!0,floatingFilter:!0},{headerName:"Status",field:"status",filter:!0,floatingFilter:!0,flex:3,valueGetter:t=>{switch(t.data.status){case 0:return"For Recommendation";case 1:return"For Approval";case 2:return t.data.validated==1?"Validated":t.data.validated==99?"Denied":"For Validation";case 99:return"Denied";default:return""}},cellRenderer:t=>{switch(t.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"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"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"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:2,cellRendererParams:{context:{componentParent:this}}}],breadcrumbs:[{text:"Home",href:"/"},{text:"Timekeeping",href:"/attendance/employee-overtime"},{text:"Overtime Application",active:!0}],statistics:[{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"}],items:[],statuses:[{count:1,status:"Pending"},{count:2,status:"Approved"},{count:1,status:"Denied"}],items:[],state:{isLoading:!1,isEdit:!1,isDeleting:!1}}},methods:{formatTime(t){let[e,s]=t.split(":");e=parseInt(e);const l=e>=12;return e=e%12||12,`${e}:${s} ${l?"PM":"AM"}`},formatDate(t){const e=new Date(t),s=new Date(e.toLocaleString("en-US",{timeZone:"UTC"})),l=new Date(s.toLocaleString("en-US",{timeZone:"Asia/Singapore"})),o=l.getFullYear(),d=String(l.getMonth()+1).padStart(2,"0"),u=String(l.getDate()).padStart(2,"0");return`${o}-${d}-${u}`},async fetchRecords(){this.state.isLoading=!0,await C.fetchRecords().then(t=>{console.log("response");let e=t.data;console.log(e),this.items=e.map((s,l)=>(this.statistics[0].count[0].total=s.pending,this.statistics[1].count[0].total=s.approved,this.statistics[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),"time coverage":this.$formatTime(s.from_time)+" - "+this.$formatTime(s.to_time)+" ("+s.hours+" Hours)",meal_label:s.meal?"Yes":"No",transportation_label:s.transportation?"Yes":"No","date created":this.$formatDate(s.created_at),status:s.status}))}).finally(()=>{this.state.isLoading=!1})},reload(){this.$emit("reload")},closeModal(){this.state.showModal=!1},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(e=>{console.log(e.value),e.value&&(this.state.isDeleting=!0,W.remove(t).then(s=>{s.status==200&&(this.$swal.fire({title:"Yaaay!",text:"Record has been deleted successfully.",type:"success",icon:"success",timer:2e3}),this.fetchRecords())}))}).catch(e=>{e.response&&e.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})},viewRecord(t){console.log(t),this.$refs.view.resetForm(),this.$refs.view.loadRecord(t),this.$refs.view.state.showModal=!0}},mounted(){this.fetchRecords()}},st={class:"space-y-4 mt-4"},rt={class:"flex items-center justify-between mb-4"},it={class:"text-lg font-semibold"},nt={class:"grid grid-cols-1 gap-4 pb-4 md:grid-cols-3"},at={class:T("h-14 w-14 flex items-center justify-center rounded-md text-4xl mb-4 shadow-lg bg-white")},lt={class:"text-md font-semibold text-slate-700 dark:text-white mb-2"},dt={class:"flex justify-center gap-4"},ct={class:"text-xs font-medium text-slate-500 dark:text-white mb-1"},mt={class:"text-2xl text-slate-900 dark:text-white font-semibold"},pt={class:"ag-grid-toolbar flex items-center justify-between px-4 py-2 bg-gray-100 border-b rounded-t-xl border-gray-200"},ut={class:"flex items-center gap-4"},ft={class:"relative z-10 flex items-center transition-colors duration-300 group-hover:text-white"};function ht(t,e,s,l,o,d){const u=c("Icon"),_=c("Button"),m=c("ag-grid-vue"),k=c("Card"),x=c("Loading"),A=c("View"),F=c("Layout");return a(),y(F,{breadcrumbs:o.breadcrumbs},{default:f(()=>[r("div",st,[i(k,{title:"Overtime Applications"},{default:f(()=>[r("div",rt,[r("h6",it,h(t.title),1)]),r("div",nt,[(a(!0),p(B,null,R(o.statistics,(v,V)=>(a(),p("div",{key:V,class:T([v.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",at,[i(u,{icon:v.icon,class:T(["text-2xl",v.text])},null,8,["icon","class"])]),r("div",lt,h(v.title),1),r("div",dt,[(a(!0),p(B,null,R(v.count,w=>(a(),p("div",{key:w.type},[r("div",ct,h(w.type),1),r("div",mt,h(w.total),1)]))),128))])],2))),128))]),r("div",pt,[e[2]||(e[2]=r("div",{class:"flex items-center justify-center gap-4 text-gray-900"}," Overtime Lists ",-1)),r("div",ut,[i(_,{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:t.exportToCsv},{default:f(()=>[e[1]||(e[1]=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",ft,[i(u,{icon:"mdi:microsoft-excel",class:"text-2xl mr-2"}),e[0]||(e[0]=E(" Export to CSV "))])]),_:1},8,["onClick"])])]),i(m,{ref:"agGrid",rowData:o.items,columnDefs:o.colDefs,style:{height:"500px"},class:"ag-theme-quartz",pagination:!0,paginationPageSize:o.paginationPageSize,paginationPageSizeSelector:o.paginationPageSizeSelector,onGridReady:t.onGridReady},null,8,["rowData","columnDefs","paginationPageSize","paginationPageSizeSelector","onGridReady"])]),_:1}),o.state.isLoading?(a(),y(x,{key:0,text:"Fetching records"})):g("",!0),i(A,{onCloseModal:d.closeModal,ref:"view",onReload:d.fetchRecords},null,8,["onCloseModal","onReload"])])]),_:1},8,["breadcrumbs"])}const ko=M(ot,[["render",ht],["__scopeId","data-v-eb35bb36"]]);export{ko as default};
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0.04 |
proxy
|
phpinfo
|
Settings