@react-pakistan/util-functions 1.22.56 → 1.22.58

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.
@@ -32,7 +32,10 @@ interface PostQuoteInvoiceArgs {
32
32
  subTotal: string;
33
33
  taxValue: string;
34
34
  total: string;
35
- productIds: any[];
35
+ products: [{
36
+ id: string;
37
+ productQuantity: string;
38
+ }];
36
39
  phone: string;
37
40
  lastName: string;
38
41
  firstName: string;
@@ -49,6 +52,6 @@ interface DeleteQuoteInvoiceArgs {
49
52
  export declare const getQuotesInvoices: ({ prisma, }: GetQuotesInvoicesArgs) => Promise<Array<QuoteInvoiceBE>>;
50
53
  export declare const getQuoteInvoiceById: ({ prisma, id, }: GetQuoteInvoiceByIdArgs) => Promise<QuoteInvoiceBE>;
51
54
  export declare const postQuotesInvoices: ({ currentPage, pageLimit, prisma, queryWhere, }: PostQuotesInvoicesArgs) => Promise<Array<QuoteInvoiceBE>>;
52
- export declare const postQuoteInvoice: ({ category, companyId, currency, customerId, date, discount, discountUnit, expiryDate, id, mode, note, ref, services, status, subTotal, taxValue, total, productIds, phone, lastName, firstName, email, country, city, address, prisma, }: PostQuoteInvoiceArgs) => Promise<Array<QuoteInvoiceBE>>;
55
+ export declare const postQuoteInvoice: ({ category, companyId, currency, customerId, date, discount, discountUnit, expiryDate, id, mode, note, ref, services, status, subTotal, taxValue, total, products, phone, lastName, firstName, email, country, city, address, prisma, }: PostQuoteInvoiceArgs) => Promise<QuoteInvoiceBE>;
53
56
  export declare const deleteQuoteInvoice: ({ prisma, id, }: DeleteQuoteInvoiceArgs) => Promise<QuoteInvoiceBE>;
54
57
  export {};
@@ -60,7 +60,9 @@ const postQuotesInvoices = (_c) => __awaiter(void 0, [_c], void 0, function* ({
60
60
  return quotesInvoices;
61
61
  });
62
62
  exports.postQuotesInvoices = postQuotesInvoices;
63
- const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ category, companyId, currency, customerId, date, discount, discountUnit, expiryDate, id, mode, note, ref, services, status, subTotal, taxValue, total, productIds, phone, lastName, firstName, email, country, city, address, prisma, }) {
63
+ const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ category, companyId, currency, customerId, date, discount, discountUnit, expiryDate, id, mode, note, ref, services, status, subTotal, taxValue, total,
64
+ // productIds,
65
+ products, phone, lastName, firstName, email, country, city, address, prisma, }) {
64
66
  let quoteInvoice;
65
67
  if (mode === 'Create') {
66
68
  const mappedServices = services.map((item) => {
@@ -95,16 +97,29 @@ const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ ca
95
97
  products: true,
96
98
  },
97
99
  });
98
- yield prisma.quotesInvoicesOnStellarProducts.create({
99
- data: {
100
- quoteInvoiceId: quoteInvoice.id,
101
- productId: productIds[0].id,
102
- },
103
- include: {
104
- product: true,
105
- quoteInvoice: true,
106
- },
107
- });
100
+ products.map((_e) => __awaiter(void 0, [_e], void 0, function* ({ id: __id, productQuantity }) {
101
+ yield prisma.quotesInvoicesOnStellarProducts.create({
102
+ data: {
103
+ quoteInvoiceId: quoteInvoice === null || quoteInvoice === void 0 ? void 0 : quoteInvoice.id,
104
+ productId: __id,
105
+ productQuantity,
106
+ },
107
+ include: {
108
+ product: true,
109
+ quoteInvoice: true,
110
+ },
111
+ });
112
+ }));
113
+ // await prisma.quotesInvoicesOnStellarProducts.create({
114
+ // data: {
115
+ // quoteInvoiceId: quoteInvoice.id,
116
+ // productId: productIds[0].id,
117
+ // },
118
+ // include: {
119
+ // product: true,
120
+ // quoteInvoice: true,
121
+ // },
122
+ // });
108
123
  }
