File manager - Edit - /home/autoph/public_html/projects/ahg-hr/assets/index.a1d30e18.js
Back
import{_ as R,r,o as d,c as h,w as m,j as u,d as o,k as I,e as i,b as _,p as S,s as O,t as y,h as L}from"./index.e8902503.js";import{P as f}from"./PayrollItemsService.18fe77f4.js";import{w as E,L as V}from"./index.3c190fb8.js";import{B as T}from"./index.edca6480.js";import{C as A}from"./CreateButton.69c40d9f.js";import{D as q}from"./DeleteButton.85a5f71a.js";import{E as U}from"./EditButton.3881a749.js";/* empty css */import{I as N}from"./index.48097a46.js";import"./jspdf.es.min.e8517b60.js";/* empty css *//* empty css */import"./vue-cleave.min.795cb0c2.js";import{c as G,a as M,V as Y}from"./array.29c46f9b.js";import{L as D}from"./Loading.587e211a.js";import"./vue-quill.snow.2184ee49.js";/* empty css */import{I as Q}from"./index.1fa545a8.js";import{F as z}from"./index.b0868b90.js";import{F as j}from"./index.fbdde90a.js";import{T as H}from"./index.2b071307.js";import{T as J}from"./index.c1433bbe.js";import{C as K}from"./CloseButton.7e0edf88.js";import{S as W}from"./SubmitButton.8f4c4681.js";import{U as X}from"./UpdateButton.af135175.js";import{M as Z}from"./Multiselect.b44a8b2e.js";import{l as $}from"./lodash.946ada64.js";import{P as ee}from"./index.09aa51ae.js";import{h as te}from"./meeting-office.7e6e2274.js";import{C as se}from"./index.fb3a5789.js";import"./logo-black.7c15feb3.js";import"./logo-white.b04c5a89.js";import"./transition.e3cedc97.js";import"./EmployeeService.0b822608.js";import"./es.string.replace.b08ed996.js";import"./Loading.vue_vue_type_style_index_0_scoped_cbded5a2_lang.4f499d44.js";import"./index.a4f02fc5.js";import"./index.bd314dbf.js";const oe={components:{FormModal:j,FormGroup:z,TextInput:J,TextArea:H,SubmitButton:W,UpdateButton:X,CloseButton:K,Loading:D,Multiselect:Z},data(){return{benefitSubcategoriesOptions:[],addLessOptions:[{value:1,label:"Addition"},{value:2,label:"Deduction"}],form:{add_less:"",taxable:!1,thirteenth_month:!1,code:"",name:"",description:""},errors:{},state:{isEdit:!1,isSaving:!1,isLoading:!1}}},methods:{loadRecord(t){this.resetForm(),this.state.isEdit=!0,this.form=t,this.form.taxable=t.taxable==1,this.form.thirteenth_month=t.thirteenth_month==1},closeModal(){this.state.showModal=!1},resetForm(){this.state.isEdit=!1,this.form={add_less:"",taxable:!1,thirteenth_month:!1,code:"",name:"",description:""}},reload(){this.$emit("reload")},reload(){return this.$emit("reload")},async saveRecord(){if(this.state.isSaving=!0,!this.state.isEdit)this.state.isSaving=!1,await f.create(this.form).then(t=>{t.status==201&&(this.$swal.fire({title:"Great!",text:"Record successfully saved.",icon:"success",timer:2e3}),this.state.showModal=!1,this.resetForm(),this.reload())}).catch(t=>{console.log(t),t.response.status==422?this.$swal.fire({title:"Ooops! something is wrong.",text:t.response.data.message,icon:"warning"}):this.$swal.fire({title:"Ooops! something is wrong.",text:"Please contact system administrator",icon:"error",timer:2e3})});else{const t=this.form.id;await f.update(t,this.form).then(e=>{e.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(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()})}},async submitForm(){try{await G().shape({code:M().required("Code field is required"),name:M().required("Name field is required"),add_less:M().required("Add / Deduction field 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(e=>{e.value&&this.saveRecord()})}catch(t){if(t instanceof Y){const e={};t.inner.forEach(c=>{e[c.path]=c.message}),this.errors=e}this.state.isSaving=!1}}},mounted(){}},re={class:"text-slate-600 dark:text-slate-400 text-sm font-normal"},ie={class:"relative"},ae={key:0,class:"text-[#ec4899]"},le={class:"grid grid-cols-2 gap-2 mb-6"},ne={class:"flex items-center gap-4"},de={class:"flex items-center cursor-pointer"},ce=["checked"],me={class:"flex items-center gap-4"},ue={class:"flex items-center cursor-pointer"},he=["checked"],pe={class:"flex gap-1 justify-end"};function fe(t,e,c,w,s,n){const b=r("Loading"),g=r("TextInput"),p=r("FormGroup"),x=r("Multiselect"),v=r("TextArea"),C=r("SubmitButton"),k=r("UpdateButton"),P=r("CloseButton"),B=r("FormModal");return d(),h(B,{title:s.state.isEdit?"Edit Payroll Item Record":"Create Payroll Item Record",active:s.state.showModal,onSubmit:t.confirmSubmit,onClose:n.closeModal,themeClass:s.state.isEdit?"bg-primary-600":"bg-gray-800",sizeClass:"lg:w-2/4"},{default:m(()=>[s.state.isEdit&&s.state.isLoading?(d(),h(b,{key:0,text:"Fetching record"})):u("",!0),s.state.isSaving?(d(),h(b,{key:1,text:"Saving record"})):u("",!0),o("div",re,[o("form",{onSubmit:e[6]||(e[6]=I((...l)=>t.confirmSubmit&&t.confirmSubmit(...l),["prevent"])),class:"space-y-4"},[i(p,{label:"Code",isRequired:!0},{default:m(()=>[i(g,{type:"text",placeholder:"Input code",modelValue:s.form.code,"onUpdate:modelValue":e[0]||(e[0]=l=>s.form.code=l),error:s.errors.code,classInput:"h-[48px]"},null,8,["modelValue","error"])]),_:1}),i(p,{label:"Name",isRequired:!0},{default:m(()=>[i(g,{type:"text",placeholder:"Input name ",modelValue:s.form.name,"onUpdate:modelValue":e[1]||(e[1]=l=>s.form.name=l),error:s.errors.name,classInput:"h-[48px]"},null,8,["modelValue","error"])]),_:1}),i(p,{label:"Addition / Deduction",isRequired:!0},{default:m(()=>[o("div",ie,[i(x,{modelValue:s.form.add_less,"onUpdate:modelValue":e[2]||(e[2]=l=>s.form.add_less=l),"close-on-select":!0,searchable:!0,id:"add_less",options:s.addLessOptions},null,8,["modelValue","options"]),s.errors.add_less?(d(),_("div",ae,"Addition / Deduction is required")):u("",!0)])]),_:1}),i(p,{label:"Description"},{default:m(()=>[i(v,{type:"text",placeholder:"Input description ",modelValue:s.form.description,"onUpdate:modelValue":e[3]||(e[3]=l=>s.form.description=l),classInput:"h-[48px]"},null,8,["modelValue"])]),_:1}),o("div",le,[o("div",ne,[o("label",de,[S(o("input",{type:"checkbox",class:"peer h-6 w-6 cursor-pointer rounded-full bg-slate-100 border border-slate-300 checked:bg-blue-500 checked:border-blue-500",checked:s.form.taxable,"onUpdate:modelValue":e[4]||(e[4]=l=>s.form.taxable=l)},null,8,ce),[[O,s.form.taxable]]),e[7]||(e[7]=o("span",{class:"absolute text-white opacity-0 peer-checked:opacity-100"},[o("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",stroke:"currentColor","stroke-width":"1"},[o("path",{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"})])],-1)),e[8]||(e[8]=o("span",{class:"ml-2 text-slate-500 dark:text-slate-400 text-sm"},"Taxable",-1))])]),o("div",me,[o("label",ue,[S(o("input",{type:"checkbox",class:"peer h-6 w-6 cursor-pointer rounded-full bg-slate-100 border border-slate-300 checked:bg-blue-500 checked:border-blue-500",checked:s.form.thirteenth_month,"onUpdate:modelValue":e[5]||(e[5]=l=>s.form.thirteenth_month=l)},null,8,he),[[O,s.form.thirteenth_month]]),e[9]||(e[9]=o("span",{class:"absolute text-white opacity-0 peer-checked:opacity-100"},[o("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",stroke:"currentColor","stroke-width":"1"},[o("path",{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"})])],-1)),e[10]||(e[10]=o("span",{class:"ml-2 text-slate-500 dark:text-slate-400 text-sm"},"13th Month",-1))])])]),o("div",pe,[s.state.isEdit?(d(),h(k,{key:1,onClick:n.submitForm},null,8,["onClick"])):(d(),h(C,{key:0,onClick:n.submitForm},null,8,["onClick"])),i(P,{onClick:n.closeModal},null,8,["onClick"])])],32)])]),_:1},8,["title","active","onSubmit","onClose","themeClass"])}const ge=R(oe,[["render",fe]]);const _e={mixins:[E],setup(){},components:{Layout:V,CreateButton:A,Loading:D,InputGroup:Q,EditButton:U,DeleteButton:q,Button:T,Form:ge,Pagination:ee,Card:se,Icon:N},data(){return{headerImage:te,title:"Payroll Items",breadcrumbs:[{text:"Home",href:"/"},{text:"Payroll",href:"/payroll/payroll-items"},{text:"Payroll Items",active:!0}],columns:[{label:"#",field:"#"},{label:"Code",field:"code"},{label:"Name",field:"name"},{label:"taxable",field:"taxable"},{label:"13th Month",field:"thirteenth_month"},{label:"Add / Deduction",field:"add_less"},{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},items:[],totalItems:0,error:[],searchQuery:"",serverOptions:{page:1,rowsPerPage:10,sortBy:"name",sortType:"asc",sortBy:"code",sortType:"asc"}}},watch:{serverOptions:{handler(){console.log(`perPage: ${this.serverOptions.rowsPerPage}`),this.fetchRecords()},deep:!0},searchQuery:$.debounce(function(){this.fetchRecords()},800)},computed:{perPage:function(){return this.serverOptions.rowsPerPage}},methods:{async fetchRecords(){this.state.isLoading=!0,this.state.isMounted=!1,await f.fetchRecords({keyword:this.searchQuery,page:this.serverOptions.page,per_page:this.serverOptions.rowsPerPage,sortBy:this.serverOptions.sortBy,sortType:this.serverOptions.sortType}).then(t=>{console.log(t);let e=t.data.data;this.items=e,this.items=e.map((c,w)=>({...c,"#":(this.serverOptions.page-1)*this.serverOptions.rowsPerPage+(w+1)})),this.totalItems=t.data.total}).finally(()=>{this.state.isLoading=!1,this.state.isMounted=!0})},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)},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,f.remove(t).then(c=>{console.log(c),c.status==201&&(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.state.isDeleting=!1})},createRecord(){this.$refs.form.resetForm(),this.$refs.form.state.showModal=!0},editRecord(t){this.$refs.form.resetForm(),this.$refs.form.loadRecord(t),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 f.update(this.categoryData.category_code,this.categoryData),Swal.fire("Success!","Data successfully updated.","success")):(await f.create(this.categoryData),Swal.fire("Success!","Data succesfully created.","success")),this.state.showModal=!1,this.state.isLoading=!1,this.resetData(),this.fetchRecords()}catch(t){this.error=t||"",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()}},be={class:"my-5"},ye={class:"md:flex pb-6 items-center"},we={class:"flex-1 md:mb-0 mb-3"},xe={key:0,class:"flex gap-1"},ve={key:1,class:"flex gap-1"},Ce={key:2,class:"flex gap-1"},ke={key:3,class:"flex gap-1"},Pe={class:"py-4 flex justify-end"};function Be(t,e,c,w,s,n){const b=r("InputGroup"),g=r("Button"),p=r("EditButton"),x=r("DeleteButton"),v=r("Pagination"),C=r("vue-good-table"),k=r("Card"),P=r("Loading"),B=r("Form"),l=r("Layout");return d(),h(l,{breadcrumbs:s.breadcrumbs},{default:m(()=>[o("div",be,[i(k,{noborder:""},{default:m(()=>[o("div",ye,[o("h6",we,y(s.title),1),o("div",{class:L(["md:flex md:space-x-3 items-center flex-none rtl:space-x-reverse my-3 float-right",t.window.width<768?"space-x-rb":""])},[i(b,{modelValue:s.searchQuery,"onUpdate:modelValue":e[0]||(e[0]=a=>s.searchQuery=a),placeholder:"Search",type:"text",prependIcon:"heroicons-outline:search",merged:""},null,8,["modelValue"]),i(g,{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(g,{icon:"heroicons-outline:plus-sm",text:"Add Record",btnClass:" btn-dark font-normal btn-sm ",iconClass:"text-lg",onClick:e[1]||(e[1]=a=>n.createRecord())})],2)]),i(C,{styleClass:"vgt-table lesspadding v-middle",columns:s.columns,rows:s.items,mode:"remote",search:!0,"sort-options":{enabled:!0},"pagination-options":{enabled:!0},onSortChange:n.onSortChange,"max-height":"600px"},{"table-row":m(a=>[a.column.field=="taxable"?(d(),_("div",xe,y(a.row.taxable?"Yes":"No"),1)):u("",!0),a.column.field=="thirteenth_month"?(d(),_("div",ve,y(a.row.thirteenth_month?"Yes":"No"),1)):u("",!0),a.column.field=="add_less"?(d(),_("div",Ce,y(a.row.add_less==1||a.row.add_less==""||a.row.add_less==null?"Addition":"Deduction"),1)):u("",!0),a.column.field=="action"?(d(),_("div",ke,[i(p,{onClick:F=>n.editRecord(a.row)},null,8,["onClick"]),i(x,{onClick:F=>n.deleteRecord(a.row.id)},null,8,["onClick"])])):u("",!0)]),"pagination-bottom":m(a=>[o("div",Pe,[i(v,{total:s.totalItems,current:s.serverOptions.page,"per-page":s.serverOptions.rowsPerPage,onPageChanged:n.handlePageChange,pageChanged:a.pageChanged,perPageChanged:s.serverOptions.rowsPerPage,enableSelect:"",perPageOptions:s.perPageOptions,onChangePerPage:n.handlePerPageChange},null,8,["total","current","per-page","onPageChanged","pageChanged","perPageChanged","perPageOptions","onChangePerPage"])])]),_:1},8,["columns","rows","onSortChange"])]),_:1}),s.state.isLoading?(d(),h(P,{key:0,text:"Fetching records"})):u("",!0),i(B,{onCloseModal:e[2]||(e[2]=a=>s.state.showModal=!1),ref:"form",onReload:n.fetchRecords},null,8,["onReload"])])]),_:1},8,["breadcrumbs"])}const mt=R(_e,[["render",Be],["__scopeId","data-v-e07d7f46"]]);export{mt as default};
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings