File manager - Edit - /home/autoph/public_html/projects/ahg-hr/assets/index.0fcfa1cb.js
Back
import{_ as I,r as u,o as n,c as w,w as m,j as a,d as i,k as P,e as o,b as c,t as v,m as D,F as O,h as F}from"./index.3a33b88d.js";import{A as R}from"./ApplicantService.0d4720e7.js";import{F as L}from"./FileService.3bf05a89.js";import{L as E,b as N,D as z,P as A}from"./index.e90b797d.js";import{B as G}from"./index.1e572db2.js";import{C as J}from"./CreateButton.96a43e5c.js";import{D as Y}from"./DeleteButton.3d4df072.js";import{E as Q}from"./EditButton.5d564d58.js";import{F as W}from"./FileButton.c1708576.js";/* empty css */import{V as K}from"./ViewButton.a3057bdc.js";import{I as M}from"./index.a5110576.js";import"./jspdf.es.min.763284f3.js";/* empty css */import{L as T}from"./Loading.d8a54a1a.js";import{I as Z}from"./index.d1aceaee.js";import{F as H}from"./index.f8c90c2f.js";import{F as X}from"./index.8531a646.js";/* empty css */import{T as $}from"./index.0333a319.js";import{T as ee}from"./index.a785f83f.js";import{C as te}from"./CloseButton.d312e091.js";import{S as re}from"./SubmitButton.16c237a6.js";import{U as oe}from"./UpdateButton.285ca87f.js";import{T as ie}from"./index.b1c5b793.js";import{c as se,a as f,V as ne}from"./array.0146f311.js";import{E as B}from"./EmployeeService.bb8f97d2.js";import{M as le}from"./Multiselect.c4704026.js";import{c as ae,d as de,f as ce,e as me,g as ue,h as pe,i as fe,j as he,k as ge,l as _e}from"./apiUtils.7f866708.js";import{l as ye}from"./lodash.adf89e63.js";import{P as be}from"./index.1269b959.js";import{h as xe}from"./meeting-office.7e6e2274.js";import{C as ve}from"./index.609bcb7c.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"./index.8925dff3.js";import"./CompanyService.e719905a.js";import"./DealershipService.99d37351.js";import"./DepartmentService.1251efbc.js";import"./DivisionService.5f7a253f.js";import"./EmploymentTypeService.df99daf2.js";import"./GroupService.9f05c020.js";import"./JobClassficationService.a5bea6d7.js";import"./JobTitleService.601bf4bf.js";import"./SectionService.1ade9a4b.js";import"./SupportingDocumentService.7899f78b.js";import"./UnitService.2af97971.js";import"./CitizenshipService.f58f587d.js";import"./CivilStatusService.b366a24e.js";import"./ReligionService.d9725506.js";const we={components:{Icon:M,FormModal:X,FormGroup:H,TextInput:ee,Textinput:ie,TextArea:$,SubmitButton:re,UpdateButton:oe,CloseButton:te,Loading:T,Multiselect:le},data(){return{dupEmail:"",sectionOptions:[],jobTitleOptions:[],companyOptions:[],jobClassificationOptions:[],dealershipOptions:[],employmentTypeOptions:[],groupOptions:[],divisionOptions:[],departmentOptions:[],unitOptions:[],applicantId:{},applicantForm:{status:""},form:{firstname:"",middlename:"",lastname:"",employee_id:"",time_keeping_id:"",email:"",date_hired:"",date_resign:"",section_id:"",salary:"",company_id:"",classification_id:"",dealer_id:"",job_grade_id:"",office_id:"",employment_status_id:"",group_id:"",employee_movement:"",division_id:"",department_id:"",unit_id:"",remarks:""},errors:{},state:{isEdit:!1,isSaving:!1,isLoading:!1}}},methods:{async fetchSectionRecords(){try{this.sectionOptions=await ae()}catch(r){console.error("Failed to fetch section data:",r)}},async fetchJobTitleRecords(){try{this.jobTitleOptions=await de()}catch(r){console.error("Failed to fetch job title data:",r)}},async fetchCompanyRecords(){try{this.companyOptions=await ce()}catch(r){console.error("Failed to fetch company data:",r)}},async fetchJobClassificationRecords(){try{this.jobClassificationOptions=await me()}catch(r){console.error("Failed to fetch job classification data:",r)}},async fetchDealershipRecords(){try{this.dealershipOptions=await ue()}catch(r){console.error("Failed to fetch dealership data:",r)}},async fetchEmploymentTypeRecords(){try{this.employmentTypeOptions=await pe()}catch(r){console.error("Failed to fetch employment type data:",r)}},async fetchGroupRecords(){try{this.groupOptions=await fe()}catch(r){console.error("Failed to fetch group data:",r)}},async fetchDivisionRecords(){try{this.divisionOptions=await he()}catch(r){console.error("Failed to fetch division data:",r)}},async fetchDepartmentRecords(){try{this.departmentOptions=await ge()}catch(r){console.error("Failed to fetch department data:",r)}},async fetchUnitRecords(){try{this.unitOptions=await _e()}catch(r){console.error("Failed to fetch unit data:",r)}finally{}},async checkDuplicatedEmail(r){this.state.isLoading=!0;try{console.log("blabla",r),await B.checkDuplicatedEmail({email:r}).then(t=>{this.form.email=r+(t.data!=0?t.data+1:"")+"@autoubgroup.com",this.state.isLoading=!1}).catch(t=>{console.log(t)})}catch(t){console.log(t)}},loadRecord(r,t){var l;this.resetForm(),console.log(t),this.applicantId=t.id,this.form.firstname=t.firstname,this.form.middlename=t.middlename,this.form.lastname=t.lastname,this.form.position_id=t.job.job_title,this.form.company_id=t.job.company_id,this.form.classification_id=t.job.classification,this.checkDuplicatedEmail((((l=t.firstname.trim()[0])==null?void 0:l.toLowerCase())||"")+(t.lastname.toLowerCase()||"")),console.log("email",this.dupEmail),this.form.mobile=t.contact_number},closeModal(){this.state.showModal=!1},resetForm(){this.errors={},this.state.isEdit=!1,this.form={firstname:"",middlename:"",lastname:"",employee_id:"",time_keeping_id:"",email:"",date_hired:Date.now(),date_resign:"",section_id:"",company_id:"",salary:"",classification_id:"",dealer_id:"",job_grade_id:"",office_id:"",employment_status_id:"2",group_id:"",employee_movement:"",division_id:"",department_id:"",unit_id:"",remarks:""}},reload(){this.$emit("reload")},async saveRecord(){this.state.isSaving=!0,await B.create(this.form).then(r=>{console.log("saving...."),console.log(r.status),r.status==201&&(this.applicantForm.status=7,this.updateStatusRecord(this.applicantId,this.applicantForm),this.state.isSaving=!1,this.$swal.fire({title:"Great!",text:"Record successfully saved.",icon:"success",timer:2e3}),this.state.showModal=!1,this.state.isSaving=!1,this.resetForm(),this.reload())}).catch(r=>{this.state.isSaving=!1,this.$swal.fire({title:"Ooops! something is wrong.",text:r.response.data.message,icon:"error",timer:2e3})})},async updateStatusRecord(r,t){await R.updateStatus(r,t).then(l=>{l.status==201?(this.$swal.fire({title:"Great!",text:"Record successfully updated.",icon:"success",timer:2e3}),this.fetchRecords()):this.$swal.fire({title:"Ooops! something is wrong.",text:"Please contact system administrator",icon:"error",timer:2e3})}).catch(l=>{console.log(l)})},async submitForm(){try{await se().shape({firstname:f().required("First Name field is required").min(2),lastname:f().required("Last Name field is required"),company_id:f().required("Company field is required"),employee_id:f().required("Employee ID field is required"),time_keeping_id:f().required("Time Keeping ID field is required"),email:f().required("Email field is required"),salary:f().required("Salary is required"),section_id:f().required("Section is required"),position_id:f().required("Position is required"),dealer_id:f().required("Position is required"),company_id:f().required("Company is required"),classification_id:f().required("Classification is required"),job_grade_id:f().required("Job Grade is required"),employment_status_id:f().required("Employment Status is required"),group_id:f().required("Group is required"),division_id:f().required("Division is required"),department_id:f().required("Department is required"),unit_id:f().required("Unit is required")}).validate(this.form,{abortEarly:!1}),this.$swal.fire({title:"Are you sure you want to save this record?",text:"",icon:"question",showCancelButton:!0,confirmButtonColor:"#34c38f",cancelButtonColor:"#f46a6a",confirmButtonText:"Yes",cancelButtonText:"No"}).then(t=>{t.value&&this.saveRecord()})}catch(r){if(r instanceof ne){const t={};r.inner.forEach(l=>{t[l.path]=l.message}),this.errors=t}this.state.isSaving=!1}}},Validating(r){},mounted(){this.fetchSectionRecords(),this.fetchJobTitleRecords(),this.fetchCompanyRecords(),this.fetchJobClassificationRecords(),this.fetchDealershipRecords(),this.fetchEmploymentTypeRecords(),this.fetchGroupRecords(),this.fetchDivisionRecords(),this.fetchDepartmentRecords(),this.fetchUnitRecords()}},Re={class:"text-slate-600 dark:text-slate-400 text-sm font-normal"},ke={class:"grid grid-cols-3 gap-2 mb-2 capitalize"},Ve={class:"grid grid-cols-3 gap-2 mb-2 capitalize"},qe={class:"grid grid-cols-3 gap-2 mb-2 capitalize",isRequired:!0},Ce={key:0,class:"flex items-center pt-2"},Se={key:0,class:"ml-2 text-[#ec4899]"},De={class:"grid grid-cols-2 gap-2 mb-2 capitalize"},Oe={key:0,class:"flex items-center pt-2"},Fe={key:0,class:"ml-2 text-[#ec4899]"},Be={key:0,class:"flex items-center pt-2"},Ie={key:0,class:"ml-2 text-[#ec4899]"},Me={class:"grid grid-cols-2 gap-2 mb-2 capitalize"},Te={key:0,class:"flex items-center pt-2"},Ue={key:0,class:"ml-2 text-[#ec4899]"},je={key:0,class:"flex items-center pt-2"},Pe={key:0,class:"ml-2 text-[#ec4899]"},Le={class:"grid grid-cols-2 gap-2 mb-2 capitalize"},Ee={class:"grid grid-cols-2 gap-2 mb-2 capitalize"},Ne={key:0,class:"flex items-center pt-2"},ze={key:0,class:"ml-2 text-[#ec4899]"},Ae={key:0,class:"flex items-center pt-2"},Ge={key:0,class:"ml-2 text-[#ec4899]"},Je={class:"grid grid-cols-2 gap-2 mb-2 capitalize"},Ye={key:0,class:"flex items-center pt-2"},Qe={key:0,class:"ml-2 text-[#ec4899]"},We={key:0,class:"flex items-center pt-2"},Ke={key:0,class:"ml-2 text-[#ec4899]"},Ze={class:"grid grid-cols-2 gap-2 mb-2 capitalize"},He={key:0,class:"flex items-center pt-2"},Xe={key:0,class:"ml-2 text-[#ec4899]"},$e={class:"flex gap-1 justify-end"};function et(r,t,l,h,e,g){const x=u("Loading"),_=u("Textinput"),d=u("FormGroup"),V=u("flat-pickr"),y=u("Multiselect"),b=u("Icon"),q=u("SubmitButton"),C=u("CloseButton"),S=u("FormModal");return n(),w(S,{title:"Create Record",active:e.state.showModal,onSubmit:r.confirmSubmit,onClose:g.closeModal,themeClass:"bg-gray-800",sizeClass:"lg:w-3/4"},{default:m(()=>[e.state.isEdit&&e.state.isLoading?(n(),w(x,{key:0,text:"Fetching record"})):a("",!0),e.state.isLoading?(n(),w(x,{key:1,text:"Fetching record"})):a("",!0),e.state.isSaving?(n(),w(x,{key:2,text:"Saving record"})):a("",!0),i("div",Re,[i("form",{onSubmit:t[20]||(t[20]=P((...s)=>r.confirmSubmit&&r.confirmSubmit(...s),["prevent"])),class:"space-y-4"},[i("div",ke,[o(d,{label:"First Name: ",isRequired:!0},{default:m(()=>[o(_,{placeholder:"",type:"text",name:"firstname",error:e.errors.firstname,modelValue:e.form.firstname,"onUpdate:modelValue":t[0]||(t[0]=s=>e.form.firstname=s)},null,8,["error","modelValue"])]),_:1}),o(d,{label:"Middle Name: "},{default:m(()=>[o(_,{placeholder:"",type:"text",name:"middlename",modelValue:e.form.middlename,"onUpdate:modelValue":t[1]||(t[1]=s=>e.form.middlename=s)},null,8,["modelValue"])]),_:1}),o(d,{label:"Last Name: ",isRequired:!0},{default:m(()=>[o(_,{placeholder:"",type:"text",name:"lastname",error:e.errors.lastname,modelValue:e.form.lastname,"onUpdate:modelValue":t[2]||(t[2]=s=>e.form.lastname=s)},null,8,["error","modelValue"])]),_:1})]),i("div",Ve,[o(d,{label:"Employee ID: ",isRequired:!0},{default:m(()=>[o(_,{placeholder:"",type:"text",name:"employee_id",error:e.errors.employee_id,modelValue:e.form.employee_id,"onUpdate:modelValue":t[3]||(t[3]=s=>e.form.employee_id=s)},null,8,["error","modelValue"])]),_:1}),o(d,{label:"Time Keeping ID: ",isRequired:!0},{default:m(()=>[o(_,{placeholder:"",type:"text",name:"time_keeping_id",error:e.errors.time_keeping_id,modelValue:e.form.time_keeping_id,"onUpdate:modelValue":t[4]||(t[4]=s=>e.form.time_keeping_id=s)},null,8,["error","modelValue"])]),_:1}),o(d,{label:"Email: ",isRequired:!0},{default:m(()=>[o(_,{placeholder:"",type:"text",name:"email",error:e.errors.email,modelValue:e.form.email,"onUpdate:modelValue":t[5]||(t[5]=s=>e.form.email=s)},null,8,["error","modelValue"])]),_:1})]),i("div",qe,[o(d,{label:"From: ",isRequired:!0},{default:m(()=>[o(V,{placeholder:"",name:"date_hired",modelValue:e.form.date_hired,"onUpdate:modelValue":t[6]||(t[6]=s=>e.form.date_hired=s),error:e.errors.date_hired,class:"form-control"},null,8,["modelValue","error"])]),_:1}),o(d,{label:"Salary: ",isRequired:!0},{default:m(()=>[o(_,{placeholder:"",type:"text",name:"salary",error:e.errors.salary,modelValue:e.form.salary,"onUpdate:modelValue":t[7]||(t[7]=s=>e.form.salary=s)},null,8,["error","modelValue"])]),_:1}),o(d,{label:"Section: ",isRequired:!0},{default:m(()=>[o(y,{placeholder:"",searchable:!0,type:"text",name:"section_id",modelValue:e.form.section_id,"onUpdate:modelValue":t[8]||(t[8]=s=>e.form.section_id=s),error:e.errors.section_id,options:e.sectionOptions,className:`${e.errors.section_id?"border-[#ec4899] border rounded-md":"border-gray-200 border rounded-md"}`},null,8,["modelValue","error","options","className"]),e.errors.section_id?(n(),c("div",Ce,[t[21]||(t[21]=i("span",{class:"text-[#ec4899] text-sm"},"Section is required",-1)),e.errors.section_id?(n(),c("span",Se,[o(b,{icon:"heroicons-outline:information-circle"})])):a("",!0)])):a("",!0)]),_:1})]),i("div",De,[o(d,{label:"Position:",isRequired:!0},{default:m(()=>[o(y,{placeholder:"",searchable:!0,type:"text",name:"position_id",modelValue:e.form.position_id,"onUpdate:modelValue":t[9]||(t[9]=s=>e.form.position_id=s),error:e.errors.position_id,options:e.jobTitleOptions,className:`${e.errors.position_id?"border-[#ec4899] border rounded-md":"border-gray-200 border rounded-md"}`},null,8,["modelValue","error","options","className"]),e.errors.position_id?(n(),c("div",Oe,[t[22]||(t[22]=i("span",{class:"text-[#ec4899] text-sm"},"Position is required",-1)),e.errors.position_id?(n(),c("span",Fe,[o(b,{icon:"heroicons-outline:information-circle"})])):a("",!0)])):a("",!0)]),_:1}),o(d,{label:"Company: ",isRequired:!0},{default:m(()=>[o(y,{searchable:!0,placeholder:"",type:"text",name:"company_id",modelValue:e.form.company_id,"onUpdate:modelValue":t[10]||(t[10]=s=>e.form.company_id=s),error:e.errors.company_id,options:e.companyOptions,className:`${e.errors.company_id?"border-[#ec4899] border rounded-md":"border-gray-200 border rounded-md"}`},null,8,["modelValue","error","options","className"]),e.errors.company_id?(n(),c("div",Be,[t[23]||(t[23]=i("span",{class:"text-[#ec4899] text-sm"},"Company is required",-1)),e.errors.company_id?(n(),c("span",Ie,[o(b,{icon:"heroicons-outline:information-circle"})])):a("",!0)])):a("",!0)]),_:1})]),i("div",Me,[o(d,{label:"Classification: ",isRequired:!0},{default:m(()=>[o(y,{placeholder:"",type:"text",name:"classification_id",modelValue:e.form.classification_id,"onUpdate:modelValue":t[11]||(t[11]=s=>e.form.classification_id=s),error:e.errors.classification_id,options:e.jobClassificationOptions,className:`${e.errors.classification_id?"border-[#ec4899] border rounded-md":"border-gray-200 border rounded-md"}`},null,8,["modelValue","error","options","className"]),e.errors.classification_id?(n(),c("div",Te,[t[24]||(t[24]=i("span",{class:"text-[#ec4899] text-sm"},"Classification is required",-1)),e.errors.classification_id?(n(),c("span",Ue,[o(b,{icon:"heroicons-outline:information-circle"})])):a("",!0)])):a("",!0)]),_:1}),o(d,{label:"Dealership: ",isRequired:!0},{default:m(()=>[o(y,{searchable:!0,placeholder:"",type:"text",name:"dealer_id",modelValue:e.form.dealer_id,"onUpdate:modelValue":t[12]||(t[12]=s=>e.form.dealer_id=s),error:e.errors.dealer_id,options:e.dealershipOptions,className:`${e.errors.dealer_id?"border-[#ec4899] border rounded-md":"border-gray-200 border rounded-md"}`},null,8,["modelValue","error","options","className"]),e.errors.dealer_id?(n(),c("div",je,[t[25]||(t[25]=i("span",{class:"text-[#ec4899] text-sm"},"Dealership is required",-1)),e.errors.dealer_id?(n(),c("span",Pe,[o(b,{icon:"heroicons-outline:information-circle"})])):a("",!0)])):a("",!0)]),_:1})]),i("div",Le,[o(d,{label:"Job Grade: ",isRequired:!0},{default:m(()=>[o(_,{placeholder:"",type:"text",name:"job_grade_id",error:e.errors.job_grade_id,modelValue:e.form.job_grade_id,"onUpdate:modelValue":t[13]||(t[13]=s=>e.form.job_grade_id=s)},null,8,["error","modelValue"])]),_:1}),o(d,{label:"Office: "},{default:m(()=>[o(_,{placeholder:"",type:"text",name:"office_id",error:e.errors.office_id,modelValue:e.form.office_id,"onUpdate:modelValue":t[14]||(t[14]=s=>e.form.office_id=s)},null,8,["error","modelValue"])]),_:1})]),i("div",Ee,[o(d,{label:"Employment Status: ",isRequired:!0},{default:m(()=>[o(y,{placeholder:"",searchable:"true",type:"text",name:"employment_status_id",modelValue:e.form.employment_status_id,"onUpdate:modelValue":t[15]||(t[15]=s=>e.form.employment_status_id=s),error:e.errors.employment_status_id,options:e.employmentTypeOptions,className:`${e.errors.employment_status_id?"border-[#ec4899] border rounded-md":"border-gray-200 border rounded-md"}`},null,8,["modelValue","error","options","className"]),e.errors.employment_status_id?(n(),c("div",Ne,[t[26]||(t[26]=i("span",{class:"text-[#ec4899] text-sm"},"Employment Status is required",-1)),e.errors.employment_status_id?(n(),c("span",ze,[o(b,{icon:"heroicons-outline:information-circle"})])):a("",!0)])):a("",!0)]),_:1}),o(d,{label:"Group: ",isRequired:!0},{default:m(()=>[o(y,{searchable:!0,placeholder:"",type:"text",name:"group_id",modelValue:e.form.group_id,"onUpdate:modelValue":t[16]||(t[16]=s=>e.form.group_id=s),error:e.errors.group_id,options:e.groupOptions,className:`${e.errors.group_id?"border-[#ec4899] border rounded-md":"border-gray-200 border rounded-md"}`},null,8,["modelValue","error","options","className"]),e.errors.group_id?(n(),c("div",Ae,[t[27]||(t[27]=i("span",{class:"text-[#ec4899] text-sm"},"Group is required",-1)),e.errors.group_id?(n(),c("span",Ge,[o(b,{icon:"heroicons-outline:information-circle"})])):a("",!0)])):a("",!0)]),_:1})]),i("div",Je,[o(d,{label:"Division: ",isRequired:!0},{default:m(()=>[o(y,{searchable:!0,placeholder:"",type:"text",name:"division_id",modelValue:e.form.division_id,"onUpdate:modelValue":t[17]||(t[17]=s=>e.form.division_id=s),error:e.errors.division_id,options:e.divisionOptions,className:`${e.errors.division_id?"border-[#ec4899] border rounded-md":"border-gray-200 border rounded-md"}`},null,8,["modelValue","error","options","className"]),e.errors.division_id?(n(),c("div",Ye,[t[28]||(t[28]=i("span",{class:"text-[#ec4899] text-sm"},"Division is required",-1)),e.errors.division_id?(n(),c("span",Qe,[o(b,{icon:"heroicons-outline:information-circle"})])):a("",!0)])):a("",!0)]),_:1}),o(d,{label:"Department: ",isRequired:!0},{default:m(()=>[o(y,{searchable:!0,placeholder:"",type:"text",name:"department_id",modelValue:e.form.department_id,"onUpdate:modelValue":t[18]||(t[18]=s=>e.form.department_id=s),error:e.errors.department_id,options:e.departmentOptions,className:`${e.errors.department_id?"border-[#ec4899] border rounded-md":"border-gray-200 border rounded-md"}`},null,8,["modelValue","error","options","className"]),e.errors.department_id?(n(),c("div",We,[t[29]||(t[29]=i("span",{class:"text-[#ec4899] text-sm"},"Department is required",-1)),e.errors.department_id?(n(),c("span",Ke,[o(b,{icon:"heroicons-outline:information-circle"})])):a("",!0)])):a("",!0)]),_:1})]),i("div",Ze,[o(d,{label:"Unit: ",isRequired:!0},{default:m(()=>[o(y,{searchable:!0,placeholder:"",type:"text",name:"unit_id",modelValue:e.form.unit_id,"onUpdate:modelValue":t[19]||(t[19]=s=>e.form.unit_id=s),error:e.errors.unit_id,options:e.unitOptions,className:`${e.errors.unit_id?"border-[#ec4899] border rounded-md":"border-gray-200 border rounded-md"}`},null,8,["modelValue","error","options","className"]),e.errors.unit_id?(n(),c("div",He,[t[30]||(t[30]=i("span",{class:"text-[#ec4899] text-sm"},"Unit is required",-1)),e.errors.unit_id?(n(),c("span",Xe,[o(b,{icon:"heroicons-outline:information-circle"})])):a("",!0)])):a("",!0)]),_:1})]),t[31]||(t[31]=i("div",{class:"grid grid-cols-2 gap-2 mb-10 capitalize"},null,-1)),i("div",$e,[o(q,{onClick:g.submitForm},null,8,["onClick"]),o(C,{onClick:g.closeModal},null,8,["onClick"])])],32)])]),_:1},8,["active","onSubmit","onClose"])}const tt=I(we,[["render",et]]);const rt={setup(){},components:{Layout:E,CreateButton:J,Loading:T,InputGroup:Z,EditButton:Q,DeleteButton:Y,ViewButton:K,FileButton:W,Button:G,Form:tt,Pagination:be,Card:ve,Icon:M,MenuItem:N,Dropdown:z},data(){return{image1:A,actions:[{name:"On-board",icon:"heroicons:check-circle",class:"h-[6px] w-[6px] bg-danger-500 rounded-full inline-block ring-4 ring-opacity-30 ring-danger-500",value:4},{name:"Return to Initial Interview",icon:"heroicons:pencil-square",class:"h-[6px] w-[6px] bg-danger-500 rounded-full inline-block ring-4 ring-opacity-30 ring-danger-500",value:1},{name:"Return to Technical Interview",icon:"heroicons:pencil-square",class:"h-[6px] w-[6px] bg-warning-500 rounded-full inline-block ring-4 ring-opacity-30 ring-warning-500",value:2},{name:"Return to Final Interview",icon:"heroicons:pencil-square",class:"h-[6px] w-[6px] bg-primary-500 rounded-full inline-block ring-4 ring-opacity-30 ring-primary-500",value:3},{name:"Archive",icon:"heroicons-outline:trash",value:6}],headerImage:xe,title:"Job Offer",breadcrumbs:[{text:"Home",href:"/"},{text:"Masterfile",href:"/recruitment/job-offer"},{text:"Job Offer",active:!0}],columns:[{label:"#",field:"#"},{label:"First Name",field:"firstname"},{label:"Middle Name",field:"middlename"},{label:"Last Name",field:"lastname"},{label:"Position",field:"job.jobtitle.name"},{label:"Status",field:"status"},{label:"Date Applied",field:"created_at",formatFn:r=>this.formatDate(r)},{label:"Resume/CV",field:"resume"},{label:"Action",field:"action"}],perPageOptions:[{value:"10",label:"10"},{value:"50",label:"50"},{value:"100",label:"100"}],state:{isLoading:!1,isMounted:!1,showModal:!1,isDeleting:!1,isDownloading:!1},items:[],form:{status:""},totalItems:0,error:[],searchQuery:"",serverOptions:{page:1,rowsPerPage:10,sortBy:"firstname",sortType:"asc"}}},watch:{serverOptions:{handler(){console.log(`perPage: ${this.serverOptions.rowsPerPage}`),this.fetchRecords()},deep:!0},searchQuery:ye.debounce(function(){this.fetchRecords()},800)},computed:{perPage:function(){return this.serverOptions.rowsPerPage}},methods:{handleChange(r,t){this.form.status=t,t==4?(this.$refs.form.loadRecord(r.id,r),this.$refs.form.state.showModal=!0,console.log("try")):t==6?this.deleteRecord(r.id):this.updateStatusRecord(r.id,t)},updateStatusRecord(r,t){console.log(t);let l="";t==1?l="Initial Interview":t==2?l="Techincal Interview":t==3&&(l="Final Interview"),this.$swal.fire({title:"Are you sure?",text:"You want to proceed this application for "+l+"?",icon:"warning",showCancelButton:!0,confirmButtonColor:"#34c38f",cancelButtonColor:"#f46a6a",confirmButtonText:"Yes, proceed it!",background:this.$store.themeSettingsStore.isDark?"#1e293b":"#fff"}).then(h=>{h.value&&(this.form.status=t,R.updateStatus(r,this.form).then(e=>{e.status==201?(this.$swal.fire({title:"Great!",text:"Record successfully updated.",icon:"success",timer:2e3}),this.fetchRecords()):(this.$swal.fire({title:"Ooops! something is wrong.",text:"Please contact system administrator",icon:"error",timer:2e3}),this.state.showModal=!1)}).catch(e=>{console.log(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})}).finally(()=>{this.state.isSaving=!1,this.reload()}))}).catch(h=>{h.response&&h.response.status==401&&this.$swal.fire({title:"Ooops! something is wrong.",text:"Error deleting record. Please contact system administrator",type:"error",icon:"error",timer:2e3})}).finally(()=>{this.state.isDeleting=!1})},applicantStatus(r){if(r===1)return"Initial Interview";if(r===2)return"Technical Interview";if(r===3)return"Final Interview";if(r===4)return"Job Offer"},formatDate(r){const t=new Date(r),l=new Date(t.toLocaleString("en-US",{timeZone:"UTC"})),h=new Date(l.toLocaleString("en-US",{timeZone:"Asia/Singapore"})),e=h.getFullYear(),g=String(h.getMonth()+1).padStart(2,"0"),x=String(h.getDate()).padStart(2,"0");return`${e}-${g}-${x}`},async viewAttachment(r){if(this.state.isDownloading)return;this.state.isDownloading=!0;let t=await L.Reader2("applicant",r),l;if(r.endsWith(".pdf"))l="application/pdf";else if(r.endsWith(".png"))l="image/png";else if(r.endsWith(".jpg")||r.endsWith(".jpeg"))l="image/jpeg";else if(r.endsWith(".svg"))l="image/svg+xml";else throw new Error("Unsupported file type");const h=atob(t),e=new Array(h.length);for(let d=0;d<h.length;d++)e[d]=h.charCodeAt(d);const g=new Uint8Array(e),x=new Blob([g],{type:l}),_=URL.createObjectURL(x);window.open(_),this.state.isLoadingPDF=!1},async fetchRecords(){this.state.isLoading=!0,this.state.isMounted=!1,await R.fetchRecords({keyword:this.searchQuery,page:this.serverOptions.page,per_page:this.serverOptions.rowsPerPage,sortBy:this.serverOptions.sortBy,sortType:this.serverOptions.sortType}).then(r=>{let t=r.data.data;this.items=t,this.items=t.filter(l=>l.status==5).map((l,h)=>({...l,"#":(this.serverOptions.page-1)*this.serverOptions.rowsPerPage+(h+1)})),this.totalItems=r.data.total}).finally(()=>{this.state.isLoading=!1,this.state.isMounted=!0})},handlePageChange(r){console.log(r),console.log(this.serverOptions.page),this.serverOptions.page!=r&&(this.serverOptions.page=r)},handlePerPageChange(r){this.serverOptions.page=1,this.serverOptions.rowsPerPage=r},onSortChange(r){console.log(r),r[0].type!="none"&&(this.serverOptions.sortBy=r[0].field,this.serverOptions.sortType=r[0].type)},async deleteRecord(r){this.$swal.fire({title:"Are you sure?",text:"You want to archive this record?",icon:"warning",showCancelButton:!0,confirmButtonColor:"#34c38f",cancelButtonColor:"#f46a6a",confirmButtonText:"Yes, archive it!",background:this.$store.themeSettingsStore.isDark?"#1e293b":"#fff"}).then(t=>{t.value&&(this.state.isDeleting=!0,R.remove(r).then(l=>{console.log(l),l.status==201&&(this.$swal.fire({title:"Yaaay!",text:"Record has been deleted successfully.",type:"success",icon:"success",timer:2e3}),this.fetchRecords())}))}).catch(t=>{t.response&&t.response.status==401&&this.$swal.fire({title:"Ooops! something is wrong.",text:"Error deleting record. Please contact system administrator",type:"error",icon:"error",timer:2e3})}).finally(()=>{this.state.isDeleting=!1})},viewRecord(r){this.$refs.form.resetForm(),this.$refs.form.loadRecord(r),this.$refs.form.state.showModal=!0},async submitForm(){if(console.log("Submit Form"),this.state.isLoading=!0,this.state.isSubmitted=!0,!this.v$.$invalid)try{this.state.isEdit==!0?(await R.update(this.categoryData.category_code,this.categoryData),Swal.fire("Success!","Data successfully updated.","success")):(await R.create(this.categoryData),Swal.fire("Success!","Data succesfully created.","success")),this.state.showModal=!1,this.state.isLoading=!1,this.resetData(),this.fetchRecords()}catch(r){this.error=r||"",this.state.isResetError=!0,this.state.isLoading=!1}},closeModal(){this.state.showModal=!1,this.resetData(),this.fetchRecords()},resetData(){this.state={isLoading:!1,isMounted:!1,isResetError:!1,isSubmitted:!1,showModal:!1},this.categoryData={category_code:"",category_desc:""},this.error=[]}},mounted(){this.fetchRecords()}},ot={class:"my-5"},it={class:"md:flex pb-6 items-center"},st={class:"flex-1 md:mb-0 mb-3"},nt={class:"md:flex md:space-x-3 items-center flex-none rtl:space-x-reverse my-3 float-right"},lt={class:"min-w-full divide-y divide-zinc-200 dark:divide-zinc-700"},at={class:"bg-white divide-y divide-zinc-200 dark:bg-zinc-900 dark:divide-zinc-700"},dt={class:"p-2"},ct={class:"flex items-center top-2"},mt={key:0,class:"h-[6px] w-[6px] bg-danger-500 rounded-full inline-block ring-4 ring-opacity-30 ring-danger-500"},ut={key:1,class:"h-[6px] w-[6px] bg-warning-500 rounded-full inline-block ring-4 ring-opacity-30 ring-warning-500"},pt={key:2,class:"h-[6px] w-[6px] bg-primary-500 rounded-full inline-block ring-4 ring-opacity-30 ring-primary-500"},ft={key:3,class:"h-[6px] w-[6px] bg-success-500 rounded-full inline-block ring-4 ring-opacity-30 ring-success-500"},ht={class:"p-2"},gt={class:"text-xl"};function _t(r,t,l,h,e,g){const x=u("InputGroup"),_=u("Button"),d=u("FileButton"),V=u("Icon"),y=u("MenuItem"),b=u("Dropdown"),q=u("Card"),C=u("Loading"),S=u("Form"),s=u("Layout");return n(),w(s,{breadcrumbs:e.breadcrumbs},{default:m(()=>[i("div",ot,[o(q,{noborder:""},{default:m(()=>[i("div",it,[i("h6",st,v(e.title),1),i("div",nt,[o(x,{modelValue:e.searchQuery,"onUpdate:modelValue":t[0]||(t[0]=p=>e.searchQuery=p),placeholder:"Search",type:"text",prependIcon:"heroicons-outline:search",merged:""},null,8,["modelValue"]),o(_,{icon:"heroicons-outline:filter",text:"Filter",btnClass:" btn-outline-secondary text-slate-600 dark:border-slate-700 dark:text-slate-300 font-normal btn-sm ",iconClass:"text-lg"})])]),i("table",lt,[t[2]||(t[2]=i("thead",{class:"bg-zinc-50 dark:bg-zinc-800"},[i("tr",{class:"bg-gray-100"},[i("th",{class:"px-6 py-3 text-left text-xs font-medium text-zinc-500 uppercase tracking-wider"},"#"),i("th",{class:"px-6 py-3 text-left text-xs font-medium text-zinc-500 uppercase tracking-wider"},"Name"),i("th",{class:"px-6 py-3 text-left text-xs font-medium text-zinc-500 uppercase tracking-wider"},"Position"),i("th",{class:"px-6 py-3 text-left text-xs font-medium text-zinc-500 uppercase tracking-wider"},"Status"),i("th",{class:"px-6 py-3 text-left text-xs font-medium text-zinc-500 uppercase tracking-wider"},"Job Offer Date"),i("th",{class:"px-6 py-3 text-left text-xs font-medium text-zinc-500 uppercase tracking-wider"},"Resume/CV"),i("th",{class:"px-6 py-3 text-left text-xs font-medium text-zinc-500 uppercase tracking-wider"},"Actions")])],-1)),i("tbody",at,[(n(!0),c(O,null,D(e.items,(p,U)=>(n(),c("tr",{key:p.id},[i("td",dt,v(U+1),1),i("td",null,v(p.firstname)+" "+v(p.lastname),1),i("td",null,v(p.job?p.job.jobtitle?p.job.jobtitle.name:"Job Title Not Available":"Item Not Available"),1),i("td",ct,[p.status==1||p.status==0?(n(),c("span",mt)):a("",!0),p.status==2?(n(),c("span",ut)):a("",!0),p.status==3?(n(),c("span",pt)):a("",!0),p.status==4?(n(),c("span",ft)):a("",!0),i("span",ht,v(g.applicantStatus(p.status)),1)]),i("td",null,v(g.formatDate(p.offered_date)),1),i("td",null,[o(d,{title:"Download Attachment",onClick:k=>g.viewAttachment(p.resume)},null,8,["onClick"])]),i("td",null,[o(b,{classMenuItems:"w-[140px] z-0"},{menus:m(()=>[(n(!0),c(O,null,D(e.actions,(k,j)=>(n(),w(y,{key:j,onClick:yt=>g.handleChange(p,k.value)},{default:m(()=>[i("div",{class:F([k.name==="delete"?"bg-red-500 text-red-500 bg-opacity-30 hover:bg-opacity-100 hover:text-white":"hover:bg-gray-800 hover:text-white","w-full border-b border-gray-500 border-opacity-10 px-4 py-2 text-sm flex items-center space-x-2"])},[i("span",{class:F(k.class)},null,2),i("span",null,v(k.name),1)],2)]),_:2},1032,["onClick"]))),128))]),default:m(()=>[i("span",gt,[o(V,{icon:"heroicons-outline:dots-vertical"})])]),_:2},1024)])]))),128))])])]),_:1}),e.state.isLoading?(n(),w(C,{key:0,text:"Fetching records"})):a("",!0),o(S,{onCloseModal:t[1]||(t[1]=p=>e.state.showModal=!1),ref:"form",onReload:g.fetchRecords},null,8,["onReload"])])]),_:1},8,["breadcrumbs"])}const br=I(rt,[["render",_t],["__scopeId","data-v-b0d340b4"]]);export{br as default};
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0.06 |
proxy
|
phpinfo
|
Settings