17fa65407c
- Added `price-info-card.component` to display total amount, tax, and payable amount. - Integrated price masking directive for formatted price display. - Created `categories.component` to list product categories with loading skeletons. - Implemented `grid-view.component` for displaying products in a grid layout. - Enhanced `products.component` to manage category selection and product display. - Introduced new models for product categories and stock responses. - Updated `main.service.ts` to fetch product categories and stock data. - Refactored `POSStore` to manage state for products, categories, and order items. - Added utility functions for price formatting and number normalization. - Included placeholder images for product and logo.
55 lines
1.5 KiB
TypeScript
55 lines
1.5 KiB
TypeScript
import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
|
import {
|
|
IColumn,
|
|
PageDataListComponent,
|
|
} from '@/shared/components/pageDataList/page-data-list.component';
|
|
import { Component, signal, TemplateRef, ViewChild } from '@angular/core';
|
|
import { UserFormComponent } from '../components/form.component';
|
|
import { IUserResponse } from '../models';
|
|
import { UsersService } from '../services/main.service';
|
|
|
|
@Component({
|
|
selector: 'app-users',
|
|
templateUrl: './list.component.html',
|
|
imports: [PageDataListComponent, UserFormComponent, CatalogRoleTagComponent],
|
|
})
|
|
export class UsersComponent {
|
|
constructor(private userService: UsersService) {
|
|
this.getData();
|
|
}
|
|
@ViewChild('role', { static: true }) roleTpl!: TemplateRef<any>;
|
|
|
|
columns = [
|
|
{ field: 'id', header: 'شناسه' },
|
|
{ field: 'firstName', header: 'نام' },
|
|
{ field: 'lastName', header: 'نام خانوادگی' },
|
|
{ field: 'mobileNumber', header: 'شماره موبایل' },
|
|
// { field: 'role', header: 'نقش', customDataModel: this.roleTpl },
|
|
{
|
|
field: 'role',
|
|
header: 'نقش',
|
|
customDataModel: (item: IUserResponse) => item.role.name ?? '-',
|
|
},
|
|
] as IColumn[];
|
|
|
|
loading = signal(false);
|
|
items = signal<IUserResponse[]>([]);
|
|
visibleForm = signal(false);
|
|
|
|
refresh() {
|
|
this.getData();
|
|
}
|
|
|
|
getData() {
|
|
this.loading.set(true);
|
|
this.userService.getAll().subscribe((res) => {
|
|
this.loading.set(false);
|
|
this.items.set(res.data);
|
|
});
|
|
}
|
|
|
|
openAddForm() {
|
|
this.visibleForm.set(true);
|
|
}
|
|
}
|