@fluxhub/fluxhub-lib 1.0.209 → 1.0.210

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.
@@ -32,7 +32,7 @@ import { TranslateModule } from '@ngx-translate/core';
32
32
  import { DragulaService, DragulaModule } from 'ng2-dragula';
33
33
  import { MatDialogRef, MatDialog, DateAdapter, MAT_DATE_LOCALE, MatAutocompleteModule, MatButtonModule, MatButtonToggleModule, MatPaginatorModule, MatCardModule, MatCheckboxModule, MatChipsModule, MatDatepickerModule, MatGridListModule, MatIconModule, MatInputModule, MatListModule, MatMenuModule, MatProgressBarModule, MatProgressSpinnerModule, MatRadioModule, MatSelectModule, MatSidenavModule, MatSliderModule, MatSortModule, MatSlideToggleModule, MatSnackBarModule, MatTableModule, MatTabsModule, MatToolbarModule, MatTooltipModule, MatFormFieldModule, MatExpansionModule, MatStepperModule, MatDialogModule, MatNativeDateModule } from '@angular/material';
34
34
  import { ActivatedRoute, Router } from '@angular/router';
35
- import { Injectable, forwardRef, Component, Input, ViewChild, Output, EventEmitter, ElementRef, Directive, Inject, PLATFORM_ID, Pipe, ViewContainerRef, NgModule, defineInjectable, inject, HostListener } from '@angular/core';
35
+ import { Injectable, Component, Input, Output, EventEmitter, forwardRef, ViewChild, ElementRef, Inject, PLATFORM_ID, Directive, Pipe, ViewContainerRef, NgModule, defineInjectable, inject, HostListener } from '@angular/core';
36
36
  import { Http } from '@angular/http';
37
37
  import { SlimLoadingBarService } from 'ng2-slim-loading-bar';
38
38
  import { ToastrService } from 'ngx-toastr';
