@react-pakistan/util-functions 1.23.32 → 1.23.34

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 (105) hide show
  1. package/api/cors/index.js +6 -6
  2. package/api/stellar-solutions/app-user/index.js +97 -38
  3. package/api/stellar-solutions/banking-detail/index.js +107 -48
  4. package/api/stellar-solutions/branch/index.js +107 -48
  5. package/api/stellar-solutions/company/index.js +124 -57
  6. package/api/stellar-solutions/company-report/index.js +48 -13
  7. package/api/stellar-solutions/contact/index.js +132 -65
  8. package/api/stellar-solutions/currency/index.js +101 -42
  9. package/api/stellar-solutions/customer/index.js +149 -74
  10. package/api/stellar-solutions/expense/index.js +132 -65
  11. package/api/stellar-solutions/expense-category/index.js +133 -66
  12. package/api/stellar-solutions/lead/index.js +132 -65
  13. package/api/stellar-solutions/menu-order/index.js +97 -38
  14. package/api/stellar-solutions/payment/index.js +135 -77
  15. package/api/stellar-solutions/payment-mode/index.js +90 -31
  16. package/api/stellar-solutions/preference/index.js +71 -28
  17. package/api/stellar-solutions/product/index.js +144 -77
  18. package/api/stellar-solutions/product-category/index.js +130 -63
  19. package/api/stellar-solutions/profile/index.js +152 -77
  20. package/api/stellar-solutions/quote-invoice/index.js +280 -201
  21. package/api/stellar-solutions/quote-invoice-report/index.js +48 -13
  22. package/api/stellar-solutions/tax/index.js +103 -44
  23. package/constants/react-pakistan.js +11 -22
  24. package/constants/social-media-sizes.js +33 -32
  25. package/general/basic-get.js +68 -6
  26. package/general/basic-post.js +55 -6
  27. package/general/camel-to-sentence-case.js +3 -3
  28. package/general/check-even-odd-length.js +1 -1
  29. package/general/create-date.js +4 -4
  30. package/general/dynamic-page-limit.js +15 -4
  31. package/general/enum-to-text.js +2 -2
  32. package/general/fetch-supabase-image.js +53 -15
  33. package/general/format-date.js +13 -12
  34. package/general/generate-blog-schema.js +10 -9
  35. package/general/generate-breadcrumb-schema.js +5 -4
  36. package/general/generate-faq-schema.js +5 -3
  37. package/general/generate-grid.js +2 -2
  38. package/general/generate-organization-schema.js +14 -13
  39. package/general/get-day-name.js +1 -1
  40. package/general/get-full-name.js +4 -1
  41. package/general/get-href.js +1 -1
  42. package/general/get-month-name.js +1 -1
  43. package/general/get-pathname.js +1 -1
  44. package/general/index.d.ts +2 -2
  45. package/general/index.js +2 -2
  46. package/general/is-next-button-disabled.js +1 -1
  47. package/general/is-odd.js +1 -1
  48. package/general/is-previous-button-disabled.js +1 -1
  49. package/general/remove-data-image-prefix.js +2 -2
  50. package/general/repeat-times.js +3 -3
  51. package/general/resolve-anchor-link.js +4 -4
  52. package/general/resolve-current-date.js +2 -2
  53. package/general/resolve-grid.js +1 -1
  54. package/general/resolve-initials.js +2 -2
  55. package/general/set-timezone.js +6 -3
  56. package/general/slugify.js +2 -2
  57. package/general/text-to-enum.js +1 -1
  58. package/general/text-to-sentence-case.js +1 -1
  59. package/general/truncate-text.js +1 -1
  60. package/general/upload-blob-to-private-supabase.d.ts +11 -0
  61. package/general/upload-blob-to-private-supabase.js +62 -0
  62. package/general/upload-blob-to-public-supabase.d.ts +11 -0
  63. package/general/upload-blob-to-public-supabase.js +62 -0
  64. package/general/upload-image-to-private-supabase.js +51 -15
  65. package/general/upload-image-to-public-supabase.js +51 -15
  66. package/general/url-to-sentence-case.js +4 -4
  67. package/general/validate-comment.js +1 -1
  68. package/general/validate-email.js +2 -2
  69. package/general/validate-name.js +1 -1
  70. package/hooks/index.d.ts +0 -1
  71. package/hooks/index.js +0 -1
  72. package/hooks/use-change.js +14 -5
  73. package/hooks/use-debounce.js +7 -6
  74. package/hooks/use-fetch.js +82 -31
  75. package/hooks/use-force-render.js +3 -3
  76. package/hooks/use-ip-geo-location.js +57 -22
  77. package/hooks/use-is-mobile.js +6 -6
  78. package/hooks/use-position.js +16 -16
  79. package/hooks/use-sticky.js +9 -8
  80. package/hooks/use-toggle-state.js +6 -5
  81. package/hooks/use-window-event-listener.js +4 -4
  82. package/local-storage/get-storage-value.js +2 -2
  83. package/local-storage/remove-storage-value.js +1 -1
  84. package/local-storage/set-storage-value.js +1 -1
  85. package/package.json +1 -1
  86. package/storybook/generate-sitemap.js +6 -22
  87. package/storybook/preview.js +13 -2
  88. package/storybook/react-design-story-script.js +7 -11
  89. package/storybook/react-emoji-collection.js +23 -33
  90. package/storybook/react-emoji-story-script.js +9 -13
  91. package/storybook/react-emoji-story-template.js +1 -46
  92. package/storybook/react-icon-collection.js +17 -27
  93. package/storybook/react-icon-story-script.js +9 -13
  94. package/storybook/react-icon-story-template.js +1 -46
  95. package/storybook/react-logo-collection.js +17 -27
  96. package/storybook/react-logo-story-script.js +9 -13
  97. package/storybook/react-logo-story-template.js +1 -46
  98. package/storybook/responsive-component.js +11 -46
  99. package/storybook/theme.js +4 -4
  100. package/general/upload-image-blob-to-private-supabase.d.ts +0 -11
  101. package/general/upload-image-blob-to-private-supabase.js +0 -27
  102. package/general/upload-image-blob-to-public-supabase.d.ts +0 -11
  103. package/general/upload-image-blob-to-public-supabase.js +0 -27
  104. package/hooks/with-seo.d.ts +0 -9
  105. package/hooks/with-seo.js +0 -43
