feat(web): * for reaquired field
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
formControlName="name"
|
formControlName="name"
|
||||||
label="USER_DETAILS.NAME"
|
label="USER_DETAILS.NAME"
|
||||||
placeholder="USER_DETAILS.NAME_PLACEHOLDER"
|
placeholder="USER_DETAILS.NAME_PLACEHOLDER"
|
||||||
|
[required]="true"
|
||||||
[error]="form.get('name')?.invalid && form.get('name')?.touched ? ('COMMON.REQUIRED' | translate) : null">
|
[error]="form.get('name')?.invalid && form.get('name')?.touched ? ('COMMON.REQUIRED' | translate) : null">
|
||||||
</app-input>
|
</app-input>
|
||||||
</div>
|
</div>
|
||||||
@@ -19,6 +20,7 @@
|
|||||||
formControlName="surname"
|
formControlName="surname"
|
||||||
label="USER_DETAILS.SURNAME"
|
label="USER_DETAILS.SURNAME"
|
||||||
placeholder="USER_DETAILS.SURNAME_PLACEHOLDER"
|
placeholder="USER_DETAILS.SURNAME_PLACEHOLDER"
|
||||||
|
[required]="true"
|
||||||
[error]="form.get('surname')?.invalid && form.get('surname')?.touched ? ('COMMON.REQUIRED' | translate) : null">
|
[error]="form.get('surname')?.invalid && form.get('surname')?.touched ? ('COMMON.REQUIRED' | translate) : null">
|
||||||
</app-input>
|
</app-input>
|
||||||
</div>
|
</div>
|
||||||
@@ -32,6 +34,7 @@
|
|||||||
label="USER_DETAILS.EMAIL"
|
label="USER_DETAILS.EMAIL"
|
||||||
type="email"
|
type="email"
|
||||||
placeholder="USER_DETAILS.EMAIL_PLACEHOLDER"
|
placeholder="USER_DETAILS.EMAIL_PLACEHOLDER"
|
||||||
|
[required]="true"
|
||||||
[error]="form.get('email')?.invalid && form.get('email')?.touched ? ('COMMON.INVALID_EMAIL' | translate) : null">
|
[error]="form.get('email')?.invalid && form.get('email')?.touched ? ('COMMON.INVALID_EMAIL' | translate) : null">
|
||||||
</app-input>
|
</app-input>
|
||||||
</div>
|
</div>
|
||||||
@@ -41,6 +44,7 @@
|
|||||||
label="USER_DETAILS.PHONE"
|
label="USER_DETAILS.PHONE"
|
||||||
type="tel"
|
type="tel"
|
||||||
placeholder="USER_DETAILS.PHONE_PLACEHOLDER"
|
placeholder="USER_DETAILS.PHONE_PLACEHOLDER"
|
||||||
|
[required]="true"
|
||||||
[error]="form.get('phone')?.invalid && form.get('phone')?.touched ? ('COMMON.REQUIRED' | translate) : null">
|
[error]="form.get('phone')?.invalid && form.get('phone')?.touched ? ('COMMON.REQUIRED' | translate) : null">
|
||||||
</app-input>
|
</app-input>
|
||||||
</div>
|
</div>
|
||||||
@@ -51,6 +55,7 @@
|
|||||||
formControlName="address"
|
formControlName="address"
|
||||||
label="USER_DETAILS.ADDRESS"
|
label="USER_DETAILS.ADDRESS"
|
||||||
placeholder="USER_DETAILS.ADDRESS_PLACEHOLDER"
|
placeholder="USER_DETAILS.ADDRESS_PLACEHOLDER"
|
||||||
|
[required]="true"
|
||||||
[error]="form.get('address')?.invalid && form.get('address')?.touched ? ('COMMON.REQUIRED' | translate) : null">
|
[error]="form.get('address')?.invalid && form.get('address')?.touched ? ('COMMON.REQUIRED' | translate) : null">
|
||||||
</app-input>
|
</app-input>
|
||||||
|
|
||||||
@@ -61,6 +66,7 @@
|
|||||||
formControlName="zip"
|
formControlName="zip"
|
||||||
label="USER_DETAILS.ZIP"
|
label="USER_DETAILS.ZIP"
|
||||||
placeholder="USER_DETAILS.ZIP_PLACEHOLDER"
|
placeholder="USER_DETAILS.ZIP_PLACEHOLDER"
|
||||||
|
[required]="true"
|
||||||
[error]="form.get('zip')?.invalid && form.get('zip')?.touched ? ('COMMON.REQUIRED' | translate) : null">
|
[error]="form.get('zip')?.invalid && form.get('zip')?.touched ? ('COMMON.REQUIRED' | translate) : null">
|
||||||
</app-input>
|
</app-input>
|
||||||
</div>
|
</div>
|
||||||
@@ -69,6 +75,7 @@
|
|||||||
formControlName="city"
|
formControlName="city"
|
||||||
label="USER_DETAILS.CITY"
|
label="USER_DETAILS.CITY"
|
||||||
placeholder="USER_DETAILS.CITY_PLACEHOLDER"
|
placeholder="USER_DETAILS.CITY_PLACEHOLDER"
|
||||||
|
[required]="true"
|
||||||
[error]="form.get('city')?.invalid && form.get('city')?.touched ? ('COMMON.REQUIRED' | translate) : null">
|
[error]="form.get('city')?.invalid && form.get('city')?.touched ? ('COMMON.REQUIRED' | translate) : null">
|
||||||
</app-input>
|
</app-input>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@if (label()) { <label [for]="id()">{{ label() }}</label> }
|
@if (label()) {
|
||||||
|
<label [for]="id()">
|
||||||
|
{{ label() }}
|
||||||
|
@if (required()) { <span class="required-mark">*</span> }
|
||||||
|
</label>
|
||||||
|
}
|
||||||
<input
|
<input
|
||||||
[id]="id()"
|
[id]="id()"
|
||||||
[type]="type()"
|
[type]="type()"
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
.form-group { display: flex; flex-direction: column; margin-bottom: var(--space-4); }
|
.form-group { display: flex; flex-direction: column; margin-bottom: var(--space-4); }
|
||||||
label { font-size: 0.875rem; font-weight: 500; margin-bottom: var(--space-2); color: var(--color-text); }
|
label { font-size: 0.875rem; font-weight: 500; margin-bottom: var(--space-2); color: var(--color-text); }
|
||||||
|
.required-mark { color: var(--color-danger-500); margin-left: 2px; }
|
||||||
.form-control {
|
.form-control {
|
||||||
padding: 0.5rem 0.75rem;
|
padding: 0.5rem 0.75rem;
|
||||||
border: 1px solid var(--color-border);
|
border: 1px solid var(--color-border);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ export class AppInputComponent implements ControlValueAccessor {
|
|||||||
type = input<string>('text');
|
type = input<string>('text');
|
||||||
placeholder = input<string>('');
|
placeholder = input<string>('');
|
||||||
error = input<string | null>(null);
|
error = input<string | null>(null);
|
||||||
|
required = input<boolean>(false);
|
||||||
|
|
||||||
value: string = '';
|
value: string = '';
|
||||||
disabled = false;
|
disabled = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user