1import{a as C,g as A,m as D,u as B,j as b}from"./-W1VOijv.js";import H from"./Dc6hFrXi.js";import O from"./B8Ry3j3y.js";import Y from"./Cb9MYrcP.js";import{d as E}from"./BmaaQ1Wp.js";import{bg as s,b3 as _,Q as v,a0 as i,b_ as a,Z as c,bs as m,I as o,aL as S,J,O as k,c1 as L}from"./PW_UF68a.js";import"./Bz2dEcw7.js";import"./CIhhRri8.js";import"./Bs5_TFWz.js";import"./B_aewNsK.js";import"./fgnZjpTr.js";import"./CH7vd0UB.js";import"./206wqFYJ.js";const Q={name:"DatePickerFilter",props:{scope:{required:!0,type:String},scopeKey:{required:!0,type:String},label:{type:String,default:"fields.date"}},data(){return{datePickerMenu:!1,tempSelectedDate:null,displayDate:""}},computed:{formattedDisplayDate(){if(!this.displayDate)return"";if(typeof this.displayDate=="string"&&this.displayDate.includes("-"))return this.displayDate;try{const e=new Date(this.displayDate);if(isNaN(e.getTime()))return"";const t=e.getFullYear(),d=String(e.getMonth()+1).padStart(2,"0"),h=String(e.getDate()).padStart(2,"0");return`${t}-${d}-${h}`}catch{return""}},selectedDate:{get(){return this.$store.state.query.queryParams[this.scope][`filter[${this.scopeKey}]`]},set(e){this.setFilter({key:`filter[${this.scopeKey}]`,scope:this.scope,val:e}),this.getData(this.scope)}}},watch:{datePickerMenu(e){e&&(this.tempSelectedDate=this.selectedDate||null)},selectedDate:{immediate:!0,handler(e){this.displayDate=e||""}}},methods:{...D("resources",["getData"]),...A("query",["setFilter"]),formatDateToString(e){if(!e)return null;try{const t=new Date(e),d=t.getFullYear(),h=String(t.getMonth()+1).padStart(2,"0"),l=String(t.getDate()).padStart(2,"0");return`${d}-${h}-${l}`}catch{return null}},onDateSelect(e){e&&(this.selectedDate=this.formatDateToString(e),this.displayDate=e)},saveCreatedAtFilter(){this.tempSelectedDate&&(this.selectedDate=this.formatDateToString(this.tempSelectedDate),this.displayDate=this.tempSelectedDate),this.datePickerMenu=!1},cancelSelection(){this.tempSelectedDate=this.selectedDate,this.datePickerMenu=!1}}},Z={class:"date-interval-picker-wrapper"};function G(e,t,d,h,l,n){const y=s("v-text-field"),f=s("v-btn"),g=s("v-spacer"),u=s("v-date-picker"),T=s("v-menu");return _(),v("div",Z,[i(T,S({ref:"`datePickerMenu_${scopeKey}`",modelValue:l.datePickerMenu,"onUpdate:modelValue":t[1]||(t[1]=p=>l.datePickerMenu=p),"close-on-content-click":!1,transition:"scale-transition","min-width":"290px"},e.$attrs),{activator:a(({props:p})=>[i(y,S({"model-value":n.formattedDisplayDate,label:e.$t(d.label),readonly:"",variant:"outlined","prepend-inner-icon":"mdi-calendar",dense:"","hide-details":"",style:{"max-width":"400px"},class:"my-1"},p),null,16,["model-value","label"])]),default:a(()=>[i(u,{modelValue:l.tempSelectedDate,"onUpdate:modelValue":[t[0]||(t[0]=p=>l.tempSelectedDate=p),n.onDateSelect],"first-day-of-week":"1",color:"primary",scrollable:""},{header:a(()=>[...t[2]||(t[2]=[o("div",{class:"v-date-picker-header"},null,-1)])]),actions:a(()=>[i(f,{text:"",width:"145px",color:"error",onClick:n.cancelSelection},{default:a(()=>[c(m(e.$t("buttons.back")),1)]),_:1},8,["onClick"]),i(g),i(f,{text:"",width:"145px",color:"success",disabled:!l.tempSelectedDate,onClick:n.saveCreatedAtFilter},{default:a(()=>[c(m(e.$t("buttons.save")),1)]),_:1},8,["disabled","onClick"])]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:1},16,["modelValue"])])}const W=C(Q,[["render",G],["__scopeId","data-v-b301a57b"]]),X={name:"TimePickerFilter",props:{scope:{required:!0,type:String},scopeKey:{required:!0,type:String},label:{type:String,default:"fields.time"}},computed:{formattedTime:{get(){return this.selectedTime?this.selectedTime.substring(0,5):""},set(e){this.selectedTime=e+":00",this.setFilter({key:`filter[${this.scopeKey}]`,scope:this.scope,val:this.selectedTime}),this.getData(this.scope)}},selectedTime:{get(){return this.$store.state.query.queryParams[this.scope][`filter[${this.scopeKey}]`]||""},set(e){this.setFilter({key:`filter[${this.scopeKey}]`,scope:this.scope,val:e})}}},methods:{...D("resources",["getData"]),...A("query",["setFilter"])}};function ee(e,t,d,h,l,n){const y=s("v-text-field");return _(),J(y,{"model-value":n.formattedTime,"onUpdate:modelValue":t[0]||(t[0]=f=>n.formattedTime=f),label:e.$t(d.label),type:"time",variant:"outlined",dense:"","hide-details":"",style:{"max-width":"400px"},class:"my-1"},null,8,["model-value","label"])}const te=C(X,[["render",ee]]),ie={name:"AppointmentIndex",components:{TimePickerFilter:te,DatePickerFilter:W,SelectFilter:Y,TextFieldFilter:O,ResetFiltersButton:H}
1,mixins:[E],data(){return{cancelDialog:!1,cancelReason:"",valid:!1,selectedType:"persoane_fizice",currentAppointmentToCancel:null,rules:{required:e=>!!e||"Acest câmp este obligatoriu."},headers:{persoane_fizice:[{title:this.$t("fields.citizen_first_name"),align:"start",key:"citizen_first_name"},{title:this.$t("fields.citizen_name"),key:"citizen_last_name"},{title:this.$t("appointment.appointment_date"),key:"appointment_date"},{title:this.$t("fields.appointment_hour"),key:"appointment_hour"},{title:this.$t("fields.department"),key:"department_id"},{title:this.$t("fields.users"),key:"user_id"},{title:this.$t("fields.status"),key:"readable_status"},{title:"",sortable:!1,align:"end",key:"action"}],persoane_juridice:[{title:this.$t("fields.company_name"),align:"start",key:"company_name"},{title:this.$t("fields.email"),key:"citizen_email"},{title:this.$t("appointment.appointment_date"),key:"appointment_date"},{title:this.$t("fields.appointment_hour"),key:"appointment_hour"},{title:this.$t("fields.department"),key:"department_id"},{title:this.$t("fields.users"),key:"user_id"},{title:this.$t("fields.status"),key:"readable_status"},{title:"",sortable:!1,align:"end",key:"action"}]}}},async mounted(){await this.fetchInitialData()},head(){return{title:"ProgramÄri"}},computed:{...b("tenant",["tenant"]),...b("appointments",["appointments","departments","users"]),...b("loader",["loading"]),...b("query",["queryParams"]),currentScope(){return"appointments"},isValid(){return this.cancelReason.trim().length>0},currentHeaders(){return this.headers[this.selectedType]||[]},filteredAppointments(){return!this.appointments||!Array.isArray(this.appointments)?[]:this.selectedType==="persoane_fizice"?this.appointments.filter(e=>!e.company_name):this.appointments.filter(e=>e.company_name)},formattedAppointments(){return this.filteredAppointments.map(e=>({...e}))},departmentId(){return B().data.value.user.department_id}},methods:{...D("resources",["getTenant","updateResource","getData","createResource","deleteResource","confirm","cancel"]),...D("query",["resetScopeFilters","setVuetifyPagination"]),async fetchInitialData(){await this.createResource(this.currentScope),await this.getData(this.currentScope)},handleOptionsUpdate(e){this.setVuetifyPagination({scope:this.currentScope,pagination:e}),this.getData(this.currentScope)},formatHour(e){return e||"-"},getDepartmentName(e){if(!e||!this.departments)return"-";const t=this.departments.find(d=>d.id===e);return t?t.name:"-"},getUserName(e){if(!e||!this.users)return"-";const t=this.users.find(d=>d.id===e);return t?t.name:"-"},openCancelDialog(e){this.cancelReason="",this.currentAppointmentToCancel=e,this.cancelDialog=!0},async handleCancelConfirm(){this.currentAppointmentToCancel&&(await this.cancel({data:{...this.currentAppointmentToCancel,cancellation_reason:this.cancelReason},key:"id",refreshData:!0,scope:this.currentScope}),this.cancelDialog=!1,this.currentAppointmentToCancel=null,this.cancelReason="")}}},ae={class:"d-flex flex-column flex-grow-1"},ne={class:"text-h5 text-md-h4"},se={class:"filter-row"},le={key:0},re={key:1},oe={key:2},de={key:3},ce={class:"text-end"},pe={class:"d-flex no-wrap justify-end"};function me(e,t,d,h,l,n){const y=s("v-divider"),f=s("v-spacer"),g=s("v-card-title"),u=s("v-btn"),T=s("v-btn-toggle"),p=s("text-field-filter"),$=s("date-picker-filter"),q=s("time-picker-filter"),V=s("select-filter"),U=s("reset-filters-button"),w=s("v-icon"),z=s("v-tooltip"),R=s("v-data-table-server"),M=s("v-textarea"),N=s("v-form"),P=s("v-card-text"),j=s("v-card-actions"),F=s("v-card"),K=s("v-dialog");return _(),v("div",ae,[i(F,{elevation:"5"},{default:a(()=>[i(g,{class:"d-flex align-center"},{default:a(()=>[o("div",ne,m(e.$t("menu.appointments")),1),i(y,{vertical:"",class:"mx-2 d-none d-md-inline"}),i(f)]),_:1}),i(P,null,{default:a(()=>[i(T,{modelValue:l.selectedType,"onUpdate:modelValue":t[0]||(t[0]=r=>l.selectedType=r),class:"mb-4","selected-class":"text-white"},{default:a(()=>[i(u,{value:"persoane_fizice"},{default:a(()=>[...t[6]||(t[6]=[c("Persoane fizice",-1)])]),_:1}),i(u,{value:"persoane_juridice"},{default:a(()=>
1[...t[7]||(t[7]=[c("Persoane juridice",-1)])]),_:1})]),_:1},8,["modelValue"]),i(R,{headers:n.currentHeaders,"items-per-page-options":[10,15,30,60],loading:e.loading,"items-length":e.queryParams[n.currentScope]?.pagination?.total||0,items:n.formattedAppointments,class:"flex-grow-1 v2-style-table",options:e.pagination,"onUpdate:options":[t[1]||(t[1]=r=>e.pagination=r),n.handleOptionsUpdate]},{"body.prepend":a(()=>[o("tr",se,[l.selectedType==="persoane_fizice"?(_(),v("td",le,[i(p,{label:e.$t("fields.citizen_first_name"),scope:n.currentScope,"scope-key":"citizen_first_name",class:"filter-field","hide-details":""},null,8,["label","scope"])])):k("",!0),l.selectedType==="persoane_fizice"?(_(),v("td",re,[i(p,{label:e.$t("fields.citizen_name"),scope:n.currentScope,"scope-key":"citizen_last_name",class:"filter-field","hide-details":""},null,8,["label","scope"])])):k("",!0),l.selectedType==="persoane_juridice"?(_(),v("td",oe,[i(p,{label:e.$t("fields.company_name"),scope:n.currentScope,"scope-key":"company_name",class:"filter-field","hide-details":""},null,8,["label","scope"])])):k("",!0),l.selectedType==="persoane_juridice"?(_(),v("td",de,[i(p,{label:e.$t("fields.email"),scope:n.currentScope,"scope-key":"citizen_email",class:"filter-field","hide-details":""},null,8,["label","scope"])])):k("",!0),o("td",null,[i($,{scope:n.currentScope,"scope-key":"appointment_date",label:"appointment.appointment_date",class:"filter-field","hide-details":""},null,8,["scope"])]),o("td",null,[i(q,{scope:n.currentScope,label:"fields.appointment_hour","scope-key":"appointment_hour",class:"filter-field","hide-details":""},null,8,["scope"])]),o("td",null,[i(V,{"item-text":"name","item-value":"id",label:e.$t("fields.department"),"scope-key":"department_id",scope:n.currentScope,items:e.departments,class:"filter-field","hide-details":""},null,8,["label","scope","items"])]),o("td",null,[i(V,{"item-text":"name","item-value":"id",label:e.$t("fields.users"),"scope-key":"user_id",scope:n.currentScope,items:e.users,class:"filter-field","hide-details":""},null,8,["label","scope","items"])]),o("td",null,[i(p,{label:e.$t("fields.status"),scope:n.currentScope,"scope-key":"readable_status",class:"filter-field","hide-details":""},null,8,["label","scope"])]),t[8]||(t[8]=o("td",null,null,-1)),o("td",ce,[i(U,{scope:n.currentScope,class:"filter-reset-button"},null,8,["scope"])])])]),"item.appointment_hour":a(({item:r})=>[c(m(n.formatHour(r.appointment_hour)),1)]),"item.department_id":a(({item:r})=>[c(m(n.getDepartmentName(r.department_id)),1)]),"item.user_id":a(({item:r})=>[c(m(n.getUserName(r.user_id)),1)]),"item.action":a(({item:r})=>[o("div",pe,[i(z,{location:"bottom"},{activator:a(({props:x})=>[i(u,S({icon:"",size:"medium",variant:"text",density:"compact",disabled:r.status!==0,onClick:I=>e.confirm({data:{...r,department_id:n.departmentId},key:"id",refreshData:!0,scope:n.currentScope})},x),{default:a(()=>[i(w,{size:"large"},{default:a(()=>[...t[9]||(t[9]=[c("mdi-check-circle",-1)])]),_:1})]),_:1},16,["disabled","onClick"])]),default:a(()=>[t[10]||(t[10]=o("span",null,"Confirmare",-1))]),_:2},1024),i(z,{location:"bottom"},{activator:a(({props:x})=>[i(u,S({icon:"",size:"medium",variant:"text",density:"compact",onClick:I=>n.openCancelDialog(r)},x,{disabled:r.status!==0}),{default:a(()=>[i(w,{size:"large"},{default:a(()=>[...t[11]||(t[11]=[c("mdi-cancel",-1)])]),_:1})]),_:1},16,["onClick","disabled"])]),default:a(()=>[t[12]||(t[12]=o("span",null,"Anulare",-1))]),_:2},1024)])]),_:1},8,["headers","loading","items-length","items","options","onUpdate:options"]),i(K,{modelValue:l.cancelDialog,"onUpdate:modelValue":t[5]||(t[5]=r=>l.cancelDialog=r),persistent:"","max-width":"600"},{default:a(()=>[i(F,null,{default:a(()=>[i(g,{class:"text-h5 bg-primary text-white"},{default:a(()=>[c(m(e.$t("appointments.cancel")),1)]),_:1}),i(P,{class:"mt-5"},{default:a(()=>[i(N,{ref:"cancelForm",modelValue:l.valid,"onUpdate:modelValue":t[3]||(t[3]=r=>l.valid=r)},{default:a(()=>[i(M,{modelValue:l.cancelReason,"onUpdate:modelValue":t[2]||(t[2]=r=>l.cancelReason=r),variant:"outlined","prepend-inner-icon":"mdi-cancel",label:e.$t("fields.cancellation_reason"),required:""},null,8,["modelValue","label"])]),_:1},8,["modelValue"])]),_:1}),i(y),i(j,null,{default:a(()=>[i(u,{color:"error",variant:"text","max-width":"200px","min-width":"100px",onClick:t[4]||(t[4]=L(r=>l.cancelDialog=!1,["stop"]))},{default:a(()=>[c(m(e.$t("buttons.back")),1)]),_:1}),i(f),i(u,{color:"success",variant:"text","max-width":"200px","min-width":"100px",loading:e.loading,disabled:!n.isValid,onClick:n.handleCancelConfirm},{default:a(()=>[c(m(e.$t("buttons.save")),1)]),_:1},8,["loading","disabled","onClick"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1})])}const Ce=C(ie,[["render",me],["__scopeId","data-v-63e09784"]]);export{Ce as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.