feedback updates
This commit is contained in:
parent
b29d3dbac3
commit
19663213be
@ -86,7 +86,7 @@
|
|||||||
<!-- Weight Column -->
|
<!-- Weight Column -->
|
||||||
<ng-container matColumnDef="weight">
|
<ng-container matColumnDef="weight">
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>Weight</th>
|
<th mat-header-cell *matHeaderCellDef mat-sort-header>Weight</th>
|
||||||
<td mat-cell *matCellDef="let item">{{ formatDecimalDisplay(item.weight, 4) }}</td>
|
<td mat-cell *matCellDef="let item">{{ item.weight | number:'1.2-2' }}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- Unit of Measure Column -->
|
<!-- Unit of Measure Column -->
|
||||||
@ -240,6 +240,14 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="!showItemForm" class="form-actions">
|
<div *ngIf="!showItemForm" class="form-actions">
|
||||||
|
<!-- Totals -->
|
||||||
|
<div class="totals-section">
|
||||||
|
<div class="total-item" *ngIf="totalGoodsValue > 0">
|
||||||
|
<span>Total Goods Value:</span>
|
||||||
|
<span class="total-value">{{totalGoodsValue | currency}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<button mat-raised-button color="primary" (click)="onSubmit()" *ngIf="!isViewMode"
|
<button mat-raised-button color="primary" (click)="onSubmit()" *ngIf="!isViewMode"
|
||||||
[disabled]="goodsForm.invalid || changeInProgress">
|
[disabled]="goodsForm.invalid || changeInProgress">
|
||||||
Save
|
Save
|
||||||
|
|||||||
@ -180,5 +180,22 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
margin-top: 0.9rem;
|
margin-top: 0.9rem;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.totals-section {
|
||||||
|
display: flex;
|
||||||
|
gap: 24px;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
|
||||||
|
.total-item {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.total-value {
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -59,11 +59,11 @@ export class GoodsComponent {
|
|||||||
showItemForm = false;
|
showItemForm = false;
|
||||||
fileToUpload: File | null = null;
|
fileToUpload: File | null = null;
|
||||||
isProcessing = false;
|
isProcessing = false;
|
||||||
|
totalGoodsValue: number = 0;
|
||||||
|
|
||||||
// Data
|
// Data
|
||||||
countries: Country[] = [];
|
countries: Country[] = [];
|
||||||
unitsOfMeasures: UnitOfMeasure[] = [];
|
unitsOfMeasures: UnitOfMeasure[] = [];
|
||||||
goodsItems: GoodsItem[] = [];
|
|
||||||
|
|
||||||
private destroy$ = new Subject<void>();
|
private destroy$ = new Subject<void>();
|
||||||
|
|
||||||
@ -136,7 +136,8 @@ export class GoodsComponent {
|
|||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
})).subscribe({
|
})).subscribe({
|
||||||
next: (items: GoodsItem[]) => {
|
next: (items: GoodsItem[]) => {
|
||||||
this.dataSource.data = this.goodsItems = items;
|
this.dataSource.data = items;
|
||||||
|
this.totalGoodsValue = items.reduce((total, item) => total + Number(item.value || 0), 0);
|
||||||
this.completed.emit((this.goodsForm.valid || this.goodsForm.disabled) && this.dataSource.data.length > 0);
|
this.completed.emit((this.goodsForm.valid || this.goodsForm.disabled) && this.dataSource.data.length > 0);
|
||||||
},
|
},
|
||||||
error: (error: any) => {
|
error: (error: any) => {
|
||||||
@ -301,7 +302,7 @@ export class GoodsComponent {
|
|||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.changeInProgress = true;
|
this.changeInProgress = true;
|
||||||
this.goodsService.deleteAllGoodsItems(this.headerid, this.goodsItems).pipe(finalize(() => {
|
this.goodsService.deleteAllGoodsItems(this.headerid).pipe(finalize(() => {
|
||||||
this.changeInProgress = false;
|
this.changeInProgress = false;
|
||||||
})).subscribe({
|
})).subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
|
|||||||
@ -16,16 +16,16 @@ import { NotificationService } from '../../core/services/common/notification.ser
|
|||||||
<mat-dialog-content>
|
<mat-dialog-content>
|
||||||
<p> The following fees apply:</p>
|
<p> The following fees apply:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li *ngIf="estimatedFees.basicFee">Basic fee <span> {{estimatedFees.basicFee | currency}} </span></li>
|
<li *ngIf="estimatedFees.basicFee">Basic fee: <span> {{estimatedFees.basicFee | currency}} </span></li>
|
||||||
<li *ngIf="estimatedFees.counterFoilFee">Counterfoil Fee <span> {{estimatedFees.counterFoilFee | currency}}
|
<li *ngIf="estimatedFees.counterFoilFee">Counterfoil Fee: <span> {{estimatedFees.counterFoilFee | currency}}
|
||||||
</span></li>
|
</span></li>
|
||||||
<li *ngIf="estimatedFees.continuationSheetFee">Continuation sheet fee
|
<li *ngIf="estimatedFees.continuationSheetFee">Continuation sheet fee:
|
||||||
<span> {{estimatedFees.continuationSheetFee | currency}}</span></li>
|
<span> {{estimatedFees.continuationSheetFee | currency}}</span></li>
|
||||||
<li *ngIf="estimatedFees.expeditedFee">Expedited fee <span> {{estimatedFees.expeditedFee | currency}}</span></li>
|
<li *ngIf="estimatedFees.expeditedFee">Expedited fee: <span> {{estimatedFees.expeditedFee | currency}}</span></li>
|
||||||
<li *ngIf="estimatedFees.shippingFee">Shipping fee <span> {{estimatedFees.shippingFee | currency}}</span></li>
|
<li *ngIf="estimatedFees.shippingFee">Shipping fee: <span> {{estimatedFees.shippingFee | currency}}</span></li>
|
||||||
<li *ngIf="estimatedFees.bondPremium">{{bondPremiumLabel}} <span> {{estimatedFees.bondPremium | currency}}</span></li>
|
<li *ngIf="estimatedFees.bondPremium">{{bondPremiumLabel}}: <span> {{estimatedFees.bondPremium | currency}}</span></li>
|
||||||
<li *ngIf="estimatedFees.cargoPremium">Cargo Premium <span> {{estimatedFees.cargoPremium | currency}}</span></li>
|
<li *ngIf="estimatedFees.cargoPremium">Cargo Premium: <span> {{estimatedFees.cargoPremium | currency}}</span></li>
|
||||||
<li *ngIf="estimatedFees.ldiPremium">LDI Premium <span> {{estimatedFees.ldiPremium | currency}}</span></li>
|
<li *ngIf="estimatedFees.ldiPremium">LDI Premium: <span> {{estimatedFees.ldiPremium | currency}}</span></li>
|
||||||
</ul>
|
</ul>
|
||||||
<hr/>
|
<hr/>
|
||||||
<ul>
|
<ul>
|
||||||
@ -33,8 +33,8 @@ import { NotificationService } from '../../core/services/common/notification.ser
|
|||||||
</ul>
|
</ul>
|
||||||
<hr/>
|
<hr/>
|
||||||
<ul>
|
<ul>
|
||||||
<li *ngIf="estimatedFees.securityAmount">Security Amount <span>{{estimatedFees.securityAmount | currency}}</span></li>
|
<li *ngIf="estimatedFees.securityAmount">Security Amount: <span>{{estimatedFees.securityAmount | currency}}</span></li>
|
||||||
<li *ngIf="estimatedFees.insuredValue">Insured Value <span>{{estimatedFees.insuredValue | currency}}</span></li>
|
<li *ngIf="estimatedFees.insuredValue">Insured Value: <span>{{estimatedFees.insuredValue | currency}}</span></li>
|
||||||
</ul>
|
</ul>
|
||||||
</mat-dialog-content>
|
</mat-dialog-content>
|
||||||
<mat-dialog-actions>
|
<mat-dialog-actions>
|
||||||
|
|||||||
@ -480,7 +480,6 @@ export class ShippingComponent {
|
|||||||
this.onDeliveryMethodChange(this.shippingFromDB.deliveryMethod);
|
this.onDeliveryMethodChange(this.shippingFromDB.deliveryMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.calculateDeliveryEstimate();
|
|
||||||
this.shippingForm.markAsUntouched();
|
this.shippingForm.markAsUntouched();
|
||||||
this.completed.emit(this.shippingForm.valid);
|
this.completed.emit(this.shippingForm.valid);
|
||||||
|
|
||||||
@ -520,7 +519,6 @@ export class ShippingComponent {
|
|||||||
formOfSecurityControl?.enable();
|
formOfSecurityControl?.enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.calculateDeliveryEstimate();
|
|
||||||
this.updateAddressContactValidation(this.shippingFromDB.shipTo);
|
this.updateAddressContactValidation(this.shippingFromDB.shipTo);
|
||||||
|
|
||||||
if (this.shippingFromDB.shipTo === '3RDPARTY') {
|
if (this.shippingFromDB.shipTo === '3RDPARTY') {
|
||||||
|
|||||||
@ -10,36 +10,73 @@
|
|||||||
<p>Agreement language will go here</p>
|
<p>Agreement language will go here</p>
|
||||||
<h3>Fees and Charges</h3>
|
<h3>Fees and Charges</h3>
|
||||||
<p> The following fees apply:</p>
|
<p> The following fees apply:</p>
|
||||||
<ul>
|
<!-- Fee List with Table-like Structure -->
|
||||||
<li *ngIf="estimatedFees.basicFee">Basic fee <span> {{estimatedFees.basicFee | currency}} </span></li>
|
<div class="fee-table">
|
||||||
<li *ngIf="estimatedFees.counterFoilFee">Counterfoil Fee <span> {{estimatedFees.counterFoilFee |
|
<div class="fee-row" *ngIf="estimatedFees.basicFee">
|
||||||
currency}}
|
<span class="fee-label">Basic fee:</span>
|
||||||
</span></li>
|
<span class="fee-value">{{ estimatedFees.basicFee | currency }}</span>
|
||||||
<li *ngIf="estimatedFees.continuationSheetFee">Continuation sheet fee
|
</div>
|
||||||
<span> {{estimatedFees.continuationSheetFee | currency}}</span>
|
|
||||||
</li>
|
<div class="fee-row" *ngIf="estimatedFees.counterFoilFee">
|
||||||
<li *ngIf="estimatedFees.expeditedFee">Expedited fee <span> {{estimatedFees.expeditedFee |
|
<span class="fee-label">Counterfoil Fee:</span>
|
||||||
currency}}</span></li>
|
<span class="fee-value">{{ estimatedFees.counterFoilFee | currency }}</span>
|
||||||
<li *ngIf="estimatedFees.shippingFee">Shipping fee <span> {{estimatedFees.shippingFee |
|
</div>
|
||||||
currency}}</span></li>
|
|
||||||
<li *ngIf="estimatedFees.bondPremium">{{bondPremiumLabel}} <span> {{estimatedFees.bondPremium |
|
<div class="fee-row" *ngIf="estimatedFees.continuationSheetFee">
|
||||||
currency}}</span></li>
|
<span class="fee-label">Continuation sheet fee:</span>
|
||||||
<li *ngIf="estimatedFees.cargoPremium">Cargo Premium <span> {{estimatedFees.cargoPremium |
|
<span class="fee-value">{{ estimatedFees.continuationSheetFee | currency }}</span>
|
||||||
currency}}</span></li>
|
</div>
|
||||||
<li *ngIf="estimatedFees.ldiPremium">LDI Premium <span> {{estimatedFees.ldiPremium | currency}}</span>
|
|
||||||
</li>
|
<div class="fee-row" *ngIf="estimatedFees.expeditedFee">
|
||||||
</ul>
|
<span class="fee-label">Expedited fee:</span>
|
||||||
|
<span class="fee-value">{{ estimatedFees.expeditedFee | currency }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="fee-row" *ngIf="estimatedFees.shippingFee">
|
||||||
|
<span class="fee-label">Shipping fee:</span>
|
||||||
|
<span class="fee-value">{{ estimatedFees.shippingFee | currency }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="fee-row" *ngIf="estimatedFees.bondPremium">
|
||||||
|
<span class="fee-label">{{ bondPremiumLabel }}:</span>
|
||||||
|
<span class="fee-value">{{ estimatedFees.bondPremium | currency }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="fee-row" *ngIf="estimatedFees.cargoPremium">
|
||||||
|
<span class="fee-label">Cargo Premium:</span>
|
||||||
|
<span class="fee-value">{{ estimatedFees.cargoPremium | currency }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="fee-row" *ngIf="estimatedFees.ldiPremium">
|
||||||
|
<span class="fee-label">LDI Premium:</span>
|
||||||
|
<span class="fee-value">{{ estimatedFees.ldiPremium | currency }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
<ul>
|
|
||||||
<li class="total">Total: <span>{{total | currency}}</span></li>
|
<!-- Total -->
|
||||||
</ul>
|
<div class="fee-table">
|
||||||
|
<div class="fee-row total">
|
||||||
|
<span class="fee-label">Total:</span>
|
||||||
|
<span class="fee-value">{{ total | currency }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
<ul>
|
|
||||||
<li *ngIf="estimatedFees.securityAmount">Security Amount <span>{{estimatedFees.securityAmount |
|
<!-- Security & Insurance -->
|
||||||
currency}}</span></li>
|
<div class="fee-table">
|
||||||
<li *ngIf="estimatedFees.insuredValue">Insured Value <span>{{estimatedFees.insuredValue |
|
<div class="fee-row" *ngIf="estimatedFees.securityAmount">
|
||||||
currency}}</span></li>
|
<span class="fee-label">Security Amount:</span>
|
||||||
</ul>
|
<span class="fee-value">{{ estimatedFees.securityAmount | currency }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="fee-row" *ngIf="estimatedFees.insuredValue">
|
||||||
|
<span class="fee-label">Insured Value:</span>
|
||||||
|
<span class="fee-value">{{ estimatedFees.insuredValue | currency }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<mat-checkbox [(ngModel)]="hasReadAllTerms" color="primary" class="read-checkbox">
|
<mat-checkbox [(ngModel)]="hasReadAllTerms" color="primary" class="read-checkbox">
|
||||||
I have read and agree to all terms and conditions above
|
I have read and agree to all terms and conditions above
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
|
|||||||
@ -32,14 +32,28 @@ mat-card-header {
|
|||||||
padding-left: 16px;
|
padding-left: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul {
|
.fee-table {
|
||||||
padding-left: 56px;
|
width: 100%;
|
||||||
|
max-width: 325px;
|
||||||
}
|
}
|
||||||
|
|
||||||
li {
|
.fee-row {
|
||||||
margin-bottom: 8px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: 8px 0;
|
||||||
|
padding-left: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fee-label {
|
||||||
|
text-align: left;
|
||||||
|
padding-right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fee-value {
|
||||||
|
text-align: right;
|
||||||
|
min-width: 120px;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
strong {
|
strong {
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { environment } from '../../../../environments/environment';
|
|||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { UserService } from '../common/user.service';
|
import { UserService } from '../common/user.service';
|
||||||
import { Goods, GoodsItem } from '../../models/carnet/goods';
|
import { Goods, GoodsItem } from '../../models/carnet/goods';
|
||||||
import { catchError, from, map, mergeMap, Observable, of, toArray } from 'rxjs';
|
import { map, Observable } from 'rxjs';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@ -118,33 +118,14 @@ export class GoodsService {
|
|||||||
return this.http.delete(`${this.apiUrl}/${this.apiDb}/DeleteGenerallistItems`, { body: goodsItemsObj });
|
return this.http.delete(`${this.apiUrl}/${this.apiDb}/DeleteGenerallistItems`, { body: goodsItemsObj });
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteAllGoodsItems(headerid: number, items: GoodsItem[]): Observable<any[]> {
|
deleteAllGoodsItems(headerid: number): Observable<any> {
|
||||||
return from(items).pipe(
|
const goodsItemsObj = {
|
||||||
mergeMap(item => {
|
P_HEADERID: headerid,
|
||||||
const goodsItemsObj = {
|
P_ITEMNO: 99999, // special value to indicate all items
|
||||||
P_HEADERID: headerid,
|
P_USERID: this.userService.getUser(),
|
||||||
P_ITEMNO: item.itemNumber,
|
};
|
||||||
P_USERID: this.userService.getUser(),
|
|
||||||
};
|
|
||||||
|
|
||||||
return this.http.delete(
|
// delete request with body
|
||||||
`${this.apiUrl}/${this.apiDb}/DeleteGenerallistItems`,
|
return this.http.delete(`${this.apiUrl}/${this.apiDb}/DeleteGenerallistItems`, { body: goodsItemsObj });
|
||||||
{ body: goodsItemsObj }
|
|
||||||
).pipe(
|
|
||||||
catchError(error => {
|
|
||||||
console.error(`Failed to delete item ${item.itemNumber}:`, error);
|
|
||||||
// Return error result instead of failing the whole stream
|
|
||||||
return of({
|
|
||||||
success: false,
|
|
||||||
item: item.itemNumber,
|
|
||||||
error: error.message
|
|
||||||
});
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}, 5),
|
|
||||||
|
|
||||||
// Collect all results into an array
|
|
||||||
toArray()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,10 @@ export class HomeService {
|
|||||||
orderType: item.ORDERTYPE,
|
orderType: item.ORDERTYPE,
|
||||||
carnetStatus: item.CARNETSTATUS,
|
carnetStatus: item.CARNETSTATUS,
|
||||||
headerid: item.HEADERID,
|
headerid: item.HEADERID,
|
||||||
printGLStatus: item.PRINTGLSTATUS
|
printGLStatus: item.PRINTGLSTATUS,
|
||||||
|
securityType: item.SECURITYTYPE,
|
||||||
|
deliveryType: item.DELIVERYTYPE,
|
||||||
|
clientName: item.CLIENTNAMNE
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,8 +26,16 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="question-row">
|
<div class="question-row">
|
||||||
|
<mat-radio-group (change)="toggleDuplicateQuestion($event)">
|
||||||
|
<mat-label class="question">Did you misplace your carnet?</mat-label>
|
||||||
|
<mat-radio-button [value]="true">Yes</mat-radio-button>
|
||||||
|
<mat-radio-button [value]="false">No</mat-radio-button>
|
||||||
|
</mat-radio-group>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="question-row" *ngIf="duplicateQuestion">
|
||||||
<mat-radio-group (change)="duplicateCarnet($event)">
|
<mat-radio-group (change)="duplicateCarnet($event)">
|
||||||
<mat-label class="question">Did you loose your carnet? Are you looking for
|
<mat-label class="question">Are you looking for
|
||||||
duplicates?</mat-label>
|
duplicates?</mat-label>
|
||||||
<mat-radio-button [value]="true">Yes</mat-radio-button>
|
<mat-radio-button [value]="true">Yes</mat-radio-button>
|
||||||
<mat-radio-button [value]="false">No</mat-radio-button>
|
<mat-radio-button [value]="false">No</mat-radio-button>
|
||||||
@ -102,6 +110,16 @@
|
|||||||
<td mat-cell *matCellDef="let item">{{ item.carnetNumber }}</td>
|
<td mat-cell *matCellDef="let item">{{ item.carnetNumber }}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="deliveryType">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header>Delivery Type</th>
|
||||||
|
<td mat-cell *matCellDef="let item">{{ item.deliveryType }}</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="securityType">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header>Security Type</th>
|
||||||
|
<td mat-cell *matCellDef="let item">{{ item.securityType }}</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="usSets">
|
<ng-container matColumnDef="usSets">
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>US Sets</th>
|
<th mat-header-cell *matHeaderCellDef mat-sort-header>US Sets</th>
|
||||||
<td mat-cell *matCellDef="let item">{{ item.usSets }}</td>
|
<td mat-cell *matCellDef="let item">{{ item.usSets }}</td>
|
||||||
@ -147,11 +165,6 @@
|
|||||||
<th mat-header-cell *matHeaderCellDef>Actions</th>
|
<th mat-header-cell *matHeaderCellDef>Actions</th>
|
||||||
<td mat-cell *matCellDef="let item">
|
<td mat-cell *matCellDef="let item">
|
||||||
<div class="action-buttons">
|
<div class="action-buttons">
|
||||||
<!-- <button mat-icon-button color="primary" (click)="editCarnet(item)"
|
|
||||||
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Not Submitted'"
|
|
||||||
matTooltip="Edit">
|
|
||||||
<mat-icon>edit</mat-icon>
|
|
||||||
</button> -->
|
|
||||||
<button matIconButton [matMenuTriggerFor]="carnetActions">
|
<button matIconButton [matMenuTriggerFor]="carnetActions">
|
||||||
<mat-icon>more_horiz</mat-icon>
|
<mat-icon>more_horiz</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
@ -175,23 +188,11 @@
|
|||||||
<mat-icon>print</mat-icon>
|
<mat-icon>print</mat-icon>
|
||||||
<span>Print GL</span>
|
<span>Print GL</span>
|
||||||
</button>
|
</button>
|
||||||
<button mat-menu-item (click)="copyCarnet(item.headerid)">
|
<button mat-menu-item (click)="copyCarnet(item)">
|
||||||
<mat-icon>file_copy</mat-icon>
|
<mat-icon>file_copy</mat-icon>
|
||||||
<span>Copy</span>
|
<span>Copy</span>
|
||||||
</button>
|
</button>
|
||||||
</mat-menu>
|
</mat-menu>
|
||||||
<!--
|
|
||||||
<button mat-icon-button color="primary" (click)="viewCarnet(item)" matTooltip="View">
|
|
||||||
<mat-icon>article</mat-icon>
|
|
||||||
</button>
|
|
||||||
<button mat-icon-button color="primary" (click)="deleteCarnet(item.headerid)" *ngIf="
|
|
||||||
getCarnetStatusLabel(item.carnetStatus) === 'Not Submitted'" matTooltip="Delete">
|
|
||||||
<mat-icon>delete</mat-icon>
|
|
||||||
</button>
|
|
||||||
<button mat-icon-button color="primary" (click)="printGeneralList(item.headerid)"
|
|
||||||
matTooltip="Print General List">
|
|
||||||
<mat-icon>print</mat-icon>
|
|
||||||
</button> -->
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import { BorDialogComponent } from './bor-dialog.component';
|
|||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { CarnetService } from '../core/services/carnet/carnet.service';
|
import { CarnetService } from '../core/services/carnet/carnet.service';
|
||||||
import { CopyCarnetDialogComponent } from './copy-carnet-dialog.component';
|
import { CopyCarnetDialogComponent } from './copy-carnet-dialog.component';
|
||||||
|
import { UserService } from '../core/services/common/user.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-home',
|
selector: 'app-home',
|
||||||
@ -35,8 +36,10 @@ export class HomeComponent {
|
|||||||
carnetData: any[] = [];
|
carnetData: any[] = [];
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
showTable = false;
|
showTable = false;
|
||||||
|
duplicateQuestion: boolean = false;
|
||||||
userPreferences: UserPreferences;
|
userPreferences: UserPreferences;
|
||||||
carnetStatuses: CarnetStatus[] = [];
|
carnetStatuses: CarnetStatus[] = [];
|
||||||
|
currentCarnetStatus: any = {};
|
||||||
|
|
||||||
// table filter variables
|
// table filter variables
|
||||||
selectedColumn: string = '';
|
selectedColumn: string = '';
|
||||||
@ -45,6 +48,8 @@ export class HomeComponent {
|
|||||||
{ value: 'applicationName', displayName: 'Application Name' },
|
{ value: 'applicationName', displayName: 'Application Name' },
|
||||||
{ value: 'holderName', displayName: 'Holder Name' },
|
{ value: 'holderName', displayName: 'Holder Name' },
|
||||||
{ value: 'carnetNumber', displayName: 'Carnet Number' },
|
{ value: 'carnetNumber', displayName: 'Carnet Number' },
|
||||||
|
{ value: 'deliveryType', displayName: 'Delivery Type' },
|
||||||
|
{ value: 'securityType', displayName: 'Security Type' },
|
||||||
{ value: 'usSets', displayName: 'US Sets' },
|
{ value: 'usSets', displayName: 'US Sets' },
|
||||||
{ value: 'foreignSets', displayName: 'Foreign Sets' },
|
{ value: 'foreignSets', displayName: 'Foreign Sets' },
|
||||||
{ value: 'transitSets', displayName: 'Transit Sets' },
|
{ value: 'transitSets', displayName: 'Transit Sets' },
|
||||||
@ -67,7 +72,7 @@ export class HomeComponent {
|
|||||||
this.dataSource.sort = value;
|
this.dataSource.sort = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
displayedColumns: string[] = ['applicationName', 'holderName', 'carnetNumber', 'usSets', 'foreignSets', 'transitSets', 'carnetValue', 'issueDate', 'expiryDate', 'orderType', 'carnetStatus', 'actions'];
|
displayedColumns: string[] = ['applicationName', 'holderName', 'carnetNumber', 'deliveryType', 'securityType', 'usSets', 'foreignSets', 'transitSets', 'carnetValue', 'issueDate', 'expiryDate', 'orderType', 'carnetStatus', 'actions'];
|
||||||
|
|
||||||
private homeService = inject(HomeService);
|
private homeService = inject(HomeService);
|
||||||
private carnetService = inject(CarnetService);
|
private carnetService = inject(CarnetService);
|
||||||
@ -75,6 +80,7 @@ export class HomeComponent {
|
|||||||
private notificationService = inject(NotificationService);
|
private notificationService = inject(NotificationService);
|
||||||
private commonService = inject(CommonService);
|
private commonService = inject(CommonService);
|
||||||
private navigationService = inject(NavigationService);
|
private navigationService = inject(NavigationService);
|
||||||
|
private userService = inject(UserService);
|
||||||
private dialog = inject(MatDialog);
|
private dialog = inject(MatDialog);
|
||||||
|
|
||||||
constructor(userPrefenceService: UserPreferencesService) {
|
constructor(userPrefenceService: UserPreferencesService) {
|
||||||
@ -103,6 +109,12 @@ export class HomeComponent {
|
|||||||
next: (data) => {
|
next: (data) => {
|
||||||
this.carnetData = data;
|
this.carnetData = data;
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
|
|
||||||
|
if (!this.currentCarnetStatus?.spid) {
|
||||||
|
this.defaultCarnetStatusData();
|
||||||
|
} else {
|
||||||
|
this.onCarnetStatusClick(this.currentCarnetStatus);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error: (error) => {
|
error: (error) => {
|
||||||
console.error('Error loading carnet data:', error);
|
console.error('Error loading carnet data:', error);
|
||||||
@ -115,13 +127,15 @@ export class HomeComponent {
|
|||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
this.showTable = false;
|
this.showTable = false;
|
||||||
|
|
||||||
|
this.currentCarnetStatus = event;
|
||||||
|
|
||||||
// Clear any existing filters when loading new data
|
// Clear any existing filters when loading new data
|
||||||
this.clearFilter();
|
this.clearFilter();
|
||||||
|
|
||||||
this.homeService.getCarnetDataByStatus(event.spid, event.carnetStatus).subscribe({
|
this.homeService.getCarnetDataByStatus(event.spid, event.carnetStatus).subscribe({
|
||||||
next: (carnetDetails) => {
|
next: (carnetDetails) => {
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
this.showTable = true;
|
this.showTable = carnetDetails.length > 0;
|
||||||
this.dataSource.data = carnetDetails;
|
this.dataSource.data = carnetDetails;
|
||||||
this.dataSource.paginator = this.paginator;
|
this.dataSource.paginator = this.paginator;
|
||||||
this.dataSource.sort = this.sort;
|
this.dataSource.sort = this.sort;
|
||||||
@ -138,6 +152,20 @@ export class HomeComponent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defaultCarnetStatusData(): void {
|
||||||
|
// if the carnet data has record with the status 'P' (not submitted), then load that data
|
||||||
|
const inProgressData = this.carnetData?.[0]?.CARNETSTATUS?.includes('P');
|
||||||
|
if (inProgressData) {
|
||||||
|
let spid = this.carnetData[0].SPID ?? this.userService.getUserSpid();
|
||||||
|
var carentData = {
|
||||||
|
spid: spid,
|
||||||
|
carnetStatus: 'P'
|
||||||
|
}
|
||||||
|
|
||||||
|
this.onCarnetStatusClick(carentData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
exportData() {
|
exportData() {
|
||||||
try {
|
try {
|
||||||
// Prepare worksheet data
|
// Prepare worksheet data
|
||||||
@ -164,6 +192,8 @@ export class HomeComponent {
|
|||||||
'Application Name': item.applicationName,
|
'Application Name': item.applicationName,
|
||||||
'Holder Name': item.holderName,
|
'Holder Name': item.holderName,
|
||||||
'Carnet Number': item.carnetNumber,
|
'Carnet Number': item.carnetNumber,
|
||||||
|
'Delivery Type': item.deliveryType,
|
||||||
|
'Security Type': item.securityType,
|
||||||
'US Sets': item.usSets,
|
'US Sets': item.usSets,
|
||||||
'Foreign Sets': item.foreignSets,
|
'Foreign Sets': item.foreignSets,
|
||||||
'Transit Sets': item.transitSets,
|
'Transit Sets': item.transitSets,
|
||||||
@ -216,6 +246,10 @@ export class HomeComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toggleDuplicateQuestion(event: MatRadioChange): void {
|
||||||
|
this.duplicateQuestion = event.value;
|
||||||
|
}
|
||||||
|
|
||||||
duplicateCarnet(event: MatRadioChange): void {
|
duplicateCarnet(event: MatRadioChange): void {
|
||||||
if (event.value) {
|
if (event.value) {
|
||||||
const dialogRef = this.dialog.open(CarnetDialogComponent, {
|
const dialogRef = this.dialog.open(CarnetDialogComponent, {
|
||||||
@ -313,16 +347,7 @@ export class HomeComponent {
|
|||||||
|
|
||||||
editCarnet(item: any): void {
|
editCarnet(item: any): void {
|
||||||
if (item && item.headerid) {
|
if (item && item.headerid) {
|
||||||
let route: string = 'edit-carnet';
|
let route: string = this.editActionRoute(item);
|
||||||
if (item.orderType === 'DUPLICATE') {
|
|
||||||
route = 'duplicate-carnet';
|
|
||||||
}
|
|
||||||
else if (item.orderType === 'REPLACE') {
|
|
||||||
route = 'extend-carnet';
|
|
||||||
} else if (item.orderType === 'REORDER') {
|
|
||||||
route = 'additional-sets';
|
|
||||||
}
|
|
||||||
|
|
||||||
this.navigateTo([route, item.headerid], {
|
this.navigateTo([route, item.headerid], {
|
||||||
queryParams: { applicationname: item.applicationName }
|
queryParams: { applicationname: item.applicationName }
|
||||||
});
|
});
|
||||||
@ -400,11 +425,11 @@ export class HomeComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
copyCarnet(headerid: number): void {
|
copyCarnet(item: any): void {
|
||||||
if (headerid) {
|
if (item && item.headerid) {
|
||||||
const dialogRef = this.dialog.open(CopyCarnetDialogComponent, {
|
const dialogRef = this.dialog.open(CopyCarnetDialogComponent, {
|
||||||
width: '500px',
|
width: '500px',
|
||||||
data: { headerid: headerid },
|
data: { headerid: item.headerid },
|
||||||
});
|
});
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(data => {
|
dialogRef.afterClosed().subscribe(data => {
|
||||||
@ -412,8 +437,9 @@ export class HomeComponent {
|
|||||||
this.carnetService.copyCarnet(data.headerid, data.applicationName).subscribe({
|
this.carnetService.copyCarnet(data.headerid, data.applicationName).subscribe({
|
||||||
next: (applicationData: any) => {
|
next: (applicationData: any) => {
|
||||||
this.notificationService.showSuccess('Carnet copied successfully');
|
this.notificationService.showSuccess('Carnet copied successfully');
|
||||||
this.navigateTo(['edit-carnet', applicationData.HEADERID], {
|
let route: string = this.editActionRoute(item);
|
||||||
queryParams: { applicationname: applicationData.APPLICATIONNAME }
|
this.navigateTo([route, data.headerid], {
|
||||||
|
queryParams: { applicationname: data.applicationName }
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
error: (error) => {
|
error: (error) => {
|
||||||
@ -523,4 +549,21 @@ export class HomeComponent {
|
|||||||
document.body.removeChild(a); // Clean up
|
document.body.removeChild(a); // Clean up
|
||||||
window.URL.revokeObjectURL(url);
|
window.URL.revokeObjectURL(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private editActionRoute(item: any): string {
|
||||||
|
let route: string = 'edit-carnet';
|
||||||
|
|
||||||
|
if (item && item.orderType) {
|
||||||
|
if (item.orderType === 'DUPLICATE') {
|
||||||
|
route = 'duplicate-carnet';
|
||||||
|
}
|
||||||
|
else if (item.orderType === 'REPLACE') {
|
||||||
|
route = 'extend-carnet';
|
||||||
|
} else if (item.orderType === 'REORDER') {
|
||||||
|
route = 'additional-sets';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return route;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user