@eqproject/eqp-attachments 0.1.10 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { __decorate, __awaiter } from 'tslib';
2
- import { ɵɵdefineInjectable, Injectable, EventEmitter, Input, Output, ViewChild, Component, NgModule } from '@angular/core';
2
+ import { ɵɵdefineInjectable, Injectable, EventEmitter, ChangeDetectorRef, Input, Output, ViewChild, Component, NgModule } from '@angular/core';
3
3
  import { Validators, FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms';
4
4
  import { base64ToFile, ImageCropperComponent, ImageCropperModule } from 'ngx-image-cropper';
5
5
  import imageCompression from 'browser-image-compression';
@@ -211,11 +211,12 @@ const toBase64 = file => new Promise((resolve, reject) => {
211
211
  });
212
212
  const ɵ0 = toBase64;
213
213
  let EqpAttachmentsComponent = class EqpAttachmentsComponent {
214
- constructor(dialog, formBuilder, sanitizer, http) {
214
+ constructor(dialog, formBuilder, sanitizer, http, cd) {
215
215
  this.dialog = dialog;
216
216
  this.formBuilder = formBuilder;
217
217
  this.sanitizer = sanitizer;
218
218
  this.http = http;
219
+ this.cd = cd;
219
220
  //#region @Input del componente
220
221
  /**
221
222
  * Se TRUE allora nasconde la colonna per le azioni sull'allegato (nel caso "multipleAttachment" è TRUE).
@@ -242,6 +243,11 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
242
243
  * Se TRUE allora il componente mostra l'elenco di tutti gli allegati ricevuto nel parametro "attachmentsList".
243
244
  */
244
245
  this.multipleAttachment = true;
246
+ /**
247
+ * Se assume il valore TRUE allora sarà possibile caricare più file per volta. Questa funzionalità è attiva
248
+ * SOLO se si gestiscono allegati multipli, quindi se l'input 'multipleAttachment' assume il valore TRUE, altrimenti è sempre disabilitata.
249
+ */
250
+ this.loadMultipleFiles = false;
245
251
  /**
246
252
  * Configurazione delle colonne della eqp-table per la visualizzazione degli allegati (caso "multipleAttachment" è TRUE).
247
253
  */
@@ -286,6 +292,10 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
286
292
  * Array di AttachmentType che si possono aggiungere
287
293
  */
288
294
  this.allowedTypes = [AttachmentType.FILE, AttachmentType.LINK];
295
+ /**
296
+ * Booleano per impostare la eqp-table nella modalità multilingua
297
+ */
298
+ this.isEqpTableMultiLanguage = false;
289
299
  /**
290
300
  * Input per definire le label da usare nel componente
291
301
  */
@@ -325,8 +335,10 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
325
335
  //#endregion
326
336
  //#region Proprietà per gestione caricamento nuovo allegato
327
337
  this.newAttachment = {};
338
+ this.newMultipleAttachments = [];
328
339
  this.attachmentType = AttachmentType;
329
340
  this.selectedFile = null;
341
+ this.selectedFiles = null;
330
342
  this.showCropImage = false;
331
343
  //#endregion
332
344
  //#region Proprietà per gestione ridimensionamento file di tipo image
@@ -357,8 +369,6 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
357
369
  if (this.attachmentsList == null)
358
370
  this.attachmentsList = new Array();
359
371
  this.checkAttachmentImage();
360
- // if (!this.compressionOptions || !this.compressionOptions.maxSizeMB || !this.compressionOptions.maxWidthOrHeight)
361
- // this.compressionOptions = { maxSizeMB: 0.5, maxWidthOrHeight: 1920, useWebWorker: true };
362
372
  }
363
373
  reloadData() {
364
374
  if (this.attachmentTable)
@@ -469,9 +479,25 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
469
479
  * Apre la modale per la definizione dei parametri del nuovo file
470
480
  */
471
481
  openModalAddAttachment(attachmentType) {
482
+ //Se è stato richiesto il caricamento di un LINK o è impostato il caricamento di FILE SINGOLO allora apre la modale per
483
+ //il caricamento singolo del file altrimenti apre quella per il caricamento multiplo
484
+ // if (attachmentType == AttachmentType.LINK || (attachmentType == AttachmentType.FILE && this.loadMultipleFiles != true)) {
472
485
  this.newAttachment = {};
473
486
  this.newAttachment.IsImage = false;
474
487
  this.newAttachment.AttachmentType = attachmentType;
488
+ this.newMultipleAttachments = new Array();
489
+ if (attachmentType == AttachmentType.LINK)
490
+ this.newMultipleAttachments.push(this.newAttachment);
491
+ this.createAttachmentForm();
492
+ //Apre la modale
493
+ this.dialofRefAddAttachment = this.dialog.open(this.dialogAddAttachment, {
494
+ disableClose: true,
495
+ hasBackdrop: true,
496
+ width: '60%',
497
+ maxHeight: '80%'
498
+ });
499
+ }
500
+ createAttachmentForm() {
475
501
  //Crea la form per la validazione dei campi
476
502
  this.newAttachmentForm = this.formBuilder.group({
477
503
  type: [this.newAttachment.AttachmentType, Validators.required],
@@ -480,18 +506,13 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
480
506
  customHeight: [this.customHeight],
481
507
  customWidth: [this.customWidth]
482
508
  });
483
- //Apre la modale
484
- this.dialofRefAddAttachment = this.dialog.open(this.dialogAddAttachment, {
485
- disableClose: true,
486
- hasBackdrop: true,
487
- width: '60%',
488
- maxHeight: '80%'
489
- });
490
509
  }
491
510
  close() {
492
511
  this.newAttachment = {};
512
+ this.newMultipleAttachments = new Array();
493
513
  this.abortFile();
494
- this.newAttachmentForm.reset();
514
+ if (this.newAttachmentForm)
515
+ this.newAttachmentForm.reset();
495
516
  this.dialofRefAddAttachment.close();
496
517
  }
497
518
  /**
@@ -500,23 +521,37 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
500
521
  * @returns
501
522
  */
502
523
  disableSave() {
503
- if (this.newAttachment.AttachmentType == AttachmentType.FILE) {
504
- return !this.newAttachment.FileDataBase64;
524
+ if (this.loadMultipleFiles != true) {
525
+ if (this.newAttachment.AttachmentType == AttachmentType.FILE) {
526
+ return !this.newAttachment.FileDataBase64;
527
+ }
528
+ else {
529
+ return !this.newAttachment.FilePath;
530
+ }
505
531
  }
506
532
  else {
507
- return !this.newAttachment.FilePath;
533
+ return this.newMultipleAttachments.filter(p => (p.AttachmentType == AttachmentType.FILE && !p.FileDataBase64) || (p.AttachmentType == AttachmentType.LINK && !p.FilePath)).length > 0;
508
534
  }
509
535
  }
510
536
  confirmAddAttachment() {
511
- if (this.newAttachment.AttachmentType == AttachmentType.LINK && !this.newAttachment.FileName)
512
- this.newAttachment.FileName = this.newAttachment.FilePath;
513
- if (this.attachmentsList == null)
514
- this.attachmentsList = new Array();
515
- this.attachmentsList.push(this.newAttachment);
537
+ if (this.loadMultipleFiles != true) {
538
+ if (this.newAttachment.AttachmentType == AttachmentType.LINK && !this.newAttachment.FileName)
539
+ this.newAttachment.FileName = this.newAttachment.FilePath;
540
+ if (this.attachmentsList == null)
541
+ this.attachmentsList = new Array();
542
+ this.attachmentsList.push(this.newAttachment);
543
+ }
544
+ else {
545
+ if (this.newMultipleAttachments == null || this.newMultipleAttachments.length == 0)
546
+ return;
547
+ if (this.attachmentsList == null)
548
+ this.attachmentsList = new Array();
549
+ this.attachmentsList = this.attachmentsList.concat(this.newMultipleAttachments);
550
+ }
516
551
  if (this.attachmentTable)
517
552
  this.attachmentTable.reloadDatatable();
518
553
  this.localEditedAttachments.emit(this.attachmentsList);
519
- this.dialofRefAddAttachment.close();
554
+ this.close();
520
555
  }
521
556
  /**
522
557
  * Apre il dialog per l'anteprima dell'allegato selezionato.
@@ -574,68 +609,140 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
574
609
  }
575
610
  //#region Gestione caricamento file
576
611
  /**
577
- * Se il file caricato è un immagine allora mostra le funzionalità del croppie per ritagliare l'immagine altrimenti
578
- * converte il file in base64 e lo associa all'allegato da salvare
612
+ * Evento scatenato alla selezione del file (o dei file).
613
+ * Se il caricamento è SINGOLO o se comunque è stato selezionato un solo file allora si occupa di controllare se si tratta di un immagine in modo da
614
+ * mostrare le funzionalità del croppie (per ritagliare l'immagine) oppure no.
615
+ * Se il file caricato non è un immagine allora genera direttamente il base64 e lo associa all'allegato da salvare.
616
+ * Se invece il caricamento dei file è MULTIPLO e sono presenti più file allora esegue le stesse operazioni ignorando però il contrllo
617
+ * immagine per il croppie (in caso di caricamento multiplo le funzionalità del croppie sono disabilitate).
579
618
  */
580
619
  onFileInputChange(event) {
581
620
  return __awaiter(this, void 0, void 0, function* () {
582
621
  this.showCropImage = false;
583
- this.selectedFile = event.target.files[0];
584
- if (!this.selectedFile)
585
- return;
586
- //Memorizza i dati per l'allegato
587
- this.newAttachment.FileContentType = this.selectedFile.type;
588
- this.newAttachment.FileName = this.selectedFile.name;
589
- this.newAttachment.FileExtension = this.selectedFile.name.substr(this.selectedFile.name.lastIndexOf('.') + 1);
590
- this.newAttachment.IsImage = AttachmentHelperService.checkImageFromMimeType(this.selectedFile.type);
591
- //Se è stata richiesta la gestione delle sole immagini ma per errore è stato selezionato un file che non è un immagine
592
- if (this.allowOnlyImages == true && this.newAttachment.IsImage != true) {
593
- EqpAttachmentDialogService.Error(this.noImageSelectedErrorMessage);
594
- this.abortFile();
595
- return;
596
- }
597
- else if (!this.checkAcceptedFiles()) {
598
- EqpAttachmentDialogService.Error(this.wrongTypeSelectedErrorMessage);
599
- this.abortFile();
600
- return;
601
- }
602
- //Verifica se il file caricato è un'immagine oppure no. Se è un immagine, prima di caricarla mostra il croppie per il resize.
603
- //Se non è un immagine allora genera il Base64
604
- if (this.newAttachment.IsImage == true) {
605
- this.getImageDimensions(event.target.files[0]);
606
- //Mostra il croppie e disabilita la form finchè non termina la modifica dell'immagine
607
- this.newAttachmentForm.disable();
608
- this.newAttachmentForm.controls["customWidth"].enable();
609
- this.newAttachmentForm.controls["customHeight"].enable();
610
- this.showCropImage = true;
611
- this.imageChangedEvent = event;
622
+ //Se è stato richiesto il caricamento SINGOLO oppure se il caricamento è MULTIPLO ma è stato selezionato un solo file
623
+ //allora verifica se il file è un immagine (per mostrare il CROPPIE)
624
+ if ([...event.target.files].length == 1 || this.loadMultipleFiles != true) {
625
+ this.selectedFile = event.target.files[0];
626
+ this.selectedFiles = event.target.files;
627
+ if (!this.selectedFile)
628
+ return;
629
+ //Memorizza i dati per l'allegato
630
+ this.newAttachment = yield this.createAttachmentFromUploadedFile(this.selectedFile, false);
631
+ this.newMultipleAttachments = new Array();
632
+ this.newMultipleAttachments.push(this.newAttachment);
633
+ //Se è stata richiesta la gestione delle sole immagini ma per errore è stato selezionato un file che non è un immagine
634
+ let checkOnlyImage = this.checkAllowOnlyImageFile(this.newAttachment);
635
+ if (checkOnlyImage == false)
636
+ return;
637
+ if (this.loadMultipleFiles == true && [...event.target.files].length == 1)
638
+ this.createAttachmentForm();
639
+ //Verifica se il file caricato è un'immagine oppure no. Se è un immagine, prima di caricarla mostra il croppie per il resize.
640
+ //Se non è un immagine allora genera il Base64
641
+ if (this.newAttachment.IsImage == true) {
642
+ this.getImageDimensions(event.target.files[0]);
643
+ //Mostra il croppie e disabilita la form finchè non termina la modifica dell'immagine
644
+ this.newAttachmentForm.disable();
645
+ this.newAttachmentForm.controls["customWidth"].enable();
646
+ this.newAttachmentForm.controls["customHeight"].enable();
647
+ this.showCropImage = true;
648
+ this.imageChangedEvent = event;
649
+ }
650
+ else {
651
+ this.showCropImage = false;
652
+ let base64Result = yield this.getBase64FromFile(this.selectedFile);
653
+ this.newAttachment.FileDataBase64 = base64Result.Base64File;
654
+ this.newAttachment.FileContentType = base64Result.ContentType;
655
+ }
612
656
  }
613
657
  else {
614
- this.showCropImage = false;
615
- let base64File = yield toBase64(this.selectedFile);
616
- if (base64File) {
617
- // Loris 20/01/2022: PROBLEMA - Quando eseguo l'upload di un file .sql non viene salvato/scaricato correttamente.
618
- // Questo succede perchè non viene popolato il FileContentType. Per risolvere il problema
619
- // faccio un controllo e se non esiste il FileContentType allora lo recupero dal base64 ottenuto.
620
- this.newAttachment.FileContentType = !this.newAttachment.FileContentType ? base64File.split(",")[0].split(":")[1].split(";")[0] : this.newAttachment.FileContentType;
621
- // Un altro metodo per leggere il ccontent type del file è tramite una regular expression:
622
- // this.newAttachment.FileContentType = !this.newAttachment.FileContentType ? base64File.match(/[^:]\w+\/[\w-+\d.]+(?=;|,)/)[0] : this.newAttachment.FileContentType;
623
- this.newAttachment.FileDataBase64 = base64File.split(",")[1];
658
+ this.selectedFiles = event.target.files;
659
+ if (!this.selectedFiles || this.selectedFiles.length == 0)
660
+ return;
661
+ this.newMultipleAttachments = new Array();
662
+ for (let i = 0; i < this.selectedFiles.length; i++) {
663
+ let newAttachment = yield this.createAttachmentFromUploadedFile(this.selectedFiles[i], true);
664
+ //Se è stata richiesta la gestione delle sole immagini ma per errore è stato selezionato un file che non è un immagine
665
+ let checkOnlyImage = this.checkAllowOnlyImageFile(newAttachment);
666
+ if (checkOnlyImage == false)
667
+ return;
668
+ this.newMultipleAttachments.push(newAttachment);
624
669
  }
625
670
  }
626
671
  });
627
672
  }
673
+ /**
674
+ * A partire dal FILE ricevuto in input ricostruisce l'oggetto IAttachmentDTO e lo restituisce.
675
+ * Se il parametro getBase64 viene passato a TRUE allora, sempre a partire dal file,genera il base64 e
676
+ * ricava il ContentType da associare all'oggetto IAttachmentDTO da restituire
677
+ * @param currentFile Oggetto FILE da processare
678
+ * @param getBase64 Se TRUE allora calcola base64 e ContentType del file passato in input
679
+ * @returns Restituisce un oggetto di tipo IAttachmentDTO
680
+ */
681
+ createAttachmentFromUploadedFile(currentFile, getBase64 = true) {
682
+ return __awaiter(this, void 0, void 0, function* () {
683
+ let newAttachment = {};
684
+ //Memorizza i dati per l'allegato
685
+ newAttachment.AttachmentType = AttachmentType.FILE;
686
+ newAttachment.FileContentType = currentFile.type;
687
+ newAttachment.FileName = currentFile.name;
688
+ newAttachment.FileExtension = currentFile.name.substr(currentFile.name.lastIndexOf('.') + 1);
689
+ newAttachment.IsImage = AttachmentHelperService.checkImageFromMimeType(currentFile.type);
690
+ if (getBase64 == true) {
691
+ let base64Result = yield this.getBase64FromFile(currentFile);
692
+ newAttachment.FileDataBase64 = base64Result.Base64File;
693
+ newAttachment.FileContentType = base64Result.ContentType;
694
+ }
695
+ return newAttachment;
696
+ });
697
+ }
698
+ /**
699
+ * A partire dal file passato in input restituisce un oggetto
700
+ * contenente il base64 del file e il suo contentType
701
+ * @param currentFile Oggetto File da cui estrapolare base64 e contentType
702
+ * @returns Restituisce un oggetto avente le proprietà Base64File e ContentType
703
+ */
704
+ getBase64FromFile(currentFile) {
705
+ return __awaiter(this, void 0, void 0, function* () {
706
+ let base64File = yield toBase64(currentFile);
707
+ let contentType = null;
708
+ if (base64File) {
709
+ // Loris 20/01/2022: PROBLEMA - Quando eseguo l'upload di un file .sql non viene salvato/scaricato correttamente.
710
+ // Questo succede perchè non viene popolato il FileContentType. Per risolvere il problema
711
+ // faccio un controllo e se non esiste il FileContentType allora lo recupero dal base64 ottenuto.
712
+ contentType = base64File.split(",")[0].split(":")[1].split(";")[0];
713
+ // Un altro metodo per leggere il ccontent type del file è tramite una regular expression:
714
+ base64File = base64File.split(",")[1];
715
+ }
716
+ let result = {
717
+ Base64File: base64File,
718
+ ContentType: contentType
719
+ };
720
+ return result;
721
+ });
722
+ }
628
723
  /**
629
724
  * Controlla se il file che si sta caricando è supportato dal sistema.
630
725
  * @returns
631
726
  */
632
727
  checkAcceptedFiles() {
633
- if (this.selectedFile.type.startsWith("video"))
728
+ if ((this.loadMultipleFiles != true && this.selectedFile.type.startsWith("video"))
729
+ || (this.loadMultipleFiles == true && [...this.selectedFiles].filter(p => p.type.startsWith("video")).length > 0))
634
730
  return false;
635
731
  if (this.acceptedFileTypes == "*")
636
732
  return true;
637
- let accepted = this.acceptedFileTypes.includes(this.selectedFile.type);
638
- if (!accepted) {
733
+ //Verifica che i tipi del file (o dei file) caricati siano coerenti con quelli accettati dalla direttiva
734
+ let accepted = true;
735
+ if (this.loadMultipleFiles != true)
736
+ accepted = this.acceptedFileTypes.includes(this.selectedFile.type);
737
+ else {
738
+ let uploadedFileTypes = [...this.selectedFiles].map(p => p.type);
739
+ uploadedFileTypes.forEach(type => {
740
+ if (!this.acceptedFileTypes.includes(type))
741
+ accepted = false;
742
+ });
743
+ }
744
+ //Questo controllo permette di gestire le casistiche per cui vengono indicati come tipi validi, ad esempio, 'image/*'
745
+ if (!accepted && this.loadMultipleFiles != true) {
639
746
  for (let t of this.acceptedFileTypes.split(",").filter(t => t.includes("*"))) {
640
747
  accepted = this.selectedFile.type.startsWith(t.split("*")[0]);
641
748
  if (accepted)
@@ -644,6 +751,24 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
644
751
  }
645
752
  return accepted;
646
753
  }
754
+ /**
755
+ * Se eqp-attachments è stata configurata per il caricamento delle sole immagini allora verifica che il file passato in
756
+ * input sia effettivamente un immagine o no.
757
+ * Se il controllo va a buon fine restituisce TRUE altrimenti mostra un messaggio d'errore e restituisce FALSE
758
+ */
759
+ checkAllowOnlyImageFile(newAttachment) {
760
+ if (this.allowOnlyImages == true && newAttachment.IsImage != true) {
761
+ EqpAttachmentDialogService.Error(this.noImageSelectedErrorMessage);
762
+ this.abortFile();
763
+ return false;
764
+ }
765
+ else if (!this.checkAcceptedFiles()) {
766
+ EqpAttachmentDialogService.Error(this.wrongTypeSelectedErrorMessage);
767
+ this.abortFile();
768
+ return false;
769
+ }
770
+ return true;
771
+ }
647
772
  getImageDimensions(img) {
648
773
  const reader = new FileReader();
649
774
  reader.onload = (e) => {
@@ -711,12 +836,14 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
711
836
  if (this.imageInput)
712
837
  this.imageInput.nativeElement.value = '';
713
838
  this.selectedFile = null;
839
+ this.selectedFiles = null;
714
840
  this.showCropImage = false;
715
841
  this.newAttachment.IsImage = false;
716
842
  this.newAttachment.FileDataBase64 = null;
717
843
  this.newAttachment.FileName = null;
718
844
  this.newAttachment.FileExtension = null;
719
845
  this.newAttachment.FileContentType = null;
846
+ this.newMultipleAttachments = new Array();
720
847
  this.customHeight = null;
721
848
  this.customWidth = null;
722
849
  this.originalHeight = null;
@@ -727,7 +854,8 @@ EqpAttachmentsComponent.ctorParameters = () => [
727
854
  { type: MatDialog },
728
855
  { type: FormBuilder },
729
856
  { type: DomSanitizer },
730
- { type: HttpClient }
857
+ { type: HttpClient },
858
+ { type: ChangeDetectorRef }
731
859
  ];
732
860
  __decorate([
733
861
  Input("disableAction")
@@ -747,6 +875,9 @@ __decorate([
747
875
  __decorate([
748
876
  Input("multipleAttachment")
749
877
  ], EqpAttachmentsComponent.prototype, "multipleAttachment", void 0);
878
+ __decorate([
879
+ Input("loadMultipleFiles")
880
+ ], EqpAttachmentsComponent.prototype, "loadMultipleFiles", void 0);
750
881
  __decorate([
751
882
  Input("attachmentsColumns")
752
883
  ], EqpAttachmentsComponent.prototype, "attachmentsColumns", void 0);
@@ -777,6 +908,9 @@ __decorate([
777
908
  __decorate([
778
909
  Input("allowedTypes")
779
910
  ], EqpAttachmentsComponent.prototype, "allowedTypes", void 0);
911
+ __decorate([
912
+ Input("isEqpTableMultiLanguage")
913
+ ], EqpAttachmentsComponent.prototype, "isEqpTableMultiLanguage", void 0);
780
914
  __decorate([
781
915
  Input("downloadTooltipPosition")
782
916
  ], EqpAttachmentsComponent.prototype, "downloadTooltipPosition", void 0);
@@ -846,6 +980,9 @@ __decorate([
846
980
  __decorate([
847
981
  ViewChild('dialogAddAttachment', { static: true })
848
982
  ], EqpAttachmentsComponent.prototype, "dialogAddAttachment", void 0);
983
+ __decorate([
984
+ ViewChild('dialogAddMultipleAttachment', { static: true })
985
+ ], EqpAttachmentsComponent.prototype, "dialogAddMultipleAttachment", void 0);
849
986
  __decorate([
850
987
  ViewChild(ImageCropperComponent)
851
988
  ], EqpAttachmentsComponent.prototype, "imageCropper", void 0);
@@ -864,7 +1001,7 @@ __decorate([
864
1001
  EqpAttachmentsComponent = __decorate([
865
1002
  Component({
866
1003
  selector: 'eqp-attachments',
867
- template: "<!-- Se richiesta la gestione multipla mostra il pulsante di aggiunta e la tabella con l'elenco allegati -->\r\n<div *ngIf=\"multipleAttachment == true\">\r\n <mat-card [ngStyle]=\"{ 'box-shadow': showMatCard == false ? 'none' : null }\">\r\n <mat-card-header>\r\n <div class=\"col-md-6\">\r\n <div class=\"text-nowrap eqp-attachments-header-title\" *ngIf=\"showHeader == true\">\r\n {{headerTitle}}\r\n </div>\r\n </div>\r\n <div class=\"col-md-6 text-right\">\r\n <div class=\"row justify-content-end\">\r\n <!-- Template del button per l'aggiunta di un allegato -->\r\n <ng-container *ngTemplateOutlet=\"addAttachmentButton\"></ng-container>\r\n </div>\r\n </div>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <eqp-table #attachmentTable [createMatCard]=\"false\" #table [columns]=\"attachmentsColumns\"\r\n [data]=\"attachmentsList\" [emptyTableMessage]=\"emptyTableMessage\" [searchText]=\"eqpTableSearchText\">\r\n </eqp-table>\r\n </mat-card-content>\r\n </mat-card>\r\n</div>\r\n\r\n<!-- Se richiesta la gestione singola mostra il pulsante di caricamento di un singolo file -->\r\n<div *ngIf=\"multipleAttachment != true\">\r\n <!-- Template del button per l'aggiunta di un allegato -->\r\n <ng-container *ngTemplateOutlet=\"addAttachmentButton\"></ng-container>\r\n\r\n <button class=\"mb-2 mr-2 eqp-attachments-download-btn\" (click)=\"viewAttachment(attachmentsList[0])\" type=\"button\"\r\n mat-raised-button *ngIf=\"attachmentsList && attachmentsList.length > 0 && attachmentsList[0]\" color=\"primary\">\r\n <mat-icon *ngIf=\"attachmentsList[0].AttachmentType == AttachmentType.FILE\">download</mat-icon>\r\n <mat-icon *ngIf=\"attachmentsList[0].AttachmentType != AttachmentType.FILE\">open_in_new</mat-icon>\r\n {{attachmentsList[0].AttachmentType == AttachmentType.FILE ? downloadLabel : openLinkLabel}}\r\n </button>\r\n <button class=\"mb-2 mr-2 eqp-attachments-preview-btn\" (click)=\"openPreviewDialog(attachmentsList[0])\" type=\"button\"\r\n mat-raised-button color=\"primary\"\r\n *ngIf=\"attachmentsList && attachmentsList.length > 0 && attachmentsList[0] && (!attachmentsList[0].FileContentType || (!attachmentsList[0].FileContentType.startsWith('video') && !attachmentsList[0].FileContentType.startsWith('audio')))\">\r\n <mat-icon>visibility</mat-icon> {{previewLabel}}\r\n </button>\r\n <button class=\"mb-2 eqp-attachments-delete-btn\" (click)=\"deleteAttachment(attachmentsList[0])\" type=\"button\"\r\n mat-raised-button *ngIf=\"attachmentsList && attachmentsList.length > 0 && attachmentsList[0]\"\r\n [disabled]=\"isDisabled\">\r\n <mat-icon>delete</mat-icon> {{deleteLabel}}\r\n </button>\r\n\r\n <div class=\"row\" style=\"margin-top: 10px;\"\r\n *ngIf=\"attachmentsList.length > 0 && attachmentsList[0] && attachmentsList[0].FileDataBase64 && attachmentsList[0].IsImage == true\">\r\n <div class=\"col-sm-12\">\r\n <div class=\"single-attachment-inline-preview-container\">\r\n <img src=\"data:image/png;base64,{{attachmentsList[0].FileDataBase64}}\">\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"row\" *ngIf=\"attachmentsList.length > 0 && attachmentsList[0] && attachmentsList[0].IsImage != true\">\r\n <div class=\"col-sm-12\">\r\n <mat-form-field>\r\n <mat-label>{{fileNameLabel}}</mat-label>\r\n <input readonly matInput [(ngModel)]=\"attachmentsList[0].FileName\">\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n\r\n\r\n<ng-template #dialogAddAttachment>\r\n <div class=\"container-fluid eqp-attachments-dialog-add-container\"\r\n style=\"max-height: 70vh !important; overflow-x: hidden; overflow-y: auto;\">\r\n <form [formGroup]=\"newAttachmentForm\" (ngSubmit)=\"confirmAddAttachment()\" *ngIf=\"newAttachmentForm\">\r\n <div class=\"row\">\r\n <div class=\"header-title-standard\"> {{addButtonLabel}} {{ newAttachment.AttachmentType ==\r\n attachmentType.FILE ?\r\n 'File' : 'Link'}} </div>\r\n </div>\r\n <div class=\"row\" style=\"margin-top: 20px;\">\r\n <div class=\"col-sm-12\" *ngIf=\"newAttachment.AttachmentType == attachmentType.FILE\">\r\n <input #imageInput style=\"display:none;\" id=\"file_attachment\" name=\"file_attachment\" type=\"file\"\r\n (change)=\"onFileInputChange($event)\" [accept]=\"acceptedFileTypes\" />\r\n <button (click)=\"imageInput.click()\" type=\"button\" style=\"margin-left: 10px;\" id=\"file_attachment\"\r\n mat-raised-button color=\"primary\" [disabled]=\"showCropImage == true\"\r\n class=\"mb-2 btn btn-primary eqp-attachments-upload-btn\" *ngIf=\"!newAttachment.FileDataBase64\">\r\n <mat-icon>cloud_upload</mat-icon>\r\n {{uploadFileLabel}}\r\n </button>\r\n <button (click)=\"abortFile()\" type=\"button\" style=\"margin-left: 10px;\" mat-raised-button\r\n *ngIf=\"newAttachment.FileDataBase64\" class=\"mb-2 eqp-attachments-delete-btn\">\r\n <mat-icon>delete</mat-icon> {{deleteLabel}}\r\n </button>\r\n </div>\r\n <div class=\"col-sm-12\" *ngIf=\"newAttachment.AttachmentType == 2 || selectedFile\">\r\n <mat-form-field>\r\n <mat-label> {{fileNameLabel}} </mat-label>\r\n <input formControlName=\"name\" matInput [(ngModel)]=\"newAttachment.FileName\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-sm-12\" *ngIf=\"newAttachment.AttachmentType == 2\">\r\n <mat-form-field>\r\n <mat-label> Link </mat-label>\r\n <input formControlName=\"path\" required matInput [(ngModel)]=\"newAttachment.FilePath\">\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n <div class=\"row\"\r\n *ngIf=\"showCropImage != true && newAttachment.FileDataBase64 && newAttachment.IsImage == true\"\r\n style=\"margin-top: 10px;\">\r\n <div class=\"col-4\">\r\n <div class=\"single-attachment-inline-preview-container\">\r\n <img src=\"data:image/png;base64,{{newAttachment.FileDataBase64}}\">\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"row mt-2 mb-2\" *ngIf=\"showCropImage == true\">\r\n <div class=\"col-md-12 d-flex align-items-center justify-content-center\">\r\n <span class=\"mr-1\">Max H(px):</span>\r\n <mat-form-field>\r\n <input formControlName=\"customHeight\" type=\"number\" matInput [(ngModel)]=\"customHeight\"\r\n (change)=\"onDimensionsChange('H')\">\r\n </mat-form-field>\r\n\r\n <span class=\"ml-2 mr-1\">Max W(px):</span>\r\n <mat-form-field>\r\n <input formControlName=\"customWidth\" type=\"number\" matInput [(ngModel)]=\"customWidth\"\r\n (change)=\"onDimensionsChange('W')\">\r\n </mat-form-field>\r\n\r\n <button class=\"btn btn-primary mat-raised-button ml-2\" (click)=\"restoreOriginalDimensions()\"\r\n [disabled]=\"customWidth == originalWidth && customHeight == originalHeight\">\r\n <mat-icon style=\"vertical-align: middle;\">replay</mat-icon>\r\n </button>\r\n </div>\r\n </div>\r\n <div class=\"row justify-content-center\" *ngIf=\"showCropImage == true\">\r\n <div style=\"max-height: 450px; max-width: 450px;\">\r\n <image-cropper [imageChangedEvent]=\"imageChangedEvent\" [maintainAspectRatio]=\"false\"\r\n [autoCrop]=\"false\" [containWithinAspectRatio]=\"false\" [aspectRatio]=\"4/3\"\r\n [cropperMinWidth]=\"128\" [onlyScaleDown]=\"true\" [roundCropper]=\"false\" [canvasRotation]=\"0\"\r\n [transform]=\"transform\" [alignImage]=\"'left'\" format=\"png\" (imageCropped)=\"imageCropped($event)\"\r\n [resizeToWidth]=\"customWidth\" [resizeToHeight]=\"customHeight\">\r\n </image-cropper>\r\n </div>\r\n </div>\r\n <div class=\"row justify-content-center mt-2\" *ngIf=\"showCropImage == true\">\r\n <div style=\"max-height: 450px; max-width: 450px;\">\r\n <button class=\"btn btn-primary mat-raised-button eqp-attachments-confirm-btn mr-2\" type=\"button\"\r\n (click)=\"confirmCrop()\">\r\n {{confirmLabel}}\r\n </button>\r\n <button class=\"btn mat-raised-button eqp-attachments-abort-btn\" type=\"button\" (click)=\"abortFile()\">\r\n {{abortLabel}}\r\n </button>\r\n </div>\r\n </div>\r\n\r\n <div class=\"row mt-2\">\r\n <div class=\"col-sm-12 text-right\">\r\n <button class=\"btn btn-primary mat-raised-button eqp-attachments-save-btn mr-2\" type=\"submit\"\r\n [disabled]=\"showCropImage == true || newAttachmentForm?.disabled == true || disableSave()\">\r\n {{saveLabel}}\r\n </button>\r\n <button class=\"btn mat-raised-button eqp-attachments-exit-btn\" (click)=\"close()\"\r\n [disabled]=\"showCropImage == true\" type=\"button\">\r\n {{exitLabel}}\r\n </button>\r\n </div>\r\n </div>\r\n </form>\r\n\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #inlinePreviewTemplate let-row=\"row\">\r\n <div class=\"inline-preview-container\" *ngIf=\"row.IsImage\" (click)=\"openPreviewDialog(row)\">\r\n <img src=\"data:image/png;base64,{{row.FileThumbnailBase64 ? row.FileThumbnailBase64 : row.FileDataBase64}}\">\r\n </div>\r\n <div class=\"inline-preview-container\" *ngIf=\"!row.IsImage\" (click)=\"openPreviewDialog(row)\">\r\n <i [ngClass]=\"getAttachmentIcon(row)\"></i>\r\n </div>\r\n</ng-template>\r\n\r\n\r\n<ng-template #dialogPreview>\r\n <div class=\"container-fluid\" style=\"max-height: 70vh !important;\" *ngIf=\"selectedAttachment\">\r\n <div class=\"row\">\r\n <div class=\"header-title-standard\">\r\n {{previewLabel}} {{ selectedAttachment?.AttachmentType == attachmentType.FILE ? 'File' : 'Link'}}\r\n </div>\r\n </div>\r\n\r\n <div class=\"row mt-2\">\r\n <!-- ANTEPRIMA IMMAGINE -->\r\n <div class=\"col-12 text-center preview-container\" *ngIf=\"selectedAttachment.IsImage\">\r\n <img class=\"image-preview\"\r\n src=\"data:image/png;base64,{{selectedAttachment.FileDataBase64 ? selectedAttachment.FileDataBase64 : selectedAttachment.FileThumbnailBase64}}\">\r\n </div>\r\n\r\n <!-- ANTEPRIMA LINK -->\r\n <div class=\"col-12 preview-container\" *ngIf=\"!selectedAttachment.IsImage\">\r\n <iframe class=\"link-preview\" [src]=\"selectedAttachment.TrustedUrl\"\r\n [title]=\"selectedAttachment.FileName\"></iframe>\r\n </div>\r\n </div>\r\n\r\n <div class=\"row mt-3\">\r\n <div class=\"col-sm-12 text-right\">\r\n <button class=\"btn btn-primary mat-raised-button eqp-attachments-save-btn mr-2\" type=\"submit\"\r\n (click)=\"viewAttachment(selectedAttachment)\"\r\n *ngIf=\"selectedAttachment.AttachmentType != AttachmentType.LINK\">\r\n {{downloadLabel}}\r\n </button>\r\n <button class=\"btn mat-raised-button eqp-attachments-exit-btn\" mat-dialog-close type=\"button\"\r\n (click)=\"selectedAttachment = null\">\r\n {{exitLabel}}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n</ng-template>\r\n\r\n\r\n<!-- TEMPLATE PER IL PULSANTE DI AGGIUNTA NUOVO ALLEGATO -->\r\n<ng-template #addAttachmentButton>\r\n\r\n <!-- \r\n Pulsanti per l'aggiunta di un file o un link. Ne viene visualizzato uno se:\r\n - gli allowedTypes sono stati specificati, nell'array ne \u00E8 presente uno solo, quello inserito \u00E8 AttachmentType.FILE (o AttachmentType.LINK) \r\n e sono nella gestione di pi\u00F9 allegati (multipleAttachment == true)\r\n OPPURE\r\n - gli allowedTypes sono stati specificati, nell'array ne \u00E8 presente uno solo, quello inserito \u00E8 AttachmentType.FILE (o AttachmentType.LINK) \r\n e sono nella gestione di un singolo allegato (multipleAttachment == true) e non ne \u00E8 ancora stato selezionato uno (ovvero attachmentsList non esiste o non ha elementi)\r\n -->\r\n <button class=\"btn btn-primary mb-4 mr-5 eqp-attachments-add-btn\" mat-raised-button color=\"primary\" type=\"button\"\r\n *ngIf=\"allowedTypes && allowedTypes.length == 1 && (multipleAttachment == true || (!attachmentsList || attachmentsList.length == 0 || (attachmentsList.length > 0 && !attachmentsList[0])))\"\r\n (click)=\"openModalAddAttachment(allowedTypes[0])\" [disabled]=\"isDisabled\">\r\n <!-- Per l'aggiunta dei file mostro un'icona diversa dall'aggiunta dei link -->\r\n <mat-icon *ngIf=\"allowedTypes[0] == 1\">cloud_upload</mat-icon>\r\n <i class=\"fas fa-link\" *ngIf=\"allowedTypes[0] == 2\"></i>\r\n <span style=\"margin-left: 10px;\">{{addButtonLabel}} {{allowedTypes[0] == 1 ? \"file\" : \"link\"}}</span>\r\n </button>\r\n\r\n\r\n <!-- Pulsante per aprire il menu per la scelta del tipo di Attachment da creare -->\r\n <button class=\"btn btn-primary mb-4 mr-5 eqp-attachments-add-btn\" mat-raised-button color=\"primary\" type=\"button\"\r\n [matMenuTriggerFor]=\"attachmentTypeMenu\" [disabled]=\"isDisabled\"\r\n *ngIf=\"allowedTypes && allowedTypes.length > 1 && (multipleAttachment == true || (!attachmentsList || attachmentsList.length == 0 || (attachmentsList.length > 0 && !attachmentsList[0])))\">\r\n <mat-icon *ngIf=\"multipleAttachment != true\">cloud_upload</mat-icon>\r\n <mat-icon *ngIf=\"multipleAttachment == true\">add</mat-icon>\r\n <span style=\"margin-left: 0px;\"> {{addButtonLabel}} </span>\r\n </button>\r\n <mat-menu #attachmentTypeMenu=\"matMenu\">\r\n <button mat-menu-item (click)=\"openModalAddAttachment(1)\" class=\"eqp-attachments-file-btn\">\r\n <i class=\"fas fa-file\"></i>\r\n <span style=\"margin-left: 10px;\">File</span>\r\n </button>\r\n <button mat-menu-item (click)=\"openModalAddAttachment(2)\" class=\"eqp-attachments-link-btn\">\r\n <i class=\"fas fa-link\"></i>\r\n <span style=\"margin-left: 10px;\">Link</span>\r\n </button>\r\n </mat-menu>\r\n</ng-template>",
1004
+ template: "<!-- Se richiesta la gestione multipla mostra il pulsante di aggiunta e la tabella con l'elenco allegati -->\r\n<div *ngIf=\"multipleAttachment == true\">\r\n <mat-card [ngStyle]=\"{ 'box-shadow': showMatCard == false ? 'none' : null }\">\r\n <mat-card-header>\r\n <div class=\"col-md-6\">\r\n <div class=\"text-nowrap eqp-attachments-header-title\" *ngIf=\"showHeader == true\">\r\n {{headerTitle}}\r\n </div>\r\n </div>\r\n <div class=\"col-md-6 text-right\">\r\n <div class=\"row justify-content-end\">\r\n <!-- Template del button per l'aggiunta di un allegato -->\r\n <ng-container *ngTemplateOutlet=\"addAttachmentButton\"></ng-container>\r\n </div>\r\n </div>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <eqp-table #attachmentTable [createMatCard]=\"false\" #table [columns]=\"attachmentsColumns\"\r\n [isMultiLanguage]=\"isEqpTableMultiLanguage\" [data]=\"attachmentsList\"\r\n [emptyTableMessage]=\"emptyTableMessage\" [searchText]=\"eqpTableSearchText\">\r\n </eqp-table>\r\n </mat-card-content>\r\n </mat-card>\r\n</div>\r\n\r\n<!-- Se richiesta la gestione singola mostra il pulsante di caricamento di un singolo file -->\r\n<div *ngIf=\"multipleAttachment != true\">\r\n <!-- Template del button per l'aggiunta di un allegato -->\r\n <ng-container *ngTemplateOutlet=\"addAttachmentButton\"></ng-container>\r\n\r\n <button class=\"mb-2 mr-2 eqp-attachments-download-btn\" (click)=\"viewAttachment(attachmentsList[0])\" type=\"button\"\r\n mat-raised-button *ngIf=\"attachmentsList && attachmentsList.length > 0 && attachmentsList[0]\" color=\"primary\">\r\n <mat-icon *ngIf=\"attachmentsList[0].AttachmentType == AttachmentType.FILE\">download</mat-icon>\r\n <mat-icon *ngIf=\"attachmentsList[0].AttachmentType != AttachmentType.FILE\">open_in_new</mat-icon>\r\n {{attachmentsList[0].AttachmentType == AttachmentType.FILE ? downloadLabel : openLinkLabel}}\r\n </button>\r\n <button class=\"mb-2 mr-2 eqp-attachments-preview-btn\" (click)=\"openPreviewDialog(attachmentsList[0])\" type=\"button\"\r\n mat-raised-button color=\"primary\"\r\n *ngIf=\"attachmentsList && attachmentsList.length > 0 && attachmentsList[0] && (!attachmentsList[0].FileContentType || (!attachmentsList[0].FileContentType.startsWith('video') && !attachmentsList[0].FileContentType.startsWith('audio')))\">\r\n <mat-icon>visibility</mat-icon> {{previewLabel}}\r\n </button>\r\n <button class=\"mb-2 eqp-attachments-delete-btn\" (click)=\"deleteAttachment(attachmentsList[0])\" type=\"button\"\r\n mat-raised-button *ngIf=\"attachmentsList && attachmentsList.length > 0 && attachmentsList[0]\"\r\n [disabled]=\"isDisabled\">\r\n <mat-icon>delete</mat-icon> {{deleteLabel}}\r\n </button>\r\n\r\n <div class=\"row\" style=\"margin-top: 10px;\"\r\n *ngIf=\"attachmentsList.length > 0 && attachmentsList[0] && attachmentsList[0].FileDataBase64 && attachmentsList[0].IsImage == true\">\r\n <div class=\"col-sm-12\">\r\n <div class=\"single-attachment-inline-preview-container\">\r\n <img src=\"data:image/png;base64,{{attachmentsList[0].FileDataBase64}}\">\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"row\" *ngIf=\"attachmentsList.length > 0 && attachmentsList[0] && attachmentsList[0].IsImage != true\">\r\n <div class=\"col-sm-12\">\r\n <mat-form-field>\r\n <mat-label>{{fileNameLabel}}</mat-label>\r\n <input readonly matInput [(ngModel)]=\"attachmentsList[0].FileName\">\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n\r\n\r\n<ng-template #dialogAddAttachment>\r\n <div class=\"container-fluid eqp-attachments-dialog-add-container\"\r\n style=\"max-height: 70vh !important; overflow-x: hidden; overflow-y: auto;\">\r\n <form [formGroup]=\"newAttachmentForm\" (ngSubmit)=\"confirmAddAttachment()\" *ngIf=\"newAttachmentForm\">\r\n <div class=\"row\">\r\n <div class=\"header-title-standard\"> {{addButtonLabel}} {{ newAttachment.AttachmentType ==\r\n attachmentType.FILE ?\r\n 'File' : 'Link'}} </div>\r\n </div>\r\n <div class=\"row\" style=\"margin-top: 20px;\">\r\n <div class=\"col-sm-12\" *ngIf=\"newAttachment.AttachmentType == attachmentType.FILE\">\r\n <input #imageInput style=\"display:none;\" id=\"file_attachment\"\r\n name=\"file_attachment\" type=\"file\" (change)=\"onFileInputChange($event)\"\r\n [accept]=\"acceptedFileTypes\" [multiple]=\"loadMultipleFiles\"/>\r\n <button (click)=\"imageInput.click()\" type=\"button\" style=\"margin-left: 10px;\" id=\"file_attachment\"\r\n mat-raised-button color=\"primary\" [disabled]=\"showCropImage == true\"\r\n class=\"mb-2 btn btn-primary eqp-attachments-upload-btn\" *ngIf=\"(loadMultipleFiles != true && !newAttachment.FileDataBase64) || (loadMultipleFiles == true && newMultipleAttachments && newMultipleAttachments.length == 0)\">\r\n <mat-icon>cloud_upload</mat-icon>\r\n {{uploadFileLabel}}\r\n </button>\r\n <button (click)=\"abortFile()\" type=\"button\" style=\"margin-left: 10px;\" mat-raised-button\r\n *ngIf=\"(loadMultipleFiles != true && newAttachment.FileDataBase64) || (loadMultipleFiles == true && newMultipleAttachments && newMultipleAttachments.length > 0)\" class=\"mb-2 eqp-attachments-delete-btn\">\r\n <mat-icon>delete</mat-icon> {{deleteLabel}}\r\n </button>\r\n </div>\r\n <div class=\"col-sm-12\" *ngIf=\"newAttachment.AttachmentType == 2 || (selectedFile && loadMultipleFiles != true)\">\r\n <mat-form-field style=\"width: 100%;\">\r\n <mat-label> {{fileNameLabel}} </mat-label>\r\n <input formControlName=\"name\" matInput [(ngModel)]=\"newAttachment.FileName\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-sm-12\" *ngIf=\"newAttachment.AttachmentType == 2\">\r\n <mat-form-field style=\"width: 100%;\">\r\n <mat-label> Link </mat-label>\r\n <input formControlName=\"path\" required matInput [(ngModel)]=\"newAttachment.FilePath\">\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n\r\n <!-- Riporta l'elenco dei nomi dei file caricati contemporaneamente (visibile solo se loadMultipleFiles = TRUE e se ci sono realmente pi\u00F9 file senza link) -->\r\n <div class=\"row\" *ngIf=\"loadMultipleFiles == true && newMultipleAttachments && newMultipleAttachments.length > 0 && newMultipleAttachments[0].AttachmentType != attachmentType.LINK\">\r\n <div class=\"col-12\" *ngFor=\"let attach of newMultipleAttachments\">\r\n <mat-form-field style=\"width: 100%\">\r\n <mat-label> {{fileNameLabel}} </mat-label>\r\n <input disabled matInput [(ngModel)]=\"attach.FileName\" [ngModelOptions]=\"{standalone: true}\">\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n\r\n <!-- Riporta la preview dell'immagine quando \u00E8 richiesto il caricamento MULTIPLO ma \u00E8 stata selezionata una sola immagine (quindi \u00E8 entrato in gioco anche il croppie) -->\r\n <div class=\"row\" *ngIf=\"loadMultipleFiles == true && showCropImage != true && newMultipleAttachments && newMultipleAttachments.length == 1 && newMultipleAttachments[0].IsImage == true\" style=\"margin-top: 10px;\">\r\n <div class=\"col-4\">\r\n <div class=\"single-attachment-inline-preview-container\">\r\n <img src=\"data:image/png;base64,{{newMultipleAttachments[0].FileDataBase64}}\">\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Riporta la preview dell'immagine quando \u00E8 richiesto il caricamento SINGOLO ed \u00E8 stata selezionata un'immagine -->\r\n <div class=\"row\" *ngIf=\"loadMultipleFiles != true && showCropImage != true && newAttachment.FileDataBase64 && newAttachment.IsImage == true\" style=\"margin-top: 10px;\">\r\n <div class=\"col-4\">\r\n <div class=\"single-attachment-inline-preview-container\">\r\n <img src=\"data:image/png;base64,{{newAttachment.FileDataBase64}}\">\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Richiama il template per le funzionalit\u00E0 del CROPPIE -->\r\n <ng-container [ngTemplateOutlet]=\"croppieTemplate\" [ngTemplateOutletContext]=\"{form: newAttachmentForm}\" *ngIf=\"showCropImage == true\"></ng-container>\r\n\r\n <div class=\"row mt-2\">\r\n <div class=\"col-sm-12 text-right\">\r\n <button class=\"btn btn-primary mat-raised-button eqp-attachments-save-btn mr-2\" type=\"submit\"\r\n [disabled]=\"showCropImage == true || (loadMultipleFiles != true && newAttachmentForm?.disabled == true) || disableSave()\">\r\n {{saveLabel}}\r\n </button>\r\n <button class=\"btn mat-raised-button eqp-attachments-exit-btn\" (click)=\"close()\"\r\n [disabled]=\"showCropImage == true\" type=\"button\">\r\n {{exitLabel}}\r\n </button>\r\n </div>\r\n </div>\r\n </form>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #inlinePreviewTemplate let-row=\"row\">\r\n <div class=\"inline-preview-container\" *ngIf=\"row.AttachmentType != AttachmentType.LINK && row.IsImage\" (click)=\"openPreviewDialog(row)\">\r\n <img src=\"data:image/png;base64,{{row.FileThumbnailBase64 ? row.FileThumbnailBase64 : row.FileDataBase64}}\">\r\n </div>\r\n <div class=\"inline-preview-container\" *ngIf=\"row.AttachmentType != AttachmentType.LINK && !row.IsImage\" (click)=\"openPreviewDialog(row)\">\r\n <i [ngClass]=\"getAttachmentIcon(row)\"></i>\r\n </div>\r\n</ng-template>\r\n\r\n\r\n<ng-template #dialogPreview>\r\n <div class=\"container-fluid\" style=\"max-height: 70vh !important;\" *ngIf=\"selectedAttachment\">\r\n <div class=\"row\">\r\n <div class=\"header-title-standard\">\r\n {{previewLabel}} {{ selectedAttachment?.AttachmentType == attachmentType.FILE ? 'File' : 'Link'}}\r\n </div>\r\n </div>\r\n\r\n <div class=\"row mt-2\">\r\n <!-- ANTEPRIMA IMMAGINE -->\r\n <div class=\"col-12 text-center preview-container\" *ngIf=\"selectedAttachment.IsImage\">\r\n <img class=\"image-preview\"\r\n src=\"data:image/png;base64,{{selectedAttachment.FileDataBase64 ? selectedAttachment.FileDataBase64 : selectedAttachment.FileThumbnailBase64}}\">\r\n </div>\r\n\r\n <!-- ANTEPRIMA LINK -->\r\n <div class=\"col-12 preview-container\" *ngIf=\"!selectedAttachment.IsImage\">\r\n <iframe class=\"link-preview\" [src]=\"selectedAttachment.TrustedUrl\"\r\n [title]=\"selectedAttachment.FileName\"></iframe>\r\n </div>\r\n </div>\r\n\r\n <div class=\"row mt-3\">\r\n <div class=\"col-sm-12 text-right\">\r\n <button class=\"btn btn-primary mat-raised-button eqp-attachments-save-btn mr-2\" type=\"submit\"\r\n (click)=\"viewAttachment(selectedAttachment)\"\r\n *ngIf=\"selectedAttachment.AttachmentType != AttachmentType.LINK\">\r\n {{downloadLabel}}\r\n </button>\r\n <button class=\"btn mat-raised-button eqp-attachments-exit-btn\" mat-dialog-close type=\"button\"\r\n (click)=\"selectedAttachment = null\">\r\n {{exitLabel}}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n</ng-template>\r\n\r\n\r\n<!-- TEMPLATE PER IL PULSANTE DI AGGIUNTA NUOVO ALLEGATO -->\r\n<ng-template #addAttachmentButton>\r\n\r\n <!-- \r\n Pulsanti per l'aggiunta di un file o un link. Ne viene visualizzato uno se:\r\n - gli allowedTypes sono stati specificati, nell'array ne \u00E8 presente uno solo, quello inserito \u00E8 AttachmentType.FILE (o AttachmentType.LINK) \r\n e sono nella gestione di pi\u00F9 allegati (multipleAttachment == true)\r\n OPPURE\r\n - gli allowedTypes sono stati specificati, nell'array ne \u00E8 presente uno solo, quello inserito \u00E8 AttachmentType.FILE (o AttachmentType.LINK) \r\n e sono nella gestione di un singolo allegato (multipleAttachment == true) e non ne \u00E8 ancora stato selezionato uno (ovvero attachmentsList non esiste o non ha elementi)\r\n -->\r\n <button class=\"btn btn-primary mb-4 mr-5 eqp-attachments-add-btn\" mat-raised-button color=\"primary\" type=\"button\"\r\n *ngIf=\"allowedTypes && allowedTypes.length == 1 && (multipleAttachment == true || (!attachmentsList || attachmentsList.length == 0 || (attachmentsList.length > 0 && !attachmentsList[0])))\"\r\n (click)=\"openModalAddAttachment(allowedTypes[0])\" [disabled]=\"isDisabled\">\r\n <!-- Per l'aggiunta dei file mostro un'icona diversa dall'aggiunta dei link -->\r\n <mat-icon *ngIf=\"allowedTypes[0] == 1\">cloud_upload</mat-icon>\r\n <i class=\"fas fa-link\" *ngIf=\"allowedTypes[0] == 2\"></i>\r\n <span style=\"margin-left: 10px;\">{{addButtonLabel}} {{allowedTypes[0] == 1 ? \"file\" : \"link\"}}</span>\r\n </button>\r\n\r\n\r\n <!-- Pulsante per aprire il menu per la scelta del tipo di Attachment da creare -->\r\n <button class=\"btn btn-primary mb-4 mr-5 eqp-attachments-add-btn\" mat-raised-button color=\"primary\" type=\"button\"\r\n [matMenuTriggerFor]=\"attachmentTypeMenu\" [disabled]=\"isDisabled\"\r\n *ngIf=\"allowedTypes && allowedTypes.length > 1 && (multipleAttachment == true || (!attachmentsList || attachmentsList.length == 0 || (attachmentsList.length > 0 && !attachmentsList[0])))\">\r\n <mat-icon *ngIf=\"multipleAttachment != true\">cloud_upload</mat-icon>\r\n <mat-icon *ngIf=\"multipleAttachment == true\">add</mat-icon>\r\n <span style=\"margin-left: 0px;\"> {{addButtonLabel}} </span>\r\n </button>\r\n <mat-menu #attachmentTypeMenu=\"matMenu\">\r\n <button mat-menu-item (click)=\"openModalAddAttachment(1)\" class=\"eqp-attachments-file-btn\">\r\n <i class=\"fas fa-file\"></i>\r\n <span style=\"margin-left: 10px;\">File</span>\r\n </button>\r\n <button mat-menu-item (click)=\"openModalAddAttachment(2)\" class=\"eqp-attachments-link-btn\">\r\n <i class=\"fas fa-link\"></i>\r\n <span style=\"margin-left: 10px;\">Link</span>\r\n </button>\r\n </mat-menu>\r\n</ng-template>\r\n\r\n\r\n<ng-template #croppieTemplate let-form=\"form\">\r\n <div class=\"row mt-2 mb-2\" [formGroup]=\"form\">\r\n <div class=\"col-md-12 d-flex align-items-center justify-content-center\">\r\n <span class=\"mr-1\">Max H(px):</span>\r\n <mat-form-field>\r\n <input formControlName=\"customHeight\" type=\"number\" matInput [(ngModel)]=\"customHeight\"\r\n (change)=\"onDimensionsChange('H')\">\r\n </mat-form-field>\r\n\r\n <span class=\"ml-2 mr-1\">Max W(px):</span>\r\n <mat-form-field>\r\n <input formControlName=\"customWidth\" type=\"number\" matInput [(ngModel)]=\"customWidth\"\r\n (change)=\"onDimensionsChange('W')\">\r\n </mat-form-field>\r\n\r\n <button class=\"btn btn-primary mat-raised-button ml-2\" (click)=\"restoreOriginalDimensions()\"\r\n [disabled]=\"customWidth == originalWidth && customHeight == originalHeight\">\r\n <mat-icon style=\"vertical-align: middle;\">replay</mat-icon>\r\n </button>\r\n </div>\r\n </div>\r\n <div class=\"row justify-content-center\">\r\n <div style=\"max-height: 450px; max-width: 450px;\">\r\n <image-cropper [imageChangedEvent]=\"imageChangedEvent\" [maintainAspectRatio]=\"false\"\r\n [autoCrop]=\"false\" [containWithinAspectRatio]=\"false\" [aspectRatio]=\"4/3\"\r\n [cropperMinWidth]=\"128\" [onlyScaleDown]=\"true\" [roundCropper]=\"false\" [canvasRotation]=\"0\"\r\n [transform]=\"transform\" [alignImage]=\"'left'\" format=\"png\" (imageCropped)=\"imageCropped($event)\"\r\n [resizeToWidth]=\"customWidth\" [resizeToHeight]=\"customHeight\">\r\n </image-cropper>\r\n </div>\r\n </div>\r\n <div class=\"row justify-content-center mt-2\">\r\n <div style=\"max-height: 450px; max-width: 450px;\">\r\n <button class=\"btn btn-primary mat-raised-button eqp-attachments-confirm-btn mr-2\" type=\"button\"\r\n (click)=\"confirmCrop()\">\r\n {{confirmLabel}}\r\n </button>\r\n <button class=\"btn mat-raised-button eqp-attachments-abort-btn\" type=\"button\" (click)=\"abortFile()\">\r\n {{abortLabel}}\r\n </button>\r\n </div>\r\n </div>\r\n</ng-template>",
868
1005
  styles: [".eqp-attachments-header-title{font-weight:700;font-size:19px;line-height:24px;margin-bottom:auto}.single-attachment-inline-preview-container{max-height:400px;max-width:400px;display:flex;align-items:center}.single-attachment-inline-preview-container img{max-width:100%;max-height:120px}.inline-preview-container{max-height:100px;max-width:100px;display:flex;align-items:center;justify-content:center;width:100%;cursor:pointer}.inline-preview-container img{max-width:100%;max-height:100px}.inline-preview-container i{font-size:25px;margin:auto}.preview-container{max-height:60vh;max-width:100%}.preview-container .image-preview{max-width:100%;max-height:100%}.preview-container .link-preview{width:70vw;height:55vh}"]
869
1006
  })
870
1007
  ], EqpAttachmentsComponent);