diff --git a/cllc-public-app/ClientApp/src/app/components/sep/sep-application/event/event.component.html b/cllc-public-app/ClientApp/src/app/components/sep/sep-application/event/event.component.html
index 62262f351d..7eb98f5422 100644
--- a/cllc-public-app/ClientApp/src/app/components/sep/sep-application/event/event.component.html
+++ b/cllc-public-app/ClientApp/src/app/components/sep/sep-application/event/event.component.html
@@ -166,11 +166,16 @@
Service Areas
+
+ Maximum number of guests in the service area exceeds maximum number of guests at location
+
+
diff --git a/cllc-public-app/ClientApp/src/app/components/sep/sep-application/event/event.component.scss b/cllc-public-app/ClientApp/src/app/components/sep/sep-application/event/event.component.scss
index f5aaaf9518..20740e7eb3 100644
--- a/cllc-public-app/ClientApp/src/app/components/sep/sep-application/event/event.component.scss
+++ b/cllc-public-app/ClientApp/src/app/components/sep/sep-application/event/event.component.scss
@@ -21,4 +21,9 @@ td {
.setting-select {
width: 200px;
-}
\ No newline at end of file
+}
+
+.error-text {
+ color: #d8292f;
+ font-size: 14px;
+ }
\ No newline at end of file
diff --git a/cllc-public-app/ClientApp/src/app/components/sep/sep-application/event/event.component.ts b/cllc-public-app/ClientApp/src/app/components/sep/sep-application/event/event.component.ts
index e8f3aaab79..4f056adef0 100644
--- a/cllc-public-app/ClientApp/src/app/components/sep/sep-application/event/event.component.ts
+++ b/cllc-public-app/ClientApp/src/app/components/sep/sep-application/event/event.component.ts
@@ -32,6 +32,7 @@ export class EventComponent extends FormBase implements OnInit {
faQuestionCircle = faQuestionCircle;
form: FormGroup;
showValidationMessages: boolean;
+ showAmountExceedValidation: boolean;
validationMessages: string[];
previewCities: AutoCompleteItem[] = [];
autocompleteCities: AutoCompleteItem[] = [];
@@ -360,6 +361,9 @@ export class EventComponent extends FormBase implements OnInit {
this.markControlsAsTouched(this.form);
this.form.updateValueAndValidity();
this.validationMessages = this.listControlsWithErrors(this.form, {});
+ if (this.showAmountExceedValidation) {
+ this.validationMessages.push("Maximum number of guests in the service area exceeds maximum number of guests at location");
+ }
const valid = this.form.valid;
return valid;
}
@@ -498,7 +502,7 @@ export class EventComponent extends FormBase implements OnInit {
next() {
this.showValidationMessages = false;
- if (this.isValid() && this.form.get('sepCity')?.value?.id) {
+ if (this.isValid() && this.form.get('sepCity')?.value?.id && !this.showAmountExceedValidation) {
this.saveComplete.emit(this.getFormValue());
//console.log("saving...")
} else {
@@ -507,4 +511,23 @@ export class EventComponent extends FormBase implements OnInit {
}
}
+ isMaxGuestExceed(locationNumber, locationIndex: number): Boolean {
+
+ if (locationNumber === undefined) {
+ return true;
+ }
+ let sum = 0;
+ let areas = this.getServiceAreas(locationIndex);
+ areas.controls.forEach((area) => {
+ const value = area.get('licencedAreaMaxNumberOfGuests').value;
+ if (!isNaN(value)) {
+ sum += (Number(value));
+ }
+ });
+
+ let totalGuestOnLocation = locationNumber;
+ this.showAmountExceedValidation = Number(sum) > Number(totalGuestOnLocation);
+ return this.showAmountExceedValidation;
+ }
+
}