SUPPORT-9561: add year combobox
This commit is contained in:
parent
8daa1bab7c
commit
0115762bdd
2 changed files with 81 additions and 0 deletions
|
|
@ -0,0 +1,45 @@
|
|||
<div [id]="getObjectId()"
|
||||
class="form-group">
|
||||
<label [ngbTooltip]="tooltip | emptyIfNull"
|
||||
[hidden]="!label" class="control-label">
|
||||
<span>{{label}}<span *ngIf="isRequired()" class="alarm"> *</span></span>
|
||||
</label>
|
||||
<div class="component-float" [title]="getValueForTooltip()">
|
||||
<select [name]="name"
|
||||
class="form-control"
|
||||
[ngModel]="getValueAsModel()"
|
||||
#model="ngModel"
|
||||
[ngStyle]="style"
|
||||
[required]="isRequired()">
|
||||
</select>
|
||||
|
||||
<div *ngIf="(model && model.touched && model.errors) || getCustomValidationMessages().size > 0 || warningMessages.length > 0" class="msg" [ngStyle]="errorTooltipStyle">
|
||||
<div class="arrow"></div>
|
||||
<div class="control-label">
|
||||
<div class="msg-alert"
|
||||
*ngFor="let warning of warningMessages">
|
||||
{{warning}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-label">
|
||||
<div class="msg-alert"
|
||||
*ngFor="let customValidationMessage of getCustomValidationMessages()">
|
||||
{{customValidationMessage}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="msg-alert control-label"
|
||||
*ngIf="model.errors && model.errors['required']">
|
||||
{{getErrorMessages()['required']}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="msg-versioning" *ngIf="getVersioningValidationMessage()" [ngStyle]="tooltipIfNotSatisfyStyle">
|
||||
<div class="arrow"></div>
|
||||
<div class="control-label">
|
||||
<div class="msg-alert">
|
||||
{{getVersioningValidationMessage()}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
36
frontend/src/ts/ervu/component/combobox/YearComboBox.ts
Normal file
36
frontend/src/ts/ervu/component/combobox/YearComboBox.ts
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import {ComboBox, ComboBoxModel} from "@webbpm/base-package";
|
||||
import {ChangeDetectionStrategy, Component} from "@angular/core";
|
||||
|
||||
@Component({
|
||||
moduleId: module.id,
|
||||
selector: 'year-combo-box',
|
||||
templateUrl: './../../../../../src/resources/template/ervu/component/combobox/ComboBox.html',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class YearComboBox extends ComboBox {
|
||||
|
||||
private START_YEAR: number = 2025;
|
||||
|
||||
initialize(): Promise<void> {
|
||||
return this.loadData();
|
||||
}
|
||||
|
||||
loadData(): Promise<void> {
|
||||
let currentYear = new Date().getFullYear();
|
||||
let startYear = this.START_YEAR;
|
||||
let years: ComboBoxModel[] = [];
|
||||
|
||||
while (startYear <= currentYear) {
|
||||
let value = startYear++;
|
||||
let model: ComboBoxModel = new ComboBoxModel();
|
||||
model.id = value;
|
||||
model.label = `${value}`;
|
||||
model.dropDownLabel = `${value}`;
|
||||
model.valid = true;
|
||||
model.hidden = false;
|
||||
years.push(model);
|
||||
}
|
||||
return Promise.resolve()
|
||||
.then(() => this.setData(years));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue