Skip to content

Commit 1954ff1

Browse files
committed
fixed load and payroll page bugs
1 parent 0676c3f commit 1954ff1

File tree

11 files changed

+122
-117
lines changed

11 files changed

+122
-117
lines changed

src/Client/Logistics.OfficeApp/src/app/layout/sidebar/sidebar.component.html

+26-26
Original file line numberDiff line numberDiff line change
@@ -8,54 +8,54 @@
88

99
<ul class="nav flex-column mb-auto">
1010
<li>
11-
<a class="nav-link border-bottom" [routerLink]="['/home']">
12-
<i class="bi bi-house-door h1" pTooltip="Home"></i>
11+
<a class="nav-link border-bottom" pTooltip="Home" [routerLink]="['/home']">
12+
<i class="bi bi-house-door h1"></i>
1313
@if (isOpened) {
1414
<span class="ms-2">Home</span>
1515
}
1616
</a>
1717
</li>
18-
<li class="nav-item">
19-
<a class="nav-link border-bottom" [routerLink]="['/dashboard']">
20-
<i class="bi bi-speedometer2 h1" pTooltip="Dashboard"></i>
18+
<li>
19+
<a class="nav-link border-bottom" pTooltip="Dashboard" [routerLink]="['/dashboard']">
20+
<i class="bi bi-speedometer2 h1"></i>
2121
@if (isOpened) {
2222
<span class="ms-2">Dashboard</span>
2323
}
2424
</a>
2525
</li>
26-
<li class="nav-item">
27-
<a class="nav-link border-bottom" [routerLink]="['/loads']">
28-
<i class="bi bi-database h1" pTooltip="Loads"></i>
26+
<li>
27+
<a class="nav-link border-bottom" pTooltip="Loads" [routerLink]="['/loads']">
28+
<i class="bi bi-database h1"></i>
2929
@if (isOpened) {
3030
<span class="ms-2">Loads</span>
3131
}
3232
</a>
3333
</li>
34-
<li class="nav-item">
35-
<a class="nav-link border-bottom" [routerLink]="['/trucks']">
36-
<i class="bi bi-truck h1" pTooltip="Trucks"></i>
34+
<li>
35+
<a class="nav-link border-bottom" pTooltip="Trucks" [routerLink]="['/trucks']">
36+
<i class="bi bi-truck h1"></i>
3737
@if (isOpened) {
3838
<span class="ms-2">Trucks</span>
3939
}
4040
</a>
4141
</li>
42-
<li class="nav-item">
43-
<a class="nav-link border-bottom" [routerLink]="['/employees']">
44-
<i class="bi bi-people h1" pTooltip="Employees"></i>
42+
<li>
43+
<a class="nav-link border-bottom" pTooltip="Employees" [routerLink]="['/employees']">
44+
<i class="bi bi-people h1"></i>
4545
@if (isOpened) {
4646
<span class="ms-2">Employees</span>
4747
}
4848
</a>
4949
</li>
50-
<li class="nav-item">
51-
<a class="nav-link border-bottom" [routerLink]="['/customers']">
52-
<i class="bi bi-building h1" pTooltip="Customers"></i>
50+
<li>
51+
<a class="nav-link border-bottom" pTooltip="Customers" [routerLink]="['/customers']" >
52+
<i class="bi bi-building h1"></i>
5353
@if (isOpened) {
5454
<span class="ms-2">Customers</span>
5555
}
5656
</a>
5757
</li>
58-
<li class="nav-item">
58+
<li>
5959
@if (isOpened) {
6060
<p-panelMenu [model]="accountingMenuItems"></p-panelMenu>
6161
}
@@ -74,12 +74,12 @@
7474
}
7575
}
7676
</p-overlayPanel>
77-
<div class="text-center">
78-
<i (click)="accountingPanel.toggle($event)" class="bi bi-journal-text h1" pTooltip="Accounting" role="presentation"></i>
79-
</div>
77+
<a class="nav-link border-bottom" pTooltip="Accounting" (click)="accountingPanel.toggle($event)" role="presentation">
78+
<i class="bi bi-journal-text h1"></i>
79+
</a>
8080
}
8181
</li>
82-
<li class="nav-item">
82+
<li>
8383
<a class="nav-link border-bottom">
8484
@if (isOpened) {
8585
<i class="bi bi-arrow-left h1" (click)="toggle()" pTooltip="Minimize menu" role="presentation"></i>
@@ -92,7 +92,7 @@
9292
</ul>
9393

9494
@if (userFullName) {
95-
<div class="border-top mb-2">
95+
<div class="d-flex justify-content-center border-top py-2">
9696
@if (userRole && isOpened) {
9797
<div class="px-3 pt-2">
9898
Role: <span class="fw-bold">{{userRole}}</span>
@@ -116,9 +116,9 @@
116116
}
117117
}
118118
</p-overlayPanel>
119-
<div class="text-center">
120-
<i (click)="profilePanel.toggle($event)" class="bi bi-person-circle h1" pTooltip="Account" role="presentation"></i>
121-
</div>
119+
<a class="nav-link" pTooltip="Account" (click)="profilePanel.toggle($event)" role="presentation">
120+
<i class="bi bi-person-circle h1"></i>
121+
</a>
122122
}
123123
</div>
124124
}

