Share Product and Share Account views updated
This commit is contained in:
committed by
Jose Alberto Hernandez
parent
fafdd0dd20
commit
a41df49a3e
@@ -0,0 +1,12 @@
|
||||
<mat-form-field fxFlex fxFlex="28%">
|
||||
<mat-label>{{getLabelText()}}</mat-label>
|
||||
<mat-select placeholder="{{getPlaceHolderText()}}" formControlName="controlSelect">
|
||||
<mat-option *ngFor="let option of selectOptions" [value]="option.id">
|
||||
{{ option.value | translateCatalog }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<button mat-button *ngIf="controlSelect" matSuffix mat-icon-button
|
||||
aria-label="Clear" (click)="clearProperty($event)">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</mat-form-field>
|
||||
@@ -0,0 +1,23 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DropdownComponent } from './dropdown.component';
|
||||
|
||||
describe('DropdownComponent', () => {
|
||||
let component: DropdownComponent;
|
||||
let fixture: ComponentFixture<DropdownComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ DropdownComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(DropdownComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,35 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { UntypedFormControl } from '@angular/forms';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-dropdown',
|
||||
templateUrl: './dropdown.component.html',
|
||||
styleUrls: ['./dropdown.component.scss']
|
||||
})
|
||||
export class DropdownComponent implements OnInit {
|
||||
|
||||
@Input() placeHolderText: string;
|
||||
@Input() labelText: string;
|
||||
@Input() selectOptions: any[] = [];
|
||||
@Input() controlSelect: UntypedFormControl;
|
||||
@Input() required: boolean;
|
||||
|
||||
constructor(private translateService: TranslateService) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
getPlaceHolderText(): string {
|
||||
return this.placeHolderText ? this.translateService.instant('labels.inputs.' + this.placeHolderText) : '';
|
||||
}
|
||||
|
||||
getLabelText(): string {
|
||||
return this.labelText ? this.translateService.instant('labels.inputs.' + this.labelText) : '';
|
||||
}
|
||||
|
||||
clearProperty() {
|
||||
this.controlSelect.patchValue('');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user