novedades.component copy.html 6.74 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
<div class="main-content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-12">
                <div class="container-fluid">
                    <div class="card-title">
                        <h2> Tipos de Novedades</h2>
                    </div>
                    <div class="row">

                        <!--
                        <h5 class="mt-10">
                            {{allNovedades | json}}
                        </h5> -->
                        <button type="button" (click)="showDialog()" class="btn btn-primary float-end">Ingresar nueva Novedad</button>


                        <p-table [value]="allNovedades">
                            <ng-template pTemplate="header">
                                <tr>
                                    <th>CODIGO</th>
                                    <th>DESCRIPCION</th>
                                    <th>ESTADO</th>
                                    <th>USUARIO CREA</th>
                                    <!--     <th>USUARIO MODIFICA</th>  -->
                                    <th>FECHA CREA</th>
                                    <!--   <th>FECHA MODIFICA</th> -->
                                    <th>opciones</th>

                                </tr>
                            </ng-template>
                            <ng-template pTemplate="body" let-item>
                                <tr>
                                    <td>{{item.code}}</td>
                                    <td>{{item.descripcion}}</td>
                                    <td>{{item.estado}}</td>
                                    <td>{{item.usercrea}}</td>
                                    <td>{{item.usermodif}}</td>
                                    <td>{{item.fechacrea | date:'dd/MM/yyyy' }}</td>
                                    <td>{{item.fechamodif}}</td>
                                    <!-- <button class="btn btn-danger">editar </button> -->

                                    <button (click)="editar()" class="btn btn-danger ">Editar Registro</button>
                                </tr>
                            </ng-template>
                        </p-table>

                        <!--
                        <ul>
                            <li *ngFor="let item of allNovedades">
                                {{item.code}} {{item.descripcion}}
                            </li>
                        </ul>  -->

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<!-- modal para crear un formulario -->
<p-dialog header="Title" [(visible)]="display">
    <form [formGroup]="miFormulario">
        <div class="mb-3">
            <label for="codeNovedad" class="form-label">id</label>
            <input formControlName="code" type=" code" class="form-control" id="codeNovedad" aria-describedby="emailHelp">
            <div id="emailHelp" class="form-text">Codigo del Registro</div>
        </div>
        <div class="mb-3">
            <label for="descripcion" class="form-label">Descripción</label>
            <input formControlName="descripcion" type=" descripcion " class="form-control " id="descripcion ">
        </div>
        <div class="mb-3 ">
            <label for="estado " class="form-label ">Estado</label>
            <input formControlName="estado" type="estado " class="form-control " id="estado ">
            <div id="estado" class="form-text"> A Activo I Inactivo</div>
        </div>
        <div class="mb-3 ">
            <label for="UsuarioC " class="form-label ">UsuarioC</label>
            <input formControlName="usercrea" type="usercrea " class="form-control " id="UsuarioC ">
        </div>
        <button (click)="guardar() " class="btn btn-primary " [disabled]="miFormulario.invalid">Guardar Registro</button>
    </form>
    {{miFormulario.value| json}}
</p-dialog>


<!-- modal para editar un formulario  
<div class="card">
    <h5>Row Editing</h5>
    <p-table [value]="allNovedades" dataKey="id" editMode="row">
        <ng-template pTemplate="header">
            <tr>
                <th>CODIGO</th>
                <th>DESCRIPCION</th>
                <th>ESTADO</th>
                <th>USUARIO CREA</th>

                <th>FECHA CREA</th>

                <th>opciones</th>
                <th style="width:8rem"></th>
            </tr>
        </ng-template>
        <ng-template pTemplate="body" let-product let-editing="editing" let-ri="rowIndex">
            <tr [pEditableRow]="product">
                <td>
                    <p-cellEditor>
                        <ng-template pTemplate="input">
                            <input pInputText type="text" [(ngModel)]="product.code">
                        </ng-template>
                        <ng-template pTemplate="output">
                            {{product.code}}
                        </ng-template>
                    </p-cellEditor>
                </td>
                <td>
                    <p-cellEditor>
                        <ng-template pTemplate="input">
                            <input pInputText type="text" [(ngModel)]="product.descripcion" required>
                        </ng-template>
                        <ng-template pTemplate="output">
                            {{product.descripcion}}
                        </ng-template>
                    </p-cellEditor>
                </td>
                <td>
                    <p-cellEditor>
                        <ng-template pTemplate="input">
                            <input pInputText type="text" [(ngModel)]="product.estado" required>
                       
                            <p-dropdown [options]="statuses" [(ngModel)]="product.estado" [style]="{'width':'100%'}"></p-dropdown>
                   
</ng-template>
<ng-template pTemplate="output">
    {{product.estado}}
</ng-template>
</p-cellEditor>
</td>
<td>
    <p-cellEditor>
        <ng-template pTemplate="input">
            <input pInputText type="text" [(ngModel)]="product.usercrea">
        </ng-template>
        <ng-template pTemplate="output">
            {{product.usercrea}}
        </ng-template>
    </p-cellEditor>
</td>
<td style="text-align:center">
    <button *ngIf="!editing" pButton pRipple type="button" pInitEditableRow icon="pi pi-pencil" (click)="onRowEditInit(product)" class="p-button-rounded p-button-text"></button>
    <button *ngIf="editing" pButton pRipple type="button" pSaveEditableRow icon="pi pi-check" (click)="onRowEditSave(product)" class="p-button-rounded p-button-text p-button-success p-mr-2"></button>
    <button *ngIf="editing" pButton pRipple type="button" pCancelEditableRow icon="pi pi-times" (click)="onRowEditCancel(product, ri)" class="p-button-rounded p-button-text p-button-danger"></button>
</td>
</tr>
</ng-template>
</p-table>
</div>

-->