src/Client/Logistics.OfficeApp/src/app/layout/sidebar/sidebar.component.scss

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
:host ::ng-deep {
3232
.p-panelmenu-header-content {
3333
background-color: transparent;
34+
border-top: unset;
3435
}
3536

3637
.p-menuitem-link {

src/Client/Logistics.OfficeApp/src/app/pages/accounting/edit-payroll/edit-payroll.component.html

+7-5
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,21 @@ <h4>Payment details</h4>
5353
@if (isEditMode()) {
5454
<div class="mb-3">
5555
<label for="paymentStatus" class="form-label">Payment Status</label>
56-
<p-dropdown formControlName="paymentStatus" styleClass="w-100" [options]="paymentStatuses"
57-
optionValue="value" optionLabel="description">
56+
<p-dropdown formControlName="paymentStatus" styleClass="w-100"
57+
[options]="paymentStatuses"
58+
optionLabel="description">
5859
</p-dropdown>
5960
</div>
6061

61-
@if (form.get('paymentStatus')?.value === paymentStatus.Paid) {
62+
@if (form.get('paymentStatus')?.value?.value === paymentStatus.Paid) {
6263
<h4>Payment details</h4>
6364
<hr/>
6465

6566
<div class="mb-3">
6667
<label for="paymentMethod" class="form-label">Payment Method</label>
67-
<p-dropdown formControlName="paymentMethod" styleClass="w-100" [options]="paymentMethods"
68-
optionValue="value" optionLabel="description">
68+
<p-dropdown formControlName="paymentMethod" styleClass="w-100"
69+
[options]="paymentMethods"
70+
optionLabel="description">
6971
</p-dropdown>
7072
</div>
7173

src/Client/Logistics.OfficeApp/src/app/pages/accounting/edit-payroll/edit-payroll.component.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {Address, CreatePayroll, Employee, Payroll, UpdatePayroll} from '@core/mo
1313
import {ApiService, ToastService} from '@core/services';
1414
import {PredefinedDateRanges} from '@core/helpers';
1515
import {
16-
PaymentMethod,
16+
EnumType,
1717
PaymentMethodEnum,
1818
PaymentStatus,
1919
PaymentStatusEnum,
@@ -74,7 +74,7 @@ export class EditPayrollComponent implements OnInit {
7474
});
7575

7676
this.form.get('paymentStatus')?.valueChanges.subscribe((status) => {
77-
this.setConditionalValidators(status);
77+
this.setConditionalValidators(status?.value as PaymentStatus);
7878
});
7979
}
8080

@@ -179,8 +179,8 @@ export class EditPayrollComponent implements OnInit {
179179
this.form.patchValue({
180180
employee: payroll.employee,
181181
dateRange: [new Date(payroll.startDate), new Date(payroll.endDate)],
182-
paymentMethod: payroll.payment.method,
183-
paymentStatus: payroll.payment.status,
182+
paymentMethod: PaymentMethodEnum.getValue(payroll.payment.method!),
183+
paymentStatus: PaymentStatusEnum.getValue(payroll.payment.status),
184184
paymentBillingAddress: payroll.payment.billingAddress,
185185
});
186186

@@ -238,7 +238,7 @@ export class EditPayrollComponent implements OnInit {
238238
interface PayrollForm {
239239
employee: FormControl<Employee | null>;
240240
dateRange: FormControl<Date[]>;
241-
paymentStatus: FormControl<PaymentStatus | null>;
242-
paymentMethod: FormControl<PaymentMethod | null>;
241+
paymentStatus: FormControl<EnumType | null>;
242+
paymentMethod: FormControl<EnumType | null>;
243243
paymentBillingAddress: FormControl<Address | null>;
244244
}

src/Client/Logistics.OfficeApp/src/app/pages/accounting/view-invoice/view-invoice.component.html

+19-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,25 @@ <h2>{{companyName}}</h2>
1818
<h4>Payment Details</h4>
1919
<p><strong>Method:</strong> {{getPaymentMethodDesc(invoice.payment.method)}}</p>
2020
<p><strong>Amount:</strong> {{invoice.payment.amount | currency}}</p>
21-
<p><strong>Payment Date:</strong> {{invoice.payment.paymentDate | date:'mediumDate'}}</p>
2221

23-
<button pButton class="p-button-raised" (click)="exportToPDF()">
24-
Export to PDF
25-
</button>
22+
@if (invoice.payment.status === paymentStatus.Paid) {
23+
<p><strong>Payment Date:</strong> {{invoice.payment.paymentDate | date:'mediumDate'}}</p>
24+
}
25+
26+
<p-button
27+
icon="bi bi-file-pdf"
28+
label="Export to PDF"
29+
(click)="exportToPDF()">
30+
</p-button>
31+
32+
@if (invoice.payment.status === paymentStatus.Pending) {
33+
<p-button
34+
styleClass="ms-2"
35+
icon="bi bi-credit-card"
36+
label="Make payment"
37+
severity="info"
38+
[routerLink]="['/payment/invoice', invoice.id]">
39+
</p-button>
40+
}
2641
}
2742
</p-card>

src/Client/Logistics.OfficeApp/src/app/pages/accounting/view-invoice/view-invoice.component.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {Component, OnInit} from '@angular/core';
2-
import {CommonModule, CurrencyPipe, DatePipe} from '@angular/common';
3-
import {ActivatedRoute} from '@angular/router';
2+
import {CommonModule} from '@angular/common';
3+
import {ActivatedRoute, RouterModule} from '@angular/router';
44
import {CardModule} from 'primeng/card';
55
import {ButtonModule} from 'primeng/button';
66
import {jsPDF} from 'jspdf';
77
import {ProgressSpinnerModule} from 'primeng/progressspinner';
88
import {ApiService, TenantService} from '@core/services';
99
import {Invoice} from '@core/models';
10-
import {PaymentMethod, PaymentMethodEnum} from '@core/enums';
10+
import {PaymentMethod, PaymentMethodEnum, PaymentStatus} from '@core/enums';
1111

1212

1313
@Component({
@@ -20,12 +20,12 @@ import {PaymentMethod, PaymentMethodEnum} from '@core/enums';
2020
CardModule,
2121
ButtonModule,
2222
ProgressSpinnerModule,
23-
CurrencyPipe,
24-
DatePipe
23+
RouterModule,
2524
],
2625
})
2726
export class ViewInvoiceComponent implements OnInit {
2827
private id?: string;
28+
public paymentStatus = PaymentStatus;
2929
public isLoading = false;
3030
public companyName?: string;
3131
public companyAddress?: string;

src/Client/Logistics.OfficeApp/src/app/pages/load/add-load/add-load.component.html

+15-20
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ <h1>Add a new load</h1>
3737
(selectedAddress)="updateDestination($event)">
3838
</app-address-autocomplete>
3939
</div>
40-
<div class="mb-3">
41-
<label for="dispatchedDate" class="form-label">Dispatched Date</label>
42-
<input id="dispatchedDate" formControlName="dispatchedDate" type="text" class="form-control" readonly />
43-
</div>
4440
<div class="mb-3">
4541
<label for="deliveryCost" class="form-label">Delivery Cost</label>
4642
<div class="input-group">
@@ -52,31 +48,30 @@ <h1>Add a new load</h1>
5248
<label for="distance" class="form-label">Estimated Distance</label>
5349
<div class="input-group">
5450
<span class="input-group-text">mi</span>
55-
<input id="distance" formControlName="distance" type="number" class="form-control" min="0" readonly />
51+
<input id="distance" formControlName="distance" type="number" class="form-control" min="0" />
5652
</div>
5753
</div>
5854
<div class="mb-3">
5955
<label for="dispatcherName" class="form-label">Assigned Dispatcher</label>
60-
<input id="dispatcherName" formControlName="assignedDispatcherName" type="text" class="form-control" readonly />
56+
<input id="dispatcherName" formControlName="assignedDispatcherName" type="text" class="form-control" />
6157
</div>
6258
<div class="mb-3">
6359
<label for="assignedTruck" class="form-label">Assigned Truck</label>
6460
<app-search-truck formControlName="assignedTruck"></app-search-truck>
6561
</div>
66-
<div>
67-
<p-button type="submit"
68-
class="mt-3"
69-
icon="bi bi-pencil-square"
70-
label="Add"
71-
[disabled]="isLoading || !form.valid">
72-
</p-button>
73-
<p-button type="button"
74-
class="mt-3 ms-0 ms-md-2"
75-
icon="bi bi-arrow-left-square"
76-
label="Back to list"
77-
[routerLink]="['/loads']">
78-
</p-button>
79-
</div>
62+
63+
<p-button type="submit"
64+
class="mt-3"
65+
icon="bi bi-pencil-square"
66+
label="Add"
67+
[disabled]="isLoading || !form.valid">
68+
</p-button>
69+
<p-button type="button"
70+
class="mt-3 ms-0 ms-md-2"
71+
icon="bi bi-arrow-left-square"
72+
label="Back to list"
73+
[routerLink]="['/loads']">
74+
</p-button>
8075
</form>
8176
</div>
8277
<div class="col-12 col-md-6">

src/Client/Logistics.OfficeApp/src/app/pages/load/add-load/add-load.component.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,11 @@ export class AddLoadComponent implements OnInit {
6969
orgCoords: new FormControl([0,0], {validators: Validators.required, nonNullable: true}),
7070
dstAddress: new FormControl(null, {validators: Validators.required, nonNullable: true}),
7171
dstCoords: new FormControl([0,0], {validators: Validators.required, nonNullable: true}),
72-
dispatchedDate: new FormControl(new Date().toLocaleDateString(), {validators: Validators.required, nonNullable: true}),
7372
deliveryCost: new FormControl(0, {validators: Validators.required, nonNullable: true}),
74-
distance: new FormControl(0, {validators: Validators.required, nonNullable: true}),
73+
distance: new FormControl({value: 0, disabled: true}, {validators: Validators.required, nonNullable: true}),
7574
assignedTruck: new FormControl(null, {validators: Validators.required}),
7675
assignedDispatcherId: new FormControl('', {validators: Validators.required, nonNullable: true}),
77-
assignedDispatcherName: new FormControl('', {validators: Validators.required, nonNullable: true}),
76+
assignedDispatcherName: new FormControl({value: '', disabled: true}, {validators: Validators.required, nonNullable: true}),
7877
});
7978
}
8079

@@ -153,7 +152,6 @@ interface AddLoadForm {
153152
orgCoords: FormControl<[number, number]>;
154153
dstAddress: FormControl<Address | null>;
155154
dstCoords: FormControl<[number, number]>;
156-
dispatchedDate: FormControl<string>;
157155
deliveryCost: FormControl<number>;
158156
distance: FormControl<number>;
159157
assignedTruck: FormControl<TruckData | null>;

0 commit comments

Comments
 (0)