shareneus 1.4.46 → 1.4.47

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.
@@ -5,36 +5,13 @@ export declare class TrUtils {
5
5
  static IsZero(Value: any): boolean;
6
6
  static IsFixedZero(Value: any): boolean;
7
7
  static Stringify(RecordData: any): any;
8
- static CombineProductDetails(product: any): string;
9
- static GetProductRegistrationNo(product: any): any;
10
- static GetEquipmentModel(product: any): string;
11
- static GetEquipmentSerialNo(equipment: any): any;
12
8
  static ConcatObjects(obj1: any, obj2: any): any;
13
9
  static ConvertPercToVal(Discount: any, Total: any): number | null;
14
- static ConvertMinsToHour(Mins: any): any;
15
- static ConvertHourToMin(HrsData: any): any;
16
10
  static FixedTo(value: any): number;
17
11
  static FixPriceValue(Value: any): string;
18
- static ConvertValToPerc(Discount: number, Total: number): number | null;
19
- static CheckARIndividualStatusValid(Part: any, Field: any): boolean;
20
- static CheckARIndividualStatusApproved(Part: any, Field: any): boolean;
21
- static CheckARIndividualStatusCompleted(Part: any, Field: any): boolean;
22
- static CheckAndUnsubscribeSubject(Subject: any): void;
23
12
  static SetValueToZeroIfNull(Value: any): any;
24
13
  static SetPercToStringIfNull(Value: any): any;
25
14
  static SetPercToTrueIfNull(Value: any): any;
26
15
  static CheckInvalidSelect(Value: any): boolean;
27
- static DateSorting(date1: any, date2: any): any;
28
- static DateSortingMonthandYear(date1: any, date2: any): any;
29
- static InvoiceIdSorting(data1: any, data2: any): any;
30
- static IdSorting(id: any, data1: any, data2: any): any;
31
- static GridNumberSorting(num1: any, num2: any): any;
32
- static AlphabetSorter(argDatalist: any, Identifier: any): any;
33
- static ArrayAlphabetSorting(SortingList: any): any;
34
- static GetHours(hour: any, isPM: any): any;
35
16
  static isTaxable(tax: string): boolean;
36
- static IsItemFromEstimate(ItemId: string): boolean;
37
- static IsItemInsurance(PayBy: string): boolean;
38
- static GetMonthsArray(): any[];
39
- static GetDurationInHrsAndMins(duration: number): string;
40
17
  }
