Browse Source

Modicaciones de resources

JeanBenitez 3 năm trước cách đây
mục cha
commit
2d7d58e0f2

+ 0 - 0
sistema-mantenimiento-front/src/app/components/resources/dialogs/test/showmultiform/showmultiform.component.css


+ 61 - 0
sistema-mantenimiento-front/src/app/components/resources/dialogs/test/showmultiform/showmultiform.component.html

@@ -0,0 +1,61 @@
+<h2 mat-dialog-title>Datos multiples registrados</h2>
+<mat-dialog-content>
+  <table class="mat-table cdk-table animated fadeIn">
+    <thead role="rowgroup">
+      <tr class="mat-header-row cdk-header-row ng-star-inserted">
+        <th
+          align="center"
+          class="mat-header-cell cdk-header-cell ng-star-inserted"
+          style="width: 3%"
+        >
+          #
+        </th>
+        <th
+          align="left"
+          style="padding-left: 1%"
+          class="mat-header-cell cdk-header-cell ng-star-inserted"
+          *ngFor="let head of data.estructura.form"
+        >
+          {{ head.label }}
+        </th>
+
+        <th
+          class="mat-header-cell cdk-header-cell ng-star-inserted"
+          style="width: 20%"
+        >
+          Acciones
+        </th>
+      </tr>
+    </thead>
+    <tbody>
+      <tr
+        class="mat-row cdk-row ng-star-inserted"
+        *ngFor="let multi of data.datos; let index = index"
+      >
+        <td align="center" class="mat-cell cdk-cell ng-star-inserted">
+          {{ index + 1 }}
+        </td>
+        <td
+          style="padding-left: 1%"
+          class="mat-cell cdk-cell ng-star-inserted"
+          *ngFor="let head of multi"
+        >
+          {{ dataShow(head.value) }}
+        </td>
+        <td class="mat-cell cdk-cell ng-star-inserted" align="center">
+            <button
+              mat-mini-fab
+              color="warn"
+              style="box-shadow: none !important"
+              (click)="deleteItem(index)"
+            >
+              <mat-icon>delete</mat-icon>
+            </button>
+        </td>
+      </tr>
+    </tbody>
+  </table>
+</mat-dialog-content>
+<mat-dialog-actions align="end">
+  <button mat-button [mat-dialog-close]="data.datos">Cerrar</button>
+</mat-dialog-actions>

+ 25 - 0
sistema-mantenimiento-front/src/app/components/resources/dialogs/test/showmultiform/showmultiform.component.spec.ts

@@ -0,0 +1,25 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { SHOWMULTIFORMComponent } from './showmultiform.component';
+
+describe('SHOWMULTIFORMComponent', () => {
+  let component: SHOWMULTIFORMComponent;
+  let fixture: ComponentFixture<SHOWMULTIFORMComponent>;
+
+  beforeEach(async () => {
+    await TestBed.configureTestingModule({
+      declarations: [ SHOWMULTIFORMComponent ]
+    })
+    .compileComponents();
+  });
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(SHOWMULTIFORMComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});

+ 34 - 0
sistema-mantenimiento-front/src/app/components/resources/dialogs/test/showmultiform/showmultiform.component.ts

@@ -0,0 +1,34 @@
+import { Component, Inject, OnInit } from '@angular/core';
+import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
+import { ResourcesService } from 'src/app/services/resources/resources.service';
+
+@Component({
+  selector: 'app-showmultiform',
+  templateUrl: './showmultiform.component.html',
+  styleUrls: ['./showmultiform.component.css'],
+})
+export class SHOWMULTIFORMComponent implements OnInit {
+  btnSmall: boolean = false;
+  constructor(
+    private _resourcesService: ResourcesService,
+    public dialogRef: MatDialogRef<any>,
+    @Inject(MAT_DIALOG_DATA) public data: any
+  ) {
+  }
+
+  ngOnInit(): void {}
+
+  public deleteItem(index:number){
+    this.data.datos.splice(index, 1);
+    this._resourcesService.openSnackBar("¡Elemento eliminado!", "Cerrar", 1000);
+  }
+
+  dataShow(item: any){    
+    let type = typeof item;
+    if(type == 'string'){
+      return item
+    }else{
+      return item.VALUE
+    }
+  }
+}