File manager - Edit - /home/autoph/public_html/projects/ahg-hr/assets/index.4265aff0.js
Back
import{_ as T,o as f,b as C,t as R,h as w,r as i,c as g,w as l,j as _,d as u,k as O,e as s}from"./index.3a0d1437.js";import{S as b}from"./ScheduleShiftService.793a4bcd.js";import{I as M,w as D,L as I}from"./index.09b28a7f.js";import{B as q}from"./index.95db1698.js";import{C as E}from"./CreateButton.83988a87.js";import{D as L}from"./DeleteButton.3eb26d6c.js";import{E as U}from"./EditButton.f8156944.js";/* empty css */import{I as G}from"./index.163ce270.js";import"./jspdf.es.min.a68db437.js";/* empty css *//* empty css */import"./vue-cleave.min.da4c1c61.js";import{c as H,a as p,V as N}from"./array.057dff5d.js";import{L as B}from"./Loading.2fa16091.js";import"./vue-quill.snow.08c5baab.js";/* empty css */import{I as A}from"./index.fd1302f6.js";import{F as Q}from"./index.5338216a.js";import{F as W}from"./index.4888d65f.js";import{T as Y}from"./index.474be899.js";import{T as j}from"./index.53519759.js";import{C as z}from"./CloseButton.f9c39bb8.js";import{S as J}from"./SubmitButton.53a3866c.js";import{U as K}from"./UpdateButton.161928d8.js";import{M as X}from"./Multiselect.4d70245a.js";import{C as Z}from"./index.30a24c9f.js";import{l as $}from"./lodash.7ba26c92.js";import{P as ee}from"./index.ceaa4080.js";import{h as te}from"./meeting-office.7e6e2274.js";import{C as oe}from"./index.5a868516.js";import"./logo-black.7c15feb3.js";import"./logo-white.b04c5a89.js";import"./transition.eb053693.js";import"./EmployeeService.0d36c049.js";import"./es.string.replace.6e729815.js";import"./Loading.vue_vue_type_style_index_0_scoped_cbded5a2_lang.717f943d.js";import"./index.57af9821.js";import"./index.ae1bb6da.js";import"./ck-white.4bf441fa.js";const se={data(){return{}},props:{text:{type:String},className:{type:String,default:"text-[#ED539F] pt-2"}}};function re(o,t,d,v,e,a){return f(),C("div",{class:w(d.className)},R(d.text),3)}const ie=T(se,[["render",re]]),le={components:{ErrorValidation:ie,FormModal:W,FormGroup:Q,TextInput:j,TextArea:Y,SubmitButton:J,UpdateButton:K,CloseButton:z,Loading:B,Multiselect:X,InputGroup:M,Checkbox:Z},data(){return{isCws:!1,isShifting:!1,dayoffOption:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],form:{name:"",description:"",from_time:"",to_time:"",flexible:!1,day_off:[],cws_from_time:"",cws_to_time:"",cws_day:"",shifting_from_time:"",shifting_to_time:"",shifting_day:[],wfh:[]},errors:{},state:{isEdit:!1,isSaving:!1,isLoading:!1}}},methods:{loadRecord(o){this.resetForm(),this.state.isEdit=!0,this.form={...o,day_off:o.day_off?o.day_off.split(","):[],wfh:o.wfh?o.wfh.split(","):[],shifting_day:o.shifting_day?o.shifting_day.split(","):[]},this.form.flexible=o.flexible==1},closeModal(){this.state.showModal=!1},resetForm(){this.isCws=!1,this.isShifting=!1,this.state.isEdit=!1,this.form={name:"",description:"",from_time:"",to_time:"",flexible:!1,day_off:[],cws_from_time:"",cws_to_time:"",cws_day:"",shifting_from_time:"",shifting_to_time:"",shifting_day:[],wfh:[]}},reload(){this.$emit("reload")},async saveRecord(){if(this.state.isSaving=!0,!this.state.isEdit)this.state.isSaving=!1,await b.create(this.form).then(o=>{o.status==201&&(this.$swal.fire({title:"Great!",text:"Record successfully saved.",icon:"success",timer:2e3}),this.state.showModal=!1,this.resetForm(),this.reload())}).catch(o=>{this.$swal.fire({title:"Ooops! something is wrong.",text:o.response.data.message,icon:"error",timer:2e3})});else{const o=this.form.id;await b.update(o,this.form).then(t=>{t.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(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})}).finally(()=>{this.state.isSaving=!1,this.reload()})}},async submitForm(){try{await H().shape({name:p().required("Name field is required").min(2),from_time:p().required("From time field is required"),to_time:p().required("To time field is required"),cws_from_time:this.isCws?p().required("From time field is required"):"",cws_to_time:this.isCws?p().required("To time field is required"):"",cws_day:this.isCws?p().required("Regular Day field is required"):"",shifting_from_time:this.isShifting?p().required("From time field is required"):"",shifting_to_time:this.isShifting?p().required("To time 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(t=>{t.value&&this.saveRecord()})}catch(o){if(console.log(o),o instanceof N){const t={};o.inner.forEach(d=>{t[d.path]=d.message}),this.errors=t,console.log(this.errors)}this.state.isSaving=!1}},checkCws(){console.log(this.isCws)},checkShifting(){console.log(this.isShifting)}},mounted(){},watch:{isCws:{handler:"checkCws",immediate:!0},isShifting:{handler:"checkShifting",immediate:!0}}},ne={class:"text-slate-600 dark:text-slate-400 text-sm font-normal"},ae={class:"grid grid-cols-4 gap-2"},me={key:1,class:"grid grid-cols-3 gap-4"},de={key:2,class:"grid grid-cols-3 gap-4"},fe={class:"flex gap-1 justify-end pt-14"};function ce(o,t,d,v,e,a){const S=i("Loading"),x=i("TextInput"),n=i("FormGroup"),h=i("flat-pickr"),c=i("ErrorValidation"),y=i("Multiselect"),V=i("Checkbox"),k=i("SubmitButton"),F=i("UpdateButton"),P=i("CloseButton"),m=i("FormModal");return f(),g(m,{title:e.state.isEdit?"Edit Record":"Create Record",active:e.state.showModal,onSubmit:o.confirmSubmit,onClose:a.closeModal,themeClass:e.state.isEdit?"bg-primary-600":"bg-gray-800",sizeClass:"lg:w-3/4"},{default:l(()=>[e.state.isEdit&&e.state.isLoading?(f(),g(S,{key:0,text:"Fetching record"})):_("",!0),u("div",ne,[u("form",{onSubmit:t[14]||(t[14]=O((...r)=>o.confirmSubmit&&o.confirmSubmit(...r),["prevent"])),class:"space-y-4"},[e.state.isSaving?(f(),g(S,{key:0,text:"Saving record"})):_("",!0),s(n,{label:"Name",isRequired:!0},{default:l(()=>[s(x,{type:"text",placeholder:"Input name",modelValue:e.form.name,"onUpdate:modelValue":t[0]||(t[0]=r=>e.form.name=r),error:e.errors.name,classInput:"h-[48px]"},null,8,["modelValue","error"])]),_:1}),s(n,{label:"Description"},{default:l(()=>[s(x,{type:"text",placeholder:"Input description",modelValue:e.form.description,"onUpdate:modelValue":t[1]||(t[1]=r=>e.form.description=r),error:e.errors.description,classInput:"h-[48px]"},null,8,["modelValue","error"])]),_:1}),u("div",ae,[s(n,{label:"From Time",isRequired:!0},{default:l(()=>[s(h,{type:"time",placeholder:"Input time ",modelValue:e.form.from_time,"onUpdate:modelValue":t[2]||(t[2]=r=>e.form.from_time=r),class:"form-control h-[48px]",config:{enableTime:!0,noCalendar:!0,dateFormat:"H:i"}},null,8,["modelValue"]),s(c,{text:e.errors.from_time},null,8,["text"])]),_:1}),s(n,{label:"To Time",isRequired:!0},{default:l(()=>[s(h,{type:"time",placeholder:"Input time ",modelValue:e.form.to_time,"onUpdate:modelValue":t[3]||(t[3]=r=>e.form.to_time=r),class:"form-control h-[48px]",config:{enableTime:!0,noCalendar:!0,dateFormat:"H:i",minTime:e.form.from_time}},null,8,["modelValue","config"]),s(c,{text:e.errors.to_time},null,8,["text"])]),_:1}),s(n,{label:"Day Off",isRequired:!0},{default:l(()=>[s(y,{type:"text",placeholder:"Select Multiple ",modelValue:e.form.day_off,"onUpdate:modelValue":t[4]||(t[4]=r=>e.form.day_off=r),class:"h-[48px]",options:e.dayoffOption,mode:"tags"},null,8,["modelValue","options"]),s(c,{text:e.errors.day_off},null,8,["text"])]),_:1}),s(n,{label:"Work From Home"},{default:l(()=>[s(y,{type:"text",placeholder:"Select Multiple ",modelValue:e.form.wfh,"onUpdate:modelValue":t[5]||(t[5]=r=>e.form.wfh=r),error:e.errors.wfh,class:"h-[48px]",options:e.dayoffOption,mode:"tags"},null,8,["modelValue","error","options"])]),_:1})]),u("div",{class:w(["grid grid-cols-1",e.isCws?"mb-24":""])},[s(V,{modelValue:e.isCws,"onUpdate:modelValue":t[6]||(t[6]=r=>e.isCws=r),checked:e.form.cws_day!=null&&e.form.cws_day!="",label:"Compress Work Schedule?",activeClass:"ring-blue-500 bg-blue-500 dark:bg-blue-700 dark:ring-blue-700",disabled:e.form.flexible},null,8,["modelValue","checked","disabled"])],2),e.form.cws_day!=null&&e.form.cws_day!=""||e.isCws?(f(),C("div",me,[s(n,{label:"Regular Day",isRequired:!0},{default:l(()=>[s(y,{type:"text",placeholder:"Select Day",modelValue:e.form.cws_day,"onUpdate:modelValue":t[7]||(t[7]=r=>e.form.cws_day=r),error:e.errors.cws_day,class:"h-[48px]",options:e.dayoffOption},null,8,["modelValue","error","options"]),s(c,{text:e.errors.cws_day},null,8,["text"])]),_:1}),s(n,{label:"From Time",isRequired:!0},{default:l(()=>[s(h,{type:"time",placeholder:"Input time ",modelValue:e.form.cws_from_time,"onUpdate:modelValue":t[8]||(t[8]=r=>e.form.cws_from_time=r),error:e.errors.cws_from_time,class:"form-control h-[48px]",config:{enableTime:!0,noCalendar:!0,dateFormat:"H:i"}},null,8,["modelValue","error"]),s(c,{text:e.errors.cws_from_time},null,8,["text"])]),_:1}),s(n,{label:"To Time",isRequired:!0,class:w(e.isCws?"":"mb-24")},{default:l(()=>[s(h,{type:"time",placeholder:"Input time ",modelValue:e.form.cws_to_time,"onUpdate:modelValue":t[9]||(t[9]=r=>e.form.cws_to_time=r),error:e.errors.cws_to_time,class:"form-control h-[48px]",config:{enableTime:!0,noCalendar:!0,dateFormat:"H:i",minTime:e.form.cws_to_time}},null,8,["modelValue","error","config"]),s(c,{text:e.errors.cws_to_time},null,8,["text"])]),_:1},8,["class"])])):_("",!0),u("div",{class:w(["grid grid-cols-1",e.isShifting?"mb-24":""])},[s(V,{modelValue:e.isShifting,"onUpdate:modelValue":t[10]||(t[10]=r=>e.isShifting=r),checked:e.form.shifting_day!=null&&e.form.shifting_day!="",label:"ROWS with Shifting?",activeClass:"ring-blue-500 bg-blue-500 dark:bg-blue-700 dark:ring-blue-700"},null,8,["modelValue","checked"])],2),e.form.shifting_day!=null&&e.form.shifting_day!=""||e.isShifting?(f(),C("div",de,[s(n,{label:"Shifting Day",isRequired:!0},{default:l(()=>[s(y,{type:"text",placeholder:"Select Day",modelValue:e.form.shifting_day,"onUpdate:modelValue":t[11]||(t[11]=r=>e.form.shifting_day=r),error:e.errors.shifting_day,class:"h-[48px]",options:e.dayoffOption,mode:"tags"},null,8,["modelValue","error","options"]),s(c,{text:e.errors.cws_day},null,8,["text"])]),_:1}),s(n,{label:"From Time",isRequired:!0},{default:l(()=>[s(h,{type:"time",placeholder:"Input time ",modelValue:e.form.shifting_from_time,"onUpdate:modelValue":t[12]||(t[12]=r=>e.form.shifting_from_time=r),error:e.errors.shifting_from_time,class:"form-control h-[48px]",config:{enableTime:!0,noCalendar:!0,dateFormat:"H:i"}},null,8,["modelValue","error"]),s(c,{text:e.errors.shifting_from_time},null,8,["text"])]),_:1}),s(n,{label:"To Time",isRequired:!0,class:w(e.isShifting?"":"mb-24")},{default:l(()=>[s(h,{type:"time",placeholder:"Input time ",modelValue:e.form.shifting_to_time,"onUpdate:modelValue":t[13]||(t[13]=r=>e.form.shifting_to_time=r),error:e.errors.shifting_to_time,class:"form-control h-[48px]",config:{enableTime:!0,noCalendar:!0,dateFormat:"H:i",minTime:e.form.cws_to_time}},null,8,["modelValue","error","config"]),s(c,{text:e.errors.shifting_to_time},null,8,["text"])]),_:1},8,["class"])])):_("",!0),u("div",fe,[e.state.isEdit?(f(),g(F,{key:1,onClick:a.submitForm},null,8,["onClick"])):(f(),g(k,{key:0,onClick:a.submitForm},null,8,["onClick"])),s(P,{onClick:a.closeModal},null,8,["onClick"])])],32)])]),_:1},8,["title","active","onSubmit","onClose","themeClass"])}const ue=T(le,[["render",ce]]);const he={mixins:[D],setup(){},components:{Layout:I,CreateButton:E,Loading:B,InputGroup:A,EditButton:U,DeleteButton:L,Button:q,Form:ue,Pagination:ee,Card:oe,Icon:G},data(){return{headerImage:te,title:"Schedule Shift",breadcrumbs:[{text:"Home",href:"/"},{text:"Masterfile",href:"/masterfile/schedule-shift"},{text:"Schedule Shift",active:!0}],columns:[{label:"#",field:"#"},{label:"Name",field:"name"},{label:"Description",field:"description"},{label:"From Time",field:"from_time"},{label:"To Time",field:"to_time"},{label:"Day Off",field:"day_off"},{label:"WFH",field:"wfh"},{label:"Flexible",field:"flexible"},{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"}}},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 b.fetchRecords({keyword:this.searchQuery,page:this.serverOptions.page,per_page:this.serverOptions.rowsPerPage,sortBy:this.serverOptions.sortBy,sortType:this.serverOptions.sortType}).then(o=>{console.log(o);let t=o.data.data;this.items=t,this.items=t.map((d,v)=>({...d,"#":(this.serverOptions.page-1)*this.serverOptions.rowsPerPage+(v+1)})),this.totalItems=o.data.total}).finally(()=>{this.state.isLoading=!1,this.state.isMounted=!0})},handlePageChange(o){console.log(o),console.log(this.serverOptions.page),this.serverOptions.page!=o&&(this.serverOptions.page=o)},handlePerPageChange(o){this.serverOptions.page=1,this.serverOptions.rowsPerPage=o},onSortChange(o){console.log(o),o[0].type!="none"&&(this.serverOptions.sortBy=o[0].field,this.serverOptions.sortType=o[0].type)},async deleteRecord(o){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(t=>{t.value&&(this.state.isDeleting=!0,b.remove(o).then(d=>{console.log(d),d.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})},createRecord(){this.$refs.form.resetForm(),this.$refs.form.state.showModal=!0},editRecord(o){this.$refs.form.resetForm(),this.$refs.form.loadRecord(o),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 b.update(this.categoryData.category_code,this.categoryData),Swal.fire("Success!","Data successfully updated.","success")):(await b.create(this.categoryData),Swal.fire("Success!","Data succesfully created.","success")),this.state.showModal=!1,this.state.isLoading=!1,this.resetData(),this.fetchRecords()}catch(o){this.error=o||"",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()}},pe={class:"my-5"},ge={class:"md:flex pb-6 items-center"},_e={class:"flex-1 md:mb-0 mb-3"},ye={key:0,class:"flex gap-1"},we={key:1,class:"flex gap-1"},be={class:"py-4 flex justify-end"};function xe(o,t,d,v,e,a){const S=i("InputGroup"),x=i("Button"),n=i("EditButton"),h=i("DeleteButton"),c=i("Pagination"),y=i("vue-good-table"),V=i("Card"),k=i("Loading"),F=i("Form"),P=i("Layout");return f(),g(P,{breadcrumbs:e.breadcrumbs},{default:l(()=>[u("div",pe,[s(V,{noborder:""},{default:l(()=>[u("div",ge,[u("h6",_e,R(e.title),1),u("div",{class:w(["md:flex md:space-x-3 items-center flex-none rtl:space-x-reverse my-3 float-right",o.window.width<768?"space-x-rb":""])},[s(S,{modelValue:e.searchQuery,"onUpdate:modelValue":t[0]||(t[0]=m=>e.searchQuery=m),placeholder:"Search",type:"text",prependIcon:"heroicons-outline:search",merged:""},null,8,["modelValue"]),s(x,{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"}),s(x,{icon:"heroicons-outline:plus-sm",text:"Add Record",btnClass:" btn-dark font-normal btn-sm ",iconClass:"text-lg",onClick:t[1]||(t[1]=m=>a.createRecord())})],2)]),s(y,{styleClass:"vgt-table lesspadding v-middle",columns:e.columns,rows:e.items,mode:"remote",search:!0,"sort-options":{enabled:!0},"pagination-options":{enabled:!0},onSortChange:a.onSortChange,"max-height":"600px"},{"table-row":l(m=>[m.column.field=="flexible"?(f(),C("div",ye,R(m.row.flexible==1?"Yes":""),1)):_("",!0),m.column.field=="action"?(f(),C("div",we,[s(n,{onClick:r=>a.editRecord(m.row)},null,8,["onClick"]),s(h,{onClick:r=>a.deleteRecord(m.row.id)},null,8,["onClick"])])):_("",!0)]),"pagination-bottom":l(m=>[u("div",be,[s(c,{total:e.totalItems,current:e.serverOptions.page,"per-page":e.serverOptions.rowsPerPage,onPageChanged:a.handlePageChange,pageChanged:m.pageChanged,perPageChanged:e.serverOptions.rowsPerPage,enableSelect:"",perPageOptions:e.perPageOptions,onChangePerPage:a.handlePerPageChange},null,8,["total","current","per-page","onPageChanged","pageChanged","perPageChanged","perPageOptions","onChangePerPage"])])]),_:1},8,["columns","rows","onSortChange"])]),_:1}),e.state.isLoading?(f(),g(k,{key:0,text:"Fetching records"})):_("",!0),s(F,{onCloseModal:t[2]||(t[2]=m=>e.state.showModal=!1),ref:"form",onReload:a.fetchRecords},null,8,["onReload"])])]),_:1},8,["breadcrumbs"])}const at=T(he,[["render",xe],["__scopeId","data-v-5b7a56b6"]]);export{at as default};
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0.1 |
proxy
|
phpinfo
|
Settings