@flowselections/floriday-verkoop-module 1.0.11 → 1.0.13

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 (69) hide show
  1. package/dist-lib/components/verkoop/AutoFulfillmentStatusCard.d.ts +4 -0
  2. package/dist-lib/components/verkoop/AutoFulfillmentStatusCard.d.ts.map +1 -0
  3. package/dist-lib/components/verkoop/AutoFulfillmentStatusCard.js +95 -0
  4. package/dist-lib/components/verkoop/CartAssignmentWizard.d.ts +6 -0
  5. package/dist-lib/components/verkoop/CartAssignmentWizard.d.ts.map +1 -0
  6. package/dist-lib/components/verkoop/CartAssignmentWizard.js +194 -0
  7. package/dist-lib/components/verkoop/CreateOrderPage.d.ts.map +1 -1
  8. package/dist-lib/components/verkoop/CreateOrderPage.js +230 -192
  9. package/dist-lib/components/verkoop/OrderAfleverbrievenCard.d.ts +4 -0
  10. package/dist-lib/components/verkoop/OrderAfleverbrievenCard.d.ts.map +1 -0
  11. package/dist-lib/components/verkoop/OrderAfleverbrievenCard.js +44 -0
  12. package/dist-lib/components/verkoop/OrderKarindelingCard.d.ts +5 -0
  13. package/dist-lib/components/verkoop/OrderKarindelingCard.d.ts.map +1 -0
  14. package/dist-lib/components/verkoop/OrderKarindelingCard.js +160 -0
  15. package/dist-lib/components/verkoop/SalesOrderDetailView.d.ts.map +1 -1
  16. package/dist-lib/components/verkoop/SalesOrderDetailView.js +6 -3
  17. package/dist-lib/components/verkoop/SalesOrdersTable.d.ts.map +1 -1
  18. package/dist-lib/components/verkoop/SalesOrdersTable.js +3 -4
  19. package/dist-lib/components/verkoop/SearchableSelect.d.ts +19 -0
  20. package/dist-lib/components/verkoop/SearchableSelect.d.ts.map +1 -0
  21. package/dist-lib/components/verkoop/SearchableSelect.js +21 -0
  22. package/dist-lib/components/verkoop/VerkoopOrdersPage.d.ts.map +1 -1
  23. package/dist-lib/components/verkoop/VerkoopOrdersPage.js +39 -3
  24. package/dist-lib/integrations/supabase/auth-middleware.d.ts +1381 -86
  25. package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
  26. package/dist-lib/integrations/supabase/client.d.ts +1381 -86
  27. package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
  28. package/dist-lib/integrations/supabase/client.server.d.ts +1381 -86
  29. package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
  30. package/dist-lib/integrations/supabase/types.d.ts +1402 -79
  31. package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
  32. package/dist-lib/lib/cart-lock.functions.d.ts +11225 -0
  33. package/dist-lib/lib/cart-lock.functions.d.ts.map +1 -0
  34. package/dist-lib/lib/cart-lock.functions.js +47 -0
  35. package/dist-lib/lib/cart-planner.d.ts +38 -0
  36. package/dist-lib/lib/cart-planner.d.ts.map +1 -0
  37. package/dist-lib/lib/cart-planner.js +217 -0
  38. package/dist-lib/lib/cart-replan.functions.d.ts +22467 -0
  39. package/dist-lib/lib/cart-replan.functions.d.ts.map +1 -0
  40. package/dist-lib/lib/cart-replan.functions.js +203 -0
  41. package/dist-lib/lib/create-order.functions.d.ts +100967 -0
  42. package/dist-lib/lib/create-order.functions.d.ts.map +1 -0
  43. package/dist-lib/lib/create-order.functions.js +343 -0
  44. package/dist-lib/lib/floriday-auto-fulfillment.functions.d.ts +33640 -0
  45. package/dist-lib/lib/floriday-auto-fulfillment.functions.d.ts.map +1 -0
  46. package/dist-lib/lib/floriday-auto-fulfillment.functions.js +65 -0
  47. package/dist-lib/lib/floriday-auto-fulfillment.server.d.ts +21 -0
  48. package/dist-lib/lib/floriday-auto-fulfillment.server.d.ts.map +1 -0
  49. package/dist-lib/lib/floriday-auto-fulfillment.server.js +352 -0
  50. package/dist-lib/lib/floriday-logistic-labels.functions.d.ts +11220 -0
  51. package/dist-lib/lib/floriday-logistic-labels.functions.d.ts.map +1 -0
  52. package/dist-lib/lib/floriday-logistic-labels.functions.js +171 -0
  53. package/dist-lib/lib/floriday-public.functions.d.ts +9067 -16
  54. package/dist-lib/lib/floriday-public.functions.d.ts.map +1 -1
  55. package/dist-lib/lib/floriday-public.functions.js +45 -47
  56. package/dist-lib/lib/floriday-writes.functions.d.ts +6475 -0
  57. package/dist-lib/lib/floriday-writes.functions.d.ts.map +1 -1
  58. package/dist-lib/lib/salesorders-mapping.d.ts +2 -0
  59. package/dist-lib/lib/salesorders-mapping.d.ts.map +1 -1
  60. package/dist-lib/lib/salesorders-mapping.js +46 -20
  61. package/dist-lib/lib/salesorders.functions.d.ts +4273 -388
  62. package/dist-lib/lib/salesorders.functions.d.ts.map +1 -1
  63. package/dist-lib/lib/salesorders.functions.js +8 -0
  64. package/dist-lib/lib/tradeitems.functions.d.ts +1381 -86
  65. package/dist-lib/lib/tradeitems.functions.d.ts.map +1 -1
  66. package/dist-lib/lib/useSalesOrdersQuery.d.ts +1 -0
  67. package/dist-lib/lib/useSalesOrdersQuery.d.ts.map +1 -1
  68. package/dist-lib/lib/useSalesOrdersQuery.js +130 -41
  69. package/package.json +1 -1