@@ -1,5 +1,16 @@
1
1
  "use strict";
2
2
  /* eslint-disable @typescript-eslint/no-explicit-any, no-restricted-globals, @typescript-eslint/array-type */
3
+ var __assign = (this && this.__assign) || function () {
4
+ __assign = Object.assign || function(t) {
5
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
6
+ s = arguments[i];
7
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
8
+ t[p] = s[p];
9
+ }
10
+ return t;
11
+ };
12
+ return __assign.apply(this, arguments);
13
+ };
3
14
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
15
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
16
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -9,223 +20,291 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
20
  step((generator = generator.apply(thisArg, _arguments || [])).next());
10
21
  });
11
22
  };
23
+ var __generator = (this && this.__generator) || function (thisArg, body) {
24
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
25
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
26
+ function verb(n) { return function (v) { return step([n, v]); }; }
27
+ function step(op) {
28
+ if (f) throw new TypeError("Generator is already executing.");
29
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
30
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
31
+ if (y = 0, t) op = [op[0] & 2, t.value];
32
+ switch (op[0]) {
33
+ case 0: case 1: t = op; break;
34
+ case 4: _.label++; return { value: op[1], done: false };
35
+ case 5: _.label++; y = op[1]; op = [0]; continue;
36
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
37
+ default:
38
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
39
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
40
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
41
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
42
+ if (t[2]) _.ops.pop();
43
+ _.trys.pop(); continue;
44
+ }
45
+ op = body.call(thisArg, _);
46
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
47
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
48
+ }
49
+ };
12
50
  Object.defineProperty(exports, "__esModule", { value: true });
13
51
  exports.deleteQuoteInvoice = exports.postQuoteInvoice = exports.postQuotesInvoices = exports.getQuoteInvoiceById = exports.getQuotesInvoices = void 0;
