Mix calculator
This commit is contained in:
+101
-9
@@ -1,6 +1,8 @@
|
||||
import type {
|
||||
ClientAccessAccount,
|
||||
ClientAccessPowerBiExport,
|
||||
MixCalculatorOptions,
|
||||
MixCalculatorSession,
|
||||
Mix,
|
||||
Product,
|
||||
ProductCostBreakdown,
|
||||
@@ -13,6 +15,7 @@ const MODULE_PERMISSIONS = {
|
||||
dashboard: 'edit',
|
||||
raw_materials: 'edit',
|
||||
mix_master: 'edit',
|
||||
mix_calculator: 'manage',
|
||||
products: 'edit',
|
||||
scenarios: 'edit',
|
||||
powerbi_export: 'edit',
|
||||
@@ -22,6 +25,7 @@ const MODULE_PERMISSIONS = {
|
||||
dashboard: 'edit',
|
||||
raw_materials: 'edit',
|
||||
mix_master: 'edit',
|
||||
mix_calculator: 'edit',
|
||||
products: 'edit',
|
||||
scenarios: 'edit',
|
||||
powerbi_export: 'none',
|
||||
@@ -31,6 +35,7 @@ const MODULE_PERMISSIONS = {
|
||||
dashboard: 'view',
|
||||
raw_materials: 'none',
|
||||
mix_master: 'none',
|
||||
mix_calculator: 'view',
|
||||
products: 'view',
|
||||
scenarios: 'none',
|
||||
powerbi_export: 'view',
|
||||
@@ -42,6 +47,7 @@ const MODULE_DETAILS = [
|
||||
['dashboard', 'Dashboard', 'workspace', 'Top-level operational dashboard'],
|
||||
['raw_materials', 'Raw Materials', 'costing', 'Maintain live material costs and versions'],
|
||||
['mix_master', 'Mix Master', 'costing', 'Create and maintain mix worksheets'],
|
||||
['mix_calculator', 'Mix Calculator', 'production', 'Create and review client-specific mix calculation sessions'],
|
||||
['products', 'Products', 'pricing', 'Review finished product pricing'],
|
||||
['scenarios', 'Scenarios', 'planning', 'Run scenario overrides and comparisons'],
|
||||
['powerbi_export', 'Power BI Export', 'reporting', 'Expose client access data to BI consumers'],
|
||||
@@ -122,6 +128,70 @@ export const mockProducts: Product[] = [
|
||||
}
|
||||
];
|
||||
|
||||
export const mockMixCalculatorOptions: MixCalculatorOptions = {
|
||||
clients: ['Hunter Premium Produce'],
|
||||
products: [
|
||||
{
|
||||
product_id: 1,
|
||||
client_name: 'Hunter Premium Produce',
|
||||
product_name: 'Hunter Orchard Blend 20kg',
|
||||
mix_id: 1,
|
||||
mix_name: 'Hunter Orchard Blend',
|
||||
unit_of_measure: '20kg bag',
|
||||
unit_size_kg: 20,
|
||||
mix_total_kg: 280
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
export const mockMixCalculatorSessions: MixCalculatorSession[] = [
|
||||
{
|
||||
id: 1,
|
||||
tenant_id: 'hunter-premium-produce',
|
||||
session_number: 'HPP-20260429-0001',
|
||||
client_name: 'Hunter Premium Produce',
|
||||
product_id: 1,
|
||||
product_name: 'Hunter Orchard Blend 20kg',
|
||||
mix_id: 1,
|
||||
mix_name: 'Hunter Orchard Blend',
|
||||
mix_date: '2026-04-29',
|
||||
batch_size_kg: 560,
|
||||
total_bags: 28,
|
||||
total_kg: 560,
|
||||
product_unit_of_measure: '20kg bag',
|
||||
product_unit_size_kg: 20,
|
||||
prepared_by_user_id: 1,
|
||||
prepared_by_name: 'Amelia Hart',
|
||||
created_by: 'operator@example.com',
|
||||
status: 'saved',
|
||||
notes: 'Morning production run',
|
||||
created_at: '2026-04-29T08:10:00',
|
||||
updated_at: '2026-04-29T08:12:00',
|
||||
warnings: [],
|
||||
is_owner: true,
|
||||
lines: [
|
||||
{
|
||||
id: 1,
|
||||
raw_material_id: 1,
|
||||
raw_material_name: 'Maize',
|
||||
required_kg: 360,
|
||||
mix_percentage: 64.2857,
|
||||
unit: 'tonne',
|
||||
sort_order: 1
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
raw_material_id: 2,
|
||||
raw_material_name: 'Barley',
|
||||
required_kg: 200,
|
||||
mix_percentage: 35.7143,
|
||||
unit: 'tonne',
|
||||
sort_order: 2
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
export const mockCosts: ProductCostBreakdown[] = [
|
||||
{
|
||||
product_id: 1,
|
||||
@@ -157,8 +227,8 @@ export const mockClientAccess: ClientAccessAccount[] = [
|
||||
created_at: '2026-04-20T09:00:00',
|
||||
active_user_count: 1,
|
||||
new_user_count: 1,
|
||||
enabled_feature_count: 7,
|
||||
total_feature_count: 7,
|
||||
enabled_feature_count: 8,
|
||||
total_feature_count: 8,
|
||||
users: [
|
||||
{
|
||||
id: 1,
|
||||
@@ -244,6 +314,17 @@ export const mockClientAccess: ClientAccessAccount[] = [
|
||||
{
|
||||
id: 4,
|
||||
client_account_id: 1,
|
||||
feature_key: 'mix_calculator',
|
||||
feature_name: 'Mix Calculator',
|
||||
feature_group: 'production',
|
||||
description: 'Create and review client-specific mix calculation sessions',
|
||||
enabled: true,
|
||||
updated_at: '2026-04-24T15:00:00',
|
||||
created_at: '2026-04-20T09:00:00'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
client_account_id: 1,
|
||||
feature_key: 'products',
|
||||
feature_name: 'Products',
|
||||
feature_group: 'pricing',
|
||||
@@ -253,7 +334,7 @@ export const mockClientAccess: ClientAccessAccount[] = [
|
||||
created_at: '2026-04-20T09:00:00'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
id: 6,
|
||||
client_account_id: 1,
|
||||
feature_key: 'scenarios',
|
||||
feature_name: 'Scenarios',
|
||||
@@ -264,7 +345,7 @@ export const mockClientAccess: ClientAccessAccount[] = [
|
||||
created_at: '2026-04-20T09:00:00'
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
id: 7,
|
||||
client_account_id: 1,
|
||||
feature_key: 'powerbi_export',
|
||||
feature_name: 'Power BI Export',
|
||||
@@ -275,7 +356,7 @@ export const mockClientAccess: ClientAccessAccount[] = [
|
||||
created_at: '2026-04-20T09:00:00'
|
||||
},
|
||||
{
|
||||
id: 13,
|
||||
id: 8,
|
||||
client_account_id: 1,
|
||||
feature_key: 'client_access',
|
||||
feature_name: 'Client Access',
|
||||
@@ -314,8 +395,8 @@ export const mockClientAccess: ClientAccessAccount[] = [
|
||||
created_at: '2026-04-21T10:00:00',
|
||||
active_user_count: 1,
|
||||
new_user_count: 0,
|
||||
enabled_feature_count: 3,
|
||||
total_feature_count: 7,
|
||||
enabled_feature_count: 4,
|
||||
total_feature_count: 8,
|
||||
users: [
|
||||
{
|
||||
id: 3,
|
||||
@@ -378,6 +459,17 @@ export const mockClientAccess: ClientAccessAccount[] = [
|
||||
{
|
||||
id: 10,
|
||||
client_account_id: 2,
|
||||
feature_key: 'mix_calculator',
|
||||
feature_name: 'Mix Calculator',
|
||||
feature_group: 'production',
|
||||
description: 'Create and review client-specific mix calculation sessions',
|
||||
enabled: true,
|
||||
updated_at: '2026-04-22T09:10:00',
|
||||
created_at: '2026-04-21T10:00:00'
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
client_account_id: 2,
|
||||
feature_key: 'products',
|
||||
feature_name: 'Products',
|
||||
feature_group: 'pricing',
|
||||
@@ -387,7 +479,7 @@ export const mockClientAccess: ClientAccessAccount[] = [
|
||||
created_at: '2026-04-21T10:00:00'
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
id: 12,
|
||||
client_account_id: 2,
|
||||
feature_key: 'scenarios',
|
||||
feature_name: 'Scenarios',
|
||||
@@ -398,7 +490,7 @@ export const mockClientAccess: ClientAccessAccount[] = [
|
||||
created_at: '2026-04-21T10:00:00'
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
id: 13,
|
||||
client_account_id: 2,
|
||||
feature_key: 'powerbi_export',
|
||||
feature_name: 'Power BI Export',
|
||||
|
||||
Reference in New Issue
Block a user