💄 fix input placeholder

This commit is contained in:
itskovacs 2025-10-12 16:03:04 +02:00
parent 97a392f233
commit 818b5c3753
2 changed files with 3 additions and 13 deletions

View File

@ -12,12 +12,10 @@
<p-floatlabel variant="in">
<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>
</p-floatlabel>
<div class="mt-4 text-right">
<p-button (click)="closeDialog()" [disabled]="!packingForm.dirty || !packingForm.valid">{{
packingForm.get("id")?.value
!== -1 ? "Update" : "Create" }}</p-button>
<p-button (click)="closeDialog()" label="Create" [disabled]="!packingForm.dirty || !packingForm.valid" />
</div>

View File

@ -1,7 +1,7 @@
import { Component } from '@angular/core';
import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
import { ButtonModule } from 'primeng/button';
import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog';
import { DynamicDialogRef } from 'primeng/dynamicdialog';
import { FloatLabelModule } from 'primeng/floatlabel';
import { InputTextModule } from 'primeng/inputtext';
import { FocusTrapModule } from 'primeng/focustrap';
@ -36,24 +36,16 @@ export class TripCreatePackingModalComponent {
constructor(
private ref: DynamicDialogRef,
private fb: FormBuilder,
private config: DynamicDialogConfig,
) {
this.packingForm = this.fb.group({
id: -1,
qt: null,
text: ['', { validators: Validators.required }],
category: ['', { validators: Validators.required }],
});
const patchValue = this.config.data?.packing;
if (patchValue) {
this.packingForm.patchValue(patchValue);
}
}
closeDialog() {
if (!this.packingForm.valid) return;
// Normalize data for API POST
let ret = this.packingForm.value;
this.ref.close(ret);