14
- const getQuotesInvoices = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma, }) {
15
- const quotesInvoices = yield prisma.quoteInvoice.findMany({
16
- orderBy: {
17
- createdAt: 'desc',
18
- },
19
- include: {
20
- company: true,
21
- customer: true,
22
- payments: true,
23
- products: true,
24
- services: true,
25
- },
52
+ var getQuotesInvoices = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
53
+ var quotesInvoices;
54
+ var prisma = _b.prisma;
55
+ return __generator(this, function (_c) {
56
+ switch (_c.label) {
57
+ case 0: return [4 /*yield*/, prisma.quoteInvoice.findMany({
58
+ orderBy: {
59
+ createdAt: 'desc',
60
+ },
61
+ include: {
62
+ company: true,
63
+ customer: true,
64
+ payments: true,
65
+ products: true,
66
+ services: true,
67
+ },
68
+ })];
69
+ case 1:
70
+ quotesInvoices = _c.sent();
71
+ return [2 /*return*/, quotesInvoices];
72
+ }
26
73
  });
27
- return quotesInvoices;
28
- });
74
+ }); };
29
75
  exports.getQuotesInvoices = getQuotesInvoices;
30
- const getQuoteInvoiceById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ prisma, id, }) {
31
- const quoteInvoice = yield prisma.quoteInvoice.findUnique({
32
- where: {
33
- id,
34
- },
35
- include: {
36
- company: true,
37
- customer: true,
38
- payments: true,
39
- products: true,
40
- services: true,
41
- },
76
+ var getQuoteInvoiceById = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
77
+ var quoteInvoice;
78
+ var prisma = _b.prisma, id = _b.id;
79
+ return __generator(this, function (_c) {
80
+ switch (_c.label) {
81
+ case 0: return [4 /*yield*/, prisma.quoteInvoice.findUnique({
82
+ where: {
83
+ id: id,
84
+ },
85
+ include: {
86
+ company: true,
87
+ customer: true,
88
+ payments: true,
89
+ products: true,
90
+ services: true,
91
+ },
92
+ })];
93
+ case 1:
94
+ quoteInvoice = _c.sent();
95
+ return [2 /*return*/, quoteInvoice];
96
+ }
42
97
  });
43
- return quoteInvoice;
44
- });
98
+ }); };
45
99
  exports.getQuoteInvoiceById = getQuoteInvoiceById;
