File manager - Edit - /home/autoph/public_html/projects/ahg-hr/assets/index.8466cd23.js
Back
import{w as U,L as z}from"./index.b7d49458.js";import{C as P}from"./index.5cb8fa8c.js";import{B as O}from"./index.bdcc6190.js";import{B as j}from"./index.a1e4de31.js";import{I as D}from"./index.c6b20525.js";import{I as G}from"./index.c252b558.js";import"./lodash.50734de5.js";import{_ as T,r as n,o as a,c as h,w as p,j as _,d as i,k as N,e as r,b as g,f as k,t as v,m as V,h as R,F as I}from"./index.15cec131.js";import{C as B,E as q}from"./EmployeeChangeScheduleService.aa1cd313.js";import{C as E}from"./CloseButton.6961055e.js";import{E as H}from"./EditButton.6d23f725.js";/* empty css */import{S as M}from"./SubmitButton.f654365f.js";import{V as $}from"./ViewButton.17af945a.js";import"./jspdf.es.min.2cbf3bf3.js";/* empty css *//* empty css */import"./vue-cleave.min.64bb37b7.js";import{V as F}from"./array.8551fbb7.js";import{L}from"./Loading.311fadfe.js";import"./vue-quill.snow.9de684a5.js";/* empty css */import{F as Y}from"./index.a76a1867.js";import{F as Z}from"./index.87425b49.js";import{T as W}from"./index.d6cd085f.js";import{T as J}from"./index.9a705aa9.js";import{D as K}from"./DenyButton.0cc61df4.js";import{U as Q}from"./UpdateButton.07cc80b7.js";import{A as X}from"./ApproverService.98a90a32.js";import{M as ee}from"./Multiselect.a8e1703e.js";import{F as te}from"./index.03e5c851.js";import{C as oe}from"./index.bea8539a.js";import{A as se}from"./main.esm.6f68e095.js";import{A as ie}from"./ActionCellRendererApprover.45859e11.js";import"./logo-black.7c15feb3.js";import"./logo-white.b04c5a89.js";import"./transition.2b35576b.js";import"./EmployeeService.402d7e1b.js";import"./es.string.replace.7f4d713f.js";import"./Loading.vue_vue_type_style_index_0_scoped_cbded5a2_lang.c1f77430.js";import"./index.59b1a56c.js";import"./ck-white.4bf441fa.js";const re={components:{Fileinput:te,DenyButton:K,FormModal:Z,FormGroup:Y,TextInput:W,Textarea:J,SubmitButton:M,UpdateButton:Q,CloseButton:E,Loading:L,Multiselect:ee,Icon:D,Checkbox:oe},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_from:"",to_time:"",description:"",attachment:"",recommending_id:"",approver_id:""},errors:{},state:{isEdit:!1,isSaving:!1,isLoading:!1,isCompanyLoading:!1}}},methods:{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.date=new Date(t.date).toLocaleDateString("en-CA").split("T")[0],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:"",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 X.fetchEmployeeApprover(t.employee_id).then(e=>{if(e.status==200)this.recommendingOptions=e.data.map((o,m)=>({value:o.employee_id,label:o.firstname+" "+o.lastname})),this.approvingOptions=e.data.filter(o=>o.classification_id>=3).map((o,m)=>({value:o.employee_id,label:o.firstname+" "+o.lastname}));else throw new Error("Failed to fetch employee approvers")})},closeModal(){this.state.showModal=!1},resetForm(){this.state.isEdit=!1,this.form={date:"",from_time:"",to_time:"",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 B.updateApprover(t,e).then(o=>{o.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(o=>{o.response.status==422?this.$swal.fire({title:"Ooops! something is wrong.",text:o.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;await B.update(t,this.status).then(e=>{e.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(e=>{e.response.status==422?this.$swal.fire({title:"Ooops! something is wrong.",text:e.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(t=>{t.value&&this.saveRecord()})}catch(t){if(t instanceof F){const e={};t.inner.forEach(o=>{e[o.path]=o.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 F){const e={};t.inner.forEach(o=>{e[o.path]=o.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 F){const e={};t.inner.forEach(o=>{e[o.path]=o.message}),this.errors=e}}},calculateHours(){const t=this.form.from_time,e=this.form.to_time;if(t&&e){const[o,m]=this.form.from_time.split(":").map(Number),[s,c]=this.form.to_time.split(":").map(Number);let d=s-o;d+=(c-m)/60,d<0&&(d+=24),this.form.hours=d}}}},ne={class:"text-slate-600 dark:text-slate-400 text-sm font-normal"},ae={class:"grid grid-cols-12 gap-4"},le={class:"col-span-12"},ce={class:"col-span-6"},de={class:"col-span-6"},me={class:"col-span-12"},pe={class:"col-span-12"},ue={key:1},fe={class:"grid grid-cols-12 justify-center items-center"},he={class:"col-span-8 flex justify-between items-center gap-4"},ge={class:"col-span-6 flex justify-center items-center gap-4"},_e={class:"font-bold"},ve={class:"col-span-6 flex justify-center items-center gap-4"},xe={class:"font-bold"},ye={key:2},we={class:"grid grid-cols-12 gap-4"},be={class:"col-span-6"},Ce={class:"relative"},Se={class:"col-span-6"},Ae={class:"relative"},Fe={class:"flex gap-1 justify-end pt-8"},ke={key:0,class:"flex gap-1 justify-end"},Re={key:1,class:"flex gap-1 justify-end"};function Be(t,e,o,m,s,c){const d=n("Loading"),x=n("flat-pickr"),u=n("FormGroup"),C=n("Textarea"),S=n("Fileinput"),w=n("Multiselect"),b=n("UpdateButton"),f=n("DenyButton"),A=n("CloseButton"),y=n("FormModal");return a(),h(y,{title:"View Record",active:s.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:c.closeModal,themeClass:"bg-gray-800",sizeClass:"lg:w-3/4"},{default:p(()=>[s.state.isEdit&&s.state.isLoading?(a(),h(d,{key:0,text:"Fetching record"})):_("",!0),i("div",ne,[i("form",{onSubmit:e[7]||(e[7]=N((...l)=>t.confirmSubmit&&t.confirmSubmit(...l),["prevent"])),class:"space-y-4",enctype:"multipart/form-data"},[s.state.isSaving?(a(),h(d,{key:0,text:"Saving record"})):_("",!0),i("div",ae,[i("div",le,[r(u,{label:"Date",isRequired:!0},{default:p(()=>[r(x,{modelValue:s.form.date,"onUpdate:modelValue":e[0]||(e[0]=l=>s.form.date=l),class:"form-control h-[48px]",id:"date",placeholder:"yyyy, dd M"},null,8,["modelValue"])]),_:1})]),i("div",ce,[r(u,{label:"From Time",isRequired:!0},{default:p(()=>[r(x,{class:"form-control h-[48px]",placeholder:"From time",modelValue:s.form.from_time,"onUpdate:modelValue":e[1]||(e[1]=l=>s.form.from_time=l),config:{enableTime:!0,noCalendar:!0,dateFormat:"H:i"}},null,8,["modelValue"])]),_:1})]),i("div",de,[r(u,{label:"To Time",isRequired:!0},{default:p(()=>[r(x,{class:"form-control h-[48px]",placeholder:"To time",modelValue:s.form.to_time,"onUpdate:modelValue":e[2]||(e[2]=l=>s.form.to_time=l),config:{enableTime:!0,noCalendar:!0,dateFormat:"H:i"}},null,8,["modelValue"])]),_:1})]),i("div",me,[r(u,{label:"Remarks"},{default:p(()=>[r(C,{name:"pn4",placeholder:"",modelValue:s.form.description,"onUpdate:modelValue":e[3]||(e[3]=l=>s.form.description=l)},null,8,["modelValue"])]),_:1})]),i("div",pe,[r(u,{label:"Attachment"},{default:p(()=>[r(S,{name:"basic",onChange:e[4]||(e[4]=l=>c.handleMainImageUpload()),class:"h-[48px]",multiple:""})]),_:1})])]),s.currentClassificationId<=2?(a(),g("div",ue,[i("div",fe,[i("div",he,[i("div",ge,[e[8]||(e[8]=k(" Recommending: ")),i("p",_e,v(s.recommending),1)]),i("div",ve,[e[9]||(e[9]=k(" Approving: ")),i("p",xe,v(s.approving),1)])])])])):(a(),g("div",ye,[i("div",we,[i("div",be,[r(u,{label:"Recommending"},{default:p(()=>[i("div",Ce,[r(w,{modelValue:s.form.recommending_id,"onUpdate:modelValue":e[5]||(e[5]=l=>s.form.recommending_id=l),"close-on-select":!0,searchable:!0,id:"recommending_id",options:s.recommendingOptions},null,8,["modelValue","options"])])]),_:1})]),i("div",Se,[r(u,{label:"Approver"},{default:p(()=>[i("div",Ae,[r(w,{modelValue:s.form.approver_id,"onUpdate:modelValue":e[6]||(e[6]=l=>s.form.approver_id=l),"close-on-select":!0,searchable:!0,id:"approver_id",options:s.approvingOptions},null,8,["modelValue","options"])])]),_:1})])])])),i("div",Fe,[this.form.status==0&&s.currentRecommendingId==s.currentEmployeeId||s.currentApprovingId==s.currentEmployeeId&&this.form.status==1&&s.currentApprovingId==this.form.approver_id||this.form.approver_id==this.form.recommending_id&&s.currentApprovingId==this.form.approver_id&&s.currentEmployeeId==this.form.approver_id?(a(),g("div",ke,[this.form.status<=1?(a(),h(b,{key:0,onClick:c.submitForm,text:s.btnTitle},null,8,["onClick","text"])):_("",!0),this.form.status<=1?(a(),h(f,{key:1,onClick:c.denyForm,text:"Deny"},null,8,["onClick"])):_("",!0)])):this.form.status==0&&s.currentApprovingId==s.currentEmployeeId||s.currentApprovingId!=this.form.approver_id?(a(),g("div",Re,[this.form.status<=1?(a(),h(b,{key:0,onClick:c.updateApproverForm,text:"Update Approver"},null,8,["onClick"])):_("",!0)])):_("",!0),r(A,{onClick:c.closeModal},null,8,["onClick"])])],32)])]),_:1},8,["active","sideTitle","badgeColor","onSubmit","onClose"])}const Ve=T(re,[["render",Be],["__scopeId","data-v-541057d7"]]);const Ie={mixins:[U],components:{ActionCellRendererApprover:ie,AgGridVue:se,Card:P,Button:O,Badge:j,Layout:z,Icon:D,SubmitButton:M,CloseButton:E,EditButton:H,ViewButton:$,View:Ve,InputGroup:G,Loading:L},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:"time coverage",filter:!0,floatingFilter:!0,flex:2},{field:"remarks",filter:!0,floatingFilter:!0,flex:2},{field:"date created",filter:!0,floatingFilter:!0},{headerName:"Status",field:"status",filter:!0,floatingFilter:!0,valueGetter:t=>{switch(t.data.status){case 0:return"For Recommendation";case 1:return"For Approval";case 2:return"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-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}}}],breadcrumbs:[{text:"Home",href:"/"},{text:"Timekeeping",href:"/attendance/change-schedule"},{text:"Change Schedule 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:[],state:{isLoading:!1,isEdit:!1,isDeleting:!1}}},methods:{formatDate(t){const e=new Date(t),o=new Date(e.toLocaleString("en-US",{timeZone:"UTC"})),m=new Date(o.toLocaleString("en-US",{timeZone:"Asia/Singapore"})),s=m.getFullYear(),c=String(m.getMonth()+1).padStart(2,"0"),d=String(m.getDate()).padStart(2,"0");return`${s}-${c}-${d}`},async fetchRecords(){this.state.isLoading=!0,await B.fetchRecords().then(t=>{let e=t.data.data;this.items=e,this.items=e.map((o,m)=>(this.statistics[0].count[0].total=o.pending,this.statistics[1].count[0].total=o.approved,this.statistics[2].count[0].total=o.denied,{...o,"#":m+1,"employee id":o.employee_id,name:o.employee.firstname+" "+o.employee.lastname,date:this.$formatDate(o.date),"time coverage":this.$formatTime(o.from_time)+" - "+this.$formatTime(o.to_time)+" ("+o.hours+" Hours)",remarks:o.description,"date created":this.$formatDate(o.created_at),status:o.status}))}).finally(()=>{this.state.isLoading=!1})},reload(){this.$emit("reload")},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=>{e.value&&(this.state.isDeleting=!0,q.remove(t).then(o=>{o.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){this.$refs.view.resetForm(),this.$refs.view.loadRecord(t),this.$refs.view.state.showModal=!0}},mounted(){this.fetchRecords()}},De={class:"space-y-4 mt-4"},Te={class:"flex-1 md:mb-0 mb-3"},Ee={class:"grid grid-cols-1 gap-4 pb-4 md:grid-cols-3"},Me={class:R("h-14 w-14 flex items-center justify-center rounded-md text-4xl mb-4 shadow-lg bg-white")},Le={class:"text-md font-semibold text-slate-700 dark:text-white mb-2"},Ue={class:"flex justify-center gap-4"},ze={class:"text-xs font-medium text-slate-500 dark:text-white mb-1"},Pe={class:"text-2xl text-slate-900 dark:text-white font-semibold"},Oe={class:"ag-grid-toolbar flex items-center justify-between px-4 py-2 bg-gray-100 border-b rounded-t-xl border-gray-200"},je={class:"flex items-center gap-4"},Ge={class:"relative z-10 flex items-center transition-colors duration-300 group-hover:text-white"};function Ne(t,e,o,m,s,c){const d=n("Icon"),x=n("Button"),u=n("ag-grid-vue"),C=n("Card"),S=n("Loading"),w=n("View"),b=n("Layout");return a(),h(b,{breadcrumbs:s.breadcrumbs},{default:p(()=>[i("div",De,[r(C,{title:"Change Schedule Applications"},{default:p(()=>[i("h6",Te,v(t.title),1),i("div",Ee,[(a(!0),g(I,null,V(s.statistics,(f,A)=>(a(),g("div",{key:A,class:R([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"])},[i("div",Me,[r(d,{icon:f.icon,class:R(["text-2xl",f.text])},null,8,["icon","class"])]),i("div",Le,v(f.title),1),i("div",Ue,[(a(!0),g(I,null,V(f.count,y=>(a(),g("div",{key:y.type},[i("div",ze,v(y.type),1),i("div",Pe,v(y.total),1)]))),128))])],2))),128))]),i("div",Oe,[e[3]||(e[3]=i("div",{class:"flex items-center justify-center gap-4 text-gray-900"}," Employee Change Schedule Lists ",-1)),i("div",je,[r(x,{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:p(()=>[e[2]||(e[2]=i("span",{class:"absolute inset-0 bg-green-500 transition-transform duration-300 transform -translate-x-full group-hover:translate-x-0"},null,-1)),i("span",Ge,[r(d,{icon:"mdi:microsoft-excel",class:"text-2xl mr-2"}),e[1]||(e[1]=k(" Export to CSV "))])]),_:1},8,["onClick"])])]),r(u,{ref:"agGrid",rowData:s.items,columnDefs:s.colDefs,style:{height:"500px"},class:"ag-theme-quartz",pagination:!0,paginationPageSize:s.paginationPageSize,paginationPageSizeSelector:s.paginationPageSizeSelector,onGridReady:t.onGridReady},null,8,["rowData","columnDefs","paginationPageSize","paginationPageSizeSelector","onGridReady"])]),_:1}),s.state.isLoading?(a(),h(S,{key:0,text:"Fetching records"})):_("",!0),r(w,{onCloseModal:e[0]||(e[0]=f=>s.state.showModal=!1),ref:"view",onReload:c.fetchRecords},null,8,["onReload"])])]),_:1},8,["breadcrumbs"])}const Dt=T(Ie,[["render",Ne],["__scopeId","data-v-d5054b60"]]);export{Dt as default};
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0 |
proxy
|
phpinfo
|
Settings