@flowselections/floriday-voorraad 1.0.15 → 1.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist-lib/components/voorraad/AdditionalPackagingDialog.d.ts +9 -0
  2. package/dist-lib/components/voorraad/AdditionalPackagingDialog.d.ts.map +1 -0
  3. package/dist-lib/components/voorraad/AdditionalPackagingDialog.js +51 -0
  4. package/dist-lib/components/voorraad/ArtikelWizard.d.ts.map +1 -1
  5. package/dist-lib/components/voorraad/ArtikelWizard.js +411 -28
  6. package/dist-lib/components/voorraad/EditArtikelPage.d.ts.map +1 -1
  7. package/dist-lib/components/voorraad/EditArtikelPage.js +78 -4
  8. package/dist-lib/components/voorraad/ExcelExportButton.d.ts +2 -1
  9. package/dist-lib/components/voorraad/ExcelExportButton.d.ts.map +1 -1
  10. package/dist-lib/components/voorraad/ExcelExportButton.js +24 -5
  11. package/dist-lib/components/voorraad/OrderHistoryCard.d.ts +8 -0
  12. package/dist-lib/components/voorraad/OrderHistoryCard.d.ts.map +1 -0
  13. package/dist-lib/components/voorraad/OrderHistoryCard.js +133 -0
  14. package/dist-lib/components/voorraad/PriceStatusBadge.d.ts +7 -0
  15. package/dist-lib/components/voorraad/PriceStatusBadge.d.ts.map +1 -0
  16. package/dist-lib/components/voorraad/PriceStatusBadge.js +67 -0
  17. package/dist-lib/components/voorraad/ProductLinkCard.d.ts +13 -0
  18. package/dist-lib/components/voorraad/ProductLinkCard.d.ts.map +1 -0
  19. package/dist-lib/components/voorraad/ProductLinkCard.js +159 -0
  20. package/dist-lib/components/voorraad/StockBulkButtons.d.ts.map +1 -1
  21. package/dist-lib/components/voorraad/StockBulkButtons.js +88 -7
  22. package/dist-lib/components/voorraad/VoorraadStockCard.d.ts +2 -1
  23. package/dist-lib/components/voorraad/VoorraadStockCard.d.ts.map +1 -1
  24. package/dist-lib/components/voorraad/VoorraadStockCard.js +5 -4
  25. package/dist-lib/components/voorraad/VoorraadTable.d.ts.map +1 -1
  26. package/dist-lib/components/voorraad/VoorraadTable.js +6 -1
  27. package/dist-lib/hooks/useLocalTradeItems.d.ts.map +1 -1
  28. package/dist-lib/hooks/useLocalTradeItems.js +4 -0
  29. package/dist-lib/hooks/useTradeItemSpec.d.ts.map +1 -1
  30. package/dist-lib/hooks/useTradeItemSpec.js +4 -1
  31. package/dist-lib/hooks/useTradeItemStock.d.ts +14 -1
  32. package/dist-lib/hooks/useTradeItemStock.d.ts.map +1 -1
  33. package/dist-lib/hooks/useTradeItemStock.js +76 -17
  34. package/dist-lib/hooks/useTradeItemSupplyLine.d.ts +21 -0
  35. package/dist-lib/hooks/useTradeItemSupplyLine.d.ts.map +1 -0
  36. package/dist-lib/hooks/useTradeItemSupplyLine.js +49 -0
  37. package/dist-lib/hooks/useVoorraadData.d.ts +5 -4
  38. package/dist-lib/hooks/useVoorraadData.d.ts.map +1 -1
  39. package/dist-lib/hooks/useVoorraadData.js +73 -7
  40. package/dist-lib/index.d.ts +1 -0
  41. package/dist-lib/index.d.ts.map +1 -1
  42. package/dist-lib/index.js +1 -0
  43. package/dist-lib/integrations/supabase/auth-middleware.d.ts +1307 -94
  44. package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
  45. package/dist-lib/integrations/supabase/client.d.ts +1307 -94
  46. package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
  47. package/dist-lib/integrations/supabase/client.server.d.ts +1307 -94
  48. package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
  49. package/dist-lib/integrations/supabase/types.d.ts +1328 -87
  50. package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
  51. package/dist-lib/lib/ensure-article-codes.d.ts +8 -0
  52. package/dist-lib/lib/ensure-article-codes.d.ts.map +1 -0
  53. package/dist-lib/lib/ensure-article-codes.js +78 -0
  54. package/dist-lib/lib/floricode-required-features.functions.d.ts +1313 -94
  55. package/dist-lib/lib/floricode-required-features.functions.d.ts.map +1 -1
  56. package/dist-lib/lib/floricode-required-features.functions.js +20 -2
  57. package/dist-lib/lib/floriday-client.d.ts +6 -0
  58. package/dist-lib/lib/floriday-client.d.ts.map +1 -1
  59. package/dist-lib/lib/floriday-customer-offer.functions.d.ts +11264 -0
  60. package/dist-lib/lib/floriday-customer-offer.functions.d.ts.map +1 -0
  61. package/dist-lib/lib/floriday-customer-offer.functions.js +175 -0
  62. package/dist-lib/lib/floriday-gateway.functions.d.ts +16129 -17
  63. package/dist-lib/lib/floriday-gateway.functions.d.ts.map +1 -1
  64. package/dist-lib/lib/floriday-gateway.functions.js +150 -0
  65. package/dist-lib/lib/floriday-gateway.server.d.ts +22 -0
  66. package/dist-lib/lib/floriday-gateway.server.d.ts.map +1 -1
  67. package/dist-lib/lib/floriday-gateway.server.js +3 -0
  68. package/dist-lib/lib/floriday-payload.d.ts +76 -8
  69. package/dist-lib/lib/floriday-payload.d.ts.map +1 -1
  70. package/dist-lib/lib/floriday-payload.js +209 -39
  71. package/dist-lib/lib/floriday-supply-line.d.ts +53 -0
  72. package/dist-lib/lib/floriday-supply-line.d.ts.map +1 -0
  73. package/dist-lib/lib/floriday-supply-line.js +109 -0
  74. package/dist-lib/lib/floriday-warehouse.functions.d.ts +33638 -0
  75. package/dist-lib/lib/floriday-warehouse.functions.d.ts.map +1 -0
  76. package/dist-lib/lib/floriday-warehouse.functions.js +98 -0
  77. package/dist-lib/lib/floriday-writes.functions.d.ts +2707 -281
  78. package/dist-lib/lib/floriday-writes.functions.d.ts.map +1 -1
  79. package/dist-lib/lib/floriday-writes.functions.js +39 -6
  80. package/dist-lib/lib/vrs-catalog.d.ts +27 -0
  81. package/dist-lib/lib/vrs-catalog.d.ts.map +1 -0
  82. package/dist-lib/lib/vrs-catalog.js +98 -0
  83. package/package.json +3 -2
  84. package/public/flowselections-assets/Voorraad/floriday-logo.png +0 -0