46
- const postQuotesInvoices = (_c) => __awaiter(void 0, [_c], void 0, function* ({ currentPage, pageLimit, prisma, queryWhere, }) {
47
- const quotesInvoices = yield prisma.$transaction([
48
- prisma.quoteInvoice.count({
49
- where: queryWhere,
50
- }),
51
- prisma.quoteInvoice.findMany({
52
- orderBy: {
53
- createdAt: 'desc',
54
- },
55
- include: {
56
- company: true,
57
- customer: true,
58
- payments: true,
59
- products: true,
60
- services: true,
61
- },
62
- where: queryWhere,
63
- take: pageLimit,
64
- skip: (currentPage - 1) * pageLimit,
65
- }),
66
- ]);
67
- return quotesInvoices;
68
- });
69
- exports.postQuotesInvoices = postQuotesInvoices;
70
- const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ address, category, city, companyId, country, currency, customerId, date, discount, discountUnit, email, expiryDate, firstName, id, invoiceStatus, lastName, mode, note, phone, prisma, products, quoteStatus, ref, services, subTotal, taxValue, total, }) {
71
- var _e;
72
- let quoteInvoice;
73
- // Parent create flow
74
- if (mode === 'Create') {
75
- let mappedServices;
76
- if (services === null || services === void 0 ? void 0 : services.length) {
77
- mappedServices = services.map((item) => {
78
- const itemToReturn = Object.assign({}, item);
79
- delete itemToReturn.mode;
80
- return itemToReturn;
81
- });
100
+ var postQuotesInvoices = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
101
+ var quotesInvoices;
102
+ var currentPage = _b.currentPage, pageLimit = _b.pageLimit, prisma = _b.prisma, queryWhere = _b.queryWhere;
103
+ return __generator(this, function (_c) {
104
+ switch (_c.label) {
105
+ case 0: return [4 /*yield*/, prisma.$transaction([
106
+ prisma.quoteInvoice.count({
107
+ where: queryWhere,
108
+ }),
109
+ prisma.quoteInvoice.findMany({
110
+ orderBy: {
111
+ createdAt: 'desc',
112
+ },
113
+ include: {
114
+ company: true,
115
+ customer: true,
116
+ payments: true,
117
+ products: true,
118
+ services: true,
119
+ },
120
+ where: queryWhere,
121
+ take: pageLimit,
122
+ skip: (currentPage - 1) * pageLimit,
123
+ }),
124
+ ])];
125
+ case 1:
126
+ quotesInvoices = _c.sent();
127
+ return [2 /*return*/, quotesInvoices];
82
128
  }
83
- // Parent customer or company flow
84
- if (customerId || companyId) {
85
- quoteInvoice = yield prisma.quoteInvoice.create({
86
- data: Object.assign({ category,
87
- companyId,
88
- currency,
89
- customerId,
90
- date,
91
- discount,
92
- discountUnit,
93
- expiryDate,
94
- invoiceStatus,
95
- note,
96
- quoteStatus,
97
- ref,
98
- subTotal,
99
- taxValue,
100
- total }, (mappedServices && {
101
- services: {
102
- createMany: {
103
- data: mappedServices,
129
+ });
130
+ }); };
131
+ exports.postQuotesInvoices = postQuotesInvoices;
132
+ var postQuoteInvoice = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
133
+ var quoteInvoice, mappedServices, foundQuoteInvoice, filteredEditServices, filteredCreateServices, err_1;
134
+ var _c;
135
+ var address = _b.address, category = _b.category, city = _b.city, companyId = _b.companyId, country = _b.country, currency = _b.currency, customerId = _b.customerId, date = _b.date, discount = _b.discount, discountUnit = _b.discountUnit, email = _b.email, expiryDate = _b.expiryDate, firstName = _b.firstName, id = _b.id, invoiceStatus = _b.invoiceStatus, lastName = _b.lastName, mode = _b.mode, note = _b.note, phone = _b.phone, prisma = _b.prisma, products = _b.products, quoteStatus = _b.quoteStatus, ref = _b.ref, services = _b.services, subTotal = _b.subTotal, taxValue = _b.taxValue, total = _b.total;
136
+ return __generator(this, function (_d) {
137
+ switch (_d.label) {
138
+ case 0:
139
+ if (!(mode === 'Create')) return [3 /*break*/, 5];
140
+ mappedServices = void 0;
141
+ if (services === null || services === void 0 ? void 0 : services.length) {
142
+ mappedServices = services.map(function (item) {
143
+ var itemToReturn = __assign({}, item);
144
+ delete itemToReturn.mode;
145
+ return itemToReturn;
146
+ });
147
+ }
148
+ if (!(customerId || companyId)) return [3 /*break*/, 3];
149
+ return [4 /*yield*/, prisma.quoteInvoice.create({
150
+ data: __assign({ category: category, companyId: companyId, currency: currency, customerId: customerId, date: date, discount: discount, discountUnit: discountUnit, expiryDate: expiryDate, invoiceStatus: invoiceStatus, note: note, quoteStatus: quoteStatus, ref: ref, subTotal: subTotal, taxValue: taxValue, total: total }, (mappedServices && {
151
+ services: {
152
+ createMany: {
153
+ data: mappedServices,
154
+ },
155
+ },
156
+ })),
157
+ include: {
158
+ products: true,
159
+ services: true,
104
160
  },
105
- },
106
- })),
107
- include: {
108
- products: true,
109
- services: true,
110
- },
111
- });
112
- yield (products === null || products === void 0 ? void 0 : products.forEach((_f) => __awaiter(void 0, [_f], void 0, function* ({ id: _id, productQuantity }) {
113
- yield prisma.quotesInvoicesOnStellarProducts.create({
161
+ })];
162
+ case 1:
163
+ quoteInvoice = _d.sent();
164
+ return [4 /*yield*/, (products === null || products === void 0 ? void 0 : products.forEach(function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
165
+ var _id = _b.id, productQuantity = _b.productQuantity;
166
+ return __generator(this, function (_c) {
167
+ switch (_c.label) {
168
+ case 0: return [4 /*yield*/, prisma.quotesInvoicesOnStellarProducts.create({
169
+ data: {
170
+ quoteInvoiceId: quoteInvoice === null || quoteInvoice === void 0 ? void 0 : quoteInvoice.id,
171
+ productId: _id,
172
+ productQuantity: productQuantity,
173
+ },
174
+ })];
175
+ case 1:
176
+ _c.sent();
177
+ return [2 /*return*/];
178
+ }
179
+ });
180
+ }); }))];
181
+ case 2:
182
+ _d.sent();
183
+ return [3 /*break*/, 5];
184
+ case 3: return [4 /*yield*/, prisma.quoteInvoice.create({
114
185
  data: {
115
- quoteInvoiceId: quoteInvoice === null || quoteInvoice === void 0 ? void 0 : quoteInvoice.id,
116
- productId: _id,
117
- productQuantity,
118
- },
119
- });
120
- })));
121
- // Parent customer creation flow
122
- }
123
- else {
124
- quoteInvoice = yield prisma.quoteInvoice.create({
125
- data: {
126
- category,
127
- companyId,
128
- currency,
129
- customerId,
130
- date,
131
- discount,
132
- discountUnit,
133
- expiryDate,
134
- invoiceStatus,
135
- note,
136
- quoteStatus,
137
- ref,
138
- subTotal,
139
- taxValue,
140
- total,
141
- customer: {
142
- create: {
143
- address,
144
- city,
145
- country,
146
- email,
147
- firstName,
148
- lastName,
149
- phone,
186
+ category: category,
187
+ companyId: companyId,
188
+ currency: currency,
189
+ customerId: customerId,
190
+ date: date,
191
+ discount: discount,
192
+ discountUnit: discountUnit,
193
+ expiryDate: expiryDate,
194
+ invoiceStatus: invoiceStatus,
195
+ note: note,
196
+ quoteStatus: quoteStatus,
197
+ ref: ref,
198
+ subTotal: subTotal,
199
+ taxValue: taxValue,
200
+ total: total,
201
+ customer: {
202
+ create: {
203
+ address: address,
204
+ city: city,
205
+ country: country,
206
+ email: email,
207
+ firstName: firstName,
208
+ lastName: lastName,
209
+ phone: phone,
210
+ },
150
211
  },
151
- },
152
- services: {
153
- createMany: {
154
- data: mappedServices,
212
+ services: {
213
+ createMany: {
214
+ data: mappedServices,
215
+ },
155
216
  },
156
217
  },
157
- },
158
- });
159
- }
160
- }
161
- // Parent edit flow
162
- if (mode === 'Edit') {
163
- try {
164
- const foundQuoteInvoice = yield prisma.quoteInvoice.findUnique({
165
- where: {
166
- id,
167
- },
168
- });
169
- const filteredEditServices = services === null || services === void 0 ? void 0 : services.filter(({ mode: _mode }) => _mode === 'Edit');
170
- const filteredCreateServices = (_e = services === null || services === void 0 ? void 0 : services.filter(({ mode: __mode }) => __mode === 'Create')) === null || _e === void 0 ? void 0 : _e.map((item) => {
171
- const toReturn = Object.assign({}, item);
172
- delete toReturn.mode;
173
- return (Object.assign(Object.assign({}, toReturn), { quoteInvoiceId: id }));
174
- });
175
- if (filteredEditServices === null || filteredEditServices === void 0 ? void 0 : filteredEditServices.length) {
176
- filteredEditServices === null || filteredEditServices === void 0 ? void 0 : filteredEditServices.map((item) => __awaiter(void 0, void 0, void 0, function* () {
177
- yield prisma.service.update({
218
+ })];
219
+ case 4:
220
+ quoteInvoice = _d.sent();
221
+ _d.label = 5;
222
+ case 5:
223
+ if (!(mode === 'Edit')) return [3 /*break*/, 12];
224
+ _d.label = 6;
225
+ case 6:
226
+ _d.trys.push([6, 11, , 12]);
227
+ return [4 /*yield*/, prisma.quoteInvoice.findUnique({
178
228
  where: {
179
- id: item.id,
180
- },
181
- data: {
182
- description: item.description,
183
- name: item.name,
184
- price: item.price,
185
- quantity: item.quantity,
186
- quoteInvoiceId: item.quoteInvoiceId,
187
- total: item.total,
229
+ id: id,
188
230
  },
189
- });
190
- }));
191
- }
192
- if (filteredCreateServices === null || filteredCreateServices === void 0 ? void 0 : filteredCreateServices.length) {
193
- yield prisma.stellarService.createMany({
194
- data: filteredCreateServices,
231
+ })];
232
+ case 7:
233
+ foundQuoteInvoice = _d.sent();
234
+ filteredEditServices = services === null || services === void 0 ? void 0 : services.filter(function (_a) {
235
+ var _mode = _a.mode;
236
+ return _mode === 'Edit';
195
237
  });
196
- }
197
- quoteInvoice = yield prisma.quoteInvoice.update({
198
- where: {
199
- id,
200
- },
201
- data: Object.assign(Object.assign({}, foundQuoteInvoice), { category,
202
- companyId,
203
- currency,
204
- customerId,
205
- date,
206
- expiryDate,
207
- invoiceStatus,
208
- note,
209
- quoteStatus,
210
- ref,
211
- subTotal,
212
- taxValue,
213
- total }),
214
- });
215
- }
216
- catch (err) {
217
- // console.log('err lib', err);
238
+ filteredCreateServices = (_c = services === null || services === void 0 ? void 0 : services.filter(function (_a) {
239
+ var __mode = _a.mode;
240
+ return __mode === 'Create';
241
+ })) === null || _c === void 0 ? void 0 : _c.map(function (item) {
242
+ var toReturn = __assign({}, item);
243
+ delete toReturn.mode;
244
+ return (__assign(__assign({}, toReturn), { quoteInvoiceId: id }));
245
+ });
246
+ if (filteredEditServices === null || filteredEditServices === void 0 ? void 0 : filteredEditServices.length) {
247
+ filteredEditServices === null || filteredEditServices === void 0 ? void 0 : filteredEditServices.map(function (item) { return __awaiter(void 0, void 0, void 0, function () {
248
+ return __generator(this, function (_a) {
249
+ switch (_a.label) {
250
+ case 0: return [4 /*yield*/, prisma.service.update({
251
+ where: {
252
+ id: item.id,
253
+ },
254
+ data: {
255
+ description: item.description,
256
+ name: item.name,
257
+ price: item.price,
258
+ quantity: item.quantity,
259
+ quoteInvoiceId: item.quoteInvoiceId,
260
+ total: item.total,
261
+ },
262
+ })];
263
+ case 1:
264
+ _a.sent();
265
+ return [2 /*return*/];
266
+ }
267
+ });
268
+ }); });
269
+ }
270
+ if (!(filteredCreateServices === null || filteredCreateServices === void 0 ? void 0 : filteredCreateServices.length)) return [3 /*break*/, 9];
271
+ return [4 /*yield*/, prisma.stellarService.createMany({
272
+ data: filteredCreateServices,
273
+ })];
274
+ case 8:
275
+ _d.sent();
276
+ _d.label = 9;
277
+ case 9: return [4 /*yield*/, prisma.quoteInvoice.update({
278
+ where: {
279
+ id: id,
280
+ },
281
+ data: __assign(__assign({}, foundQuoteInvoice), { category: category, companyId: companyId, currency: currency, customerId: customerId, date: date, expiryDate: expiryDate, invoiceStatus: invoiceStatus, note: note, quoteStatus: quoteStatus, ref: ref, subTotal: subTotal, taxValue: taxValue, total: total }),
282
+ })];
283
+ case 10:
284
+ quoteInvoice = _d.sent();
285
+ return [3 /*break*/, 12];
286
+ case 11:
287
+ err_1 = _d.sent();
288
+ return [3 /*break*/, 12];
289
+ case 12: return [2 /*return*/, quoteInvoice];
218
290
  }
219
- }
220
- return quoteInvoice;
221
- });
291
+ });
292
+ }); };
222
293
  exports.postQuoteInvoice = postQuoteInvoice;
