@flowselections/floriday-klanten-module 1.0.12 → 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 (43) hide show
  1. package/dist-lib/components/klanten/DiscountsTab.d.ts +4 -0
  2. package/dist-lib/components/klanten/DiscountsTab.d.ts.map +1 -0
  3. package/dist-lib/components/klanten/DiscountsTab.js +92 -0
  4. package/dist-lib/components/klanten/GroupedKlantDetail.d.ts.map +1 -1
  5. package/dist-lib/components/klanten/GroupedKlantDetail.js +4 -1
  6. package/dist-lib/components/klanten/KlantDetail.d.ts.map +1 -1
  7. package/dist-lib/components/klanten/KlantDetail.js +2 -1
  8. package/dist-lib/components/klanten/KlantenOverzicht.d.ts.map +1 -1
  9. package/dist-lib/components/klanten/KlantenOverzicht.js +83 -23
  10. package/dist-lib/components/klanten/LocalDiscountFormDialog.d.ts +10 -0
  11. package/dist-lib/components/klanten/LocalDiscountFormDialog.d.ts.map +1 -0
  12. package/dist-lib/components/klanten/LocalDiscountFormDialog.js +107 -0
  13. package/dist-lib/components/klanten/LocalDiscountsTab.d.ts +4 -0
  14. package/dist-lib/components/klanten/LocalDiscountsTab.d.ts.map +1 -0
  15. package/dist-lib/components/klanten/LocalDiscountsTab.js +101 -0
  16. package/dist-lib/integrations/supabase/auth-middleware.d.ts +1497 -43
  17. package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
  18. package/dist-lib/integrations/supabase/client.d.ts +1497 -43
  19. package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
  20. package/dist-lib/integrations/supabase/client.server.d.ts +1497 -43
  21. package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
  22. package/dist-lib/integrations/supabase/types.d.ts +1519 -39
  23. package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
  24. package/dist-lib/lib/accounting.functions.d.ts +4512 -150
  25. package/dist-lib/lib/accounting.functions.d.ts.map +1 -1
  26. package/dist-lib/lib/customer-analytics.functions.d.ts +1497 -43
  27. package/dist-lib/lib/customer-analytics.functions.d.ts.map +1 -1
  28. package/dist-lib/lib/customers.functions.d.ts +10178 -0
  29. package/dist-lib/lib/customers.functions.d.ts.map +1 -1
  30. package/dist-lib/lib/delivery-locations.functions.d.ts +5816 -0
  31. package/dist-lib/lib/delivery-locations.functions.d.ts.map +1 -1
  32. package/dist-lib/lib/external-customers.functions.d.ts +5816 -0
  33. package/dist-lib/lib/external-customers.functions.d.ts.map +1 -1
  34. package/dist-lib/lib/floriday-discounts.functions.d.ts +21974 -0
  35. package/dist-lib/lib/floriday-discounts.functions.d.ts.map +1 -0
  36. package/dist-lib/lib/floriday-discounts.functions.js +83 -0
  37. package/dist-lib/lib/local-discounts.functions.d.ts +76898 -0
  38. package/dist-lib/lib/local-discounts.functions.d.ts.map +1 -0
  39. package/dist-lib/lib/local-discounts.functions.js +185 -0
  40. package/dist-lib/lib/overdue-invoices.functions.d.ts +10984 -0
  41. package/dist-lib/lib/overdue-invoices.functions.d.ts.map +1 -0
  42. package/dist-lib/lib/overdue-invoices.functions.js +72 -0
  43. package/package.json +1 -1
