@flowselections/floriday-afhandeling-module 1.0.12 → 1.0.14

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 (80) hide show
  1. package/dist-lib/components/afhandeling/AutoProcessStatus.d.ts +12 -0
  2. package/dist-lib/components/afhandeling/AutoProcessStatus.d.ts.map +1 -0
  3. package/dist-lib/components/afhandeling/AutoProcessStatus.js +103 -0
  4. package/dist-lib/components/afhandeling/ControleLijstPrint.d.ts +3 -1
  5. package/dist-lib/components/afhandeling/ControleLijstPrint.d.ts.map +1 -1
  6. package/dist-lib/components/afhandeling/ControleLijstPrint.js +56 -17
  7. package/dist-lib/components/afhandeling/DagDetailDialog.d.ts.map +1 -1
  8. package/dist-lib/components/afhandeling/DagDetailDialog.js +96 -4
  9. package/dist-lib/components/afhandeling/LeveringenPage.js +1 -1
  10. package/dist-lib/components/afhandeling/VervoerdersPage.d.ts.map +1 -1
  11. package/dist-lib/components/afhandeling/VervoerdersPage.js +2 -1
  12. package/dist-lib/components/afhandeling/WeekAgendaView.d.ts +3 -1
  13. package/dist-lib/components/afhandeling/WeekAgendaView.d.ts.map +1 -1
  14. package/dist-lib/components/afhandeling/WeekAgendaView.js +58 -17
  15. package/dist-lib/components/pickstation/KioskControle.d.ts +2 -0
  16. package/dist-lib/components/pickstation/KioskControle.d.ts.map +1 -0
  17. package/dist-lib/components/pickstation/KioskControle.js +7 -0
  18. package/dist-lib/components/pickstation/PakbonTemplate.d.ts +2 -1
  19. package/dist-lib/components/pickstation/PakbonTemplate.d.ts.map +1 -1
  20. package/dist-lib/components/pickstation/PakbonTemplate.js +20 -17
  21. package/dist-lib/components/pickstation/PickstationPage.d.ts +2 -0
  22. package/dist-lib/components/pickstation/PickstationPage.d.ts.map +1 -0
  23. package/dist-lib/components/pickstation/PickstationPage.js +266 -0
  24. package/dist-lib/components/settings/AfhandelingSettingsCard.d.ts.map +1 -1
  25. package/dist-lib/components/settings/AfhandelingSettingsCard.js +14 -2
  26. package/dist-lib/hooks/useOrderPlanning.d.ts.map +1 -1
  27. package/dist-lib/hooks/useOrderPlanning.js +28 -11
  28. package/dist-lib/index.d.ts +4 -0
  29. package/dist-lib/index.d.ts.map +1 -1
  30. package/dist-lib/index.js +4 -0
  31. package/dist-lib/integrations/supabase/auth-middleware.d.ts +1243 -63
  32. package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
  33. package/dist-lib/integrations/supabase/client.d.ts +1243 -63
  34. package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
  35. package/dist-lib/integrations/supabase/client.server.d.ts +1243 -63
  36. package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
  37. package/dist-lib/integrations/supabase/types.d.ts +1264 -56
  38. package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
  39. package/dist-lib/lib/afhandelingSettings.functions.d.ts +2483 -111
  40. package/dist-lib/lib/afhandelingSettings.functions.d.ts.map +1 -1
  41. package/dist-lib/lib/afhandelingSettings.functions.js +28 -1
  42. package/dist-lib/lib/carrierPlanning.d.ts +25 -0
  43. package/dist-lib/lib/carrierPlanning.d.ts.map +1 -0
  44. package/dist-lib/lib/carrierPlanning.js +65 -0
  45. package/dist-lib/lib/carrierSignupMail.server.d.ts +0 -2
  46. package/dist-lib/lib/carrierSignupMail.server.d.ts.map +1 -1
  47. package/dist-lib/lib/carrierSignupMail.server.js +53 -216
  48. package/dist-lib/lib/carriers.functions.d.ts +5920 -20
  49. package/dist-lib/lib/carriers.functions.d.ts.map +1 -1
  50. package/dist-lib/lib/carriers.functions.js +5 -0
  51. package/dist-lib/lib/cartAssignments.functions.d.ts +5920 -20
  52. package/dist-lib/lib/cartAssignments.functions.d.ts.map +1 -1
  53. package/dist-lib/lib/cartControl.functions.d.ts +11843 -40
  54. package/dist-lib/lib/cartControl.functions.d.ts.map +1 -1
  55. package/dist-lib/lib/cartControl.functions.js +4 -1
  56. package/dist-lib/lib/cartRescheduling.d.ts.map +1 -1
  57. package/dist-lib/lib/cartRescheduling.js +8 -6
  58. package/dist-lib/lib/countries.d.ts +2 -0
  59. package/dist-lib/lib/countries.d.ts.map +1 -1
  60. package/dist-lib/lib/countries.js +51 -0
  61. package/dist-lib/lib/deliveryNotePrint.d.ts +26 -0
  62. package/dist-lib/lib/deliveryNotePrint.d.ts.map +1 -0
  63. package/dist-lib/lib/deliveryNotePrint.js +172 -0
  64. package/dist-lib/lib/floriday.functions.d.ts +1251 -63
  65. package/dist-lib/lib/floriday.functions.d.ts.map +1 -1
  66. package/dist-lib/lib/floriday.functions.js +126 -8
  67. package/dist-lib/lib/floridayAutoProcess.d.ts +30 -0
  68. package/dist-lib/lib/floridayAutoProcess.d.ts.map +1 -0
  69. package/dist-lib/lib/floridayAutoProcess.js +70 -0
  70. package/dist-lib/lib/pickstationI18n.d.ts +46 -0
  71. package/dist-lib/lib/pickstationI18n.d.ts.map +1 -1
  72. package/dist-lib/lib/pickstationI18n.js +251 -0
  73. package/dist-lib/lib/pickstationOrders.server.d.ts.map +1 -1
  74. package/dist-lib/lib/pickstationOrders.server.js +56 -19
  75. package/dist-lib/lib/pickstationTypes.d.ts +2 -0
  76. package/dist-lib/lib/pickstationTypes.d.ts.map +1 -1
  77. package/dist-lib/lib/planning.d.ts +34 -0
  78. package/dist-lib/lib/planning.d.ts.map +1 -1
  79. package/dist-lib/lib/planning.js +84 -0
  80. package/package.json +15 -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;
