@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.
- package/api/cors/index.js +6 -6
- package/api/stellar-solutions/app-user/index.js +97 -38
- package/api/stellar-solutions/banking-detail/index.js +107 -48
- package/api/stellar-solutions/branch/index.js +107 -48
- package/api/stellar-solutions/company/index.js +124 -57
- package/api/stellar-solutions/company-report/index.js +48 -13
- package/api/stellar-solutions/contact/index.js +132 -65
- package/api/stellar-solutions/currency/index.js +101 -42
- package/api/stellar-solutions/customer/index.js +149 -74
- package/api/stellar-solutions/expense/index.js +132 -65
- package/api/stellar-solutions/expense-category/index.js +133 -66
- package/api/stellar-solutions/lead/index.js +132 -65
- package/api/stellar-solutions/menu-order/index.js +97 -38
- package/api/stellar-solutions/payment/index.js +135 -77
- package/api/stellar-solutions/payment-mode/index.js +90 -31
- package/api/stellar-solutions/preference/index.js +71 -28
- package/api/stellar-solutions/product/index.js +144 -77
- package/api/stellar-solutions/product-category/index.js +130 -63
- package/api/stellar-solutions/profile/index.js +152 -77
- package/api/stellar-solutions/quote-invoice/index.js +280 -201
- package/api/stellar-solutions/quote-invoice-report/index.js +48 -13
- package/api/stellar-solutions/tax/index.js +103 -44
- package/constants/react-pakistan.js +11 -22
- package/constants/social-media-sizes.js +33 -32
- package/general/basic-get.js +68 -6
- package/general/basic-post.js +55 -6
- package/general/camel-to-sentence-case.js +3 -3
- package/general/check-even-odd-length.js +1 -1
- package/general/create-date.js +4 -4
- package/general/dynamic-page-limit.js +15 -4
- package/general/enum-to-text.js +2 -2
- package/general/fetch-supabase-image.js +53 -15
- package/general/format-date.js +13 -12
- package/general/generate-blog-schema.js +10 -9
- package/general/generate-breadcrumb-schema.js +5 -4
- package/general/generate-faq-schema.js +5 -3
- package/general/generate-grid.js +2 -2
- package/general/generate-organization-schema.js +14 -13
- package/general/get-day-name.js +1 -1
- package/general/get-full-name.js +4 -1
- package/general/get-href.js +1 -1
- package/general/get-month-name.js +1 -1
- package/general/get-pathname.js +1 -1
- package/general/index.d.ts +2 -2
- package/general/index.js +2 -2
- package/general/is-next-button-disabled.js +1 -1
- package/general/is-odd.js +1 -1
- package/general/is-previous-button-disabled.js +1 -1
- package/general/remove-data-image-prefix.js +2 -2
- package/general/repeat-times.js +3 -3
- package/general/resolve-anchor-link.js +4 -4
- package/general/resolve-current-date.js +2 -2
- package/general/resolve-grid.js +1 -1
- package/general/resolve-initials.js +2 -2
- package/general/set-timezone.js +6 -3
- package/general/slugify.js +2 -2
- package/general/text-to-enum.js +1 -1
- package/general/text-to-sentence-case.js +1 -1
- package/general/truncate-text.js +1 -1
- package/general/upload-blob-to-private-supabase.d.ts +11 -0
- package/general/upload-blob-to-private-supabase.js +62 -0
- package/general/upload-blob-to-public-supabase.d.ts +11 -0
- package/general/upload-blob-to-public-supabase.js +62 -0
- package/general/upload-image-to-private-supabase.js +51 -15
- package/general/upload-image-to-public-supabase.js +51 -15
- package/general/url-to-sentence-case.js +4 -4
- package/general/validate-comment.js +1 -1
- package/general/validate-email.js +2 -2
- package/general/validate-name.js +1 -1
- package/hooks/index.d.ts +0 -1
- package/hooks/index.js +0 -1
- package/hooks/use-change.js +14 -5
- package/hooks/use-debounce.js +7 -6
- package/hooks/use-fetch.js +82 -31
- package/hooks/use-force-render.js +3 -3
- package/hooks/use-ip-geo-location.js +57 -22
- package/hooks/use-is-mobile.js +6 -6
- package/hooks/use-position.js +16 -16
- package/hooks/use-sticky.js +9 -8
- package/hooks/use-toggle-state.js +6 -5
- package/hooks/use-window-event-listener.js +4 -4
- package/local-storage/get-storage-value.js +2 -2
- package/local-storage/remove-storage-value.js +1 -1
- package/local-storage/set-storage-value.js +1 -1
- package/package.json +1 -1
- package/storybook/generate-sitemap.js +6 -22
- package/storybook/preview.js +13 -2
- package/storybook/react-design-story-script.js +7 -11
- package/storybook/react-emoji-collection.js +23 -33
- package/storybook/react-emoji-story-script.js +9 -13
- package/storybook/react-emoji-story-template.js +1 -46
- package/storybook/react-icon-collection.js +17 -27
- package/storybook/react-icon-story-script.js +9 -13
- package/storybook/react-icon-story-template.js +1 -46
- package/storybook/react-logo-collection.js +17 -27
- package/storybook/react-logo-story-script.js +9 -13
- package/storybook/react-logo-story-template.js +1 -46
- package/storybook/responsive-component.js +11 -46
- package/storybook/theme.js +4 -4
- package/general/upload-image-blob-to-private-supabase.d.ts +0 -11
- package/general/upload-image-blob-to-private-supabase.js +0 -27
- package/general/upload-image-blob-to-public-supabase.d.ts +0 -11
- package/general/upload-image-blob-to-public-supabase.js +0 -27
- package/hooks/with-seo.d.ts +0 -9
- 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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
28
|
-
});
|
|
74
|
+
}); };
|
|
29
75
|
exports.getQuotesInvoices = getQuotesInvoices;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
44
|
-
});
|
|
98
|
+
}); };
|
|
45
99
|
exports.getQuoteInvoiceById = getQuoteInvoiceById;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
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
|
-
|
|
153
|
-
|
|
154
|
-
|
|
212
|
+
services: {
|
|
213
|
+
createMany: {
|
|
214
|
+
data: mappedServices,
|
|
215
|
+
},
|
|
155
216
|
},
|
|
156
217
|
},
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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:
|
|
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
|
-
|
|
193
|
-
|
|
194
|
-
|
|
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
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
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
|
-
|
|
221
|
-
});
|
|
291
|
+
});
|
|
292
|
+
}); };
|
|
222
293
|
exports.postQuoteInvoice = postQuoteInvoice;
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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;
|