+
diff --git a/ui/src/app/customer-area/components/order-dialog/order-dialog.component.spec.ts b/ui/src/app/customer-area/components/order-dialog/order-dialog.component.spec.ts
index 0844d7a..4f5656e 100644
--- a/ui/src/app/customer-area/components/order-dialog/order-dialog.component.spec.ts
+++ b/ui/src/app/customer-area/components/order-dialog/order-dialog.component.spec.ts
@@ -30,6 +30,7 @@ import { Farm } from 'src/app/commons/models/farm.model';
import { DeliveryAddress } from 'src/app/commons/models/delivery-address.model';
import { AuthenticationServiceMock } from 'src/app/commons/services/authentication.service.mock';
import { Batch } from 'src/app/commons/models/batch.model';
+import { MatSnackBarModule } from '@angular/material/snack-bar';
describe('OrderDialogComponent', () => {
@@ -84,7 +85,8 @@ describe('OrderDialogComponent', () => {
],
imports: [
HttpClientTestingModule,
- CommonsModule
+ CommonsModule,
+ MatSnackBarModule
].concat(
basicAngularImports,
materialImports),
@@ -123,7 +125,8 @@ describe('OrderDialogComponent', () => {
],
imports: [
HttpClientTestingModule,
- CommonsModule
+ CommonsModule,
+ MatSnackBarModule
].concat(
basicAngularImports,
materialImports
diff --git a/ui/src/app/customer-area/components/order-dialog/order-dialog.component.ts b/ui/src/app/customer-area/components/order-dialog/order-dialog.component.ts
index 9c17eaf..a9ef87f 100644
--- a/ui/src/app/customer-area/components/order-dialog/order-dialog.component.ts
+++ b/ui/src/app/customer-area/components/order-dialog/order-dialog.component.ts
@@ -11,6 +11,7 @@ import { Order } from 'src/app/commons/models/order.model';
import { OrderItem } from 'src/app/commons/models/order-item.model';
import { EventEmitter } from '@angular/core';
import { OrderStatus } from 'src/app/commons/models/order-status.model';
+import { MatSnackBar } from '@angular/material/snack-bar';
@Component({
selector: 'app-order-dialog',
@@ -43,12 +44,14 @@ export class OrderDialogComponent implements OnInit {
understood = false;
orderStored = false;
authenticationSubmitted = false;
+ orderUnderProcess = false;
constructor(
private authenticationService: AuthenticationService,
private userService: AccountService,
private orderService: OrderService,
- private formBuilder: FormBuilder) {}
+ private formBuilder: FormBuilder,
+ private messageInfo: MatSnackBar) {}
ngOnInit(): void {
this.initLabels();
@@ -209,9 +212,24 @@ export class OrderDialogComponent implements OnInit {
this.orderService.saveOrder(this.order).subscribe((order: Order) => {
this.confirmationStepLabel = 'C\'est validé';
this.orderStored = true;
+ this.orderUnderProcess = false;
+ this.confirmationButtonLabel = 'La commande est réservée';
+ this.displayConfirmationMessage();
this.createOrderEvent.emit(this.order);
});
- this.confirmationButtonLabel = 'La commande est réservée';
+ this.orderUnderProcess = true;
+ this.confirmationButtonLabel = 'Traitement en cours...';
+ }
+
+ private displayConfirmationMessage() {
+ this.messageInfo.open(
+ 'Votre commande est enregistrée. Merci :)',
+ 'X',
+ {
+ duration: 3000,
+ horizontalPosition: 'center',
+ verticalPosition: 'top'
+ });
}
close(){
@@ -221,6 +239,7 @@ export class OrderDialogComponent implements OnInit {
private resetComponentProperties() {
this.order = null;
this.orderStored = false;
+ this.orderUnderProcess = false;
this.existingAccount = true;
this.authenticationSubmitted = false;
this.understood = false;