{"version":3,"sources":["webpack:///src/app/modules/external-document-v2/external-document-v2.component.ts","webpack:///src/app/modules/external-document-v2/external-document-v2.component.html","webpack:///src/app/modules/external-document-v2/external-document-v2.component.scss","webpack:///src/app/modules/external-document-v2/external-document-v2.routing.module.ts","webpack:///src/app/modules/external-document-v2/external-document-v2.module.ts"],"names":["router","route","fb","healthProfessionalService","patientService","petService","prescriptionService","infusionService","attestationService","examService","orientationService","prescriptionModelService","attestationModelService","examModelService","orientationModelService","victaProtocolService","notification","documentService","modalService","nzModalService","themeService","coreService","cdf","clientAppService","super","actualDate","Date","nzBackfill","isPatientNotFound","search","loading","tabDefault","isMobile","isLoadingSearchPatient","destroyed$","ReplaySubject","event","this","isViewPortMobile","init","detectChanges","patient","cpf","code","patientId","callbackUrl","payload","response","resend","title","isPet","colorSetting","modalSendDocumentComponent","createTplModal","sendDocumentRequired","isSendDocumentRequired","showDownloadSignedPdf","doNotShowModalSuccessSendDocument","closeModal","subscribe","sent","console","log","params","petId","queryParams","URLSearchParams","toString","url","window","location","href","selectedDocumentModel","examList","document","patientForm","get","value","notify","adding","patients","setValue","replace","saveDocument","doc","documentForm","getRawValue","documentSaved","isVeterinarian","pet","local","cid","valueCid","documentType","save","prescriber","userId","pipe","take","toPromise","type","valid","warn","err","status","error","message","cidValues","items","map","item","id","documentTypes","prescription","selectPrescriptionLayout","previewPdf","layout","getActiveTheme","name","generateAndOpenPdf","navigate","signPdf","version","getUrlToSignDocument","_id","token","request","showSendDocumentOnCallback","ui","victaFeature","supportedVersion","method","patientDoesNotHaveAddress","responsible","responsibleDoesNotHaveAddress","modalSelectLayout","selectLayout","async","addressValue","data","updatedPatient","updateAddressPatient","savedDocumentAndPreviewPdfOrSignPdf","dateOfBirth","DateUtils","isUnderAge","address","cep","city","uf","Promise","resolve","reject","restData","dataPatient","update","next","complete","groups","getProtocols","professionalType","show","initialState","backdrop","content","selectEvent","protocol","documentsTemplate","getListDocumentsTemplates","length","hideEdit","showFavoritePrescriptionsModel","modal","model","deleteEvent","modelId","hide","confirm","nzTitle","nzContent","nzOnOk","deleteDocumentModel","nzOnCancel","prescriberId","typesOfDocuments","deleteById","getListByPrescriberId","filter","documentTemplate","documentModel","class","keyboard","msg","getFormError","static","a","nativeAsync","selector","template","routes","path","component","redirectTo","ExternalDocumentV2RoutingModule","imports","forChild","exports","ExternalDocumentV2Module","declarations","PatientsModule","DocumentV2Module","forRoot"],"mappings":"wtBAiDa,EAA2B,cAAS,IAqC/C,YACYA,EACAC,EACAC,EACAC,EACAC,EACAC,EACFC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACEC,EACFC,EACAC,EACAC,EACEC,EACFC,EACEC,GAEVC,MACExB,EACAC,EACAC,EACAmB,EACAJ,EACAd,EACAC,EACAC,EACAkB,GAlCQ,KAAAvB,SACA,KAAAC,QACA,KAAAC,KACA,KAAAC,4BACA,KAAAC,iBACA,KAAAC,aACF,KAAAC,sBACA,KAAAC,kBACA,KAAAC,qBACA,KAAAC,cACA,KAAAC,qBACA,KAAAC,2BACA,KAAAC,0BACA,KAAAC,mBACA,KAAAC,0BACA,KAAAC,uBACA,KAAAC,eACE,KAAAC,kBACF,KAAAC,eACA,KAAAC,iBACA,KAAAC,eACE,KAAAC,cACF,KAAAC,MACE,KAAAC,mBA3DZ,KAAAE,WAAa,IAAIC,KACjB,KAAAC,YAAa,EACb,KAAAC,mBAAoB,EACpB,KAAAC,QAAS,EACT,KAAAC,SAAU,EAOV,KAAAC,WAAa,mBAEb,KAAAC,UAAW,EACX,KAAAC,wBAAyB,EAcjB,KAAAC,WAAqC,IAAIC,EAAA,EAGjD,SAASC,GACPC,KAAKL,SAAWK,KAAKhB,YAAYiB,mBA0CnC,uBACE,MAAO,OAGT,WACED,KAAKE,OAGP,wBACEF,KAAKf,IAAIkB,gBAGX,kBACE,OAAOH,KAAKI,UAAYJ,KAAKI,QAAQC,IAAM,gCAA+B,0BAG5E,sBACEC,EACAC,GACA,YACEC,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A,E,qJAQD,aADCA,EAAA,E,mJAyFD,SAAAD,EAAA,EADCC,EAAA,E,wJAiBD,aADCA,EAAA,E,8JAaD,SAAAD,EAAA,EADCC,EAAA,E,qJAsBD,aADCA,EAAA,E,2JA6GD,SAAAD,EAAA,EADCC,EAAA,E,uLAeD,SAAAD,EAAA,EADCC,EAAA,E,yJAsBD,SAAAD,EAAA,EADCC,EAAA,E,oKAwDD,aADCA,EAAA,E,uKAkBD,aADCA,EAAA,E,gKArgBU,EAA2B,aALvC,YAAU,CACTC,SAAU,2BACVC,SC9Ca,g9M,QCAA,kmR,iCFuFO,IACD,IACH,IACuB,IACX,IACJ,IACO,IACJ,IACG,IACP,IACO,IACM,IACD,IACP,IACO,IACH,IACR,IACK,IACL,IACE,IACF,IACC,IACV,IACe,OA7DnB,GG7Cb,MAAMC,EAAiB,CACrB,CAAEC,KAAM,aAAcC,UAAW,GACjC,CAAED,KAAM,cAAeC,UAAW,GAClC,CAAED,KAAM,GAAIE,WAAY,Q,IAObC,EAA+B,QAA/BA,EAA+B,aAJ3C,YAAS,CACRC,QAAS,CAAC,IAAaC,SAASN,IAChCO,QAAS,CAAC,QAECH,G,ICsBAI,EAAwB,QAAxBA,EAAwB,aApBpC,YAAS,CACRC,aAAc,CAAC,GACfF,QAAS,CAAC,GACVF,QAAS,CACP,IACA,IACAD,EACA,EAAAM,eACA,IACA,EAAAC,iBACA,IAAiBC,QAAQ,IACzB,IACA,IACA,IACA,IACA,IAAcA,UACd,IACA,IAAYA,cAGHJ","file":"x","sourcesContent":["import {\n  AfterContentChecked,\n  ChangeDetectorRef,\n  Component,\n  HostListener,\n  OnDestroy,\n  OnInit,\n  ViewChild\n} from '@angular/core';\nimport { FormBuilder } from '@angular/forms';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { CoreService } from '@app/core/services/core.service';\nimport { AttestationService } from '@app/modules/document-v2/pages/attestation/attestation.service';\nimport { ModalIframeComponent } from '@app/modules/document-v2/pages/modal-iframe/modal-iframe.component';\nimport { ModalSelectLayoutComponent } from '@app/modules/document-v2/pages/modal-select-layout/modal-select-layout.component';\nimport { ModelAddFavoriteDocumentComponent } from '@app/modules/document-v2/pages/model-add-favorite-document/model-add-favorite-document.component';\nimport { ModelListFavoriteDocumentComponent } from '@app/modules/document-v2/pages/model-list-favorite-document/model-list-favorite-document.component';\nimport { OrientationService } from '@app/modules/document-v2/pages/orientation/orientation.service';\nimport { PrescriptionService } from '@app/modules/document/services/prescription.service';\nimport { HealthProfessionalService } from '@app/modules/health-professional/services/health-professional.service';\nimport { PatientsService } from '@app/modules/patients/services/patients.service';\nimport { ModalSendDocumentComponent } from '@app/shared/components/modal-send-document/modal-send-document.component';\nimport { DateUtils } from '@app/shared/data/DateUtils';\nimport { Comercial, HealthProfessional, Patient } from '@app/shared/models';\nimport { AppToastService } from '@app/shared/services/app-toast.service';\nimport { ThemeService } from '@app/theme';\nimport { NzModalService } from 'ng-zorro-antd/modal';\nimport { BsModalService } from 'ngx-bootstrap/modal';\nimport { Observable, ReplaySubject } from 'rxjs';\nimport { take } from 'rxjs/operators';\nimport { ModalListVictaProtocolComponent } from '../document/pages/modal-list-victa-protocol/modal-list-victa-protocol.component';\nimport { AttestationModelService } from '../document/services/attestation-model.service';\nimport { DocumentService } from '../document/services/document.service';\nimport { ExamModelService } from '../document/services/exam-model.service';\nimport { ExamService } from '../document/services/exam.service';\nimport { InfusionService } from '../document/services/infusion.service';\nimport { OrientationModelService } from '../document/services/orientation-model.service';\nimport { PrescriptionModelService } from '../document/services/prescription-model.service';\nimport { VictaProtocolService } from '../document/services/victa-protocol.service';\nimport { BaseExternalDocumentComponent } from '../external-document/base-external-document.component';\nimport { ClientAppService } from '../external-document/services/client-app.service';\nimport { PetPatientService } from '../patients/services/pet-patient.service';\nimport { nativeAsync } from '@app/shared/decorators/nativeAsync';\n\n@Component({\n  selector: 'app-external-document-v2',\n  templateUrl: './external-document-v2.component.html',\n  styleUrls: ['./external-document-v2.component.scss']\n})\nexport class ExternalDocumentV2Component extends BaseExternalDocumentComponent\n  implements OnInit, OnDestroy, AfterContentChecked {\n  actualDate = new Date();\n  nzBackfill = false;\n  isPatientNotFound = false;\n  search = true;\n  loading = false;\n\n  patients: Patient[];\n\n  manipulatedProfile: any;\n  selectedDocumentModel: any;\n\n  tabDefault = 'Prescrição';\n  backendVersion$: Observable<string>;\n  isMobile = false;\n  isLoadingSearchPatient = false;\n\n  @ViewChild('addPatient')\n  addPatient: any;\n\n  @ViewChild(ModalSendDocumentComponent, { static: true })\n  modalSendDocumentComponent: ModalSendDocumentComponent;\n\n  @ViewChild(ModalSelectLayoutComponent, { static: true })\n  modalSelectLayout: ModalSelectLayoutComponent;\n\n  @ViewChild(ModalIframeComponent, { static: true })\n  modalIframe: ModalIframeComponent;\n\n  private destroyed$: ReplaySubject<boolean> = new ReplaySubject<boolean>();\n\n  @HostListener('window:resize', ['$event'])\n  onResize(event) {\n    this.isMobile = this.coreService.isViewPortMobile();\n  }\n\n  constructor(\n    protected router: Router,\n    protected route: ActivatedRoute,\n    protected fb: FormBuilder,\n    protected healthProfessionalService: HealthProfessionalService,\n    protected patientService: PatientsService,\n    protected petService: PetPatientService,\n    private prescriptionService: PrescriptionService,\n    private infusionService: InfusionService,\n    private attestationService: AttestationService,\n    private examService: ExamService,\n    private orientationService: OrientationService,\n    private prescriptionModelService: PrescriptionModelService,\n    private attestationModelService: AttestationModelService,\n    private examModelService: ExamModelService,\n    private orientationModelService: OrientationModelService,\n    private victaProtocolService: VictaProtocolService,\n    private notification: AppToastService,\n    protected documentService: DocumentService,\n    private modalService: BsModalService,\n    private nzModalService: NzModalService,\n    private themeService: ThemeService,\n    protected coreService: CoreService,\n    private cdf: ChangeDetectorRef,\n    protected clientAppService: ClientAppService\n  ) {\n    super(\n      router,\n      route,\n      fb,\n      coreService,\n      documentService,\n      healthProfessionalService,\n      patientService,\n      petService,\n      clientAppService\n    );\n  }\n\n  get supportedVersion() {\n    return 'BETA';\n  }\n\n  ngOnInit() {\n    this.init();\n  }\n\n  ngAfterContentChecked(): void {\n    this.cdf.detectChanges();\n  }\n\n  get showCpfText() {\n    return this.patient && !this.patient.cpf ? 'Mostrar CPF do Responsável' : 'Mostrar CPF do Paciente';\n  }\n\n  showSendDocumentModal(\n    code: string,\n    patientId: string,\n    {\n      callbackUrl = '',\n      payload = '',\n      response = '',\n      resend = false,\n      title = '',\n      isPet = false,\n      colorSetting = {}\n    } = {}\n  ): void {\n    this.modalSendDocumentComponent.createTplModal(code, patientId, {\n      sendDocumentRequired: this.isSendDocumentRequired,\n      showDownloadSignedPdf: false,\n      resend,\n      title,\n      isPet,\n      colorSetting,\n      doNotShowModalSuccessSendDocument: true\n    });\n\n    this.modalSendDocumentComponent.closeModal.subscribe((sent: boolean) => {\n      if (sent) {\n        console.log('Documento enviado');\n      } else {\n        console.log('Envio cancelado');\n      }\n\n      if (callbackUrl) {\n        const params: any = { code, payload };\n        if (isPet) {\n          params.petId = patientId;\n        } else {\n          params.patientId = patientId;\n        }\n        params.response = response; // last query param\n        const queryParams = new URLSearchParams(params).toString();\n        const url = `${callbackUrl}?${queryParams}`;\n        window.location.href = url;\n      }\n    });\n  }\n\n  get examList(): void {\n    if (this.selectedDocumentModel) {\n      return this.selectedDocumentModel.examList;\n    }\n    return this.document && this.document.examList;\n  }\n\n  toggleAdding() {\n    if (this.patientForm.get('_id').value === null) {\n      this.notification.notify('warning', 'Aviso', 'Você precisa selecionar um paciente para iniciar');\n    } else {\n      this.adding = !this.adding;\n    }\n  }\n\n  handleCancel() {\n    this.patients = [];\n    this.patientForm\n      .get('name')\n      .setValue(this.patientForm.get('name').value.replace(/(Adicionar paciente )/gim, ''));\n  }\n  @nativeAsync\n  async updateDocument() {\n    this.loading = true;\n    await this.saveDocument();\n    this.notification.notify('success', 'Documento salvo com sucesso!', '');\n    this.loading = false;\n  }\n  @nativeAsync\n  private async saveDocument() {\n    try {\n      const doc = this.documentForm.getRawValue();\n      const patient = this.patientForm.value;\n      if (this.isVeterinarian) {\n        doc.pet = patient;\n      } else {\n        doc.patient = patient;\n      }\n      doc.local = this.local;\n      doc.code = this.document && this.document.code;\n      doc.cid = this.valueCid;\n\n      let documentSaved: any;\n      switch (this.documentType) {\n        case 'Prescrição':\n          documentSaved = await this.prescriptionService\n            .save({ prescriber: this.prescriber.userId, ...doc })\n            .pipe(take(1))\n            .toPromise();\n          documentSaved.type = 'prescription';\n          break;\n        case 'Atestado':\n          documentSaved = await this.attestationService\n            .save({ prescriber: this.prescriber.userId, ...doc })\n            .toPromise();\n          documentSaved.type = 'attestation';\n          break;\n        case 'Exame':\n          documentSaved = await this.examService\n            .save({ prescriber: this.prescriber.userId, ...doc })\n            .toPromise();\n          documentSaved.type = 'exam';\n          break;\n        case 'Outros':\n          if (!this.documentForm.valid) {\n            this.notification.notify('warning', 'Aviso', 'Orientações não pode ficar em branco');\n            this.loading = false;\n            return null;\n          }\n          documentSaved = await this.orientationService\n            .save({ prescriber: this.prescriber.userId, ...doc })\n            .toPromise();\n          documentSaved.type = 'orientation';\n          break;\n        case 'Infusão':\n          documentSaved = await this.infusionService\n            .save({ prescriber: this.prescriber.userId, ...doc })\n            .pipe(take(1))\n            .toPromise();\n          documentSaved.type = 'infusion';\n          break;\n        default:\n          console.warn('Document type unknown: ', this.documentType);\n          this.loading = false;\n          return null;\n      }\n      return documentSaved;\n    } catch (err) {\n      if (err.status === 400) {\n        this.notification.notify(\n          'error',\n          'Erro ao salvar documento',\n          err.error.error && err.error.error.message\n        );\n      } else {\n        this.notification.notify(\n          'error',\n          'Erro',\n          `Erro ao salvar um documento do tipo ${this.documentType}`\n        );\n      }\n      this.loading = false;\n      throw err;\n    }\n  }\n\n  get valueCid() {\n    if (this.documentForm.get('cid') && this.documentForm.get('cid').value) {\n      const cidValues = this.documentForm.get('cid').value;\n      return {\n        ...cidValues,\n        items: cidValues.items.map(item => item.id)\n      };\n    }\n    return null;\n  }\n  @nativeAsync\n  async saveAndPreviewPdf() {\n    if (this.documentType === this.documentTypes.prescription) {\n      this.selectPrescriptionLayout('preview');\n    } else {\n      try {\n        this.loading = true;\n        const documentSaved = await this.saveDocument();\n        await this.previewPdf(documentSaved);\n      } catch (err) {\n        console.error(err);\n      } finally {\n        this.loading = false;\n      }\n    }\n  }\n  @nativeAsync\n  private async previewPdf(documentSaved: any, layout = {}) {\n    try {\n      this.loading = true;\n      layout['theme'] = this.themeService.getActiveTheme().name;\n      await this.documentService.generateAndOpenPdf(documentSaved.code, layout);\n      this.router.navigate(['/document', documentSaved.code, 'edit']);\n    } catch (err) {\n      console.error(err);\n    }\n    this.loading = false;\n  }\n  @nativeAsync\n  async saveAndSignPdf() {\n    if (this.documentType === this.documentTypes.prescription) {\n      this.selectPrescriptionLayout('sign');\n    } else {\n      try {\n        this.loading = true;\n        const documentSaved = await this.saveDocument();\n        // TODO remover linha após virada de chave\n        await this.signPdf(documentSaved);\n      } catch (err) {\n        this.notification.notify(\n          'error',\n          'Erro Interno',\n          'Ocorreu um erro ao tentar executar o processo de assinatura do documento'\n        );\n        console.error(err);\n      }\n      this.loading = false;\n    }\n  }\n  @nativeAsync\n  private async signPdf({ code, version }, layout = {}) {\n    layout['theme'] = this.themeService.getActiveTheme().name;\n    const url = await this.documentService.getUrlToSignDocument({\n      code,\n      prescriber: this.prescriber,\n      patientId: this.patientForm.value._id,\n      layout,\n      token: this.token,\n      payload: this.payload,\n      callbackUrl: this.request.callbackUrl,\n      showSendDocumentOnCallback: this.request.ui && this.request.ui.showSendDocumentOnCallback,\n      victaFeature: this.victaFeature,\n      version: this.supportedVersion\n    });\n    window.location.href = url;\n  }\n\n  private selectPrescriptionLayout(method: string) {\n    let patientDoesNotHaveAddress = false;\n\n    if (this.patient && this.patient.responsible) {\n      if (this.patient.responsible) {\n        patientDoesNotHaveAddress = this.responsibleDoesNotHaveAddress();\n      } else {\n        patientDoesNotHaveAddress = this.patientDoesNotHaveAddress();\n      }\n    }\n\n    this.modalSelectLayout.createTplModal(\n      patientDoesNotHaveAddress,\n      this.isVeterinarian,\n      this.colorSetting\n    );\n\n    this.modalSelectLayout.selectLayout.pipe(take(1)).subscribe(async data => {\n      this.loading = true;\n      try {\n        const { layout, addressValue } = data;\n        if (layout === 'special' && patientDoesNotHaveAddress) {\n          const updatedPatient = await this.updateAddressPatient(addressValue);\n          if (this.patient.responsible) {\n            this.patient.responsible = updatedPatient;\n          } else {\n            this.patient = updatedPatient;\n          }\n        }\n        delete data.addressValue;\n        await this.savedDocumentAndPreviewPdfOrSignPdf(method, data);\n      } catch (err) {\n        console.error(err);\n        this.loading = false;\n      }\n    });\n  }\n\n  get isUnderAge() {\n    if (this.patient.dateOfBirth) {\n      return DateUtils.isUnderAge(this.patient.dateOfBirth);\n    }\n    return false;\n  }\n\n  private patientDoesNotHaveAddress() {\n    return (\n      !this.patient.address ||\n      (this.patient.address &&\n        !this.patient.address.cep &&\n        !this.patient.address.city &&\n        !this.patient.address.uf)\n    );\n  }\n\n  private responsibleDoesNotHaveAddress() {\n    return (\n      !this.patient.responsible ||\n      !this.patient.responsible.address ||\n      (this.patient.responsible.address &&\n        !this.patient.responsible.address.cep &&\n        !this.patient.responsible.address.city &&\n        !this.patient.responsible.address.uf)\n    );\n  }\n\n  updateAddressPatient(addressValue: any): Promise<Patient> {\n    return new Promise(async (resolve, reject) => {\n      try {\n        const isUpdateAndressPatiente = !this.patient.responsible;\n        const restData = isUpdateAndressPatiente ? this.patient : this.patient.responsible;\n        const dataPatient = {\n          ...restData,\n          address: {\n            ...addressValue\n          }\n        };\n        const patient = await this.patientService.update(restData._id, dataPatient).toPromise();\n        resolve(patient);\n      } catch (error) {\n        this.notification.notify(\n          'error',\n          'Error',\n          'Ocorreu um erro ao tentar atualizar endereço do paciente!'\n        );\n        this.loading = false;\n        reject(error);\n      }\n    });\n  }\n  @nativeAsync\n  async savedDocumentAndPreviewPdfOrSignPdf(method: string, data: {}) {\n    const documentSaved = await this.saveDocument();\n    if (method === 'preview') {\n      await this.previewPdf(documentSaved, data);\n    } else {\n      await this.signPdf(documentSaved, data);\n    }\n  }\n\n  ngOnDestroy(): void {\n    this.destroyed$.next(true);\n    this.destroyed$.complete();\n  }\n  @nativeAsync\n  async showVictaProtocols() {\n    try {\n      this.loading = true;\n      const groups = await this.victaProtocolService.getProtocols(this.prescriber.professionalType);\n      this.loading = false;\n\n      const modal = this.modalService.show(ModalListVictaProtocolComponent, {\n        initialState: { groups },\n        backdrop: 'static'\n      });\n\n      modal.content.selectEvent.subscribe(protocol => {\n        this.selectedDocumentModel = protocol;\n        this.adding = true;\n      });\n    } catch (err) {\n      this.loading = false;\n      this.notification.notify('warning', 'Aviso', 'Não foi possível recuperar protocolos');\n    }\n  }\n  @nativeAsync\n  async showModelListFavoriteDocument() {\n    try {\n      this.loading = true;\n      const documentsTemplate = await this.getListDocumentsTemplates();\n      this.loading = false;\n\n      if (documentsTemplate.length) {\n        const initialState = {\n          documentType: this.documentType,\n          documentsTemplate,\n          hideEdit: true,\n          colorSetting: this.colorSetting\n        };\n        this.showFavoritePrescriptionsModel(initialState);\n      } else {\n        this.notification.notify(\n          'warning',\n          'Aviso',\n          `Você ainda não possui modelos de ${this.documentType} cadastrados. Salve um modelo em Favoritos.`\n        );\n      }\n    } catch (err) {\n      this.loading = false;\n      this.notification.notify('warning', 'Aviso', 'Não foi possível recuperar a lista de modelos');\n    }\n  }\n\n  private showFavoritePrescriptionsModel(initialState: any) {\n    const modal = this.modalService.show(ModelListFavoriteDocumentComponent, {\n      initialState,\n      backdrop: 'static'\n    });\n    modal.content.selectEvent.subscribe(model => {\n      this.selectedDocumentModel = model;\n      this.adding = true;\n    });\n\n    modal.content.deleteEvent.subscribe((modelId: string) => {\n      modal.hide();\n      this.nzModalService.confirm({\n        nzTitle: 'Atenção',\n        nzContent: `Tem certeza que deseja excluir este modelo de ${this.documentType} da sua lista?`,\n        nzOnOk: async () => {\n          try {\n            await this.deleteDocumentModel(modelId, this.prescriber.userId);\n            this.notification.notify('success', 'Sucesso', 'Modelo excluído com sucesso');\n          } catch (err) {\n            this.notification.notify('warning', 'Aviso', 'Não foi possível excluir este item');\n          }\n        },\n        nzOnCancel: () => this.showFavoritePrescriptionsModel(initialState)\n      });\n    });\n  }\n  @nativeAsync\n  private async deleteDocumentModel(modelId: string, prescriberId: string) {\n    switch (this.documentType) {\n      case this.typesOfDocuments[0]:\n        await this.prescriptionModelService.deleteById(modelId, prescriberId);\n        break;\n      case this.typesOfDocuments[1]:\n        await this.examModelService.deleteById(modelId, prescriberId);\n        break;\n      case this.typesOfDocuments[2]:\n        await this.attestationModelService.deleteById(modelId, prescriberId);\n        break;\n      case this.typesOfDocuments[3]:\n        await this.orientationModelService.deleteById(modelId, prescriberId);\n        break;\n    }\n  }\n  @nativeAsync\n  private async getListDocumentsTemplates() {\n    let documentsTemplate = [];\n    switch (this.documentType) {\n      case this.typesOfDocuments[0]:\n        documentsTemplate = await this.prescriptionModelService.getListByPrescriberId(\n          this.prescriber.userId\n        );\n        break;\n      case this.typesOfDocuments[1]:\n        documentsTemplate = await this.examModelService.getListByPrescriberId(this.prescriber.userId);\n        break;\n      case this.typesOfDocuments[2]:\n        documentsTemplate = await this.attestationModelService.getListByPrescriberId(\n          this.prescriber.userId\n        );\n        break;\n      case this.typesOfDocuments[3]:\n        documentsTemplate = await this.orientationModelService.getListByPrescriberId(\n          this.prescriber.userId\n        );\n        break;\n    }\n\n    return documentsTemplate.filter(\n      documentTemplate => documentTemplate.version === this.supportedVersion\n    );\n  }\n\n  showModalAddFavoriteDocument() {\n    if (this.documentForm.valid) {\n      this.documentForm.value.prescriber = this.prescriber.userId;\n      const initialState = {\n        documentModel: this.documentForm.value,\n        documentType: this.documentType,\n        prescriber: this.prescriber,\n        colorSetting: this.colorSetting\n      };\n      this.modalService.show(ModelAddFavoriteDocumentComponent, {\n        class: 'modal-lg',\n        initialState,\n        backdrop: 'static',\n        keyboard: false\n      });\n    } else {\n      const msg = this.getFormError(this.documentType);\n      this.notification.notify('warning', 'Aviso', msg);\n    }\n  }\n\n  private getFormError(documentType: string): string {\n    switch (documentType) {\n      case 'Prescrição':\n        return 'Selecione e preencha dados do medicamento ou digite um texto livre';\n      case 'Exame':\n        return 'Selecione um material e um exame para cada material';\n      default:\n        return 'Preencha os campos obrigatórios';\n    }\n  }\n}\n","export default \"<div *ngFor=\\\"let message of messages\\\">\\n  <nz-alert nzType=\\\"warning\\\" [nzMessage]=\\\"message\\\"></nz-alert>\\n</div>\\n<div class=\\\"page-content\\\" *ngIf=\\\"!initialLoading\\\">\\n  <section class=\\\"section container-fluid prescription d-flex flex-column\\\">\\n    <div class=\\\"mb-4\\\">\\n      <div class=\\\"row\\\">\\n        <div class=\\\"col-12\\\">\\n          <h4>{{ documentType }}</h4>\\n        </div>\\n      </div>\\n      <div class=\\\"row\\\" *ngIf=\\\"showLocal\\\">\\n        <div class=\\\"col-12 col-md-6 col-lg-6\\\">\\n          <nz-form-item>\\n            <nz-form-label nzFor=\\\"cpfPatient\\\"\\n              ><span [ngStyle]=\\\"{ color: colorSetting?.primary }\\\">\\n                Escolha o local:\\n              </span>\\n            </nz-form-label>\\n            <nz-form-control>\\n              <select class=\\\"form-control\\\" id=\\\"local\\\">\\n                <option\\n                  *ngFor=\\\"let address of prescriber?.commercialData\\\"\\n                  (click)=\\\"changeLocal(address)\\\"\\n                  >{{ address.name }}</option\\n                >\\n              </select>\\n            </nz-form-control>\\n          </nz-form-item>\\n        </div>\\n      </div>\\n\\n      <form [formGroup]=\\\"patientForm\\\">\\n        <div class=\\\"row\\\">\\n          <div class=\\\"col-12\\\" >\\n            <nz-form-item>\\n              <div class=\\\"d-flex align-items-center\\\" *ngIf=\\\"patient\\\">\\n                <nz-form-label nzFor=\\\"cpfPatient\\\">\\n                  <span [ngStyle]=\\\"{ color: colorSetting?.primary }\\\">\\n                    Escolha o paciente:\\n                  </span>\\n                </nz-form-label>\\n                <nz-spin nzSimple class=\\\"ml-3\\\" *ngIf=\\\"isLoadingSearchPatient\\\"></nz-spin>\\n              </div>\\n\\n              <div class=\\\"card p-3\\\">\\n                <nz-form-control *ngIf=\\\"patient\\\">\\n                  <input\\n                    id=\\\"cpfPatient\\\"\\n                    class=\\\"input-name\\\"\\n                    formControlName=\\\"name\\\"\\n                    nz-input\\n                    disabled\\n                    [ngStyle]=\\\"{ color: colorSetting?.primary }\\\"\\n                  />\\n                </nz-form-control>\\n\\n                <div\\n                  class=\\\"mt-2 d-flex align-items-center justify-content-start\\\"\\n                  *ngIf=\\\"patient && documentForm.controls.showPatientCpf\\\"\\n                >\\n                  <nz-form-item [formGroup]=\\\"documentForm\\\">\\n                    <label nz-checkbox formControlName=\\\"showPatientCpf\\\">\\n                      {{ showCpfText }}\\n                    </label>\\n\\n                    <label nz-checkbox formControlName=\\\"showPrescriberCpf\\\">\\n                      Mostrar CPF do Prescritor\\n                    </label>\\n                  </nz-form-item>\\n                </div>\\n              </div>\\n            </nz-form-item>\\n          </div>\\n        </div>\\n\\n        <app-prescription\\n          *ngIf=\\\"documentType === typesOfDocuments[0]\\\"\\n          [manipulatedProfile]=\\\"manipulatedProfile\\\"\\n          [prescription]=\\\"document\\\"\\n          [prescriptionModel]=\\\"selectedDocumentModel\\\"\\n          [patient]=\\\"patient\\\"\\n          [isVeterinarian]=\\\"isVeterinarian\\\"\\n          [colorSetting]=\\\"colorSetting\\\"\\n          (formEmitter)=\\\"documentForm = $event\\\"\\n          [showButtonSerene]=\\\"isClientCmSerene\\\"\\n          (onShowModelListFavoriteDocument)=\\\"showModelListFavoriteDocument()\\\"\\n        ></app-prescription>\\n\\n        <app-exam-v2\\n          *ngIf=\\\"documentType === typesOfDocuments[1]\\\"\\n          [form]=\\\"documentForm\\\"\\n          [exam]=\\\"document\\\"\\n          [examModel]=\\\"selectedDocumentModel\\\"\\n          (formEmitter)=\\\"documentForm = $event\\\"\\n          [isVeterinarian]=\\\"isVeterinarian\\\"\\n          [colorSetting]=\\\"colorSetting\\\"\\n          (onShowModelListFavoriteDocument)=\\\"showModelListFavoriteDocument()\\\"\\n        ></app-exam-v2>\\n\\n        <app-attestation\\n          *ngIf=\\\"documentType === typesOfDocuments[2]\\\"\\n          [patient]=\\\"patient\\\"\\n          [attestationModel]=\\\"selectedDocumentModel\\\"\\n          [attestation]=\\\"document\\\"\\n          (formEmitter)=\\\"documentForm = $event\\\"\\n          [isVeterinarian]=\\\"isVeterinarian\\\"\\n          [colorSetting]=\\\"colorSetting\\\"\\n          (onShowModelListFavoriteDocument)=\\\"showModelListFavoriteDocument()\\\"\\n        ></app-attestation>\\n\\n        <app-orientation\\n          *ngIf=\\\"documentType === typesOfDocuments[3]\\\"\\n          [orientation]=\\\"document\\\"\\n          [orientationModel]=\\\"selectedDocumentModel\\\"\\n          [patient]=\\\"patient\\\"\\n          (formEmitter)=\\\"documentForm = $event\\\"\\n          [isVeterinarian]=\\\"isVeterinarian\\\"\\n          [colorSetting]=\\\"colorSetting\\\"\\n          (onShowModelListFavoriteDocument)=\\\"showModelListFavoriteDocument()\\\"\\n          [showButtonSerene]=\\\"isClientCmSerene\\\"\\n        ></app-orientation>\\n\\n        <app-infusion-protocol\\n          *ngIf=\\\"documentType === typesOfDocuments[4] && victaFeature\\\"\\n          [infusion]=\\\"document\\\"\\n          [colorSetting]=\\\"colorSetting\\\"\\n          [protocolSelected]=\\\"selectedDocumentModel\\\"\\n          (formEmitter)=\\\"documentForm = $event\\\"\\n          [colorSetting]=\\\"colorSetting\\\"\\n          (showModalListVictaProtocols)=\\\"showVictaProtocols()\\\"\\n        ></app-infusion-protocol>\\n      </form>\\n    </div>\\n    <div class=\\\"d-flex flex-column box-actions\\\">\\n      <nz-divider></nz-divider>\\n      <div\\n        class=\\\"d-flex align-items-center justify-content-center btns-container\\\"\\n        *ngIf=\\\"!initialLoading\\\"\\n      >\\n        <nz-button-group class=\\\"d-flex\\\">\\n          <button\\n            nz-button\\n            nz-dropdown\\n            [nzDropdownMenu]=\\\"options\\\"\\n            nzTrigger=\\\"click\\\"\\n            nzPlacement=\\\"bottomRight\\\"\\n            class=\\\"btn btn-save\\\"\\n            [nzDisabled]=\\\"invalidForm\\\"\\n            [ngStyle]=\\\"{\\n              'background-color': colorSetting?.primary,\\n              color: colorSetting?.secondary || '#FFF'\\n            }\\\"\\n          >\\n            Salvar\\n          </button>\\n        </nz-button-group>\\n        <nz-dropdown-menu #options=\\\"nzDropdownMenu\\\">\\n          <ul nz-menu>\\n            <li nz-menu-item (click)=\\\"updateDocument()\\\" *ngIf=\\\"isEditRoute\\\">Salvar</li>\\n            <li nz-menu-item (click)=\\\"saveAndSignPdf()\\\">Assinar Digitalmente</li>\\n            <li nz-menu-item (click)=\\\"showModalAddFavoriteDocument()\\\">\\n              Salvar como favoritos\\n            </li>\\n          </ul>\\n        </nz-dropdown-menu>\\n      </div>\\n    </div>\\n  </section>\\n</div>\\n\\n<ngx-loading [show]=\\\"loading || initialLoading\\\" [config]=\\\"{ backdropBorderRadius: '3px' }\\\"></ngx-loading>\\n<app-modal-send-document></app-modal-send-document>\\n<app-modal-select-layout></app-modal-select-layout>\\n\";","export default \"div nz-alert {\\n  text-align: center;\\n}\\n\\n::ng-deep .ant-drawer.ant-drawer-open .ant-drawer-mask {\\n  opacity: 0.11;\\n}\\n\\n::ng-deep .ant-drawer-body {\\n  padding-top: 0;\\n  height: 75vh;\\n  overflow: auto;\\n}\\n\\n::ng-deep .ant-drawer-open {\\n  top: 80px;\\n}\\n\\n::ng-deep .menu-drawer {\\n  top: 80px;\\n  background-color: #007260;\\n  border: 1px solid #007260;\\n}\\n\\n::ng-deep .menu-drawer .ant-drawer-content {\\n  background-color: transparent;\\n}\\n\\n::ng-deep .inner-menu {\\n  display: flex;\\n  flex-direction: column;\\n}\\n\\n::ng-deep .inner-menu .menu-icon {\\n  align-self: flex-end;\\n  margin: 20px 0;\\n}\\n\\n::ng-deep .inner-menu .menu-icon .fa {\\n  font-size: 20px;\\n  color: white;\\n}\\n\\n::ng-deep .inner-menu .menu li {\\n  padding: 20px 0;\\n}\\n\\n::ng-deep .inner-menu .menu a {\\n  color: white;\\n  font-family: \\\"problack\\\";\\n  font-size: 18px;\\n  text-transform: uppercase;\\n}\\n\\n::ng-deep .inner-menu .menu a:focus {\\n  text-decoration: none;\\n}\\n\\n::ng-deep .inner-menu .menu a .fa {\\n  margin-right: 10px;\\n}\\n\\n::ng-deep .medicationAutoComplete {\\n  margin-top: 17px;\\n}\\n\\n.toolbar {\\n  display: flex;\\n}\\n\\n.toolbar .menu-toggler {\\n  display: flex;\\n  align-items: center;\\n  justify-content: center;\\n  padding: 0;\\n  border-radius: 0;\\n  width: 80px;\\n  filter: drop-shadow(0px 3px 6px rgba(0, 0, 0, 0.16));\\n  margin: 0;\\n}\\n\\n.toolbar .menu-toggler .fa:before {\\n  font-size: 22px;\\n}\\n\\n.toolbar .menu-toggler,\\n.toolbar .toolbar-options {\\n  height: 80px;\\n}\\n\\n.toolbar .toolbar-menu {\\n  flex: 1;\\n}\\n\\n.toolbar .toolbar-menu .toolbar-options {\\n  background-color: #f5f5f5;\\n  display: flex;\\n  align-items: center;\\n  justify-content: flex-end;\\n  padding-right: 40px;\\n  padding-left: 60px;\\n}\\n\\n.toolbar .toolbar-menu .toolbar-options .btn {\\n  font-family: \\\"problack\\\", sans-serif;\\n}\\n\\n.toolbar .toolbar-menu .toolbar-options .btn-green {\\n  background-color: #87ebe1;\\n  border-color: #87ebe1;\\n  color: #1b403a;\\n}\\n\\n.toolbar .toolbar-menu .toolbar-options .btn-default {\\n  background-color: #afafaf;\\n  border-color: #afafaf;\\n  color: white;\\n}\\n\\n.toolbar .toolbar-menu .toolbar-tags {\\n  background-color: #ebebeb;\\n  height: 40px;\\n  border-radius: 0 0 10px 10px;\\n}\\n\\n.prescription {\\n  padding-top: 15px;\\n  height: calc(100vh - 50px);\\n  overflow-y: auto;\\n  background-color: #f5f5f5;\\n}\\n\\n.prescription .doc-type {\\n  margin-right: 25px;\\n}\\n\\n.prescription .hospital-brand {\\n  position: relative;\\n  display: flex;\\n  align-self: flex-end;\\n  justify-content: center;\\n  flex-direction: column;\\n  align-items: center;\\n  padding-top: 15px;\\n}\\n\\n.prescription .hospital-brand nz-dropdown {\\n  align-self: flex-end;\\n}\\n\\n.prescription .hospital-brand .rectangles {\\n  display: flex;\\n  flex-wrap: wrap;\\n  width: 48px;\\n}\\n\\n.prescription .hospital-brand .rectangles .rectangle {\\n  width: 24px;\\n  height: 24px;\\n}\\n\\n.prescription .hospital-brand .rectangles .rectangle.bg-light-alt {\\n  background-color: #4d4d4d;\\n}\\n\\n.prescription .hospital-brand .hospital-name {\\n  font-family: \\\"probold\\\";\\n  font-size: 23px;\\n  color: #4d4d4d;\\n  margin-top: 10px;\\n}\\n\\n.prescription .hospital-brand .arrow-circle {\\n  font-size: 24px;\\n  color: #4d4d4d;\\n  position: absolute;\\n  right: 0;\\n  top: 0;\\n}\\n\\n.prescription form .input-name {\\n  background-color: transparent;\\n  border-color: transparent;\\n  font-family: \\\"Times New Roman\\\", Times, serif, \\\"proregular\\\", \\\"Source Serif Pro\\\", \\\"sans-serif\\\";\\n  color: #585858 !important;\\n  font-size: 30px;\\n  height: auto;\\n  border-radius: 0;\\n  border-bottom: 2px solid #6e6e6e;\\n}\\n\\n.prescription form .input-name::-moz-placeholder {\\n  color: #f6b4af;\\n}\\n\\n.prescription form .input-name::placeholder, .prescription form .input-name {\\n  color: #f6b4af;\\n}\\n\\n@media (max-width: 1025px) {\\n  .prescription form .input-name {\\n    font-size: 16px;\\n  }\\n}\\n\\n.prescription form .input-name:hover, .prescription form .input-name:focus {\\n  border-bottom: 2px solid #6e6e6e;\\n  box-shadow: none;\\n}\\n\\n.add-prescription {\\n  padding: 20px 0;\\n  border-top: 1px solid #f5f5f5;\\n  min-height: 81px;\\n  display: flex;\\n  justify-content: center;\\n}\\n\\n@media (max-width: 1025px) {\\n  .add-prescription .btn-icon .btn-inner--text {\\n    font-size: 13px;\\n    word-break: break-word;\\n  }\\n}\\n\\n.add-prescription.adding-bg {\\n  background-color: #f5f5f5;\\n  border-top: 1px solid transparent;\\n}\\n\\n.add-prescription .btn-add-name {\\n  background-color: var(--bg-color-primary);\\n  border: 1px solid var(--bg-color-primary);\\n  color: var(--color-white);\\n  padding: 0px 10px;\\n  margin: 10px;\\n}\\n\\n.add-prescription .btn-add-outiline {\\n  display: flex;\\n  padding: 0 0 0 8px;\\n  height: 40px;\\n  align-items: center;\\n  border-radius: 10px;\\n  overflow: hidden;\\n  border: 0;\\n  font-family: \\\"probold\\\", sans-serif;\\n  background-color: var(--bg-color-secondary);\\n  color: var(--color-white);\\n}\\n\\n.add-prescription .btn-add-outiline .btn-inner--icon {\\n  background-color: var(--bg-color-primary);\\n  color: var(--color-white);\\n  display: flex;\\n  align-items: center;\\n  justify-content: center;\\n  height: 40px;\\n  width: 50px;\\n}\\n\\n.add-patient {\\n  border: 0;\\n  padding-left: 20px;\\n  padding-bottom: 0;\\n  min-height: 75px;\\n}\\n\\n.footer {\\n  height: 50px;\\n  padding: 0;\\n  border: 0;\\n  z-index: 1;\\n  background-color: var(--bg-footer);\\n}\\n\\n.footer .btn {\\n  box-shadow: none;\\n  border-radius: 0;\\n  height: 100%;\\n  display: flex;\\n  align-items: center;\\n  justify-content: center;\\n  padding-top: 0.725rem;\\n  background-color: var(--bg-color-btn-save);\\n  color: var(--color-white);\\n}\\n\\n@media (max-width: 1025px) {\\n  .footer .btn {\\n    font-size: 11px;\\n  }\\n}\\n\\n.footer .btn i {\\n  margin-left: 10px;\\n}\\n\\n.footer .btn i:before {\\n  font-size: 16px;\\n}\\n\\n.medicationNameInput {\\n  background-color: transparent;\\n  border-color: transparent;\\n  height: 100%;\\n  box-shadow: none;\\n}\\n\\ntextarea {\\n  resize: none;\\n  background-color: transparent;\\n  border: 0;\\n  border-radius: 0;\\n  box-shadow: none;\\n  padding-left: 12px;\\n  color: #4d4d4d;\\n  font-size: 18px;\\n}\\n\\ntextarea:hover, textarea:focus {\\n  border-color: transparent;\\n  box-shadow: none;\\n}\\n\\n.free-prescription {\\n  display: flex;\\n}\\n\\n.free-prescription .break-line {\\n  margin-left: 7px;\\n  white-space: pre-wrap;\\n}\\n\\n.toolbar {\\n  display: flex;\\n}\\n\\n.toolbar .menu-toggler {\\n  display: flex;\\n  align-items: center;\\n  justify-content: center;\\n  padding: 0;\\n  border-radius: 0;\\n  width: 80px;\\n  filter: drop-shadow(0px 3px 6px rgba(0, 0, 0, 0.16));\\n  margin: 0;\\n}\\n\\n.toolbar .menu-toggler .fa:before {\\n  font-size: 22px;\\n}\\n\\n.toolbar .menu-toggler,\\n.toolbar .toolbar-options {\\n  height: 80px;\\n}\\n\\n.toolbar .toolbar-menu {\\n  flex: 1;\\n}\\n\\n.toolbar .toolbar-menu .toolbar-options {\\n  background-color: #f5f5f5;\\n  display: flex;\\n  align-items: center;\\n  justify-content: flex-end;\\n  padding-right: 40px;\\n  padding-left: 60px;\\n}\\n\\n.toolbar .toolbar-menu .toolbar-options .btn {\\n  font-family: \\\"problack\\\", sans-serif;\\n}\\n\\n.toolbar .toolbar-menu .toolbar-options .btn-green {\\n  background-color: #87ebe1;\\n  border-color: #87ebe1;\\n  color: #1b403a;\\n}\\n\\n.toolbar .toolbar-menu .toolbar-options .btn-default {\\n  background-color: #afafaf;\\n  border-color: #afafaf;\\n  color: white;\\n}\\n\\n.toolbar .toolbar-menu .toolbar-tags {\\n  background-color: #ebebeb;\\n  height: 40px;\\n  border-radius: 0 0 10px 10px;\\n}\\n\\n.box-actions ::ng-deep .ant-divider-horizontal {\\n  margin: 10px 0;\\n}\\n\\n@media (min-width: 1025px) {\\n  .box-actions .btns-container {\\n    padding-bottom: 10px;\\n  }\\n}\\n\\n.box-actions .btns-container .btn {\\n  display: flex;\\n  padding: 0 8px 0 8px;\\n  height: 40px;\\n  align-items: center;\\n  overflow: hidden;\\n  border: 0;\\n  font-family: \\\"probold\\\", sans-serif;\\n  text-transform: capitalize;\\n}\\n\\n.box-actions .btns-container .btn-save,\\n.box-actions .btns-container .btn-save:focus {\\n  display: flex;\\n  justify-content: center;\\n  align-items: center;\\n  width: 100px;\\n  border-radius: 10px;\\n  background-color: var(--bg-color-secondary);\\n  color: var(--color-white);\\n}\\n\\n.box-actions .btns-container .btn-save:disabled {\\n  background-color: #eaeaea !important;\\n  color: #8b8b8b !important;\\n}\\n\\n.box-actions .btns-container .btn-dropdown,\\n.box-actions .btns-container .btn-dropdown:focus {\\n  border-radius: 0 10px 10px 0;\\n  background-color: var(--bg-color-primary);\\n  color: var(--color-white);\\n  margin-left: -8px;\\n}\\n\\n.box-actions .btns-container .btn:disabled {\\n  background-color: #c7c7c7;\\n  color: #707070;\\n  cursor: not-allowed;\\n}\\n\\n@media (max-width: 1025px) {\\n  section.section.container-fluid.prescription.d-flex.flex-column {\\n    padding: 20px;\\n  }\\n\\n  .ant-form-item-children input {\\n    font-size: 16px;\\n  }\\n}\";","import { NgModule } from '@angular/core';\nimport { RouterModule, Routes } from '@angular/router';\nimport { ExternalDocumentV2Component } from './external-document-v2.component';\n\nconst routes: Routes = [\n  { path: 'new/:token', component: ExternalDocumentV2Component },\n  { path: 'edit/:token', component: ExternalDocumentV2Component },\n  { path: '', redirectTo: 'new' }\n];\n\n@NgModule({\n  imports: [RouterModule.forChild(routes)],\n  exports: [RouterModule]\n})\nexport class ExternalDocumentV2RoutingModule {}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { SharedModule } from '@app/shared';\nimport { ComponentsModule } from '@app/shared/components/components.module';\nimport { NzCardModule, NzDropDownModule } from 'ng-zorro-antd';\nimport { NzCarouselModule } from 'ng-zorro-antd/carousel';\nimport { NzIconModule } from 'ng-zorro-antd/icon';\nimport { NzPopoverModule } from 'ng-zorro-antd/popover';\nimport { ModalModule } from 'ngx-bootstrap/modal';\nimport { NgxLoadingModule } from 'ngx-loading';\nimport { NgxMaskModule } from 'ngx-mask';\nimport { PatientsModule } from '../patients/patients.module';\nimport { DocumentV2Module } from './../document-v2/document-v2.module';\nimport { ExternalDocumentV2Component } from './external-document-v2.component';\nimport { ExternalDocumentV2RoutingModule } from './external-document-v2.routing.module';\n\n@NgModule({\n  declarations: [ExternalDocumentV2Component],\n  exports: [ExternalDocumentV2Component],\n  imports: [\n    CommonModule,\n    SharedModule,\n    ExternalDocumentV2RoutingModule,\n    PatientsModule,\n    ComponentsModule,\n    DocumentV2Module,\n    NgxLoadingModule.forRoot({}),\n    NzDropDownModule,\n    NzCardModule,\n    NzCarouselModule,\n    NzIconModule,\n    NgxMaskModule.forRoot(),\n    NzPopoverModule,\n    ModalModule.forRoot()\n  ]\n})\nexport class ExternalDocumentV2Module {}\n"]}