Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/#5533-added-services #2281

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/app/main/service/localstorage/local-storage.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,4 +343,12 @@ export class LocalStorageService {
public getTariffId(): number {
return JSON.parse(localStorage.getItem('currentTariffId'));
}

public setServiceName(serviceName: string): void {
localStorage.setItem('serviceName', serviceName);
}

public setServiceDescription(serviceDescription: string): void {
localStorage.setItem('serviceDescription', serviceDescription);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,13 @@ <h4>{{ 'ubs-tariffs-add-service.edit_service' | translate }}</h4>
formControlName="description"
id="description"
placeholder="{{ 'ubs-tariffs-add-service.placeholder-text' | translate }}"
maxlength="255"
required
>
</textarea>
<div class="validation" *ngIf="getControl('description').invalid && getControl('description').touched">
{{ 'ubs-tariffs-add-service.error_service_field_message' | translate }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use app-ubs-input-error for ubs error messages
For example we use it in UBSAddAddressPopUpComponent

</div>
</div>
<div class="form-group">
<label for="descriptionEng">{{ 'ubs-tariffs-add-service.service_description' | translate }}</label>
Expand All @@ -61,8 +66,13 @@ <h4>{{ 'ubs-tariffs-add-service.edit_service' | translate }}</h4>
formControlName="descriptionEng"
id="descriptionEng"
placeholder="{{ 'ubs-tariffs-add-service.placeholder-text' | translate }}"
maxlength="255"
required
>
</textarea>
<div class="validation" *ngIf="getControl('descriptionEng').invalid && getControl('descriptionEng').touched">
{{ 'ubs-tariffs-add-service.error_service_field_message' | translate }}
</div>
</div>
</div>
<div class="buttons d-flex justify-content-end">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@
border-radius: 0.25rem;
padding: 0.375rem 0.75rem;
}

.validation {
color: var(--ubs-primary-red);
font-size: 12px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ export class UbsAdminTariffsAddServicePopUpComponent implements OnInit, OnDestro
name: new FormControl('', [Validators.required, Validators.pattern(Patterns.NamePattern)]),
nameEng: new FormControl('', [Validators.required, Validators.pattern(Patterns.NamePattern)]),
price: new FormControl('', [Validators.required, Validators.pattern(Patterns.ubsPrice)]),
description: new FormControl('', [Validators.required]),
descriptionEng: new FormControl('', [Validators.required])
description: new FormControl('', [Validators.required, Validators.maxLength(255)]),
descriptionEng: new FormControl('', [Validators.required, Validators.maxLength(255)])
});
}

Expand Down Expand Up @@ -128,6 +128,10 @@ export class UbsAdminTariffsAddServicePopUpComponent implements OnInit, OnDestro
this.loadingAnim = false;
}

getControl(control: string) {
return this.addServiceForm.get(control);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add type of function return :AbstractControl

}

onCancel(): void {
const matDialogRef = this.dialog.open(ModalTextComponent, {
hasBackdrop: true,
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/ubs-admin/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@
"service_description": "Service description",
"placeholder-text": "Describe what is included in the service and the conditions / rules for its provision",
"error_message": "Fill in the selected fields",
"error_service_field_message": "The field must contain between 1 and 255 characters",
"btn": {
"add": "Add",
"cancel": "Cancel",
Expand Down