Show the store's scannable QR code right after onboarding

The consumer app resolves a storefront by scanning a QR that encodes
{tenantid, locationid}. Store Onboarding was creating the location but never
surfacing its QR, so operators had to hunt for it later in the store detail
view. Now that the backend returns the created location's locationid in the
onboarding response, render the existing StoreQRView component directly in
the "Store Branch Active!" success panel (both onboarding UI variants) so the
printable QR is available the moment the branch is created.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-23 11:09:09 +05:30
parent d196d56929
commit c6649c9c8f
2 changed files with 25 additions and 1 deletions

View File

@@ -31,6 +31,7 @@ import {
useFiestaAllTenants useFiestaAllTenants
} from '../services/fiestaQueries'; } from '../services/fiestaQueries';
import { FIESTA_TENANT_ID, str as fstr, num as fnum } from '../services/fiestaApi'; import { FIESTA_TENANT_ID, str as fstr, num as fnum } from '../services/fiestaApi';
import StoreQRView from './StoreQRView';
export default function AdminConsole({ activeTab: propActiveTab, showHeader = true, onBack, tenantId }: { activeTab?: 'tenant' | 'store' | 'rider', showHeader?: boolean, onBack?: () => void, tenantId?: number }) { export default function AdminConsole({ activeTab: propActiveTab, showHeader = true, onBack, tenantId }: { activeTab?: 'tenant' | 'store' | 'rider', showHeader?: boolean, onBack?: () => void, tenantId?: number }) {
const [activeTab, setActiveTab] = useState<'tenant' | 'store' | 'rider'>(propActiveTab || 'tenant'); const [activeTab, setActiveTab] = useState<'tenant' | 'store' | 'rider'>(propActiveTab || 'tenant');
@@ -448,6 +449,15 @@ VALUES (${newUserId}, 1, 'Active', NOW());
<p className="text-xs text-emerald-700 max-w-md mx-auto"> <p className="text-xs text-emerald-700 max-w-md mx-auto">
Store <strong>{storeForm.locationname}</strong> has been initialized. A default placeholder manager user has been spawned in inactive mode (requires password setup). Store <strong>{storeForm.locationname}</strong> has been initialized. A default placeholder manager user has been spawned in inactive mode (requires password setup).
</p> </p>
<div className="max-w-xs mx-auto">
<StoreQRView
tenantId={storeForm.tenantid}
locationid={storeSuccess?.details?.locationid}
storeName={storeForm.locationname}
storeZone={storeForm.city}
storeAddress={storeForm.address}
/>
</div>
<div className="flex justify-center gap-3"> <div className="flex justify-center gap-3">
{onBack && ( {onBack && (
<button <button
@@ -1188,6 +1198,15 @@ VALUES (${newUserId}, 1, 'Active', NOW());
<p className="text-xs text-emerald-700 max-w-md mx-auto"> <p className="text-xs text-emerald-700 max-w-md mx-auto">
Store <strong>{storeForm.locationname}</strong> has been initialized. A default placeholder manager user has been spawned in inactive mode (requires password setup). Store <strong>{storeForm.locationname}</strong> has been initialized. A default placeholder manager user has been spawned in inactive mode (requires password setup).
</p> </p>
<div className="max-w-xs mx-auto">
<StoreQRView
tenantId={storeForm.tenantid}
locationid={storeSuccess?.details?.locationid}
storeName={storeForm.locationname}
storeZone={storeForm.city}
storeAddress={storeForm.address}
/>
</div>
<div className="flex justify-center gap-3"> <div className="flex justify-center gap-3">
{onBack && ( {onBack && (
<button <button

View File

@@ -1095,7 +1095,12 @@ export interface CreateTenantLocationInput {
roleid?: number; roleid?: number;
} }
/** POST /tenants/createtenantlocation — Create a new store location under a tenant. */ /**
* POST /tenants/createtenantlocation — Create a new store location under a tenant.
* The envelope's `details` is the created location row (including the
* DB-assigned `locationid`), needed right after onboarding to build the
* store's QR code via `buildStoreQrPayload`.
*/
export async function createTenantLocation(input: CreateTenantLocationInput): Promise<Row> { export async function createTenantLocation(input: CreateTenantLocationInput): Promise<Row> {
return fiestaSend<Row>('tenants/createtenantlocation', 'POST', input); return fiestaSend<Row>('tenants/createtenantlocation', 'POST', input);
} }