From e391056b8210c0239847429ca83d8a1f903748dd Mon Sep 17 00:00:00 2001 From: suryacp23 Date: Wed, 15 Jul 2026 11:40:46 +0530 Subject: [PATCH] fix:cards minimal information --- src/components/cards/CallCard.tsx | 8 +- src/components/cards/DailyLogCard.tsx | 6 +- src/components/cards/StoreCard.tsx | 4 +- src/components/dv/DailyLogDetail.tsx | 2 +- src/components/rv/OrdersView.tsx | 55 ++++++++--- src/components/rv/RecordView.tsx | 136 ++++++++++++++++++++------ 6 files changed, 163 insertions(+), 48 deletions(-) diff --git a/src/components/cards/CallCard.tsx b/src/components/cards/CallCard.tsx index a174f56..47d2c20 100644 --- a/src/components/cards/CallCard.tsx +++ b/src/components/cards/CallCard.tsx @@ -1,7 +1,7 @@ import { formatValue } from '../../lib/format'; import { BASE_URL, APP_ID } from '../../api/config'; -export function CallCard({ row }: { row: Record }) { +export function CallCard({ row, isDetailView = false }: { row: Record; isDetailView?: boolean }) { // Status const stateName = String(row.status || row.current_state_name || 'Pending'); const isProductive = stateName.toLowerCase().includes('productive') || stateName.toLowerCase().includes('completed') || stateName.toLowerCase().includes('success'); @@ -89,7 +89,7 @@ export function CallCard({ row }: { row: Record }) { )} - {imageObj && imageObj.uuid && ( + {isDetailView && imageObj && imageObj.uuid && (
}) {
{/* Logistics Grid */} + {isDetailView && (

Total Weight

@@ -124,8 +125,10 @@ export function CallCard({ row }: { row: Record }) {
+ )} {/* Route & Assignment */} + {isDetailView && (

Route

@@ -150,6 +153,7 @@ export function CallCard({ row }: { row: Record }) {
+ )} {/* Footer Timeline */} diff --git a/src/components/cards/DailyLogCard.tsx b/src/components/cards/DailyLogCard.tsx index 3a9e352..4bccaf8 100644 --- a/src/components/cards/DailyLogCard.tsx +++ b/src/components/cards/DailyLogCard.tsx @@ -2,7 +2,7 @@ import { formatValue } from '../../lib/format'; import { FileImage } from 'lucide-react'; import { BASE_URL, APP_ID } from '../../api/config'; -export function DailyLogCard({ row, onPunchOut }: { row: Record; onPunchOut?: (row: any) => void }) { +export function DailyLogCard({ row, isDetailView = false, onPunchOut }: { row: Record; isDetailView?: boolean; onPunchOut?: (row: any) => void }) { const stateName = String(row.status || row.current_state_name || 'Logged'); // User details @@ -93,6 +93,7 @@ export function DailyLogCard({ row, onPunchOut }: { row: Record; on {/* Day Plan & Notes */} + {isDetailView && (
Day Plan Summary
@@ -101,9 +102,10 @@ export function DailyLogCard({ row, onPunchOut }: { row: Record; on

+ )} {/* Attached Verification Media */} - {hasImage && ( + {isDetailView && hasImage && (
Verification Image {imgData.uuid ? ( diff --git a/src/components/cards/StoreCard.tsx b/src/components/cards/StoreCard.tsx index 2141221..4239785 100644 --- a/src/components/cards/StoreCard.tsx +++ b/src/components/cards/StoreCard.tsx @@ -122,7 +122,7 @@ export function StoreCard({ row, fields, isDetailView = false, onEdit }: { row:
)} - {imageObj && imageObj.uuid && ( + {isDetailView && imageObj && imageObj.uuid && (
{/* Contact Info */} - {(ownerName !== '—' || phone !== '—' || email !== '—') && ( + {isDetailView && (ownerName !== '—' || phone !== '—' || email !== '—') && (
{ownerName !== '—' && (

diff --git a/src/components/dv/DailyLogDetail.tsx b/src/components/dv/DailyLogDetail.tsx index 3df3c09..73338e5 100644 --- a/src/components/dv/DailyLogDetail.tsx +++ b/src/components/dv/DailyLogDetail.tsx @@ -15,7 +15,7 @@ export function DailyLogDetail({ instanceId }: WiredDetailViewProps) { return (

- +
); } diff --git a/src/components/rv/OrdersView.tsx b/src/components/rv/OrdersView.tsx index 7fd3458..2cdbe2b 100644 --- a/src/components/rv/OrdersView.tsx +++ b/src/components/rv/OrdersView.tsx @@ -1,7 +1,10 @@ +import { useEffect, useState } from 'react'; import { orderBookingClient } from '../../api/clients'; import { ORDER_BOOKING } from '../../api/config'; import { RecordView } from './RecordView'; import { OrderCard } from '../cards/OrderCard'; +import { StatsTiles } from '../reusable/StatsTiles'; +import type { TileItem } from '../../api/types'; export interface WiredRecordViewProps { onRowClick?: (row: Record, index: number) => void; @@ -13,19 +16,45 @@ export interface WiredRecordViewProps { /** Orders record view (Order Booking workflow). */ export function OrdersView({ onRowClick, pageSize, headerActions, rowActions, refreshKey }: WiredRecordViewProps) { + const [analyticsTiles, setAnalyticsTiles] = useState([]); + + useEffect(() => { + let live = true; + + // Defer the fetch so it doesn't compete with the main list fetch + const timer = setTimeout(async () => { + try { + const res = await orderBookingClient.recordView(ORDER_BOOKING.recordViews.ANALYTICS_ORDERS, { limit: 0 }); + if (live && res.tile_values) { + const filteredTiles = (res.tile_values as TileItem[]).filter( + (t) => t.key !== 'total_orders' && t.key !== 'total_orders_count' + ); + setAnalyticsTiles(filteredTiles); + } + } catch (e) { + console.error("Failed to load analytics tiles for orders", e); + } + }, 100); + + return () => { live = false; clearTimeout(timer); }; + }, [refreshKey]); + return ( - } - /> +
+ {analyticsTiles.length > 0 && } + } + /> +
); } diff --git a/src/components/rv/RecordView.tsx b/src/components/rv/RecordView.tsx index 09722e0..64b3c37 100644 --- a/src/components/rv/RecordView.tsx +++ b/src/components/rv/RecordView.tsx @@ -1,5 +1,5 @@ import { useEffect, useMemo, useRef, useState } from 'react'; -import { Search } from 'lucide-react'; +import { Search, Filter } from 'lucide-react'; import { cn } from '../../lib/cn'; import { formatValue } from '../../lib/format'; import type { ZinoClient } from '../../api/client'; @@ -10,6 +10,8 @@ import { EmptyState } from '../reusable/EmptyState'; import { StatsTiles } from '../reusable/StatsTiles'; import { AnalyticsChart } from '../reusable/AnalyticsChart'; import { Select } from '../reusable/Select'; +import { Input } from '../reusable/Input'; +import { Modal } from '../reusable/Modal'; export interface RecordViewProps { /** Workflow-bound client (see api/clients.ts). */ @@ -64,6 +66,8 @@ export function RecordView({ const [search, setSearch] = useState(''); const [debounced, setDebounced] = useState(''); const [activeFilters, setActiveFilters] = useState>({}); + const [pendingFilters, setPendingFilters] = useState>({}); + const [showFilters, setShowFilters] = useState(false); const [resp, setResp] = useState(null); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); @@ -143,35 +147,111 @@ export function RecordView({
-
- - setSearch(e.target.value)} - placeholder="Search…" - className="w-full h-11 rounded-pill bg-transparent pl-11 pr-4 font-sans text-sm text-strong outline-none placeholder:text-faint" - /> +
+
+ + setSearch(e.target.value)} + placeholder="Search…" + className="w-full h-11 rounded-pill bg-transparent pl-11 pr-4 font-sans text-sm text-strong outline-none placeholder:text-faint" + /> +
+ {filterEntries.length > 0 && ( + + )}
{filterEntries.length > 0 && ( -
- {filterEntries.map(([key, options]) => { - const fieldDef = resp?.config.fields.find(f => f.field_key === key); - const label = fieldDef?.output_label || key; - const opts = options!.map(o => ({ value: o, label: o })); - return ( - c.toUpperCase())} + value={pendingFilters[key] || ''} + onChange={(e) => { + setPendingFilters(prev => ({ ...prev, [key]: e.target.value })); + }} + /> + ); + } + + const opts = options!.map(o => ({ + value: o, + label: o.replace(/[_\-\s]*\(?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\)?/i, '').trim() || o + })); + + return ( +