taxtank-core 0.9.1 → 0.9.2
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/bundles/taxtank-core.umd.js +83 -19
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/transaction.collection.js +1 -8
- package/esm2015/lib/db/Models/transaction-base.js +12 -8
- package/esm2015/lib/models/chart-accounts/chart-accounts-categories.const.js +24 -3
- package/esm2015/lib/models/chart-accounts/chart-accounts.js +5 -1
- package/esm2015/lib/models/transaction/transaction.js +4 -2
- package/esm2015/lib/services/http/transaction/messages.enum.js +7 -0
- package/esm2015/lib/services/http/transaction/transaction.service.js +10 -4
- package/esm2015/lib/services/toast/toast.service.js +32 -1
- package/fesm2015/taxtank-core.js +83 -19
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/transaction.collection.d.ts +0 -6
- package/lib/db/Models/transaction-base.d.ts +4 -2
- package/lib/models/chart-accounts/chart-accounts-categories.const.d.ts +4 -0
- package/lib/models/chart-accounts/chart-accounts.d.ts +1 -0
- package/lib/services/http/transaction/messages.enum.d.ts +5 -0
- package/lib/services/http/transaction/transaction.service.d.ts +3 -1
- package/lib/services/toast/toast.service.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1807,13 +1807,6 @@
|
|
|
1807
1807
|
enumerable: false,
|
|
1808
1808
|
configurable: true
|
|
1809
1809
|
});
|
|
1810
|
-
/**
|
|
1811
|
-
* Get new collection of transactions filtered by tank type
|
|
1812
|
-
* @param tankType
|
|
1813
|
-
*/
|
|
1814
|
-
TransactionCollection.prototype.getByTankType = function (tankType) {
|
|
1815
|
-
return new TransactionCollection(this.items.filter(function (transaction) { return transaction.tankType === tankType; }));
|
|
1816
|
-
};
|
|
1817
1810
|
/**
|
|
1818
1811
|
* get date of the last transaction
|
|
1819
1812
|
*/
|
|
@@ -2895,12 +2888,17 @@
|
|
|
2895
2888
|
ChartAccountsCategoryEnum[ChartAccountsCategoryEnum["SOLE_DEPRECIATION"] = 14] = "SOLE_DEPRECIATION";
|
|
2896
2889
|
})(exports.ChartAccountsCategoryEnum || (exports.ChartAccountsCategoryEnum = {}));
|
|
2897
2890
|
|
|
2891
|
+
/**
|
|
2892
|
+
* Grouped chart accounts categories for fast work
|
|
2893
|
+
* @TODO Alex: Clean up and/or remove some groups
|
|
2894
|
+
*/
|
|
2898
2895
|
var CHART_ACCOUNTS_CATEGORIES = {
|
|
2899
2896
|
income: [
|
|
2900
2897
|
exports.ChartAccountsCategoryEnum.PROPERTY_INCOME,
|
|
2901
2898
|
exports.ChartAccountsCategoryEnum.WORK_INCOME,
|
|
2902
2899
|
exports.ChartAccountsCategoryEnum.OTHER_INCOME,
|
|
2903
|
-
exports.ChartAccountsCategoryEnum.PERSONAL_INCOME
|
|
2900
|
+
exports.ChartAccountsCategoryEnum.PERSONAL_INCOME,
|
|
2901
|
+
exports.ChartAccountsCategoryEnum.SOLE_INCOME,
|
|
2904
2902
|
],
|
|
2905
2903
|
expense: [
|
|
2906
2904
|
exports.ChartAccountsCategoryEnum.PROPERTY_EXPENSE,
|
|
@@ -2909,7 +2907,9 @@
|
|
|
2909
2907
|
exports.ChartAccountsCategoryEnum.WORK_DEPRECIATION,
|
|
2910
2908
|
exports.ChartAccountsCategoryEnum.WORK_EXPENSE,
|
|
2911
2909
|
exports.ChartAccountsCategoryEnum.OTHER_EXPENSE,
|
|
2912
|
-
exports.ChartAccountsCategoryEnum.PERSONAL_EXPENSE
|
|
2910
|
+
exports.ChartAccountsCategoryEnum.PERSONAL_EXPENSE,
|
|
2911
|
+
exports.ChartAccountsCategoryEnum.SOLE_EXPENSE,
|
|
2912
|
+
exports.ChartAccountsCategoryEnum.SOLE_DEPRECIATION
|
|
2913
2913
|
],
|
|
2914
2914
|
property: [
|
|
2915
2915
|
exports.ChartAccountsCategoryEnum.PROPERTY_EXPENSE,
|
|
@@ -2924,6 +2924,11 @@
|
|
|
2924
2924
|
exports.ChartAccountsCategoryEnum.OTHER_EXPENSE,
|
|
2925
2925
|
exports.ChartAccountsCategoryEnum.OTHER_INCOME
|
|
2926
2926
|
],
|
|
2927
|
+
sole: [
|
|
2928
|
+
exports.ChartAccountsCategoryEnum.SOLE_INCOME,
|
|
2929
|
+
exports.ChartAccountsCategoryEnum.SOLE_EXPENSE,
|
|
2930
|
+
exports.ChartAccountsCategoryEnum.SOLE_DEPRECIATION
|
|
2931
|
+
],
|
|
2927
2932
|
personal: [
|
|
2928
2933
|
exports.ChartAccountsCategoryEnum.PERSONAL_EXPENSE,
|
|
2929
2934
|
exports.ChartAccountsCategoryEnum.PERSONAL_INCOME
|
|
@@ -2946,6 +2951,15 @@
|
|
|
2946
2951
|
// @TODO Alex why?
|
|
2947
2952
|
exports.ChartAccountsCategoryEnum.PERSONAL_INCOME
|
|
2948
2953
|
],
|
|
2954
|
+
soleExpense: [
|
|
2955
|
+
exports.ChartAccountsCategoryEnum.SOLE_EXPENSE,
|
|
2956
|
+
],
|
|
2957
|
+
soleIncome: [
|
|
2958
|
+
exports.ChartAccountsCategoryEnum.SOLE_INCOME,
|
|
2959
|
+
],
|
|
2960
|
+
soleDepreciation: [
|
|
2961
|
+
exports.ChartAccountsCategoryEnum.SOLE_DEPRECIATION,
|
|
2962
|
+
],
|
|
2949
2963
|
workTankHeader: [
|
|
2950
2964
|
exports.ChartAccountsCategoryEnum.WORK_INCOME,
|
|
2951
2965
|
exports.ChartAccountsCategoryEnum.OTHER_INCOME,
|
|
@@ -2986,17 +3000,22 @@
|
|
|
2986
3000
|
* Check if current tank is Property
|
|
2987
3001
|
*/
|
|
2988
3002
|
TransactionBase.prototype.isPropertyTank = function () {
|
|
2989
|
-
|
|
3003
|
+
var _a;
|
|
3004
|
+
return CHART_ACCOUNTS_CATEGORIES.property.includes((_a = this.chartAccounts) === null || _a === void 0 ? void 0 : _a.category);
|
|
2990
3005
|
};
|
|
2991
3006
|
/**
|
|
2992
3007
|
* Check if current tank is Work
|
|
2993
3008
|
*/
|
|
2994
3009
|
TransactionBase.prototype.isWorkTank = function () {
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3010
|
+
var _a;
|
|
3011
|
+
return CHART_ACCOUNTS_CATEGORIES.work.includes((_a = this.chartAccounts) === null || _a === void 0 ? void 0 : _a.category);
|
|
3012
|
+
};
|
|
3013
|
+
/**
|
|
3014
|
+
* Check if current tank is Sole
|
|
3015
|
+
*/
|
|
3016
|
+
TransactionBase.prototype.isSoleTank = function () {
|
|
3017
|
+
var _a;
|
|
3018
|
+
return CHART_ACCOUNTS_CATEGORIES.sole.includes((_a = this.chartAccounts) === null || _a === void 0 ? void 0 : _a.category);
|
|
3000
3019
|
};
|
|
3001
3020
|
return TransactionBase;
|
|
3002
3021
|
}());
|
|
@@ -5219,6 +5238,10 @@
|
|
|
5219
5238
|
return [exports.ChartAccountsCategoryEnum.WORK_EXPENSE, exports.ChartAccountsCategoryEnum.OTHER_EXPENSE, exports.ChartAccountsCategoryEnum.WORK_DEPRECIATION]
|
|
5220
5239
|
.includes(this.category);
|
|
5221
5240
|
};
|
|
5241
|
+
ChartAccounts.prototype.isSoleExpense = function () {
|
|
5242
|
+
return [exports.ChartAccountsCategoryEnum.SOLE_EXPENSE, exports.ChartAccountsCategoryEnum.SOLE_DEPRECIATION]
|
|
5243
|
+
.includes(this.category);
|
|
5244
|
+
};
|
|
5222
5245
|
/**
|
|
5223
5246
|
* Check if chart accounts is property expense
|
|
5224
5247
|
*/
|
|
@@ -5788,7 +5811,7 @@
|
|
|
5788
5811
|
return CHART_ACCOUNTS_CATEGORIES.expense.includes(this.chartAccounts.category);
|
|
5789
5812
|
};
|
|
5790
5813
|
Transaction.prototype.isPersonal = function () {
|
|
5791
|
-
return
|
|
5814
|
+
return CHART_ACCOUNTS_CATEGORIES.personal.includes(this.chartAccounts.category);
|
|
5792
5815
|
};
|
|
5793
5816
|
Object.defineProperty(Transaction.prototype, "chartAccountsCategories", {
|
|
5794
5817
|
get: function () {
|
|
@@ -5797,6 +5820,8 @@
|
|
|
5797
5820
|
return CHART_ACCOUNTS_CATEGORIES.personal;
|
|
5798
5821
|
case this.isPropertyTank():
|
|
5799
5822
|
return CHART_ACCOUNTS_CATEGORIES.property;
|
|
5823
|
+
case this.isSoleTank():
|
|
5824
|
+
return CHART_ACCOUNTS_CATEGORIES.sole;
|
|
5800
5825
|
default:
|
|
5801
5826
|
return CHART_ACCOUNTS_CATEGORIES.work;
|
|
5802
5827
|
}
|
|
@@ -11800,6 +11825,34 @@
|
|
|
11800
11825
|
ToastService.prototype.add = function (toast) {
|
|
11801
11826
|
this.toast$.next(toast);
|
|
11802
11827
|
};
|
|
11828
|
+
ToastService.prototype.success = function (message) {
|
|
11829
|
+
this.add(classTransformer.plainToClass(Toast, {
|
|
11830
|
+
type: exports.ToastTypeEnum.SUCCESS,
|
|
11831
|
+
title: 'Success!',
|
|
11832
|
+
message: message,
|
|
11833
|
+
}));
|
|
11834
|
+
};
|
|
11835
|
+
ToastService.prototype.warning = function (message) {
|
|
11836
|
+
this.add(classTransformer.plainToClass(Toast, {
|
|
11837
|
+
type: exports.ToastTypeEnum.WARNING,
|
|
11838
|
+
title: 'Warning!',
|
|
11839
|
+
message: message,
|
|
11840
|
+
}));
|
|
11841
|
+
};
|
|
11842
|
+
ToastService.prototype.error = function (message) {
|
|
11843
|
+
this.add(classTransformer.plainToClass(Toast, {
|
|
11844
|
+
type: exports.ToastTypeEnum.ERROR,
|
|
11845
|
+
title: 'Error!',
|
|
11846
|
+
message: message,
|
|
11847
|
+
}));
|
|
11848
|
+
};
|
|
11849
|
+
ToastService.prototype.info = function (message) {
|
|
11850
|
+
this.add(classTransformer.plainToClass(Toast, {
|
|
11851
|
+
type: exports.ToastTypeEnum.INFO,
|
|
11852
|
+
title: 'Information',
|
|
11853
|
+
message: message,
|
|
11854
|
+
}));
|
|
11855
|
+
};
|
|
11803
11856
|
return ToastService;
|
|
11804
11857
|
}());
|
|
11805
11858
|
ToastService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ToastService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
@@ -11824,16 +11877,24 @@
|
|
|
11824
11877
|
return list;
|
|
11825
11878
|
}
|
|
11826
11879
|
|
|
11880
|
+
var MessagesEnum;
|
|
11881
|
+
(function (MessagesEnum) {
|
|
11882
|
+
MessagesEnum["DELETED_MESSAGE"] = "Transaction deleted";
|
|
11883
|
+
MessagesEnum["UPDATED_MESSAGE"] = "Transaction updated";
|
|
11884
|
+
MessagesEnum["CREATED_MESSAGE"] = "Transaction(s) created";
|
|
11885
|
+
})(MessagesEnum || (MessagesEnum = {}));
|
|
11886
|
+
|
|
11827
11887
|
/**
|
|
11828
11888
|
* Service for transactions business logic
|
|
11829
11889
|
*/
|
|
11830
11890
|
var TransactionService = /** @class */ (function (_super) {
|
|
11831
11891
|
__extends(TransactionService, _super);
|
|
11832
|
-
function TransactionService(http, eventDispatcherService, environment) {
|
|
11892
|
+
function TransactionService(http, eventDispatcherService, environment, toastService) {
|
|
11833
11893
|
var _this = _super.call(this, http, eventDispatcherService, environment) || this;
|
|
11834
11894
|
_this.http = http;
|
|
11835
11895
|
_this.eventDispatcherService = eventDispatcherService;
|
|
11836
11896
|
_this.environment = environment;
|
|
11897
|
+
_this.toastService = toastService;
|
|
11837
11898
|
// url part for Transaction API
|
|
11838
11899
|
_this.url = 'transactions';
|
|
11839
11900
|
_this.modelClass = Transaction;
|
|
@@ -11955,6 +12016,7 @@
|
|
|
11955
12016
|
_this.updateCache();
|
|
11956
12017
|
}
|
|
11957
12018
|
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.TRANSACTIONS_CREATED, addedTransactions));
|
|
12019
|
+
_this.toastService.success(MessagesEnum.CREATED_MESSAGE);
|
|
11958
12020
|
return addedTransactions;
|
|
11959
12021
|
}));
|
|
11960
12022
|
};
|
|
@@ -11991,6 +12053,7 @@
|
|
|
11991
12053
|
_this.addBatch(childTransactionsToAdd).subscribe();
|
|
11992
12054
|
}
|
|
11993
12055
|
}
|
|
12056
|
+
_this.toastService.success(MessagesEnum.UPDATED_MESSAGE);
|
|
11994
12057
|
replace(_this.cache, updatedTransaction);
|
|
11995
12058
|
_this.updateCache();
|
|
11996
12059
|
return updatedTransaction;
|
|
@@ -12039,6 +12102,7 @@
|
|
|
12039
12102
|
return transaction.id !== model.id && ((_a = transaction.parentTransaction) === null || _a === void 0 ? void 0 : _a.id) !== model.id;
|
|
12040
12103
|
});
|
|
12041
12104
|
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.TRANSACTION_DELETED, model));
|
|
12105
|
+
_this.toastService.success(MessagesEnum.DELETED_MESSAGE);
|
|
12042
12106
|
_this.updateCache();
|
|
12043
12107
|
_this.transactionDeleted.emit(model);
|
|
12044
12108
|
}));
|
|
@@ -12132,7 +12196,7 @@
|
|
|
12132
12196
|
};
|
|
12133
12197
|
return TransactionService;
|
|
12134
12198
|
}(RestService));
|
|
12135
|
-
TransactionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TransactionService, deps: [{ token: i1__namespace.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
12199
|
+
TransactionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TransactionService, deps: [{ token: i1__namespace.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
12136
12200
|
TransactionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TransactionService, providedIn: 'root' });
|
|
12137
12201
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TransactionService, decorators: [{
|
|
12138
12202
|
type: i0.Injectable,
|
|
@@ -12143,7 +12207,7 @@
|
|
|
12143
12207
|
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
12144
12208
|
type: i0.Inject,
|
|
12145
12209
|
args: ['environment']
|
|
12146
|
-
}] }];
|
|
12210
|
+
}] }, { type: ToastService }];
|
|
12147
12211
|
} });
|
|
12148
12212
|
|
|
12149
12213
|
// @TODO Don't look at the commented code. Will be refactored/removed during TT-1503
|