File manager - Edit - /home/autoph/public_html/projects/ahg-hr/assets/index.8fe6fc21.js
Back
import{B as M}from"./index.9affbcc7.js";import{_ as U,r as d,o as u,c as y,w as m,j as p,d as l,k as j,e as s,b as _,f as x,t as g}from"./index.0409e1b2.js";import{D as q}from"./DeleteButton.7df36dab.js";import{E as N}from"./EditButton.16b17e01.js";import{F as G}from"./FileButton.a7226576.js";/* empty css */import{V as W}from"./ViewButton.074b6bc6.js";import{L as J,b as Q,D as Y,M as H}from"./index.15d773bc.js";import{I as z}from"./index.39289473.js";import"./jspdf.es.min.4dda79e8.js";/* empty css */import{H as K}from"./HelperService.b0838e08.js";import{C as A}from"./CompanyService.ee45576d.js";import{F as D}from"./FileService.5c843715.js";import{M as V}from"./MrfService.a4775cbf.js";import{B as X}from"./index.de756f91.js";/* empty css */import"./vue-cleave.min.18e79662.js";import{V as T}from"./array.6ad60c2c.js";import{L}from"./Loading.490cab57.js";import"./vue-quill.snow.d79094c0.js";/* empty css */import{l as Z}from"./lodash.0a0ce71b.js";import{I as $}from"./index.38283705.js";import{C as ee}from"./index.b5116294.js";import te from"./form.78ab4051.js";import{F as oe}from"./index.e35ce9e9.js";import{F as se}from"./index.209240bf.js";import{T as re}from"./index.a77f7fb6.js";import{T as ie}from"./index.61dcb620.js";import{M as ne}from"./Multiselect.bcca6a98.js";import{R as le}from"./index.444b65a7.js";import{F as ae}from"./index.95692785.js";import{F as de}from"./index.a38b0ff2.js";import{T as me}from"./index.9ea1e66b.js";import{A as ue}from"./ApproverService.3b1246b2.js";import{E as ce}from"./EmployeeService.a7f96e81.js";import{E as pe}from"./EmploymentTypeService.16c01f9c.js";import{J as fe}from"./JobTitleService.cf3393b5.js";import{N as he}from"./NatureOfRequestService.34f8de5c.js";import{S as ge}from"./SalaryGradeService.16941ab6.js";import{S as _e}from"./SupportingDocumentService.c1e6c225.js";import{C as ye}from"./CloseButton.5f2b3ff2.js";import{D as be}from"./DenyButton.1fd46c88.js";import{S as ve}from"./SubmitButton.16346f33.js";import{U as we}from"./UpdateButton.24df4af0.js";import{p as F,j as xe}from"./scr-1.d9aaecca.js";import{P as Ce}from"./index.9cd030c0.js";import"./logo-black.7c15feb3.js";import"./logo-white.b04c5a89.js";import"./transition.31efaf2a.js";import"./es.string.replace.33548c32.js";import"./Loading.vue_vue_type_style_index_0_scoped_cbded5a2_lang.ea365faf.js";import"./index.ee580c69.js";import"./index.3560e594.js";const Ve="/assets/sk.2fa59342.svg",Re="/assets/path.23ef6285.svg",Oe="/assets/file-1.4a0ee4bf.svg",Pe="/assets/pdf-1.f0f1a359.svg",Se="/assets/zip-1.b46fcdb3.svg",Be={components:{FileType:de,FormModal:oe,FormGroup:se,TextInput:re,Textarea:ie,SubmitButton:ve,UpdateButton:we,CloseButton:ye,DenyButton:be,Loading:L,Multiselect:ne,Button:M,Radio:le,FileInput:ae,TextArea:me},data(){return{sk:Ve,path:Re,file1:Oe,file2:Pe,zip:Se,pdf:F,file3:xe,currentClassificationId:this.$store.userSettings.getActiveUser.employees?this.$store.userSettings.getActiveUser.employees.classification_id:"",currentEmployeeId:this.$store.userSettings.getActiveUser.employee_id,companyOption:[],natureOfRequestOption:[],jobTitleOption:[],salaryGradeOption:[],employmentStatusPlantillaOption:[],employmentStatusNonPlantillaOption:[],supportingDocumentPlantillaOption:[],supportingDocumentNonPlantillaOption:[],requestor:"",recommender:"",endorser:"",approver_name:"",recommended_by:"",approved_by:"",form:{company_id:"",nature_of_request:"",classification:"",job_title:"",salary:"",salary_grade:"",replacement_position_number:"",employee_name_to_be_replaced1:"",nature_of_seperation1:"",date_of_seperation1:"",new_position_number:"",date_needed:"",employment_status:"",document_type:"",supporting_document:"",working_position_title:"",inclusive_period:"",attachment:"",justification:"",job_design:"",requested_by:this.$store.userSettings.getActiveUser.employee_id,endorsed_by:""},errors:{},state:{isEdit:!1,isSaving:!1,isLoading:!1,isCompanyLoading:!1,isNatureRequestLoading:!1,isPositionLoading:!1},fileIcons:{pdf:F,default:F}}},watch:{async"form.company_id"(t){try{const e=await ce.fetchHrManagerRecord(t);e.status===200&&(this.endorser=e.data.full_name,this.form.endorsed_by=e.data.employee_id)}catch(e){console.log(e)}}},methods:{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 T){const e={};t.inner.forEach(i=>{e[i.path]=i.message}),this.errors=e}}},getFileTypeImage(t){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 D.Reader2("mrf",t),i;if(t.endsWith(".pdf"))i="application/pdf";else if(t.endsWith(".png"))i="image/png";else if(t.endsWith(".jpg")||t.endsWith(".jpeg"))i="image/jpeg";else if(t.endsWith(".svg"))i="image/svg+xml";else throw new Error("Unsupported file type");const h=atob(e),o=new Array(h.length);for(let a=0;a<h.length;a++)o[a]=h.charCodeAt(a);const c=new Uint8Array(o),w=new Blob([c],{type:i}),f=URL.createObjectURL(w);window.open(f),this.state.isLoadingPDF=!1},handleMainImageUpload(){const t=event.target.files[0];this.form.supporting_document=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 fetchCompany(){this.state.isCompanyLoading=!0;try{const t=await A.fetchRecords();t.status===200&&(this.state.isCompanyLoading=!1,this.companyOption=t.data.data.map(e=>({value:e.id,label:e.code+" - "+e.name})))}catch(t){console.log(t)}finally{this.state.isCompanyLoading=!1}},async fetchApprover(){try{const t=await ue.fetchApproverRecords();t.status===200&&t.data.map(e=>{(this.$store.userSettings.getActiveUser.employees?this.$store.userSettings.getActiveUser.employees.classification_id:"")==2&&e.classification_id==3?(this.recommended_by=e.employee_id,this.recommender=e.firstname+" "+e.lastname):e.classification_id==4&&(this.form.recommended_by=e.employee_id,this.recommender=e.firstname+" "+e.lastname),e.classification_id==4&&(this.approved_by=e.employee_id,this.approver_name=e.firstname+" "+e.lastname)})}catch(t){console.log(t)}finally{this.state.isCompanyLoading=!1}},async fetchNatureOfRequest(){this.state.isNatureRequestLoading=!0,await he.fetchRecords().then(t=>{t.status==200&&(this.state.isNatureRequestLoading=!1,this.natureOfRequestOption=t.data.data.filter(e=>e.request_for=="MRF").map(e=>({value:e.id,label:e.name})))}).catch(t=>{console.log(t)}).finally(()=>{this.state.isNatureRequestLoading=!1})},async fetchJobTitle(){this.state.isPositionLoading=!0,await fe.fetchRecords().then(t=>{t.status==200&&(this.state.isPositionLoading=!1,this.jobTitleOption=t.data.data.map(e=>({value:e.id,label:e.name})))}).catch(t=>{console.log(t)}).finally(()=>{this.state.isPositionLoading=!1})},async fetchSalaryGrade(){await ge.fetchRecords().then(t=>{t.status==200&&(this.salaryGradeOption=t.data.data.map(e=>({value:e.id,label:e.name})))}).catch(t=>{console.log(t)})},async fetchEmploymentStatus(){await pe.fetchRecords().then(t=>{t.status==200&&(this.employmentStatusPlantillaOption=t.data.data.filter(e=>e.plantilla).map(e=>({value:e.id,label:e.name})),this.employmentStatusNonPlantillaOption=t.data.data.filter(e=>e.plantilla==!1).map(e=>({value:e.id,label:e.name})))}).catch(t=>{console.log(t)})},async fetchSupportingDocument(){await _e.fetchRecords().then(t=>{t.status==200&&(this.supportingDocumentPlantillaOption=t.data.data.filter(e=>e.plantilla).filter(e=>e.name=="MRF").map(e=>({value:e.id,label:e.module_name})),this.supportingDocumentNonPlantillaOption=t.data.data.filter(e=>e.plantilla==!1).filter(e=>e.name=="MRF").map(e=>({value:e.id,label:e.module_name})))}).catch(t=>{console.log(t)})},closeModal(){this.state.showModal=!1},closeMRFModal(){const t=this.form.id;try{this.$swal.fire({title:"Are you sure you want to close this record?",text:"",icon:"question",showCancelButton:!0,confirmButtonColor:"#34c38f",cancelButtonColor:"#f46a6a",confirmButtonText:"Yes",cancelButtonText:"No"}).then(e=>{e.value&&V.closeMrf(t,"").then(i=>{i.status==201?(this.$swal.fire({title:"Great!",text:"Record successfully closed.",icon:"success",timer:2e3}),this.state.isSaving=!1,this.state.showModal=!1,this.reload()):this.$swal.fire({title:"Ooops! something is wrong.",text:"Please contact system administrator",icon:"error",timer:2e3}),this.reload()}).catch(i=>{i.response.status==422?this.$swal.fire({title:"Ooops! something is wrong.",text:i.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 T){const i={};e.inner.forEach(h=>{i[h.path]=h.message}),this.errors=i}this.state.isSaving=!1}},resetForm(){this.state.isEdit=!1,this.form={company_id:"",nature_of_request:"",classification:"",job_title:"",salary_grade:"",replacement_position_number:"",employee_name_to_be_replaced1:"",nature_of_seperation1:"",date_of_seperation1:"",new_position_number:"",date_needed:"",employment_status:"",supporting_document:"",document_type:"",working_position_title:"",inclusive_period:"",attachment:"",justification:"",job_design:"",requested_by:this.$store.userSettings.getActiveUser.employee_id,recommended_by:"",endorsed_by:"",approved_by:""}},reload(){this.$emit("reload")},loadRecord(t){this.resetForm(),this.state.isEdit=!0,this.form=t,console.log(this.form),this.requestor=t.requestor[0].firstname+" "+t.requestor[0].lastname,this.recommender=t.recommendor[0]?t.recommendor[0].firstname+" "+t.recommendor[0].lastname:"",this.endorser=t.endorser[0]?t.endorser[0].firstname+" "+t.endorser[0].lastname:"",this.approver_name=t.approver[0]?t.approver[0].firstname+" "+t.approver[0].lastname:""},async submitForm(){try{this.$swal.fire({title:"Are you sure you want to submit this record for recommendation?",text:"",icon:"question",showCancelButton:!0,confirmButtonColor:"#34c38f",cancelButtonColor:"#f46a6a",confirmButtonText:"Yes",cancelButtonText:"No"}).then(t=>{t.value&&this.saveRecord()})}catch(t){if(t instanceof T){const e={};t.inner.forEach(i=>{e[i.path]=i.message}),this.errors=e}this.state.isSaving=!1}},async saveRecord(){const t=this.form.id;this.state.isSaving=!0,new FormData;let e=[];this.status?e={status:this.status.status,denied_reason:this.status.denied_reason}:this.form.recommended_by==this.currentEmployeeId?e={status:1}:this.form.endorsed_by==this.currentEmployeeId?e={status:2}:this.form.approved_by==this.currentEmployeeId&&(e={status:3}),await V.updateStatus(t,e).then(i=>{i.status==201?(this.$swal.fire({title:"Great!",text:"Record successfully submitted.",icon:"success",timer:2e3}),this.state.isSaving=!1,this.state.showModal=!1,this.reload()):this.$swal.fire({title:"Ooops! something is wrong.",text:"Please contact system administrator",icon:"error",timer:2e3}),this.reload()}).catch(i=>{i.response.status==422?this.$swal.fire({title:"Ooops! something is wrong.",text:i.response.data.message,icon:"warning"}):this.$swal.fire({title:"Ooops! something is wrong.",text:"Please contact system administrator",icon:"error",timer:2e3})})}},mounted(){this.fetchCompany(),this.fetchNatureOfRequest(),this.fetchJobTitle(),this.fetchSalaryGrade(),this.fetchEmploymentStatus(),this.fetchSupportingDocument(),this.fetchApprover()}},Ee={class:"text-slate-600 dark:text-slate-400 text-sm font-normal shadow-md p-10 border-dotted border-slate-400 px-5"},ke={class:"grid grid-cols-1 gap-2"},Ie={class:"grid grid-cols-1 gap-2 mb-4"},Te={key:0},Fe={class:"flex justify-start items-center gap-6 mb-4"},Me={class:"grid grid-cols-2 gap-2"},Ue={class:"grid grid-cols-1 gap-2"},Ae={class:"grid grid-cols-3 gap-2"},De={class:"grid grid-cols-1 gap-2"},Le={class:"grid grid-cols-3 gap-2"},je={key:1},qe={class:"grid grid-cols-1 gap-2"},Ne={class:"grid grid-cols-2 gap-2"},Ge={class:"grid grid-cols-2 gap-2"},We={class:"grid grid-cols-1 gap-2"},Je={class:"grid grid-cols-3 gap-2"},Qe={class:"grid grid-cols-1 gap-2"},Ye={class:"grid grid-cols-2"},He={class:"flex justify-center items-center gap-4 mt-4"},ze={class:"font-bold"},Ke={key:0,class:"flex justify-center items-center gap-4"},Xe={class:"font-bold"},Ze={class:"grid grid-cols-2"},$e={class:"flex justify-center items-center gap-4"},et={class:"font-bold"},tt={class:"flex justify-center items-center gap-4 mb-4"},ot={class:"font-bold"},st={class:"flex gap-1 justify-end"};function rt(t,e,i,h,o,c){const w=d("Loading"),f=d("Multiselect"),a=d("FormGroup"),b=d("Radio"),v=d("TextInput"),R=d("flat-pickr"),O=d("FileType"),C=d("TextArea"),P=d("UpdateButton"),S=d("DenyButton"),B=d("Button"),E=d("CloseButton"),k=d("FormModal");return u(),y(k,{title:"View Record",active:o.state.showModal,sideTitle:this.form.status==0?"for recommendation":this.form.status==1?"for endorsement":this.form.status==2?"for approval":this.form.status==3?"approved":this.form.status==99?"denied":"",badgeColor:this.form.status==0?"warning":this.form.status==1||this.form.status==2?"info":this.form.status==3?"success":this.form.status==99?"danger":"",onSubmit:t.confirmSubmit,onClose:c.closeModal,themeClass:"bg-gray-800",sizeClass:"lg:w-3/4"},{default:m(()=>[o.state.isEdit&&o.state.isLoading?(u(),y(w,{key:0,text:"Fetching record"})):p("",!0),o.state.isSaving?(u(),y(w,{key:1,text:"Saving record"})):p("",!0),l("div",Ee,[l("form",{onSubmit:e[24]||(e[24]=j((...r)=>t.confirmSubmit&&t.confirmSubmit(...r),["prevent"])),class:"space-y-4",enctype:"multipart/form-data"},[l("div",ke,[s(a,{label:"REQUESTING UNIT/COMPANY",isRequired:!0},{default:m(()=>[s(f,{modelValue:o.form.company_id,"onUpdate:modelValue":e[0]||(e[0]=r=>o.form.company_id=r),"close-on-select":!0,searchable:!0,id:"company_id",options:o.companyOption,loading:o.state.isCompanyLoading,disabled:!0},null,8,["modelValue","options","loading"])]),_:1})]),l("div",Ie,[s(a,{label:"NATURE OF REQUEST"},{default:m(()=>[s(f,{modelValue:o.form.nature_of_request,"onUpdate:modelValue":e[1]||(e[1]=r=>o.form.nature_of_request=r),"close-on-select":!0,searchable:!0,id:"nature_of_request",options:o.natureOfRequestOption,loading:o.state.isNatureRequestLoading,disabled:!0},null,8,["modelValue","options","loading"])]),_:1})]),o.form.nature_of_request&&o.form.nature_of_request==1?(u(),_("div",Te,[l("div",Fe,[s(b,{label:"Executive",value:4,modelValue:o.form.classification,"onUpdate:modelValue":e[2]||(e[2]=r=>o.form.classification=r)},null,8,["modelValue"]),s(b,{label:"Manager",value:3,modelValue:o.form.classification,"onUpdate:modelValue":e[3]||(e[3]=r=>o.form.classification=r)},null,8,["modelValue"]),s(b,{label:"Supervior",value:2,modelValue:o.form.classification,"onUpdate:modelValue":e[4]||(e[4]=r=>o.form.classification=r)},null,8,["modelValue"]),s(b,{label:"Rank & File",value:1,modelValue:o.form.classification,"onUpdate:modelValue":e[5]||(e[5]=r=>o.form.classification=r)},null,8,["modelValue"])]),l("div",Me,[s(a,{label:"Position Title"},{default:m(()=>[s(f,{modelValue:o.form.job_title,"onUpdate:modelValue":e[6]||(e[6]=r=>o.form.job_title=r),"close-on-select":!0,searchable:!0,id:"job_title",options:o.jobTitleOption,loading:o.state.isPositionLoading,disabled:!0},null,8,["modelValue","options","loading"])]),_:1}),s(a,{label:"Job Grade"},{default:m(()=>[s(f,{modelValue:o.form.salary_grade,"onUpdate:modelValue":e[7]||(e[7]=r=>o.form.salary_grade=r),"close-on-select":!0,searchable:!0,id:"salary_grade",options:o.salaryGradeOption,disabled:!0},null,8,["modelValue","options"])]),_:1})]),l("div",Ue,[s(a,{label:"Replacements: Number of Position"},{default:m(()=>[s(v,{placeholder:"",type:"text",modelValue:o.form.replacement_position_number,"onUpdate:modelValue":e[8]||(e[8]=r=>o.form.replacement_position_number=r),error:o.errors.replacement_position_number,classInput:"h-[48px]",disabled:""},null,8,["modelValue","error"])]),_:1})]),l("div",Ae,[s(a,{label:"Name of Employee To Be Replaced"},{default:m(()=>[s(v,{type:"text",placeholder:"",modelValue:o.form.employee_name_to_be_replaced1,"onUpdate:modelValue":e[9]||(e[9]=r=>o.form.employee_name_to_be_replaced1=r),error:o.errors.employee_name_to_be_replaced1,classInput:"h-[48px]",disabled:""},null,8,["modelValue","error"])]),_:1}),s(a,{label:"Nature of Seperation"},{default:m(()=>[s(v,{type:"text",placeholder:"",modelValue:o.form.nature_of_seperation1,"onUpdate:modelValue":e[10]||(e[10]=r=>o.form.nature_of_seperation1=r),error:o.errors.nature_of_seperation1,classInput:"h-[48px]",disabled:""},null,8,["modelValue","error"])]),_:1}),s(a,{label:"Date of Seperation"},{default:m(()=>[s(R,{type:"text",placeholder:"",modelValue:o.form.date_of_seperation1,"onUpdate:modelValue":e[11]||(e[11]=r=>o.form.date_of_seperation1=r),error:o.errors.date_of_seperation1,class:"form-control h-[48px]",disabled:""},null,8,["modelValue","error"])]),_:1})]),l("div",De,[s(a,{label:"New Position/s: Number of Position"},{default:m(()=>[s(v,{placeholder:"",type:"text",modelValue:o.form.new_position_number,"onUpdate:modelValue":e[12]||(e[12]=r=>o.form.new_position_number=r),error:o.errors.new_position_number,classInput:"h-[48px]",disabled:""},null,8,["modelValue","error"])]),_:1})]),l("div",Le,[s(a,{label:"Date Needed"},{default:m(()=>[s(v,{type:"date",modelValue:o.form.date_needed,"onUpdate:modelValue":e[13]||(e[13]=r=>o.form.date_needed=r),error:o.errors.date_needed,classInput:"h-[48px]",disabled:""},null,8,["modelValue","error"])]),_:1}),s(a,{label:"Employment Status"},{default:m(()=>[s(f,{modelValue:o.form.employment_status,"onUpdate:modelValue":e[14]||(e[14]=r=>o.form.employment_status=r),"close-on-select":!0,searchable:!0,id:"employment_status",options:o.employmentStatusPlantillaOption,disabled:!0},null,8,["modelValue","options"])]),_:1}),s(a,{label:"Supporting document/s"},{default:m(()=>[s(f,{modelValue:o.form.document_type,"onUpdate:modelValue":e[15]||(e[15]=r=>o.form.document_type=r),"close-on-select":!0,searchable:!0,id:"document_type",options:o.supportingDocumentPlantillaOption,disabled:!0},null,8,["modelValue","options"]),l("div",{class:"flex justify-start items-center gap-2 mt-2 cursor-pointer",onClick:e[16]||(e[16]=r=>c.viewAttachment(o.form.supporting_document))},[s(O,{image:c.getFileTypeImage(o.form.supporting_document)},null,8,["image"]),x(" "+g(o.form.supporting_document),1)])]),_:1})])])):p("",!0),o.form.nature_of_request&&o.form.nature_of_request==2?(u(),_("div",je,[l("div",qe,[s(a,{label:"HIRING OF NON-PLANTILLA PERSONNEL"})]),l("div",Ne,[s(a,{label:"Designated/Working Position Title"},{default:m(()=>[s(f,{modelValue:o.form.job_title,"onUpdate:modelValue":e[17]||(e[17]=r=>o.form.job_title=r),"close-on-select":!0,searchable:!0,id:"job_title",options:o.jobTitleOption,loading:o.state.isPositionLoading,disabled:!0},null,8,["modelValue","options","loading"])]),_:1}),s(a,{label:"Employment Status"},{default:m(()=>[s(f,{modelValue:o.form.employment_status,"onUpdate:modelValue":e[18]||(e[18]=r=>o.form.employment_status=r),"close-on-select":!0,searchable:!0,id:"employment_status",options:o.employmentStatusNonPlantillaOption,disabled:!0},null,8,["modelValue","options"])]),_:1})]),l("div",Ge,[s(a,{label:"Inclusive Period of Employment"},{default:m(()=>[s(v,{placeholder:"",type:"text",modelValue:o.form.inclusive_period,"onUpdate:modelValue":e[19]||(e[19]=r=>o.form.inclusive_period=r),error:o.errors.inclusive_period,classInput:"h-[48px]",disabled:""},null,8,["modelValue","error"])]),_:1}),s(a,{label:"Supporting document"},{default:m(()=>[s(f,{modelValue:o.form.document_type,"onUpdate:modelValue":e[20]||(e[20]=r=>o.form.document_type=r),"close-on-select":!0,searchable:!0,id:"document_type",options:o.supportingDocumentNonPlantillaOption,disabled:!0},null,8,["modelValue","options"]),x(" "+g(o.form.supporting_document),1)]),_:1})])])):p("",!0),l("div",We,[s(a,{label:"JUSTIFICATION FOR THE REQUEST"},{default:m(()=>[s(C,{rows:"4",cols:"15",modelValue:o.form.justification,"onUpdate:modelValue":e[21]||(e[21]=r=>o.form.justification=r),disabled:""},null,8,["modelValue"])]),_:1})]),l("div",Je,[s(a,{label:"Salary"},{default:m(()=>[s(v,{type:"text",placeholder:"",modelValue:o.form.salary,"onUpdate:modelValue":e[22]||(e[22]=r=>o.form.salary=r),error:o.errors.salary,classInput:"h-[48px]"},null,8,["modelValue","error"])]),_:1})]),l("div",Qe,[s(a,{label:"Job Design"},{default:m(()=>[s(C,{rows:"4",cols:"15",modelValue:o.form.job_design,"onUpdate:modelValue":e[23]||(e[23]=r=>o.form.job_design=r),disabled:""},null,8,["modelValue"])]),_:1})]),l("div",Ye,[l("div",He,[e[25]||(e[25]=x(" Requested By: ")),l("p",ze,g(o.requestor)+" - Date ("+g(this.$formatDate(o.form.created_at))+")",1)]),o.recommender!=""?(u(),_("div",Ke,[e[26]||(e[26]=x(" Recommender: ")),l("p",Xe,g(o.recommender)+" "+g(o.form.status>=1?" - Date ("+this.$formatDate(o.form.recommended_at)+")":""),1)])):p("",!0)]),l("div",Ze,[l("div",$e,[e[27]||(e[27]=x(" Endorser: ")),l("p",et,g(o.endorser)+" "+g(o.form.status>=2?" - Date ("+this.$formatDate(o.form.endorsed_at)+")":""),1)]),l("div",tt,[e[28]||(e[28]=x(" Approver: ")),l("p",ot,g(o.approver_name)+" "+g(o.form.status>=3?" - Date ("+this.$formatDate(o.form.approved_at)+")":""),1)])]),l("div",st,[this.form.recommended_by==o.currentEmployeeId&&this.form.status==0||this.form.endorsed_by==o.currentEmployeeId&&this.form.status==1||this.form.approved_by==o.currentEmployeeId&&this.form.status==2?(u(),y(P,{key:0,onClick:c.submitForm,text:o.form.status==0?"Submit for Endorsement":o.form.status==1?"Submit for Approval":o.form.status==2?"Approve":""},null,8,["onClick","text"])):p("",!0),this.form.recommended_by==o.currentEmployeeId&&this.form.status==0||this.form.endorsed_by==o.currentEmployeeId&&this.form.status==1||this.form.approved_by==o.currentEmployeeId&&this.form.status==2?(u(),y(S,{key:1,onClick:c.denyForm,text:"Deny"},null,8,["onClick"])):p("",!0),o.form.status==3?(u(),y(B,{key:2,type:"button",btnClass:"btn bg-red-600 pl-3 py-2 border border-red-600 hover:ring ring-offset-1 ring-red-600 text-white",icon:"carbon:close-outline",iconClass:"text-2xl",text:"Close this MRF?",onClick:c.closeMRFModal},null,8,["onClick"])):p("",!0),s(E,{onClick:c.closeModal},null,8,["onClick"])])],32)])]),_:1},8,["active","sideTitle","badgeColor","onSubmit","onClose"])}const it=U(Be,[["render",rt]]);const nt={setup(){},components:{FileButton:G,Badge:X,Layout:J,Form:te,View:it,Card:ee,InputGroup:$,Button:M,MenuItem:Q,Dropdown:Y,Icon:z,MinimalAvatar:H,Pagination:Ce,ViewButton:W,EditButton:N,DeleteButton:q,Loading:L},data(){return{currentEmployeeId:this.$store.userSettings.getActiveUser.employees?this.$store.userSettings.getActiveUser.employees.employee_id:"admin",title:"Employee Masterlist",breadcrumbs:[{text:"Home",href:"/"},{text:"Recruitment",href:"/mrf"},{text:"Mrf",active:!0}],total:100,state:{showModal:!1,viewModal:!1},items:[],current:1,searchQuery:"",perpage:10,pageRange:5,serverOptions:{page:1,rowsPerPage:10,sortBy:"status",sortType:"asc"},actions:[{name:"approve",icon:"heroicons-outline:hand-thumb-up"},{name:"denied",icon:"heroicons-outline:hand-thumb-down"}],options:[{value:"1",label:"1"},{value:"3",label:"3"},{value:"5",label:"5"}],columns:[{label:"#",field:"#"},{label:"Company",field:"company_code"},{label:"Job title",field:"jobtitle.name"},{label:"No. of Vacancies",field:"replacement_position_number"},{label:"Employment Status",field:"employmenttype.name"},{label:"Attachment",field:"supporting_document"},{label:"Requested by",field:"fullname"},{label:"Status",field:"status"},{label:"Action",field:"action"}],perPageOptions:[{value:"10",label:"10"},{value:"50",label:"50"},{value:"100",label:"100"}]}},methods:{async viewAttachment(t){if(this.state.isDownloading)return;this.state.isDownloading=!0;let e=await D.Reader2("mrf",t),i;if(t.endsWith(".pdf"))i="application/pdf";else if(t.endsWith(".png"))i="image/png";else if(t.endsWith(".jpg")||t.endsWith(".jpeg"))i="image/jpeg";else if(t.endsWith(".svg"))i="image/svg+xml";else throw new Error("Unsupported file type");const h=atob(e),o=new Array(h.length);for(let a=0;a<h.length;a++)o[a]=h.charCodeAt(a);const c=new Uint8Array(o),w=new Blob([c],{type:i}),f=URL.createObjectURL(w);window.open(f),this.state.isLoadingPDF=!1},async fetchMrfRecords(){this.state.isLoading=!0,await V.fetchRecords({keyword:this.searchQuery,page:this.serverOptions.page,per_page:this.serverOptions.rowsPerPage,sortBy:this.serverOptions.sortBy,sortType:this.serverOptions.sortType}).then(t=>{let e=t.data.data;this.items=e,this.items=e.map((i,h)=>({...i,"#":(this.serverOptions.page-1)*this.serverOptions.rowsPerPage+(h+1)})),this.totalItems=t.data.total}).finally(()=>{this.state.isLoading=!1})},viewRecord(t){this.$refs.view.resetForm(),this.$refs.view.loadRecord(t),this.$refs.view.state.showModal=!0},editRecord(t){this.$refs.form.resetForm(),this.$refs.form.loadRecord(t),this.$refs.form.state.showModal=!0},covertTolowerStr(t){return t.toLowerCase().trim()},shortenDesc(){this.items=this.items.map(t=>({...t,shortened_desc:K.shortenedText(t.job_description,5)}))},createRecord(){this.$refs.form.resetForm(),this.$refs.form.state.showModal=!0},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,V.remove(t).then(i=>{i.status==200&&(this.$swal.fire({title:"Yaaay!",text:"Record has been deleted successfully.",type:"success",icon:"success",timer:2e3}),this.fetchMrfRecords())}))}).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})},async fetchCompany(){this.state.isLoading=!0;try{const t=await A.fetchRecords();t.status===200&&(this.companyOption=t.data.data.map(e=>({value:e.id,label:e.code+" - "+e.name})))}catch(t){console.log(t)}},handlePageChange(t){console.log(t),console.log(this.serverOptions.page),this.serverOptions.page!=t&&(this.serverOptions.page=t)},handlePerPageChange(t){this.serverOptions.page=1,this.serverOptions.rowsPerPage=t},onSortChange(t){console.log(t),t[0].type!="none"&&(this.serverOptions.sortBy=t[0].field,this.serverOptions.sortType=t[0].type)}},watch:{serverOptions:{handler(){console.log(`perPage: ${this.serverOptions.rowsPerPage}`),this.fetchMrfRecords()},deep:!0},searchQuery:Z.debounce(function(){this.fetchMrfRecords()},800)},computed:{perPage:function(){return this.serverOptions.rowsPerPage}},mounted(){this.fetchCompany(),this.fetchMrfRecords()},created(){this.shortenDesc()}},lt={class:"my-5"},at={class:"md:flex pb-6 items-center"},dt={class:"md:flex md:space-x-3 items-center flex-none rtl:space-x-reverse my-3 float-right"},mt={key:0},ut={key:1},ct={class:"relative group"},pt={class:"icon"},ft={class:"absolute top-1/2 -translate-y-1/2 ml-2 px-3 py-1 bg-gray-800 text-white text-xs rounded shadow-lg opacity-0 transition-opacity duration-300 tooltip whitespace-nowrap"},ht={key:2},gt={key:0},_t={key:1},yt={key:2},bt={key:3},vt={key:4},wt={key:3},xt={key:4},Ct={class:"py-4 px-3 flex justify-center"};function Vt(t,e,i,h,o,c){const w=d("InputGroup"),f=d("Button"),a=d("FileButton"),b=d("Badge"),v=d("EditButton"),R=d("ViewButton"),O=d("DeleteButton"),C=d("Pagination"),P=d("vue-good-table"),S=d("Card"),B=d("Loading"),E=d("Form"),k=d("View"),r=d("Layout");return u(),y(r,{breadcrumbs:o.breadcrumbs},{default:m(()=>[l("div",lt,[s(S,{noborder:""},{default:m(()=>[l("div",at,[e[4]||(e[4]=l("h6",{class:"flex-1 md:mb-0 mb-3"},"Manpower Request Form",-1)),l("div",dt,[s(w,{modelValue:o.searchQuery,"onUpdate:modelValue":e[0]||(e[0]=n=>o.searchQuery=n),placeholder:"Search",type:"text",prependIcon:"heroicons-outline:search",merged:""},null,8,["modelValue"]),s(f,{icon:"heroicons-outline:plus-sm",text:"Add Record",btnClass:" btn-dark font-normal btn-sm ",iconClass:"text-lg",onClick:e[1]||(e[1]=n=>c.createRecord())})])]),s(P,{styleClass:"vgt-table lesspadding v-middle",columns:o.columns,rows:o.items,mode:"remote",search:!0,"sort-options":{enabled:!0},"pagination-options":{enabled:!0},onSortChange:c.onSortChange,"max-height":"600px"},{"table-row":m(n=>[n.column.field=="supporting_document"?(u(),_("div",mt,[s(a,{title:"Download Attachment",onClick:I=>c.viewAttachment(n.row.supporting_document)},null,8,["onClick"])])):p("",!0),n.column.field=="company_code"?(u(),_("div",ut,[l("div",ct,[l("span",pt,g(n.row.company.code),1),l("span",ft,g(n.row.company.name),1)])])):p("",!0),n.column.field=="status"?(u(),_("span",ht,[n.row.status==0?(u(),_("div",gt,[s(b,{label:"for recommendation",badgeClass:"bg-warning-500 text-white"})])):p("",!0),n.row.status==1?(u(),_("div",_t,[s(b,{label:"for endorsement",badgeClass:"bg-info-500 text-white"})])):p("",!0),n.row.status==2?(u(),_("div",yt,[s(b,{label:"for approval",badgeClass:"bg-info-500 text-white "})])):p("",!0),n.row.status==3?(u(),_("div",bt,[s(b,{label:"approved",badgeClass:"bg-success-500 text-white "})])):p("",!0),n.row.status==99?(u(),_("div",vt,[s(b,{label:"denied",badgeClass:"bg-danger-500 text-white "})])):p("",!0)])):p("",!0),n.column.field=="fullname"?(u(),_("span",wt,g(n.row.employee.firstname)+" "+g(n.row.employee.lastname),1)):p("",!0),n.column.field=="action"?(u(),_("span",xt,[(n.row.status==0||n.row.status==99)&&n.row.requested_by==o.currentEmployeeId?(u(),y(v,{key:0,onClick:I=>c.editRecord(n.row)},null,8,["onClick"])):p("",!0),n.row.requested_by==o.currentEmployeeId&&n.row.status!=0||n.row.recommended_by==o.currentEmployeeId&&n.row.status==0||n.row.status>0?(u(),y(R,{key:1,onClick:I=>c.viewRecord(n.row)},null,8,["onClick"])):p("",!0),n.row.requested_by==o.currentEmployeeId&&n.row.status==0?(u(),y(O,{key:2,onClick:I=>c.deleteRecord(n.row.id)},null,8,["onClick"])):p("",!0)])):p("",!0)]),"pagination-bottom":m(n=>[l("div",Ct,[s(C,{total:t.totalItems,current:o.serverOptions.page,"per-page":o.serverOptions.rowsPerPage,onPageChanged:c.handlePageChange,pageChanged:n.pageChanged,perPageChanged:o.serverOptions.rowsPerPage,enableSelect:"",perPageOptions:o.perPageOptions,onChangePerPage:c.handlePerPageChange},null,8,["total","current","per-page","onPageChanged","pageChanged","perPageChanged","perPageOptions","onChangePerPage"])])]),_:1},8,["columns","rows","onSortChange"])]),_:1}),o.state.isLoading?(u(),y(B,{key:0,text:"Fetching records"})):p("",!0),s(E,{onCloseModal:e[2]||(e[2]=n=>o.state.showModal=!1),onReload:c.fetchMrfRecords,ref:"form"},null,8,["onReload"]),s(k,{onCloseModal:e[3]||(e[3]=n=>o.state.showModal=!1),onReload:c.fetchMrfRecords,ref:"view"},null,8,["onReload"])])]),_:1},8,["breadcrumbs"])}const Po=U(nt,[["render",Vt],["__scopeId","data-v-56e2f8c9"]]);export{Po as default};
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings