@appcorp/stellar-solutions-invoice-module 0.1.74 → 0.1.75
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.
- package/base-modules/invoice/add-service-product-section.d.ts +1 -5
- package/base-modules/invoice/add-service-product-section.js +3 -3
- package/base-modules/invoice/cache.d.ts +15 -0
- package/base-modules/invoice/cache.js +50 -0
- package/base-modules/invoice/calculate-subtotal.d.ts +6 -1
- package/base-modules/invoice/calculate-subtotal.js +2 -2
- package/base-modules/invoice/calculate-total.d.ts +1 -1
- package/base-modules/invoice/calculate-total.js +8 -8
- package/base-modules/invoice/company-form-section.d.ts +1 -5
- package/base-modules/invoice/company-form-section.js +25 -22
- package/base-modules/invoice/constants.d.ts +2 -3
- package/base-modules/invoice/constants.js +2 -3
- package/base-modules/invoice/context.d.ts +556 -20
- package/base-modules/invoice/context.js +530 -342
- package/base-modules/invoice/customer-form-section.d.ts +1 -5
- package/base-modules/invoice/customer-form-section.js +25 -9
- package/base-modules/invoice/form.d.ts +1 -5
- package/base-modules/invoice/form.js +9 -9
- package/base-modules/invoice/page.d.ts +8 -0
- package/base-modules/invoice/page.js +171 -0
- package/base-modules/invoice/pricing-form-section.d.ts +1 -5
- package/base-modules/invoice/pricing-form-section.js +16 -11
- package/base-modules/invoice/products-form-section.d.ts +1 -5
- package/base-modules/invoice/products-form-section.js +49 -40
- package/base-modules/invoice/services-form-section.d.ts +1 -5
- package/base-modules/invoice/services-form-section.js +10 -9
- package/base-modules/invoice/validate.d.ts +83 -25
- package/base-modules/invoice/validate.js +4 -4
- package/base-modules/payment/cache.d.ts +15 -0
- package/base-modules/payment/cache.js +52 -0
- package/base-modules/payment/constants.d.ts +1 -14
- package/base-modules/payment/constants.js +2 -15
- package/base-modules/payment/context.d.ts +214 -48
- package/base-modules/payment/context.js +266 -237
- package/base-modules/payment/drawer.d.ts +0 -6
- package/base-modules/payment/drawer.js +89 -44
- package/base-modules/payment/form.js +3 -2
- package/base-modules/payment/{payment.js → page.js} +2 -5
- package/base-modules/payment/types.d.ts +0 -85
- package/base-modules/payment/types.js +74 -21
- package/base-modules/payment/validate.d.ts +12 -0
- package/base-modules/payment/validate.js +19 -8
- package/base-modules/payment/view.d.ts +1 -5
- package/base-modules/payment/view.js +4 -3
- package/base-modules/quote/add-service-product-section.js +1 -1
- package/base-modules/quote/cache.d.ts +15 -0
- package/base-modules/quote/cache.js +50 -0
- package/base-modules/quote/company-form-section.d.ts +1 -1
- package/base-modules/quote/company-form-section.js +14 -12
- package/base-modules/quote/constants.js +1 -0
- package/base-modules/quote/context.d.ts +656 -46
- package/base-modules/quote/context.js +413 -289
- package/base-modules/quote/customer-form-section.d.ts +1 -1
- package/base-modules/quote/customer-form-section.js +24 -9
- package/base-modules/quote/form.d.ts +1 -5
- package/base-modules/quote/form.js +8 -9
- package/base-modules/quote/page.d.ts +8 -0
- package/base-modules/quote/page.js +163 -0
- package/base-modules/quote/pricing-form-section.js +9 -8
- package/base-modules/quote/products-form-section.js +2 -2
- package/base-modules/quote/services-form-section.js +1 -1
- package/base-modules/quote/types.d.ts +0 -127
- package/base-modules/quote/types.js +92 -35
- package/base-modules/quote/validate.d.ts +82 -25
- package/base-modules/quote/validate.js +3 -4
- package/package.json +8 -8
- package/base-modules/invoice/actions.d.ts +0 -215
- package/base-modules/invoice/actions.js +0 -38
- package/base-modules/invoice/drawer.d.ts +0 -13
- package/base-modules/invoice/drawer.js +0 -46
- package/base-modules/invoice/invoice.d.ts +0 -8
- package/base-modules/invoice/invoice.js +0 -69
- package/base-modules/invoice/reducer.d.ts +0 -4
- package/base-modules/invoice/reducer.js +0 -180
- package/base-modules/invoice/types.d.ts +0 -211
- package/base-modules/invoice/types.js +0 -43
- package/base-modules/payment/actions.d.ts +0 -203
- package/base-modules/payment/actions.js +0 -50
- package/base-modules/payment/reducer.d.ts +0 -29
- package/base-modules/payment/reducer.js +0 -215
- package/base-modules/quote/actions.d.ts +0 -215
- package/base-modules/quote/actions.js +0 -38
- package/base-modules/quote/drawer.d.ts +0 -13
- package/base-modules/quote/drawer.js +0 -46
- package/base-modules/quote/quote.d.ts +0 -8
- package/base-modules/quote/quote.js +0 -69
- package/base-modules/quote/reducer.d.ts +0 -4
- package/base-modules/quote/reducer.js +0 -181
- /package/base-modules/payment/{payment.d.ts → page.d.ts} +0 -0
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import z from "zod";
|
|
2
|
-
import { QUOTE_DRAWER } from "./types";
|
|
3
2
|
export declare const formValid: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4
3
|
address: z.ZodString;
|
|
5
4
|
city: z.ZodString;
|
|
6
5
|
country: z.ZodString;
|
|
7
6
|
currency: z.ZodString;
|
|
8
|
-
|
|
7
|
+
quoteMode: z.ZodLiteral<"INVOICE_MODE.CUSTOMER">;
|
|
9
8
|
email: z.ZodString;
|
|
10
9
|
firstName: z.ZodString;
|
|
11
10
|
lastName: z.ZodString;
|
|
@@ -27,7 +26,7 @@ export declare const formValid: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
27
26
|
companyId: z.ZodString;
|
|
28
27
|
currency: z.ZodString;
|
|
29
28
|
date: z.ZodString;
|
|
30
|
-
|
|
29
|
+
quoteMode: z.ZodLiteral<"INVOICE_MODE.COMPANY">;
|
|
31
30
|
expiryDate: z.ZodString;
|
|
32
31
|
note: z.ZodOptional<z.ZodString>;
|
|
33
32
|
ref: z.ZodString;
|
|
@@ -44,8 +43,15 @@ export declare const formValid: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
44
43
|
price: z.ZodString;
|
|
45
44
|
rowTotal: z.ZodString;
|
|
46
45
|
}, z.core.$strip>>>;
|
|
47
|
-
}, z.core.$strip>], "
|
|
46
|
+
}, z.core.$strip>], "quoteMode">;
|
|
48
47
|
export declare const formValidation: z.ZodObject<{
|
|
48
|
+
"~standard": z.ZodStandardSchemaWithJSON<z.ZodObject<{
|
|
49
|
+
discountUnit: z.ZodString;
|
|
50
|
+
discount: z.ZodString;
|
|
51
|
+
total: z.ZodString;
|
|
52
|
+
subTotal: z.ZodString;
|
|
53
|
+
taxRate: z.ZodString;
|
|
54
|
+
}, z.core.$strip>>;
|
|
49
55
|
shape: {
|
|
50
56
|
discountUnit: z.ZodString;
|
|
51
57
|
discount: z.ZodString;
|
|
@@ -54,11 +60,11 @@ export declare const formValidation: z.ZodObject<{
|
|
|
54
60
|
taxRate: z.ZodString;
|
|
55
61
|
};
|
|
56
62
|
keyof: () => z.ZodEnum<{
|
|
57
|
-
discount: "discount";
|
|
58
|
-
discountUnit: "discountUnit";
|
|
59
63
|
subTotal: "subTotal";
|
|
60
64
|
taxRate: "taxRate";
|
|
65
|
+
discount: "discount";
|
|
61
66
|
total: "total";
|
|
67
|
+
discountUnit: "discountUnit";
|
|
62
68
|
}>;
|
|
63
69
|
catchall: <T extends z.core.SomeType>(schema: T) => z.ZodObject<{
|
|
64
70
|
discountUnit: z.ZodString;
|
|
@@ -95,7 +101,7 @@ export declare const formValidation: z.ZodObject<{
|
|
|
95
101
|
subTotal: z.ZodString;
|
|
96
102
|
taxRate: z.ZodString;
|
|
97
103
|
}, z.core.$strip>;
|
|
98
|
-
extend: <U extends z.core.$ZodLooseShape>(shape: U) => z.ZodObject<(("
|
|
104
|
+
extend: <U extends z.core.$ZodLooseShape>(shape: U) => z.ZodObject<(("subTotal" | "taxRate" | "discount" | "total" | "discountUnit") & keyof U extends never ? {
|
|
99
105
|
discountUnit: z.ZodString;
|
|
100
106
|
discount: z.ZodString;
|
|
101
107
|
total: z.ZodString;
|
|
@@ -114,7 +120,7 @@ export declare const formValidation: z.ZodObject<{
|
|
|
114
120
|
total: z.ZodString;
|
|
115
121
|
subTotal: z.ZodString;
|
|
116
122
|
taxRate: z.ZodString;
|
|
117
|
-
}, U> & Partial<Record<"
|
|
123
|
+
}, U> & Partial<Record<"subTotal" | "taxRate" | "discount" | "total" | "discountUnit", z.core.SomeType>>) => z.ZodObject<(("subTotal" | "taxRate" | "discount" | "total" | "discountUnit") & keyof U extends never ? {
|
|
118
124
|
discountUnit: z.ZodString;
|
|
119
125
|
discount: z.ZodString;
|
|
120
126
|
total: z.ZodString;
|
|
@@ -127,7 +133,7 @@ export declare const formValidation: z.ZodObject<{
|
|
|
127
133
|
subTotal: z.ZodString;
|
|
128
134
|
taxRate: z.ZodString;
|
|
129
135
|
} extends infer T_1 extends z.core.util.SomeObject ? { [K in keyof T_1 as K extends keyof U ? never : K]: T_1[K]; } : never) & { [K_1 in keyof U]: U[K_1]; }) extends infer T ? { [k in keyof T]: T[k]; } : never, z.core.$strip>;
|
|
130
|
-
merge: <U extends z.ZodObject>(other: U) => z.ZodObject<(("
|
|
136
|
+
merge: <U extends z.ZodObject>(other: U) => z.ZodObject<(("subTotal" | "taxRate" | "discount" | "total" | "discountUnit") & keyof U["shape"] extends never ? {
|
|
131
137
|
discountUnit: z.ZodString;
|
|
132
138
|
discount: z.ZodString;
|
|
133
139
|
total: z.ZodString;
|
|
@@ -140,20 +146,20 @@ export declare const formValidation: z.ZodObject<{
|
|
|
140
146
|
subTotal: z.ZodString;
|
|
141
147
|
taxRate: z.ZodString;
|
|
142
148
|
} extends infer T_1 extends z.core.util.SomeObject ? { [K in keyof T_1 as K extends keyof U["shape"] ? never : K]: T_1[K]; } : never) & (U["shape"] extends infer T_2 extends z.core.util.SomeObject ? { [K_1 in keyof T_2]: T_2[K_1]; } : never)) extends infer T ? { [k in keyof T]: T[k]; } : never, U["_zod"]["config"]>;
|
|
143
|
-
pick: <M extends z.core.util.Mask<"
|
|
149
|
+
pick: <M extends z.core.util.Mask<"subTotal" | "taxRate" | "discount" | "total" | "discountUnit">>(mask: M & Record<Exclude<keyof M, "subTotal" | "taxRate" | "discount" | "total" | "discountUnit">, never>) => z.ZodObject<Pick<{
|
|
144
150
|
discountUnit: z.ZodString;
|
|
145
151
|
discount: z.ZodString;
|
|
146
152
|
total: z.ZodString;
|
|
147
153
|
subTotal: z.ZodString;
|
|
148
154
|
taxRate: z.ZodString;
|
|
149
|
-
}, Extract<"
|
|
150
|
-
omit: <M extends z.core.util.Mask<"
|
|
155
|
+
}, Extract<"subTotal", keyof M> | Extract<"taxRate", keyof M> | Extract<"discount", keyof M> | Extract<"total", keyof M> | Extract<"discountUnit", keyof M>> extends infer T ? { [k in keyof T]: T[k]; } : never, z.core.$strip>;
|
|
156
|
+
omit: <M extends z.core.util.Mask<"subTotal" | "taxRate" | "discount" | "total" | "discountUnit">>(mask: M & Record<Exclude<keyof M, "subTotal" | "taxRate" | "discount" | "total" | "discountUnit">, never>) => z.ZodObject<Omit<{
|
|
151
157
|
discountUnit: z.ZodString;
|
|
152
158
|
discount: z.ZodString;
|
|
153
159
|
total: z.ZodString;
|
|
154
160
|
subTotal: z.ZodString;
|
|
155
161
|
taxRate: z.ZodString;
|
|
156
|
-
}, Extract<"
|
|
162
|
+
}, Extract<"subTotal", keyof M> | Extract<"taxRate", keyof M> | Extract<"discount", keyof M> | Extract<"total", keyof M> | Extract<"discountUnit", keyof M>> extends infer T ? { [k in keyof T]: T[k]; } : never, z.core.$strip>;
|
|
157
163
|
partial: {
|
|
158
164
|
(): z.ZodObject<{
|
|
159
165
|
discountUnit: z.ZodOptional<z.ZodString>;
|
|
@@ -162,7 +168,7 @@ export declare const formValidation: z.ZodObject<{
|
|
|
162
168
|
subTotal: z.ZodOptional<z.ZodString>;
|
|
163
169
|
taxRate: z.ZodOptional<z.ZodString>;
|
|
164
170
|
}, z.core.$strip>;
|
|
165
|
-
<M extends z.core.util.Mask<"
|
|
171
|
+
<M extends z.core.util.Mask<"subTotal" | "taxRate" | "discount" | "total" | "discountUnit">>(mask: M & Record<Exclude<keyof M, "subTotal" | "taxRate" | "discount" | "total" | "discountUnit">, never>): z.ZodObject<{
|
|
166
172
|
discountUnit: "discountUnit" extends infer T ? T extends "discountUnit" ? T extends keyof M ? z.ZodOptional<{
|
|
167
173
|
discountUnit: z.ZodString;
|
|
168
174
|
discount: z.ZodString;
|
|
@@ -238,7 +244,7 @@ export declare const formValidation: z.ZodObject<{
|
|
|
238
244
|
subTotal: z.ZodNonOptional<z.ZodString>;
|
|
239
245
|
taxRate: z.ZodNonOptional<z.ZodString>;
|
|
240
246
|
}, z.core.$strip>;
|
|
241
|
-
<M extends z.core.util.Mask<"
|
|
247
|
+
<M extends z.core.util.Mask<"subTotal" | "taxRate" | "discount" | "total" | "discountUnit">>(mask: M & Record<Exclude<keyof M, "subTotal" | "taxRate" | "discount" | "total" | "discountUnit">, never>): z.ZodObject<{
|
|
242
248
|
discountUnit: "discountUnit" extends infer T ? T extends "discountUnit" ? T extends keyof M ? z.ZodNonOptional<{
|
|
243
249
|
discountUnit: z.ZodString;
|
|
244
250
|
discount: z.ZodString;
|
|
@@ -335,6 +341,13 @@ export declare const formValidation: z.ZodObject<{
|
|
|
335
341
|
subTotal: string;
|
|
336
342
|
taxRate: string;
|
|
337
343
|
};
|
|
344
|
+
toJSONSchema: (params?: z.core.ToJSONSchemaParams) => z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
|
|
345
|
+
discountUnit: z.ZodString;
|
|
346
|
+
discount: z.ZodString;
|
|
347
|
+
total: z.ZodString;
|
|
348
|
+
subTotal: z.ZodString;
|
|
349
|
+
taxRate: z.ZodString;
|
|
350
|
+
}, z.core.$strip>>;
|
|
338
351
|
check: (...checks: (z.core.CheckFn<{
|
|
339
352
|
discountUnit: string;
|
|
340
353
|
discount: string;
|
|
@@ -354,6 +367,25 @@ export declare const formValidation: z.ZodObject<{
|
|
|
354
367
|
subTotal: z.ZodString;
|
|
355
368
|
taxRate: z.ZodString;
|
|
356
369
|
}, z.core.$strip>;
|
|
370
|
+
with: (...checks: (z.core.CheckFn<{
|
|
371
|
+
discountUnit: string;
|
|
372
|
+
discount: string;
|
|
373
|
+
total: string;
|
|
374
|
+
subTotal: string;
|
|
375
|
+
taxRate: string;
|
|
376
|
+
}> | z.core.$ZodCheck<{
|
|
377
|
+
discountUnit: string;
|
|
378
|
+
discount: string;
|
|
379
|
+
total: string;
|
|
380
|
+
subTotal: string;
|
|
381
|
+
taxRate: string;
|
|
382
|
+
}>)[]) => z.ZodObject<{
|
|
383
|
+
discountUnit: z.ZodString;
|
|
384
|
+
discount: z.ZodString;
|
|
385
|
+
total: z.ZodString;
|
|
386
|
+
subTotal: z.ZodString;
|
|
387
|
+
taxRate: z.ZodString;
|
|
388
|
+
}, z.core.$strip>;
|
|
357
389
|
clone: (def?: z.core.$ZodObjectDef<{
|
|
358
390
|
discountUnit: z.ZodString;
|
|
359
391
|
discount: z.ZodString;
|
|
@@ -400,7 +432,7 @@ export declare const formValidation: z.ZodObject<{
|
|
|
400
432
|
subTotal: z.ZodString;
|
|
401
433
|
taxRate: z.ZodString;
|
|
402
434
|
}, z.core.$strip>;
|
|
403
|
-
brand: <T extends PropertyKey = PropertyKey>(value?: T | undefined) => PropertyKey extends T ? z.ZodObject<{
|
|
435
|
+
brand: <T extends PropertyKey = PropertyKey, Dir extends "in" | "out" | "inout" = "out">(value?: T | undefined) => PropertyKey extends T ? z.ZodObject<{
|
|
404
436
|
discountUnit: z.ZodString;
|
|
405
437
|
discount: z.ZodString;
|
|
406
438
|
total: z.ZodString;
|
|
@@ -412,7 +444,7 @@ export declare const formValidation: z.ZodObject<{
|
|
|
412
444
|
total: z.ZodString;
|
|
413
445
|
subTotal: z.ZodString;
|
|
414
446
|
taxRate: z.ZodString;
|
|
415
|
-
}, z.core.$strip>, T>;
|
|
447
|
+
}, z.core.$strip>, T, Dir>;
|
|
416
448
|
parse: (data: unknown, params?: z.core.ParseContext<z.core.$ZodIssue>) => {
|
|
417
449
|
discountUnit: string;
|
|
418
450
|
discount: string;
|
|
@@ -552,20 +584,38 @@ export declare const formValidation: z.ZodObject<{
|
|
|
552
584
|
subTotal: string;
|
|
553
585
|
taxRate: string;
|
|
554
586
|
}>>;
|
|
555
|
-
refine:
|
|
587
|
+
refine: <Ch extends (arg: {
|
|
556
588
|
discountUnit: string;
|
|
557
589
|
discount: string;
|
|
558
590
|
total: string;
|
|
559
591
|
subTotal: string;
|
|
560
592
|
taxRate: string;
|
|
561
|
-
}) => unknown | Promise<unknown
|
|
593
|
+
}) => unknown | Promise<unknown>>(check: Ch, params?: string | {
|
|
594
|
+
params?: Record<string, any> | undefined;
|
|
562
595
|
abort?: boolean | undefined | undefined;
|
|
563
596
|
when?: ((payload: z.core.ParsePayload) => boolean) | undefined | undefined;
|
|
564
597
|
path?: PropertyKey[] | undefined | undefined;
|
|
565
|
-
params?: Record<string, any> | undefined;
|
|
566
598
|
error?: string | z.core.$ZodErrorMap<NonNullable<z.core.$ZodIssue>> | undefined;
|
|
567
599
|
message?: string | undefined | undefined;
|
|
568
|
-
} | undefined) => z.ZodObject<{
|
|
600
|
+
} | undefined) => Ch extends (arg: any) => arg is infer R ? z.ZodObject<{
|
|
601
|
+
discountUnit: z.ZodString;
|
|
602
|
+
discount: z.ZodString;
|
|
603
|
+
total: z.ZodString;
|
|
604
|
+
subTotal: z.ZodString;
|
|
605
|
+
taxRate: z.ZodString;
|
|
606
|
+
}, z.core.$strip> & z.ZodType<R, {
|
|
607
|
+
discountUnit: string;
|
|
608
|
+
discount: string;
|
|
609
|
+
total: string;
|
|
610
|
+
subTotal: string;
|
|
611
|
+
taxRate: string;
|
|
612
|
+
}, z.core.$ZodTypeInternals<R, {
|
|
613
|
+
discountUnit: string;
|
|
614
|
+
discount: string;
|
|
615
|
+
total: string;
|
|
616
|
+
subTotal: string;
|
|
617
|
+
taxRate: string;
|
|
618
|
+
}>> : z.ZodObject<{
|
|
569
619
|
discountUnit: z.ZodString;
|
|
570
620
|
discount: z.ZodString;
|
|
571
621
|
total: z.ZodString;
|
|
@@ -617,6 +667,13 @@ export declare const formValidation: z.ZodObject<{
|
|
|
617
667
|
subTotal: z.ZodString;
|
|
618
668
|
taxRate: z.ZodString;
|
|
619
669
|
}, z.core.$strip>>;
|
|
670
|
+
exactOptional: () => z.ZodExactOptional<z.ZodObject<{
|
|
671
|
+
discountUnit: z.ZodString;
|
|
672
|
+
discount: z.ZodString;
|
|
673
|
+
total: z.ZodString;
|
|
674
|
+
subTotal: z.ZodString;
|
|
675
|
+
taxRate: z.ZodString;
|
|
676
|
+
}, z.core.$strip>>;
|
|
620
677
|
nonoptional: (params?: string | z.core.$ZodNonOptionalParams) => z.ZodNonOptional<z.ZodObject<{
|
|
621
678
|
discountUnit: z.ZodString;
|
|
622
679
|
discount: z.ZodString;
|
|
@@ -838,19 +895,19 @@ export declare const formValidation: z.ZodObject<{
|
|
|
838
895
|
};
|
|
839
896
|
isOptional: () => boolean;
|
|
840
897
|
isNullable: () => boolean;
|
|
841
|
-
|
|
898
|
+
apply: <T>(fn: (schema: z.ZodObject<{
|
|
842
899
|
discountUnit: z.ZodString;
|
|
843
900
|
discount: z.ZodString;
|
|
844
901
|
total: z.ZodString;
|
|
845
902
|
subTotal: z.ZodString;
|
|
846
903
|
taxRate: z.ZodString;
|
|
847
|
-
}, z.core.$strip
|
|
848
|
-
|
|
904
|
+
}, z.core.$strip>) => T) => T;
|
|
905
|
+
_zod: z.core.$ZodObjectInternals<{
|
|
849
906
|
discountUnit: z.ZodString;
|
|
850
907
|
discount: z.ZodString;
|
|
851
908
|
total: z.ZodString;
|
|
852
909
|
subTotal: z.ZodString;
|
|
853
910
|
taxRate: z.ZodString;
|
|
854
|
-
}, z.core.$strip
|
|
911
|
+
}, z.core.$strip>;
|
|
855
912
|
}, z.core.$strip>;
|
|
856
913
|
export type FormValidate = z.infer<typeof formValidation>;
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.formValidation = exports.formValid = void 0;
|
|
7
7
|
var zod_1 = __importDefault(require("zod"));
|
|
8
8
|
var constants_1 = require("./constants");
|
|
9
|
-
var types_1 = require("./types");
|
|
10
9
|
var services = zod_1.default.object({
|
|
11
10
|
name: zod_1.default.string().nonempty(constants_1.validationErrors.services.name),
|
|
12
11
|
description: zod_1.default.string().nonempty(constants_1.validationErrors.services.description),
|
|
@@ -53,7 +52,7 @@ var customerSchema = zod_1.default.object({
|
|
|
53
52
|
city: zod_1.default.string().nonempty(constants_1.validationErrors.customerCity),
|
|
54
53
|
country: zod_1.default.string().nonempty(constants_1.validationErrors.customerCountry),
|
|
55
54
|
currency: zod_1.default.string(),
|
|
56
|
-
|
|
55
|
+
quoteMode: zod_1.default.literal("INVOICE_MODE.CUSTOMER"),
|
|
57
56
|
email: zod_1.default.string().nonempty(constants_1.validationErrors.customerEmail),
|
|
58
57
|
firstName: zod_1.default.string().nonempty(constants_1.validationErrors.customerFirstName),
|
|
59
58
|
lastName: zod_1.default.string().nonempty(constants_1.validationErrors.customerLastName),
|
|
@@ -68,7 +67,7 @@ var companySchema = zod_1.default.object({
|
|
|
68
67
|
companyId: zod_1.default.string().nonempty(constants_1.validationErrors.companyId),
|
|
69
68
|
currency: zod_1.default.string().nonempty(constants_1.validationErrors.currency),
|
|
70
69
|
date: zod_1.default.string().nonempty(constants_1.validationErrors.date),
|
|
71
|
-
|
|
70
|
+
quoteMode: zod_1.default.literal("INVOICE_MODE.COMPANY"),
|
|
72
71
|
expiryDate: zod_1.default.string().nonempty(constants_1.validationErrors.expiryDate),
|
|
73
72
|
note: zod_1.default.string().optional(),
|
|
74
73
|
ref: zod_1.default.string().nonempty(constants_1.validationErrors.ref),
|
|
@@ -78,7 +77,7 @@ var companySchema = zod_1.default.object({
|
|
|
78
77
|
// ============================================================================
|
|
79
78
|
// MAIN FORM VALIDATION (DISCRIMINATED UNION)
|
|
80
79
|
// ============================================================================
|
|
81
|
-
exports.formValid = zod_1.default.discriminatedUnion("
|
|
80
|
+
exports.formValid = zod_1.default.discriminatedUnion("quoteMode", [
|
|
82
81
|
customerSchema,
|
|
83
82
|
companySchema,
|
|
84
83
|
]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appcorp/stellar-solutions-invoice-module",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.75",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"automate": "./automate.sh",
|
|
6
6
|
"build": "yarn clean && yarn build:ts && cp package.json lib && cp README.md lib && cp yarn.lock lib",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"upgrade:own": "ncu -f '@appcorp/app-corp-vista, @appcorp/shadcn, @appcorp/stellar-solutions-company-module, @appcorp/stellar-solutions-modules, @appcorp/stellar-solutions-product-module, @react-pakistan/util-functions' -u"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@appcorp/app-corp-vista": "^0.3.
|
|
24
|
-
"@appcorp/shadcn": "^1.1.
|
|
25
|
-
"@appcorp/stellar-solutions-company-module": "^0.1.
|
|
26
|
-
"@appcorp/stellar-solutions-modules": "^0.1.
|
|
27
|
-
"@appcorp/stellar-solutions-product-module": "^0.2.
|
|
23
|
+
"@appcorp/app-corp-vista": "^0.3.98",
|
|
24
|
+
"@appcorp/shadcn": "^1.1.52",
|
|
25
|
+
"@appcorp/stellar-solutions-company-module": "^0.1.55",
|
|
26
|
+
"@appcorp/stellar-solutions-modules": "^0.1.85",
|
|
27
|
+
"@appcorp/stellar-solutions-product-module": "^0.2.39",
|
|
28
28
|
"@eslint/eslintrc": "^3",
|
|
29
29
|
"@headlessui/react": "^2",
|
|
30
30
|
"@heroicons/react": "^2",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@radix-ui/react-separator": "^1",
|
|
38
38
|
"@radix-ui/react-slot": "^1",
|
|
39
39
|
"@radix-ui/react-switch": "^1",
|
|
40
|
-
"@react-pakistan/util-functions": "^1.25.
|
|
40
|
+
"@react-pakistan/util-functions": "^1.25.39",
|
|
41
41
|
"@supabase/supabase-js": "^2",
|
|
42
42
|
"@tailwindcss/forms": "^0",
|
|
43
43
|
"@tailwindcss/postcss": "^4",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"uuid": "^11",
|
|
76
76
|
"vaul": "^1.1.2",
|
|
77
77
|
"webp-converter-browser": "^1",
|
|
78
|
-
"zod": "^4"
|
|
78
|
+
"zod": "^4.3.6"
|
|
79
79
|
},
|
|
80
80
|
"packageManager": "yarn@4.12.0"
|
|
81
81
|
}
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import { ProductTypeBE } from "@appcorp/stellar-solutions-product-module/base-modules/product/types";
|
|
2
|
-
import { DISCOUNT_UNIT, INVOICE_DRAWER, InvoiceState, QuoteInvoiceTypeBE, Product, Service, INVOICE_MODAL } from "./types";
|
|
3
|
-
import { TaxTypeBE } from "@appcorp/stellar-solutions-modules/global-modules/preferences/types";
|
|
4
|
-
import { CompanyTypeBE } from "@appcorp/stellar-solutions-company-module/base-modules/company/types";
|
|
5
|
-
import { CustomerTypeBE } from "@appcorp/stellar-solutions-company-module/base-modules/customer/types";
|
|
6
|
-
export declare enum INVOICE_ACTION_TYPES {
|
|
7
|
-
ADD_ITEM_PRODUCT = "ADD_ITEM_PRODUCT",
|
|
8
|
-
ADD_ITEM_SERVICE = "ADD_ITEM_SERVICE",
|
|
9
|
-
DELETE_ITEM_PRODUCT = "DELETE_ITEM_PRODUCT",
|
|
10
|
-
DELETE_ITEM_SERVICE = "DELETE_ITEM_SERVICE",
|
|
11
|
-
RESET_ERRORS = "RESET_ERRORS",
|
|
12
|
-
RESET_FORM = "RESET_FORM",
|
|
13
|
-
SET_AFTER_DISCOUNT = "SET_AFTER_DISCOUNT",
|
|
14
|
-
SET_BUTTON_DISABLE = "SET_BUTTON_DISABLE",
|
|
15
|
-
SET_COMPANIES_LIST = "SET_COMPANIES_LIST",
|
|
16
|
-
SET_COUNT = "SET_COUNT",
|
|
17
|
-
SET_CURRENT_PAGE = "SET_CURRENT_PAGE",
|
|
18
|
-
SET_CUSTOMER = "SET_CUSTOMER",
|
|
19
|
-
SET_CUSTOMER_DATA = "SET_CUSTOMER_DATA",
|
|
20
|
-
SET_CUSTOMER_FORM = "SET_CUSTOMER_FORM",
|
|
21
|
-
SET_DISABLE_SAVE_BUTTON = "SET_DISABLE_SAVE_BUTTON",
|
|
22
|
-
SET_DISCOUNT_UNIT = "SET_DISCOUNT_UNIT",
|
|
23
|
-
SET_DRAWER = "SET_DRAWER",
|
|
24
|
-
SET_ERRORS = "SET_ERRORS",
|
|
25
|
-
SET_FORM = "SET_FORM",
|
|
26
|
-
SET_FORM_LOADING = "SET_FORM_LOADING",
|
|
27
|
-
SET_FORM_TO_RENDER = "SET_FORM_TO_RENDER",
|
|
28
|
-
SET_INPUT_FIELD = "SET_INPUT_FIELD",
|
|
29
|
-
SET_INVOICES = "SET_INVOICES",
|
|
30
|
-
SET_INVOICE_FORM = "SET_INVOICE_FORM",
|
|
31
|
-
SET_IS_INVOICE_API_SUCCESS = "SET_IS_INVOICE_API_SUCCESS",
|
|
32
|
-
SET_MODAL = "SET_MODAL",
|
|
33
|
-
SET_PAGE_LIMIT = "SET_PAGE_LIMIT",
|
|
34
|
-
SET_PRODUCTS_LIST = "SET_PRODUCTS_LIST",
|
|
35
|
-
SET_SEARCH_QUERY = "SET_SEARCH_QUERY",
|
|
36
|
-
SET_SKELTON_LOADING = "SET_SKELTON_LOADING",
|
|
37
|
-
SET_TAX = "SET_TAX",
|
|
38
|
-
SET_TAXES = "SET_TAXES"
|
|
39
|
-
}
|
|
40
|
-
export type InvoiceUpdateFieldAction = {
|
|
41
|
-
type: INVOICE_ACTION_TYPES.SET_INPUT_FIELD;
|
|
42
|
-
payload: {
|
|
43
|
-
key: keyof QuoteInvoiceTypeBE | "servicesList" | "productsList" | "taxQuery" | "productQuery" | "companyQuery";
|
|
44
|
-
value: string | string[] | boolean | number | number[] | Service[] | Product[];
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
export type InvoiceResetErrorAction = {
|
|
48
|
-
type: INVOICE_ACTION_TYPES.RESET_ERRORS;
|
|
49
|
-
};
|
|
50
|
-
export type InvoiceResetFormAction = {
|
|
51
|
-
type: INVOICE_ACTION_TYPES.RESET_FORM;
|
|
52
|
-
};
|
|
53
|
-
export type InvoiceSetErrorsAction = {
|
|
54
|
-
type: INVOICE_ACTION_TYPES.SET_ERRORS;
|
|
55
|
-
payload: {
|
|
56
|
-
errors: {
|
|
57
|
-
[key: string]: string;
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
export type InvoiceSetCurrentPageAction = {
|
|
62
|
-
type: INVOICE_ACTION_TYPES.SET_CURRENT_PAGE;
|
|
63
|
-
payload: {
|
|
64
|
-
currentPage: number;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
export type InvoiceSetButtonDisableAction = {
|
|
68
|
-
type: INVOICE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON;
|
|
69
|
-
payload: {
|
|
70
|
-
disableSaveButton: boolean;
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
export type InvoiceSetFormLoadingAction = {
|
|
74
|
-
type: INVOICE_ACTION_TYPES.SET_FORM_LOADING;
|
|
75
|
-
payload: boolean;
|
|
76
|
-
};
|
|
77
|
-
export type InvoiceSetMaxPageLimitAction = {
|
|
78
|
-
type: INVOICE_ACTION_TYPES.SET_PAGE_LIMIT;
|
|
79
|
-
payload: {
|
|
80
|
-
pageLimit: number;
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
export type InvoiceSetSearchQueryAction = {
|
|
84
|
-
type: INVOICE_ACTION_TYPES.SET_SEARCH_QUERY;
|
|
85
|
-
payload: {
|
|
86
|
-
searchQuery: string;
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
export type InvoiceSetInvoicesAction = {
|
|
90
|
-
type: INVOICE_ACTION_TYPES.SET_INVOICES;
|
|
91
|
-
payload: {
|
|
92
|
-
invoices: QuoteInvoiceTypeBE[];
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
export type InvoiceSetCountAction = {
|
|
96
|
-
type: INVOICE_ACTION_TYPES.SET_COUNT;
|
|
97
|
-
payload: {
|
|
98
|
-
count: number;
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
export type InvoiceSetInvoiceFormAction = {
|
|
102
|
-
type: INVOICE_ACTION_TYPES.SET_INVOICE_FORM;
|
|
103
|
-
payload: QuoteInvoiceTypeBE;
|
|
104
|
-
};
|
|
105
|
-
export type InvoiceToggleLoadingAction = {
|
|
106
|
-
type: INVOICE_ACTION_TYPES.SET_SKELTON_LOADING;
|
|
107
|
-
payload: boolean;
|
|
108
|
-
};
|
|
109
|
-
export type InvoiceAddItemServiceAction = {
|
|
110
|
-
type: INVOICE_ACTION_TYPES.ADD_ITEM_SERVICE;
|
|
111
|
-
payload: {
|
|
112
|
-
servicesList: Service[];
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
export type InvoiceAddItemProductAction = {
|
|
116
|
-
type: INVOICE_ACTION_TYPES.ADD_ITEM_PRODUCT;
|
|
117
|
-
payload: {
|
|
118
|
-
productsList: Product[];
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
export type InvoiceDeleteItemProductAction = {
|
|
122
|
-
type: INVOICE_ACTION_TYPES.DELETE_ITEM_PRODUCT;
|
|
123
|
-
payload: {
|
|
124
|
-
productsList: Product[];
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
export type InvoiceDeleteItemServiceAction = {
|
|
128
|
-
type: INVOICE_ACTION_TYPES.DELETE_ITEM_SERVICE;
|
|
129
|
-
payload: {
|
|
130
|
-
servicesList: Service[];
|
|
131
|
-
};
|
|
132
|
-
};
|
|
133
|
-
export type InvoiceSetDiscountUnitAction = {
|
|
134
|
-
type: INVOICE_ACTION_TYPES.SET_DISCOUNT_UNIT;
|
|
135
|
-
payload: {
|
|
136
|
-
discountUnit: DISCOUNT_UNIT;
|
|
137
|
-
};
|
|
138
|
-
};
|
|
139
|
-
export type InvoiceSetCustomerDataAction = {
|
|
140
|
-
type: INVOICE_ACTION_TYPES.SET_CUSTOMER_DATA;
|
|
141
|
-
payload: InvoiceState;
|
|
142
|
-
};
|
|
143
|
-
export type InvoiceSetIsInvoiceApiSuccessAction = {
|
|
144
|
-
type: INVOICE_ACTION_TYPES.SET_IS_INVOICE_API_SUCCESS;
|
|
145
|
-
payload: boolean;
|
|
146
|
-
};
|
|
147
|
-
export type InvoiceSetDrawerAction = {
|
|
148
|
-
type: INVOICE_ACTION_TYPES.SET_DRAWER;
|
|
149
|
-
payload: {
|
|
150
|
-
drawer: INVOICE_DRAWER | null;
|
|
151
|
-
};
|
|
152
|
-
};
|
|
153
|
-
export type InvoiceSetFormAction = {
|
|
154
|
-
type: INVOICE_ACTION_TYPES.SET_FORM;
|
|
155
|
-
payload: {
|
|
156
|
-
form: QuoteInvoiceTypeBE;
|
|
157
|
-
};
|
|
158
|
-
};
|
|
159
|
-
export type InvoiceSetAfterDiscountAction = {
|
|
160
|
-
type: INVOICE_ACTION_TYPES.SET_AFTER_DISCOUNT;
|
|
161
|
-
payload: {
|
|
162
|
-
afterDiscount: string;
|
|
163
|
-
};
|
|
164
|
-
};
|
|
165
|
-
export type InvoiceSetTaxAction = {
|
|
166
|
-
type: INVOICE_ACTION_TYPES.SET_TAX;
|
|
167
|
-
payload: {
|
|
168
|
-
tax: string;
|
|
169
|
-
};
|
|
170
|
-
};
|
|
171
|
-
export type InvoiceSetFormToRenderAction = {
|
|
172
|
-
type: INVOICE_ACTION_TYPES.SET_FORM_TO_RENDER;
|
|
173
|
-
payload: {
|
|
174
|
-
formToRender: string;
|
|
175
|
-
};
|
|
176
|
-
};
|
|
177
|
-
export type InvoiceSetProductsListAction = {
|
|
178
|
-
type: INVOICE_ACTION_TYPES.SET_PRODUCTS_LIST;
|
|
179
|
-
payload: {
|
|
180
|
-
list: ProductTypeBE[];
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
export type InvoiceSetCompaniesListAction = {
|
|
184
|
-
type: INVOICE_ACTION_TYPES.SET_COMPANIES_LIST;
|
|
185
|
-
payload: {
|
|
186
|
-
companiesList: CompanyTypeBE[];
|
|
187
|
-
};
|
|
188
|
-
};
|
|
189
|
-
export type InvoiceSetCustomerAction = {
|
|
190
|
-
type: INVOICE_ACTION_TYPES.SET_CUSTOMER;
|
|
191
|
-
payload: {
|
|
192
|
-
customer: CustomerTypeBE;
|
|
193
|
-
customerId: string;
|
|
194
|
-
};
|
|
195
|
-
};
|
|
196
|
-
export type InvoiceSetCustomerFormAction = {
|
|
197
|
-
type: INVOICE_ACTION_TYPES.SET_CUSTOMER_FORM;
|
|
198
|
-
payload: {
|
|
199
|
-
key: keyof CustomerTypeBE;
|
|
200
|
-
value: string;
|
|
201
|
-
};
|
|
202
|
-
};
|
|
203
|
-
export type InvoiceSetTaxesAction = {
|
|
204
|
-
type: INVOICE_ACTION_TYPES.SET_TAXES;
|
|
205
|
-
payload: {
|
|
206
|
-
taxes: TaxTypeBE[];
|
|
207
|
-
};
|
|
208
|
-
};
|
|
209
|
-
export type InvoiceSetModalAction = {
|
|
210
|
-
type: INVOICE_ACTION_TYPES.SET_MODAL;
|
|
211
|
-
payload: {
|
|
212
|
-
modal: INVOICE_MODAL;
|
|
213
|
-
};
|
|
214
|
-
};
|
|
215
|
-
export type InvoiceActions = InvoiceAddItemProductAction | InvoiceAddItemServiceAction | InvoiceResetErrorAction | InvoiceDeleteItemProductAction | InvoiceDeleteItemServiceAction | InvoiceResetFormAction | InvoiceSetButtonDisableAction | InvoiceSetCurrentPageAction | InvoiceSetCustomerDataAction | InvoiceSetDiscountUnitAction | InvoiceSetErrorsAction | InvoiceSetFormLoadingAction | InvoiceSetInvoicesAction | InvoiceSetInvoiceFormAction | InvoiceSetIsInvoiceApiSuccessAction | InvoiceSetMaxPageLimitAction | InvoiceSetSearchQueryAction | InvoiceUpdateFieldAction | InvoiceToggleLoadingAction | InvoiceSetDrawerAction | InvoiceSetCountAction | InvoiceSetFormAction | InvoiceSetAfterDiscountAction | InvoiceSetTaxAction | InvoiceSetFormToRenderAction | InvoiceSetProductsListAction | InvoiceSetCustomerAction | InvoiceSetTaxesAction | InvoiceSetCustomerFormAction | InvoiceSetCompaniesListAction | InvoiceSetModalAction;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.INVOICE_ACTION_TYPES = void 0;
|
|
4
|
-
var INVOICE_ACTION_TYPES;
|
|
5
|
-
(function (INVOICE_ACTION_TYPES) {
|
|
6
|
-
INVOICE_ACTION_TYPES["ADD_ITEM_PRODUCT"] = "ADD_ITEM_PRODUCT";
|
|
7
|
-
INVOICE_ACTION_TYPES["ADD_ITEM_SERVICE"] = "ADD_ITEM_SERVICE";
|
|
8
|
-
INVOICE_ACTION_TYPES["DELETE_ITEM_PRODUCT"] = "DELETE_ITEM_PRODUCT";
|
|
9
|
-
INVOICE_ACTION_TYPES["DELETE_ITEM_SERVICE"] = "DELETE_ITEM_SERVICE";
|
|
10
|
-
INVOICE_ACTION_TYPES["RESET_ERRORS"] = "RESET_ERRORS";
|
|
11
|
-
INVOICE_ACTION_TYPES["RESET_FORM"] = "RESET_FORM";
|
|
12
|
-
INVOICE_ACTION_TYPES["SET_AFTER_DISCOUNT"] = "SET_AFTER_DISCOUNT";
|
|
13
|
-
INVOICE_ACTION_TYPES["SET_BUTTON_DISABLE"] = "SET_BUTTON_DISABLE";
|
|
14
|
-
INVOICE_ACTION_TYPES["SET_COMPANIES_LIST"] = "SET_COMPANIES_LIST";
|
|
15
|
-
INVOICE_ACTION_TYPES["SET_COUNT"] = "SET_COUNT";
|
|
16
|
-
INVOICE_ACTION_TYPES["SET_CURRENT_PAGE"] = "SET_CURRENT_PAGE";
|
|
17
|
-
INVOICE_ACTION_TYPES["SET_CUSTOMER"] = "SET_CUSTOMER";
|
|
18
|
-
INVOICE_ACTION_TYPES["SET_CUSTOMER_DATA"] = "SET_CUSTOMER_DATA";
|
|
19
|
-
INVOICE_ACTION_TYPES["SET_CUSTOMER_FORM"] = "SET_CUSTOMER_FORM";
|
|
20
|
-
INVOICE_ACTION_TYPES["SET_DISABLE_SAVE_BUTTON"] = "SET_DISABLE_SAVE_BUTTON";
|
|
21
|
-
INVOICE_ACTION_TYPES["SET_DISCOUNT_UNIT"] = "SET_DISCOUNT_UNIT";
|
|
22
|
-
INVOICE_ACTION_TYPES["SET_DRAWER"] = "SET_DRAWER";
|
|
23
|
-
INVOICE_ACTION_TYPES["SET_ERRORS"] = "SET_ERRORS";
|
|
24
|
-
INVOICE_ACTION_TYPES["SET_FORM"] = "SET_FORM";
|
|
25
|
-
INVOICE_ACTION_TYPES["SET_FORM_LOADING"] = "SET_FORM_LOADING";
|
|
26
|
-
INVOICE_ACTION_TYPES["SET_FORM_TO_RENDER"] = "SET_FORM_TO_RENDER";
|
|
27
|
-
INVOICE_ACTION_TYPES["SET_INPUT_FIELD"] = "SET_INPUT_FIELD";
|
|
28
|
-
INVOICE_ACTION_TYPES["SET_INVOICES"] = "SET_INVOICES";
|
|
29
|
-
INVOICE_ACTION_TYPES["SET_INVOICE_FORM"] = "SET_INVOICE_FORM";
|
|
30
|
-
INVOICE_ACTION_TYPES["SET_IS_INVOICE_API_SUCCESS"] = "SET_IS_INVOICE_API_SUCCESS";
|
|
31
|
-
INVOICE_ACTION_TYPES["SET_MODAL"] = "SET_MODAL";
|
|
32
|
-
INVOICE_ACTION_TYPES["SET_PAGE_LIMIT"] = "SET_PAGE_LIMIT";
|
|
33
|
-
INVOICE_ACTION_TYPES["SET_PRODUCTS_LIST"] = "SET_PRODUCTS_LIST";
|
|
34
|
-
INVOICE_ACTION_TYPES["SET_SEARCH_QUERY"] = "SET_SEARCH_QUERY";
|
|
35
|
-
INVOICE_ACTION_TYPES["SET_SKELTON_LOADING"] = "SET_SKELTON_LOADING";
|
|
36
|
-
INVOICE_ACTION_TYPES["SET_TAX"] = "SET_TAX";
|
|
37
|
-
INVOICE_ACTION_TYPES["SET_TAXES"] = "SET_TAXES";
|
|
38
|
-
})(INVOICE_ACTION_TYPES || (exports.INVOICE_ACTION_TYPES = INVOICE_ACTION_TYPES = {}));
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Invoice Drawer Component
|
|
3
|
-
*
|
|
4
|
-
* A full-screen drawer component for creating/editing invoices with multi-section forms.
|
|
5
|
-
* Supports both company and customer invoices with dynamic form sections.
|
|
6
|
-
* Features RTL support and internationalization.
|
|
7
|
-
*/
|
|
8
|
-
import { FC } from "react";
|
|
9
|
-
interface Props {
|
|
10
|
-
isRTL: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare const Drawer: FC<Props>;
|
|
13
|
-
export {};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Invoice Drawer Component
|
|
4
|
-
*
|
|
5
|
-
* A full-screen drawer component for creating/editing invoices with multi-section forms.
|
|
6
|
-
* Supports both company and customer invoices with dynamic form sections.
|
|
7
|
-
* Features RTL support and internationalization.
|
|
8
|
-
*/
|
|
9
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.Drawer = void 0;
|
|
14
|
-
var react_1 = __importDefault(require("react"));
|
|
15
|
-
var lucide_react_1 = require("lucide-react");
|
|
16
|
-
var next_intl_1 = require("next-intl");
|
|
17
|
-
var button_1 = require("@appcorp/shadcn/components/ui/button");
|
|
18
|
-
var drawer_1 = require("@appcorp/shadcn/components/ui/drawer");
|
|
19
|
-
var context_1 = require("./context");
|
|
20
|
-
var form_1 = require("./form");
|
|
21
|
-
var types_1 = require("./types");
|
|
22
|
-
var Drawer = function (_a) {
|
|
23
|
-
var isRTL = _a.isRTL;
|
|
24
|
-
var t = (0, next_intl_1.useTranslations)("invoice");
|
|
25
|
-
var _b = (0, context_1.useInvoiceStateContext)(), closeDrawer = _b.closeDrawer, disableSaveButton = _b.disableSaveButton, drawer = _b.drawer, handleSubmit = _b.handleSubmit;
|
|
26
|
-
var isFormDrawer = drawer === types_1.INVOICE_DRAWER.INVOICE_COMPANY_FORM_DRAWER ||
|
|
27
|
-
drawer === types_1.INVOICE_DRAWER.INVOICE_CUSTOMER_FORM_DRAWER;
|
|
28
|
-
var drawerTitle = t("drawerTitleInvoice");
|
|
29
|
-
// Ensure responsive variant is applied before the data- attribute so Tailwind parses it
|
|
30
|
-
var drawerWidth = "sm:data-[vaul-drawer-direction=right]:min-w-5xl";
|
|
31
|
-
var drawerDirection = isRTL ? "left" : "right";
|
|
32
|
-
return (react_1.default.createElement(drawer_1.Drawer, { open: !!drawer, onOpenChange: function (open) { return !open && closeDrawer(); }, direction: drawerDirection },
|
|
33
|
-
react_1.default.createElement(drawer_1.DrawerContent, { className: "h-full ".concat(drawerWidth, " ").concat(isRTL ? "rtl" : "ltr"), dir: isRTL ? "rtl" : "ltr" },
|
|
34
|
-
react_1.default.createElement(drawer_1.DrawerHeader, { className: "flex flex-row items-center justify-between border-b pb-4 ".concat(isRTL ? "flex-row-reverse" : "") },
|
|
35
|
-
react_1.default.createElement(drawer_1.DrawerTitle, { className: "text-xl font-semibold flex items-center ".concat(isRTL ? "flex-row-reverse gap-2" : "gap-2") }, drawerTitle),
|
|
36
|
-
react_1.default.createElement(drawer_1.DrawerClose, { asChild: true },
|
|
37
|
-
react_1.default.createElement(button_1.Button, { variant: "ghost", size: "icon", className: "h-8 w-8" },
|
|
38
|
-
react_1.default.createElement(lucide_react_1.X, { className: "h-4 w-4" }),
|
|
39
|
-
react_1.default.createElement("span", { className: "sr-only" }, t("drawerButtonClose"))))),
|
|
40
|
-
react_1.default.createElement("div", { className: "flex-1 overflow-y-auto px-4 py-6 ".concat(isRTL ? "text-right" : "text-left") }, isFormDrawer && react_1.default.createElement(form_1.InvoiceForm, { isRTL: isRTL })),
|
|
41
|
-
react_1.default.createElement(drawer_1.DrawerFooter, { className: "border-t pt-4" },
|
|
42
|
-
react_1.default.createElement("div", { className: "flex gap-2 ".concat(isRTL ? "flex-row-reverse" : "") },
|
|
43
|
-
react_1.default.createElement(button_1.Button, { variant: "outline", onClick: closeDrawer, className: "flex-1" }, t("drawerButtonCancel")),
|
|
44
|
-
isFormDrawer && (react_1.default.createElement(button_1.Button, { onClick: handleSubmit, disabled: disableSaveButton, className: "flex-1" }, t("drawerButtonSave"))))))));
|
|
45
|
-
};
|
|
46
|
-
exports.Drawer = Drawer;
|