109
124
  else {
110
125
  quoteInvoice = yield prisma.quoteInvoice.create({
@@ -191,9 +206,7 @@ const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ ca
191
206
  status,
192
207
  subTotal,
193
208
  taxValue,
194
- total, products: {
195
- connect: productIds,
196
- } }),
209
+ total }),
197
210
  });
198
211
  }
199
212
  catch (err) {
@@ -203,7 +216,7 @@ const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ ca
203
216
  return quoteInvoice;
204
217
  });
205
218
  exports.postQuoteInvoice = postQuoteInvoice;
206
- const deleteQuoteInvoice = (_e) => __awaiter(void 0, [_e], void 0, function* ({ prisma, id, }) {
219
+ const deleteQuoteInvoice = (_f) => __awaiter(void 0, [_f], void 0, function* ({ prisma, id, }) {
207
220
  const quoteInvoice = yield prisma.quoteInvoice.delete({
208
221
  where: {
209
222
  id,
@@ -1,6 +1,6 @@
1
1
  export * from './basic-get';
2
2
  export * from './basic-post';
3
- export * from './camel-to-sentense-case';
3
+ export * from './camel-to-sentence-case';
4
4
  export * from './check-even-odd-length';
5
5
  export * from './countries';
6
6
  export * from './currencies';
@@ -27,6 +27,7 @@ export * from './resolve-grid';
27
27
  export * from './resolve-initials';
28
28
  export * from './slugify';
29
29
  export * from './truncate-text';
30
+ export * from './url-to-sentence-case';
30
31
  export * from './validate-comment';
31
32
  export * from './validate-email';
32
33
  export * from './validate-name';
package/general/index.js CHANGED
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  // export * from './time-out';
18
18
  __exportStar(require("./basic-get"), exports);
19
19
  __exportStar(require("./basic-post"), exports);
20
- __exportStar(require("./camel-to-sentense-case"), exports);
20
+ __exportStar(require("./camel-to-sentence-case"), exports);
21
21
  __exportStar(require("./check-even-odd-length"), exports);
22
22
  __exportStar(require("./countries"), exports);
23
23
  __exportStar(require("./currencies"), exports);
@@ -44,6 +44,7 @@ __exportStar(require("./resolve-grid"), exports);
44
44
  __exportStar(require("./resolve-initials"), exports);
45
45
  __exportStar(require("./slugify"), exports);
46
46
  __exportStar(require("./truncate-text"), exports);
47
+ __exportStar(require("./url-to-sentence-case"), exports);
47
48
  __exportStar(require("./validate-comment"), exports);
48
49
  __exportStar(require("./validate-email"), exports);
49
50
  __exportStar(require("./validate-name"), exports);
@@ -0,0 +1,10 @@
1
+ /**
2
+ * A util function to convert url into sentence case
3
+ *
4
+ * @param str - string provided to convert url into sentence case - taimoorKhan
5
+ * @returns string in sentence case - Taimoor Khan
6
+ * @author Taimoor Khan
7
+ * @remarks
8
+ */
9
+ /** End file docs */
10
+ export declare const urlToSentenceCase: (url: string) => string;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * A util function to convert url into sentence case
4
+ *
5
+ * @param str - string provided to convert url into sentence case - taimoorKhan
6
+ * @returns string in sentence case - Taimoor Khan
7
+ * @author Taimoor Khan
8
+ * @remarks
9
+ */
10
+ /** End file docs */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.urlToSentenceCase = void 0;
13
+ const urlToSentenceCase = (url) => {
14
+ const chunks = url.split('/');
15
+ const pageName = chunks[chunks.length - 1];
16
+ return pageName
17
+ .split('-')
18
+ .map((_str) => _str.charAt(0).toUpperCase() + _str.slice(1))
19
+ .join(' ');
20
+ };
21
+ exports.urlToSentenceCase = urlToSentenceCase;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "1.22.56",
3
+ "version": "1.22.58",
4
4
  "description": "A library of all util functions",
5
5
  "main": "index.js",
6
6
  "scripts": {