@react-pakistan/util-functions 1.23.63 → 1.23.66

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.
@@ -128,8 +128,37 @@ var postPayment = function (_a) { return __awaiter(void 0, [_a], void 0, functio
128
128
  }
129
129
  return 0;
130
130
  };
131
- if (!(calculateBalance() === 0)) return [3 /*break*/, 4];
132
- return [4 /*yield*/, prisma.invoice.update({
131
+ return [4 /*yield*/, prisma.payment.upsert({
132
+ where: {
133
+ id: id,
134
+ },
135
+ update: {
136
+ amount: amount,
137
+ attachment: attachment,
138
+ date: date,
139
+ description: description,
140
+ mode: mode,
141
+ paymentType: paymentType,
142
+ quoteInvoiceId: quoteInvoiceId,
143
+ ref: ref,
144
+ },
145
+ create: {
146
+ amount: amount,
147
+ attachment: attachment,
148
+ balance: String(calculateBalance()),
149
+ currency: currency,
150
+ date: date,
151
+ description: description,
152
+ mode: mode,
153
+ paymentType: paymentType,
154
+ quoteInvoiceId: quoteInvoiceId,
155
+ ref: ref,
156
+ },
157
+ })];
158
+ case 3:
159
+ payment = _c.sent();
160
+ if (!(calculateBalance() === 0)) return [3 /*break*/, 5];
161
+ return [4 /*yield*/, prisma.quoteInvoice.update({
133
162
  where: {
134
163
  id: quoteInvoiceId,
135
164
  },
@@ -137,39 +166,10 @@ var postPayment = function (_a) { return __awaiter(void 0, [_a], void 0, functio
137
166
  invoiceStatus: 'PAID',
138
167
  },
139
168
  })];
140
- case 3:
169
+ case 4:
141
170
  _c.sent();
142
- _c.label = 4;
143
- case 4: return [4 /*yield*/, prisma.payment.upsert({
144
- where: {
145
- id: id,
146
- },
147
- update: {
148
- amount: amount,
149
- attachment: attachment,
150
- date: date,
151
- description: description,
152
- mode: mode,
153
- paymentType: paymentType,
154
- quoteInvoiceId: quoteInvoiceId,
155
- ref: ref,
156
- },
157
- create: {
158
- amount: amount,
159
- attachment: attachment,
160
- balance: String(calculateBalance()),
161
- currency: currency,
162
- date: date,
163
- description: description,
164
- mode: mode,
165
- paymentType: paymentType,
166
- quoteInvoiceId: quoteInvoiceId,
167
- ref: ref,
168
- },
169
- })];
170
- case 5:
171
- payment = _c.sent();
172
- return [2 /*return*/, payment];
171
+ _c.label = 5;
172
+ case 5: return [2 /*return*/, payment];
173
173
  }
174
174
  });
175
175
  }); };
@@ -1,6 +1,8 @@
1
1
  export declare enum DATE_FORMATS {
2
2
  LOCALE_DATE = "LOCALE_DATE",
3
3
  DD_MM = "DD_MM",
4
- YYYY_MM_DD = "YYYY_MM_DD"
4
+ YYYY_MM_DD = "YYYY_MM_DD",
5
+ DAY_DD_YYYY = "DAY_DD_YYYY",
6
+ DAY_DD_YY_COMPACT = "DAY_DD_YY_COMPACT"
5
7
  }
6
8
  export declare const formatDate: (str: string, format: DATE_FORMATS) => string;
@@ -1,12 +1,16 @@
1
1
  "use strict";
2
+ /* eslint-disable @typescript-eslint/indent */
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.formatDate = exports.DATE_FORMATS = void 0;
5
+ var get_day_name_1 = require("./get-day-name");
4
6
  var get_month_name_1 = require("./get-month-name");
5
7
  var DATE_FORMATS;
6
8
  (function (DATE_FORMATS) {
7
9
  DATE_FORMATS["LOCALE_DATE"] = "LOCALE_DATE";
8
10
  DATE_FORMATS["DD_MM"] = "DD_MM";
9
11
  DATE_FORMATS["YYYY_MM_DD"] = "YYYY_MM_DD";
12
+ DATE_FORMATS["DAY_DD_YYYY"] = "DAY_DD_YYYY";
13
+ DATE_FORMATS["DAY_DD_YY_COMPACT"] = "DAY_DD_YY_COMPACT";
10
14
  })(DATE_FORMATS || (exports.DATE_FORMATS = DATE_FORMATS = {}));
11
15
  var formatDate = function (str, format) {
12
16
  var _a;
@@ -19,6 +23,12 @@ var formatDate = function (str, format) {
19
23
  _a[DATE_FORMATS.LOCALE_DATE] = dateObj.toLocaleDateString(),
20
24
  _a[DATE_FORMATS.DD_MM] = "".concat(dateObj.getDate(), " ").concat((0, get_month_name_1.getMonthName)(dateObj.getMonth())),
21
25
  _a[DATE_FORMATS.YYYY_MM_DD] = "".concat(dateObj.getFullYear(), "-").concat(monthNumberInTwoDigits, "-").concat(dateNumberInTowDigits),
26
+ _a[DATE_FORMATS.DAY_DD_YYYY] = "".concat((0, get_day_name_1.getDayName)(dateObj
27
+ .getDay()), ", ").concat(dateObj
28
+ .getDate(), " ").concat((0, get_month_name_1.getMonthName)(dateObj.getMonth()), " ").concat(dateObj.getFullYear()),
29
+ _a[DATE_FORMATS.DAY_DD_YY_COMPACT] = "".concat((0, get_day_name_1.getDayName)(dateObj.getDay())
30
+ .slice(3), ", ").concat(dateObj.getDate(), " ").concat((0, get_month_name_1.getMonthName)(dateObj
31
+ .getMonth()), " ").concat(String(dateObj.getFullYear()).slice(2, 5)),
22
32
  _a);
23
33
  return dateMap[format];
24
34
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "1.23.63",
3
+ "version": "1.23.66",
4
4
  "description": "A library of all util functions",
5
5
  "main": "index.js",
6
6
  "scripts": {