|
|
@@ -1,4 +1,13 @@
|
|
|
-<h1 mat-dialog-title class="prevent-select">Análisis de costos</h1>
|
|
|
+<h1 mat-dialog-title class="prevent-select">
|
|
|
+ {{ hasPreviousAnalysis ? 'Análisis de costos - Registro previo' : 'Análisis de costos' }}
|
|
|
+</h1>
|
|
|
+
|
|
|
+@if (hasPreviousAnalysis && previousAnalysis) {
|
|
|
+ <div class="previous-analysis-info">
|
|
|
+ <p><strong>Fecha:</strong> {{ previousAnalysis.FECHA }}</p>
|
|
|
+ <p><strong>Usuario:</strong> {{ previousAnalysis.USUARIO }}</p>
|
|
|
+ </div>
|
|
|
+}
|
|
|
|
|
|
<div mat-dialog-content class="cost-analysis-content">
|
|
|
@if (costData) {
|
|
|
@@ -11,11 +20,11 @@
|
|
|
<span class="user-name">{{ user.NOMBRE }}</span>
|
|
|
<mat-form-field appearance="outline" class="cost-input">
|
|
|
<mat-label>Costo</mat-label>
|
|
|
- <input matInput type="number" [(ngModel)]="userCosts[user.ID].amount" (ngModelChange)="onUserCostChange()">
|
|
|
+ <input matInput type="number" [(ngModel)]="userCosts[user.ID].amount" (ngModelChange)="onUserCostChange()" [readonly]="isReadOnly">
|
|
|
</mat-form-field>
|
|
|
<mat-form-field appearance="outline" class="currency-select">
|
|
|
<mat-label>Moneda</mat-label>
|
|
|
- <mat-select [(ngModel)]="userCosts[user.ID].currency" (selectionChange)="onUserCostChange()">
|
|
|
+ <mat-select [(ngModel)]="userCosts[user.ID].currency" (selectionChange)="onUserCostChange()" [disabled]="isReadOnly">
|
|
|
@for (currency of currencies; track currency) {
|
|
|
<mat-option [value]="currency">{{ currency }}</mat-option>
|
|
|
}
|
|
|
@@ -27,10 +36,10 @@
|
|
|
}
|
|
|
|
|
|
<!-- Herramientas -->
|
|
|
- @if (costData.HERRAMIENTAS && costData.HERRAMIENTAS.length > 0) {
|
|
|
+ @if ((hasPreviousAnalysis ? previousAnalysis?.HERRAMIENTAS : costData?.HERRAMIENTAS)?.length > 0) {
|
|
|
<h3>Herramientas</h3>
|
|
|
<div class="items-table">
|
|
|
- @for (tool of costData.HERRAMIENTAS; track tool.ID) {
|
|
|
+ @for (tool of (hasPreviousAnalysis ? previousAnalysis.HERRAMIENTAS : costData.HERRAMIENTAS); track tool.ID) {
|
|
|
<div class="item-row">
|
|
|
<span class="item-name">{{ tool.NOMBRE }}</span>
|
|
|
<span class="item-cost">{{ tool.PRECIO_UNITARIO }} {{ tool.MONEDA_SIMBOLO }}</span>
|
|
|
@@ -40,7 +49,7 @@
|
|
|
}
|
|
|
</div>
|
|
|
<div class="subtotal-section">
|
|
|
- @for (subtotal of costData.SUBTOTAL_HERRAMIENTAS; track subtotal.SIMBOLO) {
|
|
|
+ @for (subtotal of (hasPreviousAnalysis ? previousAnalysis.SUBTOTAL_HERRAMIENTAS : costData.SUBTOTAL_HERRAMIENTAS); track subtotal.SIMBOLO) {
|
|
|
<div class="subtotal-row">
|
|
|
<strong>Subtotal Herramientas: {{ subtotal.SUBTOTAL }} {{ subtotal.SIMBOLO }}</strong>
|
|
|
</div>
|
|
|
@@ -49,10 +58,10 @@
|
|
|
}
|
|
|
|
|
|
<!-- Refacciones -->
|
|
|
- @if (costData.REFACCIONES && costData.REFACCIONES.length > 0) {
|
|
|
+ @if ((hasPreviousAnalysis ? previousAnalysis?.REFACCIONES : costData?.REFACCIONES)?.length > 0) {
|
|
|
<h3>Refacciones</h3>
|
|
|
<div class="items-table">
|
|
|
- @for (part of costData.REFACCIONES; track part.ID) {
|
|
|
+ @for (part of (hasPreviousAnalysis ? previousAnalysis.REFACCIONES : costData.REFACCIONES); track part.ID) {
|
|
|
<div class="item-row">
|
|
|
<span class="item-name">{{ part.NOMBRE }}</span>
|
|
|
<span class="item-cost">{{ part.PRECIO_UNITARIO }} {{ part.MONEDA_SIMBOLO }}</span>
|
|
|
@@ -62,7 +71,7 @@
|
|
|
}
|
|
|
</div>
|
|
|
<div class="subtotal-section">
|
|
|
- @for (subtotal of costData.SUBTOTAL_REFACCIONES; track subtotal.SIMBOLO) {
|
|
|
+ @for (subtotal of (hasPreviousAnalysis ? previousAnalysis.SUBTOTAL_REFACCIONES : costData.SUBTOTAL_REFACCIONES); track subtotal.SIMBOLO) {
|
|
|
<div class="subtotal-row">
|
|
|
<strong>Subtotal Refacciones: {{ subtotal.SUBTOTAL }} {{ subtotal.SIMBOLO }}</strong>
|
|
|
</div>
|
|
|
@@ -70,6 +79,17 @@
|
|
|
</div>
|
|
|
}
|
|
|
|
|
|
+ <!-- Subtotal Usuarios (solo si hay análisis previo) -->
|
|
|
+ @if (hasPreviousAnalysis && previousAnalysis?.SUBTOTAL_USUARIOS?.length > 0) {
|
|
|
+ <div class="subtotal-section">
|
|
|
+ @for (subtotal of previousAnalysis.SUBTOTAL_USUARIOS; track subtotal.SIMBOLO) {
|
|
|
+ <div class="subtotal-row">
|
|
|
+ <strong>Subtotal Usuarios: {{ subtotal.SUBTOTAL }} {{ subtotal.SIMBOLO }}</strong>
|
|
|
+ </div>
|
|
|
+ }
|
|
|
+ </div>
|
|
|
+ }
|
|
|
+
|
|
|
<!-- Totales -->
|
|
|
<div class="totals-section">
|
|
|
<h3>Total</h3>
|
|
|
@@ -83,11 +103,13 @@
|
|
|
|
|
|
<mat-form-field appearance="outline" class="full-width comments-field">
|
|
|
<mat-label>Comentarios</mat-label>
|
|
|
- <textarea matInput [(ngModel)]="comments" rows="3" placeholder="Ingrese sus comentarios..."></textarea>
|
|
|
+ <textarea matInput [(ngModel)]="comments" rows="3" placeholder="Ingrese sus comentarios..." [readonly]="isReadOnly"></textarea>
|
|
|
</mat-form-field>
|
|
|
</div>
|
|
|
|
|
|
<div mat-dialog-actions align="end">
|
|
|
- <button mat-button (click)="onCancel()">Cancelar</button>
|
|
|
- <button mat-button color="primary" (click)="onSave()">Guardar</button>
|
|
|
+ <button mat-button (click)="onCancel()">{{ isReadOnly ? 'Cerrar' : 'Cancelar' }}</button>
|
|
|
+ @if (!isReadOnly) {
|
|
|
+ <button mat-button color="primary" (click)="onSave()">Guardar</button>
|
|
|
+ }
|
|
|
</div>
|