@yusr_systems/core 6.0.11 → 6.0.12

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/dist/index.d.ts CHANGED
@@ -140,6 +140,12 @@ export declare class LoginRequest {
140
140
  constructor(init?: Partial<LoginRequest>);
141
141
  }
142
142
 
143
+ export declare interface NumberToWordsOptions {
144
+ currency?: string;
145
+ fraction?: string;
146
+ feminine?: boolean;
147
+ }
148
+
143
149
  export declare type PermissionSelector<S> = (state: S, resource: string) => ResourcePermissions;
144
150
 
145
151
  export declare type RequestResult<T> = {
@@ -195,6 +201,19 @@ export declare class SystemPermissions {
195
201
  hasAuth(action: string): boolean;
196
202
  }
197
203
 
204
+ export declare class TafqeetService {
205
+ private static masculineUnits;
206
+ private static feminineUnits;
207
+ private static tens;
208
+ private static teens;
209
+ private static feminineTeens;
210
+ private static hundreds;
211
+ static ConvertAmount(amount: number, currency: Currency): string;
212
+ static Convert(num: number, isFeminine?: boolean): string;
213
+ private static convertHundreds;
214
+ private static getCurrencyWord;
215
+ }
216
+
198
217
  export declare class User extends BaseEntity {
199
218
  username: string;
200
219
  password: string;
package/dist/yusr-core.js CHANGED
@@ -309,6 +309,110 @@ var n = class e {
309
309
  }, j = class extends T {
310
310
  routeName = "Users";
311
311
  }, M = class {
312
+ static masculineUnits = [
313
+ "",
314
+ "واحد",
315
+ "اثنان",
316
+ "ثلاثة",
317
+ "أربعة",
318
+ "خمسة",
319
+ "ستة",
320
+ "سبعة",
321
+ "ثمانية",
322
+ "تسعة"
323
+ ];
324
+ static feminineUnits = [
325
+ "",
326
+ "واحدة",
327
+ "اثنتان",
328
+ "ثلاث",
329
+ "أربع",
330
+ "خمس",
331
+ "ست",
332
+ "سبع",
333
+ "ثمان",
334
+ "تسع"
335
+ ];
336
+ static tens = [
337
+ "",
338
+ "عشرة",
339
+ "عشرون",
340
+ "ثلاثون",
341
+ "أربعون",
342
+ "خمسون",
343
+ "ستون",
344
+ "سبعون",
345
+ "ثمانون",
346
+ "تسعون"
347
+ ];
348
+ static teens = [
349
+ "أحد عشر",
350
+ "اثنا عشر",
351
+ "ثلاثة عشر",
352
+ "أربعة عشر",
353
+ "خمسة عشر",
354
+ "ستة عشر",
355
+ "سبعة عشر",
356
+ "ثمانية عشر",
357
+ "تسعة عشر"
358
+ ];
359
+ static feminineTeens = [
360
+ "إحدى عشرة",
361
+ "اثنتا عشرة",
362
+ "ثلاث عشرة",
363
+ "أربع عشرة",
364
+ "خمس عشرة",
365
+ "ست عشرة",
366
+ "سبع عشرة",
367
+ "ثماني عشرة",
368
+ "تسع عشرة"
369
+ ];
370
+ static hundreds = [
371
+ "",
372
+ "مائة",
373
+ "مئتان",
374
+ "ثلاثمائة",
375
+ "أربعمائة",
376
+ "خمسمائة",
377
+ "ستمائة",
378
+ "سبعمائة",
379
+ "ثمانمائة",
380
+ "تسعمائة"
381
+ ];
382
+ static ConvertAmount(e, t) {
383
+ let n = Math.floor(e), r = Math.round((e - n) * 100), i = "";
384
+ return n > 0 && (i += this.Convert(n, t.isFeminine) + " " + this.getCurrencyWord(n, t, !1)), r > 0 && (i && (i += " و "), i += this.Convert(r, t.isFeminine) + " " + this.getCurrencyWord(r, t, !0)), n === 0 && r === 0 && (i = `صفر ${t.name}`), i;
385
+ }
386
+ static Convert(e, t = !1) {
387
+ if (e === 0) return "صفر";
388
+ let n = [];
389
+ if (e >= 1e9) {
390
+ let t = Math.floor(e / 1e9);
391
+ n.push(this.convertHundreds(t, !1) + " مليار" + (t > 2 ? "ات" : "")), e %= 1e9;
392
+ }
393
+ if (e >= 1e6) {
394
+ let t = Math.floor(e / 1e6);
395
+ n.push(this.convertHundreds(t, !1) + " مليون" + (t > 2 ? "ات" : "")), e %= 1e6;
396
+ }
397
+ if (e >= 1e3) {
398
+ let t = Math.floor(e / 1e3);
399
+ t === 1 ? n.push("ألف") : t === 2 ? n.push("ألفان") : n.push(this.convertHundreds(t, !1) + " آلاف"), e %= 1e3;
400
+ }
401
+ return e > 0 && n.push(this.convertHundreds(e, t)), n.join(" و ");
402
+ }
403
+ static convertHundreds(e, t = !1) {
404
+ let n = Math.floor(e / 100), r = e % 100, i = "";
405
+ if (n > 0 && (i += this.hundreds[n]), r > 0) if (i && (i += " و "), r >= 11 && r <= 19) i += t ? this.feminineTeens[r - 11] : this.teens[r - 11];
406
+ else {
407
+ let e = r % 10, n = Math.floor(r / 10), a = (t ? this.feminineUnits : this.masculineUnits)[e], o = this.tens[n];
408
+ e > 0 && n > 0 ? i += a + " و " + o : n > 0 ? i += o : i += a;
409
+ }
410
+ return i;
411
+ }
412
+ static getCurrencyWord(e, t, n) {
413
+ return e === 0 ? n ? t.subPlural : t.plural : e === 1 || e === 2 ? n ? t.subName : t.name : e >= 3 && e <= 10 ? n ? t.subPlural : t.plural : n ? t.subName : t.name;
414
+ }
415
+ }, N = class {
312
416
  static required(e = "هذا الحقل مطلوب") {
313
417
  return (t) => t == null || t === "" || typeof t == "string" && t.trim() === "" ? e : null;
314
418
  }
@@ -326,4 +430,4 @@ var n = class e {
326
430
  }
327
431
  };
328
432
  //#endregion
329
- export { S as ApiConstants, n as AuthConstants, T as BaseApiService, o as BaseEntity, w as BaseFilterableApiService, g as Branch, _ as BranchFilterColumns, E as BranchesApiService, D as CitiesApiService, s as City, c as CityFilterColumns, O as CountriesApiService, l as Country, u as CountryFilterColumns, k as CurrenciesApiService, d as Currency, f as FilterCondition, p as LoginRequest, v as Role, y as RoleFilterColumns, A as RolesApiService, m as StorageFile, h as StorageFileStatus, a as SystemPermissions, b as User, x as UserFilterColumns, j as UsersApiService, M as Validators, C as YusrApiHelper, i as createAuthSlice };
433
+ export { S as ApiConstants, n as AuthConstants, T as BaseApiService, o as BaseEntity, w as BaseFilterableApiService, g as Branch, _ as BranchFilterColumns, E as BranchesApiService, D as CitiesApiService, s as City, c as CityFilterColumns, O as CountriesApiService, l as Country, u as CountryFilterColumns, k as CurrenciesApiService, d as Currency, f as FilterCondition, p as LoginRequest, v as Role, y as RoleFilterColumns, A as RolesApiService, m as StorageFile, h as StorageFileStatus, a as SystemPermissions, M as TafqeetService, b as User, x as UserFilterColumns, j as UsersApiService, N as Validators, C as YusrApiHelper, i as createAuthSlice };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yusr_systems/core",
3
- "version": "6.0.11",
3
+ "version": "6.0.12",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "publishConfig": {