%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/vacivi36/www2]/app/
Upload File :
Create Path :
Current File : /home/vacivi36/www2]/app/33.6304648adb167721.js

"use strict";(self.webpackChunkmaterial=self.webpackChunkmaterial||[]).push([[33],{3021:(xe,P,l)=>{l.r(P),l.d(P,{SchedulesModule:()=>fe});var p=l(9808),_=l(6696),q=l(8279),J=l(6087),N=l(4847),c=l(3075),g=l(8966),e=l(5e3),x=l(7261),b=l(662),F=l(8902),I=l(3088),h=l(3737),C=l(7423),Z=l(4834),y=l(5899),O=l(7238),T=l(4376);function Y(o,r){1&o&&e._UZ(0,"mat-progress-bar",19)}function E(o,r){if(1&o&&(e.TgZ(0,"div",20)(1,"span",21),e._uU(2),e.qZA(),e.TgZ(3,"span",22),e._uU(4),e.qZA()()),2&o){const t=r.item;e.xp6(2),e.Oqu(t.name),e.xp6(2),e.Oqu(t.cpf)}}function B(o,r){if(1&o&&(e.TgZ(0,"div",20)(1,"span",21),e._uU(2),e.qZA(),e.TgZ(3,"span",22),e._uU(4),e.qZA()()),2&o){const t=r.item;e.xp6(2),e.Oqu(t.name),e.xp6(2),e.hij("Lote: ",t.batch,"")}}function L(o,r){if(1&o){const t=e.EpF();e.TgZ(0,"button",34),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().index,a=e.oxw();return e.KtG(a.removeApplication(i))}),e._UZ(1,"i",35),e.qZA()}}function Q(o,r){if(1&o){const t=e.EpF();e.TgZ(0,"button",36),e.NdJ("click",function(){e.CHM(t);const i=e.oxw(2);return e.KtG(i.addApplication())}),e._UZ(1,"i",37),e.qZA()}if(2&o){const t=e.oxw().$implicit;e.Q6J("disabled",!t.valid)}}function z(o,r){if(1&o&&(e.TgZ(0,"div",23)(1,"div",24)(2,"div",25)(3,"label",7),e._uU(4,"Vacina"),e.qZA(),e.TgZ(5,"span",8),e._uU(6,"*"),e.qZA(),e.TgZ(7,"ng-select",26),e.YNc(8,B,5,2,"ng-template",10),e.qZA()(),e.TgZ(9,"div",27)(10,"label",7),e._uU(11,"Dose"),e.qZA(),e.TgZ(12,"span",8),e._uU(13,"*"),e.qZA(),e._UZ(14,"input",28),e.qZA(),e.TgZ(15,"div",29)(16,"label",7),e._uU(17,"Data da Aplica\xe7\xe3o"),e.qZA(),e.TgZ(18,"span",8),e._uU(19,"*"),e.qZA(),e._UZ(20,"input",30),e.qZA(),e.TgZ(21,"div",31),e.YNc(22,L,2,0,"button",32),e.YNc(23,Q,2,1,"button",33),e.qZA()()()),2&o){const t=r.index,n=e.oxw();e.xp6(1),e.Q6J("formGroupName",t),e.xp6(6),e.Q6J("items",n.vaccines)("clearable",!0),e.xp6(15),e.Q6J("ngIf",t>0),e.xp6(1),e.Q6J("ngIf",t===n.applications.length-1)}}let S=(()=>{class o{constructor(t,n,i,a,s,d,m){this.formBuilder=t,this._snackBar=n,this.scheduleService=i,this.patientService=a,this.vaccineService=s,this.dialog=d,this.data=m,this.patients=[],this.vaccines=[],this.loading=!1,this.savedChange=!1,this.schedule=this.data.schedule}ngOnInit(){this.initForm(),this.populateForm(this.schedule),this.downloadPatients(),this.downloadVaccines()}initForm(){this.form=this.formBuilder.group({patient_id:[null,c.kI.required],schedule_date:[null,c.kI.required],notes:[null],applications:this.formBuilder.array([])}),null==this.schedule&&this.addApplication()}get applications(){return this.form.get("applications")}addApplication(){const t=this.formBuilder.group({vaccine_id:[null,c.kI.required],application_date:[null,c.kI.required],dose_number:[null,c.kI.required]});this.applications.push(t)}removeApplication(t){this.applications.removeAt(t)}save(t){if(this.form.valid){this.loading=!0;let n=this.form.value;this.schedule?this.scheduleService.update(this.schedule.id,n).then(i=>{this.schedule=i,this.savedChange=!0,this.openSnackBar("Salvo com sucesso!","Fechar","success"),t&&this.closeDialog()}).catch(i=>{this.openSnackBar(i.error.message,"Fechar","danger")}).finally(()=>{this.loading=!1}):this.scheduleService.create(n).then(i=>{this.schedule=i,this.savedChange=!0,this.openSnackBar("Salvo com sucesso!","Fechar","success"),t&&this.closeDialog()}).catch(i=>{this.openSnackBar(i.error.message,"Fechar","danger")}).finally(()=>{this.loading=!1})}}populateForm(t){this.form.patchValue(t),t&&t.applications&&t.applications.forEach(n=>{const i=this.formBuilder.group({vaccine_id:[n.vaccine_id,c.kI.required],application_date:[n.application_date,c.kI.required],dose_number:[n.dose_number,c.kI.required]});this.applications.push(i)})}canSave(){return this.form.valid&&!this.loading}closeDialog(){this.savedChange?this.dialog.close(this.schedule):this.dialog.close()}openSnackBar(t,n,i){this._snackBar.open(t,n,{horizontalPosition:"right",verticalPosition:"bottom",duration:4e3,panelClass:"snackBar-"+i})}downloadPatients(){this.loading=!0,this.patientService.list().then(t=>{this.patients=t}).catch(t=>{this.openSnackBar("Erro ao listar pacientes","Fechar","danger")}).finally(()=>{this.loading=!1})}downloadVaccines(){this.loading=!0,this.vaccineService.list().then(t=>{this.vaccines=t}).catch(t=>{this.openSnackBar("Erro ao listar vacinas","Fechar","danger")}).finally(()=>{this.loading=!1})}}return o.\u0275fac=function(t){return new(t||o)(e.Y36(c.qu),e.Y36(x.ux),e.Y36(b.u),e.Y36(F.e),e.Y36(I.s),e.Y36(g.so),e.Y36(g.WI))},o.\u0275cmp=e.Xpm({type:o,selectors:[["app-schedule-form-dialog"]],decls:32,vars:7,consts:[[3,"formGroup"],["cdkDrag","","cdkDragRootElement",".cdk-overlay-pane","cdkDragHandle","",1,"d-flex","align-items-center","justify-content-between","cursor-pointer","p-2","mt-2","mx-2"],[1,"mdi","mdi-close","mb-2",3,"click"],["style","height: 3px;","color","accent","mode","indeterminate",4,"ngIf"],[1,"content-scrollable","mat-typography","p-4","background-color-form"],[1,"row"],[1,"col-md-8"],[1,"form-label"],[1,"required"],["bindLabel","name","bindValue","id","formControlName","patient_id",1,"style-ng-select","form-select",3,"items","clearable"],["ng-option-tmp",""],[1,"col-md-4"],["type","date","formControlName","schedule_date",1,"form-control"],[2,"margin-top","30px","margin-bottom","10px"],["formArrayName","applications","class","application-group",4,"ngFor","ngForOf"],[1,"col-md-12","mt-3"],["formControlName","notes","rows","4",1,"form-control"],["cdkDrag","","cdkDragRootElement",".cdk-overlay-pane","cdkDragHandle","","align","end",1,"cursor-pointer","p-2","mt-1","mx-2","mb-1"],["mat-button","","color","accent",3,"disabled","click"],["color","accent","mode","indeterminate",2,"height","3px"],[1,"d-flex","flex-column"],[1,"font-weight-bold"],[1,"small","text-muted"],["formArrayName","applications",1,"application-group"],[1,"row",3,"formGroupName"],[1,"col-md-6","mt-3"],["bindLabel","name","bindValue","id","formControlName","vaccine_id",1,"style-ng-select","form-select",3,"items","clearable"],[1,"col-md-2","mt-3"],["type","number","formControlName","dose_number",1,"form-control"],[1,"col-md-3","mt-3"],["type","date","formControlName","application_date",1,"form-control"],[1,"col-md-1","d-flex","align-items-center","justify-content-center",2,"margin-top","41px"],["matTooltip","Remover","mat-icon-button","","color","warn","class","button-remove-vaccine",3,"click",4,"ngIf"],["matTooltip","Adicionar","mat-icon-button","","color","primary","class","button-add-vaccine",3,"disabled","click",4,"ngIf"],["matTooltip","Remover","mat-icon-button","","color","warn",1,"button-remove-vaccine",3,"click"],[1,"mdi","mdi-minus"],["matTooltip","Adicionar","mat-icon-button","","color","primary",1,"button-add-vaccine",3,"disabled","click"],[1,"mdi","mdi-plus"]],template:function(t,n){1&t&&(e.TgZ(0,"form",0)(1,"div",1)(2,"h6"),e._uU(3),e.qZA(),e.TgZ(4,"i",2),e.NdJ("click",function(){return n.closeDialog()}),e.qZA()(),e._UZ(5,"mat-divider"),e.YNc(6,Y,1,0,"mat-progress-bar",3),e.TgZ(7,"div",4)(8,"div",5)(9,"div",6)(10,"label",7),e._uU(11,"Paciente"),e.qZA(),e.TgZ(12,"span",8),e._uU(13,"*"),e.qZA(),e.TgZ(14,"ng-select",9),e.YNc(15,E,5,2,"ng-template",10),e.qZA()(),e.TgZ(16,"div",11)(17,"label",7),e._uU(18,"Data do Agendamento"),e.qZA(),e.TgZ(19,"span",8),e._uU(20,"*"),e.qZA(),e._UZ(21,"input",12),e.qZA(),e._UZ(22,"mat-divider",13),e.YNc(23,z,24,5,"div",14),e.TgZ(24,"div",15)(25,"label",7),e._uU(26,"Observa\xe7\xf5es"),e.qZA(),e._UZ(27,"textarea",16),e.qZA()()(),e._UZ(28,"mat-divider"),e.TgZ(29,"div",17)(30,"button",18),e.NdJ("click",function(){return n.save(!0)}),e._uU(31,"Salvar e Fechar"),e.qZA()()()),2&t&&(e.Q6J("formGroup",n.form),e.xp6(3),e.Oqu(n.schedule?"Editar Agendamento #"+n.schedule.id:"Novo Agendamento"),e.xp6(3),e.Q6J("ngIf",n.loading),e.xp6(8),e.Q6J("items",n.patients)("clearable",!0),e.xp6(9),e.Q6J("ngForOf",n.applications.controls),e.xp6(7),e.Q6J("disabled",!n.form.valid))},dependencies:[p.sg,p.O5,h.Zt,h.Bh,C.lW,Z.d,y.pW,O.gM,c._Y,c.Fj,c.wV,c.JJ,c.JL,c.sg,c.u,c.x0,c.CE,T.w9,T.ir],styles:[".required[_ngcontent-%COMP%]{color:#ea0505;margin-left:5px}.small-toggle[_ngcontent-%COMP%]{transform:scale(.75);margin:0}.small-toggle[_ngcontent-%COMP%]   .mat-slide-toggle-thumb[_ngcontent-%COMP%]{width:12px;height:12px}.small-toggle[_ngcontent-%COMP%]   .mat-slide-toggle-bar[_ngcontent-%COMP%]{height:14px}input[type=number][_ngcontent-%COMP%]::-webkit-outer-spin-button, input[type=number][_ngcontent-%COMP%]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number][_ngcontent-%COMP%]{-moz-appearance:textfield}  ng-select .ng-select-container{font-size:14px!important}  ng-select .ng-option{font-size:14px!important}  ng-select .ng-value{font-size:14px!important}.button-add-vaccine[_ngcontent-%COMP%]{width:32px;height:32px;line-height:35px;background-color:#dcf1decc}.button-add-vaccine[_ngcontent-%COMP%]:hover{background-color:#caeaca}.button-add-vaccine[_ngcontent-%COMP%]:disabled{background-color:#e0e0e0;color:#a0a0a0;cursor:not-allowed}.button-remove-vaccine[_ngcontent-%COMP%]{width:32px;height:32px;line-height:35px;background-color:#f8e0e0e6;margin-right:8px}.button-remove-vaccine[_ngcontent-%COMP%]:hover{background-color:#eac9c9}.button-remove-vaccine[_ngcontent-%COMP%]:disabled{background-color:#e0e0e0;color:#a0a0a0;cursor:not-allowed}.content-scrollable[_ngcontent-%COMP%]{max-height:calc(100vh - 240px);overflow-y:auto;padding-right:10px}"]}),o})();var R=l(5969);function j(o,r){1&o&&e._UZ(0,"mat-progress-bar",23)}let H=(()=>{class o{constructor(t,n,i,a,s,d){this.formBuilder=t,this._snackBar=n,this.scheduleService=i,this.alertDialogService=a,this.dialog=s,this.data=d,this.selectedFile=null,this.selectedFileName=null,this.loading=!1}ngOnInit(){this.initForm()}initForm(){this.form=this.formBuilder.group({file:[null,[c.kI.required]]})}onFileSelected(t){var n;const i=t.target;if(i.files&&i.files.length>0){const a=i.files[0],s=null===(n=a.name.split(".").pop())||void 0===n?void 0:n.toLowerCase();if(!["xlsx","xls"].includes(s)||a.size>10485760)return alert("Apenas arquivos .xlsx ou .xls com at\xe9 10MB s\xe3o permitidos."),i.value="",this.selectedFile=null,void(this.selectedFileName=null);this.selectedFile=a,this.selectedFileName=a.name}}importFile(t){this.selectedFile?this.scheduleService.importSchedules(this.selectedFile).then(n=>{t&&(this.closeDialog(),this.openSnackBar("Importado com sucesso!","Fechar","success"))}).catch(n=>{this.alertDialogService.openAlertDialog("Erro",n.error.message)}):this.openSnackBar("Por favor, selecione um arquivo antes de importar.","Fechar","danger")}downloadSheetExample(){const n=document.createElement("a");n.href="/assets/sheets/Planilha Exemplo Importacao Agendamentos.xlsx",n.download="Planilha Exemplo Importacao Agendamentos.xlsx",n.click()}canSave(){return!!this.selectedFile}closeDialog(){this.dialog.close()}openSnackBar(t,n,i){this._snackBar.open(t,n,{horizontalPosition:"right",verticalPosition:"bottom",duration:4e3,panelClass:"snackBar-"+i})}}return o.\u0275fac=function(t){return new(t||o)(e.Y36(c.qu),e.Y36(x.ux),e.Y36(b.u),e.Y36(R.C),e.Y36(g.so),e.Y36(g.WI))},o.\u0275cmp=e.Xpm({type:o,selectors:[["app-schedule-import-dialog"]],decls:39,vars:5,consts:[[3,"formGroup"],["cdkDrag","","cdkDragRootElement",".cdk-overlay-pane","cdkDragHandle","",1,"d-flex","align-items-center","justify-content-between","cursor-pointer","p-2","mt-2","mx-2"],[1,"mdi","mdi-close","mb-2",3,"click"],["style","height: 3px;","color","accent","mode","indeterminate",4,"ngIf"],[1,"mat-typography","p-4","background-color-form"],[1,"row","mb-3","d-flex","align-items-center"],[1,"col-md-12","mb-3"],[1,"text-muted",2,"font-size","13px"],["mat-stroked-button","",1,"mb-2",2,"background-color","#FFFFFF",3,"click"],[1,"mdi","mdi-download",2,"font-size","1.1rem","margin-right","10px"],[2,"font-weight","400"],[1,"col-md-12","mt-3"],[1,"form-label"],[1,"required"],[1,"file-info-text"],[1,"text-muted","small"],[2,"font-weight","600"],[1,"custom-file-upload"],["type","file","id","fileInput","formControlName","file","hidden","","accept",".xlsx, .xls",3,"change"],["for","fileInput",1,"file-label"],[1,"mdi","mdi-file-excel",2,"color","green","font-size","1.1rem"],["cdkDrag","","cdkDragRootElement",".cdk-overlay-pane","cdkDragHandle","","align","end",1,"cursor-pointer","p-2","mt-1","mx-2","mb-1"],["mat-button","","color","accent",3,"disabled","click"],["color","accent","mode","indeterminate",2,"height","3px"]],template:function(t,n){1&t&&(e.TgZ(0,"form",0)(1,"div",1)(2,"h6"),e._uU(3),e.qZA(),e.TgZ(4,"i",2),e.NdJ("click",function(){return n.closeDialog()}),e.qZA()(),e._UZ(5,"mat-divider"),e.YNc(6,j,1,0,"mat-progress-bar",3),e.TgZ(7,"div",4)(8,"div",5)(9,"div",6)(10,"p",7),e._uU(11," Disponibilizamos uma planilha de exemplo para facilitar o processo de importa\xe7\xe3o. Certifique-se de seguir o modelo para garantir que os dados sejam importados corretamente pelo sistema. "),e.qZA(),e.TgZ(12,"button",8),e.NdJ("click",function(){return n.downloadSheetExample()}),e._UZ(13,"i",9),e.TgZ(14,"span",10),e._uU(15,"Baixar Planilha Exemplo"),e.qZA()()(),e._UZ(16,"mat-divider"),e.TgZ(17,"div",11)(18,"label",12),e._uU(19,"Escolha o arquivo"),e.qZA(),e.TgZ(20,"span",13),e._uU(21,"*"),e.qZA(),e.TgZ(22,"div",14)(23,"p",15),e._uU(24,"Apenas arquivos .xlsx ou .xls s\xe3o permitidos."),e.qZA(),e.TgZ(25,"p",15),e._uU(26,"Tamanho m\xe1ximo: "),e.TgZ(27,"span",16),e._uU(28,"10MB."),e.qZA()()(),e.TgZ(29,"div",17)(30,"input",18),e.NdJ("change",function(a){return n.onFileSelected(a)}),e.qZA(),e.TgZ(31,"label",19),e._UZ(32,"i",20),e.TgZ(33,"span"),e._uU(34),e.qZA()()()()()(),e._UZ(35,"mat-divider"),e.TgZ(36,"div",21)(37,"button",22),e.NdJ("click",function(){return n.importFile(!0)}),e._uU(38,"Importar"),e.qZA()()()),2&t&&(e.Q6J("formGroup",n.form),e.xp6(3),e.Oqu("Importar Agendamentos"),e.xp6(3),e.Q6J("ngIf",n.loading),e.xp6(28),e.Oqu(n.selectedFileName||"Escolher Arquivo Excel"),e.xp6(3),e.Q6J("disabled",!n.canSave()))},dependencies:[p.O5,h.Zt,h.Bh,C.lW,Z.d,y.pW,c._Y,c.Fj,c.JJ,c.JL,c.sg,c.u],styles:[".required[_ngcontent-%COMP%]{color:#ea0505;margin-left:5px}.small-toggle[_ngcontent-%COMP%]{transform:scale(.75);margin:0}.small-toggle[_ngcontent-%COMP%]   .mat-slide-toggle-thumb[_ngcontent-%COMP%]{width:12px;height:12px}.small-toggle[_ngcontent-%COMP%]   .mat-slide-toggle-bar[_ngcontent-%COMP%]{height:14px}.file-info-text[_ngcontent-%COMP%]{margin-top:5px}.file-info-text[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{margin:0;line-height:1.4}.custom-file-upload[_ngcontent-%COMP%]{margin-top:18px;position:relative;display:inline-block}.file-label[_ngcontent-%COMP%]{display:flex;align-items:center;padding:8px 12px;border:1px solid #ccc;border-radius:4px;background-color:#fff;cursor:pointer;transition:background-color .3s ease}.file-label[_ngcontent-%COMP%]:hover{background-color:#f1f1f1}.file-label[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{margin-right:8px}"]}),o})();var D=l(5439),G=l(5664),V=l(6030),W=l(4530),K=l(508),w=l(6688),f=l(6856),v=l(288),A=l(7322),$=l(5245),X=l(7531),M=l(2181),ee=l(4107),U=l(6838);function te(o,r){1&o&&e._UZ(0,"mat-progress-bar",34)}function ne(o,r){if(1&o){const t=e.EpF();e.TgZ(0,"mat-select-filter",35),e.NdJ("filteredReturn",function(i){e.CHM(t);const a=e.oxw();return e.KtG(a.filteredPatients=i)}),e.qZA()}if(2&o){const t=e.oxw();e.Q6J("placeholder","Pesquisar")("displayMember","name")("array",t.patients)}}function ie(o,r){if(1&o&&(e.TgZ(0,"mat-option",18),e._uU(1),e.qZA()),2&o){const t=r.$implicit;e.Q6J("value",t.id),e.xp6(1),e.Oqu(t.name)}}function oe(o,r){if(1&o){const t=e.EpF();e.TgZ(0,"mat-select-filter",36),e.NdJ("filteredReturn",function(i){e.CHM(t);const a=e.oxw();return e.KtG(a.filteredCampaigns=i)}),e.qZA()}if(2&o){const t=e.oxw();e.Q6J("placeholder","Pesquisar")("displayMember","name")("array",t.campaigns)}}function ae(o,r){if(1&o&&(e.TgZ(0,"mat-option",18),e._uU(1),e.qZA()),2&o){const t=r.$implicit;e.Q6J("value",t.id),e.xp6(1),e.Oqu(t.name)}}function le(o,r){if(1&o&&e._UZ(0,"i",54),2&o){const t=e.oxw().$implicit;e.Q6J("matTooltip",t.notes)}}function re(o,r){if(1&o&&(e.TgZ(0,"div",55)(1,"div",56)(2,"span",57),e._uU(3),e.qZA(),e.TgZ(4,"span",58),e._uU(5),e.qZA()(),e.TgZ(6,"div",59)(7,"span",60),e._uU(8),e.ALo(9,"date"),e.qZA(),e.TgZ(10,"span",60),e._uU(11),e.qZA()()()),2&o){const t=r.$implicit;e.xp6(3),e.AsE("",t.vaccine.name," - ",t.dose_number,"\xaa Dose"),e.xp6(2),e.hij("Lote ",t.vaccine.batch,""),e.xp6(3),e.hij("Aplica\xe7\xe3o: ",e.xi3(9,5,t.application_date,"dd/MM/yyyy"),""),e.xp6(3),e.hij("Campanha: ",t.vaccine.campaign.name,"")}}function ce(o,r){if(1&o){const t=e.EpF();e.TgZ(0,"div")(1,"div",38)(2,"div",39)(3,"div",40)(4,"div",41)(5,"h5")(6,"i",42),e.NdJ("click",function(){const a=e.CHM(t).$implicit,s=e.oxw(2);return e.KtG(s.redirectToWhatsapp(a.patient.mobile))}),e.qZA(),e.TgZ(7,"span"),e._uU(8),e.qZA(),e.TgZ(9,"span",43),e._uU(10),e.qZA(),e.YNc(11,le,1,1,"i",44),e.qZA()()(),e.TgZ(12,"div",45)(13,"span",46),e._uU(14),e.ALo(15,"date"),e.qZA(),e._UZ(16,"i",47),e.TgZ(17,"mat-menu",null,48)(19,"button",49),e.NdJ("click",function(){const a=e.CHM(t).$implicit,s=e.oxw(2);return e.KtG(s.delete(a.id,a.patient.name))}),e._UZ(20,"i",50),e._uU(21," Excluir "),e.qZA()()()(),e.TgZ(22,"div",51)(23,"div",52),e.YNc(24,re,12,8,"div",53),e.qZA()()()()}if(2&o){const t=r.$implicit,n=e.MAs(18);e.xp6(8),e.Oqu(t.patient.name),e.xp6(2),e.hij(" - ",t.patient.cpf,""),e.xp6(1),e.Q6J("ngIf",t&&t.notes),e.xp6(3),e.hij("Data do Agendamento: ",e.xi3(15,6,t.schedule_date,"dd/MM/yyyy"),""),e.xp6(2),e.Q6J("matMenuTriggerFor",n),e.xp6(8),e.Q6J("ngForOf",t.applications)}}function se(o,r){if(1&o&&(e.ynx(0),e.YNc(1,ce,25,9,"div",37),e.BQk()),2&o){const t=e.oxw();e.xp6(1),e.Q6J("ngForOf",t.filteredSchedules)}}function de(o,r){1&o&&(e.TgZ(0,"div",61),e._UZ(1,"i",62),e.TgZ(2,"p"),e._uU(3,"Nenhum agendamento foi encontrado."),e.qZA()())}const pe=[{path:"",component:(()=>{class o{constructor(t,n,i,a,s,d,m,u,k,_e,ve){this._liveAnnouncer=t,this.formBuilder=n,this.dialog=i,this.confirmService=a,this._snackBar=s,this.scheduleService=d,this.patientService=m,this.campaignService=u,this.datePipe=k,this.router=_e,this.route=ve,this.loading=!1,this.selectedChip="today",this.patients=[],this.filteredPatients=[],this.schedules=[],this.filteredSchedules=[],this.campaigns=[],this.filteredCampaigns=[],this.isDateRangeInvalid=!1,this.displayedColumns=["patient","vaccine","schedule_date","application_date","doses","options"],this.dataSource=new q.by}ngOnInit(){this.initForm(),this.downloadPatients(),this.downloadCampaigns(),this.paramsVaccineApplicationFromURL()}ngAfterViewInit(){this.dataSource.sort=this.sort,this.dataSource.paginator=this.paginator}initForm(){var t,n;const i=new Date;this.form=this.formBuilder.group({from:new c.NI(i),to:new c.NI(i),patient_id:[""],campaign_id:[""],type:["schedule"]}),null===(t=this.form.get("from"))||void 0===t||t.valueChanges.subscribe(()=>this.checkDateRange()),null===(n=this.form.get("to"))||void 0===n||n.valueChanges.subscribe(()=>this.checkDateRange())}checkDateRange(){var t,n;const i=null===(t=this.form.get("from"))||void 0===t?void 0:t.value,a=null===(n=this.form.get("to"))||void 0===n?void 0:n.value;if(i&&a){const s=Math.abs(a.getTime()-i.getTime()),d=Math.ceil(s/864e5);this.isDateRangeInvalid=d>30}else this.isDateRangeInvalid=!1}applyFilter(t){const n=t.target.value.trim().toLowerCase();this.filteredSchedules=this.schedules.map(i=>{const a=i.applications.filter(s=>s.vaccine.name.toLowerCase().includes(n)||s.vaccine.batch&&s.vaccine.batch.toLowerCase()===n);return a.length>0?Object.assign(Object.assign({},i),{applications:a}):i.patient.name.toLowerCase().includes(n)?i:void 0}).filter(i=>void 0!==i)}openDialog(t){this.dialog.open(S,{width:"900px",maxHeight:"100vh",panelClass:"dialog",autoFocus:!1,data:{schedule:t}}).afterClosed().subscribe(i=>{i&&this.filterSchedules()})}openDialogImport(){this.dialog.open(H,{width:"550px",maxHeight:"100vh",panelClass:"dialog",autoFocus:!1}).afterClosed().subscribe(()=>{this.filterSchedules()})}filterSchedules(){var t,n,i,a;let s=this.datePipe.transform(null===(t=this.form.get("from"))||void 0===t?void 0:t.value,"yyyy-MM-dd"),d=this.datePipe.transform(null===(n=this.form.get("to"))||void 0===n?void 0:n.value,"yyyy-MM-dd"),m=null===(i=this.form.get("patient_id"))||void 0===i?void 0:i.value,u=null===(a=this.form.get("campaign_id"))||void 0===a?void 0:a.value;this.router.navigate([],{relativeTo:this.route,queryParams:{from:s,to:d||null},queryParamsHandling:"merge"}),this.downloadSchedules(s,d,m,u,"schedule")}downloadSchedules(t,n,i,a,s){this.loading=!0,this.scheduleService.list({from:t,to:n,patient_id:i,campaign_id:a,type:s}).then(d=>{this.schedules=d,this.filteredSchedules=d}).catch(d=>{this.openSnackBar("Erro ao listar agendamentos","Fechar","danger")}).finally(()=>{this.loading=!1})}downloadPatients(){this.loading=!0,this.patientService.list().then(t=>{this.patients=t,this.filteredPatients=this.patients.slice()}).catch(t=>{this.openSnackBar("Erro ao listar pacientes","Fechar","danger")}).finally(()=>{this.loading=!1})}downloadCampaigns(){this.loading=!0,this.campaignService.list().then(t=>{this.campaigns=t,this.filteredCampaigns=this.campaigns.slice()}).catch(t=>{this.openSnackBar("Erro ao listar campanhas","Fechar","danger")}).finally(()=>{this.loading=!1})}delete(t,n){this.confirmService.openConfirmDialog("Excluir","Tem certeza que deseja excluir o agendamento do paciente "+n+" ?","Cancelar","Excluir").afterClosed().subscribe(i=>{i&&(this.loading=!0,this.scheduleService.delete(t).then(()=>{this.filterSchedules(),this.openSnackBar("Exclu\xeddo com sucesso!","Fechar","success")}).catch(a=>{this.openSnackBar(a.error.message,"Fechar","danger")}).finally(()=>{this.loading=!1}))})}openSnackBar(t,n,i){this._snackBar.open(t,n,{horizontalPosition:"right",verticalPosition:"bottom",duration:4e3,panelClass:"snackBar-"+i})}setDateRange(t){var n,i;this.selectedChip=t;const a=new Date;let s,d;switch(t){case"today":s=d=a;break;case"tomorrow":s=d=new Date(a),s.setDate(a.getDate()+1);break;case"dayAfterTomorrow":s=d=new Date(a),s.setDate(a.getDate()+2);break;default:return}const m=this.datePipe.transform(s,"yyyy-MM-dd"),u=this.datePipe.transform(d,"yyyy-MM-dd");this.form.patchValue({from:s,to:d}),this.router.navigate([],{relativeTo:this.route,queryParams:{from:m,to:u},queryParamsHandling:"merge"}),this.downloadSchedules(m,u,null===(n=this.form.get("patient_id"))||void 0===n?void 0:n.value,null===(i=this.form.get("campaign_id"))||void 0===i?void 0:i.value,"schedule")}paramsVaccineApplicationFromURL(){const t=this.route.snapshot.queryParams,n=t.from,i=t.to;n&&i?(this.form.patchValue({from:D(n,"YYYY-MM-DD").toDate(),to:D(i,"YYYY-MM-DD").toDate()}),this.filterSchedules()):this.filterSchedules()}redirectToWhatsapp(t){const i=`https://api.whatsapp.com/send/?phone=${t.replace(/\D/g,"")}`;window.open(i,"_blank")}}return o.\u0275fac=function(t){return new(t||o)(e.Y36(G.Kd),e.Y36(c.qu),e.Y36(g.uw),e.Y36(V.x),e.Y36(x.ux),e.Y36(b.u),e.Y36(F.e),e.Y36(W.U),e.Y36(p.uU),e.Y36(_.F0),e.Y36(_.gz))},o.\u0275cmp=e.Xpm({type:o,selectors:[["app-schedule-list"]],viewQuery:function(t,n){if(1&t&&(e.Gf(J.NW,5),e.Gf(N.YE,5)),2&t){let i;e.iGM(i=e.CRH())&&(n.paginator=i.first),e.iGM(i=e.CRH())&&(n.sort=i.first)}},decls:65,vars:22,consts:[[1,"d-flex","align-items-center","justify-content-between","p-2"],["mat-raised-button","","color","accent",1,"style-button-add",2,"margin-left","auto","margin-right","15px",3,"click"],["mat-raised-button","","color","primary",1,"style-button-add",2,"width","120px",3,"click"],[1,"mdi","mdi-file-excel","mx-1"],[1,"mt-3"],["style","height: 3px;","color","accent","mode","indeterminate",4,"ngIf"],[1,"mt-4",3,"formGroup"],[1,"filter-schedule"],[1,"mx-1"],["appearance","standard",1,"col-md-3","margin-right-selector"],[2,"font-size","15px",3,"rangePicker"],["matStartDate","","formControlName","from"],["matEndDate","","formControlName","to"],["matSuffix","",3,"for"],["picker",""],["formControlName","patient_id",3,"disableOptionCentering"],["select",""],["noResultsMessage","Nenhum paciente encontrado.",3,"placeholder","displayMember","array","filteredReturn",4,"ngIf"],[3,"value"],[3,"value",4,"ngFor","ngForOf"],["appearance","standard",1,"col-md-2","margin-right-selector"],["formControlName","campaign_id",3,"disableOptionCentering"],["select1",""],["noResultsMessage","Nenhuma campanha encontrada.",3,"placeholder","displayMember","array","filteredReturn",4,"ngIf"],["mat-raised-button","","color","primary",2,"height","35px","font-size","13px",3,"disabled","matTooltip","click"],[1,"header-cards"],[1,"search_input_group"],[1,"mdi","mdi-magnify"],["matInput","","placeholder","Pesquisar",1,"search_input",3,"input"],["input",""],["color","primary",3,"ngClass","selected","click"],[1,"scrollable-content"],[4,"ngIf","ngIfElse"],["noData",""],["color","accent","mode","indeterminate",2,"height","3px"],["noResultsMessage","Nenhum paciente encontrado.",3,"placeholder","displayMember","array","filteredReturn"],["noResultsMessage","Nenhuma campanha encontrada.",3,"placeholder","displayMember","array","filteredReturn"],[4,"ngFor","ngForOf"],[1,"schedule-card-horizontal"],[1,"card-header"],[1,"left-content","d-flex","justify-content-between","align-items-center"],[1,"card-title","mx-3","mt-2","d-flex","align-items-center"],["matTooltip","WhatsApp",1,"mdi","mdi-whatsapp","icon-whatsapp",3,"click"],[1,"patient-cpf"],["class","mdi mdi-sticker-text mx-2",3,"matTooltip",4,"ngIf"],[1,"right-actions"],[1,"schedule-date"],["matTooltip","Mais op\xe7\xf5es",1,"mdi","mdi-dots-vertical",3,"matMenuTriggerFor"],["menu","matMenu"],["mat-menu-item","",1,"items-menu",3,"click"],[1,"mdi","mdi-delete","icon-delete","mx-1"],[1,"vaccine-details","mx-3"],[1,"vaccine-row"],["class","vaccine-info",4,"ngFor","ngForOf"],[1,"mdi","mdi-sticker-text","mx-2",3,"matTooltip"],[1,"vaccine-info"],[1,"vaccine-header"],[1,"vaccine-name"],[1,"vaccine-lot"],[1,"d-flex","align-items-center","justify-content-between"],[1,"application-date"],[1,"empty-state"],[1,"mdi","mdi-needle"]],template:function(t,n){if(1&t&&(e.TgZ(0,"div",0)(1,"h3"),e._uU(2,"Agendamentos"),e.qZA(),e.TgZ(3,"button",1),e.NdJ("click",function(){return n.openDialog()}),e._uU(4,"Novo Agendamento"),e.qZA(),e.TgZ(5,"button",2),e.NdJ("click",function(){return n.openDialogImport()}),e._UZ(6,"i",3),e._uU(7,"Importar"),e.qZA()(),e._UZ(8,"mat-divider",4),e.YNc(9,te,1,0,"mat-progress-bar",5),e.TgZ(10,"form",6)(11,"mat-accordion")(12,"mat-expansion-panel",7)(13,"mat-expansion-panel-header")(14,"mat-panel-title")(15,"span"),e._uU(16,"Filtros"),e.qZA(),e.TgZ(17,"mat-icon",8),e._uU(18,"filter_list"),e.qZA()()(),e.TgZ(19,"mat-form-field",9)(20,"mat-label"),e._uU(21,"Data do Agendamento"),e.qZA(),e.TgZ(22,"mat-date-range-input",10),e._UZ(23,"input",11)(24,"input",12),e.qZA(),e._UZ(25,"mat-datepicker-toggle",13)(26,"mat-date-range-picker",null,14),e.qZA(),e.TgZ(28,"mat-form-field",9)(29,"mat-label"),e._uU(30,"Paciente"),e.qZA(),e.TgZ(31,"mat-select",15,16),e.YNc(33,ne,1,3,"mat-select-filter",17),e.TgZ(34,"mat-option",18),e._uU(35,"Todos"),e.qZA(),e.YNc(36,ie,2,2,"mat-option",19),e.qZA()(),e.TgZ(37,"mat-form-field",20)(38,"mat-label"),e._uU(39,"Campanha"),e.qZA(),e.TgZ(40,"mat-select",21,22),e.YNc(42,oe,1,3,"mat-select-filter",23),e.TgZ(43,"mat-option",18),e._uU(44,"Todos"),e.qZA(),e.YNc(45,ae,2,2,"mat-option",19),e.qZA()(),e.TgZ(46,"button",24),e.NdJ("click",function(){return n.filterSchedules()}),e._uU(47,"Filtrar"),e.qZA()()()(),e.TgZ(48,"div",25)(49,"div",26),e._UZ(50,"i",27),e._uU(51,"\xa0 "),e.TgZ(52,"input",28,29),e.NdJ("input",function(a){return n.applyFilter(a)}),e.qZA()(),e.TgZ(54,"mat-chip-list")(55,"mat-chip",30),e.NdJ("click",function(){return n.setDateRange("today")}),e._uU(56," Hoje "),e.qZA(),e.TgZ(57,"mat-chip",30),e.NdJ("click",function(){return n.setDateRange("tomorrow")}),e._uU(58," Amanh\xe3 "),e.qZA(),e.TgZ(59,"mat-chip",30),e.NdJ("click",function(){return n.setDateRange("dayAfterTomorrow")}),e._uU(60," Depois de Amanh\xe3 "),e.qZA()()(),e.TgZ(61,"div",31),e.YNc(62,se,2,1,"ng-container",32),e.qZA(),e.YNc(63,de,4,0,"ng-template",null,33,e.W1O)),2&t){const i=e.MAs(27),a=e.MAs(32),s=e.MAs(41),d=e.MAs(64);e.xp6(9),e.Q6J("ngIf",n.loading),e.xp6(1),e.Q6J("formGroup",n.form),e.xp6(12),e.Q6J("rangePicker",i),e.xp6(3),e.Q6J("for",i),e.xp6(6),e.Q6J("disableOptionCentering",!0),e.xp6(2),e.Q6J("ngIf",a.focused),e.xp6(1),e.Q6J("value",""),e.xp6(2),e.Q6J("ngForOf",n.filteredPatients),e.xp6(4),e.Q6J("disableOptionCentering",!0),e.xp6(2),e.Q6J("ngIf",s.focused),e.xp6(1),e.Q6J("value",""),e.xp6(2),e.Q6J("ngForOf",n.filteredCampaigns),e.xp6(1),e.Q6J("disabled",n.isDateRangeInvalid)("matTooltip",n.isDateRangeInvalid?"O intervalo de datas n\xe3o pode ser maior que 30 dias.":""),e.xp6(9),e.Q6J("ngClass","today"===n.selectedChip?"selected-white":"selected-black")("selected","today"===n.selectedChip),e.xp6(2),e.Q6J("ngClass","tomorrow"===n.selectedChip?"selected-white":"selected-black")("selected","tomorrow"===n.selectedChip),e.xp6(2),e.Q6J("ngClass","dayAfterTomorrow"===n.selectedChip?"selected-white":"selected-black")("selected","dayAfterTomorrow"===n.selectedChip),e.xp6(3),e.Q6J("ngIf",n.filteredSchedules&&n.filteredSchedules.length)("ngIfElse",d)}},dependencies:[p.mk,p.sg,p.O5,K.ey,C.lW,w.qn,w.HS,f.nW,f.wx,f.zY,f.By,f._g,v.pp,v.ib,v.yz,v.yK,A.KE,A.hX,A.R9,$.Hw,X.Nt,Z.d,M.VK,M.OP,M.p6,y.pW,ee.gD,O.gM,c._Y,c.Fj,c.JJ,c.JL,c.sg,c.u,U.Fq,p.uU],styles:['h3[_ngcontent-%COMP%]{font-size:23px}.header-cards[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;margin-top:20px;margin-bottom:20px}.search_input_group[_ngcontent-%COMP%]{display:flex;align-items:center;background:white;width:300px}.search_input[_ngcontent-%COMP%]{border:none;outline:none;padding:5px}.card-header[_ngcontent-%COMP%]{display:flex;padding:4px;border-radius:6px 6px 0 0;background-color:#f4f6f8;border-bottom:1px solid #ddd}.card-title[_ngcontent-%COMP%]   h5[_ngcontent-%COMP%]{font-size:15px;display:flex}.total-dose[_ngcontent-%COMP%]{margin-bottom:-10px;font-size:14px;color:#444;font-weight:500;float:right}.schedule-date[_ngcontent-%COMP%]{font-size:14.5px;font-weight:400;color:#424242;border-radius:4px;white-space:nowrap;margin-left:auto;position:relative}.vaccine-info[_ngcontent-%COMP%]{display:flex;justify-content:space-between;font-size:14px;line-height:25px;color:#555}.card-actions[_ngcontent-%COMP%]{display:flex;gap:10px;margin-top:15px}.no-data[_ngcontent-%COMP%]{text-align:center;color:#888;font-size:16px}.schedule-card-horizontal[_ngcontent-%COMP%]{background-color:#fff;border-radius:6px;border:1px solid #ddd;margin-bottom:10px}.right-actions[_ngcontent-%COMP%]{display:flex;gap:15px;margin-left:auto;margin-right:20px;align-items:center}.icon-edit[_ngcontent-%COMP%]{cursor:pointer;font-size:20px;color:#565656;transition:color .3s ease}.icon-delete[_ngcontent-%COMP%]{cursor:pointer;font-size:20px;color:#ee0606;transition:color .3s ease}.items-menu[_ngcontent-%COMP%]{height:34px;display:flex;align-items:center;font-size:13px}  .mat-menu-panel{min-width:112px;max-width:280px;overflow:auto;-webkit-overflow-scrolling:touch;max-height:calc(100vh - 48px);border-radius:4px;outline:0;min-height:0!important;position:relative}.vaccine-details[_ngcontent-%COMP%]{border-radius:4px;margin-bottom:20px;margin-top:20px}.vaccine-row[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:20px}.vaccine-info[_ngcontent-%COMP%]{width:23.9%;display:flex;justify-content:center;flex-direction:column;padding:10px;background-color:#fff;border:1px solid #ddd;border-radius:4px}@media (max-width: 1024px){.vaccine-info[_ngcontent-%COMP%]{width:48%}}@media (max-width: 768px){.vaccine-info[_ngcontent-%COMP%]{width:100%}}.vaccine-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;font-size:15px;font-weight:700;color:#0798da}.vaccine-name[_ngcontent-%COMP%]{font-weight:600;font-size:14px}.vaccine-lot[_ngcontent-%COMP%]{font-size:13px;color:#8b98a4;font-style:italic;font-weight:500}.application-date[_ngcontent-%COMP%]{font-size:13.5px;font-weight:400;color:#424242;line-height:20px}.mdi-sticker-text[_ngcontent-%COMP%]:before{content:"\\f178e";font-size:15px;color:#565656}.mat-chip.mat-standard-chip.mat-chip-selected.mat-accent[_ngcontent-%COMP%]{background-color:#434343}.empty-state[_ngcontent-%COMP%]{display:flex;font-family:Poppins,sans-serif;flex-direction:column;align-items:center;justify-content:center;height:140px;color:#888;font-size:18px;text-align:center}.mdi-needle[_ngcontent-%COMP%]:before{content:"\\f0391";font-size:50px}.margin-right-selector[_ngcontent-%COMP%]{margin-right:20px}.filter-schedule[_ngcontent-%COMP%]{border:1px solid #ddd;box-shadow:none;border-radius:6px}.selected-white[_ngcontent-%COMP%]{color:#fff}.selected-black[_ngcontent-%COMP%]{color:#242424}.patient-cpf[_ngcontent-%COMP%]{font-size:14px;font-weight:400;color:#424242}.scrollable-content[_ngcontent-%COMP%]{max-height:510px;overflow-y:auto}.icon-whatsapp[_ngcontent-%COMP%]{color:#25d366;cursor:pointer;margin-left:-5px;margin-right:10px}']}),o})()},{path:"new",component:S},{path:":id/edit",component:S}];let me=(()=>{class o{}return o.\u0275fac=function(t){return new(t||o)},o.\u0275mod=e.oAB({type:o}),o.\u0275inj=e.cJS({imports:[_.Bz.forChild(pe),_.Bz]}),o})();var ue=l(4540),ge=l(79),he=l(5539);let fe=(()=>{class o{}return o.\u0275fac=function(t){return new(t||o)},o.\u0275mod=e.oAB({type:o}),o.\u0275inj=e.cJS({imports:[p.ez,me,h._t,ue.m,c.UX,ge.Tx,he.JB,T.A0,U.FF]}),o})()}}]);

Zerion Mini Shell 1.0