import{_ as g,ax as y,M as j,c as b,a as t,w as o,Z as w,ay as v,R as _,H as $,r as k,o as u,$ as l,K as i,I as D,a3 as L,aj as V,N as p,av as f,a1 as C,Q}from"./app-Cox3Klmm.js";import{Q as P,a as r}from"./QTable-Bcm4QxKC.js";import{Q as x}from"./QTr-DpZRq2Qw.js";import{d as E}from"./utils-B-Rlv8Ts.js";import"./externalHosting.js";import"./QList-DOsz8eIb.js";import"./QMarkupTable-DkBRsZwQ.js";import"./QSelect-SR9QxmCO.js";import"./QChip-ubeLtWhp.js";import"./QItemLabel-BhKjsO0f.js";import"./position-engine-Dz9uviBh.js";import"./selection-DztvFjhq.js";import"./rtl-DFPa-2ov.js";import"./use-fullscreen-BlRyF2qr.js";const S={name:"JobList",data(){return{ACTION:$,RESOURCE:_,jobs:[],columns:[{name:"name",align:"left",label:this.$i18n.t("components.jobList.headers.name"),field:e=>e.name,format:e=>`${e}`,sortable:!0},{name:"label",align:"left",label:this.$i18n.t("components.jobList.headers.label"),field:e=>e.label,format:e=>`${e}`,sortable:!0},{name:"grades",align:"center",label:this.$i18n.t("components.jobList.headers.grades"),field:e=>e.grades,format:e=>`${e}`,style:"width: 30px",sortable:!0},{name:"defaultDuty",align:"center",label:this.$i18n.t("components.jobList.headers.defaultDuty"),field:e=>e.defaultDuty,format:e=>`${e}`,style:"width: 30px",sortable:!0},{name:"offDutyPay",align:"center",label:this.$i18n.t("components.jobList.headers.offDutyPay"),field:e=>e.offDutyPay,format:e=>`${e}`,style:"width: 30px",sortable:!0}],pagination:{sortBy:"desc",descending:!1,page:1,rowsPerPage:0},loading:!0}},computed:{...y(v,["searchFilter","paginationSave"])},methods:{can:E,onRowClick(e){this.$router.push({name:"dev-job-detail",params:{jobId:e.name}})},getPaginationLabel(e,s,d){return this.$i18n.t("components.jobList.paginationLabel",{from:e,to:s,total:d})},updatePagination(e){this.loading||(this.paginationSave=e,this.pagination=e)}},mounted(){this.$axios.get("/api/jobs").then(e=>{for(const[s,d]of Object.entries(e.data.jobs))this.jobs.push({name:s,...d});this.loading=!1,this.pagination={...this.paginationSave}}).catch(e=>{this.loading=!1,this.$q.notify({message:this.$i18n.t("general.error"),position:"top",color:"red",icon:"fas fa-exclamation-triangle",caption:this.$i18n.t("general.timeout")})})}},U={key:0,class:"row q-pa-sm"},R={class:"row"},q={class:"col-12"},B={class:"q-mx-md q-my-sm row flex-center"},I={class:"text-caption text-sub"},N={class:"q-ml-auto"},O={class:"text-main"},T={class:"text-main"};function F(e,s,d,J,n,c){const h=k("router-view");return e.$route.name==="dev-job-list"?(u(),j("div",U,[t(w,{class:"job-list-card full-width"},{default:o(()=>[l("div",R,[l("div",q,[l("div",B,[l("div",I,i(e.$t("components.jobList.subheader")),1),l("div",N,[c.can(n.ACTION.DEV.JOB.CREATE,n.RESOURCE.DEV)?(u(),b(L,{key:0,color:"primary",onClick:s[0]||(s[0]=a=>e.$router.push({name:"dev-job-create"})),label:e.$t("components.jobList.createJob"),class:"q-ma-sm",icon:"add"},null,8,["label"])):D("",!0)])]),t(V),t(P,{color:"primary","card-class":"job-list-card text-main","table-class":"job-list-table","table-header-class":"job-list-table-header text-main",flat:"",style:{"max-height":"70vh"},"hide-bottom":"",rows:n.jobs,columns:n.columns,"row-key":"name",pagination:n.pagination,"no-results-label":e.$t("components.jobList.noData"),"loading-label":e.$t("components.jobList.loadData"),loading:n.loading,filter:e.searchFilter,"onUpdate:pagination":c.updatePagination},{"top-right":o(()=>[t(C,{"input-style":{color:"var(--q-main)"},borderless:"",dense:"",debounce:"300",modelValue:e.searchFilter,"onUpdate:modelValue":s[1]||(s[1]=a=>e.searchFilter=a),placeholder:e.$t("general.search")},{append:o(()=>[t(Q,{class:"text-white search-icon",name:"search"})]),_:1},8,["modelValue","placeholder"])]),body:o(a=>[t(x,{props:a,onClick:m=>c.onRowClick(a.row),class:"cursor-pointer"},{default:o(()=>[t(r,{key:"name",props:a},{default:o(()=>[p(i(a.row.name),1)]),_:2},1032,["props"]),t(r,{key:"label",props:a},{default:o(()=>[p(i(a.row.label),1)]),_:2},1032,["props"]),t(r,{key:"grades",props:a},{default:o(()=>[p(i(Object.keys(a.row.grades).length),1)]),_:2},1032,["props"]),t(r,{key:"defaultDuty",props:a},{default:o(()=>[t(f,{disable:"",modelValue:a.row.defaultDuty,"onUpdate:modelValue":m=>a.row.defaultDuty=m},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["props"]),t(r,{key:"offDutyPay",props:a},{default:o(()=>[t(f,{disable:"",modelValue:a.row.offDutyPay,"onUpdate:modelValue":m=>a.row.offDutyPay=m},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["props"])]),_:2},1032,["props","onClick"])]),"no-data":o(()=>[l("div",O,i(e.$t("components.jobList.noData")),1)]),loading:o(()=>[l("div",T,i(e.$t("components.jobList.loadData")),1)]),_:1},8,["rows","columns","pagination","no-results-label","loading-label","loading","filter","onUpdate:pagination"])])])]),_:1})])):(u(),b(h,{key:1}))}const se=g(S,[["render",F],["__scopeId","data-v-c1091860"]]);export{se as default};
