v1.3 - client and admin scaffolding
This commit is contained in:
+262
-7
@@ -1,4 +1,12 @@
|
||||
import type { Mix, Product, ProductCostBreakdown, RawMaterial, Scenario } from '$lib/types';
|
||||
import type {
|
||||
ClientAccessAccount,
|
||||
ClientAccessPowerBiExport,
|
||||
Mix,
|
||||
Product,
|
||||
ProductCostBreakdown,
|
||||
RawMaterial,
|
||||
Scenario
|
||||
} from '$lib/types';
|
||||
|
||||
export const mockRawMaterials: RawMaterial[] = [
|
||||
{
|
||||
@@ -32,8 +40,8 @@ export const mockRawMaterials: RawMaterial[] = [
|
||||
export const mockMixes: Mix[] = [
|
||||
{
|
||||
id: 1,
|
||||
client_name: 'Specialty Feeds',
|
||||
name: 'Pigeon Mix',
|
||||
client_name: 'Hunter Premium Produce',
|
||||
name: 'Hunter Orchard Blend',
|
||||
status: 'active',
|
||||
ingredients: [
|
||||
{
|
||||
@@ -63,10 +71,10 @@ export const mockMixes: Mix[] = [
|
||||
export const mockProducts: Product[] = [
|
||||
{
|
||||
id: 1,
|
||||
name: 'Specialty Pigeon Breeder 20kg',
|
||||
client_name: 'Specialty Feeds',
|
||||
name: 'Hunter Orchard Blend 20kg',
|
||||
client_name: 'Hunter Premium Produce',
|
||||
mix_id: 1,
|
||||
mix_name: 'Pigeon Mix',
|
||||
mix_name: 'Hunter Orchard Blend',
|
||||
sale_type: 'standard',
|
||||
unit_of_measure: '20kg bag',
|
||||
distributor_margin: 0.225,
|
||||
@@ -77,7 +85,7 @@ export const mockProducts: Product[] = [
|
||||
export const mockCosts: ProductCostBreakdown[] = [
|
||||
{
|
||||
product_id: 1,
|
||||
product_name: 'Specialty Pigeon Breeder 20kg',
|
||||
product_name: 'Hunter Orchard Blend 20kg',
|
||||
finished_product_delivered: 14.208,
|
||||
distributor_price: 18.3329,
|
||||
wholesale_price: 17.3268,
|
||||
@@ -94,3 +102,250 @@ export const mockScenarios: Scenario[] = [
|
||||
overrides: {}
|
||||
}
|
||||
];
|
||||
|
||||
export const mockClientAccess: ClientAccessAccount[] = [
|
||||
{
|
||||
id: 1,
|
||||
tenant_id: 'hunter-premium-produce',
|
||||
name: 'Hunter Premium Produce',
|
||||
client_code: 'HPP',
|
||||
status: 'active',
|
||||
powerbi_workspace: 'hunter-premium-produce-prod',
|
||||
notes: 'Primary production client for the Lean 101 admin and access workflows',
|
||||
created_at: '2026-04-20T09:00:00',
|
||||
active_user_count: 1,
|
||||
new_user_count: 1,
|
||||
enabled_feature_count: 6,
|
||||
total_feature_count: 6,
|
||||
users: [
|
||||
{
|
||||
id: 1,
|
||||
client_account_id: 1,
|
||||
full_name: 'Amelia Hart',
|
||||
email: 'operator@example.com',
|
||||
role: 'admin',
|
||||
status: 'active',
|
||||
is_new_user: false,
|
||||
last_login_at: '2026-04-24T11:30:00',
|
||||
created_at: '2026-04-20T09:00:00'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
client_account_id: 1,
|
||||
full_name: 'Ethan Cole',
|
||||
email: 'ethan.cole@hunterpremiumproduce.example',
|
||||
role: 'operator',
|
||||
status: 'invited',
|
||||
is_new_user: true,
|
||||
last_login_at: null,
|
||||
created_at: '2026-04-24T15:00:00'
|
||||
}
|
||||
],
|
||||
features: [
|
||||
{
|
||||
id: 1,
|
||||
client_account_id: 1,
|
||||
feature_key: 'dashboard',
|
||||
feature_name: 'Dashboard',
|
||||
feature_group: 'workspace',
|
||||
description: 'Top-level operational dashboard',
|
||||
enabled: true,
|
||||
updated_at: '2026-04-24T15:00:00',
|
||||
created_at: '2026-04-20T09:00:00'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
client_account_id: 1,
|
||||
feature_key: 'raw_materials',
|
||||
feature_name: 'Raw Materials',
|
||||
feature_group: 'costing',
|
||||
description: 'Maintain live material costs and versions',
|
||||
enabled: true,
|
||||
updated_at: '2026-04-24T15:00:00',
|
||||
created_at: '2026-04-20T09:00:00'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
client_account_id: 1,
|
||||
feature_key: 'mix_master',
|
||||
feature_name: 'Mix Master',
|
||||
feature_group: 'costing',
|
||||
description: 'Create and maintain mix worksheets',
|
||||
enabled: true,
|
||||
updated_at: '2026-04-24T15:00:00',
|
||||
created_at: '2026-04-20T09:00:00'
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
client_account_id: 1,
|
||||
feature_key: 'products',
|
||||
feature_name: 'Products',
|
||||
feature_group: 'pricing',
|
||||
description: 'Review finished product pricing',
|
||||
enabled: true,
|
||||
updated_at: '2026-04-24T15:00:00',
|
||||
created_at: '2026-04-20T09:00:00'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
client_account_id: 1,
|
||||
feature_key: 'scenarios',
|
||||
feature_name: 'Scenarios',
|
||||
feature_group: 'planning',
|
||||
description: 'Run scenario overrides and comparisons',
|
||||
enabled: true,
|
||||
updated_at: '2026-04-24T15:00:00',
|
||||
created_at: '2026-04-20T09:00:00'
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
client_account_id: 1,
|
||||
feature_key: 'powerbi_export',
|
||||
feature_name: 'Power BI Export',
|
||||
feature_group: 'reporting',
|
||||
description: 'Expose client access data to BI consumers',
|
||||
enabled: true,
|
||||
updated_at: '2026-04-24T15:00:00',
|
||||
created_at: '2026-04-20T09:00:00'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
tenant_id: 'loft-grains',
|
||||
name: 'Loft Grains',
|
||||
client_code: 'LOFT',
|
||||
status: 'onboarding',
|
||||
powerbi_workspace: 'farm-ops-sandbox',
|
||||
notes: 'Onboarding workspace used to test staged user enablement',
|
||||
created_at: '2026-04-21T10:00:00',
|
||||
active_user_count: 1,
|
||||
new_user_count: 0,
|
||||
enabled_feature_count: 3,
|
||||
total_feature_count: 6,
|
||||
users: [
|
||||
{
|
||||
id: 3,
|
||||
client_account_id: 2,
|
||||
full_name: 'Ruby Singh',
|
||||
email: 'ruby.singh@loftgrains.example',
|
||||
role: 'viewer',
|
||||
status: 'active',
|
||||
is_new_user: false,
|
||||
last_login_at: '2026-04-22T09:10:00',
|
||||
created_at: '2026-04-21T10:00:00'
|
||||
}
|
||||
],
|
||||
features: [
|
||||
{
|
||||
id: 7,
|
||||
client_account_id: 2,
|
||||
feature_key: 'dashboard',
|
||||
feature_name: 'Dashboard',
|
||||
feature_group: 'workspace',
|
||||
description: 'Top-level operational dashboard',
|
||||
enabled: true,
|
||||
updated_at: '2026-04-22T09:10:00',
|
||||
created_at: '2026-04-21T10:00:00'
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
client_account_id: 2,
|
||||
feature_key: 'raw_materials',
|
||||
feature_name: 'Raw Materials',
|
||||
feature_group: 'costing',
|
||||
description: 'Maintain live material costs and versions',
|
||||
enabled: false,
|
||||
updated_at: '2026-04-22T09:10:00',
|
||||
created_at: '2026-04-21T10:00:00'
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
client_account_id: 2,
|
||||
feature_key: 'mix_master',
|
||||
feature_name: 'Mix Master',
|
||||
feature_group: 'costing',
|
||||
description: 'Create and maintain mix worksheets',
|
||||
enabled: false,
|
||||
updated_at: '2026-04-22T09:10:00',
|
||||
created_at: '2026-04-21T10:00:00'
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
client_account_id: 2,
|
||||
feature_key: 'products',
|
||||
feature_name: 'Products',
|
||||
feature_group: 'pricing',
|
||||
description: 'Review finished product pricing',
|
||||
enabled: true,
|
||||
updated_at: '2026-04-22T09:10:00',
|
||||
created_at: '2026-04-21T10:00:00'
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
client_account_id: 2,
|
||||
feature_key: 'scenarios',
|
||||
feature_name: 'Scenarios',
|
||||
feature_group: 'planning',
|
||||
description: 'Run scenario overrides and comparisons',
|
||||
enabled: false,
|
||||
updated_at: '2026-04-22T09:10:00',
|
||||
created_at: '2026-04-21T10:00:00'
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
client_account_id: 2,
|
||||
feature_key: 'powerbi_export',
|
||||
feature_name: 'Power BI Export',
|
||||
feature_group: 'reporting',
|
||||
description: 'Expose client access data to BI consumers',
|
||||
enabled: true,
|
||||
updated_at: '2026-04-22T09:10:00',
|
||||
created_at: '2026-04-21T10:00:00'
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
export const mockClientAccessExport: ClientAccessPowerBiExport = {
|
||||
generated_at: '2026-04-25T09:00:00',
|
||||
client_rows: mockClientAccess.map((client) => ({
|
||||
client_id: client.id,
|
||||
tenant_id: client.tenant_id,
|
||||
client_name: client.name,
|
||||
client_code: client.client_code,
|
||||
client_status: client.status,
|
||||
powerbi_workspace: client.powerbi_workspace,
|
||||
active_user_count: client.active_user_count,
|
||||
new_user_count: client.new_user_count,
|
||||
enabled_feature_count: client.enabled_feature_count,
|
||||
total_feature_count: client.total_feature_count
|
||||
})),
|
||||
user_rows: mockClientAccess.flatMap((client) =>
|
||||
client.users.map((user) => ({
|
||||
client_id: client.id,
|
||||
client_name: client.name,
|
||||
user_id: user.id,
|
||||
full_name: user.full_name,
|
||||
email: user.email,
|
||||
role: user.role,
|
||||
status: user.status,
|
||||
is_new_user: user.is_new_user,
|
||||
last_login_at: user.last_login_at,
|
||||
created_at: user.created_at
|
||||
}))
|
||||
),
|
||||
feature_rows: mockClientAccess.flatMap((client) =>
|
||||
client.features.map((feature) => ({
|
||||
client_id: client.id,
|
||||
client_name: client.name,
|
||||
feature_id: feature.id,
|
||||
feature_key: feature.feature_key,
|
||||
feature_name: feature.feature_name,
|
||||
feature_group: feature.feature_group,
|
||||
enabled: feature.enabled,
|
||||
updated_at: feature.updated_at
|
||||
}))
|
||||
),
|
||||
clients: mockClientAccess
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user