File manager - Edit - /home/autoph/public_html/projects/ahg-hr/assets/index.c95f6742.js
Back
import{A as v}from"./main.esm.35b2f04c.js";import{L as S}from"./index.a2e6eae1.js";import{C as R}from"./index.80034d43.js";import{B as F}from"./index.cc73f214.js";import{_ as b,r as s,o as l,c,w as f,j as C,d as a,k as B,e as r,t as k}from"./index.85badd64.js";import{D as h}from"./DocumentTypeService.49b3a39f.js";import{A as M}from"./ActionCellRenderer.e268db3d.js";import{F as D}from"./index.d64b81fa.js";import{F as E}from"./index.1361a4ca.js";import"./index.0683473b.js";/* empty css */import{T as L}from"./index.4b5a3e02.js";import{M as A}from"./Multiselect.a507ebe0.js";import{S as P}from"./SubmitButton.fbd40930.js";import{C as V}from"./CloseButton.d4d5b449.js";import{U as G}from"./UpdateButton.7c791611.js";import{c as T,a as z,V as I}from"./array.e024b95a.js";import{L as N}from"./Loading.585cd43f.js";import"./logo-black.7c15feb3.js";import"./logo-white.b04c5a89.js";import"./transition.47a550d7.js";import"./EmployeeService.9af9860f.js";import"./vue-cleave.min.5fe175a4.js";import"./es.string.replace.52fb44b9.js";import"./EditButton.f8e95215.js";import"./DeleteButton.f13880af.js";import"./ViewButton.13bd1aa9.js";import"./jspdf.es.min.23081428.js";/* empty css */import"./index.9cc1ebc8.js";import"./index.6e6276ec.js";import"./Loading.vue_vue_type_style_index_0_scoped_cbded5a2_lang.ffa9415b.js";const O={components:{FormGroup:D,TextInput:L,FormModal:E,Multiselect:A,SubmitButton:P,CloseButton:V,UpdateButton:G},data(){return{form:{code:null,name:null,description:null},errors:{},state:{isEdit:!1,showModal:!1}}},methods:{closeModal(){this.state.isEdit=!1,this.resetForm(),this.state.showModal=!1},resetForm(){this.state.isEdit=!1,this.form={name:"",description:""}},loadRecord(e){this.resetForm(),this.state.isEdit=!0,this.form=e},reload(){this.$emit("reload")},async saveRecord(){if(this.state.isSaving=!0,!this.state.isEdit)this.state.isSaving=!1,await h.create(this.form).then(e=>{e.status==201&&(this.$swal.fire({title:"Great!",text:"Record successfully saved.",icon:"success",timer:2e3}),this.state.showModal=!1,this.resetForm(),this.reload())}).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:e.response.data.message,icon:"error",timer:2e3})});else{const e=this.form.id;await h.update(e,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{const e=T().shape({name:z().nullable().required("Name field is required")});console.log(e),await e.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&&(console.log(t.value),this.saveRecord())})}catch(e){if(e instanceof I){const t={};e.inner.forEach(i=>{t[i.path]=i.message}),this.errors=t}this.state.isSaving=!1}}}},U={class:"text-slate-600 dark:text-slate-400 text-sm font-normal"},q={class:"space-y-4"},$={class:"flex gap-1 justify-end"};function Y(e,t,i,g,o,n){const m=s("Loading"),u=s("TextInput"),p=s("FormGroup"),_=s("SubmitButton"),x=s("UpdateButton"),y=s("CloseButton"),w=s("FormModal");return l(),c(w,{title:o.state.isEdit?"Edit Record":"Create Record",active:o.state.showModal,onSubmit:e.confirmSubmit,onClose:n.closeModal,themeClass:o.state.isEdit?"bg-primary-600":"bg-gray-800",sizeClass:"lg:w-3/4"},{default:f(()=>[o.state.isEdit&&o.state.isLoading?(l(),c(m,{key:0,text:"Fetching record"})):C("",!0),a("div",U,[a("form",{onSubmit:t[2]||(t[2]=B((...d)=>e.onSubmit&&e.onSubmit(...d),["prevent"]))},[o.state.isEdit&&o.state.isLoading?(l(),c(m,{key:0,text:"Fetching record"})):C("",!0),a("div",q,[r(p,{label:"Name",isRequired:!0},{default:f(()=>[r(u,{type:"text",placeholder:"Input name ",modelValue:o.form.name,"onUpdate:modelValue":t[0]||(t[0]=d=>o.form.name=d),error:o.errors.name,classInput:"h-[48px]"},null,8,["modelValue","error"])]),_:1}),r(p,{label:"Description"},{default:f(()=>[r(u,{type:"text",placeholder:"Input description ",modelValue:o.form.description,"onUpdate:modelValue":t[1]||(t[1]=d=>o.form.description=d),classInput:"h-[48px]"},null,8,["modelValue"])]),_:1}),a("div",$,[o.state.isEdit?(l(),c(x,{key:1,onClick:n.submitForm},null,8,["onClick"])):(l(),c(_,{key:0,onClick:n.submitForm},null,8,["onClick"])),r(y,{onClick:n.closeModal},null,8,["onClick"])])])],32)])]),_:1},8,["title","active","onSubmit","onClose","themeClass"])}const j=b(O,[["render",Y]]);const H={components:{AgGridVue:v,Layout:S,Card:R,Button:F,ActionCellRenderer:M,Form:j,Loading:N},data(){return{items:[],title:"Document Type",gridApi:null,breadcrumbs:[{text:"Home",href:"/"},{text:"Masterfile",href:"/masterfile/document-type"},{text:"Document Type",active:!0}],paginationPageSize:10,paginationPageSizeSelector:[10,25,50],colDefs:[{field:"#",filter:!0,floatingFilter:!0},{field:"name",filter:!0,floatingFilter:!0,flex:2},{field:"description",filter:!0,floatingFilter:!0},{headerName:"Actions",cellRenderer:"ActionCellRenderer",flex:1,cellRendererParams:{context:{componentParent:this}}}],state:{isLoading:!1,isEdit:!1,isDeleting:!1}}},methods:{async fetchRecords(){this.state.isLoading=!0,await h.fetchRecords().then(e=>{let t=e.data.data;this.items=t.map((i,g)=>({"#":g+1,name:i.name,description:i.description,id:i.id}))}).finally(()=>{this.state.isLoading=!1})},createRecord(){this.$refs.form.state.showModal=!0},editRecord(e){this.$refs.form.resetForm(),this.$refs.form.loadRecord(e),this.$refs.form.state.showModal=!0},deleteRecord(e){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,h.remove(e).then(i=>{i.status==201&&(this.$swal.fire({title:"Yaaay!",text:"Record has been deleted successfully.",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",icon:"error",timer:2e3})}).finally(()=>{this.state.isDeleting=!1})},onGridReady(e){this.gridApi=e.api},exportToCsv(){this.gridApi?this.gridApi.exportDataAsCsv({onlySelected:!1,columnKeys:this.colDefs.filter(e=>e.field!=="actions").map(e=>e.field)}):console.error("Grid API is not ready.")}},mounted(){this.fetchRecords()}},K={class:"my-5"},J={class:"md:flex pb-6 items-center"},Q={class:"flex-1 md:mb-0 mb-3"},W={class:"md:flex md:space-x-3 items-center flex-none rtl:space-x-reverse my-3 float-right"};function X(e,t,i,g,o,n){const m=s("Button"),u=s("ag-grid-vue"),p=s("Card"),_=s("Loading"),x=s("Form"),y=s("Layout");return l(),c(y,{breadcrumbs:o.breadcrumbs},{default:f(()=>[a("div",K,[r(p,{noborder:""},{default:f(()=>[a("div",J,[a("h6",Q,k(o.title),1),a("div",W,[r(m,{icon:"heroicons-outline:download",text:"Export to CSV",btnClass:"btn-dark font-normal btn-sm",iconClass:"text-lg",onClick:n.exportToCsv},null,8,["onClick"]),r(m,{icon:"heroicons-outline:plus-sm",text:"Add Record",btnClass:"btn-dark font-normal btn-sm",iconClass:"text-lg",onClick:t[0]||(t[0]=w=>n.createRecord())})])]),r(u,{ref:"agGrid",rowData:o.items,columnDefs:o.colDefs,style:{height:"500px"},class:"ag-theme-quartz",pagination:!0,paginationPageSize:o.paginationPageSize,paginationPageSizeSelector:o.paginationPageSizeSelector,onGridReady:n.onGridReady},null,8,["rowData","columnDefs","paginationPageSize","paginationPageSizeSelector","onGridReady"])]),_:1}),o.state.isLoading?(l(),c(_,{key:0,text:"Fetching records"})):C("",!0),r(x,{onCloseModal:t[1]||(t[1]=w=>o.state.showModal=!1),ref:"form"},null,512)])]),_:1},8,["breadcrumbs"])}const Ee=b(H,[["render",X]]);export{Ee as default};
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0.07 |
proxy
|
phpinfo
|
Settings