@@ -10,10 +10,12 @@ export type Database = {
10
10
  afhandeling_settings: {
11
11
  Row: {
12
12
  created_at: string;
13
+ extra_pick_days_with_stickers: number;
13
14
  id: string;
14
15
  max_workdays_earlier_pick: number;
15
16
  pick_days_before_transport: number;
16
17
  pick_distribution_enabled: boolean;
18
+ pick_weekdays: number[];
17
19
  signup_mail_enabled: boolean;
18
20
  signup_mail_lead_minutes: number;
19
21
  signup_mail_purpose: string;
@@ -23,10 +25,12 @@ export type Database = {
23
25
  };
24
26
  Insert: {
25
27
  created_at?: string;
28
+ extra_pick_days_with_stickers?: number;
26
29
  id?: string;
27
30
  max_workdays_earlier_pick?: number;
28
31
  pick_days_before_transport?: number;
29
32
  pick_distribution_enabled?: boolean;
33
+ pick_weekdays?: number[];
30
34
  signup_mail_enabled?: boolean;
31
35
  signup_mail_lead_minutes?: number;
32
36
  signup_mail_purpose?: string;
@@ -36,10 +40,12 @@ export type Database = {
36
40
  };
37
41
  Update: {
38
42
  created_at?: string;
43
+ extra_pick_days_with_stickers?: number;
39
44
  id?: string;
40
45
  max_workdays_earlier_pick?: number;
41
46
  pick_days_before_transport?: number;
42
47
  pick_distribution_enabled?: boolean;
48
+ pick_weekdays?: number[];
43
49
  signup_mail_enabled?: boolean;
44
50
  signup_mail_lead_minutes?: number;
45
51
  signup_mail_purpose?: string;
@@ -458,6 +464,48 @@ export type Database = {
458
464
  }
459
465
  ];
460
466
  };
467
+ carrier_signup_dispatch_runs: {
468
+ Row: {
469
+ detail: Json | null;
470
+ error: string | null;
471
+ finished_at: string | null;
472
+ groups: number;
473
+ id: string;
474
+ ok: boolean;
475
+ reason: string | null;
476
+ sent: number;
477
+ skipped: Json;
478
+ started_at: string;
479
+ unassigned: Json;
480
+ };
481
+ Insert: {
482
+ detail?: Json | null;
483
+ error?: string | null;
484
+ finished_at?: string | null;
485
+ groups?: number;
486
+ id?: string;
487
+ ok?: boolean;
488
+ reason?: string | null;
489
+ sent?: number;
490
+ skipped?: Json;
491
+ started_at?: string;
492
+ unassigned?: Json;
493
+ };
494
+ Update: {
495
+ detail?: Json | null;
496
+ error?: string | null;
497
+ finished_at?: string | null;
498
+ groups?: number;
499
+ id?: string;
500
+ ok?: boolean;
501
+ reason?: string | null;
502
+ sent?: number;
503
+ skipped?: Json;
504
+ started_at?: string;
505
+ unassigned?: Json;
506
+ };
507
+ Relationships: [];
508
+ };
461
509
  carrier_signup_dispatches: {
462
510
  Row: {
463
511
  carrier_id: string;
@@ -511,6 +559,7 @@ export type Database = {
511
559
  contact_person: string | null;
512
560
  created_at: string;
513
561
  delivery_days: number | null;
562
+ delivery_weekdays: number[];
514
563
  email: string | null;
515
564
  id: string;
516
565
  is_default: boolean;
@@ -518,6 +567,7 @@ export type Database = {
518
567
  notes: string | null;
519
568
  phone: string | null;
520
569
  pickup_moments: Json;
570
+ pickup_weekdays: number[];
521
571
  service_cities: string[];
522
572
  service_countries: string[];
523
573
  service_provinces: string[];
@@ -533,6 +583,7 @@ export type Database = {
533
583
  contact_person?: string | null;
534
584
  created_at?: string;
535
585
  delivery_days?: number | null;
586
+ delivery_weekdays?: number[];
536
587
  email?: string | null;
537
588
  id?: string;
538
589
  is_default?: boolean;
@@ -540,6 +591,7 @@ export type Database = {
540
591
  notes?: string | null;
541
592
  phone?: string | null;
542
593
  pickup_moments?: Json;
594
+ pickup_weekdays?: number[];
543
595
  service_cities?: string[];
544
596
  service_countries?: string[];
545
597
  service_provinces?: string[];
@@ -555,6 +607,7 @@ export type Database = {
555
607
  contact_person?: string | null;
556
608
  created_at?: string;
557
609
  delivery_days?: number | null;
610
+ delivery_weekdays?: number[];
558
611
  email?: string | null;
559
612
  id?: string;
560
613
  is_default?: boolean;
@@ -562,6 +615,7 @@ export type Database = {
562
615
  notes?: string | null;
563
616
  phone?: string | null;
564
617
  pickup_moments?: Json;
618
+ pickup_weekdays?: number[];
565
619
  service_cities?: string[];
566
620
  service_countries?: string[];
567
621
  service_provinces?: string[];
@@ -574,6 +628,182 @@ export type Database = {
574
628
  };
575
629
  Relationships: [];
576
630
  };
631
+ cart_control_draft: {
632
+ Row: {
633
+ cart_states: Json;
634
+ checked_keys: Json;
635
+ draft_date: string;
636
+ form_state: Json;
637
+ notes: string;
638
+ updated_at: string;
639
+ user_id: string;
640
+ };
641
+ Insert: {
642
+ cart_states?: Json;
643
+ checked_keys?: Json;
644
+ draft_date: string;
645
+ form_state?: Json;
646
+ notes?: string;
647
+ updated_at?: string;
648
+ user_id: string;
649
+ };
650
+ Update: {
651
+ cart_states?: Json;
652
+ checked_keys?: Json;
653
+ draft_date?: string;
654
+ form_state?: Json;
655
+ notes?: string;
656
+ updated_at?: string;
657
+ user_id?: string;
658
+ };
659
+ Relationships: [];
660
+ };
661
+ cart_control_items: {
662
+ Row: {
663
+ action: string;
664
+ block_reason: string | null;
665
+ carrier_name: string | null;
666
+ cart_index: number;
667
+ cart_number_id: string | null;
668
+ cart_number_label: string | null;
669
+ created_at: string;
670
+ customer_name: string | null;
671
+ delivery_date: string | null;
672
+ id: string;
673
+ new_pick_date: string | null;
674
+ order_id: string;
675
+ order_number: string | null;
676
+ order_source: string;
677
+ pickup_date: string | null;
678
+ session_id: string;
679
+ };
680
+ Insert: {
681
+ action: string;
682
+ block_reason?: string | null;
683
+ carrier_name?: string | null;
684
+ cart_index: number;
685
+ cart_number_id?: string | null;
686
+ cart_number_label?: string | null;
687
+ created_at?: string;
688
+ customer_name?: string | null;
689
+ delivery_date?: string | null;
690
+ id?: string;
691
+ new_pick_date?: string | null;
692
+ order_id: string;
693
+ order_number?: string | null;
694
+ order_source: string;
695
+ pickup_date?: string | null;
696
+ session_id: string;
697
+ };
698
+ Update: {
699
+ action?: string;
700
+ block_reason?: string | null;
701
+ carrier_name?: string | null;
702
+ cart_index?: number;
703
+ cart_number_id?: string | null;
704
+ cart_number_label?: string | null;
705
+ created_at?: string;
706
+ customer_name?: string | null;
707
+ delivery_date?: string | null;
708
+ id?: string;
709
+ new_pick_date?: string | null;
710
+ order_id?: string;
711
+ order_number?: string | null;
712
+ order_source?: string;
713
+ pickup_date?: string | null;
714
+ session_id?: string;
715
+ };
716
+ Relationships: [
717
+ {
718
+ foreignKeyName: "cart_control_items_session_id_fkey";
719
+ columns: ["session_id"];
720
+ isOneToOne: false;
721
+ referencedRelation: "cart_control_sessions";
722
+ referencedColumns: ["id"];
723
+ }
724
+ ];
725
+ };
726
+ cart_control_sessions: {
727
+ Row: {
728
+ blocked_count: number;
729
+ checked_count: number;
730
+ control_date: string;
731
+ created_at: string;
732
+ id: string;
733
+ notes: string | null;
734
+ performed_at: string;
735
+ rescheduled_count: number;
736
+ stock_consumed_at: string | null;
737
+ total_carts: number;
738
+ updated_at: string;
739
+ user_id: string;
740
+ };
741
+ Insert: {
742
+ blocked_count?: number;
743
+ checked_count?: number;
744
+ control_date?: string;
745
+ created_at?: string;
746
+ id?: string;
747
+ notes?: string | null;
748
+ performed_at?: string;
749
+ rescheduled_count?: number;
750
+ stock_consumed_at?: string | null;
751
+ total_carts?: number;
752
+ updated_at?: string;
753
+ user_id: string;
754
+ };
755
+ Update: {
756
+ blocked_count?: number;
757
+ checked_count?: number;
758
+ control_date?: string;
759
+ created_at?: string;
760
+ id?: string;
761
+ notes?: string | null;
762
+ performed_at?: string;
763
+ rescheduled_count?: number;
764
+ stock_consumed_at?: string | null;
765
+ total_carts?: number;
766
+ updated_at?: string;
767
+ user_id?: string;
768
+ };
769
+ Relationships: [];
770
+ };
771
+ cart_numbers: {
772
+ Row: {
773
+ assigned_at: string;
774
+ cart_index: number;
775
+ cart_number: string;
776
+ day_seq: number;
777
+ id: string;
778
+ order_id: string;
779
+ order_source: string;
780
+ pick_date: string;
781
+ status: string;
782
+ };
783
+ Insert: {
784
+ assigned_at?: string;
785
+ cart_index: number;
786
+ cart_number: string;
787
+ day_seq: number;
788
+ id?: string;
789
+ order_id: string;
790
+ order_source: string;
791
+ pick_date: string;
792
+ status?: string;
793
+ };
794
+ Update: {
795
+ assigned_at?: string;
796
+ cart_index?: number;
797
+ cart_number?: string;
798
+ day_seq?: number;
799
+ id?: string;
800
+ order_id?: string;
801
+ order_source?: string;
802
+ pick_date?: string;
803
+ status?: string;
804
+ };
805
+ Relationships: [];
806
+ };
577
807
  cart_pick_overrides: {
578
808
  Row: {
579
809
  cart_index: number;
@@ -613,6 +843,38 @@ export type Database = {
613
843
  };
614
844
  Relationships: [];
615
845
  };
846
+ cart_replan_queue: {
847
+ Row: {
848
+ attempts: number;
849
+ last_error: string | null;
850
+ order_id: string;
851
+ processed_at: string | null;
852
+ requested_at: string;
853
+ };
854
+ Insert: {
855
+ attempts?: number;
856
+ last_error?: string | null;
857
+ order_id: string;
858
+ processed_at?: string | null;
859
+ requested_at?: string;
860
+ };
861
+ Update: {
862
+ attempts?: number;
863
+ last_error?: string | null;
864
+ order_id?: string;
865
+ processed_at?: string | null;
866
+ requested_at?: string;
867
+ };
868
+ Relationships: [
869
+ {
870
+ foreignKeyName: "cart_replan_queue_order_id_fkey";
871
+ columns: ["order_id"];
872
+ isOneToOne: true;
873
+ referencedRelation: "orders";
874
+ referencedColumns: ["id"];
875
+ }
876
+ ];
877
+ };
616
878
  collections: {
617
879
  Row: {
618
880
  created_at: string;
@@ -1266,6 +1528,54 @@ export type Database = {
1266
1528
  }
1267
1529
  ];
1268
1530
  };
1531
+ dashboard_critical_alerts: {
1532
+ Row: {
1533
+ alert_key: string;
1534
+ alert_type: string;
1535
+ created_at: string;
1536
+ description: string | null;
1537
+ id: string;
1538
+ metadata: Json | null;
1539
+ priority: string;
1540
+ raised_at: string;
1541
+ related_cart_ids: string[] | null;
1542
+ resolved_at: string | null;
1543
+ title: string;
1544
+ updated_at: string;
1545
+ user_id: string;
1546
+ };
1547
+ Insert: {
1548
+ alert_key: string;
1549
+ alert_type: string;
1550
+ created_at?: string;
1551
+ description?: string | null;
1552
+ id?: string;
1553
+ metadata?: Json | null;
1554
+ priority?: string;
1555
+ raised_at?: string;
1556
+ related_cart_ids?: string[] | null;
1557
+ resolved_at?: string | null;
1558
+ title: string;
1559
+ updated_at?: string;
1560
+ user_id: string;
1561
+ };
1562
+ Update: {
1563
+ alert_key?: string;
1564
+ alert_type?: string;
1565
+ created_at?: string;
1566
+ description?: string | null;
1567
+ id?: string;
1568
+ metadata?: Json | null;
1569
+ priority?: string;
1570
+ raised_at?: string;
1571
+ related_cart_ids?: string[] | null;
1572
+ resolved_at?: string | null;
1573
+ title?: string;
1574
+ updated_at?: string;
1575
+ user_id?: string;
1576
+ };
1577
+ Relationships: [];
1578
+ };
1269
1579
  dashboard_daily_reports: {
1270
1580
  Row: {
1271
1581
  created_at: string;
@@ -2746,34 +3056,52 @@ export type Database = {
2746
3056
  Row: {
2747
3057
  catalog_key: string | null;
2748
3058
  catalog_url: string;
3059
+ client_id: string | null;
3060
+ client_secret_ciphertext: string | null;
3061
+ client_secret_last4: string | null;
2749
3062
  created_at: string;
2750
3063
  id: number;
2751
3064
  last_meta: Json | null;
2752
3065
  last_test_at: string | null;
2753
3066
  last_test_error: string | null;
2754
3067
  last_test_ok: boolean | null;
3068
+ last_token_test_at: string | null;
3069
+ last_token_test_error: string | null;
3070
+ last_token_test_ok: boolean | null;
2755
3071
  updated_at: string;
2756
3072
  };
2757
3073
  Insert: {
2758
3074
  catalog_key?: string | null;
2759
3075
  catalog_url?: string;
3076
+ client_id?: string | null;
3077
+ client_secret_ciphertext?: string | null;
3078
+ client_secret_last4?: string | null;
2760
3079
  created_at?: string;
2761
3080
  id?: number;
2762
3081
  last_meta?: Json | null;
2763
3082
  last_test_at?: string | null;
2764
3083
  last_test_error?: string | null;
2765
3084
  last_test_ok?: boolean | null;
3085
+ last_token_test_at?: string | null;
3086
+ last_token_test_error?: string | null;
3087
+ last_token_test_ok?: boolean | null;
2766
3088
  updated_at?: string;
2767
3089
  };
2768
3090
  Update: {
2769
3091
  catalog_key?: string | null;
2770
3092
  catalog_url?: string;
3093
+ client_id?: string | null;
3094
+ client_secret_ciphertext?: string | null;
3095
+ client_secret_last4?: string | null;
2771
3096
  created_at?: string;
2772
3097
  id?: number;
2773
3098
  last_meta?: Json | null;
2774
3099
  last_test_at?: string | null;
2775
3100
  last_test_error?: string | null;
2776
3101
  last_test_ok?: boolean | null;
3102
+ last_token_test_at?: string | null;
3103
+ last_token_test_error?: string | null;
3104
+ last_token_test_ok?: boolean | null;
2777
3105
  updated_at?: string;
2778
3106
  };
2779
3107
  Relationships: [];
@@ -3444,6 +3772,51 @@ export type Database = {
3444
3772
  }
3445
3773
  ];
3446
3774
  };
3775
+ floriday_continuous_stock_queue: {
3776
+ Row: {
3777
+ attempts: number;
3778
+ connection_id: string;
3779
+ created_at: string;
3780
+ gateway_attempt_id: string | null;
3781
+ id: string;
3782
+ last_error: string | null;
3783
+ number_of_pieces: number;
3784
+ sent_at: string | null;
3785
+ status: string;
3786
+ trade_item_id: string;
3787
+ updated_at: string;
3788
+ user_id: string;
3789
+ };
3790
+ Insert: {
3791
+ attempts?: number;
3792
+ connection_id: string;
3793
+ created_at?: string;
3794
+ gateway_attempt_id?: string | null;
3795
+ id?: string;
3796
+ last_error?: string | null;
3797
+ number_of_pieces?: number;
3798
+ sent_at?: string | null;
3799
+ status?: string;
3800
+ trade_item_id: string;
3801
+ updated_at?: string;
3802
+ user_id: string;
3803
+ };
3804
+ Update: {
3805
+ attempts?: number;
3806
+ connection_id?: string;
3807
+ created_at?: string;
3808
+ gateway_attempt_id?: string | null;
3809
+ id?: string;
3810
+ last_error?: string | null;
3811
+ number_of_pieces?: number;
3812
+ sent_at?: string | null;
3813
+ status?: string;
3814
+ trade_item_id?: string;
3815
+ updated_at?: string;
3816
+ user_id?: string;
3817
+ };
3818
+ Relationships: [];
3819
+ };
3447
3820
  floriday_contract_trade_item_groups_cache: {
3448
3821
  Row: {
3449
3822
  connection_id: string;
@@ -4556,45 +4929,101 @@ export type Database = {
4556
4929
  }
4557
4930
  ];
4558
4931
  };
4559
- imap_accounts: {
4932
+ flow_role_assignments: {
4560
4933
  Row: {
4561
4934
  created_at: string;
4562
- email: string | null;
4563
- host: string;
4564
4935
  id: string;
4565
- is_active: boolean;
4566
- last_test_error: string | null;
4567
- last_test_ok: boolean | null;
4568
- last_tested_at: string | null;
4569
- name: string;
4570
- password: string | null;
4571
- password_secret_name: string | null;
4572
- port: number;
4573
- updated_at: string;
4574
- use_tls: boolean;
4575
- username: string;
4936
+ role_id: string;
4937
+ user_id: string;
4576
4938
  };
4577
4939
  Insert: {
4578
4940
  created_at?: string;
4579
- email?: string | null;
4580
- host: string;
4581
4941
  id?: string;
4582
- is_active?: boolean;
4583
- last_test_error?: string | null;
4584
- last_test_ok?: boolean | null;
4585
- last_tested_at?: string | null;
4586
- name: string;
4587
- password?: string | null;
4588
- password_secret_name?: string | null;
4589
- port?: number;
4590
- updated_at?: string;
4591
- use_tls?: boolean;
4592
- username: string;
4942
+ role_id: string;
4943
+ user_id: string;
4593
4944
  };
4594
4945
  Update: {
4595
4946
  created_at?: string;
4596
- email?: string | null;
4597
- host?: string;
4947
+ id?: string;
4948
+ role_id?: string;
4949
+ user_id?: string;
4950
+ };
4951
+ Relationships: [
4952
+ {
4953
+ foreignKeyName: "flow_role_assignments_role_id_fkey";
4954
+ columns: ["role_id"];
4955
+ isOneToOne: false;
4956
+ referencedRelation: "flow_roles";
4957
+ referencedColumns: ["id"];
4958
+ }
4959
+ ];
4960
+ };
4961
+ flow_roles: {
4962
+ Row: {
4963
+ created_at: string;
4964
+ description: string | null;
4965
+ id: string;
4966
+ module_access: string[];
4967
+ name: string;
4968
+ updated_at: string;
4969
+ };
4970
+ Insert: {
4971
+ created_at?: string;
4972
+ description?: string | null;
4973
+ id?: string;
4974
+ module_access?: string[];
4975
+ name: string;
4976
+ updated_at?: string;
4977
+ };
4978
+ Update: {
4979
+ created_at?: string;
4980
+ description?: string | null;
4981
+ id?: string;
4982
+ module_access?: string[];
4983
+ name?: string;
4984
+ updated_at?: string;
4985
+ };
4986
+ Relationships: [];
4987
+ };
4988
+ imap_accounts: {
4989
+ Row: {
4990
+ created_at: string;
4991
+ email: string | null;
4992
+ host: string;
4993
+ id: string;
4994
+ is_active: boolean;
4995
+ last_test_error: string | null;
4996
+ last_test_ok: boolean | null;
4997
+ last_tested_at: string | null;
4998
+ name: string;
4999
+ password: string | null;
5000
+ password_secret_name: string | null;
5001
+ port: number;
5002
+ updated_at: string;
5003
+ use_tls: boolean;
5004
+ username: string;
5005
+ };
5006
+ Insert: {
5007
+ created_at?: string;
5008
+ email?: string | null;
5009
+ host: string;
5010
+ id?: string;
5011
+ is_active?: boolean;
5012
+ last_test_error?: string | null;
5013
+ last_test_ok?: boolean | null;
5014
+ last_tested_at?: string | null;
5015
+ name: string;
5016
+ password?: string | null;
5017
+ password_secret_name?: string | null;
5018
+ port?: number;
5019
+ updated_at?: string;
5020
+ use_tls?: boolean;
5021
+ username: string;
5022
+ };
5023
+ Update: {
5024
+ created_at?: string;
5025
+ email?: string | null;
5026
+ host?: string;
4598
5027
  id?: string;
4599
5028
  is_active?: boolean;
4600
5029
  last_test_error?: string | null;
@@ -4887,6 +5316,216 @@ export type Database = {
4887
5316
  };
4888
5317
  Relationships: [];
4889
5318
  };
5319
+ local_customer_agreements: {
5320
+ Row: {
5321
+ base_price: number | null;
5322
+ created_at: string;
5323
+ currency: string;
5324
+ customer_id: string;
5325
+ id: string;
5326
+ min_quantity: number;
5327
+ net_price: number;
5328
+ notes: string | null;
5329
+ product_category_id: string | null;
5330
+ product_id: string | null;
5331
+ updated_at: string;
5332
+ valid_from: string | null;
5333
+ valid_until: string | null;
5334
+ };
5335
+ Insert: {
5336
+ base_price?: number | null;
5337
+ created_at?: string;
5338
+ currency?: string;
5339
+ customer_id: string;
5340
+ id?: string;
5341
+ min_quantity?: number;
5342
+ net_price: number;
5343
+ notes?: string | null;
5344
+ product_category_id?: string | null;
5345
+ product_id?: string | null;
5346
+ updated_at?: string;
5347
+ valid_from?: string | null;
5348
+ valid_until?: string | null;
5349
+ };
5350
+ Update: {
5351
+ base_price?: number | null;
5352
+ created_at?: string;
5353
+ currency?: string;
5354
+ customer_id?: string;
5355
+ id?: string;
5356
+ min_quantity?: number;
5357
+ net_price?: number;
5358
+ notes?: string | null;
5359
+ product_category_id?: string | null;
5360
+ product_id?: string | null;
5361
+ updated_at?: string;
5362
+ valid_from?: string | null;
5363
+ valid_until?: string | null;
5364
+ };
5365
+ Relationships: [
5366
+ {
5367
+ foreignKeyName: "local_customer_agreements_customer_id_fkey";
5368
+ columns: ["customer_id"];
5369
+ isOneToOne: false;
5370
+ referencedRelation: "customers";
5371
+ referencedColumns: ["id"];
5372
+ },
5373
+ {
5374
+ foreignKeyName: "local_customer_agreements_product_category_id_fkey";
5375
+ columns: ["product_category_id"];
5376
+ isOneToOne: false;
5377
+ referencedRelation: "product_categories";
5378
+ referencedColumns: ["id"];
5379
+ },
5380
+ {
5381
+ foreignKeyName: "local_customer_agreements_product_id_fkey";
5382
+ columns: ["product_id"];
5383
+ isOneToOne: false;
5384
+ referencedRelation: "products";
5385
+ referencedColumns: ["id"];
5386
+ }
5387
+ ];
5388
+ };
5389
+ local_customer_price_groups: {
5390
+ Row: {
5391
+ created_at: string;
5392
+ currency: string;
5393
+ customer_id: string;
5394
+ discount_type: string;
5395
+ discount_value: number;
5396
+ id: string;
5397
+ min_quantity: number;
5398
+ notes: string | null;
5399
+ product_category_id: string | null;
5400
+ product_id: string | null;
5401
+ updated_at: string;
5402
+ valid_from: string | null;
5403
+ valid_until: string | null;
5404
+ };
5405
+ Insert: {
5406
+ created_at?: string;
5407
+ currency?: string;
5408
+ customer_id: string;
5409
+ discount_type: string;
5410
+ discount_value: number;
5411
+ id?: string;
5412
+ min_quantity?: number;
5413
+ notes?: string | null;
5414
+ product_category_id?: string | null;
5415
+ product_id?: string | null;
5416
+ updated_at?: string;
5417
+ valid_from?: string | null;
5418
+ valid_until?: string | null;
5419
+ };
5420
+ Update: {
5421
+ created_at?: string;
5422
+ currency?: string;
5423
+ customer_id?: string;
5424
+ discount_type?: string;
5425
+ discount_value?: number;
5426
+ id?: string;
5427
+ min_quantity?: number;
5428
+ notes?: string | null;
5429
+ product_category_id?: string | null;
5430
+ product_id?: string | null;
5431
+ updated_at?: string;
5432
+ valid_from?: string | null;
5433
+ valid_until?: string | null;
5434
+ };
5435
+ Relationships: [
5436
+ {
5437
+ foreignKeyName: "local_customer_price_groups_customer_id_fkey";
5438
+ columns: ["customer_id"];
5439
+ isOneToOne: false;
5440
+ referencedRelation: "customers";
5441
+ referencedColumns: ["id"];
5442
+ },
5443
+ {
5444
+ foreignKeyName: "local_customer_price_groups_product_category_id_fkey";
5445
+ columns: ["product_category_id"];
5446
+ isOneToOne: false;
5447
+ referencedRelation: "product_categories";
5448
+ referencedColumns: ["id"];
5449
+ },
5450
+ {
5451
+ foreignKeyName: "local_customer_price_groups_product_id_fkey";
5452
+ columns: ["product_id"];
5453
+ isOneToOne: false;
5454
+ referencedRelation: "products";
5455
+ referencedColumns: ["id"];
5456
+ }
5457
+ ];
5458
+ };
5459
+ local_customer_sales_strategies: {
5460
+ Row: {
5461
+ created_at: string;
5462
+ currency: string;
5463
+ customer_id: string;
5464
+ discount_type: string;
5465
+ discount_value: number;
5466
+ id: string;
5467
+ min_quantity: number;
5468
+ notes: string | null;
5469
+ product_category_id: string | null;
5470
+ product_id: string | null;
5471
+ updated_at: string;
5472
+ valid_from: string | null;
5473
+ valid_until: string | null;
5474
+ };
5475
+ Insert: {
5476
+ created_at?: string;
5477
+ currency?: string;
5478
+ customer_id: string;
5479
+ discount_type: string;
5480
+ discount_value: number;
5481
+ id?: string;
5482
+ min_quantity?: number;
5483
+ notes?: string | null;
5484
+ product_category_id?: string | null;
5485
+ product_id?: string | null;
5486
+ updated_at?: string;
5487
+ valid_from?: string | null;
5488
+ valid_until?: string | null;
5489
+ };
5490
+ Update: {
5491
+ created_at?: string;
5492
+ currency?: string;
5493
+ customer_id?: string;
5494
+ discount_type?: string;
5495
+ discount_value?: number;
5496
+ id?: string;
5497
+ min_quantity?: number;
5498
+ notes?: string | null;
5499
+ product_category_id?: string | null;
5500
+ product_id?: string | null;
5501
+ updated_at?: string;
5502
+ valid_from?: string | null;
5503
+ valid_until?: string | null;
5504
+ };
5505
+ Relationships: [
5506
+ {
5507
+ foreignKeyName: "local_customer_sales_strategies_customer_id_fkey";
5508
+ columns: ["customer_id"];
5509
+ isOneToOne: false;
5510
+ referencedRelation: "customers";
5511
+ referencedColumns: ["id"];
5512
+ },
5513
+ {
5514
+ foreignKeyName: "local_customer_sales_strategies_product_category_id_fkey";
5515
+ columns: ["product_category_id"];
5516
+ isOneToOne: false;
5517
+ referencedRelation: "product_categories";
5518
+ referencedColumns: ["id"];
5519
+ },
5520
+ {
5521
+ foreignKeyName: "local_customer_sales_strategies_product_id_fkey";
5522
+ columns: ["product_id"];
5523
+ isOneToOne: false;
5524
+ referencedRelation: "products";
5525
+ referencedColumns: ["id"];
5526
+ }
5527
+ ];
5528
+ };
4890
5529
  locations: {
4891
5530
  Row: {
4892
5531
  created_at: string;
@@ -5003,6 +5642,7 @@ export type Database = {
5003
5642
  matched_customer_id: string | null;
5004
5643
  message_id: string;
5005
5644
  notes: string | null;
5645
+ order_number: string | null;
5006
5646
  parsed_payload: Json | null;
5007
5647
  reviewed_at: string | null;
5008
5648
  reviewed_by: string | null;
@@ -5018,6 +5658,7 @@ export type Database = {
5018
5658
  matched_customer_id?: string | null;
5019
5659
  message_id: string;
5020
5660
  notes?: string | null;
5661
+ order_number?: string | null;
5021
5662
  parsed_payload?: Json | null;
5022
5663
  reviewed_at?: string | null;
5023
5664
  reviewed_by?: string | null;
@@ -5033,6 +5674,7 @@ export type Database = {
5033
5674
  matched_customer_id?: string | null;
5034
5675
  message_id?: string;
5035
5676
  notes?: string | null;
5677
+ order_number?: string | null;
5036
5678
  parsed_payload?: Json | null;
5037
5679
  reviewed_at?: string | null;
5038
5680
  reviewed_by?: string | null;
@@ -5413,6 +6055,281 @@ export type Database = {
5413
6055
  }
5414
6056
  ];
5415
6057
  };
6058
+ nmbrs_component_mapping: {
6059
+ Row: {
6060
+ created_at: string;
6061
+ id: string;
6062
+ source_kind: string;
6063
+ source_value: string | null;
6064
+ updated_at: string;
6065
+ wage_code: string;
6066
+ };
6067
+ Insert: {
6068
+ created_at?: string;
6069
+ id?: string;
6070
+ source_kind: string;
6071
+ source_value?: string | null;
6072
+ updated_at?: string;
6073
+ wage_code: string;
6074
+ };
6075
+ Update: {
6076
+ created_at?: string;
6077
+ id?: string;
6078
+ source_kind?: string;
6079
+ source_value?: string | null;
6080
+ updated_at?: string;
6081
+ wage_code?: string;
6082
+ };
6083
+ Relationships: [
6084
+ {
6085
+ foreignKeyName: "nmbrs_component_mapping_wage_code_fkey";
6086
+ columns: ["wage_code"];
6087
+ isOneToOne: false;
6088
+ referencedRelation: "nmbrs_wage_components";
6089
+ referencedColumns: ["code"];
6090
+ }
6091
+ ];
6092
+ };
6093
+ nmbrs_employee_mapping: {
6094
+ Row: {
6095
+ active_from: string | null;
6096
+ active_to: string | null;
6097
+ contract_hours_per_week: number | null;
6098
+ created_at: string;
6099
+ hourly_wage: number | null;
6100
+ id: string;
6101
+ monteur_id: string;
6102
+ nmbrs_company_code: string | null;
6103
+ nmbrs_employee_number: string;
6104
+ updated_at: string;
6105
+ };
6106
+ Insert: {
6107
+ active_from?: string | null;
6108
+ active_to?: string | null;
6109
+ contract_hours_per_week?: number | null;
6110
+ created_at?: string;
6111
+ hourly_wage?: number | null;
6112
+ id?: string;
6113
+ monteur_id: string;
6114
+ nmbrs_company_code?: string | null;
6115
+ nmbrs_employee_number: string;
6116
+ updated_at?: string;
6117
+ };
6118
+ Update: {
6119
+ active_from?: string | null;
6120
+ active_to?: string | null;
6121
+ contract_hours_per_week?: number | null;
6122
+ created_at?: string;
6123
+ hourly_wage?: number | null;
6124
+ id?: string;
6125
+ monteur_id?: string;
6126
+ nmbrs_company_code?: string | null;
6127
+ nmbrs_employee_number?: string;
6128
+ updated_at?: string;
6129
+ };
6130
+ Relationships: [
6131
+ {
6132
+ foreignKeyName: "nmbrs_employee_mapping_monteur_id_fkey";
6133
+ columns: ["monteur_id"];
6134
+ isOneToOne: true;
6135
+ referencedRelation: "monteurs";
6136
+ referencedColumns: ["id"];
6137
+ }
6138
+ ];
6139
+ };
6140
+ nmbrs_export_lines: {
6141
+ Row: {
6142
+ amount: number;
6143
+ created_at: string;
6144
+ entry_date: string;
6145
+ hours: number;
6146
+ id: string;
6147
+ monteur_id: string;
6148
+ nmbrs_employee_number: string | null;
6149
+ notes: string | null;
6150
+ run_id: string;
6151
+ source_kind: string | null;
6152
+ source_ref_id: string | null;
6153
+ updated_at: string;
6154
+ wage_code: string;
6155
+ };
6156
+ Insert: {
6157
+ amount?: number;
6158
+ created_at?: string;
6159
+ entry_date: string;
6160
+ hours?: number;
6161
+ id?: string;
6162
+ monteur_id: string;
6163
+ nmbrs_employee_number?: string | null;
6164
+ notes?: string | null;
6165
+ run_id: string;
6166
+ source_kind?: string | null;
6167
+ source_ref_id?: string | null;
6168
+ updated_at?: string;
6169
+ wage_code: string;
6170
+ };
6171
+ Update: {
6172
+ amount?: number;
6173
+ created_at?: string;
6174
+ entry_date?: string;
6175
+ hours?: number;
6176
+ id?: string;
6177
+ monteur_id?: string;
6178
+ nmbrs_employee_number?: string | null;
6179
+ notes?: string | null;
6180
+ run_id?: string;
6181
+ source_kind?: string | null;
6182
+ source_ref_id?: string | null;
6183
+ updated_at?: string;
6184
+ wage_code?: string;
6185
+ };
6186
+ Relationships: [
6187
+ {
6188
+ foreignKeyName: "nmbrs_export_lines_monteur_id_fkey";
6189
+ columns: ["monteur_id"];
6190
+ isOneToOne: false;
6191
+ referencedRelation: "monteurs";
6192
+ referencedColumns: ["id"];
6193
+ },
6194
+ {
6195
+ foreignKeyName: "nmbrs_export_lines_run_id_fkey";
6196
+ columns: ["run_id"];
6197
+ isOneToOne: false;
6198
+ referencedRelation: "nmbrs_export_runs";
6199
+ referencedColumns: ["id"];
6200
+ },
6201
+ {
6202
+ foreignKeyName: "nmbrs_export_lines_wage_code_fkey";
6203
+ columns: ["wage_code"];
6204
+ isOneToOne: false;
6205
+ referencedRelation: "nmbrs_wage_components";
6206
+ referencedColumns: ["code"];
6207
+ }
6208
+ ];
6209
+ };
6210
+ nmbrs_export_runs: {
6211
+ Row: {
6212
+ created_at: string;
6213
+ file_name: string | null;
6214
+ generated_at: string;
6215
+ generated_by: string | null;
6216
+ id: string;
6217
+ notes: string | null;
6218
+ period_end: string;
6219
+ period_label: string;
6220
+ period_start: string;
6221
+ status: string;
6222
+ total_hours: number;
6223
+ total_lines: number;
6224
+ updated_at: string;
6225
+ };
6226
+ Insert: {
6227
+ created_at?: string;
6228
+ file_name?: string | null;
6229
+ generated_at?: string;
6230
+ generated_by?: string | null;
6231
+ id?: string;
6232
+ notes?: string | null;
6233
+ period_end: string;
6234
+ period_label: string;
6235
+ period_start: string;
6236
+ status?: string;
6237
+ total_hours?: number;
6238
+ total_lines?: number;
6239
+ updated_at?: string;
6240
+ };
6241
+ Update: {
6242
+ created_at?: string;
6243
+ file_name?: string | null;
6244
+ generated_at?: string;
6245
+ generated_by?: string | null;
6246
+ id?: string;
6247
+ notes?: string | null;
6248
+ period_end?: string;
6249
+ period_label?: string;
6250
+ period_start?: string;
6251
+ status?: string;
6252
+ total_hours?: number;
6253
+ total_lines?: number;
6254
+ updated_at?: string;
6255
+ };
6256
+ Relationships: [];
6257
+ };
6258
+ nmbrs_settings: {
6259
+ Row: {
6260
+ created_at: string;
6261
+ default_company_code: string | null;
6262
+ id: boolean;
6263
+ include_travel: boolean;
6264
+ overtime_threshold_daily: number;
6265
+ overtime_threshold_weekly: number;
6266
+ period_type: string;
6267
+ updated_at: string;
6268
+ updated_by: string | null;
6269
+ week_start_day: number;
6270
+ };
6271
+ Insert: {
6272
+ created_at?: string;
6273
+ default_company_code?: string | null;
6274
+ id?: boolean;
6275
+ include_travel?: boolean;
6276
+ overtime_threshold_daily?: number;
6277
+ overtime_threshold_weekly?: number;
6278
+ period_type?: string;
6279
+ updated_at?: string;
6280
+ updated_by?: string | null;
6281
+ week_start_day?: number;
6282
+ };
6283
+ Update: {
6284
+ created_at?: string;
6285
+ default_company_code?: string | null;
6286
+ id?: boolean;
6287
+ include_travel?: boolean;
6288
+ overtime_threshold_daily?: number;
6289
+ overtime_threshold_weekly?: number;
6290
+ period_type?: string;
6291
+ updated_at?: string;
6292
+ updated_by?: string | null;
6293
+ week_start_day?: number;
6294
+ };
6295
+ Relationships: [];
6296
+ };
6297
+ nmbrs_wage_components: {
6298
+ Row: {
6299
+ category: string;
6300
+ code: string;
6301
+ created_at: string;
6302
+ id: string;
6303
+ is_active: boolean;
6304
+ label: string;
6305
+ sort_order: number;
6306
+ unit: string;
6307
+ updated_at: string;
6308
+ };
6309
+ Insert: {
6310
+ category: string;
6311
+ code: string;
6312
+ created_at?: string;
6313
+ id?: string;
6314
+ is_active?: boolean;
6315
+ label: string;
6316
+ sort_order?: number;
6317
+ unit: string;
6318
+ updated_at?: string;
6319
+ };
6320
+ Update: {
6321
+ category?: string;
6322
+ code?: string;
6323
+ created_at?: string;
6324
+ id?: string;
6325
+ is_active?: boolean;
6326
+ label?: string;
6327
+ sort_order?: number;
6328
+ unit?: string;
6329
+ updated_at?: string;
6330
+ };
6331
+ Relationships: [];
6332
+ };
5416
6333
  notifications: {
5417
6334
  Row: {
5418
6335
  created_at: string;
@@ -5644,6 +6561,7 @@ export type Database = {
5644
6561
  id: string;
5645
6562
  items: Json;
5646
6563
  notes: string | null;
6564
+ order_number: string | null;
5647
6565
  recipient_id: string;
5648
6566
  total_amount: number;
5649
6567
  };
@@ -5657,6 +6575,7 @@ export type Database = {
5657
6575
  id?: string;
5658
6576
  items?: Json;
5659
6577
  notes?: string | null;
6578
+ order_number?: string | null;
5660
6579
  recipient_id: string;
5661
6580
  total_amount?: number;
5662
6581
  };
@@ -5670,6 +6589,7 @@ export type Database = {
5670
6589
  id?: string;
5671
6590
  items?: Json;
5672
6591
  notes?: string | null;
6592
+ order_number?: string | null;
5673
6593
  recipient_id?: string;
5674
6594
  total_amount?: number;
5675
6595
  };
@@ -5837,6 +6757,9 @@ export type Database = {
5837
6757
  crates_per_layer: number;
5838
6758
  created_at: string;
5839
6759
  id: string;
6760
+ layer_fraction: number;
6761
+ layer_share_pct: number;
6762
+ layers_per_cart: number;
5840
6763
  order_item_id: string | null;
5841
6764
  plants_per_crate: number;
5842
6765
  product_id: string | null;
@@ -5848,6 +6771,9 @@ export type Database = {
5848
6771
  crates_per_layer?: number;
5849
6772
  created_at?: string;
5850
6773
  id?: string;
6774
+ layer_fraction?: number;
6775
+ layer_share_pct?: number;
6776
+ layers_per_cart?: number;
5851
6777
  order_item_id?: string | null;
5852
6778
  plants_per_crate?: number;
5853
6779
  product_id?: string | null;
@@ -5859,6 +6785,9 @@ export type Database = {
5859
6785
  crates_per_layer?: number;
5860
6786
  created_at?: string;
5861
6787
  id?: string;
6788
+ layer_fraction?: number;
6789
+ layer_share_pct?: number;
6790
+ layers_per_cart?: number;
5862
6791
  order_item_id?: string | null;
5863
6792
  plants_per_crate?: number;
5864
6793
  product_id?: string | null;
@@ -5890,33 +6819,45 @@ export type Database = {
5890
6819
  };
5891
6820
  order_carts: {
5892
6821
  Row: {
6822
+ algorithm_version: number;
5893
6823
  cart_number: number;
5894
6824
  created_at: string;
5895
6825
  id: string;
5896
6826
  is_auto: boolean;
5897
6827
  is_complete: boolean;
5898
6828
  notes: string | null;
6829
+ occupancy_pct: number;
5899
6830
  order_id: string;
6831
+ source: string;
6832
+ total_layers_used: number;
5900
6833
  updated_at: string;
5901
6834
  };
5902
6835
  Insert: {
6836
+ algorithm_version?: number;
5903
6837
  cart_number: number;
5904
6838
  created_at?: string;
5905
6839
  id?: string;
5906
6840
  is_auto?: boolean;
5907
6841
  is_complete?: boolean;
5908
6842
  notes?: string | null;
6843
+ occupancy_pct?: number;
5909
6844
  order_id: string;
6845
+ source?: string;
6846
+ total_layers_used?: number;
5910
6847
  updated_at?: string;
5911
6848
  };
5912
6849
  Update: {
6850
+ algorithm_version?: number;
5913
6851
  cart_number?: number;
5914
6852
  created_at?: string;
5915
6853
  id?: string;
5916
6854
  is_auto?: boolean;
5917
6855
  is_complete?: boolean;
5918
6856
  notes?: string | null;
6857
+ occupancy_pct?: number;
5919
6858
  order_id?: string;
6859
+ source?: string;
6860
+ total_layers_used?: number;
5920
6861
  updated_at?: string;
5921
6862
  };
5922
6863
  Relationships: [
@@ -6427,6 +7368,7 @@ export type Database = {
6427
7368
  purchase_price: number | null;
6428
7369
  quantity: number;
6429
7370
  sale_price: number | null;
7371
+ trade_item_key: string | null;
6430
7372
  unit: string;
6431
7373
  updated_at: string;
6432
7374
  weight: string | null;
@@ -6449,6 +7391,7 @@ export type Database = {
6449
7391
  purchase_price?: number | null;
6450
7392
  quantity?: number;
6451
7393
  sale_price?: number | null;
7394
+ trade_item_key?: string | null;
6452
7395
  unit?: string;
6453
7396
  updated_at?: string;
6454
7397
  weight?: string | null;
@@ -6471,6 +7414,7 @@ export type Database = {
6471
7414
  purchase_price?: number | null;
6472
7415
  quantity?: number;
6473
7416
  sale_price?: number | null;
7417
+ trade_item_key?: string | null;
6474
7418
  unit?: string;
6475
7419
  updated_at?: string;
6476
7420
  weight?: string | null;
@@ -6483,6 +7427,7 @@ export type Database = {
6483
7427
  display_name: string | null;
6484
7428
  email: string | null;
6485
7429
  id: string;
7430
+ is_superadmin: boolean;
6486
7431
  notification_preferences: Json;
6487
7432
  tenant_id: string | null;
6488
7433
  updated_at: string;
@@ -6492,6 +7437,7 @@ export type Database = {
6492
7437
  display_name?: string | null;
6493
7438
  email?: string | null;
6494
7439
  id: string;
7440
+ is_superadmin?: boolean;
6495
7441
  notification_preferences?: Json;
6496
7442
  tenant_id?: string | null;
6497
7443
  updated_at?: string;
@@ -6501,6 +7447,7 @@ export type Database = {
6501
7447
  display_name?: string | null;
6502
7448
  email?: string | null;
6503
7449
  id?: string;
7450
+ is_superadmin?: boolean;
6504
7451
  notification_preferences?: Json;
6505
7452
  tenant_id?: string | null;
6506
7453
  updated_at?: string;
@@ -7305,20 +8252,134 @@ export type Database = {
7305
8252
  description?: string | null;
7306
8253
  hourly_rate?: number;
7307
8254
  id?: string;
7308
- image_url?: string | null;
7309
- is_active?: boolean;
7310
- name: string;
8255
+ image_url?: string | null;
8256
+ is_active?: boolean;
8257
+ name: string;
8258
+ };
8259
+ Update: {
8260
+ capacity?: number;
8261
+ color_code?: string | null;
8262
+ created_at?: string;
8263
+ description?: string | null;
8264
+ hourly_rate?: number;
8265
+ id?: string;
8266
+ image_url?: string | null;
8267
+ is_active?: boolean;
8268
+ name?: string;
8269
+ };
8270
+ Relationships: [];
8271
+ };
8272
+ sidebar_config: {
8273
+ Row: {
8274
+ id: string;
8275
+ module_order: string[];
8276
+ updated_at: string;
8277
+ };
8278
+ Insert: {
8279
+ id?: string;
8280
+ module_order?: string[];
8281
+ updated_at?: string;
8282
+ };
8283
+ Update: {
8284
+ id?: string;
8285
+ module_order?: string[];
8286
+ updated_at?: string;
8287
+ };
8288
+ Relationships: [];
8289
+ };
8290
+ stock_import_runs: {
8291
+ Row: {
8292
+ connection_id: string | null;
8293
+ created_at: string;
8294
+ created_rows: number;
8295
+ errors: Json;
8296
+ filename: string | null;
8297
+ id: string;
8298
+ mutations: Json;
8299
+ skipped_rows: number;
8300
+ total_rows: number;
8301
+ updated_rows: number;
8302
+ user_id: string;
8303
+ };
8304
+ Insert: {
8305
+ connection_id?: string | null;
8306
+ created_at?: string;
8307
+ created_rows?: number;
8308
+ errors?: Json;
8309
+ filename?: string | null;
8310
+ id?: string;
8311
+ mutations?: Json;
8312
+ skipped_rows?: number;
8313
+ total_rows?: number;
8314
+ updated_rows?: number;
8315
+ user_id: string;
8316
+ };
8317
+ Update: {
8318
+ connection_id?: string | null;
8319
+ created_at?: string;
8320
+ created_rows?: number;
8321
+ errors?: Json;
8322
+ filename?: string | null;
8323
+ id?: string;
8324
+ mutations?: Json;
8325
+ skipped_rows?: number;
8326
+ total_rows?: number;
8327
+ updated_rows?: number;
8328
+ user_id?: string;
8329
+ };
8330
+ Relationships: [];
8331
+ };
8332
+ stock_mutation_log: {
8333
+ Row: {
8334
+ connection_id: string | null;
8335
+ created_at: string;
8336
+ created_by: string | null;
8337
+ id: string;
8338
+ mutation_type: string;
8339
+ order_id: string | null;
8340
+ order_item_id: string | null;
8341
+ order_source: string | null;
8342
+ physical_after: number | null;
8343
+ physical_before: number | null;
8344
+ qty_delta: number;
8345
+ reason: string | null;
8346
+ reserved_after: number | null;
8347
+ reserved_before: number | null;
8348
+ trade_item_key: string | null;
8349
+ };
8350
+ Insert: {
8351
+ connection_id?: string | null;
8352
+ created_at?: string;
8353
+ created_by?: string | null;
8354
+ id?: string;
8355
+ mutation_type: string;
8356
+ order_id?: string | null;
8357
+ order_item_id?: string | null;
8358
+ order_source?: string | null;
8359
+ physical_after?: number | null;
8360
+ physical_before?: number | null;
8361
+ qty_delta: number;
8362
+ reason?: string | null;
8363
+ reserved_after?: number | null;
8364
+ reserved_before?: number | null;
8365
+ trade_item_key?: string | null;
7311
8366
  };
7312
8367
  Update: {
7313
- capacity?: number;
7314
- color_code?: string | null;
8368
+ connection_id?: string | null;
7315
8369
  created_at?: string;
7316
- description?: string | null;
7317
- hourly_rate?: number;
8370
+ created_by?: string | null;
7318
8371
  id?: string;
7319
- image_url?: string | null;
7320
- is_active?: boolean;
7321
- name?: string;
8372
+ mutation_type?: string;
8373
+ order_id?: string | null;
8374
+ order_item_id?: string | null;
8375
+ order_source?: string | null;
8376
+ physical_after?: number | null;
8377
+ physical_before?: number | null;
8378
+ qty_delta?: number;
8379
+ reason?: string | null;
8380
+ reserved_after?: number | null;
8381
+ reserved_before?: number | null;
8382
+ trade_item_key?: string | null;
7322
8383
  };
7323
8384
  Relationships: [];
7324
8385
  };
@@ -7587,7 +8648,13 @@ export type Database = {
7587
8648
  connection_id: string | null;
7588
8649
  created_at: string;
7589
8650
  data: Json;
8651
+ floriday_id: string | null;
8652
+ floriday_link_error: string | null;
8653
+ floriday_link_status: string;
7590
8654
  id: string;
8655
+ last_floriday_sync_at: string | null;
8656
+ missing_required_fields: string[];
8657
+ source: string;
7591
8658
  updated_at: string;
7592
8659
  user_id: string;
7593
8660
  };
@@ -7595,7 +8662,13 @@ export type Database = {
7595
8662
  connection_id?: string | null;
7596
8663
  created_at?: string;
7597
8664
  data?: Json;
8665
+ floriday_id?: string | null;
8666
+ floriday_link_error?: string | null;
8667
+ floriday_link_status?: string;
7598
8668
  id?: string;
8669
+ last_floriday_sync_at?: string | null;
8670
+ missing_required_fields?: string[];
8671
+ source?: string;
7599
8672
  updated_at?: string;
7600
8673
  user_id: string;
7601
8674
  };
@@ -7603,7 +8676,13 @@ export type Database = {
7603
8676
  connection_id?: string | null;
7604
8677
  created_at?: string;
7605
8678
  data?: Json;
8679
+ floriday_id?: string | null;
8680
+ floriday_link_error?: string | null;
8681
+ floriday_link_status?: string;
7606
8682
  id?: string;
8683
+ last_floriday_sync_at?: string | null;
8684
+ missing_required_fields?: string[];
8685
+ source?: string;
7607
8686
  updated_at?: string;
7608
8687
  user_id?: string;
7609
8688
  };
@@ -7976,6 +9055,10 @@ export type Database = {
7976
9055
  default_invoice_type: string;
7977
9056
  default_payment_term_days: number;
7978
9057
  default_vat_code: string;
9058
+ invoice_enabled_ao: boolean;
9059
+ invoice_enabled_fo: boolean;
9060
+ invoice_enabled_ho: boolean;
9061
+ invoice_enabled_mo: boolean;
7979
9062
  updated_at: string;
7980
9063
  user_id: string;
7981
9064
  };
@@ -7985,6 +9068,10 @@ export type Database = {
7985
9068
  default_invoice_type?: string;
7986
9069
  default_payment_term_days?: number;
7987
9070
  default_vat_code?: string;
9071
+ invoice_enabled_ao?: boolean;
9072
+ invoice_enabled_fo?: boolean;
9073
+ invoice_enabled_ho?: boolean;
9074
+ invoice_enabled_mo?: boolean;
7988
9075
  updated_at?: string;
7989
9076
  user_id: string;
7990
9077
  };
@@ -7994,6 +9081,10 @@ export type Database = {
7994
9081
  default_invoice_type?: string;
7995
9082
  default_payment_term_days?: number;
7996
9083
  default_vat_code?: string;
9084
+ invoice_enabled_ao?: boolean;
9085
+ invoice_enabled_fo?: boolean;
9086
+ invoice_enabled_ho?: boolean;
9087
+ invoice_enabled_mo?: boolean;
7997
9088
  updated_at?: string;
7998
9089
  user_id?: string;
7999
9090
  };
@@ -8001,6 +9092,7 @@ export type Database = {
8001
9092
  };
8002
9093
  twinfield_invoice_sync_logs: {
8003
9094
  Row: {
9095
+ action_type: string | null;
8004
9096
  created_at: string;
8005
9097
  details: Json | null;
8006
9098
  duration_ms: number | null;
@@ -8013,6 +9105,7 @@ export type Database = {
8013
9105
  user_id: string;
8014
9106
  };
8015
9107
  Insert: {
9108
+ action_type?: string | null;
8016
9109
  created_at?: string;
8017
9110
  details?: Json | null;
8018
9111
  duration_ms?: number | null;
@@ -8025,6 +9118,7 @@ export type Database = {
8025
9118
  user_id: string;
8026
9119
  };
8027
9120
  Update: {
9121
+ action_type?: string | null;
8028
9122
  created_at?: string;
8029
9123
  details?: Json | null;
8030
9124
  duration_ms?: number | null;
@@ -8264,6 +9358,57 @@ export type Database = {
8264
9358
  }
8265
9359
  ];
8266
9360
  };
9361
+ twinfield_request_metrics: {
9362
+ Row: {
9363
+ bucket_hour: string;
9364
+ connection_id: string;
9365
+ error_count: number;
9366
+ rate_limited_count: number;
9367
+ request_count: number;
9368
+ updated_at: string;
9369
+ };
9370
+ Insert: {
9371
+ bucket_hour: string;
9372
+ connection_id: string;
9373
+ error_count?: number;
9374
+ rate_limited_count?: number;
9375
+ request_count?: number;
9376
+ updated_at?: string;
9377
+ };
9378
+ Update: {
9379
+ bucket_hour?: string;
9380
+ connection_id?: string;
9381
+ error_count?: number;
9382
+ rate_limited_count?: number;
9383
+ request_count?: number;
9384
+ updated_at?: string;
9385
+ };
9386
+ Relationships: [];
9387
+ };
9388
+ twinfield_session_cache: {
9389
+ Row: {
9390
+ cluster: string;
9391
+ created_at: string;
9392
+ expires_at: string;
9393
+ session_id: string;
9394
+ user_id: string;
9395
+ };
9396
+ Insert: {
9397
+ cluster: string;
9398
+ created_at?: string;
9399
+ expires_at: string;
9400
+ session_id: string;
9401
+ user_id: string;
9402
+ };
9403
+ Update: {
9404
+ cluster?: string;
9405
+ created_at?: string;
9406
+ expires_at?: string;
9407
+ session_id?: string;
9408
+ user_id?: string;
9409
+ };
9410
+ Relationships: [];
9411
+ };
8267
9412
  twinfield_settings: {
8268
9413
  Row: {
8269
9414
  active_environment: string;
@@ -8857,6 +10002,44 @@ export type Database = {
8857
10002
  };
8858
10003
  Relationships: [];
8859
10004
  };
10005
+ floriday_customer_discounts: {
10006
+ Row: {
10007
+ base_price: number | null;
10008
+ buyer_organization_id: string | null;
10009
+ currency: string | null;
10010
+ discount_type: string | null;
10011
+ discount_value: number | null;
10012
+ min_quantity: number | null;
10013
+ net_price: number | null;
10014
+ product_group_id: string | null;
10015
+ raw: Json | null;
10016
+ source: string | null;
10017
+ source_id: string | null;
10018
+ trade_item_id: string | null;
10019
+ valid_from: string | null;
10020
+ valid_until: string | null;
10021
+ };
10022
+ Relationships: [];
10023
+ };
10024
+ local_customer_discounts: {
10025
+ Row: {
10026
+ base_price: number | null;
10027
+ currency: string | null;
10028
+ customer_id: string | null;
10029
+ discount_type: string | null;
10030
+ discount_value: number | null;
10031
+ min_quantity: number | null;
10032
+ net_price: number | null;
10033
+ product_category_id: string | null;
10034
+ product_id: string | null;
10035
+ product_name: string | null;
10036
+ source: string | null;
10037
+ source_id: string | null;
10038
+ valid_from: string | null;
10039
+ valid_until: string | null;
10040
+ };
10041
+ Relationships: [];
10042
+ };
8860
10043
  manufacture_product_possible_stock_view: {
8861
10044
  Row: {
8862
10045
  component_count: number | null;
@@ -9153,6 +10336,68 @@ export type Database = {
9153
10336
  };
9154
10337
  Returns: number;
9155
10338
  };
10339
+ afh_city_code: {
10340
+ Args: {
10341
+ _city: string;
10342
+ _country: string;
10343
+ };
10344
+ Returns: string;
10345
+ };
10346
+ afh_normalize_country: {
10347
+ Args: {
10348
+ _raw: string;
10349
+ };
10350
+ Returns: string;
10351
+ };
10352
+ afh_normalize_nl_province: {
10353
+ Args: {
10354
+ _raw: string;
10355
+ };
10356
+ Returns: string;
10357
+ };
10358
+ afh_subtract_workdays: {
10359
+ Args: {
10360
+ _date: string;
10361
+ _days: number;
10362
+ };
10363
+ Returns: string;
10364
+ };
10365
+ apply_stock_consumption: {
10366
+ Args: {
10367
+ p_order_id: string;
10368
+ p_order_item_id: string;
10369
+ p_qty: number;
10370
+ p_reason: string;
10371
+ p_source: string;
10372
+ p_trade_item_key: string;
10373
+ };
10374
+ Returns: undefined;
10375
+ };
10376
+ apply_stock_reservation: {
10377
+ Args: {
10378
+ p_order_id: string;
10379
+ p_order_item_id: string;
10380
+ p_qty: number;
10381
+ p_reason: string;
10382
+ p_source: string;
10383
+ p_trade_item_key: string;
10384
+ };
10385
+ Returns: undefined;
10386
+ };
10387
+ assign_cart_numbers: {
10388
+ Args: {
10389
+ p_carts: Json;
10390
+ };
10391
+ Returns: {
10392
+ cart_index: number;
10393
+ cart_number: string;
10394
+ day_seq: number;
10395
+ order_id: string;
10396
+ order_source: string;
10397
+ pick_date: string;
10398
+ status: string;
10399
+ }[];
10400
+ };
9156
10401
  assign_floriday_order_numbers: {
9157
10402
  Args: {
9158
10403
  p_ids: string[];
@@ -9162,20 +10407,81 @@ export type Database = {
9162
10407
  order_number: string;
9163
10408
  }[];
9164
10409
  };
10410
+ autolink_product_to_floriday: {
10411
+ Args: {
10412
+ p_product_id: string;
10413
+ };
10414
+ Returns: string;
10415
+ };
10416
+ backfill_open_order_reservations: {
10417
+ Args: never;
10418
+ Returns: {
10419
+ processed_items: number;
10420
+ }[];
10421
+ };
9165
10422
  call_exact_route: {
9166
10423
  Args: {
9167
10424
  path: string;
9168
10425
  };
9169
10426
  Returns: number;
9170
10427
  };
10428
+ check_offer_product_available_stock: {
10429
+ Args: {
10430
+ p_campaign_product_id: string;
10431
+ p_code: string;
10432
+ p_needed_qty?: number;
10433
+ p_product_name?: string;
10434
+ };
10435
+ Returns: Json;
10436
+ };
10437
+ check_trade_item_available_stock: {
10438
+ Args: {
10439
+ p_connection_id?: string;
10440
+ p_context?: string;
10441
+ p_needed_qty?: number;
10442
+ p_order_id?: string;
10443
+ p_order_item_id?: string;
10444
+ p_owner_id?: string;
10445
+ p_product_name?: string;
10446
+ p_trade_item_key: string;
10447
+ };
10448
+ Returns: Json;
10449
+ };
9171
10450
  cleanup_old_bookings: {
9172
10451
  Args: never;
9173
10452
  Returns: number;
9174
10453
  };
10454
+ control_get_todays_carts: {
10455
+ Args: never;
10456
+ Returns: {
10457
+ cart_index: number;
10458
+ cart_number: string;
10459
+ cart_number_id: string;
10460
+ order_id: string;
10461
+ order_source: string;
10462
+ pick_date: string;
10463
+ status: string;
10464
+ }[];
10465
+ };
10466
+ count_distinct_regulatory_products: {
10467
+ Args: never;
10468
+ Returns: number;
10469
+ };
9175
10470
  current_monteur_id: {
9176
10471
  Args: never;
9177
10472
  Returns: string;
9178
10473
  };
10474
+ dashboard_alert_counts: {
10475
+ Args: never;
10476
+ Returns: Json;
10477
+ };
10478
+ dashboard_alert_rows: {
10479
+ Args: {
10480
+ check_id: string;
10481
+ row_limit?: number;
10482
+ };
10483
+ Returns: Json;
10484
+ };
9179
10485
  dashboard_list_public_schema: {
9180
10486
  Args: never;
9181
10487
  Returns: {
@@ -9184,6 +10490,12 @@ export type Database = {
9184
10490
  table_name: string;
9185
10491
  }[];
9186
10492
  };
10493
+ dispatch_carrier_signups_sql: {
10494
+ Args: {
10495
+ _catchup?: string;
10496
+ };
10497
+ Returns: Json;
10498
+ };
9187
10499
  email_auth_decrypt: {
9188
10500
  Args: {
9189
10501
  cipher: string;
@@ -9219,6 +10531,12 @@ export type Database = {
9219
10531
  status: string;
9220
10532
  }[];
9221
10533
  };
10534
+ ensure_trade_item_stock_row: {
10535
+ Args: {
10536
+ p_key: string;
10537
+ };
10538
+ Returns: undefined;
10539
+ };
9222
10540
  ensure_user_tenant: {
9223
10541
  Args: never;
9224
10542
  Returns: string;
@@ -9256,6 +10574,38 @@ export type Database = {
9256
10574
  };
9257
10575
  Returns: boolean;
9258
10576
  };
10577
+ find_trade_item_key: {
10578
+ Args: {
10579
+ p_barcode: string;
10580
+ p_name: string;
10581
+ p_product_id: string;
10582
+ };
10583
+ Returns: string;
10584
+ };
10585
+ floriday_effective_price: {
10586
+ Args: {
10587
+ _buyer_id: string;
10588
+ _on_date?: string;
10589
+ _quantity?: number;
10590
+ _trade_item_id: string;
10591
+ };
10592
+ Returns: {
10593
+ base_price: number;
10594
+ currency: string;
10595
+ discount_type: string;
10596
+ discount_value: number;
10597
+ net_price: number;
10598
+ source: string;
10599
+ source_id: string;
10600
+ }[];
10601
+ };
10602
+ format_cart_number: {
10603
+ Args: {
10604
+ p_pick_date: string;
10605
+ p_seq: number;
10606
+ };
10607
+ Returns: string;
10608
+ };
9259
10609
  get_active_floriday_connection_public: {
9260
10610
  Args: never;
9261
10611
  Returns: {
@@ -9269,6 +10619,13 @@ export type Database = {
9269
10619
  preferred_warehouse_name: string;
9270
10620
  }[];
9271
10621
  };
10622
+ get_active_floriday_context: {
10623
+ Args: never;
10624
+ Returns: {
10625
+ connection_id: string;
10626
+ user_id: string;
10627
+ }[];
10628
+ };
9272
10629
  get_active_twinfield_public: {
9273
10630
  Args: never;
9274
10631
  Returns: {
@@ -9280,6 +10637,13 @@ export type Database = {
9280
10637
  office_code: string;
9281
10638
  }[];
9282
10639
  };
10640
+ get_floricode_record_counts: {
10641
+ Args: never;
10642
+ Returns: {
10643
+ count: number;
10644
+ resource: string;
10645
+ }[];
10646
+ };
9283
10647
  get_floriday_agreements_active: {
9284
10648
  Args: {
9285
10649
  p_on_date?: string;
@@ -9371,6 +10735,24 @@ export type Database = {
9371
10735
  };
9372
10736
  Returns: Json;
9373
10737
  };
10738
+ get_offer_delivery_options: {
10739
+ Args: {
10740
+ p_code: string;
10741
+ };
10742
+ Returns: Json;
10743
+ };
10744
+ get_offer_recipient_by_code: {
10745
+ Args: {
10746
+ p_code: string;
10747
+ };
10748
+ Returns: {
10749
+ campaign_id: string;
10750
+ clicked_at: string;
10751
+ customer_id: string;
10752
+ id: string;
10753
+ ordered_at: string;
10754
+ }[];
10755
+ };
9374
10756
  get_or_assign_floriday_order_number: {
9375
10757
  Args: {
9376
10758
  p_floriday_id: string;
@@ -9423,12 +10805,53 @@ export type Database = {
9423
10805
  Args: never;
9424
10806
  Returns: boolean;
9425
10807
  };
10808
+ is_superadmin: {
10809
+ Args: {
10810
+ _user_id: string;
10811
+ };
10812
+ Returns: boolean;
10813
+ };
10814
+ local_effective_price: {
10815
+ Args: {
10816
+ _customer_id: string;
10817
+ _on_date?: string;
10818
+ _product_id: string;
10819
+ _quantity?: number;
10820
+ };
10821
+ Returns: {
10822
+ currency: string;
10823
+ discount_type: string;
10824
+ discount_value: number;
10825
+ net_price: number;
10826
+ source: string;
10827
+ source_id: string;
10828
+ }[];
10829
+ };
10830
+ mark_offer_clicked: {
10831
+ Args: {
10832
+ p_code: string;
10833
+ };
10834
+ Returns: undefined;
10835
+ };
10836
+ mark_offer_ordered: {
10837
+ Args: {
10838
+ p_code: string;
10839
+ };
10840
+ Returns: undefined;
10841
+ };
9426
10842
  next_order_number: {
9427
10843
  Args: {
9428
10844
  p_prefix: string;
9429
10845
  };
9430
10846
  Returns: string;
9431
10847
  };
10848
+ next_order_number_for_date: {
10849
+ Args: {
10850
+ p_created_at?: string;
10851
+ p_prefix: string;
10852
+ };
10853
+ Returns: string;
10854
+ };
9432
10855
  next_work_order_number: {
9433
10856
  Args: {
9434
10857
  p_parent_work_order_id?: string;
@@ -9436,16 +10859,41 @@ export type Database = {
9436
10859
  };
9437
10860
  Returns: string;
9438
10861
  };
10862
+ normalize_order_source: {
10863
+ Args: {
10864
+ p_src: string;
10865
+ };
10866
+ Returns: string;
10867
+ };
9439
10868
  normalize_vat: {
9440
10869
  Args: {
9441
10870
  v: string;
9442
10871
  };
9443
10872
  Returns: string;
9444
10873
  };
10874
+ offer_recipient_matches: {
10875
+ Args: {
10876
+ _campaign_id: string;
10877
+ _customer_id: string;
10878
+ _recipient_id: string;
10879
+ };
10880
+ Returns: boolean;
10881
+ };
10882
+ order_number_prefix: {
10883
+ Args: {
10884
+ p_custom_fields?: Json;
10885
+ p_order_source: string;
10886
+ };
10887
+ Returns: string;
10888
+ };
9445
10889
  pickstation_get_orders_raw: {
9446
10890
  Args: never;
9447
10891
  Returns: Json;
9448
10892
  };
10893
+ pickstation_get_planning_context: {
10894
+ Args: never;
10895
+ Returns: Json;
10896
+ };
9449
10897
  pickstation_get_settings: {
9450
10898
  Args: never;
9451
10899
  Returns: Json;
@@ -9460,6 +10908,26 @@ export type Database = {
9460
10908
  };
9461
10909
  Returns: undefined;
9462
10910
  };
10911
+ pickstation_set_cart_status: {
10912
+ Args: {
10913
+ p_cart_index: number;
10914
+ p_order_id: string;
10915
+ p_order_source: string;
10916
+ p_status: string;
10917
+ };
10918
+ Returns: undefined;
10919
+ };
10920
+ promote_trade_item_key: {
10921
+ Args: {
10922
+ p_new: string;
10923
+ p_old: string;
10924
+ };
10925
+ Returns: undefined;
10926
+ };
10927
+ refresh_external_customers_grouped: {
10928
+ Args: never;
10929
+ Returns: undefined;
10930
+ };
9463
10931
  refresh_floricode_derived_code_lists: {
9464
10932
  Args: never;
9465
10933
  Returns: {
@@ -9474,6 +10942,12 @@ export type Database = {
9474
10942
  };
9475
10943
  Returns: number;
9476
10944
  };
10945
+ refresh_floricode_derived_for_products: {
10946
+ Args: {
10947
+ _product_ids: string[];
10948
+ };
10949
+ Returns: number;
10950
+ };
9477
10951
  reset_floriday_sync_cursor: {
9478
10952
  Args: {
9479
10953
  p_connection_id: string;
@@ -9481,6 +10955,12 @@ export type Database = {
9481
10955
  };
9482
10956
  Returns: undefined;
9483
10957
  };
10958
+ resolve_product_id_for_item: {
10959
+ Args: {
10960
+ p_product_name: string;
10961
+ };
10962
+ Returns: string;
10963
+ };
9484
10964
  schedule_floriday_additional_services_sync: {
9485
10965
  Args: {
9486
10966
  p_apikey: string;