feat(purchases): update terminology from "محصول" to "کالا" in purchase forms and templates
refactor(purchases): remove unused purchase receipt components and consolidate receipt template logic fix(suppliers): enhance suppliers select component to support full data option values style(tailwind): improve theme variables for better customization and consistency feat(shared): introduce abstract select component for reusable select field logic chore(purchases): clean up imports and improve component structure for better maintainability
This commit is contained in:
@@ -1,15 +1,13 @@
|
||||
<div class="">
|
||||
<uikit-field label="انبار">
|
||||
<p-select
|
||||
[options]="brands()"
|
||||
optionLabel="name"
|
||||
optionValue="id"
|
||||
placeholder="انتخاب انبار"
|
||||
[formControl]="control"
|
||||
[showClear]="true"
|
||||
[filter]="true"
|
||||
appendTo="body"
|
||||
>
|
||||
</p-select>
|
||||
</uikit-field>
|
||||
</div>
|
||||
<uikit-field label="انبار" [control]="control" [showLabel]="showLabel" [showErrors]="showErrors">
|
||||
<p-select
|
||||
[options]="items()"
|
||||
optionLabel="name"
|
||||
[optionValue]="selectOptionValue"
|
||||
placeholder="انتخاب انبار"
|
||||
[formControl]="control"
|
||||
[showClear]="true"
|
||||
[filter]="true"
|
||||
appendTo="body"
|
||||
>
|
||||
</p-select>
|
||||
</uikit-field>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Maybe } from '@/core';
|
||||
import { AbstractSelectComponent } from '@/shared/components';
|
||||
import { UikitFieldComponent } from '@/uikit';
|
||||
import { Component, Input, signal } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { Component } from '@angular/core';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { Select } from 'primeng/select';
|
||||
import { IInventoryResponse } from '../../models';
|
||||
import { InventoriesService } from '../../services/main.service';
|
||||
@@ -11,24 +11,17 @@ import { InventoriesService } from '../../services/main.service';
|
||||
templateUrl: './select.component.html',
|
||||
imports: [ReactiveFormsModule, Select, UikitFieldComponent],
|
||||
})
|
||||
export class InventoriesSelectComponent {
|
||||
@Input() control!: FormControl<Maybe<number>>;
|
||||
@Input() canInsert: boolean = false;
|
||||
|
||||
export class InventoriesSelectComponent extends AbstractSelectComponent<IInventoryResponse> {
|
||||
constructor(private service: InventoriesService) {
|
||||
super();
|
||||
this.getData();
|
||||
}
|
||||
|
||||
loading = signal(false);
|
||||
brands = signal<Maybe<IInventoryResponse[]>>(null);
|
||||
|
||||
isOpenFormDialog = signal(false);
|
||||
|
||||
getData() {
|
||||
this.loading.set(true);
|
||||
this.service.getAll().subscribe({
|
||||
next: (res) => {
|
||||
this.brands.set(res.data);
|
||||
this.items.set(res.data);
|
||||
this.loading.set(false);
|
||||
},
|
||||
error: () => {
|
||||
@@ -36,12 +29,4 @@ export class InventoriesSelectComponent {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
refresh() {
|
||||
this.getData();
|
||||
}
|
||||
|
||||
onOpenForm() {
|
||||
// this.isOpenFormDialog.set(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user