@@ -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;
@@ -7588,15 +8337,75 @@ export type Database = {
7588
8337
  name: string;
7589
8338
  };
7590
8339
  Update: {
7591
- capacity?: number;
7592
- color_code?: string | null;
8340
+ capacity?: number;
8341
+ color_code?: string | null;
8342
+ created_at?: string;
8343
+ description?: string | null;
8344
+ hourly_rate?: number;
8345
+ id?: string;
8346
+ image_url?: string | null;
8347
+ is_active?: boolean;
8348
+ name?: string;
8349
+ };
8350
+ Relationships: [];
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;
7593
8399
  created_at?: string;
7594
- description?: string | null;
7595
- hourly_rate?: number;
8400
+ created_rows?: number;
8401
+ errors?: Json;
8402
+ filename?: string | null;
7596
8403
  id?: string;
7597
- image_url?: string | null;
7598
- is_active?: boolean;
7599
- name?: string;
8404
+ mutations?: Json;
8405
+ skipped_rows?: number;
8406
+ total_rows?: number;
8407
+ updated_rows?: number;
8408
+ user_id?: string;
7600
8409
  };
7601
8410
  Relationships: [];
7602
8411
  };
@@ -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
  };
@@ -8001,6 +8810,116 @@ export type Database = {
8001
8810
  };
8002
8811
  Relationships: [];
