1"use strict";(self.webpackChunkwebapp=self.webpackChunkwebapp||[]).push([[2223],{2223:(S,T,a)=>{a.d(T,{F:()=>X});var o=a(3075),_=a(846),g=a(1158),m=a(4350),d=a(4563),y=a(2654),e=a(5e3),x=a(9665),C=a(5765),f=a(6165),A=a(7576),s=a(9808),l=a(3976),c=a(4164),h=a(4850),v=a(2868),b=a(9251);let Y=(()=>{class i{constructor(t){this.therapyService=t,this.label="Terapia",this.searchPlaceholder="Cerca paziente",this.selected=new e.vpe,this.onChange=n=>{},this.onTouched=()=>{}}ngOnInit(){this.therapies$=this.therapyService.list({"q[typology_eq]":m.Nn[this.typology],"q[patients_therapies_status_eq]":b.De.active}).pipe((0,h.U)(t=>t.list),(0,h.U)(t=>t.map(n=>({label:n.name,value:n.id,meta:n}))),(0,v.b)(t=>{if(this.patientId){const n=t.find(r=>{var u;return(null===(u=r.meta.patient)||void 0===u?void 0:u.id)===this.patientId});n&&(this.model=null==n?void 0:n.value,this.onChange(this.model),this.onSelected(n.meta))}})),this.icon=this.typology===m.N3.group?"groups":"patients"}onModelChange(t){this.onChange(t)}onSelected(t){this.selected.emit(t)}registerOnChange(t){this.onChange=t}registerOnTouched(t){this.onTouched=t}writeValue(t){this.model=t}}return i.\u0275fac=function(t){return new(t||i)(e.Y36(C.C))},i.\u0275cmp=e.Xpm({type:i,selectors:[["lib-therapy-select"]],inputs:{label:"label",searchPlaceholder:"searchPlaceholder",typology:"typology",patientId:"patientId"},outputs:{selected:"selected"},features:[e._Bn([{provide:o.JU,useExisting:(0,e.Gpc)(()=>i),multi:!0}])],decls:2,vars:8,consts:[[3,"icon","label","searchPlaceholder","enableSearch","options","ngModel","ngModelChange","selected"]],template:function(t,n){1&t&&(e.TgZ(0,"ui-select",0),e.NdJ("ngModelChange",function(u){return n.onModelChange(u)})("selected",function(u){return n.onSelected(u)})("ngModelChange",function(u){return n.model=u}),e.ALo(1,"async"),e.qZA()),2&t&&e.Q6J("icon",n.icon)("label",n.label)("searchPlaceholder",n.searchPlaceholder)("enableSearch",!0)("options",e.lcZ(1,6,n.therapies$))("ngModel",n.model)},directives:[l.H,o.JJ,o.On],pipes:[s.Ov],styles:[""]}),i})();var H=a(1927),L=a(4022),Q=a(7606);function z(i,p){if(1&i&&(e.TgZ(0,"span"),e._uU(1),e.qZA()),2&i){const t=e.oxw();e.xp6(1),e.hij("- ",t.typeLabel,"")}}function k(i,p){if(1&i){const t=e.EpF();e.TgZ(0,"div")(1,"div",4),e._UZ(2,"ui-select",5),e.qZA(),e.TgZ(3,"div",6)(4,"ui-button",7),e.NdJ("click",function(){return e.CHM(t),e.oxw().ref.close()}),e._uU(5,"Annulla"),e.qZA(),e.TgZ(6,"ui-button",8),e.NdJ("click",function(){return e.CHM(t),e.oxw().setType()}),e._uU(7,"Continua"),e.qZA()()()}if(2&i){const t=e.oxw();e.xp6(2),e.Q6J("options",t.THERAPY_TYPES_OPTIONS),e.xp6(4),e.Q6J("disabled",!t.form.value.type)}}function F(i,p){1&i&&(e.TgZ(0,"div",22),e._UZ(1,"ui-input",23),e.TgZ(2,"span",24),e._uU(3,"EUR"),e.qZA()())}function R(i,p){1&i&&(e.ynx(0),e._uU(1,"Gestisci tariffe"),e.BQk())}function B(i,p){1&i&&(e.ynx(0),e._uU(1,"Nascondi tariffe"),e.BQk())}function K(i,p){if(1&i){const t=e.EpF();e.TgZ(0,"ui-button",25),e.NdJ("click",function(){e.CHM(t);const r=e.oxw(2);return r.showPrices=!r.showPrices}),e.YNc(1,R,2,0,"ng-container",3),e.YNc(2,B,2,0,"ng-container",3),e.qZA()}if(2&i){const t=e.oxw(2);e.xp6(1),e.Q6J("ngIf",!t.showPrices),e.xp6(1),e.Q6J("ngIf",t.showPrices)}}function V(i,p){if(1&i&&(e.TgZ(0,"div",28)(1,"div",29)(2,"strong"),e._uU(3),e.qZA()(),e.TgZ(4,"div",30),e._UZ(5,"ui-input",31),e.TgZ(6,"span",32),e._uU(7,"EUR"),e.qZA()()()),2&i){const t=p.index,n=e.oxw(3);e.Q6J("formGroupName",t),e.xp6(3),e.Oqu(n.patientsArray.at(t).get("name").value)}}function W(i,p){if(1&i&&(e.TgZ(0,"div",26),e.YNc(1,V,8,2,"div",27),e.qZA()),2&i){const t=e.oxw(2);e.xp6(1),e.Q6J("ngForOf",t.patientsArray.controls)}}function G(i,p){if(1&i&&(e.TgZ(0,"p",33),e._uU(1," Ora del paziente: "),e.TgZ(2,"span",34),e._uU(3),e.ALo(4,"dateTz"),e.qZA()()),2&i){const t=e.oxw(2);e.xp6(3),e.AsE("",e.Dn7(4,2,t.startDate,"HH:mm",t.patientsArray.at(0).get("time_zone").value)," (",t.patientsArray.at(0).get("time_zone").value,")")}}function q(i,p){if(1&i&&(e.TgZ(0,"p",33),e._uU(1," Ora del paziente: "),e.TgZ(2,"span",34),e._uU(3),e.ALo(4,"dateTz"),e.qZA()()),2&i){const t=e.oxw(2);e.xp6(3),e.AsE("",e.Dn7(4,2,t.endDate,"HH:mm",t.patientsArray.at(0).get("time_zone").value)," (",t.patientsArray.at(0).get("time_zone").value,")")}}function j(i,p){if(1&i){const t=e.EpF();e.TgZ(0,"div")(1,"div",9)(2,"lib-therapy-select",10),e.NdJ("selected",function(r){return e.CHM(t),e.oxw().onTherapySelect(r)}),e.qZA(),e.YNc(3,F,4,0,"div",11),e.YNc(4,K,3,2,"ui-button",12),e.qZA(),e.YNc(5,W,2,1,"div",13),e.TgZ(6,"div",14)(7,"div",15),e._UZ(8,"ui-date-picker",16),e.qZA(),e.TgZ(9,"div",17),e._UZ(10,"ui-input",18),e.YNc(11,G,5,6,"p",19),e.qZA(),e.TgZ(12,"div",17),e._UZ(13,"ui-input",20),e.YNc(14,q,5,6,"p",19),e.qZA()(),e.TgZ(15,"div",6)(16,"ui-button",7),e.NdJ("click",function(){return e.CHM(t),e.oxw().ref.close()}),e._uU(17,"Annulla"),e.qZA(),e.TgZ(18,"ui-button",21),e.NdJ("click",function(){return e.CHM(t),e.oxw().create()}),e._uU(19,"Crea seduta"),e.qZA()()()}if(2&i){const t=e.oxw();e.xp6(2),e.Q6J("typology",t.type)("patientId",null==t.ref.data||null==t.ref.data.patient?null:t.ref.data.patient.id)("label",t.type!==t.TherapyTypology.group?"Paziente":"Gruppo")("searchPlaceholder",t.type!==t.TherapyTypology.group?"Cerca paziente":"Cerca gruppo"),e.xp6(1),e.Q6J("ngIf",t.type!==t.TherapyTypology.group),e.xp6(1),e.Q6J("ngIf",t.type===t.TherapyTypology.group&&t.form.value.therapyId),e.xp6(1),e.Q6J("ngIf",t.showPrices),e.xp6(6),e.Q6J("ngIf",t.patientsArray.length&&t.form.value.startTime&&t.type!==t.TherapyTypology.group),e.xp6(3),e.Q6J("ngIf",t.patientsArray.length&&t.form.value.endTime&&t.type!==t.TherapyTypology.group),e.xp6(4),e.Q6J("loading",t.loading)}}let X=(()=>{class i{constructor(t,n,r,u,$){var M,N,Z,D,O,E,P,I,w;this.ref=t,this.therapyService=n,this.formErrorsService=r,this.userService=u,this.fb=$,this.THERAPY_TYPES_OPTIONS=_.x9,this.DAILY_REPEAT_OPTIONS=_.U8,this.TherapyTypology=m.N3,this.subscription=new y.w,this.setTherapyType(),this.form=this.fb.group({date:["",o.kI.required],startTime:["",o.kI.required],endTime:["",o.kI.required],repeat:[0,o.kI.required],type:this.t
1ype,therapyId:null===(N=null===(M=this.ref.data)||void 0===M?void 0:M.group)||void 0===N?void 0:N.id,appointments_patients:this.fb.array([])}),(null===(Z=this.ref.data)||void 0===Z?void 0:Z.type)!==m.N3.group&&this.form.addControl("price",new o.NI("",o.kI.required)),(null===(D=this.ref.data)||void 0===D?void 0:D.date)&&(this.form.patchValue({date:g(null===(O=this.ref.data)||void 0===O?void 0:O.date),startTime:g(null===(E=this.ref.data)||void 0===E?void 0:E.date).format("HH:mm"),endTime:g(null===(P=this.ref.data)||void 0===P?void 0:P.date).add(1,"hour").format("HH:mm")}),this.startDate=(0,d.O)(this.form.value.date,this.form.value.time),this.endDate=(0,d.O)(this.form.value.date,this.form.value.time)),this.subscription.add(null===(I=this.form.get("startTime"))||void 0===I?void 0:I.valueChanges.subscribe(J=>{var U;this.startDate=(0,d.O)(new Date,J),null===(U=this.form.get("endTime"))||void 0===U||U.setValue(g(this.startDate).add(1,"hour").format("HH:mm"))})),this.subscription.add(null===(w=this.form.get("endTime"))||void 0===w?void 0:w.valueChanges.subscribe(J=>{this.endDate=(0,d.O)(new Date,J)}))}setTherapyType(){var t;if(this.type=null===(t=this.ref.data)||void 0===t?void 0:t.type,this.typeLabel=this.type===m.N3.group?"Terapia di gruppo":void 0,!this.type){const n=this.userService.user;n.can(["single","couple"])||(this.type=n.can(["single"])?m.N3.single:m.N3.couple,this.typeLabel=_.mi[this.type])}}ngOnInit(){}ngOnDestroy(){this.subscription.unsubscribe()}get patientsArray(){return this.form.get("appointments_patients")}addPatient(t){this.patientsArray.push(this.fb.group({name:t.fullName,patient_id:t.id,time_zone:t.time_zone,price:[t.price,o.kI.required]}))}setType(){var t;this.type=null===(t=this.form.get("type"))||void 0===t?void 0:t.value,this.typeLabel=_.mi[this.type]}onTherapySelect(t){var n;null===(n=this.form.get("price"))||void 0===n||n.setValue(+(t.price||0)),this.patientsArray.clear(),t.patients.forEach(r=>this.addPatient(r))}create(){if(this.form.valid){this.loading=!0;const t=this.form.value,n={};n.start_date=(0,d.O)(t.date,t.startTime),n.end_date=(0,d.O)(t.date,t.endTime),t.type===m.N3.single&&(t.appointments_patients[0].price=t.price),n.typology="session",this.therapyService.createAppointment(t.therapyId,n,t.appointments_patients).subscribe(r=>{this.ref.close(r)},r=>{this.formErrorsService.setErrors(this.form,r),this.loading=!1})}else this.formErrorsService.markAllAsTouched(this.form)}}return i.\u0275fac=function(t){return new(t||i)(e.Y36(x.S),e.Y36(C.C),e.Y36(f.u),e.Y36(A.K),e.Y36(o.qu))},i.\u0275cmp=e.Xpm({type:i,selectors:[["lib-new-appointment-modal"]],decls:7,vars:4,consts:[[1,"sm:w-160"],[3,"formGroup"],[1,"text-dark","text-xl","font-semibold","leading-7","mb-6"],[4,"ngIf"],[1,"grid","grid-cols-2","gap-8","mb-10"],["label","Seleziona tipologia seduta","formControlName","type",1,"col-span-2","sm:col-span-1",3,"options"],[1,"border-t","border-grey-200","mt-8","pt-6","flex","items-center","justify-end"],["fill","outline",1,"mr-5",3,"click"],[3,"disabled","click"],[1,"grid","grid-cols-2","gap-8","mb-10","items-end"],["formControlName","therapyId",1,"col-span-2","sm:col-span-1",3,"typology","patientId","label","searchPlaceholder","selected"],["class","flex items-center col-span-2 sm:col-span-1",4,"ngIf"],["fill","none","class","mb-3",3,"click",4,"ngIf"],["formArrayName","appointments_patients","class","mb-10",4,"ngIf"],[1,"grid","grid-cols-4","gap-8","mb-10"],[1,"col-span-4","sm:col-span-2"],["label","Data seduta","formControlName","date"],[1,"col-span-2","sm:col-span-1"],["label","Ora di inizio","icon","clock","type","time","formControlName","startTime"],["class","text-xs dark mt-2.5",4,"ngIf"],["label","Ora di fine","icon","clock","type","time","formControlName","endTime"],[3,"loading","click"],[1,"flex","items-center","col-span-2","sm:col-span-1"],["label","Tariffa","formControlName","price",1,"sm:w-14"],[1,"text-grey-500","text-sm","font-medium","mt-8","ml-3.5"],["fill","none",1,"mb-3",3,"click"],["formArrayName","appointments_patients",1,"mb-10"],["class","grid grid-cols-4 gap-8 mb-4 items-center",3,"formGroupName",4,"ngFor","ngForOf"],[1,"grid","grid-cols-4","gap-8","mb-4","items-center",3,"formGroupName"],[1,"col-span-2"],[1,"col-span-2","flex","items-center"],["formControlName","price"],[1,"text-grey-500","text-sm","font-medium","ml-3.5"],[1,"text-xs","dark","mt-2.5"],[1,"font-medium"]],template:function(t,n){1&t&&(e.TgZ(0,"div",0)(1,"form",1)(2,"h1",2),e._uU(3,"Nuova Seduta "),e.YNc(4,z,2,1,"span",3),e.qZA(),e.YNc(5,k,8,2,"div",3),e.YNc(6,j,20,10,"div",3),e.qZA()()),2&t&&(e.xp6(1),e.Q6J("formGroup",n.form),e.xp6(3),e.Q6J("ngIf",n.typeLabel),e.xp6(1),e.Q6J("ngIf",!n.typeLabel&&!n.type),e.xp6(1),e.Q6J("ngIf",n.typeLabel||n.type))},directives:[o._Y,o.JL,o.sg,s.O5,l.H,o.JJ,o.u,c.r,Y,H.a,o.CE,s.sg,o.x0,L.L],pipes:[Q.U],styles:[""]}),i})()},4563:(S,T,a)=>{a.d(T,{O:()=>g});var o=a(1158);function g(m,d,y){let e=o(d,"HH:mm");return y&&(e=e.add(y,"minutes")),o(m).set({hour:e.get("hour"),minute:e.get("minute"),second:e.get("second")}).utc().toISOString()}},4022:(S,T,a)=>{a.d(T,{L:()=>C});var o=a(5e3),_=a(1158),m=a(3075),d=a(6895),y=a(1927),e=a(389),x=a(1599);let C=(()=>{class f{constructor(){this.startView="month",this.labelFormat="ddd D MMMM YYYY",this.onChange=s=>{},this.onTouched=()=>{}}ngOnInit(){}onSelect(s,l){var c,h;this.isRange&&this.model instanceof d.C0?this.model&&this.model.start&&s.isAfter(this.model.start)&&!this.model.end?(this.model=new d.C0(this.model.start,s),this.date="Da "+(null===(c=this.model.start)||void 0===c?void 0:c.format(this.labelFormat))+" - A "+(null===(h=this.model.end)||void 0===h?void 0:h.format(this.labelFormat)),l.close(),this.onChange(this.model)):this.model=new d.C0(s,null):(this.model=s,this.date=s.format(this.labelFormat),this.onChange(s),l.close())}registerOnChange(s){this.onChange=s}registerOnTouched(s){this.onTouched=s}writeValue(s){var l,c;s&&(this.model=s,this.model instanceof _?this.date=this.model.startOf("day").format(this.labelFormat):this.model instanceof d.C0&&(this.date="Da "+(null===(l=this.model.start)||void 0===l?void 0:l.format(this.labelFormat))+" - A "+(null===(c=this.model.end)||void 0===c?void 0:c.format(this.labelFormat))))}}return f.\u0275fac=function(s){return new(s||f)},f.\u0275cmp=o.Xpm({type:f,selectors:[["ui-date-picker"]],inputs:{label:"label",isRange:"isRange",startView:"startView",maxDate:"maxDate",labelFormat:"labelFormat"},features:[o._Bn([{provide:m.JU,useExisting:(0,o.Gpc)(()=>f),multi:!0},{provide:d.q_,useClass:d.LK}])],decls:5,vars:8,consts:[["placeholder","--- Seleziona data ---","icon","agenda",3,"label","uiDropdown","ngModel","readonly","ngModelChange"],[3,"disableMaxHeight"],["dropdown",""],[1,"border","border-grey-300","shadow","rounded-b","bg-white","h-full",3,"click"],[3,"selected","startView","maxDate","selectedChange"]],template:function(s,l){if(1&s){const c=o.EpF();o.TgZ(0,"ui-input",0),o.NdJ("ngModelChange",function(v){return l.date=v}),o.qZA(),o.TgZ(1,"ui-dropdown",1,2)(3,"div",3),o.NdJ("click",function(v){return v.stopPropagation()}),o.TgZ(4,"mat-calendar",4),o.NdJ("selectedChange",function(v){o.CHM(c);const b=o.MAs(2);return l.onSelect(v,b)}),o.qZA()()()}if(2&s){const c=o.MAs(2);o.Q6J("label",l.label)("uiDropdown",c)("ngModel",l.date)("readonly",!0),o.xp6(1),o.Q6J("disableMaxHeight",!0),o.xp6(3),o.Q6J("selected",l.model)("startView",l.startView)("maxDate",l.maxDate)}},directives:[y.a,e.w,m.JJ,m.On,x.J,d._H],styles:[""]}),f})()}}]);
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.