@react-pakistan/util-functions 1.23.16 → 1.23.17

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.
@@ -54,6 +54,6 @@ interface DeleteQuoteInvoiceArgs {
54
54
  export declare const getQuotesInvoices: ({ prisma, }: GetQuotesInvoicesArgs) => Promise<Array<QuoteInvoiceBE>>;
55
55
  export declare const getQuoteInvoiceById: ({ prisma, id, }: GetQuoteInvoiceByIdArgs) => Promise<QuoteInvoiceBE>;
56
56
  export declare const postQuotesInvoices: ({ currentPage, pageLimit, prisma, queryWhere, }: PostQuotesInvoicesArgs) => Promise<Array<QuoteInvoiceBE>>;
57
- export declare const postQuoteInvoice: ({ address, category, city, companyId, country, createdAt, currency, customerId, date, discount, discountUnit, email, expiryDate, firstName, id, invoiceStatus, lastName, mode, note, phone, prisma, products, quoteStatus, ref, services, subTotal, taxValue, total, }: PostQuoteInvoiceArgs) => Promise<QuoteInvoiceBE>;
57
+ export declare const postQuoteInvoice: ({ 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, }: PostQuoteInvoiceArgs) => Promise<QuoteInvoiceBE>;
58
58
  export declare const deleteQuoteInvoice: ({ prisma, id, }: DeleteQuoteInvoiceArgs) => Promise<QuoteInvoiceBE>;
59
59
  export {};
@@ -67,9 +67,10 @@ const postQuotesInvoices = (_c) => __awaiter(void 0, [_c], void 0, function* ({
67
67
  return quotesInvoices;
68
68
  });
69
69
  exports.postQuotesInvoices = postQuotesInvoices;
70
- const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ address, category, city, companyId, country, createdAt, currency, customerId, date, discount, discountUnit, email, expiryDate, firstName, id, invoiceStatus, lastName, mode, note, phone, prisma, products, quoteStatus, ref, services, subTotal, taxValue, total, }) {
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
71
  var _e;
72
72
  let quoteInvoice;
73
+ // Parent create flow
73
74
  if (mode === 'Create') {
74
75
  let mappedServices;
75
76
  if (services === null || services === void 0 ? void 0 : services.length) {
@@ -79,11 +80,10 @@ const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ ad
79
80
  return itemToReturn;
80
81
  });
81
82
  }
83
+ // Parent customer or company flow
82
84
  if (customerId || companyId) {
83
85
  quoteInvoice = yield prisma.quoteInvoice.create({
84
- data: Object.assign({
85
- // id,
86
- category,
86
+ data: Object.assign({ category,
87
87
  companyId,
88
88
  currency,
89
89
  customerId,
@@ -91,14 +91,13 @@ const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ ad
91
91
  discount,
92
92
  discountUnit,
93
93
  expiryDate,
94
+ invoiceStatus,
94
95
  note,
95
- ref,
96
96
  quoteStatus,
97
- invoiceStatus,
97
+ ref,
98
98
  subTotal,
99
99
  taxValue,
100
- total,
101
- createdAt }, (mappedServices && {
100
+ total }, (mappedServices && {
102
101
  services: {
103
102
  createMany: {
104
103
  data: mappedServices,
@@ -119,11 +118,11 @@ const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ ad
119
118
  },
120
119
  });
121
120
  })));
121
+ // Parent customer creation flow
122
122
  }
123
123
  else {
124
124
  quoteInvoice = yield prisma.quoteInvoice.create({
125
125
  data: {
126
- // id,
127
126
  category,
128
127
  companyId,
129
128
  currency,
@@ -132,14 +131,13 @@ const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ ad
132
131
  discount,
133
132
  discountUnit,
134
133
  expiryDate,
134
+ invoiceStatus,
135
135
  note,
136
- ref,
137
136
  quoteStatus,
138
- invoiceStatus,
137
+ ref,
139
138
  subTotal,
140
139
  taxValue,
141
140
  total,
142
- createdAt,
143
141
  customer: {
144
142
  create: {
145
143
  address,
@@ -160,6 +158,7 @@ const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ ad
160
158
  });
161
159
  }
162
160
  }
161
+ // Parent edit flow
163
162
  if (mode === 'Edit') {
164
163
  try {
165
164
  const foundQuoteInvoice = yield prisma.quoteInvoice.findUnique({
@@ -201,41 +200,19 @@ const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ ad
201
200
  customerId,
202
201
  date,
203
202
  expiryDate,
203
+ invoiceStatus,
204
204
  note,
205
- ref,
206
205
  quoteStatus,
207
- invoiceStatus,
206
+ ref,
208
207
  subTotal,
209
208
  taxValue,
210
209
  total }),
211
210
  });
212
211
  }
213
212
  catch (err) {
214
- // console.log('err', err);
213
+ console.log('err lib', err);
215
214
  }
216
215
  }
217
- // if (quoteInvoice) {
218
- // console.log('=>>>>>', quoteInvoice);
219
- // // products.map(async (product) => {
220
- // await prisma.quoteInvoice.update({
221
- // where: {
222
- // id: quoteInvoice.id,
223
- // },
224
- // data: {
225
- // products: {
226
- // connect: products,
227
- // },
228
- // // quoteInvoiceId: quoteInvoice?.id,
229
- // // productId: product.id,
230
- // // productQuantity: product.productQuantity,
231
- // },
232
- // include: {
233
- // product: true,
234
- // quoteInvoice: true,
235
- // },
236
- // // });
237
- // });
238
- // }
239
216
  return quoteInvoice;
240
217
  });
241
218
  exports.postQuoteInvoice = postQuoteInvoice;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "1.23.16",
3
+ "version": "1.23.17",
4
4
  "description": "A library of all util functions",
5
5
  "main": "index.js",
6
6
  "scripts": {