8003
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;
8855
+ updated_at?: string;
8856
+ user_id: string;
8857
+ week?: number | null;
8858
+ year?: number | null;
8859
+ };
8860
+ Update: {
8861
+ available_quantity?: number | null;
8862
+ connection_id?: string;
8863
+ created_at?: string;
8864
+ currency?: string | null;
8865
+ endpoint_family?: string | null;
8866
+ environment?: string | null;
8867
+ id?: 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;
8878
+ updated_at?: string;
8879
+ user_id?: string;
8880
+ week?: number | null;
8881
+ year?: number | null;
8882
+ };
8883
+ Relationships: [];
8884
+ };
8885
+ trade_item_warehouse_preferences: {
8886
+ Row: {
8887
+ connection_id: string;
8888
+ created_at: string;
8889
+ id: string;
8890
+ trade_item_id: string;
8891
+ updated_at: string;
8892
+ warehouse_id: string;
8893
+ warehouse_name: string | null;
8894
+ };
8895
+ Insert: {
8896
+ connection_id: string;
8897
+ created_at?: string;
8898
+ id?: string;
8899
+ trade_item_id: string;
8900
+ updated_at?: string;
8901
+ warehouse_id: string;
8902
+ warehouse_name?: string | null;
8903
+ };
8904
+ Update: {
8905
+ connection_id?: string;
8906
+ created_at?: string;
8907
+ id?: string;
8908
+ trade_item_id?: string;
8909
+ updated_at?: string;
8910
+ warehouse_id?: string;
8911
+ warehouse_name?: string | null;
8912
+ };
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
+ ];
8922
+ };
8004
8923
  twinfield_connections: {
8005
8924
  Row: {
8006
8925
  access_token: string | null;
@@ -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;
@@ -9628,6 +10597,12 @@ export type Database = {
9628
10597
  order_number: string;
9629
10598
  }[];
9630
10599
  };
10600
+ autolink_product_to_floriday: {
10601
+ Args: {
10602
+ p_product_id: string;
10603
+ };
10604
+ Returns: string;
10605
+ };
9631
10606
  backfill_open_order_reservations: {
9632
10607
  Args: never;
9633
10608
  Returns: {
@@ -9640,10 +10615,44 @@ export type Database = {
9640
10615
  };
9641
10616
  Returns: number;
9642
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
+ };
9643
10640
  cleanup_old_bookings: {
9644
10641
  Args: never;
9645
10642
  Returns: number;
9646
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
+ };
9647
10656
  control_get_todays_carts: {
9648
10657
  Args: never;
9649
10658
  Returns: {
@@ -9724,6 +10733,18 @@ export type Database = {
9724
10733
  status: string;
9725
10734
  }[];
9726
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
+ };
9727
10748
  ensure_user_tenant: {
9728
10749
  Args: never;
9729
10750
  Returns: string;
@@ -9761,12 +10782,31 @@ export type Database = {
9761
10782
  };
9762
10783
  Returns: boolean;
9763
10784
  };
9764
- find_trade_item_key_by_name: {
10785
+ find_trade_item_key: {
9765
10786
  Args: {
10787
+ p_barcode: string;
9766
10788
  p_name: string;
10789
+ p_product_id: string;
9767
10790
  };
9768
10791
  Returns: string;
9769
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
+ };
9770
10810
  format_cart_number: {
9771
10811
  Args: {
9772
10812
  p_pick_date: string;
@@ -9787,6 +10827,13 @@ export type Database = {
9787
10827
  preferred_warehouse_name: string;
9788
10828
  }[];
9789
10829
  };
10830
+ get_active_floriday_context: {
10831
+ Args: never;
10832
+ Returns: {
10833
+ connection_id: string;
10834
+ user_id: string;
10835
+ }[];
10836
+ };
9790
10837
  get_active_twinfield_public: {
9791
10838
  Args: never;
9792
10839
  Returns: {
@@ -9798,6 +10845,13 @@ export type Database = {
9798
10845
  office_code: string;
9799
10846
  }[];
9800
10847
  };
10848
+ get_floricode_record_counts: {
10849
+ Args: never;
10850
+ Returns: {
10851
+ count: number;
10852
+ resource: string;
10853
+ }[];
10854
+ };
9801
10855
  get_floriday_agreements_active: {
9802
10856
  Args: {
9803
10857
  p_on_date?: string;
@@ -9889,6 +10943,24 @@ export type Database = {
9889
10943
  };
9890
10944
  Returns: Json;
9891
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
+ };
9892
10964
  get_or_assign_floriday_order_number: {
9893
10965
  Args: {
9894
10966
  p_floriday_id: string;
@@ -9941,12 +11013,53 @@ export type Database = {
9941
11013
  Args: never;
9942
11014
  Returns: boolean;
9943
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
+ };
9944
11050
  next_order_number: {
9945
11051
  Args: {
9946
11052
  p_prefix: string;
9947
11053
  };
9948
11054
  Returns: string;
9949
11055
  };
11056
+ next_order_number_for_date: {
11057
+ Args: {
11058
+ p_created_at?: string;
11059
+ p_prefix: string;
11060
+ };
11061
+ Returns: string;
11062
+ };
9950
11063
  next_work_order_number: {
9951
11064
  Args: {
9952
11065
  p_parent_work_order_id?: string;
@@ -9954,16 +11067,41 @@ export type Database = {
9954
11067
  };
9955
11068
  Returns: string;
9956
11069
  };
11070
+ normalize_order_source: {
11071
+ Args: {
11072
+ p_src: string;
11073
+ };
11074
+ Returns: string;
11075
+ };
9957
11076
  normalize_vat: {
9958
11077
  Args: {
9959
11078
  v: string;
9960
11079
  };
9961
11080
  Returns: string;
9962
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
+ };
9963
11097
  pickstation_get_orders_raw: {
9964
11098
  Args: never;
9965
11099
  Returns: Json;
9966
11100
  };
11101
+ pickstation_get_planning_context: {
11102
+ Args: never;
11103
+ Returns: Json;
11104
+ };
9967
11105
  pickstation_get_settings: {
9968
11106
  Args: never;
9969
11107
  Returns: Json;
@@ -9987,6 +11125,35 @@ export type Database = {
9987
11125
  };
9988
11126
  Returns: undefined;
9989
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
+ };
9990
11157
  refresh_floricode_derived_code_lists: {
9991
11158
  Args: never;
9992
11159
  Returns: {
@@ -10001,6 +11168,12 @@ export type Database = {
10001
11168
  };
10002
11169
  Returns: number;
10003
11170
  };
11171
+ refresh_floricode_derived_for_products: {
11172
+ Args: {
11173
+ _product_ids: string[];
11174
+ };
11175
+ Returns: number;
11176
+ };
10004
11177
  reset_floriday_sync_cursor: {
10005
11178
  Args: {
10006
11179
  p_connection_id: string;
@@ -10008,6 +11181,12 @@ export type Database = {
10008
11181
  };
10009
11182
  Returns: undefined;
10010
11183
  };
11184
+ resolve_product_id_for_item: {
11185
+ Args: {
11186
+ p_product_name: string;
11187
+ };
11188
+ Returns: string;
11189
+ };
10011
11190
  schedule_floriday_additional_services_sync: {
10012
11191
  Args: {
10013
11192
  p_apikey: string;
@@ -10285,6 +11464,24 @@ export type Database = {
10285
11464
  };
10286
11465
  Returns: string[];
10287
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
+ };
10288
11485
  twinfield_decrypt: {
10289
11486
  Args: {
10290
11487
  cipher: string;
@@ -10297,6 +11494,17 @@ export type Database = {
10297
11494
  };
10298
11495
  Returns: string;
10299
11496
  };
11497
+ upsert_auto_fulfillment_log: {
11498
+ Args: {
11499
+ p_connection_id: string;
11500
+ p_error?: string;
11501
+ p_fulfillment_order_id?: string;
11502
+ p_reason?: string;
11503
+ p_sales_order_id: string;
11504
+ p_status: string;
11505
+ };
11506
+ Returns: undefined;
11507
+ };
10300
11508
  };
10301
11509
  Enums: {
10302
11510
  app_role: "admin" | "manager" | "warehouse" | "sales" | "developer" | "receptie" | "monteur";