updates on the milers page and name change
This commit is contained in:
11
src/App.jsx
11
src/App.jsx
@@ -101,9 +101,14 @@ const AuthenticatedApp = () => {
|
||||
|
||||
<Route path="pricing" element={<Pricing />} />
|
||||
|
||||
<Route path="riders" element={<Riders />} />
|
||||
<Route path="riders/create" element={<CreateRider />} />
|
||||
<Route path="riders/edit" element={<EditRider />} />
|
||||
<Route path="milers" element={<Riders />} />
|
||||
<Route path="milers/create" element={<CreateRider />} />
|
||||
<Route path="milers/edit" element={<EditRider />} />
|
||||
|
||||
{/* Backwards-compatible aliases */}
|
||||
<Route path="riders" element={<Navigate to="/doormile/milers" replace />} />
|
||||
<Route path="riders/create" element={<Navigate to="/doormile/milers/create" replace />} />
|
||||
<Route path="riders/edit" element={<Navigate to="/doormile/milers/edit" replace />} />
|
||||
|
||||
<Route path="customers" element={<Customers />} />
|
||||
<Route path="hubs" element={<Hubs />} />
|
||||
|
||||
@@ -284,6 +284,7 @@ const ROUTES = [
|
||||
['/doormile/dispatch', DISPATCH],
|
||||
['/doormile/deliveries', { ...ORDERS, label: 'Deliveries' }],
|
||||
['/doormile/orders', ORDERS],
|
||||
['/doormile/milers', RIDERS],
|
||||
['/doormile/riders', RIDERS],
|
||||
['/doormile/vehicles', VEHICLES],
|
||||
['/doormile/hubs', HUBS],
|
||||
|
||||
@@ -49,7 +49,7 @@ const NAV = [
|
||||
{ label: 'Dispatch', path: '/doormile/dispatch' },
|
||||
{ label: 'Orders', path: '/doormile/orders' },
|
||||
{ label: 'Deliveries', path: '/doormile/deliveries' },
|
||||
{ label: 'Riders', path: '/doormile/riders' },
|
||||
{ label: 'Milers', path: '/doormile/milers' },
|
||||
{ label: 'Clients', path: '/doormile/tenants' },
|
||||
{ label: 'Pricing', path: '/doormile/pricing' },
|
||||
{ label: 'Customers', path: '/doormile/customers' },
|
||||
|
||||
@@ -77,7 +77,7 @@ export default function CreateRider() {
|
||||
applocationid: Number(form.applocationid),
|
||||
hubid: form.hubid ? Number(form.hubid) : undefined,
|
||||
},
|
||||
{ onSuccess: (res) => res?.success !== false && navigate('/doormile/riders') }
|
||||
{ onSuccess: (res) => res?.success !== false && navigate('/doormile/milers') }
|
||||
);
|
||||
};
|
||||
|
||||
@@ -85,23 +85,23 @@ export default function CreateRider() {
|
||||
<Stack space="lg">
|
||||
<PageHeader
|
||||
icon={Bike}
|
||||
title="New rider"
|
||||
title="New miler"
|
||||
subtitle="Creates a miler-app login and puts them on a zone"
|
||||
breadcrumb={
|
||||
<Breadcrumb>
|
||||
<BreadcrumbList>
|
||||
<BreadcrumbItem>
|
||||
<BreadcrumbLink href="/doormile/riders">Riders</BreadcrumbLink>
|
||||
<BreadcrumbLink href="/doormile/milers">Milers</BreadcrumbLink>
|
||||
</BreadcrumbItem>
|
||||
<BreadcrumbSeparator />
|
||||
<BreadcrumbItem>
|
||||
<BreadcrumbPage>New rider</BreadcrumbPage>
|
||||
<BreadcrumbPage>New miler</BreadcrumbPage>
|
||||
</BreadcrumbItem>
|
||||
</BreadcrumbList>
|
||||
</Breadcrumb>
|
||||
}
|
||||
actions={
|
||||
<Button variant="outline" onClick={() => navigate('/doormile/riders')}>
|
||||
<Button variant="outline" onClick={() => navigate('/doormile/milers')}>
|
||||
<ArrowLeft className="mr-1.5 h-4 w-4" /> Back
|
||||
</Button>
|
||||
}
|
||||
@@ -140,7 +140,7 @@ export default function CreateRider() {
|
||||
/>
|
||||
</Field>
|
||||
|
||||
<Field label="Password" required error={errors.password}>
|
||||
<Field label="Initial password" required error={errors.password}>
|
||||
<Input
|
||||
type="password"
|
||||
autoComplete="new-password"
|
||||
@@ -151,7 +151,7 @@ export default function CreateRider() {
|
||||
</Field>
|
||||
|
||||
<Field label="Default vehicle">
|
||||
<Select value={form.defaultvehicletype} onValueChange={set('defaultvehicletype')}>
|
||||
<Select value={form.defaultvehicletype} onValueChange={(value) => set('defaultvehicletype')(value)}>
|
||||
<SelectTrigger>
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
@@ -166,15 +166,19 @@ export default function CreateRider() {
|
||||
</Field>
|
||||
|
||||
{isStaff && (
|
||||
<Field label="Client" required error={errors.tenantid}>
|
||||
<Select value={String(form.tenantid)} onValueChange={set('tenantid')}>
|
||||
<Field label="Client" hint="Who this rider delivers for">
|
||||
<Select
|
||||
value={form.tenantid === '' ? 'all' : String(form.tenantid)}
|
||||
onValueChange={(value) => set('tenantid')(value === 'all' ? '' : value)}
|
||||
>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Choose a client" />
|
||||
<SelectValue placeholder="All clients (Doormile staff)" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="all">All clients (Doormile staff)</SelectItem>
|
||||
{(tenants || []).map((tenant) => (
|
||||
<SelectItem key={tenant.tenantid} value={String(tenant.tenantid)}>
|
||||
{tenant.tenantname || `Tenant #${tenant.tenantid}`}
|
||||
{tenant.tenantname || `Client #${tenant.tenantid}`}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
@@ -182,10 +186,13 @@ export default function CreateRider() {
|
||||
</Field>
|
||||
)}
|
||||
|
||||
<Field label="City" required error={errors.applocationid}>
|
||||
<Select value={String(form.applocationid)} onValueChange={set('applocationid')}>
|
||||
<Field label="Zone / City" required error={errors.applocationid}>
|
||||
<Select
|
||||
value={form.applocationid === '' ? undefined : String(form.applocationid)}
|
||||
onValueChange={(value) => set('applocationid')(value)}
|
||||
>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Choose a city" />
|
||||
<SelectValue placeholder="Choose a zone" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{(locations || [])
|
||||
@@ -220,11 +227,11 @@ export default function CreateRider() {
|
||||
</div>
|
||||
|
||||
<div className="mt-6 flex justify-end gap-2 border-t border-border pt-5">
|
||||
<Button type="button" variant="ghost" onClick={() => navigate('/doormile/riders')}>
|
||||
<Button type="button" variant="ghost" onClick={() => navigate('/doormile/milers')}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button type="submit" loading={createMiler.isPending}>
|
||||
Create rider
|
||||
Create miler
|
||||
</Button>
|
||||
</div>
|
||||
</Surface>
|
||||
|
||||
@@ -83,7 +83,7 @@ export default function EditRider() {
|
||||
applocationid: form.applocationid === '' ? undefined : Number(form.applocationid),
|
||||
},
|
||||
},
|
||||
{ onSuccess: (res) => res?.success !== false && navigate('/doormile/riders') }
|
||||
{ onSuccess: (res) => res?.success !== false && navigate('/doormile/milers') }
|
||||
);
|
||||
};
|
||||
|
||||
@@ -91,13 +91,13 @@ export default function EditRider() {
|
||||
<Stack space="lg">
|
||||
<PageHeader
|
||||
icon={Bike}
|
||||
title={form?.displayname || 'Edit rider'}
|
||||
title={form?.displayname || 'Edit miler'}
|
||||
subtitle="Identity, contact, client and zone"
|
||||
breadcrumb={
|
||||
<Breadcrumb>
|
||||
<BreadcrumbList>
|
||||
<BreadcrumbItem>
|
||||
<BreadcrumbLink href="/doormile/riders">Riders</BreadcrumbLink>
|
||||
<BreadcrumbLink href="/doormile/milers">Milers</BreadcrumbLink>
|
||||
</BreadcrumbItem>
|
||||
<BreadcrumbSeparator />
|
||||
<BreadcrumbItem>
|
||||
@@ -107,7 +107,7 @@ export default function EditRider() {
|
||||
</Breadcrumb>
|
||||
}
|
||||
actions={
|
||||
<Button variant="outline" onClick={() => navigate('/doormile/riders')}>
|
||||
<Button variant="outline" onClick={() => navigate('/doormile/milers')}>
|
||||
<ArrowLeft className="mr-1.5 h-4 w-4" /> Back
|
||||
</Button>
|
||||
}
|
||||
|
||||
@@ -159,11 +159,11 @@ export default function Riders() {
|
||||
cell: (row) => (
|
||||
<div className="flex justify-end gap-1">
|
||||
<IconButton
|
||||
label="Edit rider"
|
||||
label="Edit miler"
|
||||
icon={Pencil}
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => navigate('/doormile/riders/edit', { state: { rider: row } })}
|
||||
onClick={() => navigate('/doormile/milers/edit', { state: { rider: row } })}
|
||||
/>
|
||||
<IconButton
|
||||
label="Assign vehicle"
|
||||
@@ -192,7 +192,7 @@ export default function Riders() {
|
||||
size="sm"
|
||||
onClick={() => setLogsRow(row)}
|
||||
/>
|
||||
<IconButton label="Block rider" icon={Ban} variant="ghost" size="sm" onClick={() => setBlockRow(row)} />
|
||||
<IconButton label="Block miler" icon={Ban} variant="ghost" size="sm" onClick={() => setBlockRow(row)} />
|
||||
</div>
|
||||
),
|
||||
},
|
||||
@@ -204,11 +204,11 @@ export default function Riders() {
|
||||
<Stack space="lg">
|
||||
<PageHeader
|
||||
icon={Bike}
|
||||
title="Riders"
|
||||
title="Milers"
|
||||
subtitle="Who is on the road, what they are on, and where they are"
|
||||
actions={
|
||||
<Button onClick={() => navigate('/doormile/riders/create')}>
|
||||
<Plus className="mr-1.5 h-4 w-4" /> New rider
|
||||
<Button onClick={() => navigate('/doormile/milers/create')}>
|
||||
<Plus className="mr-1.5 h-4 w-4" /> New miler
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
@@ -217,7 +217,7 @@ export default function Riders() {
|
||||
<KpiCard
|
||||
icon={Users}
|
||||
value={summary?.total ?? counts.all}
|
||||
label="Total riders"
|
||||
label="Total milers"
|
||||
tone="brand"
|
||||
index={0}
|
||||
loading={isLoading}
|
||||
|
||||
Reference in New Issue
Block a user