From 2744daeb1ea0604c7ebc8c57a99102f8bc8a9329 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mehmet=20=C3=87etin?=
<92744169+mehmetcetin01140@users.noreply.github.com>
Date: Mon, 6 Jan 2025 14:58:04 +0300
Subject: [PATCH] update tabledoc
---
src/views/uikit/tabledoc.ts | 292 +++++++++++++++++++-----------------
1 file changed, 155 insertions(+), 137 deletions(-)
diff --git a/src/views/uikit/tabledoc.ts b/src/views/uikit/tabledoc.ts
index 7bf74e7..50732ab 100644
--- a/src/views/uikit/tabledoc.ts
+++ b/src/views/uikit/tabledoc.ts
@@ -15,6 +15,9 @@ import { RatingModule } from 'primeng/rating';
import { Customer, CustomerService, Representative } from '@/src/service/customer.service';
import { Product, ProductService } from '@/src/service/product.service';
import { RippleModule } from 'primeng/ripple';
+import { IconFieldModule } from 'primeng/iconfield';
+import { InputIconModule } from 'primeng/inputicon';
+import { TagModule } from 'primeng/tag';
interface expandedRows {
[key: string]: boolean;
@@ -22,60 +25,79 @@ interface expandedRows {
@Component({
standalone: true,
- imports:[TableModule, MultiSelectModule, SelectModule, InputTextModule, SliderModule,ProgressBarModule,ToggleButtonModule,ToastModule, CommonModule, FormsModule,ButtonModule,RatingModule, RippleModule],
- template: `
-
+ imports: [
+ TableModule,
+ MultiSelectModule,
+ SelectModule,
+ InputTextModule,
+ SliderModule,
+ ProgressBarModule,
+ ToggleButtonModule,
+ ToastModule,
+ CommonModule,
+ FormsModule,
+ ButtonModule,
+ RatingModule,
+ RippleModule,
+ IconFieldModule,
+ InputIconModule,
+ SelectModule,
+ TagModule
+ ],
+ template: `
Filtering
-
-
-
-
-
-
-
-
+
+
+
-
-
+
+
|
-
-
+
+
|
-
-
+
+
Agent
-
+
-
+
Agent Picker
-
+
-
- 
- {{ option.name }}
+
+ 
+ {{ option.name }}
@@ -83,47 +105,39 @@ interface expandedRows {
|
-
-
+
+
|
-
-
+
+
|
-
-
+
+
Status
-
+
- {{ option.label }}
+
|
-
-
+
+
Activity
-
+
-
-
+
+
{{ activityValues[0] }}
{{ activityValues[1] }}
@@ -131,10 +145,10 @@ interface expandedRows {
|
-
- | | | | | | | |
@@ -145,32 +159,27 @@ interface expandedRows {
{{ customer.name }}
-
+
{{ customer.country.name }}
|
-
+
{{ customer.representative.name }}
|
{{ customer.date | date: 'MM/dd/yyyy' }}
|
- {{ customer.balance | currency:'USD':'symbol' }}
+ {{ customer.balance | currency: 'USD' : 'symbol' }}
|
{{ customer.status }}
|
-
+
|
-
+
|
@@ -189,12 +198,9 @@ interface expandedRows {
Frozen Columns
-
+
-
+
| Name |
@@ -211,12 +217,9 @@ interface expandedRows {
| {{ customer.name }} |
- {{ customer.id }}
- |
+ {{ customer.id }} |
-
+
{{ customer.country.name }}
|
{{ customer.date }} |
@@ -226,14 +229,10 @@ interface expandedRows {
{{ customer.activity }} |
-
+
{{ customer.representative.name }}
|
- {{ formatCurrency(customer.balance) }}
- |
+ {{ formatCurrency(customer.balance) }} |
@@ -243,28 +242,31 @@ interface expandedRows {
Row Expansion
-
-
+
+
|
- Name
+ |
+ Name
|
Image |
- Price
+ |
+ Price
|
- Category
+ |
+ Category
|
- Reviews
+ |
+ Reviews
|
- Status
+ |
+ Status
|
@@ -272,20 +274,17 @@ interface expandedRows {
|
-
+
|
{{ product.name }} |
- ![]() |
- {{ product.price | currency:'USD' }} |
+ ![]() |
+ {{ product.price | currency: 'USD' }} |
{{ product.category }} |
|
- {{ product.inventoryStatus }}
+ |
+ {{ product.inventoryStatus }}
|
@@ -296,19 +295,24 @@ interface expandedRows {
- | Id
+ |
+ Id
|
- Customer
+ |
+ Customer
|
- Date
+ |
+ Date
|
- Amount
+ |
+ Amount
|
- Status
+ |
+ Status
|
|
@@ -319,9 +323,9 @@ interface expandedRows {
{{ order.id }} |
{{ order.customer }} |
{{ order.date }} |
- {{ order.amount | currency:'USD' }} |
- {{ order.status }}
+ | {{ order.amount | currency: 'USD' }} |
+
+ {{ order.status }}
|
@@ -343,9 +347,7 @@ interface expandedRows {
Grouping
-
+
| Name |
@@ -358,9 +360,7 @@ interface expandedRows {
-
+
{{ customer.representative.name }}
|
@@ -369,8 +369,7 @@ interface expandedRows {
{{ customer.name }}
-
+
{{ customer.country.name }}
|
@@ -386,10 +385,9 @@ interface expandedRows {
`,
- providers: [ConfirmationService, MessageService, CustomerService, ProductService],
+ providers: [ConfirmationService, MessageService, CustomerService, ProductService]
})
export class TableDoc implements OnInit {
-
customers1: Customer[] = [];
customers2: Customer[] = [];
@@ -420,19 +418,22 @@ export class TableDoc implements OnInit {
@ViewChild('filter') filter!: ElementRef;
- constructor(private customerService: CustomerService, private productService: ProductService) { }
+ constructor(
+ private customerService: CustomerService,
+ private productService: ProductService
+ ) {}
ngOnInit() {
- this.customerService.getCustomersLarge().then(customers => {
+ this.customerService.getCustomersLarge().then((customers) => {
this.customers1 = customers;
this.loading = false;
// @ts-ignore
- this.customers1.forEach(customer => customer.date = new Date(customer.date));
+ this.customers1.forEach((customer) => (customer.date = new Date(customer.date)));
});
- this.customerService.getCustomersMedium().then(customers => this.customers2 = customers);
- this.customerService.getCustomersLarge().then(customers => this.customers3 = customers);
- this.productService.getProductsWithOrdersSmall().then(data => this.products = data);
+ this.customerService.getCustomersMedium().then((customers) => (this.customers2 = customers));
+ this.customerService.getCustomersLarge().then((customers) => (this.customers3 = customers));
+ this.productService.getProductsWithOrdersSmall().then((data) => (this.products = data));
this.representatives = [
{ name: 'Amy Elsner', image: 'amyelsner.png' },
@@ -457,6 +458,28 @@ export class TableDoc implements OnInit {
];
}
+ getSeverity(status: string) {
+ switch (status.toLowerCase()) {
+ case 'unqualified':
+ return 'danger';
+
+ case 'qualified':
+ return 'success';
+
+ case 'new':
+ return 'info';
+
+ case 'negotiation':
+ return 'warn';
+
+ case 'renewal':
+ return null;
+
+ default:
+ return null;
+ }
+ }
+
onSort() {
this.updateRowGroupMetaData();
}
@@ -471,14 +494,12 @@ export class TableDoc implements OnInit {
if (i === 0) {
this.rowGroupMetadata[representativeName] = { index: 0, size: 1 };
- }
- else {
+ } else {
const previousRowData = this.customers3[i - 1];
const previousRowGroup = previousRowData?.representative?.name;
if (representativeName === previousRowGroup) {
this.rowGroupMetadata[representativeName].size++;
- }
- else {
+ } else {
this.rowGroupMetadata[representativeName] = { index: i, size: 1 };
}
}
@@ -488,8 +509,7 @@ export class TableDoc implements OnInit {
expandAll() {
if (!this.isExpanded) {
- this.products.forEach(product => product && product.name ? this.expandedRows[product.name] = true : '');
-
+ this.products.forEach((product) => (product && product.name ? (this.expandedRows[product.name] = true) : ''));
} else {
this.expandedRows = {};
}
@@ -508,6 +528,4 @@ export class TableDoc implements OnInit {
table.clear();
this.filter.nativeElement.value = '';
}
-
-
}
| |