@@ -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;
@@ -730,6 +739,7 @@ export type Database = {
730
739
  notes: string | null;
731
740
  performed_at: string;
732
741
  rescheduled_count: number;
742
+ stock_consumed_at: string | null;
733
743
  total_carts: number;
734
744
  updated_at: string;
735
745
  user_id: string;
@@ -743,6 +753,7 @@ export type Database = {
743
753
  notes?: string | null;
744
754
  performed_at?: string;
745
755
  rescheduled_count?: number;
756
+ stock_consumed_at?: string | null;
746
757
  total_carts?: number;
747
758
  updated_at?: string;
748
759
  user_id: string;
@@ -756,6 +767,7 @@ export type Database = {
756
767
  notes?: string | null;
757
768
  performed_at?: string;
758
769
  rescheduled_count?: number;
770
+ stock_consumed_at?: string | null;
759
771
  total_carts?: number;
760
772
  updated_at?: string;
761
773
  user_id?: string;
@@ -837,6 +849,38 @@ export type Database = {
837
849
  };
838
850
  Relationships: [];
839
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
+ };
840
884
  collections: {
841
885
  Row: {
842
886
  created_at: string;
@@ -3018,34 +3062,52 @@ export type Database = {
3018
3062
  Row: {
3019
3063
  catalog_key: string | null;
3020
3064
  catalog_url: string;
3065
+ client_id: string | null;
3066
+ client_secret_ciphertext: string | null;
3067
+ client_secret_last4: string | null;
3021
3068
  created_at: string;
3022
3069
  id: number;
3023
3070
  last_meta: Json | null;
3024
3071
  last_test_at: string | null;
3025
3072
  last_test_error: string | null;
3026
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;
3027
3077
  updated_at: string;
3028
3078
  };
3029
3079
  Insert: {
3030
3080
  catalog_key?: string | null;
3031
3081
  catalog_url?: string;
3082
+ client_id?: string | null;
3083
+ client_secret_ciphertext?: string | null;
3084
+ client_secret_last4?: string | null;
3032
3085
  created_at?: string;
3033
3086
  id?: number;
3034
3087
  last_meta?: Json | null;
3035
3088
  last_test_at?: string | null;
3036
3089
  last_test_error?: string | null;
3037
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;
3038
3094
  updated_at?: string;
3039
3095
  };
3040
3096
  Update: {
3041
3097
  catalog_key?: string | null;
3042
3098
  catalog_url?: string;
3099
+ client_id?: string | null;
3100
+ client_secret_ciphertext?: string | null;
3101
+ client_secret_last4?: string | null;
3043
3102
  created_at?: string;
3044
3103
  id?: number;
3045
3104
  last_meta?: Json | null;
3046
3105
  last_test_at?: string | null;
3047
3106
  last_test_error?: string | null;
3048
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;
3049
3111
  updated_at?: string;
3050
3112
  };
3051
3113
  Relationships: [];
@@ -3286,6 +3348,56 @@ export type Database = {
3286
3348
  }
3287
3349
  ];
3288
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
+ };
3289
3401
  floriday_base_items_cache: {
3290
3402
  Row: {
3291
3403
  connection_id: string;
@@ -3716,6 +3828,51 @@ export type Database = {
3716
3828
  }
3717
3829
  ];
3718
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
+ };
3719
3876
  floriday_contract_trade_item_groups_cache: {
3720
3877
  Row: {
3721
3878
  connection_id: string;
@@ -4387,6 +4544,24 @@ export type Database = {
4387
4544
  }
4388
4545
  ];
4389
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
+ };
4390
4565
  floriday_resource_schemas: {
4391
4566
  Row: {
4392
4567
  enums: Json;
@@ -4828,6 +5003,62 @@ export type Database = {
4828
5003
  }
4829
5004
  ];
4830
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
+ };
4831
5062
  imap_accounts: {
4832
5063
  Row: {
4833
5064
  created_at: string;
@@ -5159,80 +5390,290 @@ export type Database = {
5159
5390
  };
5160
5391
  Relationships: [];
5161
5392
  };
5162
- locations: {
5393
+ local_customer_agreements: {
5163
5394
  Row: {
5395
+ base_price: number | null;
5164
5396
  created_at: string;
5397
+ currency: string;
5398
+ customer_id: string;
5165
5399
  id: string;
5166
- name: string;
5167
- 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;
5168
5405
  updated_at: string;
5406
+ valid_from: string | null;
5407
+ valid_until: string | null;
5169
5408
  };
5170
5409
  Insert: {
5410
+ base_price?: number | null;
5171
5411
  created_at?: string;
5412
+ currency?: string;
5413
+ customer_id: string;
5172
5414
  id?: string;
5173
- name: string;
5174
- 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;
5175
5420
  updated_at?: string;
5421
+ valid_from?: string | null;
5422
+ valid_until?: string | null;
5176
5423
  };
5177
5424
  Update: {
5425
+ base_price?: number | null;
5178
5426
  created_at?: string;
5427
+ currency?: string;
5428
+ customer_id?: string;
5179
5429
  id?: string;
5180
- name?: string;
5181
- 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;
5182
5435
  updated_at?: string;
5436
+ valid_from?: string | null;
5437
+ valid_until?: string | null;
5183
5438
  };
5184
- 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
+ ];
5185
5462
  };
5186
- mailbox_messages: {
5463
+ local_customer_price_groups: {
5187
5464
  Row: {
5188
- body_html: string | null;
5189
- body_text: string | null;
5190
- connection_id: string | null;
5191
5465
  created_at: string;
5192
- error_message: string | null;
5193
- external_id: string | null;
5194
- from_email: string | null;
5195
- from_name: string | null;
5466
+ currency: string;
5467
+ customer_id: string;
5468
+ discount_type: string;
5469
+ discount_value: number;
5196
5470
  id: string;
5197
- message_id: string | null;
5198
- profile_id: string | null;
5199
- raw_size: number | null;
5200
- received_at: string | null;
5201
- status: string;
5202
- subject: string | null;
5203
- uid: number | null;
5471
+ min_quantity: number;
5472
+ notes: string | null;
5473
+ product_category_id: string | null;
5474
+ product_id: string | null;
5204
5475
  updated_at: string;
5476
+ valid_from: string | null;
5477
+ valid_until: string | null;
5205
5478
  };
5206
5479
  Insert: {
5207
- body_html?: string | null;
5208
- body_text?: string | null;
5209
- connection_id?: string | null;
5210
5480
  created_at?: string;
5211
- error_message?: string | null;
5212
- external_id?: string | null;
5213
- from_email?: string | null;
5214
- from_name?: string | null;
5481
+ currency?: string;
5482
+ customer_id: string;
5483
+ discount_type: string;
5484
+ discount_value: number;
5215
5485
  id?: string;
5216
- message_id?: string | null;
5217
- profile_id?: string | null;
5218
- raw_size?: number | null;
5219
- received_at?: string | null;
5220
- status?: string;
5221
- subject?: string | null;
5222
- uid?: number | null;
5486
+ min_quantity?: number;
5487
+ notes?: string | null;
5488
+ product_category_id?: string | null;
5489
+ product_id?: string | null;
5223
5490
  updated_at?: string;
5491
+ valid_from?: string | null;
5492
+ valid_until?: string | null;
5224
5493
  };
5225
5494
  Update: {
5226
- body_html?: string | null;
5227
- body_text?: string | null;
5228
- connection_id?: string | null;
5229
5495
  created_at?: string;
5230
- error_message?: string | null;
5231
- external_id?: string | null;
5232
- from_email?: string | null;
5233
- from_name?: string | null;
5496
+ currency?: string;
5497
+ customer_id?: string;
5498
+ discount_type?: string;
5499
+ discount_value?: number;
5234
5500
  id?: string;
5235
- 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;
5236
5677
  profile_id?: string | null;
5237
5678
  raw_size?: number | null;
5238
5679
  received_at?: string | null;
@@ -5275,6 +5716,7 @@ export type Database = {
5275
5716
  matched_customer_id: string | null;
5276
5717
  message_id: string;
5277
5718
  notes: string | null;
5719
+ order_number: string | null;
5278
5720
  parsed_payload: Json | null;
5279
5721
  reviewed_at: string | null;
5280
5722
  reviewed_by: string | null;
@@ -5290,6 +5732,7 @@ export type Database = {
5290
5732
  matched_customer_id?: string | null;
5291
5733
  message_id: string;
5292
5734
  notes?: string | null;
5735
+ order_number?: string | null;
5293
5736
  parsed_payload?: Json | null;
5294
5737
  reviewed_at?: string | null;
5295
5738
  reviewed_by?: string | null;
@@ -5305,6 +5748,7 @@ export type Database = {
5305
5748
  matched_customer_id?: string | null;
5306
5749
  message_id?: string;
5307
5750
  notes?: string | null;
5751
+ order_number?: string | null;
5308
5752
  parsed_payload?: Json | null;
5309
5753
  reviewed_at?: string | null;
5310
5754
  reviewed_by?: string | null;
@@ -5685,6 +6129,281 @@ export type Database = {
5685
6129
  }
5686
6130
  ];
5687
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
+ };
5688
6407
  notifications: {
5689
6408
  Row: {
5690
6409
  created_at: string;
@@ -5916,6 +6635,7 @@ export type Database = {
5916
6635
  id: string;
5917
6636
  items: Json;
5918
6637
  notes: string | null;
6638
+ order_number: string | null;
5919
6639
  recipient_id: string;
5920
6640
  total_amount: number;
5921
6641
  };
@@ -5929,6 +6649,7 @@ export type Database = {
5929
6649
  id?: string;
5930
6650
  items?: Json;
5931
6651
  notes?: string | null;
6652
+ order_number?: string | null;
5932
6653
  recipient_id: string;
5933
6654
  total_amount?: number;
5934
6655
  };
@@ -5942,6 +6663,7 @@ export type Database = {
5942
6663
  id?: string;
5943
6664
  items?: Json;
5944
6665
  notes?: string | null;
6666
+ order_number?: string | null;
5945
6667
  recipient_id?: string;
5946
6668
  total_amount?: number;
5947
6669
  };
@@ -6109,6 +6831,9 @@ export type Database = {
6109
6831
  crates_per_layer: number;
6110
6832
  created_at: string;
6111
6833
  id: string;
6834
+ layer_fraction: number;
6835
+ layer_share_pct: number;
6836
+ layers_per_cart: number;
6112
6837
  order_item_id: string | null;
6113
6838
  plants_per_crate: number;
6114
6839
  product_id: string | null;
@@ -6120,6 +6845,9 @@ export type Database = {
6120
6845
  crates_per_layer?: number;
6121
6846
  created_at?: string;
6122
6847
  id?: string;
6848
+ layer_fraction?: number;
6849
+ layer_share_pct?: number;
6850
+ layers_per_cart?: number;
6123
6851
  order_item_id?: string | null;
6124
6852
  plants_per_crate?: number;
6125
6853
  product_id?: string | null;
@@ -6131,6 +6859,9 @@ export type Database = {
6131
6859
  crates_per_layer?: number;
6132
6860
  created_at?: string;
6133
6861
  id?: string;
6862
+ layer_fraction?: number;
6863
+ layer_share_pct?: number;
6864
+ layers_per_cart?: number;
6134
6865
  order_item_id?: string | null;
6135
6866
  plants_per_crate?: number;
6136
6867
  product_id?: string | null;
@@ -6162,33 +6893,45 @@ export type Database = {
6162
6893
  };
6163
6894
  order_carts: {
6164
6895
  Row: {
6896
+ algorithm_version: number;
6165
6897
  cart_number: number;
6166
6898
  created_at: string;
6167
6899
  id: string;
6168
6900
  is_auto: boolean;
6169
6901
  is_complete: boolean;
6170
6902
  notes: string | null;
6903
+ occupancy_pct: number;
6171
6904
  order_id: string;
6905
+ source: string;
6906
+ total_layers_used: number;
6172
6907
  updated_at: string;
6173
6908
  };
6174
6909
  Insert: {
6910
+ algorithm_version?: number;
6175
6911
  cart_number: number;
6176
6912
  created_at?: string;
6177
6913
  id?: string;
6178
6914
  is_auto?: boolean;
6179
6915
  is_complete?: boolean;
6180
6916
  notes?: string | null;
6917
+ occupancy_pct?: number;
6181
6918
  order_id: string;
6919
+ source?: string;
6920
+ total_layers_used?: number;
6182
6921
  updated_at?: string;
6183
6922
  };
6184
6923
  Update: {
6924
+ algorithm_version?: number;
6185
6925
  cart_number?: number;
6186
6926
  created_at?: string;
6187
6927
  id?: string;
6188
6928
  is_auto?: boolean;
6189
6929
  is_complete?: boolean;
6190
6930
  notes?: string | null;
6931
+ occupancy_pct?: number;
6191
6932
  order_id?: string;
6933
+ source?: string;
6934
+ total_layers_used?: number;
6192
6935
  updated_at?: string;
6193
6936
  };
6194
6937
  Relationships: [
@@ -6348,6 +7091,8 @@ export type Database = {
6348
7091
  order_date: string;
6349
7092
  order_number: string;
6350
7093
  order_source: string;
7094
+ plan_locked_at: string | null;
7095
+ plan_locked_ref: string | null;
6351
7096
  status: string;
6352
7097
  total: string;
6353
7098
  updated_at: string;
@@ -6364,6 +7109,8 @@ export type Database = {
6364
7109
  order_date?: string;
6365
7110
  order_number: string;
6366
7111
  order_source?: string;
7112
+ plan_locked_at?: string | null;
7113
+ plan_locked_ref?: string | null;
6367
7114
  status?: string;
6368
7115
  total?: string;
6369
7116
  updated_at?: string;
@@ -6380,6 +7127,8 @@ export type Database = {
6380
7127
  order_date?: string;
6381
7128
  order_number?: string;
6382
7129
  order_source?: string;
7130
+ plan_locked_at?: string | null;
7131
+ plan_locked_ref?: string | null;
6383
7132
  status?: string;
6384
7133
  total?: string;
6385
7134
  updated_at?: string;
@@ -6699,6 +7448,7 @@ export type Database = {
6699
7448
  purchase_price: number | null;
6700
7449
  quantity: number;
6701
7450
  sale_price: number | null;
7451
+ trade_item_key: string | null;
6702
7452
  unit: string;
6703
7453
  updated_at: string;
6704
7454
  weight: string | null;
@@ -6721,6 +7471,7 @@ export type Database = {
6721
7471
  purchase_price?: number | null;
6722
7472
  quantity?: number;
6723
7473
  sale_price?: number | null;
7474
+ trade_item_key?: string | null;
6724
7475
  unit?: string;
6725
7476
  updated_at?: string;
6726
7477
  weight?: string | null;
@@ -6743,6 +7494,7 @@ export type Database = {
6743
7494
  purchase_price?: number | null;
6744
7495
  quantity?: number;
6745
7496
  sale_price?: number | null;
7497
+ trade_item_key?: string | null;
6746
7498
  unit?: string;
6747
7499
  updated_at?: string;
6748
7500
  weight?: string | null;
@@ -6755,6 +7507,7 @@ export type Database = {
6755
7507
  display_name: string | null;
6756
7508
  email: string | null;
6757
7509
  id: string;
7510
+ is_superadmin: boolean;
6758
7511
  notification_preferences: Json;
6759
7512
  tenant_id: string | null;
6760
7513
  updated_at: string;
@@ -6764,6 +7517,7 @@ export type Database = {
6764
7517
  display_name?: string | null;
6765
7518
  email?: string | null;
6766
7519
  id: string;
7520
+ is_superadmin?: boolean;
6767
7521
  notification_preferences?: Json;
6768
7522
  tenant_id?: string | null;
6769
7523
  updated_at?: string;
@@ -6773,6 +7527,7 @@ export type Database = {
6773
7527
  display_name?: string | null;
6774
7528
  email?: string | null;
6775
7529
  id?: string;
7530
+ is_superadmin?: boolean;
6776
7531
  notification_preferences?: Json;
6777
7532
  tenant_id?: string | null;
6778
7533
  updated_at?: string;
@@ -7594,6 +8349,120 @@ export type Database = {
7594
8349
  };
7595
8350
  Relationships: [];
7596
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
+ };
8412
+ stock_mutation_log: {
8413
+ Row: {
8414
+ connection_id: string | null;
8415
+ created_at: string;
8416
+ created_by: string | null;
8417
+ id: string;
8418
+ mutation_type: string;
8419
+ order_id: string | null;
8420
+ order_item_id: string | null;
8421
+ order_source: string | null;
8422
+ physical_after: number | null;
8423
+ physical_before: number | null;
8424
+ qty_delta: number;
8425
+ reason: string | null;
8426
+ reserved_after: number | null;
8427
+ reserved_before: number | null;
8428
+ trade_item_key: string | null;
8429
+ };
8430
+ Insert: {
8431
+ connection_id?: string | null;
8432
+ created_at?: string;
8433
+ created_by?: string | null;
8434
+ id?: string;
8435
+ mutation_type: string;
8436
+ order_id?: string | null;
8437
+ order_item_id?: string | null;
8438
+ order_source?: string | null;
8439
+ physical_after?: number | null;
8440
+ physical_before?: number | null;
8441
+ qty_delta: number;
8442
+ reason?: string | null;
8443
+ reserved_after?: number | null;
8444
+ reserved_before?: number | null;
8445
+ trade_item_key?: string | null;
8446
+ };
8447
+ Update: {
8448
+ connection_id?: string | null;
8449
+ created_at?: string;
8450
+ created_by?: string | null;
8451
+ id?: string;
8452
+ mutation_type?: string;
8453
+ order_id?: string | null;
8454
+ order_item_id?: string | null;
8455
+ order_source?: string | null;
8456
+ physical_after?: number | null;
8457
+ physical_before?: number | null;
8458
+ qty_delta?: number;
8459
+ reason?: string | null;
8460
+ reserved_after?: number | null;
8461
+ reserved_before?: number | null;
8462
+ trade_item_key?: string | null;
8463
+ };
8464
+ Relationships: [];
8465
+ };
7597
8466
  supplier_products: {
7598
8467
  Row: {
7599
8468
  article_number: string | null;
@@ -7877,69 +8746,179 @@ export type Database = {
7877
8746
  floriday_link_error?: string | null;
7878
8747
  floriday_link_status?: string;
7879
8748
  id?: string;
7880
- last_floriday_sync_at?: string | null;
7881
- missing_required_fields?: string[];
7882
- source?: 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;
8840
+ created_at?: string;
8841
+ currency?: string | null;
8842
+ endpoint_family?: string | null;
8843
+ environment?: string | null;
8844
+ id?: 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;
7883
8855
  updated_at?: string;
7884
8856
  user_id: string;
8857
+ week?: number | null;
8858
+ year?: number | null;
7885
8859
  };
7886
8860
  Update: {
7887
- connection_id?: string | null;
8861
+ available_quantity?: number | null;
8862
+ connection_id?: string;
7888
8863
  created_at?: string;
7889
- data?: Json;
7890
- floriday_id?: string | null;
7891
- floriday_link_error?: string | null;
7892
- floriday_link_status?: string;
8864
+ currency?: string | null;
8865
+ endpoint_family?: string | null;
8866
+ environment?: string | null;
7893
8867
  id?: string;
7894
- last_floriday_sync_at?: string | null;
7895
- missing_required_fields?: string[];
7896
- 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;
7897
8878
  updated_at?: string;
7898
8879
  user_id?: string;
8880
+ week?: number | null;
8881
+ year?: number | null;
7899
8882
  };
7900
8883
  Relationships: [];
7901
8884
  };
7902
- trade_item_stock: {
8885
+ trade_item_warehouse_preferences: {
7903
8886
  Row: {
7904
8887
  connection_id: string;
7905
8888
  created_at: string;
7906
8889
  id: string;
7907
- incoming_stock: number;
7908
- minimum_stock: number;
7909
- notes: string | null;
7910
- physical_stock: number;
7911
- reserved_stock: number;
7912
- trade_item_key: string;
8890
+ trade_item_id: string;
7913
8891
  updated_at: string;
7914
- user_id: string;
8892
+ warehouse_id: string;
8893
+ warehouse_name: string | null;
7915
8894
  };
7916
8895
  Insert: {
7917
8896
  connection_id: string;
7918
8897
  created_at?: string;
7919
8898
  id?: string;
7920
- incoming_stock?: number;
7921
- minimum_stock?: number;
7922
- notes?: string | null;
7923
- physical_stock?: number;
7924
- reserved_stock?: number;
7925
- trade_item_key: string;
8899
+ trade_item_id: string;
7926
8900
  updated_at?: string;
7927
- user_id: string;
8901
+ warehouse_id: string;
8902
+ warehouse_name?: string | null;
7928
8903
  };
7929
8904
  Update: {
7930
8905
  connection_id?: string;
7931
8906
  created_at?: string;
7932
8907
  id?: string;
7933
- incoming_stock?: number;
7934
- minimum_stock?: number;
7935
- notes?: string | null;
7936
- physical_stock?: number;
7937
- reserved_stock?: number;
7938
- trade_item_key?: string;
8908
+ trade_item_id?: string;
7939
8909
  updated_at?: string;
7940
- user_id?: string;
8910
+ warehouse_id?: string;
8911
+ warehouse_name?: string | null;
7941
8912
  };
7942
- 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
+ ];
7943
8922
  };
7944
8923
  twinfield_connections: {
7945
8924
  Row: {
@@ -8266,6 +9245,10 @@ export type Database = {
8266
9245
  default_invoice_type: string;
8267
9246
  default_payment_term_days: number;
8268
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;
8269
9252
  updated_at: string;
8270
9253
  user_id: string;
8271
9254
  };
@@ -8275,6 +9258,10 @@ export type Database = {
8275
9258
  default_invoice_type?: string;
8276
9259
  default_payment_term_days?: number;
8277
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;
8278
9265
  updated_at?: string;
8279
9266
  user_id: string;
8280
9267
  };
@@ -8284,6 +9271,10 @@ export type Database = {
8284
9271
  default_invoice_type?: string;
8285
9272
  default_payment_term_days?: number;
8286
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;
8287
9278
  updated_at?: string;
8288
9279
  user_id?: string;
8289
9280
  };
@@ -9201,6 +10192,44 @@ export type Database = {
9201
10192
  };
9202
10193
  Relationships: [];
9203
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
+ };
9204
10233
  manufacture_product_possible_stock_view: {
9205
10234
  Row: {
9206
10235
  component_count: number | null;
@@ -9497,6 +10526,54 @@ export type Database = {
9497
10526
  };
9498
10527
  Returns: number;
9499
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
+ };
10555
+ apply_stock_consumption: {
10556
+ Args: {
10557
+ p_order_id: string;
10558
+ p_order_item_id: string;
10559
+ p_qty: number;
10560
+ p_reason: string;
10561
+ p_source: string;
10562
+ p_trade_item_key: string;
10563
+ };
10564
+ Returns: undefined;
10565
+ };
10566
+ apply_stock_reservation: {
10567
+ Args: {
10568
+ p_order_id: string;
10569
+ p_order_item_id: string;
10570
+ p_qty: number;
10571
+ p_reason: string;
10572
+ p_source: string;
10573
+ p_trade_item_key: string;
10574
+ };
10575
+ Returns: undefined;
10576
+ };
9500
10577
  assign_cart_numbers: {
9501
10578
  Args: {
9502
10579
  p_carts: Json;
@@ -9520,16 +10597,62 @@ export type Database = {
9520
10597
  order_number: string;
9521
10598
  }[];
9522
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
+ };
9523
10612
  call_exact_route: {
9524
10613
  Args: {
9525
10614
  path: string;
9526
10615
  };
9527
10616
  Returns: number;
9528
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
+ };
9529
10640
  cleanup_old_bookings: {
9530
10641
  Args: never;
9531
10642
  Returns: number;
9532
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
+ };
9533
10656
  control_get_todays_carts: {
9534
10657
  Args: never;
9535
10658
  Returns: {
@@ -9569,6 +10692,12 @@ export type Database = {
9569
10692
  table_name: string;
9570
10693
  }[];
9571
10694
  };
10695
+ dispatch_carrier_signups_sql: {
10696
+ Args: {
10697
+ _catchup?: string;
10698
+ };
10699
+ Returns: Json;
10700
+ };
9572
10701
  email_auth_decrypt: {
9573
10702
  Args: {
9574
10703
  cipher: string;
@@ -9604,6 +10733,18 @@ export type Database = {
9604
10733
  status: string;
9605
10734
  }[];
9606
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
+ };
9607
10748
  ensure_user_tenant: {
9608
10749
  Args: never;
9609
10750
  Returns: string;
@@ -9641,6 +10782,31 @@ export type Database = {
9641
10782
  };
9642
10783
  Returns: boolean;
9643
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
+ };
9644
10810
  format_cart_number: {
9645
10811
  Args: {
9646
10812
  p_pick_date: string;
@@ -9661,6 +10827,13 @@ export type Database = {
9661
10827
  preferred_warehouse_name: string;
9662
10828
  }[];
9663
10829
  };
10830
+ get_active_floriday_context: {
10831
+ Args: never;
10832
+ Returns: {
10833
+ connection_id: string;
10834
+ user_id: string;
10835
+ }[];
10836
+ };
9664
10837
  get_active_twinfield_public: {
9665
10838
  Args: never;
9666
10839
  Returns: {
@@ -9672,6 +10845,13 @@ export type Database = {
9672
10845
  office_code: string;
9673
10846
  }[];
9674
10847
  };
10848
+ get_floricode_record_counts: {
10849
+ Args: never;
10850
+ Returns: {
10851
+ count: number;
10852
+ resource: string;
10853
+ }[];
10854
+ };
9675
10855
  get_floriday_agreements_active: {
9676
10856
  Args: {
9677
10857
  p_on_date?: string;
@@ -9763,6 +10943,24 @@ export type Database = {
9763
10943
  };
9764
10944
  Returns: Json;
9765
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
+ };
9766
10964
  get_or_assign_floriday_order_number: {
9767
10965
  Args: {
9768
10966
  p_floriday_id: string;
@@ -9815,12 +11013,53 @@ export type Database = {
9815
11013
  Args: never;
9816
11014
  Returns: boolean;
9817
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
+ };
9818
11050
  next_order_number: {
9819
11051
  Args: {
9820
11052
  p_prefix: string;
9821
11053
  };
9822
11054
  Returns: string;
9823
11055
  };
11056
+ next_order_number_for_date: {
11057
+ Args: {
11058
+ p_created_at?: string;
11059
+ p_prefix: string;
11060
+ };
11061
+ Returns: string;
11062
+ };
9824
11063
  next_work_order_number: {
9825
11064
  Args: {
9826
11065
  p_parent_work_order_id?: string;
@@ -9828,16 +11067,41 @@ export type Database = {
9828
11067
  };
9829
11068
  Returns: string;
9830
11069
  };
11070
+ normalize_order_source: {
11071
+ Args: {
11072
+ p_src: string;
11073
+ };
11074
+ Returns: string;
11075
+ };
9831
11076
  normalize_vat: {
9832
11077
  Args: {
9833
11078
  v: string;
9834
11079
  };
9835
11080
  Returns: string;
9836
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
+ };
9837
11097
  pickstation_get_orders_raw: {
9838
11098
  Args: never;
9839
11099
  Returns: Json;
9840
11100
  };
11101
+ pickstation_get_planning_context: {
11102
+ Args: never;
11103
+ Returns: Json;
11104
+ };
9841
11105
  pickstation_get_settings: {
9842
11106
  Args: never;
9843
11107
  Returns: Json;
@@ -9861,6 +11125,35 @@ export type Database = {
9861
11125
  };
9862
11126
  Returns: undefined;
9863
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
+ };
9864
11157
  refresh_floricode_derived_code_lists: {
9865
11158
  Args: never;
9866
11159
  Returns: {
@@ -9875,6 +11168,12 @@ export type Database = {
9875
11168
  };
9876
11169
  Returns: number;
9877
11170
  };
11171
+ refresh_floricode_derived_for_products: {
11172
+ Args: {
11173
+ _product_ids: string[];
11174
+ };
11175
+ Returns: number;
11176
+ };
9878
11177
  reset_floriday_sync_cursor: {
9879
11178
  Args: {
9880
11179
  p_connection_id: string;
@@ -9882,6 +11181,12 @@ export type Database = {
9882
11181
  };
9883
11182
  Returns: undefined;
9884
11183
  };
11184
+ resolve_product_id_for_item: {
11185
+ Args: {
11186
+ p_product_name: string;
11187
+ };
11188
+ Returns: string;
11189
+ };
9885
11190
  schedule_floriday_additional_services_sync: {
9886
11191
  Args: {
9887
11192
  p_apikey: string;
@@ -10159,6 +11464,24 @@ export type Database = {
10159
11464
  };
10160
11465
  Returns: string[];
10161
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
+ };
10162
11485
  twinfield_decrypt: {
10163
11486
  Args: {
10164
11487
  cipher: string;