@@ -1,9 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TrUtils = void 0;
4
- // import { HttpClient } from '@angular/common/http';
5
- const enums_1 = require("../enums/enums");
6
- // import { LaborStatusEnum } from '../enums/enums';
7
4
  class TrUtils {
8
5
  static IsNull(Value) {
9
6
  return Value === null || typeof Value === 'undefined';
@@ -24,28 +21,6 @@ class TrUtils {
24
21
  let StringifiedResult = JSON.parse(JSON.stringify(RecordData));
25
22
  return StringifiedResult;
26
23
  }
27
- static CombineProductDetails(product) {
28
- return product.Model + ' ' + product.Year + ' ' + product.Var;
29
- }
30
- static GetProductRegistrationNo(product) {
31
- if (!this.IsNull(product)) {
32
- return product.RegNo;
33
- }
34
- else {
35
- return null;
36
- }
37
- }
38
- static GetEquipmentModel(product) {
39
- return product.Make + ' ' + product.Model;
40
- }
41
- static GetEquipmentSerialNo(equipment) {
42
- if (!this.IsNull(equipment)) {
43
- return equipment.SNo;
44
- }
45
- else {
46
- return null;
47
- }
48
- }
49
24
  static ConcatObjects(obj1, obj2) {
50
25
  // tslint:disable-next-line:forin
51
26
  for (let key in obj2) {
@@ -71,22 +46,6 @@ class TrUtils {
71
46
  return value;
72
47
  }
73
48
  }
74
- static ConvertMinsToHour(Mins) {
75
- let Num;
76
- Mins = Number(Mins);
77
- let Hrs = Mins / 60;
78
- Num = this.FixedTo(Hrs);
79
- return Num;
80
- }
81
- static ConvertHourToMin(HrsData) {
82
- let Time = {};
83
- if (!TrUtils.IsNull(HrsData)) {
84
- // tslint:disable-next-line:radix
85
- Time['Hrs'] = parseInt(HrsData.toString().split('.')[0]);
86
- Time['Mins'] = (HrsData * 60) % 60;
87
- }
88
- return Time;
89
- }
90
49
  static FixedTo(value) {
91
50
  if (this.IsNull(value)) {
92
51
  value = 0;
@@ -105,54 +64,6 @@ class TrUtils {
105
64
  let Result = Value.toFixed(this.DecimalsNumber);
106
65
  return Result;
107
66
  }
108
- static ConvertValToPerc(Discount, Total) {
109
- if (this.IsNull(Total)) {
110
- return null;
111
- }
112
- else {
113
- if (this.IsNull(Discount)) {
114
- Discount = 0;
115
- }
116
- if (this.IsNull(Total)) {
117
- Total = 0;
118
- }
119
- let value = this.FixedTo(((Discount * 100) / Total));
120
- if (isNaN(value)) {
121
- value = 0;
122
- }
123
- return value;
124
- }
125
- }
126
- static CheckARIndividualStatusValid(Part, Field) {
127
- if (Part.Ind[Field] === enums_1.LaborStatusEnum.Cancelled || Part.Ind[Field] === enums_1.LaborStatusEnum.Declined) {
128
- return false;
129
- }
130
- else {
131
- return true;
132
- }
133
- }
134
- static CheckARIndividualStatusApproved(Part, Field) {
135
- if (Part.Ind[Field] !== enums_1.LaborStatusEnum.New && Part.Ind[Field] !== enums_1.LaborStatusEnum.WtngForAppr &&
136
- this.CheckARIndividualStatusValid(Part, Field)) {
137
- return true;
138
- }
139
- else {
140
- return false;
141
- }
142
- }
143
- static CheckARIndividualStatusCompleted(Part, Field) {
144
- if (Part.Ind[Field] === enums_1.LaborStatusEnum.Completed) {
145
- return true;
146
- }
147
- else {
148
- return false;
149
- }
150
- }
151
- static CheckAndUnsubscribeSubject(Subject) {
152
- if (!this.IsNull(Subject)) {
153
- Subject.unsubscribe();
154
- }
155
- }
156
67
  static SetValueToZeroIfNull(Value) {
157
68
  if (this.IsNull(Value)) {
158
69
  Value = 0;
@@ -174,177 +85,9 @@ class TrUtils {
174
85
  static CheckInvalidSelect(Value) {
175
86
  return Value === null || typeof Value === 'undefined' || Value === '' || Value === -1 || Value === '-1';
176
87
  }
177
- static DateSorting(date1, date2) {
178
- if (TrUtils.IsEmpty(date1) && TrUtils.IsEmpty(date2)) {
179
- return 0;
180
- }
181
- if (TrUtils.IsEmpty(date1)) {
182
- return -1;
183
- }
184
- if (TrUtils.IsEmpty(date2)) {
185
- return 1;
186
- }
187
- let Date1 = date1.split('-');
188
- let Date2 = date2.split('-');
189
- let year1 = Number(Date1[2]);
190
- let day1 = Number(Date1[0]);
191
- let months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec'];
192
- let month1 = months.indexOf(Date1[1]);
193
- let year2 = Number(Date2[2]);
194
- let day2 = Number(Date2[0]);
195
- let month2 = months.indexOf(Date2[1]);
196
- let result1 = (year1 * 10000) + (month1 * 100) + day1;
197
- let result2 = (year2 * 10000) + (month2 * 100) + day2;
198
- let result = result1 - result2;
199
- return result;
200
- }
201
- static DateSortingMonthandYear(date1, date2) {
202
- if (TrUtils.IsEmpty(date1) && TrUtils.IsEmpty(date2)) {
203
- return 0;
204
- }
205
- if (TrUtils.IsEmpty(date1)) {
206
- return -1;
207
- }
208
- if (TrUtils.IsEmpty(date2)) {
209
- return 1;
210
- }
211
- let Date1 = date1.split('/');
212
- let Date2 = date2.split('/');
213
- let year1 = Number(Date1[1]);
214
- // let day1 = Number(Date1[0]);
215
- let months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec'];
216
- let month1 = months.indexOf(Date1[0]);
217
- let year2 = Number(Date2[1]);
218
- // let day2 = Number(Date2[0]);
219
- let month2 = months.indexOf(Date2[0]);
220
- let result1 = (year1 * 10000) + (month1 * 100);
221
- let result2 = (year2 * 10000) + (month2 * 100);
222
- let result = result1 - result2;
223
- return result;
224
- }
225
- static InvoiceIdSorting(data1, data2) {
226
- if (!this.IsEmpty(data1) && !this.IsEmpty(data2)) {
227
- let Data1 = data1.split('I');
228
- let Data2 = data2.split('I');
229
- return this.GridNumberSorting(Data1[1], Data2[1]);
230
- }
231
- else {
232
- return 0;
233
- }
234
- }
235
- static IdSorting(id, data1, data2) {
236
- if (!this.IsEmpty(data1) && !this.IsEmpty(data2) && data1.includes(id) && data2.includes(id)) {
237
- let Data1 = data1.split(id);
238
- let Data2 = data2.split(id);
239
- return this.GridNumberSorting(Data1[1], Data2[1]);
240
- }
241
- else {
242
- return this.GridNumberSorting(data1, data2);
243
- ;
244
- }
245
- }
246
- static GridNumberSorting(num1, num2) {
247
- let result = Number(num1) - Number(num2);
248
- return result;
249
- }
250
- static AlphabetSorter(argDatalist, Identifier) {
251
- let argList = TrUtils.Stringify(argDatalist);
252
- argList.sort(function (a, b) {
253
- var _a, _b, _c, _d;
254
- // tslint:disable-next-line:curly
255
- if (TrUtils.IsNull(a[Identifier])) {
256
- a[Identifier] = '';
257
- }
258
- if (TrUtils.IsNull(b[Identifier])) {
259
- b[Identifier] = '';
260
- }
261
- if (((_a = a[Identifier]) === null || _a === void 0 ? void 0 : _a.toLowerCase()) < ((_b = b[Identifier]) === null || _b === void 0 ? void 0 : _b.toLowerCase()))
262
- return -1;
263
- // tslint:disable-next-line:curly
264
- if (((_c = a[Identifier]) === null || _c === void 0 ? void 0 : _c.toLowerCase()) > ((_d = b[Identifier]) === null || _d === void 0 ? void 0 : _d.toLowerCase()))
265
- return 1;
266
- return 0;
267
- });
268
- return argList;
269
- }
270
- static ArrayAlphabetSorting(SortingList) {
271
- SortingList.sort((a, b) => {
272
- let fa = a.Name.toLowerCase(), fb = b.Name.toLowerCase();
273
- if (fa < fb) {
274
- return -1;
275
- }
276
- if (fa > fb) {
277
- return 1;
278
- }
279
- return 0;
280
- });
281
- return SortingList;
282
- }
283
- static GetHours(hour, isPM) {
284
- if (isPM === 'PM') {
285
- let Amhours = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11'];
286
- let Pmhours = ['13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23'];
287
- if (hour >= 12) {
288
- let Index = Pmhours.findIndex((val) => {
289
- return val === hour.toString();
290
- });
291
- return (Index === -1) ? '12' : Amhours[Index];
292
- }
293
- else {
294
- let Index = Amhours.findIndex((val) => {
295
- return val === hour.toString();
296
- });
297
- return (Index === -1) ? '12' : Pmhours[Index];
298
- }
299
- }
300
- else {
301
- return hour === '12' ? '0' : hour.toString();
302
- }
303
- }
304
88
  static isTaxable(tax) {
305
89
  return (tax === 'TI') ? true : false;
306
90
  }
307
- static IsItemFromEstimate(ItemId) {
308
- return !TrUtils.IsNull(ItemId) && (ItemId.split('E').length === 2);
309
- }
310
- static IsItemInsurance(PayBy) {
311
- return PayBy === enums_1.PayTypeEnum.Insurance || PayBy === enums_1.PayTypeEnum.Shared;
312
- }
313
- static GetMonthsArray() {
314
- let MonthName = new Array();
315
- MonthName[0] = 'Jan';
316
- MonthName[1] = 'Feb';
317
- MonthName[2] = 'Mar';
318
- MonthName[3] = 'Apr';
319
- MonthName[4] = 'May';
320
- MonthName[5] = 'Jun';
321
- MonthName[6] = 'Jul';
322
- MonthName[7] = 'Aug';
323
- MonthName[8] = 'Sept';
324
- MonthName[9] = 'Oct';
325
- MonthName[10] = 'Nov';
326
- MonthName[11] = 'Dec';
327
- return MonthName;
328
- }
329
- static GetDurationInHrsAndMins(duration) {
330
- let Durationhr = Math.floor(duration / 60);
331
- let Durationmin = duration % 60;
332
- if (Durationhr === 0 && Durationmin === 0) {
333
- return '-';
334
- }
335
- else {
336
- let DurationInfo = '';
337
- if (Durationhr !== 0) {
338
- DurationInfo = Durationhr + ' hrs';
339
- }
340
- if (Durationmin !== 0) {
341
- DurationInfo = DurationInfo + ' ' + Durationmin + ' mins';
342
- }
343
- return DurationInfo;
344
- }
345
- }
346
91
  }
347
92
  exports.TrUtils = TrUtils;
348
- // static laborEndPointAddress: string = 'https://b4721cf2655e.ngrok.io/';
349
- // static laborEndPointAddress: string = 'http://localhost:9000/';
350
93
  TrUtils.DecimalsNumber = 2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.4.46",
3
+ "version": "1.4.47",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",