diff --git a/src/api/client.ts b/src/api/client.ts index 3f1f9fa..8323094 100644 --- a/src/api/client.ts +++ b/src/api/client.ts @@ -127,7 +127,6 @@ export class ZinoClient { try { const p = JSON.parse(atob(this.token.split('.')[1])); - console.log('--- JWT PAYLOAD ---', p); return { id: String(p.user_id ?? p.sub ?? ''), org_id: String(p.org_id ?? ''), diff --git a/src/api/config.ts b/src/api/config.ts index ff193ea..3904e11 100644 --- a/src/api/config.ts +++ b/src/api/config.ts @@ -65,7 +65,7 @@ export const ORDER_BOOKING = { recordViews: { ORDERS: '1e424561-9a27-44f5-9b68-64d63296d837', CALLS: 'b4d7a710-24e7-416d-885a-31fd1e727aab', - ANALYTICS: '56b21b46-6d2c-4e10-b5a3-c63d058d0afa' + ANALYTICS: 'b4d7a710-24e7-416d-885a-31fd1e727aab' }, detailViews: { ORDERS: '0804c6c3-6cf9-4050-94bb-fa48dd5de87d', diff --git a/src/components/forms/fields/SmartGridField.tsx b/src/components/forms/fields/SmartGridField.tsx index 307663e..56ec727 100644 --- a/src/components/forms/fields/SmartGridField.tsx +++ b/src/components/forms/fields/SmartGridField.tsx @@ -159,61 +159,49 @@ export function SmartGridField({ {value.length === 0 ? ( No rows added. ) : ( -
| - {col.name} - | - ))} -- |
|---|---|
|
- {(() => {
- const val = row[col.id];
- let displayVal = String(val ?? '-');
+
+ {value.map((row, i) => {
+ let productName = 'Unknown Product';
+ let bags = '0';
- if (col.data_type === 'select' || col.data_type === 'multiselect') {
- const opt = col.properties?.options?.find(o => String(o.value) === String(val));
- if (opt) displayVal = opt.label;
- }
+ visibleColumns.forEach(col => {
+ const isName = col.id.toLowerCase().includes('name') || col.name.toLowerCase().includes('name') || (col.id.toLowerCase().includes('category') && productName === 'Unknown Product');
+ const isBags = col.id.toLowerCase().includes('bags') || col.name.toLowerCase().includes('bags') || col.id.toLowerCase().includes('quantity');
+
+ if (isName || isBags) {
+ const val = row[col.id];
+ let displayVal = String(val ?? '-');
- if ((col.id.toLowerCase().includes('difference') || col.name?.toLowerCase().includes('difference')) && val != null && val !== '') {
- const numVal = Number(val);
- if (!isNaN(numVal)) {
- if (numVal < 0) {
- displayVal = `${Math.abs(numVal)} kgs less`;
- } else if (numVal > 0) {
- displayVal = `${numVal} kgs more`;
- } else {
- displayVal = `0 kgs`;
- }
- }
- }
+ if (col.data_type === 'select' || col.data_type === 'multiselect') {
+ const opt = col.properties?.options?.find(o => String(o.value) === String(val));
+ if (opt) displayVal = opt.label;
+ }
- return displayVal;
- })()}
- |
- ))}
- - - - | -