💄 fix input placeholder
This commit is contained in:
parent
97a392f233
commit
818b5c3753
@ -12,12 +12,10 @@
|
|||||||
|
|
||||||
<p-floatlabel variant="in">
|
<p-floatlabel variant="in">
|
||||||
<p-select [options]="packingCategories" id="category" appendTo="body" formControlName="category"
|
<p-select [options]="packingCategories" id="category" appendTo="body" formControlName="category"
|
||||||
optionLabel="dispValue" optionValue="value" placeholder="Select Category" fluid />
|
optionLabel="dispValue" optionValue="value" fluid />
|
||||||
<label for="category">Category</label>
|
<label for="category">Category</label>
|
||||||
</p-floatlabel>
|
</p-floatlabel>
|
||||||
|
|
||||||
<div class="mt-4 text-right">
|
<div class="mt-4 text-right">
|
||||||
<p-button (click)="closeDialog()" [disabled]="!packingForm.dirty || !packingForm.valid">{{
|
<p-button (click)="closeDialog()" label="Create" [disabled]="!packingForm.dirty || !packingForm.valid" />
|
||||||
packingForm.get("id")?.value
|
|
||||||
!== -1 ? "Update" : "Create" }}</p-button>
|
|
||||||
</div>
|
</div>
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
|
import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
|
||||||
import { ButtonModule } from 'primeng/button';
|
import { ButtonModule } from 'primeng/button';
|
||||||
import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog';
|
import { DynamicDialogRef } from 'primeng/dynamicdialog';
|
||||||
import { FloatLabelModule } from 'primeng/floatlabel';
|
import { FloatLabelModule } from 'primeng/floatlabel';
|
||||||
import { InputTextModule } from 'primeng/inputtext';
|
import { InputTextModule } from 'primeng/inputtext';
|
||||||
import { FocusTrapModule } from 'primeng/focustrap';
|
import { FocusTrapModule } from 'primeng/focustrap';
|
||||||
@ -36,24 +36,16 @@ export class TripCreatePackingModalComponent {
|
|||||||
constructor(
|
constructor(
|
||||||
private ref: DynamicDialogRef,
|
private ref: DynamicDialogRef,
|
||||||
private fb: FormBuilder,
|
private fb: FormBuilder,
|
||||||
private config: DynamicDialogConfig,
|
|
||||||
) {
|
) {
|
||||||
this.packingForm = this.fb.group({
|
this.packingForm = this.fb.group({
|
||||||
id: -1,
|
|
||||||
qt: null,
|
qt: null,
|
||||||
text: ['', { validators: Validators.required }],
|
text: ['', { validators: Validators.required }],
|
||||||
category: ['', { validators: Validators.required }],
|
category: ['', { validators: Validators.required }],
|
||||||
});
|
});
|
||||||
|
|
||||||
const patchValue = this.config.data?.packing;
|
|
||||||
if (patchValue) {
|
|
||||||
this.packingForm.patchValue(patchValue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
closeDialog() {
|
closeDialog() {
|
||||||
if (!this.packingForm.valid) return;
|
if (!this.packingForm.valid) return;
|
||||||
|
|
||||||
// Normalize data for API POST
|
// Normalize data for API POST
|
||||||
let ret = this.packingForm.value;
|
let ret = this.packingForm.value;
|
||||||
this.ref.close(ret);
|
this.ref.close(ret);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user