223
- const deleteQuoteInvoice = (_g) => __awaiter(void 0, [_g], void 0, function* ({ prisma, id, }) {
224
- const quoteInvoice = yield prisma.quoteInvoice.delete({
225
- where: {
226
- id,
227
- },
294
+ var deleteQuoteInvoice = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
295
+ var quoteInvoice;
296
+ var prisma = _b.prisma, id = _b.id;
297
+ return __generator(this, function (_c) {
298
+ switch (_c.label) {
299
+ case 0: return [4 /*yield*/, prisma.quoteInvoice.delete({
300
+ where: {
301
+ id: id,
302
+ },
303
+ })];
304
+ case 1:
305
+ quoteInvoice = _c.sent();
306
+ return [2 /*return*/, quoteInvoice];
307
+ }
228
308
  });
229
- return quoteInvoice;
230
- });
309
+ }); };
231
310
  exports.deleteQuoteInvoice = deleteQuoteInvoice;
@@ -9,19 +9,54 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  step((generator = generator.apply(thisArg, _arguments || [])).next());
10
10
  });
11
11
  };
12
+ var __generator = (this && this.__generator) || function (thisArg, body) {
13
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
14
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
15
+ function verb(n) { return function (v) { return step([n, v]); }; }
16
+ function step(op) {
17
+ if (f) throw new TypeError("Generator is already executing.");
18
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
19
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
20
+ if (y = 0, t) op = [op[0] & 2, t.value];
21
+ switch (op[0]) {
22
+ case 0: case 1: t = op; break;
23
+ case 4: _.label++; return { value: op[1], done: false };
24
+ case 5: _.label++; y = op[1]; op = [0]; continue;
25
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
26
+ default:
27
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
28
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
29
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
30
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
31
+ if (t[2]) _.ops.pop();
32
+ _.trys.pop(); continue;
33
+ }
34
+ op = body.call(thisArg, _);
35
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
36
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
37
+ }
38
+ };
12
39
  Object.defineProperty(exports, "__esModule", { value: true });
