Compare commits
2 Commits
bbcf987488
...
d196d56929
| Author | SHA1 | Date | |
|---|---|---|---|
| d196d56929 | |||
| 58c42d9013 |
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"css.lint.unknownAtRules": "ignore"
|
||||||
|
}
|
||||||
3
go.work
3
go.work
@@ -1,3 +1,4 @@
|
|||||||
go 1.21
|
go 1.24
|
||||||
|
|
||||||
use ..\fiesta-backend\backend_fiesta
|
use ..\fiesta-backend\backend_fiesta
|
||||||
|
|
||||||
|
|||||||
@@ -270,8 +270,8 @@ export default function App() {
|
|||||||
|
|
||||||
// Define secondary sections (Stores, Logistics, Staffing, Settings) within main body
|
// Define secondary sections (Stores, Logistics, Staffing, Settings) within main body
|
||||||
const renderStoresSection = () => {
|
const renderStoresSection = () => {
|
||||||
const isSoleStore = !selectedStore && storesList.length === 1;
|
const isSoleStore = storesList.length === 1;
|
||||||
const activeStore = selectedStore ?? (isSoleStore ? storesList[0] : null);
|
const activeStore = selectedStore;
|
||||||
|
|
||||||
if (activeStore) {
|
if (activeStore) {
|
||||||
return (
|
return (
|
||||||
@@ -290,7 +290,7 @@ export default function App() {
|
|||||||
)}
|
)}
|
||||||
<StoreDetailView
|
<StoreDetailView
|
||||||
store={activeStore}
|
store={activeStore}
|
||||||
onBack={selectedStore ? () => setSelectedStore(null) : undefined}
|
onBack={() => setSelectedStore(null)}
|
||||||
tenantId={tenantId}
|
tenantId={tenantId}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ export default function AdminConsole({ activeTab: propActiveTab, showHeader = tr
|
|||||||
lastname: '',
|
lastname: '',
|
||||||
email: '',
|
email: '',
|
||||||
contactno: '',
|
contactno: '',
|
||||||
password: 'Rider@123',
|
password: '',
|
||||||
locationid: 0,
|
locationid: 0,
|
||||||
shiftid: 0,
|
shiftid: 0,
|
||||||
vehiclename: '',
|
vehiclename: '',
|
||||||
@@ -192,15 +192,16 @@ export default function AdminConsole({ activeTab: propActiveTab, showHeader = tr
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// Create base user with roleid = 3 and configid = 6 (Rider config)
|
// Create base user with roleid = 5 (Rider) and configid = 1, matching the
|
||||||
|
// convention login (auth.ts) queries against.
|
||||||
const res = await createUserMut.mutateAsync({
|
const res = await createUserMut.mutateAsync({
|
||||||
firstname: riderForm.firstname,
|
firstname: riderForm.firstname,
|
||||||
lastname: riderForm.lastname,
|
lastname: riderForm.lastname,
|
||||||
email: riderForm.email,
|
email: riderForm.email,
|
||||||
contactno: riderForm.contactno,
|
contactno: riderForm.contactno,
|
||||||
password: riderForm.password,
|
password: riderForm.password,
|
||||||
roleid: 3,
|
roleid: 5,
|
||||||
configid: 6,
|
configid: 1,
|
||||||
tenantid: FIESTA_TENANT_ID,
|
tenantid: FIESTA_TENANT_ID,
|
||||||
locationid: Number(riderForm.locationid),
|
locationid: Number(riderForm.locationid),
|
||||||
applocationid: 1,
|
applocationid: 1,
|
||||||
@@ -781,7 +782,7 @@ VALUES (${newUserId}, 1, 'Active', NOW());
|
|||||||
lastname: '',
|
lastname: '',
|
||||||
email: '',
|
email: '',
|
||||||
contactno: '',
|
contactno: '',
|
||||||
password: 'Rider@123',
|
password: '',
|
||||||
locationid: 0,
|
locationid: 0,
|
||||||
shiftid: 0,
|
shiftid: 0,
|
||||||
vehiclename: '',
|
vehiclename: '',
|
||||||
@@ -1456,7 +1457,7 @@ VALUES (${newUserId}, 1, 'Active', NOW());
|
|||||||
lastname: '',
|
lastname: '',
|
||||||
email: '',
|
email: '',
|
||||||
contactno: '',
|
contactno: '',
|
||||||
password: 'Rider@123',
|
password: '',
|
||||||
locationid: 0,
|
locationid: 0,
|
||||||
shiftid: 0,
|
shiftid: 0,
|
||||||
vehiclename: '',
|
vehiclename: '',
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ export default function Header({
|
|||||||
|
|
||||||
{/* Dynamic Store Name Context */}
|
{/* Dynamic Store Name Context */}
|
||||||
{storeContext && (
|
{storeContext && (
|
||||||
<div className="flex flex-col ml-0.5 sm:ml-1 border-l border-white/20 pl-2 sm:pl-3 py-0.5 select-none min-w-0">
|
<div className="flex flex-col ml-0.5 sm:ml-1 pl-2 sm:pl-3 py-0.5 select-none min-w-0">
|
||||||
<span className="flex items-center gap-1.5 sm:gap-2 text-xs sm:text-base md:text-lg font-bold tracking-tight text-white leading-tight truncate max-w-[110px] xs:max-w-[150px] sm:max-w-none">
|
<span className="flex items-center gap-1.5 sm:gap-2 text-xs sm:text-base md:text-lg font-bold tracking-tight text-white leading-tight truncate max-w-[110px] xs:max-w-[150px] sm:max-w-none">
|
||||||
{storeContext.icon && <storeContext.icon size={16} className="text-purple-300 shrink-0 hidden xs:inline" />}
|
{storeContext.icon && <storeContext.icon size={16} className="text-purple-300 shrink-0 hidden xs:inline" />}
|
||||||
<span className="truncate">{storeContext.storeName}</span>
|
<span className="truncate">{storeContext.storeName}</span>
|
||||||
|
|||||||
@@ -105,8 +105,12 @@ export default function UsersPanel({ tenantId = FIESTA_TENANT_ID, defaultNewUser
|
|||||||
// Selectable roles for the Add User modal - limited to Staff and Rider.
|
// Selectable roles for the Add User modal - limited to Staff and Rider.
|
||||||
const roleChoices = React.useMemo(() => {
|
const roleChoices = React.useMemo(() => {
|
||||||
return [
|
return [
|
||||||
{ id: 4, label: 'Staff', desc: 'Standard store staff duties', icon: User, configid: 15 },
|
// configid must be 1 here — it's the same app_users.configid column the
|
||||||
{ id: 5, label: 'Rider', desc: 'Delivery fleet rider', icon: Bike, configid: 6 },
|
// login endpoints filter on (auth.ts hardcodes configid: 1 for every
|
||||||
|
// login attempt), not the unrelated Hasura "role config" id. Any other
|
||||||
|
// value means the account can never be found on login.
|
||||||
|
{ id: 4, label: 'Staff', desc: 'Standard store staff duties', icon: User, configid: 1 },
|
||||||
|
{ id: 5, label: 'Rider', desc: 'Delivery fleet rider', icon: Bike, configid: 1 },
|
||||||
];
|
];
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -247,7 +251,7 @@ export default function UsersPanel({ tenantId = FIESTA_TENANT_ID, defaultNewUser
|
|||||||
email: newUser.email,
|
email: newUser.email,
|
||||||
contactno: newUser.contactno,
|
contactno: newUser.contactno,
|
||||||
roleid: Number(newUser.roleid),
|
roleid: Number(newUser.roleid),
|
||||||
configid: selectedRole?.configid ?? 15,
|
configid: selectedRole?.configid ?? 1,
|
||||||
// Store binding — sent exactly as the backend expects so the user is tied
|
// Store binding — sent exactly as the backend expects so the user is tied
|
||||||
// to the chosen branch (tenantid + locationid + applocationid).
|
// to the chosen branch (tenantid + locationid + applocationid).
|
||||||
tenantid: tenantId,
|
tenantid: tenantId,
|
||||||
|
|||||||
@@ -943,7 +943,11 @@ export interface CreateUserInput {
|
|||||||
/** Optional — merchant_web's create form doesn't collect one. */
|
/** Optional — merchant_web's create form doesn't collect one. */
|
||||||
password?: string;
|
password?: string;
|
||||||
roleid: number;
|
roleid: number;
|
||||||
/** Role config (the selected role's configid) — matches merchant_web's create payload. */
|
/**
|
||||||
|
* app_users.configid — the same column every login call filters on
|
||||||
|
* (auth.ts hardcodes configid: 1). Must stay 1 or the account can never
|
||||||
|
* be found on login; this is NOT the unrelated Hasura "role config" id.
|
||||||
|
*/
|
||||||
configid?: number;
|
configid?: number;
|
||||||
/** Business module id (merchant_web sends the logged-in user's; 0 when absent). */
|
/** Business module id (merchant_web sends the logged-in user's; 0 when absent). */
|
||||||
moduleid?: number;
|
moduleid?: number;
|
||||||
@@ -975,7 +979,7 @@ export async function createUser(input: CreateUserInput): Promise<Row> {
|
|||||||
dialcode: input.dialcode ?? '+91',
|
dialcode: input.dialcode ?? '+91',
|
||||||
contactno: input.contactno,
|
contactno: input.contactno,
|
||||||
roleid: input.roleid,
|
roleid: input.roleid,
|
||||||
configid: input.configid ?? 15,
|
configid: input.configid ?? 1,
|
||||||
moduleid: input.moduleid ?? 0,
|
moduleid: input.moduleid ?? 0,
|
||||||
pin: input.pin ?? 0,
|
pin: input.pin ?? 0,
|
||||||
address: input.address ?? '',
|
address: input.address ?? '',
|
||||||
@@ -1138,7 +1142,7 @@ export async function getRiderPeriodicLogs(opts: {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** /riders/getriderlogs?userid=&riderid=&fromdate=&todate=&tenantid=&applocationid= —
|
/** /partners/getriderlogs?userid=&riderid=&fromdate=&todate=&tenantid=&applocationid= —
|
||||||
* full telemetry logs (GPS traces, events, etc.) for a rider. */
|
* full telemetry logs (GPS traces, events, etc.) for a rider. */
|
||||||
export async function getRiderLogs(opts: {
|
export async function getRiderLogs(opts: {
|
||||||
userid?: number;
|
userid?: number;
|
||||||
@@ -1151,7 +1155,7 @@ export async function getRiderLogs(opts: {
|
|||||||
pagesize?: number;
|
pagesize?: number;
|
||||||
}): Promise<Row[]> {
|
}): Promise<Row[]> {
|
||||||
return toRows(
|
return toRows(
|
||||||
await fiestaGet('riders/getriderlogs', {
|
await fiestaGet('partners/getriderlogs', {
|
||||||
userid: opts.userid,
|
userid: opts.userid,
|
||||||
riderid: opts.riderid,
|
riderid: opts.riderid,
|
||||||
fromdate: opts.fromdate,
|
fromdate: opts.fromdate,
|
||||||
|
|||||||
Reference in New Issue
Block a user