@@ -9,7 +9,10 @@ export type Database = {
9
9
  Tables: {
10
10
  afhandeling_settings: {
11
11
  Row: {
12
+ auto_print_delivery_note: boolean;
13
+ auto_process_paused: boolean;
12
14
  created_at: string;
15
+ extra_pick_days_with_stickers: number;
13
16
  id: string;
14
17
  max_workdays_earlier_pick: number;
15
18
  pick_days_before_transport: number;
@@ -23,7 +26,10 @@ export type Database = {
23
26
  user_id: string;
24
27
  };
25
28
  Insert: {
29
+ auto_print_delivery_note?: boolean;
30
+ auto_process_paused?: boolean;
26
31
  created_at?: string;
32
+ extra_pick_days_with_stickers?: number;
27
33
  id?: string;
28
34
  max_workdays_earlier_pick?: number;
29
35
  pick_days_before_transport?: number;
@@ -37,7 +43,10 @@ export type Database = {
37
43
  user_id: string;
38
44
  };
39
45
  Update: {
46
+ auto_print_delivery_note?: boolean;
47
+ auto_process_paused?: boolean;
40
48
  created_at?: string;
49
+ extra_pick_days_with_stickers?: number;
41
50
  id?: string;
42
51
  max_workdays_earlier_pick?: number;
43
52
  pick_days_before_transport?: number;
@@ -840,6 +849,38 @@ export type Database = {
840
849
  };
841
850
  Relationships: [];
842
851
  };
852
+ cart_replan_queue: {
853
+ Row: {
854
+ attempts: number;
855
+ last_error: string | null;
856
+ order_id: string;
857
+ processed_at: string | null;
858
+ requested_at: string;
859
+ };
860
+ Insert: {
861
+ attempts?: number;
862
+ last_error?: string | null;
863
+ order_id: string;
864
+ processed_at?: string | null;
865
+ requested_at?: string;
866
+ };
867
+ Update: {
868
+ attempts?: number;
869
+ last_error?: string | null;
870
+ order_id?: string;
871
+ processed_at?: string | null;
872
+ requested_at?: string;
873
+ };
874
+ Relationships: [
875
+ {
876
+ foreignKeyName: "cart_replan_queue_order_id_fkey";
877
+ columns: ["order_id"];
878
+ isOneToOne: true;
879
+ referencedRelation: "orders";
880
+ referencedColumns: ["id"];
881
+ }
882
+ ];
883
+ };
843
884
  collections: {
844
885
  Row: {
845
886
  created_at: string;
@@ -3021,34 +3062,52 @@ export type Database = {
3021
3062
  Row: {
3022
3063
  catalog_key: string | null;
3023
3064
  catalog_url: string;
3065
+ client_id: string | null;
3066
+ client_secret_ciphertext: string | null;
3067
+ client_secret_last4: string | null;
3024
3068
  created_at: string;
3025
3069
  id: number;
3026
3070
  last_meta: Json | null;
3027
3071
  last_test_at: string | null;
3028
3072
  last_test_error: string | null;
3029
3073
  last_test_ok: boolean | null;
3074
+ last_token_test_at: string | null;
3075
+ last_token_test_error: string | null;
3076
+ last_token_test_ok: boolean | null;
3030
3077
  updated_at: string;
3031
3078
  };
3032
3079
  Insert: {
3033
3080
  catalog_key?: string | null;
3034
3081
  catalog_url?: string;
3082
+ client_id?: string | null;
3083
+ client_secret_ciphertext?: string | null;
3084
+ client_secret_last4?: string | null;
3035
3085
  created_at?: string;
3036
3086
  id?: number;
3037
3087
  last_meta?: Json | null;
3038
3088
  last_test_at?: string | null;
3039
3089
  last_test_error?: string | null;
3040
3090
  last_test_ok?: boolean | null;
3091
+ last_token_test_at?: string | null;
3092
+ last_token_test_error?: string | null;
3093
+ last_token_test_ok?: boolean | null;
3041
3094
  updated_at?: string;
3042
3095
  };
3043
3096
  Update: {
3044
3097
  catalog_key?: string | null;
3045
3098
  catalog_url?: string;
3099
+ client_id?: string | null;
3100
+ client_secret_ciphertext?: string | null;
3101
+ client_secret_last4?: string | null;
3046
3102
  created_at?: string;
3047
3103
  id?: number;
3048
3104
  last_meta?: Json | null;
3049
3105
  last_test_at?: string | null;
3050
3106
  last_test_error?: string | null;
3051
3107
  last_test_ok?: boolean | null;
3108
+ last_token_test_at?: string | null;
3109
+ last_token_test_error?: string | null;
3110
+ last_token_test_ok?: boolean | null;
3052
3111
  updated_at?: string;
3053
3112
  };
3054
3113
  Relationships: [];
@@ -3289,6 +3348,56 @@ export type Database = {
3289
3348
  }
3290
3349
  ];
3291
3350
  };
3351
+ floriday_auto_fulfillment_log: {
3352
+ Row: {
3353
+ attempts: number;
3354
+ connection_id: string;
3355
+ created_at: string;
3356
+ error: string | null;
3357
+ fulfillment_order_id: string | null;
3358
+ id: string;
3359
+ last_attempt_at: string | null;
3360
+ reason: string | null;
3361
+ sales_order_id: string;
3362
+ status: string;
3363
+ updated_at: string;
3364
+ };
3365
+ Insert: {
3366
+ attempts?: number;
3367
+ connection_id: string;
3368
+ created_at?: string;
3369
+ error?: string | null;
3370
+ fulfillment_order_id?: string | null;
3371
+ id?: string;
3372
+ last_attempt_at?: string | null;
3373
+ reason?: string | null;
3374
+ sales_order_id: string;
3375
+ status?: string;
3376
+ updated_at?: string;
3377
+ };
3378
+ Update: {
3379
+ attempts?: number;
3380
+ connection_id?: string;
3381
+ created_at?: string;
3382
+ error?: string | null;
3383
+ fulfillment_order_id?: string | null;
3384
+ id?: string;
3385
+ last_attempt_at?: string | null;
3386
+ reason?: string | null;
3387
+ sales_order_id?: string;
3388
+ status?: string;
3389
+ updated_at?: string;
3390
+ };
3391
+ Relationships: [
3392
+ {
3393
+ foreignKeyName: "floriday_auto_fulfillment_log_connection_id_fkey";
3394
+ columns: ["connection_id"];
3395
+ isOneToOne: false;
3396
+ referencedRelation: "floriday_connections";
3397
+ referencedColumns: ["id"];
3398
+ }
3399
+ ];
3400
+ };
3292
3401
  floriday_base_items_cache: {
3293
3402
  Row: {
3294
3403
  connection_id: string;
@@ -3719,6 +3828,51 @@ export type Database = {
3719
3828
  }
3720
3829
  ];
3721
3830
  };
3831
+ floriday_continuous_stock_queue: {
3832
+ Row: {
3833
+ attempts: number;
3834
+ connection_id: string;
3835
+ created_at: string;
3836
+ gateway_attempt_id: string | null;
3837
+ id: string;
3838
+ last_error: string | null;
3839
+ number_of_pieces: number;
3840
+ sent_at: string | null;
3841
+ status: string;
3842
+ trade_item_id: string;
3843
+ updated_at: string;
3844
+ user_id: string;
3845
+ };
3846
+ Insert: {
3847
+ attempts?: number;
3848
+ connection_id: string;
3849
+ created_at?: string;
3850
+ gateway_attempt_id?: string | null;
3851
+ id?: string;
3852
+ last_error?: string | null;
3853
+ number_of_pieces?: number;
3854
+ sent_at?: string | null;
3855
+ status?: string;
3856
+ trade_item_id: string;
3857
+ updated_at?: string;
3858
+ user_id: string;
3859
+ };
3860
+ Update: {
3861
+ attempts?: number;
3862
+ connection_id?: string;
3863
+ created_at?: string;
3864
+ gateway_attempt_id?: string | null;
3865
+ id?: string;
3866
+ last_error?: string | null;
3867
+ number_of_pieces?: number;
3868
+ sent_at?: string | null;
3869
+ status?: string;
3870
+ trade_item_id?: string;
3871
+ updated_at?: string;
3872
+ user_id?: string;
3873
+ };
3874
+ Relationships: [];
3875
+ };
3722
3876
  floriday_contract_trade_item_groups_cache: {
3723
3877
  Row: {
3724
3878
  connection_id: string;
@@ -4390,6 +4544,24 @@ export type Database = {
4390
4544
  }
4391
4545
  ];
4392
4546
  };
4547
+ floriday_rate_limit_state: {
4548
+ Row: {
4549
+ bucket: string;
4550
+ last_refill_at: string;
4551
+ tokens: number;
4552
+ };
4553
+ Insert: {
4554
+ bucket: string;
4555
+ last_refill_at?: string;
4556
+ tokens: number;
4557
+ };
4558
+ Update: {
4559
+ bucket?: string;
4560
+ last_refill_at?: string;
4561
+ tokens?: number;
4562
+ };
4563
+ Relationships: [];
4564
+ };
4393
4565
  floriday_resource_schemas: {
4394
4566
  Row: {
4395
4567
  enums: Json;
@@ -4831,6 +5003,62 @@ export type Database = {
4831
5003
  }
4832
5004
  ];
4833
5005
  };
5006
+ flow_role_assignments: {
5007
+ Row: {
5008
+ created_at: string;
5009
+ id: string;
5010
+ role_id: string;
5011
+ user_id: string;
5012
+ };
5013
+ Insert: {
5014
+ created_at?: string;
5015
+ id?: string;
5016
+ role_id: string;
5017
+ user_id: string;
5018
+ };
5019
+ Update: {
5020
+ created_at?: string;
5021
+ id?: string;
5022
+ role_id?: string;
5023
+ user_id?: string;
5024
+ };
5025
+ Relationships: [
5026
+ {
5027
+ foreignKeyName: "flow_role_assignments_role_id_fkey";
5028
+ columns: ["role_id"];
5029
+ isOneToOne: false;
5030
+ referencedRelation: "flow_roles";
5031
+ referencedColumns: ["id"];
5032
+ }
5033
+ ];
5034
+ };
5035
+ flow_roles: {
5036
+ Row: {
5037
+ created_at: string;
5038
+ description: string | null;
5039
+ id: string;
5040
+ module_access: string[];
5041
+ name: string;
5042
+ updated_at: string;
5043
+ };
5044
+ Insert: {
5045
+ created_at?: string;
5046
+ description?: string | null;
5047
+ id?: string;
5048
+ module_access?: string[];
5049
+ name: string;
5050
+ updated_at?: string;
5051
+ };
5052
+ Update: {
5053
+ created_at?: string;
5054
+ description?: string | null;
5055
+ id?: string;
5056
+ module_access?: string[];
5057
+ name?: string;
5058
+ updated_at?: string;
5059
+ };
5060
+ Relationships: [];
5061
+ };
4834
5062
  imap_accounts: {
4835
5063
  Row: {
4836
5064
  created_at: string;
@@ -5162,80 +5390,290 @@ export type Database = {
5162
5390
  };
5163
5391
  Relationships: [];
5164
5392
  };
5165
- locations: {
5393
+ local_customer_agreements: {
5166
5394
  Row: {
5395
+ base_price: number | null;
5167
5396
  created_at: string;
5397
+ currency: string;
5398
+ customer_id: string;
5168
5399
  id: string;
5169
- name: string;
5170
- sort_order: number;
5400
+ min_quantity: number;
5401
+ net_price: number;
5402
+ notes: string | null;
5403
+ product_category_id: string | null;
5404
+ product_id: string | null;
5171
5405
  updated_at: string;
5406
+ valid_from: string | null;
5407
+ valid_until: string | null;
5172
5408
  };
5173
5409
  Insert: {
5410
+ base_price?: number | null;
5174
5411
  created_at?: string;
5412
+ currency?: string;
5413
+ customer_id: string;
5175
5414
  id?: string;
5176
- name: string;
5177
- sort_order?: number;
5415
+ min_quantity?: number;
5416
+ net_price: number;
5417
+ notes?: string | null;
5418
+ product_category_id?: string | null;
5419
+ product_id?: string | null;
5178
5420
  updated_at?: string;
5421
+ valid_from?: string | null;
5422
+ valid_until?: string | null;
5179
5423
  };
5180
5424
  Update: {
5425
+ base_price?: number | null;
5181
5426
  created_at?: string;
5427
+ currency?: string;
5428
+ customer_id?: string;
5182
5429
  id?: string;
5183
- name?: string;
5184
- sort_order?: number;
5430
+ min_quantity?: number;
5431
+ net_price?: number;
5432
+ notes?: string | null;
5433
+ product_category_id?: string | null;
5434
+ product_id?: string | null;
5185
5435
  updated_at?: string;
5436
+ valid_from?: string | null;
5437
+ valid_until?: string | null;
5186
5438
  };
5187
- Relationships: [];
5439
+ Relationships: [
5440
+ {
5441
+ foreignKeyName: "local_customer_agreements_customer_id_fkey";
5442
+ columns: ["customer_id"];
5443
+ isOneToOne: false;
5444
+ referencedRelation: "customers";
5445
+ referencedColumns: ["id"];
5446
+ },
5447
+ {
5448
+ foreignKeyName: "local_customer_agreements_product_category_id_fkey";
5449
+ columns: ["product_category_id"];
5450
+ isOneToOne: false;
5451
+ referencedRelation: "product_categories";
5452
+ referencedColumns: ["id"];
5453
+ },
5454
+ {
5455
+ foreignKeyName: "local_customer_agreements_product_id_fkey";
5456
+ columns: ["product_id"];
5457
+ isOneToOne: false;
5458
+ referencedRelation: "products";
5459
+ referencedColumns: ["id"];
5460
+ }
5461
+ ];
5188
5462
  };
5189
- mailbox_messages: {
5463
+ local_customer_price_groups: {
5190
5464
  Row: {
5191
- body_html: string | null;
5192
- body_text: string | null;
5193
- connection_id: string | null;
5194
5465
  created_at: string;
5195
- error_message: string | null;
5196
- external_id: string | null;
5197
- from_email: string | null;
5198
- from_name: string | null;
5466
+ currency: string;
5467
+ customer_id: string;
5468
+ discount_type: string;
5469
+ discount_value: number;
5199
5470
  id: string;
5200
- message_id: string | null;
5201
- profile_id: string | null;
5202
- raw_size: number | null;
5203
- received_at: string | null;
5204
- status: string;
5205
- subject: string | null;
5206
- uid: number | null;
5471
+ min_quantity: number;
5472
+ notes: string | null;
5473
+ product_category_id: string | null;
5474
+ product_id: string | null;
5207
5475
  updated_at: string;
5476
+ valid_from: string | null;
5477
+ valid_until: string | null;
5208
5478
  };
5209
5479
  Insert: {
5210
- body_html?: string | null;
5211
- body_text?: string | null;
5212
- connection_id?: string | null;
5213
5480
  created_at?: string;
5214
- error_message?: string | null;
5215
- external_id?: string | null;
5216
- from_email?: string | null;
5217
- from_name?: string | null;
5481
+ currency?: string;
5482
+ customer_id: string;
5483
+ discount_type: string;
5484
+ discount_value: number;
5218
5485
  id?: string;
5219
- message_id?: string | null;
5220
- profile_id?: string | null;
5221
- raw_size?: number | null;
5222
- received_at?: string | null;
5223
- status?: string;
5224
- subject?: string | null;
5225
- uid?: number | null;
5486
+ min_quantity?: number;
5487
+ notes?: string | null;
5488
+ product_category_id?: string | null;
5489
+ product_id?: string | null;
5226
5490
  updated_at?: string;
5491
+ valid_from?: string | null;
5492
+ valid_until?: string | null;
5227
5493
  };
5228
5494
  Update: {
5229
- body_html?: string | null;
5230
- body_text?: string | null;
5231
- connection_id?: string | null;
5232
5495
  created_at?: string;
5233
- error_message?: string | null;
5234
- external_id?: string | null;
5235
- from_email?: string | null;
5236
- from_name?: string | null;
5496
+ currency?: string;
5497
+ customer_id?: string;
5498
+ discount_type?: string;
5499
+ discount_value?: number;
5237
5500
  id?: string;
5238
- message_id?: string | null;
5501
+ min_quantity?: number;
5502
+ notes?: string | null;
5503
+ product_category_id?: string | null;
5504
+ product_id?: string | null;
5505
+ updated_at?: string;
5506
+ valid_from?: string | null;
5507
+ valid_until?: string | null;
5508
+ };
5509
+ Relationships: [
5510
+ {
5511
+ foreignKeyName: "local_customer_price_groups_customer_id_fkey";
5512
+ columns: ["customer_id"];
5513
+ isOneToOne: false;
5514
+ referencedRelation: "customers";
5515
+ referencedColumns: ["id"];
5516
+ },
5517
+ {
5518
+ foreignKeyName: "local_customer_price_groups_product_category_id_fkey";
5519
+ columns: ["product_category_id"];
5520
+ isOneToOne: false;
5521
+ referencedRelation: "product_categories";
5522
+ referencedColumns: ["id"];
5523
+ },
5524
+ {
5525
+ foreignKeyName: "local_customer_price_groups_product_id_fkey";
5526
+ columns: ["product_id"];
5527
+ isOneToOne: false;
5528
+ referencedRelation: "products";
5529
+ referencedColumns: ["id"];
5530
+ }
5531
+ ];
5532
+ };
5533
+ local_customer_sales_strategies: {
5534
+ Row: {
5535
+ created_at: string;
5536
+ currency: string;
5537
+ customer_id: string;
5538
+ discount_type: string;
5539
+ discount_value: number;
5540
+ id: string;
5541
+ min_quantity: number;
5542
+ notes: string | null;
5543
+ product_category_id: string | null;
5544
+ product_id: string | null;
5545
+ updated_at: string;
5546
+ valid_from: string | null;
5547
+ valid_until: string | null;
5548
+ };
5549
+ Insert: {
5550
+ created_at?: string;
5551
+ currency?: string;
5552
+ customer_id: string;
5553
+ discount_type: string;
5554
+ discount_value: number;
5555
+ id?: string;
5556
+ min_quantity?: number;
5557
+ notes?: string | null;
5558
+ product_category_id?: string | null;
5559
+ product_id?: string | null;
5560
+ updated_at?: string;
5561
+ valid_from?: string | null;
5562
+ valid_until?: string | null;
5563
+ };
5564
+ Update: {
5565
+ created_at?: string;
5566
+ currency?: string;
5567
+ customer_id?: string;
5568
+ discount_type?: string;
5569
+ discount_value?: number;
5570
+ id?: string;
5571
+ min_quantity?: number;
5572
+ notes?: string | null;
5573
+ product_category_id?: string | null;
5574
+ product_id?: string | null;
5575
+ updated_at?: string;
5576
+ valid_from?: string | null;
5577
+ valid_until?: string | null;
5578
+ };
5579
+ Relationships: [
5580
+ {
5581
+ foreignKeyName: "local_customer_sales_strategies_customer_id_fkey";
5582
+ columns: ["customer_id"];
5583
+ isOneToOne: false;
5584
+ referencedRelation: "customers";
5585
+ referencedColumns: ["id"];
5586
+ },
5587
+ {
5588
+ foreignKeyName: "local_customer_sales_strategies_product_category_id_fkey";
5589
+ columns: ["product_category_id"];
5590
+ isOneToOne: false;
5591
+ referencedRelation: "product_categories";
5592
+ referencedColumns: ["id"];
5593
+ },
5594
+ {
5595
+ foreignKeyName: "local_customer_sales_strategies_product_id_fkey";
5596
+ columns: ["product_id"];
5597
+ isOneToOne: false;
5598
+ referencedRelation: "products";
5599
+ referencedColumns: ["id"];
5600
+ }
5601
+ ];
5602
+ };
5603
+ locations: {
5604
+ Row: {
5605
+ created_at: string;
5606
+ id: string;
5607
+ name: string;
5608
+ sort_order: number;
5609
+ updated_at: string;
5610
+ };
5611
+ Insert: {
5612
+ created_at?: string;
5613
+ id?: string;
5614
+ name: string;
5615
+ sort_order?: number;
5616
+ updated_at?: string;
5617
+ };
5618
+ Update: {
5619
+ created_at?: string;
5620
+ id?: string;
5621
+ name?: string;
5622
+ sort_order?: number;
5623
+ updated_at?: string;
5624
+ };
5625
+ Relationships: [];
5626
+ };
5627
+ mailbox_messages: {
5628
+ Row: {
5629
+ body_html: string | null;
5630
+ body_text: string | null;
5631
+ connection_id: string | null;
5632
+ created_at: string;
5633
+ error_message: string | null;
5634
+ external_id: string | null;
5635
+ from_email: string | null;
5636
+ from_name: string | null;
5637
+ id: string;
5638
+ message_id: string | null;
5639
+ profile_id: string | null;
5640
+ raw_size: number | null;
5641
+ received_at: string | null;
5642
+ status: string;
5643
+ subject: string | null;
5644
+ uid: number | null;
5645
+ updated_at: string;
5646
+ };
5647
+ Insert: {
5648
+ body_html?: string | null;
5649
+ body_text?: string | null;
5650
+ connection_id?: string | null;
5651
+ created_at?: string;
5652
+ error_message?: string | null;
5653
+ external_id?: string | null;
5654
+ from_email?: string | null;
5655
+ from_name?: string | null;
5656
+ id?: string;
5657
+ message_id?: string | null;
5658
+ profile_id?: string | null;
5659
+ raw_size?: number | null;
5660
+ received_at?: string | null;
5661
+ status?: string;
5662
+ subject?: string | null;
5663
+ uid?: number | null;
5664
+ updated_at?: string;
5665
+ };
5666
+ Update: {
5667
+ body_html?: string | null;
5668
+ body_text?: string | null;
5669
+ connection_id?: string | null;
5670
+ created_at?: string;
5671
+ error_message?: string | null;
5672
+ external_id?: string | null;
5673
+ from_email?: string | null;
5674
+ from_name?: string | null;
5675
+ id?: string;
5676
+ message_id?: string | null;
5239
5677
  profile_id?: string | null;
5240
5678
  raw_size?: number | null;
5241
5679
  received_at?: string | null;
@@ -5278,6 +5716,7 @@ export type Database = {
5278
5716
  matched_customer_id: string | null;
5279
5717
  message_id: string;
5280
5718
  notes: string | null;
5719
+ order_number: string | null;
5281
5720
  parsed_payload: Json | null;
5282
5721
  reviewed_at: string | null;
5283
5722
  reviewed_by: string | null;
@@ -5293,6 +5732,7 @@ export type Database = {
5293
5732
  matched_customer_id?: string | null;
5294
5733
  message_id: string;
5295
5734
  notes?: string | null;
5735
+ order_number?: string | null;
5296
5736
  parsed_payload?: Json | null;
5297
5737
  reviewed_at?: string | null;
5298
5738
  reviewed_by?: string | null;
@@ -5308,6 +5748,7 @@ export type Database = {
5308
5748
  matched_customer_id?: string | null;
5309
5749
  message_id?: string;
5310
5750
  notes?: string | null;
5751
+ order_number?: string | null;
5311
5752
  parsed_payload?: Json | null;
5312
5753
  reviewed_at?: string | null;
5313
5754
  reviewed_by?: string | null;
@@ -5688,6 +6129,281 @@ export type Database = {
5688
6129
  }
5689
6130
  ];
5690
6131
  };
6132
+ nmbrs_component_mapping: {
6133
+ Row: {
6134
+ created_at: string;
6135
+ id: string;
6136
+ source_kind: string;
6137
+ source_value: string | null;
6138
+ updated_at: string;
6139
+ wage_code: string;
6140
+ };
6141
+ Insert: {
6142
+ created_at?: string;
6143
+ id?: string;
6144
+ source_kind: string;
6145
+ source_value?: string | null;
6146
+ updated_at?: string;
6147
+ wage_code: string;
6148
+ };
6149
+ Update: {
6150
+ created_at?: string;
6151
+ id?: string;
6152
+ source_kind?: string;
6153
+ source_value?: string | null;
6154
+ updated_at?: string;
6155
+ wage_code?: string;
6156
+ };
6157
+ Relationships: [
6158
+ {
6159
+ foreignKeyName: "nmbrs_component_mapping_wage_code_fkey";
6160
+ columns: ["wage_code"];
6161
+ isOneToOne: false;
6162
+ referencedRelation: "nmbrs_wage_components";
6163
+ referencedColumns: ["code"];
6164
+ }
6165
+ ];
6166
+ };
6167
+ nmbrs_employee_mapping: {
6168
+ Row: {
6169
+ active_from: string | null;
6170
+ active_to: string | null;
6171
+ contract_hours_per_week: number | null;
6172
+ created_at: string;
6173
+ hourly_wage: number | null;
6174
+ id: string;
6175
+ monteur_id: string;
6176
+ nmbrs_company_code: string | null;
6177
+ nmbrs_employee_number: string;
6178
+ updated_at: string;
6179
+ };
6180
+ Insert: {
6181
+ active_from?: string | null;
6182
+ active_to?: string | null;
6183
+ contract_hours_per_week?: number | null;
6184
+ created_at?: string;
6185
+ hourly_wage?: number | null;
6186
+ id?: string;
6187
+ monteur_id: string;
6188
+ nmbrs_company_code?: string | null;
6189
+ nmbrs_employee_number: string;
6190
+ updated_at?: string;
6191
+ };
6192
+ Update: {
6193
+ active_from?: string | null;
6194
+ active_to?: string | null;
6195
+ contract_hours_per_week?: number | null;
6196
+ created_at?: string;
6197
+ hourly_wage?: number | null;
6198
+ id?: string;
6199
+ monteur_id?: string;
6200
+ nmbrs_company_code?: string | null;
6201
+ nmbrs_employee_number?: string;
6202
+ updated_at?: string;
6203
+ };
6204
+ Relationships: [
6205
+ {
6206
+ foreignKeyName: "nmbrs_employee_mapping_monteur_id_fkey";
6207
+ columns: ["monteur_id"];
6208
+ isOneToOne: true;
6209
+ referencedRelation: "monteurs";
6210
+ referencedColumns: ["id"];
6211
+ }
6212
+ ];
6213
+ };
6214
+ nmbrs_export_lines: {
6215
+ Row: {
6216
+ amount: number;
6217
+ created_at: string;
6218
+ entry_date: string;
6219
+ hours: number;
6220
+ id: string;
6221
+ monteur_id: string;
6222
+ nmbrs_employee_number: string | null;
6223
+ notes: string | null;
6224
+ run_id: string;
6225
+ source_kind: string | null;
6226
+ source_ref_id: string | null;
6227
+ updated_at: string;
6228
+ wage_code: string;
6229
+ };
6230
+ Insert: {
6231
+ amount?: number;
6232
+ created_at?: string;
6233
+ entry_date: string;
6234
+ hours?: number;
6235
+ id?: string;
6236
+ monteur_id: string;
6237
+ nmbrs_employee_number?: string | null;
6238
+ notes?: string | null;
6239
+ run_id: string;
6240
+ source_kind?: string | null;
6241
+ source_ref_id?: string | null;
6242
+ updated_at?: string;
6243
+ wage_code: string;
6244
+ };
6245
+ Update: {
6246
+ amount?: number;
6247
+ created_at?: string;
6248
+ entry_date?: string;
6249
+ hours?: number;
6250
+ id?: string;
6251
+ monteur_id?: string;
6252
+ nmbrs_employee_number?: string | null;
6253
+ notes?: string | null;
6254
+ run_id?: string;
6255
+ source_kind?: string | null;
6256
+ source_ref_id?: string | null;
6257
+ updated_at?: string;
6258
+ wage_code?: string;
6259
+ };
6260
+ Relationships: [
6261
+ {
6262
+ foreignKeyName: "nmbrs_export_lines_monteur_id_fkey";
6263
+ columns: ["monteur_id"];
6264
+ isOneToOne: false;
6265
+ referencedRelation: "monteurs";
6266
+ referencedColumns: ["id"];
6267
+ },
6268
+ {
6269
+ foreignKeyName: "nmbrs_export_lines_run_id_fkey";
6270
+ columns: ["run_id"];
6271
+ isOneToOne: false;
6272
+ referencedRelation: "nmbrs_export_runs";
6273
+ referencedColumns: ["id"];
6274
+ },
6275
+ {
6276
+ foreignKeyName: "nmbrs_export_lines_wage_code_fkey";
6277
+ columns: ["wage_code"];
6278
+ isOneToOne: false;
6279
+ referencedRelation: "nmbrs_wage_components";
6280
+ referencedColumns: ["code"];
6281
+ }
6282
+ ];
6283
+ };
6284
+ nmbrs_export_runs: {
6285
+ Row: {
6286
+ created_at: string;
6287
+ file_name: string | null;
6288
+ generated_at: string;
6289
+ generated_by: string | null;
6290
+ id: string;
6291
+ notes: string | null;
6292
+ period_end: string;
6293
+ period_label: string;
6294
+ period_start: string;
6295
+ status: string;
6296
+ total_hours: number;
6297
+ total_lines: number;
6298
+ updated_at: string;
6299
+ };
6300
+ Insert: {
6301
+ created_at?: string;
6302
+ file_name?: string | null;
6303
+ generated_at?: string;
6304
+ generated_by?: string | null;
6305
+ id?: string;
6306
+ notes?: string | null;
6307
+ period_end: string;
6308
+ period_label: string;
6309
+ period_start: string;
6310
+ status?: string;
6311
+ total_hours?: number;
6312
+ total_lines?: number;
6313
+ updated_at?: string;
6314
+ };
6315
+ Update: {
6316
+ created_at?: string;
6317
+ file_name?: string | null;
6318
+ generated_at?: string;
6319
+ generated_by?: string | null;
6320
+ id?: string;
6321
+ notes?: string | null;
6322
+ period_end?: string;
6323
+ period_label?: string;
6324
+ period_start?: string;
6325
+ status?: string;
6326
+ total_hours?: number;
6327
+ total_lines?: number;
6328
+ updated_at?: string;
6329
+ };
6330
+ Relationships: [];
6331
+ };
6332
+ nmbrs_settings: {
6333
+ Row: {
6334
+ created_at: string;
6335
+ default_company_code: string | null;
6336
+ id: boolean;
6337
+ include_travel: boolean;
6338
+ overtime_threshold_daily: number;
6339
+ overtime_threshold_weekly: number;
6340
+ period_type: string;
6341
+ updated_at: string;
6342
+ updated_by: string | null;
6343
+ week_start_day: number;
6344
+ };
6345
+ Insert: {
6346
+ created_at?: string;
6347
+ default_company_code?: string | null;
6348
+ id?: boolean;
6349
+ include_travel?: boolean;
6350
+ overtime_threshold_daily?: number;
6351
+ overtime_threshold_weekly?: number;
6352
+ period_type?: string;
6353
+ updated_at?: string;
6354
+ updated_by?: string | null;
6355
+ week_start_day?: number;
6356
+ };
6357
+ Update: {
6358
+ created_at?: string;
6359
+ default_company_code?: string | null;
6360
+ id?: boolean;
6361
+ include_travel?: boolean;
6362
+ overtime_threshold_daily?: number;
6363
+ overtime_threshold_weekly?: number;
6364
+ period_type?: string;
6365
+ updated_at?: string;
6366
+ updated_by?: string | null;
6367
+ week_start_day?: number;
6368
+ };
6369
+ Relationships: [];
6370
+ };
6371
+ nmbrs_wage_components: {
6372
+ Row: {
6373
+ category: string;
6374
+ code: string;
6375
+ created_at: string;
6376
+ id: string;
6377
+ is_active: boolean;
6378
+ label: string;
6379
+ sort_order: number;
6380
+ unit: string;
6381
+ updated_at: string;
6382
+ };
6383
+ Insert: {
6384
+ category: string;
6385
+ code: string;
6386
+ created_at?: string;
6387
+ id?: string;
6388
+ is_active?: boolean;
6389
+ label: string;
6390
+ sort_order?: number;
6391
+ unit: string;
6392
+ updated_at?: string;
6393
+ };
6394
+ Update: {
6395
+ category?: string;
6396
+ code?: string;
6397
+ created_at?: string;
6398
+ id?: string;
6399
+ is_active?: boolean;
6400
+ label?: string;
6401
+ sort_order?: number;
6402
+ unit?: string;
6403
+ updated_at?: string;
6404
+ };
6405
+ Relationships: [];
6406
+ };
5691
6407
  notifications: {
5692
6408
  Row: {
5693
6409
  created_at: string;
@@ -5919,6 +6635,7 @@ export type Database = {
5919
6635
  id: string;
5920
6636
  items: Json;
5921
6637
  notes: string | null;
6638
+ order_number: string | null;
5922
6639
  recipient_id: string;
5923
6640
  total_amount: number;
5924
6641
  };
@@ -5932,6 +6649,7 @@ export type Database = {
5932
6649
  id?: string;
5933
6650
  items?: Json;
5934
6651
  notes?: string | null;
6652
+ order_number?: string | null;
5935
6653
  recipient_id: string;
5936
6654
  total_amount?: number;
5937
6655
  };
@@ -5945,6 +6663,7 @@ export type Database = {
5945
6663
  id?: string;
5946
6664
  items?: Json;
5947
6665
  notes?: string | null;
6666
+ order_number?: string | null;
5948
6667
  recipient_id?: string;
5949
6668
  total_amount?: number;
5950
6669
  };
@@ -6112,6 +6831,9 @@ export type Database = {
6112
6831
  crates_per_layer: number;
6113
6832
  created_at: string;
6114
6833
  id: string;
6834
+ layer_fraction: number;
6835
+ layer_share_pct: number;
6836
+ layers_per_cart: number;
6115
6837
  order_item_id: string | null;
6116
6838
  plants_per_crate: number;
6117
6839
  product_id: string | null;
@@ -6123,6 +6845,9 @@ export type Database = {
6123
6845
  crates_per_layer?: number;
6124
6846
  created_at?: string;
6125
6847
  id?: string;
6848
+ layer_fraction?: number;
6849
+ layer_share_pct?: number;
6850
+ layers_per_cart?: number;
6126
6851
  order_item_id?: string | null;
6127
6852
  plants_per_crate?: number;
6128
6853
  product_id?: string | null;
@@ -6134,6 +6859,9 @@ export type Database = {
6134
6859
  crates_per_layer?: number;
6135
6860
  created_at?: string;
6136
6861
  id?: string;
6862
+ layer_fraction?: number;
6863
+ layer_share_pct?: number;
6864
+ layers_per_cart?: number;
6137
6865
  order_item_id?: string | null;
6138
6866
  plants_per_crate?: number;
6139
6867
  product_id?: string | null;
@@ -6165,33 +6893,45 @@ export type Database = {
6165
6893
  };
6166
6894
  order_carts: {
6167
6895
  Row: {
6896
+ algorithm_version: number;
6168
6897
  cart_number: number;
6169
6898
  created_at: string;
6170
6899
  id: string;
6171
6900
  is_auto: boolean;
6172
6901
  is_complete: boolean;
6173
6902
  notes: string | null;
6903
+ occupancy_pct: number;
6174
6904
  order_id: string;
6905
+ source: string;
6906
+ total_layers_used: number;
6175
6907
  updated_at: string;
6176
6908
  };
6177
6909
  Insert: {
6910
+ algorithm_version?: number;
6178
6911
  cart_number: number;
6179
6912
  created_at?: string;
6180
6913
  id?: string;
6181
6914
  is_auto?: boolean;
6182
6915
  is_complete?: boolean;
6183
6916
  notes?: string | null;
6917
+ occupancy_pct?: number;
6184
6918
  order_id: string;
6919
+ source?: string;
6920
+ total_layers_used?: number;
6185
6921
  updated_at?: string;
6186
6922
  };
6187
6923
  Update: {
6924
+ algorithm_version?: number;
6188
6925
  cart_number?: number;
6189
6926
  created_at?: string;
6190
6927
  id?: string;
6191
6928
  is_auto?: boolean;
6192
6929
  is_complete?: boolean;
6193
6930
  notes?: string | null;
6931
+ occupancy_pct?: number;
6194
6932
  order_id?: string;
6933
+ source?: string;
6934
+ total_layers_used?: number;
6195
6935
  updated_at?: string;
6196
6936
  };
6197
6937
  Relationships: [
@@ -6351,6 +7091,8 @@ export type Database = {
6351
7091
  order_date: string;
6352
7092
  order_number: string;
6353
7093
  order_source: string;
7094
+ plan_locked_at: string | null;
7095
+ plan_locked_ref: string | null;
6354
7096
  status: string;
6355
7097
  total: string;
6356
7098
  updated_at: string;
@@ -6367,6 +7109,8 @@ export type Database = {
6367
7109
  order_date?: string;
6368
7110
  order_number: string;
6369
7111
  order_source?: string;
7112
+ plan_locked_at?: string | null;
7113
+ plan_locked_ref?: string | null;
6370
7114
  status?: string;
6371
7115
  total?: string;
6372
7116
  updated_at?: string;
@@ -6383,6 +7127,8 @@ export type Database = {
6383
7127
  order_date?: string;
6384
7128
  order_number?: string;
6385
7129
  order_source?: string;
7130
+ plan_locked_at?: string | null;
7131
+ plan_locked_ref?: string | null;
6386
7132
  status?: string;
6387
7133
  total?: string;
6388
7134
  updated_at?: string;
@@ -6761,6 +7507,7 @@ export type Database = {
6761
7507
  display_name: string | null;
6762
7508
  email: string | null;
6763
7509
  id: string;
7510
+ is_superadmin: boolean;
6764
7511
  notification_preferences: Json;
6765
7512
  tenant_id: string | null;
6766
7513
  updated_at: string;
@@ -6770,6 +7517,7 @@ export type Database = {
6770
7517
  display_name?: string | null;
6771
7518
  email?: string | null;
6772
7519
  id: string;
7520
+ is_superadmin?: boolean;
6773
7521
  notification_preferences?: Json;
6774
7522
  tenant_id?: string | null;
6775
7523
  updated_at?: string;
@@ -6779,6 +7527,7 @@ export type Database = {
6779
7527
  display_name?: string | null;
6780
7528
  email?: string | null;
6781
7529
  id?: string;
7530
+ is_superadmin?: boolean;
6782
7531
  notification_preferences?: Json;
6783
7532
  tenant_id?: string | null;
6784
7533
  updated_at?: string;
@@ -7600,6 +8349,66 @@ export type Database = {
7600
8349
  };
7601
8350
  Relationships: [];
7602
8351
  };
8352
+ sidebar_config: {
8353
+ Row: {
8354
+ id: string;
8355
+ module_order: string[];
8356
+ updated_at: string;
8357
+ };
8358
+ Insert: {
8359
+ id?: string;
8360
+ module_order?: string[];
8361
+ updated_at?: string;
8362
+ };
8363
+ Update: {
8364
+ id?: string;
8365
+ module_order?: string[];
8366
+ updated_at?: string;
8367
+ };
8368
+ Relationships: [];
8369
+ };
8370
+ stock_import_runs: {
8371
+ Row: {
8372
+ connection_id: string | null;
8373
+ created_at: string;
8374
+ created_rows: number;
8375
+ errors: Json;
8376
+ filename: string | null;
8377
+ id: string;
8378
+ mutations: Json;
8379
+ skipped_rows: number;
8380
+ total_rows: number;
8381
+ updated_rows: number;
8382
+ user_id: string;
8383
+ };
8384
+ Insert: {
8385
+ connection_id?: string | null;
8386
+ created_at?: string;
8387
+ created_rows?: number;
8388
+ errors?: Json;
8389
+ filename?: string | null;
8390
+ id?: string;
8391
+ mutations?: Json;
8392
+ skipped_rows?: number;
8393
+ total_rows?: number;
8394
+ updated_rows?: number;
8395
+ user_id: string;
8396
+ };
8397
+ Update: {
8398
+ connection_id?: string | null;
8399
+ created_at?: string;
8400
+ created_rows?: number;
8401
+ errors?: Json;
8402
+ filename?: string | null;
8403
+ id?: string;
8404
+ mutations?: Json;
8405
+ skipped_rows?: number;
8406
+ total_rows?: number;
8407
+ updated_rows?: number;
8408
+ user_id?: string;
8409
+ };
8410
+ Relationships: [];
8411
+ };
7603
8412
  stock_mutation_log: {
7604
8413
  Row: {
7605
8414
  connection_id: string | null;
@@ -7616,7 +8425,7 @@ export type Database = {
7616
8425
  reason: string | null;
7617
8426
  reserved_after: number | null;
7618
8427
  reserved_before: number | null;
7619
- trade_item_key: string;
8428
+ trade_item_key: string | null;
7620
8429
  };
7621
8430
  Insert: {
7622
8431
  connection_id?: string | null;
@@ -7633,7 +8442,7 @@ export type Database = {
7633
8442
  reason?: string | null;
7634
8443
  reserved_after?: number | null;
7635
8444
  reserved_before?: number | null;
7636
- trade_item_key: string;
8445
+ trade_item_key?: string | null;
7637
8446
  };
7638
8447
  Update: {
7639
8448
  connection_id?: string | null;
@@ -7650,7 +8459,7 @@ export type Database = {
7650
8459
  reason?: string | null;
7651
8460
  reserved_after?: number | null;
7652
8461
  reserved_before?: number | null;
7653
- trade_item_key?: string;
8462
+ trade_item_key?: string | null;
7654
8463
  };
7655
8464
  Relationships: [];
7656
8465
  };
@@ -7930,76 +8739,186 @@ export type Database = {
7930
8739
  user_id: string;
7931
8740
  };
7932
8741
  Insert: {
7933
- connection_id?: string | null;
8742
+ connection_id?: string | null;
8743
+ created_at?: string;
8744
+ data?: Json;
8745
+ floriday_id?: string | null;
8746
+ floriday_link_error?: string | null;
8747
+ floriday_link_status?: string;
8748
+ id?: string;
8749
+ last_floriday_sync_at?: string | null;
8750
+ missing_required_fields?: string[];
8751
+ source?: string;
8752
+ updated_at?: string;
8753
+ user_id: string;
8754
+ };
8755
+ Update: {
8756
+ connection_id?: string | null;
8757
+ created_at?: string;
8758
+ data?: Json;
8759
+ floriday_id?: string | null;
8760
+ floriday_link_error?: string | null;
8761
+ floriday_link_status?: string;
8762
+ id?: string;
8763
+ last_floriday_sync_at?: string | null;
8764
+ missing_required_fields?: string[];
8765
+ source?: string;
8766
+ updated_at?: string;
8767
+ user_id?: string;
8768
+ };
8769
+ Relationships: [];
8770
+ };
8771
+ trade_item_stock: {
8772
+ Row: {
8773
+ connection_id: string;
8774
+ created_at: string;
8775
+ id: string;
8776
+ incoming_stock: number;
8777
+ minimum_stock: number;
8778
+ notes: string | null;
8779
+ physical_stock: number;
8780
+ reserved_stock: number;
8781
+ trade_item_key: string;
8782
+ updated_at: string;
8783
+ user_id: string;
8784
+ };
8785
+ Insert: {
8786
+ connection_id: string;
8787
+ created_at?: string;
8788
+ id?: string;
8789
+ incoming_stock?: number;
8790
+ minimum_stock?: number;
8791
+ notes?: string | null;
8792
+ physical_stock?: number;
8793
+ reserved_stock?: number;
8794
+ trade_item_key: string;
8795
+ updated_at?: string;
8796
+ user_id: string;
8797
+ };
8798
+ Update: {
8799
+ connection_id?: string;
8800
+ created_at?: string;
8801
+ id?: string;
8802
+ incoming_stock?: number;
8803
+ minimum_stock?: number;
8804
+ notes?: string | null;
8805
+ physical_stock?: number;
8806
+ reserved_stock?: number;
8807
+ trade_item_key?: string;
8808
+ updated_at?: string;
8809
+ user_id?: string;
8810
+ };
8811
+ Relationships: [];
8812
+ };
8813
+ trade_item_supply_lines: {
8814
+ Row: {
8815
+ available_quantity: number | null;
8816
+ connection_id: string;
8817
+ created_at: string;
8818
+ currency: string | null;
8819
+ endpoint_family: string | null;
8820
+ environment: string | null;
8821
+ id: string;
8822
+ last_error: string | null;
8823
+ last_status: number | null;
8824
+ packing_configuration_id: string | null;
8825
+ period_end: string | null;
8826
+ period_start: string | null;
8827
+ price_per_piece: number | null;
8828
+ sales_unit: string | null;
8829
+ supply_line_id: string | null;
8830
+ supply_type: string;
8831
+ trade_item_id: string;
8832
+ updated_at: string;
8833
+ user_id: string;
8834
+ week: number | null;
8835
+ year: number | null;
8836
+ };
8837
+ Insert: {
8838
+ available_quantity?: number | null;
8839
+ connection_id: string;
7934
8840
  created_at?: string;
7935
- data?: Json;
7936
- floriday_id?: string | null;
7937
- floriday_link_error?: string | null;
7938
- floriday_link_status?: string;
8841
+ currency?: string | null;
8842
+ endpoint_family?: string | null;
8843
+ environment?: string | null;
7939
8844
  id?: string;
7940
- last_floriday_sync_at?: string | null;
7941
- missing_required_fields?: string[];
7942
- source?: string;
8845
+ last_error?: string | null;
8846
+ last_status?: number | null;
8847
+ packing_configuration_id?: string | null;
8848
+ period_end?: string | null;
8849
+ period_start?: string | null;
8850
+ price_per_piece?: number | null;
8851
+ sales_unit?: string | null;
8852
+ supply_line_id?: string | null;
8853
+ supply_type?: string;
8854
+ trade_item_id: string;
7943
8855
  updated_at?: string;
7944
8856
  user_id: string;
8857
+ week?: number | null;
8858
+ year?: number | null;
7945
8859
  };
7946
8860
  Update: {
7947
- connection_id?: string | null;
8861
+ available_quantity?: number | null;
8862
+ connection_id?: string;
7948
8863
  created_at?: string;
7949
- data?: Json;
7950
- floriday_id?: string | null;
7951
- floriday_link_error?: string | null;
7952
- floriday_link_status?: string;
8864
+ currency?: string | null;
8865
+ endpoint_family?: string | null;
8866
+ environment?: string | null;
7953
8867
  id?: string;
7954
- last_floriday_sync_at?: string | null;
7955
- missing_required_fields?: string[];
7956
- source?: string;
8868
+ last_error?: string | null;
8869
+ last_status?: number | null;
8870
+ packing_configuration_id?: string | null;
8871
+ period_end?: string | null;
8872
+ period_start?: string | null;
8873
+ price_per_piece?: number | null;
8874
+ sales_unit?: string | null;
8875
+ supply_line_id?: string | null;
8876
+ supply_type?: string;
8877
+ trade_item_id?: string;
7957
8878
  updated_at?: string;
7958
8879
  user_id?: string;
8880
+ week?: number | null;
8881
+ year?: number | null;
7959
8882
  };
7960
8883
  Relationships: [];
7961
8884
  };
7962
- trade_item_stock: {
8885
+ trade_item_warehouse_preferences: {
7963
8886
  Row: {
7964
8887
  connection_id: string;
7965
8888
  created_at: string;
7966
8889
  id: string;
7967
- incoming_stock: number;
7968
- minimum_stock: number;
7969
- notes: string | null;
7970
- physical_stock: number;
7971
- reserved_stock: number;
7972
- trade_item_key: string;
8890
+ trade_item_id: string;
7973
8891
  updated_at: string;
7974
- user_id: string;
8892
+ warehouse_id: string;
8893
+ warehouse_name: string | null;
7975
8894
  };
7976
8895
  Insert: {
7977
8896
  connection_id: string;
7978
8897
  created_at?: string;
7979
8898
  id?: string;
7980
- incoming_stock?: number;
7981
- minimum_stock?: number;
7982
- notes?: string | null;
7983
- physical_stock?: number;
7984
- reserved_stock?: number;
7985
- trade_item_key: string;
8899
+ trade_item_id: string;
7986
8900
  updated_at?: string;
7987
- user_id: string;
8901
+ warehouse_id: string;
8902
+ warehouse_name?: string | null;
7988
8903
  };
7989
8904
  Update: {
7990
8905
  connection_id?: string;
7991
8906
  created_at?: string;
7992
8907
  id?: string;
7993
- incoming_stock?: number;
7994
- minimum_stock?: number;
7995
- notes?: string | null;
7996
- physical_stock?: number;
7997
- reserved_stock?: number;
7998
- trade_item_key?: string;
8908
+ trade_item_id?: string;
7999
8909
  updated_at?: string;
8000
- user_id?: string;
8910
+ warehouse_id?: string;
8911
+ warehouse_name?: string | null;
8001
8912
  };
8002
- Relationships: [];
8913
+ Relationships: [
8914
+ {
8915
+ foreignKeyName: "trade_item_warehouse_preferences_connection_id_fkey";
8916
+ columns: ["connection_id"];
8917
+ isOneToOne: false;
8918
+ referencedRelation: "floriday_connections";
8919
+ referencedColumns: ["id"];
8920
+ }
8921
+ ];
8003
8922
  };
8004
8923
  twinfield_connections: {
8005
8924
  Row: {
@@ -8326,6 +9245,10 @@ export type Database = {
8326
9245
  default_invoice_type: string;
8327
9246
  default_payment_term_days: number;
8328
9247
  default_vat_code: string;
9248
+ invoice_enabled_ao: boolean;
9249
+ invoice_enabled_fo: boolean;
9250
+ invoice_enabled_ho: boolean;
9251
+ invoice_enabled_mo: boolean;
8329
9252
  updated_at: string;
8330
9253
  user_id: string;
8331
9254
  };
@@ -8335,6 +9258,10 @@ export type Database = {
8335
9258
  default_invoice_type?: string;
8336
9259
  default_payment_term_days?: number;
8337
9260
  default_vat_code?: string;
9261
+ invoice_enabled_ao?: boolean;
9262
+ invoice_enabled_fo?: boolean;
9263
+ invoice_enabled_ho?: boolean;
9264
+ invoice_enabled_mo?: boolean;
8338
9265
  updated_at?: string;
8339
9266
  user_id: string;
8340
9267
  };
@@ -8344,6 +9271,10 @@ export type Database = {
8344
9271
  default_invoice_type?: string;
8345
9272
  default_payment_term_days?: number;
8346
9273
  default_vat_code?: string;
9274
+ invoice_enabled_ao?: boolean;
9275
+ invoice_enabled_fo?: boolean;
9276
+ invoice_enabled_ho?: boolean;
9277
+ invoice_enabled_mo?: boolean;
8347
9278
  updated_at?: string;
8348
9279
  user_id?: string;
8349
9280
  };
@@ -9261,6 +10192,44 @@ export type Database = {
9261
10192
  };
9262
10193
  Relationships: [];
9263
10194
  };
10195
+ floriday_customer_discounts: {
10196
+ Row: {
10197
+ base_price: number | null;
10198
+ buyer_organization_id: string | null;
10199
+ currency: string | null;
10200
+ discount_type: string | null;
10201
+ discount_value: number | null;
10202
+ min_quantity: number | null;
10203
+ net_price: number | null;
10204
+ product_group_id: string | null;
10205
+ raw: Json | null;
10206
+ source: string | null;
10207
+ source_id: string | null;
10208
+ trade_item_id: string | null;
10209
+ valid_from: string | null;
10210
+ valid_until: string | null;
10211
+ };
10212
+ Relationships: [];
10213
+ };
10214
+ local_customer_discounts: {
10215
+ Row: {
10216
+ base_price: number | null;
10217
+ currency: string | null;
10218
+ customer_id: string | null;
10219
+ discount_type: string | null;
10220
+ discount_value: number | null;
10221
+ min_quantity: number | null;
10222
+ net_price: number | null;
10223
+ product_category_id: string | null;
10224
+ product_id: string | null;
10225
+ product_name: string | null;
10226
+ source: string | null;
10227
+ source_id: string | null;
10228
+ valid_from: string | null;
10229
+ valid_until: string | null;
10230
+ };
10231
+ Relationships: [];
10232
+ };
9264
10233
  manufacture_product_possible_stock_view: {
9265
10234
  Row: {
9266
10235
  component_count: number | null;
@@ -9557,6 +10526,32 @@ export type Database = {
9557
10526
  };
9558
10527
  Returns: number;
9559
10528
  };
10529
+ afh_city_code: {
10530
+ Args: {
10531
+ _city: string;
10532
+ _country: string;
10533
+ };
10534
+ Returns: string;
10535
+ };
10536
+ afh_normalize_country: {
10537
+ Args: {
10538
+ _raw: string;
10539
+ };
10540
+ Returns: string;
10541
+ };
10542
+ afh_normalize_nl_province: {
10543
+ Args: {
10544
+ _raw: string;
10545
+ };
10546
+ Returns: string;
10547
+ };
10548
+ afh_subtract_workdays: {
10549
+ Args: {
10550
+ _date: string;
10551
+ _days: number;
10552
+ };
10553
+ Returns: string;
10554
+ };
9560
10555
  apply_stock_consumption: {
9561
10556
  Args: {
9562
10557
  p_order_id: string;
@@ -9602,16 +10597,62 @@ export type Database = {
9602
10597
  order_number: string;
9603
10598
  }[];
9604
10599
  };
10600
+ autolink_product_to_floriday: {
10601
+ Args: {
10602
+ p_product_id: string;
10603
+ };
10604
+ Returns: string;
10605
+ };
10606
+ backfill_open_order_reservations: {
10607
+ Args: never;
10608
+ Returns: {
10609
+ processed_items: number;
10610
+ }[];
10611
+ };
9605
10612
  call_exact_route: {
9606
10613
  Args: {
9607
10614
  path: string;
9608
10615
  };
9609
10616
  Returns: number;
9610
10617
  };
10618
+ check_offer_product_available_stock: {
10619
+ Args: {
10620
+ p_campaign_product_id: string;
10621
+ p_code: string;
10622
+ p_needed_qty?: number;
10623
+ p_product_name?: string;
10624
+ };
10625
+ Returns: Json;
10626
+ };
10627
+ check_trade_item_available_stock: {
10628
+ Args: {
10629
+ p_connection_id?: string;
10630
+ p_context?: string;
10631
+ p_needed_qty?: number;
10632
+ p_order_id?: string;
10633
+ p_order_item_id?: string;
10634
+ p_owner_id?: string;
10635
+ p_product_name?: string;
10636
+ p_trade_item_key: string;
10637
+ };
10638
+ Returns: Json;
10639
+ };
9611
10640
  cleanup_old_bookings: {
9612
10641
  Args: never;
9613
10642
  Returns: number;
9614
10643
  };
10644
+ consume_floriday_rate_limit: {
10645
+ Args: {
10646
+ p_bucket: string;
10647
+ p_capacity: number;
10648
+ p_cost?: number;
10649
+ p_refill_per_sec: number;
10650
+ };
10651
+ Returns: {
10652
+ granted: boolean;
10653
+ wait_ms: number;
10654
+ }[];
10655
+ };
9615
10656
  control_get_todays_carts: {
9616
10657
  Args: never;
9617
10658
  Returns: {
@@ -9651,6 +10692,12 @@ export type Database = {
9651
10692
  table_name: string;
9652
10693
  }[];
9653
10694
  };
10695
+ dispatch_carrier_signups_sql: {
10696
+ Args: {
10697
+ _catchup?: string;
10698
+ };
10699
+ Returns: Json;
10700
+ };
9654
10701
  email_auth_decrypt: {
9655
10702
  Args: {
9656
10703
  cipher: string;
@@ -9686,6 +10733,18 @@ export type Database = {
9686
10733
  status: string;
9687
10734
  }[];
9688
10735
  };
10736
+ enqueue_cart_replan_if_unlocked: {
10737
+ Args: {
10738
+ p_order_id: string;
10739
+ };
10740
+ Returns: undefined;
10741
+ };
10742
+ ensure_trade_item_stock_row: {
10743
+ Args: {
10744
+ p_key: string;
10745
+ };
10746
+ Returns: undefined;
10747
+ };
9689
10748
  ensure_user_tenant: {
9690
10749
  Args: never;
9691
10750
  Returns: string;
@@ -9723,6 +10782,31 @@ export type Database = {
9723
10782
  };
9724
10783
  Returns: boolean;
9725
10784
  };
10785
+ find_trade_item_key: {
10786
+ Args: {
10787
+ p_barcode: string;
10788
+ p_name: string;
10789
+ p_product_id: string;
10790
+ };
10791
+ Returns: string;
10792
+ };
10793
+ floriday_effective_price: {
10794
+ Args: {
10795
+ _buyer_id: string;
10796
+ _on_date?: string;
10797
+ _quantity?: number;
10798
+ _trade_item_id: string;
10799
+ };
10800
+ Returns: {
10801
+ base_price: number;
10802
+ currency: string;
10803
+ discount_type: string;
10804
+ discount_value: number;
10805
+ net_price: number;
10806
+ source: string;
10807
+ source_id: string;
10808
+ }[];
10809
+ };
9726
10810
  format_cart_number: {
9727
10811
  Args: {
9728
10812
  p_pick_date: string;
@@ -9743,6 +10827,13 @@ export type Database = {
9743
10827
  preferred_warehouse_name: string;
9744
10828
  }[];
9745
10829
  };
10830
+ get_active_floriday_context: {
10831
+ Args: never;
10832
+ Returns: {
10833
+ connection_id: string;
10834
+ user_id: string;
10835
+ }[];
10836
+ };
9746
10837
  get_active_twinfield_public: {
9747
10838
  Args: never;
9748
10839
  Returns: {
@@ -9754,6 +10845,13 @@ export type Database = {
9754
10845
  office_code: string;
9755
10846
  }[];
9756
10847
  };
10848
+ get_floricode_record_counts: {
10849
+ Args: never;
10850
+ Returns: {
10851
+ count: number;
10852
+ resource: string;
10853
+ }[];
10854
+ };
9757
10855
  get_floriday_agreements_active: {
9758
10856
  Args: {
9759
10857
  p_on_date?: string;
@@ -9845,6 +10943,24 @@ export type Database = {
9845
10943
  };
9846
10944
  Returns: Json;
9847
10945
  };
10946
+ get_offer_delivery_options: {
10947
+ Args: {
10948
+ p_code: string;
10949
+ };
10950
+ Returns: Json;
10951
+ };
10952
+ get_offer_recipient_by_code: {
10953
+ Args: {
10954
+ p_code: string;
10955
+ };
10956
+ Returns: {
10957
+ campaign_id: string;
10958
+ clicked_at: string;
10959
+ customer_id: string;
10960
+ id: string;
10961
+ ordered_at: string;
10962
+ }[];
10963
+ };
9848
10964
  get_or_assign_floriday_order_number: {
9849
10965
  Args: {
9850
10966
  p_floriday_id: string;
@@ -9897,12 +11013,53 @@ export type Database = {
9897
11013
  Args: never;
9898
11014
  Returns: boolean;
9899
11015
  };
11016
+ is_superadmin: {
11017
+ Args: {
11018
+ _user_id: string;
11019
+ };
11020
+ Returns: boolean;
11021
+ };
11022
+ local_effective_price: {
11023
+ Args: {
11024
+ _customer_id: string;
11025
+ _on_date?: string;
11026
+ _product_id: string;
11027
+ _quantity?: number;
11028
+ };
11029
+ Returns: {
11030
+ currency: string;
11031
+ discount_type: string;
11032
+ discount_value: number;
11033
+ net_price: number;
11034
+ source: string;
11035
+ source_id: string;
11036
+ }[];
11037
+ };
11038
+ mark_offer_clicked: {
11039
+ Args: {
11040
+ p_code: string;
11041
+ };
11042
+ Returns: undefined;
11043
+ };
11044
+ mark_offer_ordered: {
11045
+ Args: {
11046
+ p_code: string;
11047
+ };
11048
+ Returns: undefined;
11049
+ };
9900
11050
  next_order_number: {
9901
11051
  Args: {
9902
11052
  p_prefix: string;
9903
11053
  };
9904
11054
  Returns: string;
9905
11055
  };
11056
+ next_order_number_for_date: {
11057
+ Args: {
11058
+ p_created_at?: string;
11059
+ p_prefix: string;
11060
+ };
11061
+ Returns: string;
11062
+ };
9906
11063
  next_work_order_number: {
9907
11064
  Args: {
9908
11065
  p_parent_work_order_id?: string;
@@ -9910,16 +11067,41 @@ export type Database = {
9910
11067
  };
9911
11068
  Returns: string;
9912
11069
  };
11070
+ normalize_order_source: {
11071
+ Args: {
11072
+ p_src: string;
11073
+ };
11074
+ Returns: string;
11075
+ };
9913
11076
  normalize_vat: {
9914
11077
  Args: {
9915
11078
  v: string;
9916
11079
  };
9917
11080
  Returns: string;
9918
11081
  };
11082
+ offer_recipient_matches: {
11083
+ Args: {
11084
+ _campaign_id: string;
11085
+ _customer_id: string;
11086
+ _recipient_id: string;
11087
+ };
11088
+ Returns: boolean;
11089
+ };
11090
+ order_number_prefix: {
11091
+ Args: {
11092
+ p_custom_fields?: Json;
11093
+ p_order_source: string;
11094
+ };
11095
+ Returns: string;
11096
+ };
9919
11097
  pickstation_get_orders_raw: {
9920
11098
  Args: never;
9921
11099
  Returns: Json;
9922
11100
  };
11101
+ pickstation_get_planning_context: {
11102
+ Args: never;
11103
+ Returns: Json;
11104
+ };
9923
11105
  pickstation_get_settings: {
9924
11106
  Args: never;
9925
11107
  Returns: Json;
@@ -9943,6 +11125,35 @@ export type Database = {
9943
11125
  };
9944
11126
  Returns: undefined;
9945
11127
  };
11128
+ promote_trade_item_key: {
11129
+ Args: {
11130
+ p_new: string;
11131
+ p_old: string;
11132
+ };
11133
+ Returns: undefined;
11134
+ };
11135
+ recompute_order_status: {
11136
+ Args: {
11137
+ p_order_id: string;
11138
+ };
11139
+ Returns: undefined;
11140
+ };
11141
+ recompute_reserved_for_order: {
11142
+ Args: {
11143
+ p_order_id: string;
11144
+ };
11145
+ Returns: undefined;
11146
+ };
11147
+ recompute_reserved_stock: {
11148
+ Args: {
11149
+ p_trade_item_key: string;
11150
+ };
11151
+ Returns: undefined;
11152
+ };
11153
+ refresh_external_customers_grouped: {
11154
+ Args: never;
11155
+ Returns: undefined;
11156
+ };
9946
11157
  refresh_floricode_derived_code_lists: {
9947
11158
  Args: never;
9948
11159
  Returns: {
@@ -9957,6 +11168,12 @@ export type Database = {
9957
11168
  };
9958
11169
  Returns: number;
9959
11170
  };
11171
+ refresh_floricode_derived_for_products: {
11172
+ Args: {
11173
+ _product_ids: string[];
11174
+ };
11175
+ Returns: number;
11176
+ };
9960
11177
  reset_floriday_sync_cursor: {
9961
11178
  Args: {
9962
11179
  p_connection_id: string;
@@ -9964,6 +11181,12 @@ export type Database = {
9964
11181
  };
9965
11182
  Returns: undefined;
9966
11183
  };
11184
+ resolve_product_id_for_item: {
11185
+ Args: {
11186
+ p_product_name: string;
11187
+ };
11188
+ Returns: string;
11189
+ };
9967
11190
  schedule_floriday_additional_services_sync: {
9968
11191
  Args: {
9969
11192
  p_apikey: string;
@@ -10241,6 +11464,24 @@ export type Database = {
10241
11464
  };
10242
11465
  Returns: string[];
10243
11466
  };
11467
+ sync_cached_packing_from_product: {
11468
+ Args: {
11469
+ p_product_id: string;
11470
+ };
11471
+ Returns: undefined;
11472
+ };
11473
+ sync_order_cart_item_packing_from_product: {
11474
+ Args: {
11475
+ p_product_id: string;
11476
+ };
11477
+ Returns: undefined;
11478
+ };
11479
+ sync_product_packing_from_floriday_cache: {
11480
+ Args: {
11481
+ p_floriday_id: string;
11482
+ };
11483
+ Returns: undefined;
11484
+ };
10244
11485
  twinfield_decrypt: {
10245
11486
  Args: {
10246
11487
  cipher: string;