import{r as n,o as r,g as c,w as a,h as s,i as D,j as l,k as w,F as N,l as $,t as d,m as _}from"./vendor-cf98dd49.js";import{_ as y}from"./_plugin-vue_export-helper-c27b6911.js";const E={data:()=>({assingDepartmentModal:!1,requestId:"",selectedDepartment:"",departments:[],requests:[],breadcrumbs:[{title:"Home",disabled:!1,href:"/"},{title:"Requests Manager",disabled:!0}]}),mounted(){this.loadRequests(),this.loadDepartments()},methods:{loadRequests(){this.$root.axiosGet("/request-manager-load").then(e=>{this.requests=e.response.data.data})},rejectRequests(e){this.$root.axiosPost("/request-manager-reject/"+e,null,{}).then(o=>{this.loadRequests()})},processRequests(e){this.$root.axiosPost("/request-manager-process/"+e,null,{}).then(o=>{this.loadRequests()})},loadDepartments(){this.$root.axiosGet("/departments-manager-load").then(e=>{this.departments=e.response.data.data,console.log(this.departments)})},showDepartmentModal(e){this.assingDepartmentModal=!0,this.selectedDepartment="",this.requestId=e},assingDepartment(e){this.$root.axiosPost("/request-manager-assing-department/"+e,null,{department:this.selectedDepartment}).then(o=>{this.assingDepartmentModal=!1,this.loadRequests()})},getStatus(e){if(e==1)return"PENDDING";if(e==2)return"WORKING";if(e==3)return"DONE";if(e==4)return"REJECTED"}}},j={style:{"font-size":"24px"}},P=D("strong",null,"Requests Manager",-1);function B(e,o,G,I,S,u){const q=n("v-icon"),f=n("v-spacer"),k=n("v-breadcrumbs"),m=n("v-row"),p=n("v-divider"),i=n("v-btn"),b=n("v-col"),v=n("v-card-text"),g=n("v-card"),R=n("v-card-title"),C=n("v-select"),x=n("v-card-actions"),M=n("v-dialog"),V=n("v-container");return r(),c(V,null,{default:a(()=>[s(m,null,{default:a(()=>[D("span",j,[s(q,{"x-small":"",class:"pb-2",icon:"mdi-office-building-outline"}),l(),P]),s(f),s(k,{items:e.breadcrumbs,style:{"font-size":"12px"}},null,8,["items"])]),_:1}),s(p,{class:"pb-7"}),s(m,null,{default:a(()=>[s(g,{elevation:"5",style:{width:"100%",height:"500px"}},{default:a(()=>[s(v,null,{default:a(()=>[(r(!0),w(N,null,$(e.requests,t=>(r(),c(b,{cols:"12",class:"pt-0 pb-0",key:t.id},{default:a(()=>[l(" #"+d(t.id)+" | "+d(t.firstname)+" "+d(t.lastname)+" | "+d(t.email)+" | "+d(u.getStatus(t.status))+" ",1),!t.department_id&&t.status!=4?(r(),c(i,{key:0,onClick:h=>u.showDepartmentModal(t.id)},{default:a(()=>[l("Assing Department")]),_:2},1032,["onClick"])):_("",!0),t.department_id&&t.status==1?(r(),c(i,{key:1,onClick:h=>u.processRequests(t.id)},{default:a(()=>[l("Process")]),_:2},1032,["onClick"])):_("",!0),t.status!=4&&t.status!=2?(r(),c(i,{key:2,onClick:h=>u.rejectRequests(t.id)},{default:a(()=>[l("Reject")]),_:2},1032,["onClick"])):_("",!0)]),_:2},1024))),128))]),_:1})]),_:1})]),_:1}),s(M,{modelValue:e.assingDepartmentModal,"onUpdate:modelValue":o[3]||(o[3]=t=>e.assingDepartmentModal=t),persistent:"","max-width":"700"},{default:a(()=>[s(g,null,{default:a(()=>[s(R,{class:"text-h5"},{default:a(()=>[l(" Create New Department ")]),_:1}),s(p,{class:"mb-5"}),s(v,null,{default:a(()=>[s(m,null,{default:a(()=>[l(d(e.requestId),1)]),_:1}),s(m,null,{default:a(()=>[s(C,{modelValue:e.selectedDepartment,"onUpdate:modelValue":o[0]||(o[0]=t=>e.selectedDepartment=t),items:e.departments,"item-title":"name","item-value":"id",title:"pageTitle"},null,8,["modelValue","items"])]),_:1})]),_:1}),s(p,{class:"mt-5"}),s(x,null,{default:a(()=>[s(i,{color:"red darken-1",text:"",onClick:o[1]||(o[1]=t=>e.assingDepartmentModal=!1)},{default:a(()=>[l(" Close ")]),_:1}),s(f),s(i,{color:"green darken-1",text:"",onClick:o[2]||(o[2]=t=>u.assingDepartment(e.requestId))},{default:a(()=>[l(" Assing ")]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1})}const A=y(E,[["render",B]]);export{A as default};