13
40
  exports.postQuotesInvoicesReport = void 0;
14
- const postQuotesInvoicesReport = (_a) => __awaiter(void 0, [_a], void 0, function* ({ include, orderBy, prisma, queryWhere, }) {
15
- const quotesInvoices = yield prisma.$transaction([
16
- prisma.quoteInvoice.count({
17
- where: queryWhere,
18
- }),
19
- prisma.quoteInvoice.findMany({
20
- include,
21
- orderBy,
22
- where: queryWhere,
23
- }),
24
- ]);
25
- return quotesInvoices;
26
- });
41
+ var postQuotesInvoicesReport = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
42
+ var quotesInvoices;
43
+ var include = _b.include, orderBy = _b.orderBy, prisma = _b.prisma, queryWhere = _b.queryWhere;
44
+ return __generator(this, function (_c) {
45
+ switch (_c.label) {
46
+ case 0: return [4 /*yield*/, prisma.$transaction([
47
+ prisma.quoteInvoice.count({
48
+ where: queryWhere,
49
+ }),
50
+ prisma.quoteInvoice.findMany({
51
+ include: include,
52
+ orderBy: orderBy,
53
+ where: queryWhere,
54
+ }),
55
+ ])];
56
+ case 1:
57
+ quotesInvoices = _c.sent();
58
+ return [2 /*return*/, quotesInvoices];
59
+ }
60
+ });
61
+ }); };
27
62
  exports.postQuotesInvoicesReport = postQuotesInvoicesReport;