@@ -2656,6 +2656,7 @@ class FHUploadComponent {
2656
2656
  this.b_edit_loaded = false;
2657
2657
  this.tipo = '';
2658
2658
  this.b_ini = false;
2659
+ this.lista_allegati = [];
2659
2660
  this.uploader = new FileUploader({
2660
2661
  url: this.app_s.API_ENDPOINT + this.app_s.UPLOAD_ENDPOINT,
2661
2662
  'maxFileSize': 500 * 1024 * 1024
@@ -2680,6 +2681,7 @@ class FHUploadComponent {
2680
2681
  * @return {?}
2681
2682
  */
2682
2683
  ngOnInit() {
2684
+ console.log('INIT');
2683
2685
  /** @type {?} */
2684
2686
  var uo = {};
2685
2687
  uo.headers = [{ name: 'Authorization', value: 'Bearer ' + localStorage.getItem(this.app_s.COMPANY_KEY + "token") }];
@@ -2696,8 +2698,9 @@ class FHUploadComponent {
2696
2698
  this.uploader.onErrorItem = (a, b, c, d) => {
2697
2699
  this.toastr.error(b);
2698
2700
  };
2699
- this.uploader.onAfterAddingFile = () => {
2700
- this.ch();
2701
+ this.uploader.onAfterAddingFile = (fileItem) => {
2702
+ console.log('onAfterAddingFile');
2703
+ this.ch(fileItem);
2701
2704
  };
2702
2705
  this.uploader.onProgressItem = (fileItem, progress) => {
2703
2706
  // console.log(fileItem);
@@ -2726,13 +2729,22 @@ class FHUploadComponent {
2726
2729
  window.open(this.app_s.COMPANY_SITE_ROOT + '/uploads/' + this.App + '/' + this.K + '/' + this.file_name);
2727
2730
  }
2728
2731
  /**
2732
+ * @param {?} fileItem
2729
2733
  * @return {?}
2730
2734
  */
2731
- ch() {
2735
+ ch(fileItem) {
2732
2736
  if (this.descri_obb && this.descrizione == '') {
2733
2737
  this.toastr.error(this.inserire_descrizione);
2734
2738
  return;
2735
2739
  }
2740
+ console.log('this.lista_allegati ', this.lista_allegati);
2741
+ console.log('fileItem ', fileItem);
2742
+ for (let i = 0; i < this.lista_allegati.length; i++) {
2743
+ if (this.lista_allegati[i].Filename.toLowerCase() == fileItem.file.name.toLowerCase()) {
2744
+ this.toastr.error('File già presente (cancellarlo per aggiornarlo)');
2745
+ return;
2746
+ }
2747
+ }
2736
2748
  this.uploader.onBuildItemForm = (item, form) => {
2737
2749
  form.append('App', this.App);
2738
2750
  form.append('K', this.K);
@@ -2806,6 +2818,7 @@ FHUploadComponent.decorators = [
2806
2818
  { type: Component, args: [{
2807
2819
  selector: 'FHUpload',
2808
2820
  template: `
2821
+ aaaazzz
2809
2822
  <div *ngIf="loading" fxLayout="row">
2810
2823
  WAIT
2811
2824
  </div>
@@ -3240,6 +3253,7 @@ class FHUploadPanelComponent {
3240
3253
  this.enabled = true;
3241
3254
  this.label = '';
3242
3255
  this.sovrascrivi_path = '';
3256
+ this.access_control = false;
3243
3257
  this.change = new EventEmitter();
3244
3258
  this.App = '';
3245
3259
  this.K = '';
@@ -3304,6 +3318,7 @@ class FHUploadPanelComponent {
3304
3318
  * @return {?}
3305
3319
  */
3306
3320
  ngOnInit() {
3321
+ console.log('INIT1');
3307
3322
  this.upc.single = false;
3308
3323
  this.b_mobile = this._appservice.getState().pageFullscreen;
3309
3324
  this
@@ -3351,7 +3366,10 @@ class FHUploadPanelComponent {
3351
3366
  if ('3G2|3GA|3GP|7Z|AA|AAC|AC|ACCDB|ACCDT|ADN|AI|AIF|AIFC|AIFF|AIT|AMR|ANI|APK|APP|APPLESCRIPT|ASAX|ASC|ASCX|ASF|ASH|ASHX|ASMX|ASP|ASPX|ASX|AU|AUP|AVI|AXD|AZE|BAK|BASH|BAT|BIN|BLANK|BMP|BOWERRC|BPG|BROWSER|BZ2|C|CAB|CAD|CAF|CAL|CD|CER|CFG|CFM|CFML|CGI|CLASS|CMD|CODEKIT|COFFEE|COFFEELINTIGNORE|COM|COMPILE|CONF|CONFIG|CPP|CPTX|CR2|CRDOWNLOAD|CRT|CRYPT|CS|CSH|CSON|CSPROJ|CSS|CSV|CUE|DAT|DB|DBF|DEB|DGN|DIST|DIZ|DLL|DMG|DNG|DOC|DOCB|DOCM|DOCX|DOT|DOTM|DOTX|DOWNLOAD|DPJ|DS_STORE|DTD|DWG|DXF|EDITORCONFIG|EL|ENC|EOT|EPS|EPUB|ESLINTIGNORE|EXE|F4V|FAX|FB2|FLA|FLAC|FLV|FOLDER|GADGET|GDP|GEM|GIF|GITATTRIBUTES|GITIGNORE|GO|GPG|GZ|H|HANDLEBARS|HBS|HEIC|HS|HSL|HTM|HTML|IBOOKS|ICNS|ICO|ICS|IDX|IFF|IFO|IMAGE|IMG|IN|INDD|INF|INI|ISO|J2|JAR|JAVA|JPE|JPEG|JPG|JS|JSON|JSP|JSX|KEY|KF8|KMK|KSH|KUP|LESS|LEX|LICX|LISP|LIT|LNK|LOCK|LOG|LUA|M|M2V|M3U|M3U8|M4|M4A|M4R|M4V|MAP|MASTER|MC|MD|MDB|MDF|ME|MI|MID|MIDI|MK|MKV|MM|MO|MOBI|MOD|MOV|MP2|MP3|MP4|MPA|MPD|MPE|MPEG|MPG|MPGA|MPP|MPT|MSI|MSU|NEF|NES|NFO|NIX|NPMIGNORE|ODB|ODS|ODT|OGG|OGV|OST|OTF|OTT|OVA|OVF|P12|P7B|PAGES|PART|PCD|PDB|PDF|PEM|PFX|PGP|PH|PHAR|PHP|PKG|PL|PLIST|PM|PNG|PO|POM|POT|POTX|PPS|PPSX|PPT|PPTM|PPTX|PROP|PS|PS1|PSD|PSP|PST|PUB|PY|PYC|QT|RA|RAM|RAR|RAW|RB|RDF|RESX|RETRY|RM|ROM|RPM|RSA|RSS|RTF|RU|RUB|SASS|SCSS|SDF|SED|SH|SITEMAP|SKIN|SLDM|SLDX|SLN|SOL|SQL|SQLITE|STEP|STL|SVG|SWD|SWF|SWIFT|SYS|TAR|TCSH|TEX|TFIGNORE|TGA|TGZ|TIF|TIFF|TMP|TORRENT|TS|TSV|TTF|TWIG|TXT|UDF|VB|VBPROJ|VBS|VCD|VCS|VDI|VDX|VMDK|VOB|VSCODEIGNORE|VSD|VSS|VST|VSX|VTX|WAR|WAV|WBK|WEBINFO|WEBM|WEBP|WMA|WMF|WMV|WOFF|WOFF2|WPS|WSF|XAML|XCF|XLM|XLS|XLSM|XLSX|XLT|XLTM|XLTX|XML|XPI|XPS|XRB|XSD|XSL|XSPF|XZ|YAML|YML|Z|ZIP|ZSH'.indexOf(arrf[arrf.length - 1].toLocaleUpperCase()) != -1)
3352
3367
  iconf = arrf[arrf.length - 1].toLocaleLowerCase();
3353
3368
  this.arr_g[i].icon = iconf + '.svg';
3369
+ this.arr_g[i].can_delete = !this.access_control || this.arr_g[i].idp == this._appservice.user;
3354
3370
  }
3371
+ if (this.upc == null)
3372
+ this.upc.lista_allegati = this.arr_g;
3355
3373
  }
3356
3374
  });
3357
3375
  }
@@ -3375,6 +3393,7 @@ FHUploadPanelComponent.decorators = [
3375
3393
  <th style="width:50%">Nome</th>
3376
3394
  <th style="width:60px;text-align:center">Dim.</th>
3377
3395
  <th style="width:50%">Descrizione</th>
3396
+ <th style="width:30%">Utente</th>
3378
3397
  <th style="width:240px;text-align:center">Data</th>
3379
3398
  <th style="width:40px" class="actions"></th>
3380
3399
  <th *ngIf="enabled" style="width:40px" class="actions"></th>
@@ -3392,6 +3411,7 @@ FHUploadPanelComponent.decorators = [
3392
3411
  <td *ngIf="!b_mobile">{{app.Filename}}</td>
3393
3412
  <td *ngIf="!b_mobile" style="text-align:center">{{app.Filesize}}</td>
3394
3413
  <td *ngIf="!b_mobile">{{app.descrizione}}</td>
3414
+ <td *ngIf="!b_mobile">{{app.nc}}</td>
3395
3415
  <td *ngIf="!b_mobile" style="text-align:center">{{app.dt_ins | date: 'dd/MM/yyyy HH:mm:ss'}}</td>
3396
3416
  <td *ngIf="!b_mobile" style="text-align:center">
3397
3417
  <button mat-icon-button matTooltip="Download File" (click)="download_all(app)">
@@ -3400,9 +3420,15 @@ FHUploadPanelComponent.decorators = [
3400
3420
  </td>
3401
3421
 
3402
3422
  <td *ngIf="enabled" style="text-align:center">
3403
- <a mat-icon-button matTooltip="Elimina File" *ngIf="enabled" (click)="delete(app)">
3423
+ <a mat-icon-button matTooltip="Elimina File" *ngIf="app.can_delete" (click)="delete(app)">
3404
3424
  <mat-icon>delete</mat-icon>
3405
- </a></td>
3425
+ </a>
3426
+
3427
+ <a mat-icon-button [matTooltip]="'Cancellazione consentita solo a: '+app.nc" *ngIf="!app.can_delete" [disabled]="true" >
3428
+ <mat-icon>delete</mat-icon>
3429
+ </a>
3430
+
3431
+ </td>
3406
3432
 
3407
3433
  </tr>
3408
3434
  </table>
@@ -3431,6 +3457,7 @@ FHUploadPanelComponent.propDecorators = {
3431
3457
  enabled: [{ type: Input }],
3432
3458
  label: [{ type: Input }],
3433
3459
  sovrascrivi_path: [{ type: Input }],
3460
+ access_control: [{ type: Input }],
3434
3461
  change: [{ type: Output }],
3435
3462
  upc: [{ type: ViewChild, args: ['upc',] }]
3436
3463
  };
@@ -10430,6 +10457,7 @@ class win_uploads {
10430
10457
  this.app_s = app_s;
10431
10458
  this.enabled = true;
10432
10459
  this.change = new EventEmitter();
10460
+ this.access_control = true;
10433
10461
  this.App = '';
10434
10462
  this.K = '';
10435
10463
  this.b_edit_loaded = false;
@@ -10512,9 +10540,18 @@ class win_uploads {
10512
10540
  });
10513
10541
  }
10514
10542
  /**
10543
+ * @param {?} fileItem
10515
10544
  * @return {?}
10516
10545
  */
10517
- ch() {
10546
+ ch(fileItem) {
10547
+ console.log('this.arr_g ', this.arr_g);
10548
+ console.log('fileItem ', fileItem);
10549
+ for (let i = 0; i < this.arr_g.length; i++) {
10550
+ if (this.arr_g[i].Filename.toLowerCase() == fileItem.file.name.toLowerCase()) {
10551
+ this.toastr.error('File già presente (cancellarlo per aggiornarlo)');
10552
+ return;
10553
+ }
10554
+ }
10518
10555
  this.uploader.onBuildItemForm = (item, form) => {
10519
10556
  form.append('App', this.App);
10520
10557
  form.append('K', this.K);
@@ -10560,6 +10597,7 @@ class win_uploads {
10560
10597
  if ('3G2|3GA|3GP|7Z|AA|AAC|AC|ACCDB|ACCDT|ADN|AI|AIF|AIFC|AIFF|AIT|AMR|ANI|APK|APP|APPLESCRIPT|ASAX|ASC|ASCX|ASF|ASH|ASHX|ASMX|ASP|ASPX|ASX|AU|AUP|AVI|AXD|AZE|BAK|BASH|BAT|BIN|BLANK|BMP|BOWERRC|BPG|BROWSER|BZ2|C|CAB|CAD|CAF|CAL|CD|CER|CFG|CFM|CFML|CGI|CLASS|CMD|CODEKIT|COFFEE|COFFEELINTIGNORE|COM|COMPILE|CONF|CONFIG|CPP|CPTX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T|TS|TSV|TTF|TWIG|TXT|UDF|VB|VBPROJ|VBS|VCD|VCS|VDI|VDX|VMDK|VOB|VSCODEIGNORE|VSD|VSS|VST|VSX|VTX|WAR|WAV|WBK|WEBINFO|WEBM|WEBP|WMA|WMF|WMV|WOFF|WOFF2|WPS|WSF|XAML|XCF|XLM|XLS|XLSM|XLSX|XLT|XLTM|XLTX|XML|XPI|XPS|XRB|XSD|XSL|XSPF|XZ|YAML|YML|Z|ZIP|ZSH'.indexOf(arrf[arrf.length - 1].toLocaleUpperCase()) != -1)
10561
10598
  iconf = arrf[arrf.length - 1].toLocaleLowerCase();
10562
10599
  this.arr_g[i].icon = iconf + '.svg';
10600
+ this.arr_g[i].can_delete = !this.access_control || this.arr_g[i].idp == this.app_s.user;
10563
10601
  }
10564
10602
  }
10565
10603
  });
@@ -10571,6 +10609,10 @@ class win_uploads {
10571
10609
  this.App = this.app_s.getState().wkf_doc_info.uiid_app;
10572
10610
  this.K = this.app_s.getState().wkf_doc_info.uiid_doc;
10573
10611
  this.single = false;
10612
+ this.uploader.onAfterAddingFile = (fileItem) => {
10613
+ console.log('onAfterAddingFile');
10614
+ this.ch(fileItem);
10615
+ };
10574
10616
  this.init(this.App, this.K);
10575
10617
  this.ref_allegato();
10576
10618
  }
@@ -10604,7 +10646,7 @@ win_uploads.decorators = [
10604
10646
  <input matInput type="text" name="descrizione" [(ngModel)]="descrizione" placeholder="{{label}}">
10605
10647
 
10606
10648
 
10607
- <input type="file" ng2FileSelect [uploader]="uploader" multiple (change)="ch()"/>
10649
+ <input type="file" ng2FileSelect [uploader]="uploader" multiple />
10608
10650
  <!--<button mat-raised-button *ngIf="b_edit_loaded" (click)="download_all()">{{label_b}}</button>-->
10609
10651
  </div>
10610
10652
  <br>
@@ -10619,6 +10661,8 @@ win_uploads.decorators = [
10619
10661
  <th style="width:50%">Nome</th>
10620
10662
  <th style="width:60px;text-align:center">Dim.</th>
10621
10663
  <th style="width:50%">Descrizione</th>
10664
+
10665
+ <th style="width:30%">Utente</th>
10622
10666
  <th style="width:240px;text-align:center">Data</th>
10623
10667
  <th style="width:40px" class="actions"></th>
10624
10668
  <th *ngIf="enabled" style="width:40px" class="actions"></th>
@@ -10633,6 +10677,7 @@ win_uploads.decorators = [
10633
10677
  <td>{{app.Filename}}</td>
10634
10678
  <td style="text-align:center">{{app.Filesize}}</td>
10635
10679
  <td>{{app.descrizione}}</td>
10680
+ <td>{{app.nc}}</td>
10636
10681
  <td style="text-align:center">{{app.dt_ins | date: 'dd/MM/yyyy HH:mm:ss'}}</td>
10637
10682
  <td style="text-align:center">
10638
10683
  <button mat-icon-button matTooltip="Download File" (click)="download_all(app)">
@@ -10640,9 +10685,17 @@ win_uploads.decorators = [
10640
10685
  </button>
10641
10686
  </td>
10642
10687
 
10643
- <td style="text-align:center"><a mat-icon-button *ngIf="enabled" (click)="delete(app)">
10644
- <mat-icon>delete</mat-icon>
10645
- </a></td>
10688
+
10689
+ <td *ngIf="enabled" style="text-align:center">
10690
+ <a mat-icon-button matTooltip="Elimina File" *ngIf="app.can_delete" (click)="delete(app)">
10691
+ <mat-icon>delete</mat-icon>
10692
+ </a>
10693
+
10694
+ <a mat-icon-button [matTooltip]="'Cancellazione consentita solo a: '+app.nc" *ngIf="!app.can_delete" [disabled]="true" >
10695
+ <mat-icon>delete</mat-icon>
10696
+ </a>
10697
+
10698
+ </td>
10646
10699
  </tr>
10647
10700
  </table>
10648
10701
 
@@ -10672,6 +10725,7 @@ win_uploads.propDecorators = {
10672
10725
  enabled: [{ type: Input }],
10673
10726
  change: [{ type: Output }],
10674
10727
  upc: [{ type: ViewChild, args: ['upc',] }],
10728
+ access_control: [{ type: Input }],
10675
10729
  single: [{ type: Input }]
10676
10730
  };
10677
10731