asv-hlps 1.2.27 → 1.2.31
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/lib/cjs/index.d.ts +4 -1
- package/lib/cjs/index.js +5 -1
- package/lib/cjs/models/entities/acts/Act.d.ts +18 -0
- package/lib/cjs/models/entities/acts/Act.js +2 -0
- package/lib/cjs/models/entities/acts/ActCat.d.ts +4 -0
- package/lib/cjs/models/entities/acts/ActCat.js +2 -0
- package/lib/cjs/models/entities/acts/ActLine.d.ts +13 -0
- package/lib/cjs/models/entities/acts/ActLine.js +2 -0
- package/lib/cjs/models/entities/acts/index.d.ts +4 -0
- package/lib/cjs/models/entities/acts/index.js +2 -0
- package/lib/cjs/models/entities/bills/Bill.d.ts +6 -0
- package/lib/cjs/models/entities/bills/BillCat.d.ts +4 -0
- package/lib/cjs/models/entities/bills/BillCat.js +6 -0
- package/lib/cjs/models/index.d.ts +1 -0
- package/lib/cjs/models/index.js +1 -0
- package/lib/cjs/reacts/hooks/useReadonlyFetchTobs.d.ts +5 -0
- package/lib/cjs/reacts/hooks/useReadonlyFetchTobs.js +38 -0
- package/lib/cjs/reacts/index.d.ts +2 -0
- package/lib/cjs/reacts/index.js +8 -0
- package/lib/cjs/services/authService.d.ts +5 -5
- package/lib/cjs/services/authService.js +14 -8
- package/lib/cjs/services/capacitorStorageService.d.ts +7 -0
- package/lib/cjs/services/capacitorStorageService.js +26 -0
- package/lib/cjs/services/storageService.d.ts +3 -3
- package/lib/cjs/services/storageService.js +48 -7
- package/lib/esm/index.d.ts +4 -1
- package/lib/esm/index.js +4 -1
- package/lib/esm/models/entities/acts/Act.d.ts +18 -0
- package/lib/esm/models/entities/acts/Act.js +1 -0
- package/lib/esm/models/entities/acts/ActCat.d.ts +4 -0
- package/lib/esm/models/entities/acts/ActCat.js +1 -0
- package/lib/esm/models/entities/acts/ActLine.d.ts +13 -0
- package/lib/esm/models/entities/acts/ActLine.js +1 -0
- package/lib/esm/models/entities/acts/index.d.ts +4 -0
- package/lib/esm/models/entities/acts/index.js +1 -0
- package/lib/esm/models/entities/bills/Bill.d.ts +6 -0
- package/lib/esm/models/entities/bills/BillCat.d.ts +4 -0
- package/lib/esm/models/entities/bills/BillCat.js +2 -0
- package/lib/esm/models/index.d.ts +1 -0
- package/lib/esm/models/index.js +1 -0
- package/lib/esm/reacts/hooks/useReadonlyFetchTobs.d.ts +5 -0
- package/lib/esm/reacts/hooks/useReadonlyFetchTobs.js +36 -0
- package/lib/esm/reacts/index.d.ts +2 -0
- package/lib/esm/reacts/index.js +2 -0
- package/lib/esm/services/authService.d.ts +5 -5
- package/lib/esm/services/authService.js +14 -8
- package/lib/esm/services/capacitorStorageService.d.ts +7 -0
- package/lib/esm/services/capacitorStorageService.js +24 -0
- package/lib/esm/services/storageService.d.ts +3 -3
- package/lib/esm/services/storageService.js +48 -7
- package/package.json +4 -1
package/lib/cjs/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import AmountOnBillPipe from "./helpers/pipes/amount-on-bill-pipe";
|
|
|
4
4
|
import AmountOnListBillPipe from "./helpers/pipes/amount-on-list-bill-pipe";
|
|
5
5
|
import StockPipe from "./helpers/pipes/stock-pipe";
|
|
6
6
|
import { AuthService } from "./services/authService";
|
|
7
|
+
import CapacitorStorageService from "./services/capacitorStorageService";
|
|
7
8
|
import StorageService from "./services/storageService";
|
|
8
9
|
import "./auth";
|
|
9
10
|
import "./bill";
|
|
@@ -16,6 +17,7 @@ import "./pdfs/invoices/infoInvoice";
|
|
|
16
17
|
import "./pdfs/tools/tools";
|
|
17
18
|
import "./product";
|
|
18
19
|
import "./react-utils";
|
|
20
|
+
import "./reacts/index";
|
|
19
21
|
import "./sale";
|
|
20
22
|
import "./services/authService";
|
|
21
23
|
import "./user";
|
|
@@ -35,4 +37,5 @@ export * from "./react-utils";
|
|
|
35
37
|
export * from "./sale";
|
|
36
38
|
export * from "./user";
|
|
37
39
|
export * from "./utils";
|
|
38
|
-
export
|
|
40
|
+
export * from "./reacts/index";
|
|
41
|
+
export { AuthService, StorageService, CapacitorStorageService, HlpProduct, HlpEntry, StockPipe, AmountOnListBillPipe, AmountOnBillPipe };
|
package/lib/cjs/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.AmountOnBillPipe = exports.AmountOnListBillPipe = exports.StockPipe = exports.HlpEntry = exports.HlpProduct = exports.StorageService = exports.AuthService = void 0;
|
|
20
|
+
exports.AmountOnBillPipe = exports.AmountOnListBillPipe = exports.StockPipe = exports.HlpEntry = exports.HlpProduct = exports.CapacitorStorageService = exports.StorageService = exports.AuthService = void 0;
|
|
21
21
|
const hlpEntry_1 = require("./helpers/hlpEntry");
|
|
22
22
|
Object.defineProperty(exports, "HlpEntry", { enumerable: true, get: function () { return hlpEntry_1.HlpEntry; } });
|
|
23
23
|
const hlpProduct_1 = __importDefault(require("./helpers/hlpProduct"));
|
|
@@ -30,6 +30,8 @@ const stock_pipe_1 = __importDefault(require("./helpers/pipes/stock-pipe"));
|
|
|
30
30
|
exports.StockPipe = stock_pipe_1.default;
|
|
31
31
|
const authService_1 = require("./services/authService");
|
|
32
32
|
Object.defineProperty(exports, "AuthService", { enumerable: true, get: function () { return authService_1.AuthService; } });
|
|
33
|
+
const capacitorStorageService_1 = __importDefault(require("./services/capacitorStorageService"));
|
|
34
|
+
exports.CapacitorStorageService = capacitorStorageService_1.default;
|
|
33
35
|
const storageService_1 = __importDefault(require("./services/storageService"));
|
|
34
36
|
exports.StorageService = storageService_1.default;
|
|
35
37
|
require("./auth");
|
|
@@ -46,6 +48,7 @@ require("./pdfs/invoices/infoInvoice");
|
|
|
46
48
|
require("./pdfs/tools/tools");
|
|
47
49
|
require("./product");
|
|
48
50
|
require("./react-utils");
|
|
51
|
+
require("./reacts/index");
|
|
49
52
|
require("./sale");
|
|
50
53
|
require("./services/authService");
|
|
51
54
|
require("./user");
|
|
@@ -65,3 +68,4 @@ __exportStar(require("./react-utils"), exports);
|
|
|
65
68
|
__exportStar(require("./sale"), exports);
|
|
66
69
|
__exportStar(require("./user"), exports);
|
|
67
70
|
__exportStar(require("./utils"), exports);
|
|
71
|
+
__exportStar(require("./reacts/index"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ActLine } from "./ActLine";
|
|
2
|
+
import { ActCat } from "./ActCat";
|
|
3
|
+
import { Bill } from "../bills/Bill";
|
|
4
|
+
import { UserNotarial } from "../users/UserNotatial";
|
|
5
|
+
export interface Act {
|
|
6
|
+
id: number;
|
|
7
|
+
actDate: Date | string;
|
|
8
|
+
billNumber: string;
|
|
9
|
+
isActive: boolean;
|
|
10
|
+
tva: boolean;
|
|
11
|
+
description: string;
|
|
12
|
+
notes: string;
|
|
13
|
+
bill: Bill;
|
|
14
|
+
encoder: UserNotarial;
|
|
15
|
+
client: UserNotarial;
|
|
16
|
+
cat: ActCat;
|
|
17
|
+
actLines: ActLine[];
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Act } from './Act';
|
|
2
|
+
export interface ActLine {
|
|
3
|
+
id: number;
|
|
4
|
+
registerNumber: string;
|
|
5
|
+
designation: string;
|
|
6
|
+
actLineDate: Date | string;
|
|
7
|
+
dutiesPaid: number;
|
|
8
|
+
costs: number;
|
|
9
|
+
fees: number;
|
|
10
|
+
emolument: number;
|
|
11
|
+
isActive: boolean;
|
|
12
|
+
act: Act;
|
|
13
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { HousingRented } from "../../../core/estates/models/HousingRented";
|
|
2
|
+
import { Act } from "../acts/Act";
|
|
1
3
|
import { Entry } from "../comptas/Entry";
|
|
2
4
|
import { Sale } from "../sales/Sale";
|
|
3
5
|
import { User } from "../users/User";
|
|
6
|
+
import { BillCat } from "./BillCat";
|
|
4
7
|
import { BillLine } from "./BillLine";
|
|
5
8
|
import { BillPayment } from "./BillPayment";
|
|
6
9
|
export interface Bill {
|
|
@@ -31,4 +34,7 @@ export interface Bill {
|
|
|
31
34
|
client?: User;
|
|
32
35
|
sales?: Sale[];
|
|
33
36
|
nbrePayment?: number;
|
|
37
|
+
act?: Act;
|
|
38
|
+
rented?: HousingRented;
|
|
39
|
+
cat?: BillCat;
|
|
34
40
|
}
|
|
@@ -3,6 +3,7 @@ import { NaCoAc } from "./shared/NaCoAc";
|
|
|
3
3
|
import { NaCoShortAc } from "./shared/NaCoShortAc";
|
|
4
4
|
import { colNa, colNaCo, colNaCoSh, FormPropsType, HeaderTableColumnType, IPath, MenuItemType } from "./types/Type";
|
|
5
5
|
export * from "./entities/auth/index";
|
|
6
|
+
export * from "./entities/acts/index";
|
|
6
7
|
export * from "./entities/bills/index";
|
|
7
8
|
export * from "./entities/buys/index";
|
|
8
9
|
export * from "./entities/cashs/index";
|
package/lib/cjs/models/index.js
CHANGED
|
@@ -20,6 +20,7 @@ Object.defineProperty(exports, "colNa", { enumerable: true, get: function () { r
|
|
|
20
20
|
Object.defineProperty(exports, "colNaCo", { enumerable: true, get: function () { return Type_1.colNaCo; } });
|
|
21
21
|
Object.defineProperty(exports, "colNaCoSh", { enumerable: true, get: function () { return Type_1.colNaCoSh; } });
|
|
22
22
|
__exportStar(require("./entities/auth/index"), exports);
|
|
23
|
+
__exportStar(require("./entities/acts/index"), exports);
|
|
23
24
|
__exportStar(require("./entities/bills/index"), exports);
|
|
24
25
|
__exportStar(require("./entities/buys/index"), exports);
|
|
25
26
|
__exportStar(require("./entities/cashs/index"), exports);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const react_1 = require("react");
|
|
13
|
+
const react_utils_1 = require("../../react-utils");
|
|
14
|
+
const useReadonlyFetchTobs = (url, httpService, urlParam, valueProp = "id", labelProp = "name") => {
|
|
15
|
+
const [tobs, setTobs] = (0, react_1.useState)([]);
|
|
16
|
+
const getDatas = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
try {
|
|
18
|
+
if (!urlParam) {
|
|
19
|
+
const { data: tobs } = yield httpService.get(url);
|
|
20
|
+
setTobs(tobs);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
const { data: tobs } = yield httpService.getByParam(urlParam, url);
|
|
24
|
+
setTobs(tobs);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch (error) { }
|
|
28
|
+
});
|
|
29
|
+
(0, react_1.useEffect)(() => {
|
|
30
|
+
getDatas();
|
|
31
|
+
return () => { };
|
|
32
|
+
}, []);
|
|
33
|
+
// const options = useMemo(() => selectOptionsToLabelAndValue(tobs, valueProp, labelProp), []);
|
|
34
|
+
const options = (0, react_utils_1.selectOptionsToLabelAndValue)(tobs, valueProp, labelProp);
|
|
35
|
+
return { tobs, options };
|
|
36
|
+
};
|
|
37
|
+
exports.default = useReadonlyFetchTobs;
|
|
38
|
+
// export default {tobs , options} ;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useReadonlyFetchTobs = void 0;
|
|
7
|
+
const useReadonlyFetchTobs_1 = __importDefault(require("./hooks/useReadonlyFetchTobs"));
|
|
8
|
+
exports.useReadonlyFetchTobs = useReadonlyFetchTobs_1.default;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { AuthParam } from "../auth";
|
|
2
|
-
import { User } from "../models/entities/users/User";
|
|
3
|
-
import { UserNotarial } from "../models/entities/users/UserNotatial";
|
|
4
2
|
export declare class AuthService {
|
|
5
3
|
tokenKey: string;
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
authStes: string[];
|
|
5
|
+
capacitor?: boolean;
|
|
6
|
+
constructor(tokenkey: string, authStes: string[], capacitor?: boolean);
|
|
7
|
+
getStorageToken: (param?: "local") => string;
|
|
8
8
|
setStorageToken: (jwt: any) => any;
|
|
9
9
|
decodeToken: () => unknown;
|
|
10
10
|
removeStorageToken: () => void;
|
|
11
11
|
login: (tob: LoginType, httpService: any) => Promise<boolean>;
|
|
12
12
|
logout: () => boolean;
|
|
13
13
|
authUser: () => unknown;
|
|
14
|
-
getAuth: (
|
|
14
|
+
getAuth: (param?: AuthParam) => boolean;
|
|
15
15
|
}
|
|
16
16
|
declare type LoginType = {
|
|
17
17
|
username: string;
|
|
@@ -17,14 +17,16 @@ const jwt_decode_1 = __importDefault(require("jwt-decode"));
|
|
|
17
17
|
const auth_1 = require("../auth");
|
|
18
18
|
const storageService_1 = __importDefault(require("./storageService"));
|
|
19
19
|
class AuthService {
|
|
20
|
-
constructor(tokenkey) {
|
|
20
|
+
constructor(tokenkey, authStes, capacitor) {
|
|
21
21
|
this.tokenKey = "";
|
|
22
|
+
this.authStes = [];
|
|
23
|
+
this.capacitor = false;
|
|
22
24
|
// getStorageToken = (tokenKey, local = false) => {
|
|
23
|
-
this.getStorageToken = (
|
|
25
|
+
this.getStorageToken = (param) => {
|
|
24
26
|
if (!this.tokenKey) {
|
|
25
27
|
return null;
|
|
26
28
|
}
|
|
27
|
-
return storageService_1.default.getStorage(this.tokenKey,
|
|
29
|
+
return storageService_1.default.getStorage(this.tokenKey, param);
|
|
28
30
|
};
|
|
29
31
|
// setStorageToken = (tokenKey, jwt) => {
|
|
30
32
|
this.setStorageToken = (jwt) => {
|
|
@@ -43,9 +45,8 @@ class AuthService {
|
|
|
43
45
|
};
|
|
44
46
|
this.login = (tob, httpService) => __awaiter(this, void 0, void 0, function* () {
|
|
45
47
|
try {
|
|
46
|
-
const { data:
|
|
47
|
-
|
|
48
|
-
this.setStorageToken(jwt.token);
|
|
48
|
+
const { data: token } = yield httpService.post("auth/login", tob);
|
|
49
|
+
this.setStorageToken(token);
|
|
49
50
|
return true;
|
|
50
51
|
}
|
|
51
52
|
catch (error) {
|
|
@@ -68,10 +69,15 @@ class AuthService {
|
|
|
68
69
|
return null;
|
|
69
70
|
}
|
|
70
71
|
};
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
/* getAuth = (authUser: User | UserNotarial, authSte: string[], param?: AuthParam) => {
|
|
73
|
+
return getAuth(authUser, authSte, param);
|
|
74
|
+
}; */
|
|
75
|
+
this.getAuth = (param) => {
|
|
76
|
+
return (0, auth_1.getAuth)(this.authUser(), this.authStes, param);
|
|
73
77
|
};
|
|
74
78
|
this.tokenKey = tokenkey;
|
|
79
|
+
this.authStes = authStes;
|
|
80
|
+
capacitor = capacitor;
|
|
75
81
|
}
|
|
76
82
|
}
|
|
77
83
|
exports.AuthService = AuthService;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare class CapacitorStorageService {
|
|
2
|
+
setStorage: (key: string, value: string) => Promise<void>;
|
|
3
|
+
getStorage: (key: string) => Promise<import("@capacitor/preferences").GetResult>;
|
|
4
|
+
removeName: (key: string) => Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: CapacitorStorageService;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const preferences_1 = require("@capacitor/preferences");
|
|
13
|
+
class CapacitorStorageService {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.setStorage = (key, value) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
yield preferences_1.Preferences.set({ key, value });
|
|
17
|
+
});
|
|
18
|
+
this.getStorage = (key) => __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
return yield preferences_1.Preferences.get({ key });
|
|
20
|
+
});
|
|
21
|
+
this.removeName = (key) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
yield preferences_1.Preferences.remove({ key });
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.default = new CapacitorStorageService();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare class StorageService {
|
|
2
|
-
getStorage: (key: string,
|
|
3
|
-
setStorage: (key: string, value: string,
|
|
4
|
-
removeStorage: (key: string) => void;
|
|
2
|
+
getStorage: (key: string, param?: "local") => string;
|
|
3
|
+
setStorage: (key: string, value: string, param?: "local") => any;
|
|
4
|
+
removeStorage: (key: string, param?: "local") => void;
|
|
5
5
|
}
|
|
6
6
|
declare const _default: StorageService;
|
|
7
7
|
export default _default;
|
|
@@ -2,22 +2,63 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
class StorageService {
|
|
4
4
|
constructor() {
|
|
5
|
-
this.getStorage = (key,
|
|
5
|
+
this.getStorage = (key, param) => {
|
|
6
6
|
if (!key) {
|
|
7
7
|
return null;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
switch (param) {
|
|
10
|
+
case "local":
|
|
11
|
+
return localStorage.getItem(key);
|
|
12
|
+
default:
|
|
13
|
+
return sessionStorage.getItem(key);
|
|
14
|
+
}
|
|
10
15
|
};
|
|
11
|
-
this.setStorage = (key, value,
|
|
16
|
+
this.setStorage = (key, value, param) => {
|
|
12
17
|
if (!key) {
|
|
13
18
|
return null;
|
|
14
19
|
}
|
|
15
|
-
|
|
20
|
+
switch (param) {
|
|
21
|
+
case "local":
|
|
22
|
+
localStorage.setItem(key, value);
|
|
23
|
+
break;
|
|
24
|
+
default:
|
|
25
|
+
sessionStorage.setItem(key, value);
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
16
28
|
};
|
|
17
|
-
this.removeStorage = (key) => {
|
|
18
|
-
|
|
19
|
-
|
|
29
|
+
this.removeStorage = (key, param) => {
|
|
30
|
+
switch (param) {
|
|
31
|
+
case "local":
|
|
32
|
+
localStorage.removeItem(key);
|
|
33
|
+
break;
|
|
34
|
+
default:
|
|
35
|
+
sessionStorage.removeItem(key);
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
20
38
|
};
|
|
21
39
|
}
|
|
22
40
|
}
|
|
23
41
|
exports.default = new StorageService();
|
|
42
|
+
/* class StorageService {
|
|
43
|
+
getStorage = (key: string, local = false) => {
|
|
44
|
+
if (!key) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
return !local ? sessionStorage.getItem(key) : localStorage.getItem(key);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
setStorage = (key: string, value: string, local = false): any => {
|
|
51
|
+
if (!key) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
!local ? sessionStorage.setItem(key, value) : localStorage.setItem(key, value);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
removeStorage = (key: string) => {
|
|
58
|
+
localStorage.removeItem(key);
|
|
59
|
+
sessionStorage.removeItem(key);
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default new StorageService();
|
|
64
|
+
*/
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import AmountOnBillPipe from "./helpers/pipes/amount-on-bill-pipe";
|
|
|
4
4
|
import AmountOnListBillPipe from "./helpers/pipes/amount-on-list-bill-pipe";
|
|
5
5
|
import StockPipe from "./helpers/pipes/stock-pipe";
|
|
6
6
|
import { AuthService } from "./services/authService";
|
|
7
|
+
import CapacitorStorageService from "./services/capacitorStorageService";
|
|
7
8
|
import StorageService from "./services/storageService";
|
|
8
9
|
import "./auth";
|
|
9
10
|
import "./bill";
|
|
@@ -16,6 +17,7 @@ import "./pdfs/invoices/infoInvoice";
|
|
|
16
17
|
import "./pdfs/tools/tools";
|
|
17
18
|
import "./product";
|
|
18
19
|
import "./react-utils";
|
|
20
|
+
import "./reacts/index";
|
|
19
21
|
import "./sale";
|
|
20
22
|
import "./services/authService";
|
|
21
23
|
import "./user";
|
|
@@ -35,4 +37,5 @@ export * from "./react-utils";
|
|
|
35
37
|
export * from "./sale";
|
|
36
38
|
export * from "./user";
|
|
37
39
|
export * from "./utils";
|
|
38
|
-
export
|
|
40
|
+
export * from "./reacts/index";
|
|
41
|
+
export { AuthService, StorageService, CapacitorStorageService, HlpProduct, HlpEntry, StockPipe, AmountOnListBillPipe, AmountOnBillPipe };
|
package/lib/esm/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import AmountOnBillPipe from "./helpers/pipes/amount-on-bill-pipe";
|
|
|
4
4
|
import AmountOnListBillPipe from "./helpers/pipes/amount-on-list-bill-pipe";
|
|
5
5
|
import StockPipe from "./helpers/pipes/stock-pipe";
|
|
6
6
|
import { AuthService } from "./services/authService";
|
|
7
|
+
import CapacitorStorageService from "./services/capacitorStorageService";
|
|
7
8
|
import StorageService from "./services/storageService";
|
|
8
9
|
import "./auth";
|
|
9
10
|
import "./bill";
|
|
@@ -19,6 +20,7 @@ import "./pdfs/invoices/infoInvoice";
|
|
|
19
20
|
import "./pdfs/tools/tools";
|
|
20
21
|
import "./product";
|
|
21
22
|
import "./react-utils";
|
|
23
|
+
import "./reacts/index";
|
|
22
24
|
import "./sale";
|
|
23
25
|
import "./services/authService";
|
|
24
26
|
import "./user";
|
|
@@ -38,5 +40,6 @@ export * from "./react-utils";
|
|
|
38
40
|
export * from "./sale";
|
|
39
41
|
export * from "./user";
|
|
40
42
|
export * from "./utils";
|
|
43
|
+
export * from "./reacts/index";
|
|
41
44
|
// export * from "./helpers/hlpProduct";
|
|
42
|
-
export { AuthService, StorageService, HlpProduct, HlpEntry, StockPipe, AmountOnListBillPipe, AmountOnBillPipe };
|
|
45
|
+
export { AuthService, StorageService, CapacitorStorageService, HlpProduct, HlpEntry, StockPipe, AmountOnListBillPipe, AmountOnBillPipe };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ActLine } from "./ActLine";
|
|
2
|
+
import { ActCat } from "./ActCat";
|
|
3
|
+
import { Bill } from "../bills/Bill";
|
|
4
|
+
import { UserNotarial } from "../users/UserNotatial";
|
|
5
|
+
export interface Act {
|
|
6
|
+
id: number;
|
|
7
|
+
actDate: Date | string;
|
|
8
|
+
billNumber: string;
|
|
9
|
+
isActive: boolean;
|
|
10
|
+
tva: boolean;
|
|
11
|
+
description: string;
|
|
12
|
+
notes: string;
|
|
13
|
+
bill: Bill;
|
|
14
|
+
encoder: UserNotarial;
|
|
15
|
+
client: UserNotarial;
|
|
16
|
+
cat: ActCat;
|
|
17
|
+
actLines: ActLine[];
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Act } from './Act';
|
|
2
|
+
export interface ActLine {
|
|
3
|
+
id: number;
|
|
4
|
+
registerNumber: string;
|
|
5
|
+
designation: string;
|
|
6
|
+
actLineDate: Date | string;
|
|
7
|
+
dutiesPaid: number;
|
|
8
|
+
costs: number;
|
|
9
|
+
fees: number;
|
|
10
|
+
emolument: number;
|
|
11
|
+
isActive: boolean;
|
|
12
|
+
act: Act;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { HousingRented } from "../../../core/estates/models/HousingRented";
|
|
2
|
+
import { Act } from "../acts/Act";
|
|
1
3
|
import { Entry } from "../comptas/Entry";
|
|
2
4
|
import { Sale } from "../sales/Sale";
|
|
3
5
|
import { User } from "../users/User";
|
|
6
|
+
import { BillCat } from "./BillCat";
|
|
4
7
|
import { BillLine } from "./BillLine";
|
|
5
8
|
import { BillPayment } from "./BillPayment";
|
|
6
9
|
export interface Bill {
|
|
@@ -31,4 +34,7 @@ export interface Bill {
|
|
|
31
34
|
client?: User;
|
|
32
35
|
sales?: Sale[];
|
|
33
36
|
nbrePayment?: number;
|
|
37
|
+
act?: Act;
|
|
38
|
+
rented?: HousingRented;
|
|
39
|
+
cat?: BillCat;
|
|
34
40
|
}
|
|
@@ -3,6 +3,7 @@ import { NaCoAc } from "./shared/NaCoAc";
|
|
|
3
3
|
import { NaCoShortAc } from "./shared/NaCoShortAc";
|
|
4
4
|
import { colNa, colNaCo, colNaCoSh, FormPropsType, HeaderTableColumnType, IPath, MenuItemType } from "./types/Type";
|
|
5
5
|
export * from "./entities/auth/index";
|
|
6
|
+
export * from "./entities/acts/index";
|
|
6
7
|
export * from "./entities/bills/index";
|
|
7
8
|
export * from "./entities/buys/index";
|
|
8
9
|
export * from "./entities/cashs/index";
|
package/lib/esm/models/index.js
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { useEffect, useState } from "react";
|
|
11
|
+
import { selectOptionsToLabelAndValue } from "../../react-utils";
|
|
12
|
+
const useReadonlyFetchTobs = (url, httpService, urlParam, valueProp = "id", labelProp = "name") => {
|
|
13
|
+
const [tobs, setTobs] = useState([]);
|
|
14
|
+
const getDatas = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
try {
|
|
16
|
+
if (!urlParam) {
|
|
17
|
+
const { data: tobs } = yield httpService.get(url);
|
|
18
|
+
setTobs(tobs);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
const { data: tobs } = yield httpService.getByParam(urlParam, url);
|
|
22
|
+
setTobs(tobs);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch (error) { }
|
|
26
|
+
});
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
getDatas();
|
|
29
|
+
return () => { };
|
|
30
|
+
}, []);
|
|
31
|
+
// const options = useMemo(() => selectOptionsToLabelAndValue(tobs, valueProp, labelProp), []);
|
|
32
|
+
const options = selectOptionsToLabelAndValue(tobs, valueProp, labelProp);
|
|
33
|
+
return { tobs, options };
|
|
34
|
+
};
|
|
35
|
+
export default useReadonlyFetchTobs;
|
|
36
|
+
// export default {tobs , options} ;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { AuthParam } from "../auth";
|
|
2
|
-
import { User } from "../models/entities/users/User";
|
|
3
|
-
import { UserNotarial } from "../models/entities/users/UserNotatial";
|
|
4
2
|
export declare class AuthService {
|
|
5
3
|
tokenKey: string;
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
authStes: string[];
|
|
5
|
+
capacitor?: boolean;
|
|
6
|
+
constructor(tokenkey: string, authStes: string[], capacitor?: boolean);
|
|
7
|
+
getStorageToken: (param?: "local") => string;
|
|
8
8
|
setStorageToken: (jwt: any) => any;
|
|
9
9
|
decodeToken: () => unknown;
|
|
10
10
|
removeStorageToken: () => void;
|
|
11
11
|
login: (tob: LoginType, httpService: any) => Promise<boolean>;
|
|
12
12
|
logout: () => boolean;
|
|
13
13
|
authUser: () => unknown;
|
|
14
|
-
getAuth: (
|
|
14
|
+
getAuth: (param?: AuthParam) => boolean;
|
|
15
15
|
}
|
|
16
16
|
declare type LoginType = {
|
|
17
17
|
username: string;
|
|
@@ -11,14 +11,16 @@ import jwtDecode from "jwt-decode";
|
|
|
11
11
|
import { getAuth } from "../auth";
|
|
12
12
|
import storageService from "./storageService";
|
|
13
13
|
export class AuthService {
|
|
14
|
-
constructor(tokenkey) {
|
|
14
|
+
constructor(tokenkey, authStes, capacitor) {
|
|
15
15
|
this.tokenKey = "";
|
|
16
|
+
this.authStes = [];
|
|
17
|
+
this.capacitor = false;
|
|
16
18
|
// getStorageToken = (tokenKey, local = false) => {
|
|
17
|
-
this.getStorageToken = (
|
|
19
|
+
this.getStorageToken = (param) => {
|
|
18
20
|
if (!this.tokenKey) {
|
|
19
21
|
return null;
|
|
20
22
|
}
|
|
21
|
-
return storageService.getStorage(this.tokenKey,
|
|
23
|
+
return storageService.getStorage(this.tokenKey, param);
|
|
22
24
|
};
|
|
23
25
|
// setStorageToken = (tokenKey, jwt) => {
|
|
24
26
|
this.setStorageToken = (jwt) => {
|
|
@@ -37,9 +39,8 @@ export class AuthService {
|
|
|
37
39
|
};
|
|
38
40
|
this.login = (tob, httpService) => __awaiter(this, void 0, void 0, function* () {
|
|
39
41
|
try {
|
|
40
|
-
const { data:
|
|
41
|
-
|
|
42
|
-
this.setStorageToken(jwt.token);
|
|
42
|
+
const { data: token } = yield httpService.post("auth/login", tob);
|
|
43
|
+
this.setStorageToken(token);
|
|
43
44
|
return true;
|
|
44
45
|
}
|
|
45
46
|
catch (error) {
|
|
@@ -62,10 +63,15 @@ export class AuthService {
|
|
|
62
63
|
return null;
|
|
63
64
|
}
|
|
64
65
|
};
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
/* getAuth = (authUser: User | UserNotarial, authSte: string[], param?: AuthParam) => {
|
|
67
|
+
return getAuth(authUser, authSte, param);
|
|
68
|
+
}; */
|
|
69
|
+
this.getAuth = (param) => {
|
|
70
|
+
return getAuth(this.authUser(), this.authStes, param);
|
|
67
71
|
};
|
|
68
72
|
this.tokenKey = tokenkey;
|
|
73
|
+
this.authStes = authStes;
|
|
74
|
+
capacitor = capacitor;
|
|
69
75
|
}
|
|
70
76
|
}
|
|
71
77
|
// export default new AuthService("awPharma");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare class CapacitorStorageService {
|
|
2
|
+
setStorage: (key: string, value: string) => Promise<void>;
|
|
3
|
+
getStorage: (key: string) => Promise<import("@capacitor/preferences").GetResult>;
|
|
4
|
+
removeName: (key: string) => Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: CapacitorStorageService;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { Preferences } from "@capacitor/preferences";
|
|
11
|
+
class CapacitorStorageService {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.setStorage = (key, value) => __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
yield Preferences.set({ key, value });
|
|
15
|
+
});
|
|
16
|
+
this.getStorage = (key) => __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
return yield Preferences.get({ key });
|
|
18
|
+
});
|
|
19
|
+
this.removeName = (key) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
yield Preferences.remove({ key });
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export default new CapacitorStorageService();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare class StorageService {
|
|
2
|
-
getStorage: (key: string,
|
|
3
|
-
setStorage: (key: string, value: string,
|
|
4
|
-
removeStorage: (key: string) => void;
|
|
2
|
+
getStorage: (key: string, param?: "local") => string;
|
|
3
|
+
setStorage: (key: string, value: string, param?: "local") => any;
|
|
4
|
+
removeStorage: (key: string, param?: "local") => void;
|
|
5
5
|
}
|
|
6
6
|
declare const _default: StorageService;
|
|
7
7
|
export default _default;
|
|
@@ -1,21 +1,62 @@
|
|
|
1
1
|
class StorageService {
|
|
2
2
|
constructor() {
|
|
3
|
-
this.getStorage = (key,
|
|
3
|
+
this.getStorage = (key, param) => {
|
|
4
4
|
if (!key) {
|
|
5
5
|
return null;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
switch (param) {
|
|
8
|
+
case "local":
|
|
9
|
+
return localStorage.getItem(key);
|
|
10
|
+
default:
|
|
11
|
+
return sessionStorage.getItem(key);
|
|
12
|
+
}
|
|
8
13
|
};
|
|
9
|
-
this.setStorage = (key, value,
|
|
14
|
+
this.setStorage = (key, value, param) => {
|
|
10
15
|
if (!key) {
|
|
11
16
|
return null;
|
|
12
17
|
}
|
|
13
|
-
|
|
18
|
+
switch (param) {
|
|
19
|
+
case "local":
|
|
20
|
+
localStorage.setItem(key, value);
|
|
21
|
+
break;
|
|
22
|
+
default:
|
|
23
|
+
sessionStorage.setItem(key, value);
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
14
26
|
};
|
|
15
|
-
this.removeStorage = (key) => {
|
|
16
|
-
|
|
17
|
-
|
|
27
|
+
this.removeStorage = (key, param) => {
|
|
28
|
+
switch (param) {
|
|
29
|
+
case "local":
|
|
30
|
+
localStorage.removeItem(key);
|
|
31
|
+
break;
|
|
32
|
+
default:
|
|
33
|
+
sessionStorage.removeItem(key);
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
18
36
|
};
|
|
19
37
|
}
|
|
20
38
|
}
|
|
21
39
|
export default new StorageService();
|
|
40
|
+
/* class StorageService {
|
|
41
|
+
getStorage = (key: string, local = false) => {
|
|
42
|
+
if (!key) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return !local ? sessionStorage.getItem(key) : localStorage.getItem(key);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
setStorage = (key: string, value: string, local = false): any => {
|
|
49
|
+
if (!key) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
!local ? sessionStorage.setItem(key, value) : localStorage.setItem(key, value);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
removeStorage = (key: string) => {
|
|
56
|
+
localStorage.removeItem(key);
|
|
57
|
+
sessionStorage.removeItem(key);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export default new StorageService();
|
|
62
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "asv-hlps",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.31",
|
|
4
4
|
"description": "helpers",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -18,13 +18,16 @@
|
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/bcryptjs": "^2.4.2",
|
|
20
20
|
"@types/randomatic": "^3.1.3",
|
|
21
|
+
"@types/react": "^18.0.18",
|
|
21
22
|
"typescript": "^4.7.4"
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
25
|
+
"@capacitor/preferences": "^4.0.1",
|
|
24
26
|
"axios": "^0.27.2",
|
|
25
27
|
"bcryptjs": "^2.4.3",
|
|
26
28
|
"jwt-decode": "^3.1.2",
|
|
27
29
|
"randomatic": "^3.1.1",
|
|
30
|
+
"react": "^18.2.0",
|
|
28
31
|
"yup": "^0.32.11"
|
|
29
32
|
}
|
|
30
33
|
}
|