wired the api for rest mock data

This commit is contained in:
2026-07-07 17:35:00 +05:30
parent e6ad37b20f
commit 903c7ea74c
14 changed files with 672 additions and 173 deletions

View File

@@ -115,7 +115,9 @@ const mapMiler = (m, hubName) => {
hub: hubName,
zones: Array.isArray(m.zones) ? m.zones : m.currentpincode ? [m.currentpincode] : [],
vehicle,
vehicleNo: m.vehicleid ? `VEH-${m.vehicleid}` : '—',
// Real registration plate from the joined vehicles table; fall back to a
// placeholder tag if the miler has no vehicle assigned.
vehicleNo: m.vehicleno || (m.vehicleid ? `VEH-${m.vehicleid}` : '—'),
status: API_TO_UI_STATUS[m.availabilitystatus] || 'Idle',
checkInTime: checkInLabel(m.checkinat),
hoursToday: m.hoursactive ?? 0,
@@ -520,6 +522,10 @@ function ProfileDrawer({ rider, onClose, onSave, startInEdit = false }) {
open={!!rider}
onClose={onClose}
sx={{
// This build renders temporary drawers at zIndex.drawer (1200), which sits
// BELOW the app bar (drawer + 1). On mobile the sheet starts at top:0, so its
// Close button would hide under the app bar. Lift the whole modal above it.
zIndex: (t) => t.zIndex.modal,
'& .MuiDrawer-paper': {
width: { xs: '100%', sm: 380 },
maxWidth: '100%',
@@ -541,7 +547,7 @@ function ProfileDrawer({ rider, onClose, onSave, startInEdit = false }) {
</Button>
<Typography variant="h6" sx={{ fontWeight: 800, lineHeight: 1.25,fontSize: '1.5rem' }}>{form.name || rider.name}</Typography>
<Typography variant="body2" sx={{ opacity: 0.9, fontFamily: 'monospace', mb: 0.25 }}>{rider.id}</Typography>
<Stack direction="row" alignItems="center" spacing={0.75} mt={2} flexWrap="wrap" useFlexGap>
<Stack direction="row" alignItems="center" spacing={0.75} useFlexGap sx={{ flexWrap: 'wrap', mt: 2 }}>
<Chip size="small" label={form.status || rider.status}
sx={{ bgcolor: 'rgba(255,255,255,0.18)', color: '#fff', fontWeight: 700 }} />
{rider.verified && (
@@ -883,7 +889,7 @@ function RiderCard({ rider, onView, onMenu }) {
direction="row"
spacing={1}
useFlexGap
flexWrap="wrap"
sx={{ flexWrap: 'wrap' }}
>
{rider.zones.slice(0, 3).map((z) => (
<Chip
@@ -1261,7 +1267,7 @@ export default function Riders() {
</Stack>
{/* Status Chips */}
<Stack direction="row" gap={1.25} flexWrap="wrap" rowGap={1.5} mt={4} spacing={1}>
<Stack direction="row" sx={{ flexWrap: 'wrap', columnGap: 1.25, rowGap: 1.5, mt: 4 }}>
{STATUS_CHIPS.map(s => {
const active = statusFilter === s;
const meta = STATUS_META[s] || {};
@@ -1339,7 +1345,7 @@ export default function Riders() {
</TableCell>
<TableCell><StatusPill status={rider.status} /></TableCell>
<TableCell>
<Stack direction="row" gap={0.5} flexWrap="wrap">
<Stack direction="row" sx={{ flexWrap: 'wrap', gap: 0.5 }}>
{rider.zones.map(z => <Chip key={z} label={z} size="small" variant="outlined" />)}
</Stack>
</TableCell>