File manager - Edit - /home/autoph/public_html/projects/ahg-hr/assets/index.9c3bac7c.js
Back
import{L as B}from"./index.b7d49458.js";import{C as N}from"./index.5cb8fa8c.js";import{L as R}from"./Loading.311fadfe.js";import{V as S}from"./VueSelect.1a1a80f3.js";import{B as D}from"./index.bdcc6190.js";import{I as G}from"./index.c6b20525.js";import{T as U}from"./index.9a705aa9.js";import{F as z}from"./index.a76a1867.js";import{_ as A,c as y,w as a,r as d,o as m,d as s,e as r,b as u,m as O,h as L,t as c,f as b,j as x,F as W,k as P}from"./index.15cec131.js";/* empty css */import{T as H}from"./index.d6cd085f.js";import{c as K,a as v,f as Y,V as J}from"./array.8551fbb7.js";import{E as h}from"./EmployeeService.402d7e1b.js";import{m as Q,p as X,x as Z,y as $,I as ee}from"./tabs.3c655538.js";import"./logo-black.7c15feb3.js";import"./logo-white.b04c5a89.js";import"./transition.2b35576b.js";import"./vue-cleave.min.64bb37b7.js";import"./es.string.replace.7f4d713f.js";import"./Loading.vue_vue_type_style_index_0_scoped_cbded5a2_lang.c1f77430.js";const se="/assets/user-2.2006f1b4.jpg";const te={setup(){},components:{Loading:R,Layout:B,Card:N,TabGroup:Q,TabList:X,Tab:Z,TabPanel:$,TabPanels:ee,user1:se,TextInput:H,VueSelect:S,Button:D,Icon:G,FormGroup:z,Textarea:U},data(){return{currentPassword:"",newPassword:"",confirmPassword:"",isPasswordLoading:!1,isPasswordMatched:!1,errors:{},activeParentTab:"profile",profile_image:"",form:{id:this.$route.params.id??null,fullname:"",email:"",mobile:"",position:"",company:"",dealership:"",department:null,attachment:""},basicInformationItems:null,salaryAndWagesItems:null,employeeRecord:[],breadcrumbs:[{text:"Home",href:"/"},{text:"Employee",active:!0}],buttons:[{title:"Profile",key:"profile"},{title:"Change Password",key:"changePassword"}],state:{isLoading:!1,isMounted:!1,showModal:!1,isDeleting:!1}}},computed:{},methods:{async submitForm(){const o=K().shape({currentPassword:v().required("Current Password is Required"),newPassword:v().required("New Password is Required").min(8,"New Password must be at least 8 characters long"),confirmPassword:v().oneOf([Y("newPassword"),null],"Passwords must match").required("Confirm Password is Required")});try{await o.validate({currentPassword:this.currentPassword,newPassword:this.newPassword,confirmPassword:this.confirmPassword},{abortEarly:!1}),this.$swal.fire({title:"Are you sure you want to change your password?",text:"",icon:"question",showCancelButton:!0,confirmButtonColor:"#34c38f",cancelButtonColor:"#f46a6a",confirmButtonText:"Yes",cancelButtonText:"No"}).then(e=>{e.value&&this.saveRecord()})}catch(e){if(e instanceof J){const n={};e.inner.forEach(l=>{n[l.path]=l.message}),console.log(n),this.errors=n}}},async saveRecord(){this.state.isSaving=!0;let e={employee_id:this.$store.userSettings.getActiveUser.employees.employee_id,currentPassword:this.currentPassword,newPassword:this.newPassword,confirmPassword:this.confirmPassword};await h.updatePassword(e).then(n=>{n.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.state.showModal=!1)}).catch(n=>{console.log(n),n.response.status==422?this.$swal.fire({title:"Ooops! something is wrong.",text:n.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()})},async passwordChecker(){this.isPasswordLoading=!0;try{const o=await h.passwordChecker({password:this.currentPassword});this.isPasswordLoading=!1,this.isPasswordMatched=o.data.status}catch(o){console.error("Error fetching employee schedule:",o),this.isPasswordLoading=!1,this.state.isEmployeeScheduleLoading=!1}},handleChangePassword(){this.errors={},this.currentPassword||(this.errors.currentPassword="Current password is required."),this.newPassword?this.newPassword.length<8&&(this.errors.newPassword="New password must be at least 8 characters."):this.errors.newPassword="New password is required.",this.confirmPassword?this.newPassword!==this.confirmPassword&&(this.errors.confirmPassword="Passwords do not match."):this.errors.confirmPassword="Please confirm your new password."},triggerFileInput(){this.$refs.fileInput.click()},async handleMainImageUpload(){const o=event.target.files[0];this.form.attachment=o;const e=new FileReader;e.onload=l=>{this.profile_image=l.target.result,o.type.startsWith("image/")?this.profile_image=e.result:o.type==="application/pdf"?this.form.imageView=this.pdf_file_view:o.type==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"&&(this.form.imageView=this.excel_file_view)},e.readAsDataURL(o);let n=new FormData;Object.keys(this.form).forEach(l=>{n.append(l,this.form[l])}),await h.uploadProfilePicture(n).then(l=>{l.status==201&&(this.$swal.fire({title:"Great!",text:"Record successfully saved.",icon:"success",timer:2e3}),this.reload())}).catch(l=>{console.log(l)})},async fetchEmployeeData(){this.state.isLoading=!0;try{const o=await h.fetchRecord(this.$store.userSettings.getActiveUser.employees.employee_id);o.status===200&&(this.form=o.data,this.basicInformationItems=o.data,this.state.isLoading=!1)}catch{this.state.isLoading=!1}},closeModal(){this.state.showModal=!1}},mounted(){this.fetchEmployeeData()}},oe={class:"my-5"},re={class:"min-h-[500px]"},ie={class:"grid grid-cols-12 md:gap-1"},ae={class:"lg:col-span-3 md:col-span-5 col-span-12"},ne={key:0},le=["onClick"],de={key:1},me={class:"lg:col-span-9 md:col-span-7 col-span-12"},ce={class:"relative"},pe={class:"text-slate-600 dark:text-slate-400 text-sm font-normal shadow-md p-10 border-dotted border-[0] border-l border-slate-400 px-5"},ue={class:"flex justify-center items-center pt-20 text-xl"},fe={class:"flex justify-center items-center text-indigo-400 pt-4 mb-8"},he={class:"flex justify-center items-center"},we={class:"w-3/4 flex justify-between items-center pt-4"},_e={class:"flex items-end"},ge={class:"flex justify-center items-center"},ye={class:"w-3/4 flex justify-between items-center pt-4"},be={class:"flex items-start"},xe={class:"capitalize"},Pe={class:"flex items-end"},ve={class:"flex justify-center items-center"},Ce={class:"w-3/4 flex justify-between items-center pt-4"},ke={class:"flex items-start"},Te={class:"flex items-end"},Le={class:"absolute top-[40px] left-1/2 transform -translate-x-1/2"},Ie=["src"],Ve=["src"],Ee={class:"relative"},Fe={class:"mb-4"},je={class:"flex gap-2 mt-2"},qe={key:0,class:"text-sm text-green-600 flex items-center gap-2"},Me={key:1,class:"text-sm text-red-600 flex items-center gap-2"},Be={class:"flex justify-end"};function Ne(o,e,n,l,t,p){const f=d("Icon"),I=d("Tab"),V=d("TabList"),E=d("router-link"),w=d("Card"),C=d("TabPanel"),k=d("TabPanels"),_=d("TextInput"),g=d("FormGroup"),F=d("TabGroup"),j=d("Loading"),q=d("Layout");return m(),y(q,{breadcrumbs:t.breadcrumbs},{default:a(()=>[s("div",oe,[r(w,{title:""},{default:a(()=>[r(F,null,{default:a(()=>[s("div",re,[s("div",ie,[s("div",ae,[r(V,null,{default:a(()=>[(m(!0),u(W,null,O(t.buttons,(i,M)=>(m(),y(I,{class:"grid grid-cols-1 border-0 outline-0 ring-0 focus:ring-0",key:M},{default:a(({selected:T})=>[i.key?(m(),u("div",ne,[s("button",{onClick:Re=>t.activeParentTab=i.key,class:L([[T?"text-white bg-primary-500 ":"text-slate-500 bg-white dark:bg-slate-700 dark:text-slate-300"],"text-sm font-medium md:block inline-block mb-4 last:mb-0 capitalize px-6 rounded-md py-2 transition duration-150"])},c(i.title),11,le)])):i.parentKey==t.activeParentTab?(m(),u("div",de,[s("button",{class:L([[T?"text-white bg-primary-500 ":"text-slate-500 bg-white dark:bg-slate-700 dark:text-slate-300"],"text-sm font-medium mb-4 last:mb-0 capitalize px-6 rounded-md py-2 transition duration-150 headless-focus flex items-center gap-2"])},[r(f,{icon:"system-uicons:chevron-right-double",class:"text-lg"}),b(c(i.title),1)],2)])):x("",!0)]),_:2},1024))),128))]),_:1})]),s("div",me,[r(k,null,{default:a(()=>[r(C,null,{default:a(()=>[r(w,{bodyClass:"p-0"},{default:a(()=>[s("div",ce,[e[15]||(e[15]=s("div",{class:"bg-gray-900 text-white flex justify-center items-center rounded-t-lg p-2 mb-4 h-[120px] relative z-1"},null,-1)),s("div",pe,[s("form",{onSubmit:e[0]||(e[0]=P((...i)=>o.onSubmit&&o.onSubmit(...i),["prevent"]))},[s("div",ue,c(t.form.firstname)+" "+c(t.form.lastname),1),s("div",fe,c(t.form.email),1),s("div",he,[s("div",we,[e[9]||(e[9]=s("div",{class:"font-bold pr-2"}," Location: ",-1)),e[10]||(e[10]=s("div",null,null,-1)),s("div",_e,[e[8]||(e[8]=s("div",{class:"font-bold pr-2"}," Contact #: ",-1)),s("div",null,c(t.form.mobile),1)])])]),s("div",ge,[s("div",ye,[s("div",be,[e[11]||(e[11]=s("div",{class:"font-bold pr-2 capitalize"}," Position: ",-1)),s("div",xe,c(t.form.position==null?"":t.form.position.name),1)]),s("div",Pe,[e[12]||(e[12]=s("div",{class:"font-bold pr-2"}," Company: ",-1)),s("div",null,c(t.form.company==null?"":t.form.company.name),1)])])]),s("div",ve,[s("div",Ce,[s("div",ke,[e[13]||(e[13]=s("div",{class:"font-bold pr-2"}," Dealership: ",-1)),s("div",null,c(t.form.dealership==null?"":t.form.dealership.name),1)]),s("div",Te,[e[14]||(e[14]=s("div",{class:"font-bold pr-2"}," Department: ",-1)),s("div",null,c(t.form.department==null?"":t.form.department.name),1)])])])],32)]),s("div",Le,[(t.profile_image==""?t.profile_image:t.form.employee_profile?t.form.employee_profile.attachment:t.profile_image)?(m(),u("img",{key:0,src:t.profile_image,alt:"",class:"rounded-full w-40 h-40 border border-gray-600 p-2 transition-all duration-1000 ease-in-out hover:p-1"},null,8,Ie)):(m(),u("img",{key:1,src:t.form.employee_profile?t.form.employee_profile.attachment:t.profile_image,alt:"",class:"rounded-full w-40 h-40 border border-gray-600 p-2 transition-all duration-1000 ease-in-out hover:p-1"},null,8,Ve)),s("input",{type:"file",ref:"fileInput",accept:"image/*",style:{display:"none"},onChange:e[1]||(e[1]=i=>p.handleMainImageUpload())},null,544),r(E,{to:"#",class:"absolute right-2 h-8 w-8 bg-slate-50 text-slate-600 rounded-full shadow-sm flex flex-col items-center justify-center md:top-[120px] top-[120px]",onClick:P(p.triggerFileInput,["prevent"])},{default:a(()=>[r(f,{icon:"heroicons:pencil-square"})]),_:1},8,["onClick"])])])]),_:1})]),_:1})]),_:1}),r(k,null,{default:a(()=>[r(C,null,{default:a(()=>[r(w,{bodyClass:"p-4"},{default:a(()=>[s("div",Ee,[s("form",{onSubmit:e[7]||(e[7]=P((...i)=>p.handleChangePassword&&p.handleChangePassword(...i),["prevent"]))},[s("div",Fe,[r(g,{label:"Current Password"},{default:a(()=>[r(_,{type:"password",modelValue:t.currentPassword,"onUpdate:modelValue":e[2]||(e[2]=i=>t.currentPassword=i),error:t.errors.currentPassword,placeholder:"Enter current password",classInput:"h-[48px] w-full",hasicon:"",onChange:e[3]||(e[3]=i=>p.passwordChecker()),required:""},null,8,["modelValue","error"]),s("div",je,[t.isPasswordLoading?(m(),u("div",qe,[r(f,{icon:"svg-spinners:tadpole"}),e[16]||(e[16]=b(" Validating password... "))])):!t.isPasswordMatched&&t.currentPassword.length>7?(m(),u("div",Me,[r(f,{icon:"heroicons:exclamation-circle"}),e[17]||(e[17]=b(" Password does not match "))])):x("",!0)])]),_:1}),r(g,{label:"New Password"},{default:a(()=>[r(_,{type:"password",modelValue:t.newPassword,"onUpdate:modelValue":e[4]||(e[4]=i=>t.newPassword=i),error:t.errors.newPassword,placeholder:"Enter new password",classInput:"h-[48px] w-full",hasicon:"",required:""},null,8,["modelValue","error"])]),_:1}),r(g,{label:"Confirm New Password"},{default:a(()=>[r(_,{type:"password",modelValue:t.confirmPassword,"onUpdate:modelValue":e[5]||(e[5]=i=>t.confirmPassword=i),error:t.errors.confirmPassword,placeholder:"Confirm new password",classInput:"h-[48px] w-full",hasicon:"",required:""},null,8,["modelValue","error"])]),_:1}),s("div",Be,[s("button",{onClick:e[6]||(e[6]=(...i)=>p.submitForm&&p.submitForm(...i)),type:"submit",class:"inline-flex items-center px-4 py-2 text-sm font-medium rounded-md shadow-sm text-white bg-primary-600 hover:bg-primary-700"}," Change Password ")])])],32)])]),_:1})]),_:1})]),_:1})])])])]),_:1})]),_:1}),t.state.isLoading?(m(),y(j,{key:0,text:"Fetching records"})):x("",!0)])]),_:1},8,["breadcrumbs"])}const rs=A(te,[["render",Ne],["__scopeId","data-v-4ac2be07"]]);export{rs as default};
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings