taxtank-core 0.9.0 → 0.9.3
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 +112 -141
- 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/interfaces/exportable.interface.js +2 -0
- package/esm2015/lib/interfaces/updatable.interface.js +2 -0
- 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/export/export-format.enum.js +6 -0
- package/esm2015/lib/models/transaction/transaction.js +6 -4
- package/esm2015/lib/services/http/transaction/messages.enum.js +7 -0
- package/esm2015/lib/services/http/transaction/transaction.service.js +17 -4
- package/esm2015/lib/services/pdf/pdf.service.js +2 -42
- package/esm2015/lib/services/toast/toast.service.js +32 -1
- package/esm2015/lib/services/xlsx/xlsx.service.js +13 -20
- package/esm2015/public-api.js +4 -3
- package/fesm2015/taxtank-core.js +112 -137
- 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/interfaces/exportable.interface.d.ts +9 -0
- package/lib/interfaces/updatable.interface.d.ts +8 -0
- 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/models/export/export-format.enum.d.ts +4 -0
- package/lib/services/http/transaction/messages.enum.d.ts +5 -0
- package/lib/services/http/transaction/transaction.service.d.ts +7 -1
- package/lib/services/pdf/pdf.service.d.ts +1 -14
- package/lib/services/toast/toast.service.d.ts +4 -0
- package/lib/services/xlsx/xlsx.service.d.ts +4 -5
- package/package.json +1 -1
- package/public-api.d.ts +3 -2
- package/esm2015/lib/models/data-table/data-table-column.js +0 -13
- package/esm2015/lib/models/data-table/data-table.js +0 -42
- package/lib/models/data-table/data-table-column.d.ts +0 -20
- package/lib/models/data-table/data-table.d.ts +0 -24
package/fesm2015/taxtank-core.js
CHANGED
|
@@ -1290,13 +1290,6 @@ class TransactionCollection extends Collection {
|
|
|
1290
1290
|
get cashPosition() {
|
|
1291
1291
|
return this.claimAmount;
|
|
1292
1292
|
}
|
|
1293
|
-
/**
|
|
1294
|
-
* Get new collection of transactions filtered by tank type
|
|
1295
|
-
* @param tankType
|
|
1296
|
-
*/
|
|
1297
|
-
getByTankType(tankType) {
|
|
1298
|
-
return new TransactionCollection(this.items.filter((transaction) => transaction.tankType === tankType));
|
|
1299
|
-
}
|
|
1300
1293
|
/**
|
|
1301
1294
|
* get date of the last transaction
|
|
1302
1295
|
*/
|
|
@@ -2106,12 +2099,17 @@ var ChartAccountsCategoryEnum;
|
|
|
2106
2099
|
ChartAccountsCategoryEnum[ChartAccountsCategoryEnum["SOLE_DEPRECIATION"] = 14] = "SOLE_DEPRECIATION";
|
|
2107
2100
|
})(ChartAccountsCategoryEnum || (ChartAccountsCategoryEnum = {}));
|
|
2108
2101
|
|
|
2102
|
+
/**
|
|
2103
|
+
* Grouped chart accounts categories for fast work
|
|
2104
|
+
* @TODO Alex: Clean up and/or remove some groups
|
|
2105
|
+
*/
|
|
2109
2106
|
const CHART_ACCOUNTS_CATEGORIES = {
|
|
2110
2107
|
income: [
|
|
2111
2108
|
ChartAccountsCategoryEnum.PROPERTY_INCOME,
|
|
2112
2109
|
ChartAccountsCategoryEnum.WORK_INCOME,
|
|
2113
2110
|
ChartAccountsCategoryEnum.OTHER_INCOME,
|
|
2114
|
-
ChartAccountsCategoryEnum.PERSONAL_INCOME
|
|
2111
|
+
ChartAccountsCategoryEnum.PERSONAL_INCOME,
|
|
2112
|
+
ChartAccountsCategoryEnum.SOLE_INCOME,
|
|
2115
2113
|
],
|
|
2116
2114
|
expense: [
|
|
2117
2115
|
ChartAccountsCategoryEnum.PROPERTY_EXPENSE,
|
|
@@ -2120,7 +2118,9 @@ const CHART_ACCOUNTS_CATEGORIES = {
|
|
|
2120
2118
|
ChartAccountsCategoryEnum.WORK_DEPRECIATION,
|
|
2121
2119
|
ChartAccountsCategoryEnum.WORK_EXPENSE,
|
|
2122
2120
|
ChartAccountsCategoryEnum.OTHER_EXPENSE,
|
|
2123
|
-
ChartAccountsCategoryEnum.PERSONAL_EXPENSE
|
|
2121
|
+
ChartAccountsCategoryEnum.PERSONAL_EXPENSE,
|
|
2122
|
+
ChartAccountsCategoryEnum.SOLE_EXPENSE,
|
|
2123
|
+
ChartAccountsCategoryEnum.SOLE_DEPRECIATION
|
|
2124
2124
|
],
|
|
2125
2125
|
property: [
|
|
2126
2126
|
ChartAccountsCategoryEnum.PROPERTY_EXPENSE,
|
|
@@ -2135,6 +2135,11 @@ const CHART_ACCOUNTS_CATEGORIES = {
|
|
|
2135
2135
|
ChartAccountsCategoryEnum.OTHER_EXPENSE,
|
|
2136
2136
|
ChartAccountsCategoryEnum.OTHER_INCOME
|
|
2137
2137
|
],
|
|
2138
|
+
sole: [
|
|
2139
|
+
ChartAccountsCategoryEnum.SOLE_INCOME,
|
|
2140
|
+
ChartAccountsCategoryEnum.SOLE_EXPENSE,
|
|
2141
|
+
ChartAccountsCategoryEnum.SOLE_DEPRECIATION
|
|
2142
|
+
],
|
|
2138
2143
|
personal: [
|
|
2139
2144
|
ChartAccountsCategoryEnum.PERSONAL_EXPENSE,
|
|
2140
2145
|
ChartAccountsCategoryEnum.PERSONAL_INCOME
|
|
@@ -2157,6 +2162,15 @@ const CHART_ACCOUNTS_CATEGORIES = {
|
|
|
2157
2162
|
// @TODO Alex why?
|
|
2158
2163
|
ChartAccountsCategoryEnum.PERSONAL_INCOME
|
|
2159
2164
|
],
|
|
2165
|
+
soleExpense: [
|
|
2166
|
+
ChartAccountsCategoryEnum.SOLE_EXPENSE,
|
|
2167
|
+
],
|
|
2168
|
+
soleIncome: [
|
|
2169
|
+
ChartAccountsCategoryEnum.SOLE_INCOME,
|
|
2170
|
+
],
|
|
2171
|
+
soleDepreciation: [
|
|
2172
|
+
ChartAccountsCategoryEnum.SOLE_DEPRECIATION,
|
|
2173
|
+
],
|
|
2160
2174
|
workTankHeader: [
|
|
2161
2175
|
ChartAccountsCategoryEnum.WORK_INCOME,
|
|
2162
2176
|
ChartAccountsCategoryEnum.OTHER_INCOME,
|
|
@@ -2195,17 +2209,22 @@ class TransactionBase {
|
|
|
2195
2209
|
* Check if current tank is Property
|
|
2196
2210
|
*/
|
|
2197
2211
|
isPropertyTank() {
|
|
2198
|
-
|
|
2212
|
+
var _a;
|
|
2213
|
+
return CHART_ACCOUNTS_CATEGORIES.property.includes((_a = this.chartAccounts) === null || _a === void 0 ? void 0 : _a.category);
|
|
2199
2214
|
}
|
|
2200
2215
|
/**
|
|
2201
2216
|
* Check if current tank is Work
|
|
2202
2217
|
*/
|
|
2203
2218
|
isWorkTank() {
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2219
|
+
var _a;
|
|
2220
|
+
return CHART_ACCOUNTS_CATEGORIES.work.includes((_a = this.chartAccounts) === null || _a === void 0 ? void 0 : _a.category);
|
|
2221
|
+
}
|
|
2222
|
+
/**
|
|
2223
|
+
* Check if current tank is Sole
|
|
2224
|
+
*/
|
|
2225
|
+
isSoleTank() {
|
|
2226
|
+
var _a;
|
|
2227
|
+
return CHART_ACCOUNTS_CATEGORIES.sole.includes((_a = this.chartAccounts) === null || _a === void 0 ? void 0 : _a.category);
|
|
2209
2228
|
}
|
|
2210
2229
|
}
|
|
2211
2230
|
|
|
@@ -4014,6 +4033,10 @@ class ChartAccounts extends ChartAccounts$1 {
|
|
|
4014
4033
|
return [ChartAccountsCategoryEnum.WORK_EXPENSE, ChartAccountsCategoryEnum.OTHER_EXPENSE, ChartAccountsCategoryEnum.WORK_DEPRECIATION]
|
|
4015
4034
|
.includes(this.category);
|
|
4016
4035
|
}
|
|
4036
|
+
isSoleExpense() {
|
|
4037
|
+
return [ChartAccountsCategoryEnum.SOLE_EXPENSE, ChartAccountsCategoryEnum.SOLE_DEPRECIATION]
|
|
4038
|
+
.includes(this.category);
|
|
4039
|
+
}
|
|
4017
4040
|
/**
|
|
4018
4041
|
* Check if chart accounts is property expense
|
|
4019
4042
|
*/
|
|
@@ -4454,7 +4477,7 @@ class Transaction extends Transaction$1 {
|
|
|
4454
4477
|
return CHART_ACCOUNTS_CATEGORIES.expense.includes(this.chartAccounts.category);
|
|
4455
4478
|
}
|
|
4456
4479
|
isPersonal() {
|
|
4457
|
-
return
|
|
4480
|
+
return CHART_ACCOUNTS_CATEGORIES.personal.includes(this.chartAccounts.category);
|
|
4458
4481
|
}
|
|
4459
4482
|
get chartAccountsCategories() {
|
|
4460
4483
|
switch (true) {
|
|
@@ -4462,6 +4485,8 @@ class Transaction extends Transaction$1 {
|
|
|
4462
4485
|
return CHART_ACCOUNTS_CATEGORIES.personal;
|
|
4463
4486
|
case this.isPropertyTank():
|
|
4464
4487
|
return CHART_ACCOUNTS_CATEGORIES.property;
|
|
4488
|
+
case this.isSoleTank():
|
|
4489
|
+
return CHART_ACCOUNTS_CATEGORIES.sole;
|
|
4465
4490
|
default:
|
|
4466
4491
|
return CHART_ACCOUNTS_CATEGORIES.work;
|
|
4467
4492
|
}
|
|
@@ -4518,10 +4543,10 @@ class Transaction extends Transaction$1 {
|
|
|
4518
4543
|
return this.operation === TransactionOperationEnum.TRANSFER;
|
|
4519
4544
|
}
|
|
4520
4545
|
get debit() {
|
|
4521
|
-
return this.isDebit() ? Math.abs(this.amount) :
|
|
4546
|
+
return this.isDebit() ? Math.abs(this.amount) : 0;
|
|
4522
4547
|
}
|
|
4523
4548
|
get credit() {
|
|
4524
|
-
return this.isCredit() ? Math.abs(this.amount) :
|
|
4549
|
+
return this.isCredit() ? Math.abs(this.amount) : 0;
|
|
4525
4550
|
}
|
|
4526
4551
|
/**
|
|
4527
4552
|
* Get value of transaction metadata field
|
|
@@ -5183,61 +5208,6 @@ var AlphabetColorsEnum;
|
|
|
5183
5208
|
AlphabetColorsEnum["Z"] = "#E3C9CE";
|
|
5184
5209
|
})(AlphabetColorsEnum || (AlphabetColorsEnum = {}));
|
|
5185
5210
|
|
|
5186
|
-
/**
|
|
5187
|
-
* Class to generate data-table structure based on provided collection.
|
|
5188
|
-
* Use to work with HTML/PDF/XLSX tables
|
|
5189
|
-
*/
|
|
5190
|
-
class DataTable {
|
|
5191
|
-
constructor(collection, columns, caption, footerCaption) {
|
|
5192
|
-
this.caption = caption;
|
|
5193
|
-
this.columns = columns;
|
|
5194
|
-
this.setRows(collection);
|
|
5195
|
-
if (footerCaption) {
|
|
5196
|
-
this.setFooterRow(collection, footerCaption);
|
|
5197
|
-
}
|
|
5198
|
-
}
|
|
5199
|
-
setRows(collection) {
|
|
5200
|
-
this.rows = collection.items.map((item) => {
|
|
5201
|
-
// parse table columns to return items based on column properties
|
|
5202
|
-
return this.columns.map((column) => {
|
|
5203
|
-
// if the pipe is provided - transform the return value
|
|
5204
|
-
if (column.pipe) {
|
|
5205
|
-
return column.pipe.transform(item[column.key]);
|
|
5206
|
-
}
|
|
5207
|
-
return (item[column.key] ? item[column.key] : '-').toString();
|
|
5208
|
-
});
|
|
5209
|
-
});
|
|
5210
|
-
}
|
|
5211
|
-
setFooterRow(collection, footerCaption) {
|
|
5212
|
-
this.footerRow = this.columns.map((column, index) => {
|
|
5213
|
-
if (index === 0) {
|
|
5214
|
-
return footerCaption.toString();
|
|
5215
|
-
}
|
|
5216
|
-
if (!column.total) {
|
|
5217
|
-
return '';
|
|
5218
|
-
}
|
|
5219
|
-
const totalValue = collection.items.reduce((sum, item) => {
|
|
5220
|
-
// check if current collection item has value. If not - don't add it to the sum
|
|
5221
|
-
return item[column.key] !== null ? sum + Number(item[column.key]) : sum;
|
|
5222
|
-
}, null);
|
|
5223
|
-
return (totalValue !== null && totalValue !== void 0 ? totalValue : '-').toString();
|
|
5224
|
-
});
|
|
5225
|
-
}
|
|
5226
|
-
}
|
|
5227
|
-
|
|
5228
|
-
class DataTableColumn {
|
|
5229
|
-
constructor(name, key, total, pipe) {
|
|
5230
|
-
/**
|
|
5231
|
-
* Flag that shows should the column be in the total calculation or not
|
|
5232
|
-
*/
|
|
5233
|
-
this.total = false;
|
|
5234
|
-
this.name = name;
|
|
5235
|
-
this.key = key;
|
|
5236
|
-
this.total = total;
|
|
5237
|
-
this.pipe = pipe;
|
|
5238
|
-
}
|
|
5239
|
-
}
|
|
5240
|
-
|
|
5241
5211
|
var DepreciationLvpRateEnum;
|
|
5242
5212
|
(function (DepreciationLvpRateEnum) {
|
|
5243
5213
|
DepreciationLvpRateEnum[DepreciationLvpRateEnum["FIRST_YEAR"] = 0.1875] = "FIRST_YEAR";
|
|
@@ -5448,6 +5418,12 @@ var AppEventTypeEnum;
|
|
|
5448
5418
|
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 37] = "VEHICLE_CLAIM_CREATED";
|
|
5449
5419
|
})(AppEventTypeEnum || (AppEventTypeEnum = {}));
|
|
5450
5420
|
|
|
5421
|
+
var ExportFormatEnum;
|
|
5422
|
+
(function (ExportFormatEnum) {
|
|
5423
|
+
ExportFormatEnum["PDF"] = "PDF";
|
|
5424
|
+
ExportFormatEnum["XLSX"] = "XLSX";
|
|
5425
|
+
})(ExportFormatEnum || (ExportFormatEnum = {}));
|
|
5426
|
+
|
|
5451
5427
|
var IconsFileEnum;
|
|
5452
5428
|
(function (IconsFileEnum) {
|
|
5453
5429
|
IconsFileEnum["JPG"] = "icon-image-jpg";
|
|
@@ -8770,24 +8746,13 @@ const PDF_CONFIG = {
|
|
|
8770
8746
|
* Service to work with PDF (generate, download, e.t.c.)
|
|
8771
8747
|
*/
|
|
8772
8748
|
class PdfService {
|
|
8773
|
-
// @Todo remove 'any' type
|
|
8774
|
-
/**
|
|
8775
|
-
* Download generated PDF file
|
|
8776
|
-
*/
|
|
8777
|
-
download(tables, title, fileName) {
|
|
8778
|
-
const document = this.generatePdfFile(tables, title);
|
|
8779
|
-
document.save(`${fileName}.pdf`);
|
|
8780
|
-
}
|
|
8781
8749
|
/**
|
|
8782
|
-
*
|
|
8750
|
+
* Export file form provided HTML tables
|
|
8783
8751
|
*/
|
|
8784
8752
|
exportTables(tables, title, fileName) {
|
|
8785
8753
|
const document = this.generateFromTables(tables, title);
|
|
8786
8754
|
document.save(`${fileName}.pdf`);
|
|
8787
8755
|
}
|
|
8788
|
-
/**
|
|
8789
|
-
* @Todo rename when all DataTable dependent methods will be cleared-up
|
|
8790
|
-
*/
|
|
8791
8756
|
generateFromTables(tables, title) {
|
|
8792
8757
|
const pdf = new jsPDF();
|
|
8793
8758
|
this.setDocumentTitle(pdf, title);
|
|
@@ -8836,35 +8801,6 @@ class PdfService {
|
|
|
8836
8801
|
logo.src = PDF_CONFIG.logo.src;
|
|
8837
8802
|
doc.addImage(logo, 'PNG', PDF_CONFIG.logo.positionX, PDF_CONFIG.logo.positionY, PDF_CONFIG.logo.width, PDF_CONFIG.logo.height);
|
|
8838
8803
|
}
|
|
8839
|
-
/**
|
|
8840
|
-
* @Todo remove/refactor when all DataTable dependent methods will be cleared-up
|
|
8841
|
-
* Generate PDF file from provided data
|
|
8842
|
-
*/
|
|
8843
|
-
generatePdfFile(tables, title) {
|
|
8844
|
-
const pdf = new jsPDF();
|
|
8845
|
-
// set document font params
|
|
8846
|
-
pdf.setFontSize(PDF_CONFIG.text.fontSize)
|
|
8847
|
-
.setFont(PDF_CONFIG.text.fontName, PDF_CONFIG.text.fontStyle, PDF_CONFIG.text.fontWeight)
|
|
8848
|
-
.text(title, PDF_CONFIG.text.positionX, PDF_CONFIG.text.positionY);
|
|
8849
|
-
tables.forEach((table) => {
|
|
8850
|
-
// coords of last table
|
|
8851
|
-
const lastTableCoords = pdf['lastAutoTable'].finalY || PDF_CONFIG.contentCoords.marginTop;
|
|
8852
|
-
pdf.text(table.caption, PDF_CONFIG.contentCoords.marginLeft, lastTableCoords + PDF_CONFIG.contentCoords.marginTop);
|
|
8853
|
-
// table options
|
|
8854
|
-
const options = {
|
|
8855
|
-
startY: lastTableCoords + PDF_CONFIG.contentTitleCoords.marginTop,
|
|
8856
|
-
head: [table['columns'].map((column) => column.name)],
|
|
8857
|
-
body: table['rows'],
|
|
8858
|
-
foot: [table['footerRow']],
|
|
8859
|
-
footStyles: {
|
|
8860
|
-
fillColor: PDF_CONFIG.text.fillColor,
|
|
8861
|
-
textColor: PDF_CONFIG.text.textColor
|
|
8862
|
-
}
|
|
8863
|
-
};
|
|
8864
|
-
autoTable(pdf, options);
|
|
8865
|
-
});
|
|
8866
|
-
return pdf;
|
|
8867
|
-
}
|
|
8868
8804
|
}
|
|
8869
8805
|
PdfService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
8870
8806
|
PdfService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PdfService, providedIn: 'root' });
|
|
@@ -9722,6 +9658,34 @@ class ToastService {
|
|
|
9722
9658
|
add(toast) {
|
|
9723
9659
|
this.toast$.next(toast);
|
|
9724
9660
|
}
|
|
9661
|
+
success(message) {
|
|
9662
|
+
this.add(plainToClass(Toast, {
|
|
9663
|
+
type: ToastTypeEnum.SUCCESS,
|
|
9664
|
+
title: 'Success!',
|
|
9665
|
+
message,
|
|
9666
|
+
}));
|
|
9667
|
+
}
|
|
9668
|
+
warning(message) {
|
|
9669
|
+
this.add(plainToClass(Toast, {
|
|
9670
|
+
type: ToastTypeEnum.WARNING,
|
|
9671
|
+
title: 'Warning!',
|
|
9672
|
+
message,
|
|
9673
|
+
}));
|
|
9674
|
+
}
|
|
9675
|
+
error(message) {
|
|
9676
|
+
this.add(plainToClass(Toast, {
|
|
9677
|
+
type: ToastTypeEnum.ERROR,
|
|
9678
|
+
title: 'Error!',
|
|
9679
|
+
message,
|
|
9680
|
+
}));
|
|
9681
|
+
}
|
|
9682
|
+
info(message) {
|
|
9683
|
+
this.add(plainToClass(Toast, {
|
|
9684
|
+
type: ToastTypeEnum.INFO,
|
|
9685
|
+
title: 'Information',
|
|
9686
|
+
message,
|
|
9687
|
+
}));
|
|
9688
|
+
}
|
|
9725
9689
|
}
|
|
9726
9690
|
ToastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ToastService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
9727
9691
|
ToastService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ToastService, providedIn: 'root' });
|
|
@@ -9745,15 +9709,23 @@ function enumToList(data) {
|
|
|
9745
9709
|
return list;
|
|
9746
9710
|
}
|
|
9747
9711
|
|
|
9712
|
+
var MessagesEnum;
|
|
9713
|
+
(function (MessagesEnum) {
|
|
9714
|
+
MessagesEnum["DELETED_MESSAGE"] = "Transaction deleted";
|
|
9715
|
+
MessagesEnum["UPDATED_MESSAGE"] = "Transaction updated";
|
|
9716
|
+
MessagesEnum["CREATED_MESSAGE"] = "Transaction(s) created";
|
|
9717
|
+
})(MessagesEnum || (MessagesEnum = {}));
|
|
9718
|
+
|
|
9748
9719
|
/**
|
|
9749
9720
|
* Service for transactions business logic
|
|
9750
9721
|
*/
|
|
9751
9722
|
class TransactionService extends RestService {
|
|
9752
|
-
constructor(http, eventDispatcherService, environment) {
|
|
9723
|
+
constructor(http, eventDispatcherService, environment, toastService) {
|
|
9753
9724
|
super(http, eventDispatcherService, environment);
|
|
9754
9725
|
this.http = http;
|
|
9755
9726
|
this.eventDispatcherService = eventDispatcherService;
|
|
9756
9727
|
this.environment = environment;
|
|
9728
|
+
this.toastService = toastService;
|
|
9757
9729
|
// url part for Transaction API
|
|
9758
9730
|
this.url = 'transactions';
|
|
9759
9731
|
this.modelClass = Transaction;
|
|
@@ -9765,6 +9737,7 @@ class TransactionService extends RestService {
|
|
|
9765
9737
|
*/
|
|
9766
9738
|
listenEvents() {
|
|
9767
9739
|
this.listenDepreciationChange();
|
|
9740
|
+
this.listenPropertyShareUpdate();
|
|
9768
9741
|
}
|
|
9769
9742
|
/**
|
|
9770
9743
|
* get list of all user's TaxTank transactions
|
|
@@ -9869,6 +9842,7 @@ class TransactionService extends RestService {
|
|
|
9869
9842
|
this.updateCache();
|
|
9870
9843
|
}
|
|
9871
9844
|
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.TRANSACTIONS_CREATED, addedTransactions));
|
|
9845
|
+
this.toastService.success(MessagesEnum.CREATED_MESSAGE);
|
|
9872
9846
|
return addedTransactions;
|
|
9873
9847
|
}));
|
|
9874
9848
|
}
|
|
@@ -9904,6 +9878,7 @@ class TransactionService extends RestService {
|
|
|
9904
9878
|
this.addBatch(childTransactionsToAdd).subscribe();
|
|
9905
9879
|
}
|
|
9906
9880
|
}
|
|
9881
|
+
this.toastService.success(MessagesEnum.UPDATED_MESSAGE);
|
|
9907
9882
|
replace(this.cache, updatedTransaction);
|
|
9908
9883
|
this.updateCache();
|
|
9909
9884
|
return updatedTransaction;
|
|
@@ -9950,6 +9925,7 @@ class TransactionService extends RestService {
|
|
|
9950
9925
|
return transaction.id !== model.id && ((_a = transaction.parentTransaction) === null || _a === void 0 ? void 0 : _a.id) !== model.id;
|
|
9951
9926
|
});
|
|
9952
9927
|
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.TRANSACTION_DELETED, model));
|
|
9928
|
+
this.toastService.success(MessagesEnum.DELETED_MESSAGE);
|
|
9953
9929
|
this.updateCache();
|
|
9954
9930
|
this.transactionDeleted.emit(model);
|
|
9955
9931
|
}));
|
|
@@ -10032,8 +10008,14 @@ class TransactionService extends RestService {
|
|
|
10032
10008
|
});
|
|
10033
10009
|
});
|
|
10034
10010
|
}
|
|
10011
|
+
/**
|
|
10012
|
+
* Listen to EventDispatcherService event related to Property Share changing
|
|
10013
|
+
*/
|
|
10014
|
+
listenPropertyShareUpdate() {
|
|
10015
|
+
this.eventDispatcherService.on(AppEventTypeEnum.PROPERTY_SHARE_UPDATED).subscribe(() => this.resetCache());
|
|
10016
|
+
}
|
|
10035
10017
|
}
|
|
10036
|
-
TransactionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
10018
|
+
TransactionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
10037
10019
|
TransactionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, providedIn: 'root' });
|
|
10038
10020
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TransactionService, decorators: [{
|
|
10039
10021
|
type: Injectable,
|
|
@@ -10043,7 +10025,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
10043
10025
|
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
10044
10026
|
type: Inject,
|
|
10045
10027
|
args: ['environment']
|
|
10046
|
-
}] }]; } });
|
|
10028
|
+
}] }, { type: ToastService }]; } });
|
|
10047
10029
|
|
|
10048
10030
|
// @TODO Don't look at the commented code. Will be refactored/removed during TT-1503
|
|
10049
10031
|
/**
|
|
@@ -10610,18 +10592,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
10610
10592
|
* Service to work with XLSX (generate, download, e.t.c.)
|
|
10611
10593
|
*/
|
|
10612
10594
|
class XlsxService {
|
|
10613
|
-
|
|
10614
|
-
|
|
10615
|
-
* Download generated Excel file
|
|
10595
|
+
/**
|
|
10596
|
+
* Export file form provided HTML tables
|
|
10616
10597
|
*/
|
|
10617
|
-
|
|
10618
|
-
const excelFile = this.
|
|
10598
|
+
exportTables(tables, title, fileName) {
|
|
10599
|
+
const excelFile = this.generateFromTables(tables, title);
|
|
10619
10600
|
const data = new Blob([excelFile], {
|
|
10620
10601
|
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8'
|
|
10621
10602
|
});
|
|
10622
10603
|
FileSaver.saveAs(data, `${fileName}.xlsx`);
|
|
10623
10604
|
}
|
|
10624
|
-
|
|
10605
|
+
generateFromTables(tables, title) {
|
|
10625
10606
|
// create new workbook
|
|
10626
10607
|
const workbook = xlsx.utils.book_new();
|
|
10627
10608
|
// create empty worksheet
|
|
@@ -10629,19 +10610,13 @@ class XlsxService {
|
|
|
10629
10610
|
SheetNames: [],
|
|
10630
10611
|
Sheets: {}
|
|
10631
10612
|
};
|
|
10632
|
-
|
|
10633
|
-
// add caption
|
|
10634
|
-
|
|
10635
|
-
|
|
10636
|
-
|
|
10637
|
-
|
|
10638
|
-
|
|
10639
|
-
];
|
|
10640
|
-
});
|
|
10641
|
-
sheetData.forEach((data) => {
|
|
10642
|
-
xlsx.utils.sheet_add_json(worksheet, data, { origin: -1, skipHeader: true });
|
|
10643
|
-
// set empty row after each table
|
|
10644
|
-
xlsx.utils.sheet_add_json(worksheet, [], { origin: -1 });
|
|
10613
|
+
tables.forEach((data) => {
|
|
10614
|
+
// add caption for the current table
|
|
10615
|
+
xlsx.utils.sheet_add_aoa(worksheet, [[data.caption.innerText]], { origin: -1 });
|
|
10616
|
+
// add table table data to the worksheet
|
|
10617
|
+
xlsx.utils.sheet_add_dom(worksheet, data, { origin: -1, raw: true });
|
|
10618
|
+
// set empty row after current table
|
|
10619
|
+
xlsx.utils.sheet_add_aoa(worksheet, [], { origin: -1 });
|
|
10645
10620
|
});
|
|
10646
10621
|
xlsx.utils.book_append_sheet(workbook, worksheet);
|
|
10647
10622
|
return xlsx.write(workbook, { bookType: 'xlsx', type: 'array' });
|
|
@@ -10833,5 +10808,5 @@ class ResetPasswordForm extends AbstractForm {
|
|
|
10833
10808
|
* Generated bundle index. Do not edit.
|
|
10834
10809
|
*/
|
|
10835
10810
|
|
|
10836
|
-
export { AbstractForm, Address, AddressService, AddressTypeEnum, AlphabetColorsEnum, AppEvent, AppEventTypeEnum, AssetEntityTypeEnum, AssetTypeEnum, AssetsService, AuthService, BANK_ACCOUNT_TYPES, Bank, BankAccount, BankAccountCalculationService, BankAccountChartData, BankAccountCollection, BankAccountProperty, BankAccountService, BankAccountStatusEnum, BankAccountTypeEnum, BankConnection, BankConnectionService, BankConnectionStatusEnum, BankService, BankTransaction, BankTransactionCalculationService, BankTransactionChartData, BankTransactionCollection, BankTransactionService, BankTransactionSummaryFieldsEnum, BankTransactionTypeEnum, BasiqConfig, BasiqJob, BasiqService, BasiqToken, BorrowingExpense, BorrowingExpenseLoan, BorrowingExpenseService, CAPITAL_COSTS_ITEMS, CHART_ACCOUNTS_CATEGORIES, CalculationFormItem, CalculationFormTypeEnum, ChartAccounts, ChartAccountsCategoryEnum, ChartAccountsDepreciation, ChartAccountsDepreciationService, ChartAccountsEtpEnum, ChartAccountsHeading, ChartAccountsHeadingTaxDeductibleEnum, ChartAccountsHeadingTaxableEnum, ChartAccountsHeadingVehicleListEnum, ChartAccountsListEnum, ChartAccountsMetadata, ChartAccountsMetadataListEnum, ChartAccountsMetadataTypeEnum, ChartAccountsService, ChartAccountsTaxLabelsEnum, ChartAccountsTypeEnum, ChartData, ChartSerie, Chat, ChatService, ChatStatusEnum, ChatViewTypeEnum, ClientCollection, ClientDetails, ClientDetailsMedicareExemptionEnum, ClientDetailsWorkDepreciationCalculationEnum, ClientDetailsWorkingHolidayMakerEnum, ClientInvite, ClientInviteService, ClientInviteStatusEnum, ClientInviteTypeEnum, ClientMovement, ClientMovementCollection, ClientMovementService, ClientPortfolioChartData, ClientPortfolioReport, ClientPortfolioReportCollection, ClientPortfolioReportService, Collection, CollectionDictionary, CorelogicService, CorelogicSuggestion, Country, DEFAULT_VEHICLE_EXPENSE, DEPRECIATION_GROUPS, DOCUMENT_FILE_TYPES,
|
|
10811
|
+
export { AbstractForm, Address, AddressService, AddressTypeEnum, AlphabetColorsEnum, AppEvent, AppEventTypeEnum, AssetEntityTypeEnum, AssetTypeEnum, AssetsService, AuthService, BANK_ACCOUNT_TYPES, Bank, BankAccount, BankAccountCalculationService, BankAccountChartData, BankAccountCollection, BankAccountProperty, BankAccountService, BankAccountStatusEnum, BankAccountTypeEnum, BankConnection, BankConnectionService, BankConnectionStatusEnum, BankService, BankTransaction, BankTransactionCalculationService, BankTransactionChartData, BankTransactionCollection, BankTransactionService, BankTransactionSummaryFieldsEnum, BankTransactionTypeEnum, BasiqConfig, BasiqJob, BasiqService, BasiqToken, BorrowingExpense, BorrowingExpenseLoan, BorrowingExpenseService, CAPITAL_COSTS_ITEMS, CHART_ACCOUNTS_CATEGORIES, CalculationFormItem, CalculationFormTypeEnum, ChartAccounts, ChartAccountsCategoryEnum, ChartAccountsDepreciation, ChartAccountsDepreciationService, ChartAccountsEtpEnum, ChartAccountsHeading, ChartAccountsHeadingTaxDeductibleEnum, ChartAccountsHeadingTaxableEnum, ChartAccountsHeadingVehicleListEnum, ChartAccountsListEnum, ChartAccountsMetadata, ChartAccountsMetadataListEnum, ChartAccountsMetadataTypeEnum, ChartAccountsService, ChartAccountsTaxLabelsEnum, ChartAccountsTypeEnum, ChartData, ChartSerie, Chat, ChatService, ChatStatusEnum, ChatViewTypeEnum, ClientCollection, ClientDetails, ClientDetailsMedicareExemptionEnum, ClientDetailsWorkDepreciationCalculationEnum, ClientDetailsWorkingHolidayMakerEnum, ClientInvite, ClientInviteService, ClientInviteStatusEnum, ClientInviteTypeEnum, ClientMovement, ClientMovementCollection, ClientMovementService, ClientPortfolioChartData, ClientPortfolioReport, ClientPortfolioReportCollection, ClientPortfolioReportService, Collection, CollectionDictionary, CorelogicService, CorelogicSuggestion, Country, DEFAULT_VEHICLE_EXPENSE, DEPRECIATION_GROUPS, DOCUMENT_FILE_TYPES, Depreciation, DepreciationCalculationEnum, DepreciationCalculationPercentEnum, DepreciationCapitalProject, DepreciationCapitalProjectService, DepreciationCollection, DepreciationForecast, DepreciationForecastCollection, DepreciationGroup, DepreciationGroupEnum, DepreciationGroupItem, DepreciationLvpRateEnum, DepreciationReceipt, DepreciationService, DepreciationTypeEnum, DepreciationWriteOffAmountEnum, Document, DocumentApiUrlPrefixEnum, DocumentFolder, DocumentFolderService, ENDPOINTS, EmployeeCollection, EmployeeDetails, EmployeeInvite, EmployeeInviteService, EmployeeService, Endpoint, EquityPositionChartService, EventDispatcherService, ExportFormatEnum, FinancialYear, Firm, FirmService, FirmTypeEnum, HeaderTitleService, IconsFileEnum, IncomeAmountTypeEnum, IncomePosition, IncomeSource, IncomeSourceChartData, IncomeSourceCollection, IncomeSourceForecast, IncomeSourceForecastService, IncomeSourceService, IncomeSourceType, IncomeSourceTypeEnum, IncomeSourceTypeListOtherEnum, IncomeSourceTypeListSalaryEnum, IncomeSourceTypeListWorkEnum, InterceptorsModule, IntercomService, InviteStatusEnum, JwtService, Loan, LoanBankTypeEnum, LoanCollection, LoanFrequencyEnum, LoanInterestTypeEnum, LoanMaxNumberOfPaymentsEnum, LoanPayment, LoanPayout, LoanPayoutTypeEnum, LoanRepaymentFrequencyEnum, LoanRepaymentTypeEnum, LoanService, LoanTypeEnum, LoanVehicleTypeEnum, LogbookCollection, LogbookPeriod, LoginForm, MODULE_URL_LIST, MONTHS, Message, MessageCollection, MessageDocument, MessageDocumentCollection, MessageDocumentService, MessageService, MonthNameShortEnum, MonthNumberEnum, MyAccountHistory, MyAccountHistoryInitiatedByEnum, MyAccountHistoryStatusEnum, MyAccountHistoryTypeEnum, Notification, Occupation, OccupationService, PasswordForm, PdfService, Phone, PhoneTypeEnum, PreloaderService, Property, PropertyCalculationService, PropertyCategory, PropertyCategoryMovement, PropertyCategoryMovementService, PropertyCategoryService, PropertyCollection, PropertyDepreciationCalculationEnum, PropertyDocument, PropertyDocumentService, PropertyEquityChartData, PropertyEquityChartItem, PropertyForecast, PropertySale, PropertySaleService, PropertySaleTaxExemptionMetadata, PropertyService, PropertyShare, PropertyShareAccessEnum, PropertyShareService, PropertyShareStatusEnum, PropertySubscription, PropertyValuation, RegisterClientForm, RegisterFirmForm, RegistrationInvite, RegistrationInviteStatusEnum, ReportItem, ReportItemCollection, ReportItemDetails, ResetPasswordForm, SUBSCRIPTION_DESCRIPTION, SUBSCRIPTION_TITLE, SalaryForecast, SalaryForecastFrequencyEnum, SalaryForecastService, ServiceNotificationService, ServiceNotificationStatusEnum, ServiceNotificationTypeEnum, ServicePayment, ServicePaymentStatusEnum, ServicePrice, ServicePriceCollection, ServicePriceRecurringIntervalEnum, ServicePriceTypeEnum, ServiceProduct, ServiceSubscription, ServiceSubscriptionCollection, ServiceSubscriptionItem, ServiceSubscriptionStatusEnum, ShareFilterOptionsEnum, SoleForecast, SoleForecastService, SpareDocumentSpareTypeEnum, SseService, SubscriptionService, SubscriptionTypeEnum, TYPE_LOAN, TankTypeEnum, TaxCalculationMedicareExemptionEnum, TaxCalculationTypeEnum, TaxExemption, TaxExemptionEnum, TaxExemptionMetadata, TaxExemptionMetadataEnum, TaxExemptionService, TaxReturnCategoryListEnum, TaxReturnCategorySectionEnum, TaxReview, TaxReviewCollection, TaxReviewHistoryService, TaxReviewService, TaxReviewStatusEnum, TaxSummary, TaxSummaryListEnum, TaxSummarySection, TaxSummarySectionEnum, TaxSummaryService, TaxSummaryTaxSummaryEnum, TaxSummaryTypeEnum, TicketFeedbackEnum, TicketStatusEnum, TicketTypesEnum, Toast, ToastService, ToastTypeEnum, Transaction, TransactionAllocation, TransactionAllocationCollection, TransactionAllocationService, TransactionBase, TransactionCalculationService, TransactionCollection, TransactionMetadata, TransactionOperationEnum, TransactionReceipt, TransactionService, TransactionSourceEnum, TransactionTypeEnum, TtCoreModule, USER_ROLES, USER_WORK_POSITION, User, UserEventSetting, UserEventSettingCollection, UserEventSettingFieldEnum, UserEventSettingService, UserEventStatusEnum, UserEventType, UserEventTypeCategory, UserEventTypeClientTypeEnum, UserEventTypeEmployeeTypeEnum, UserEventTypeFrequencyEnum, UserEventTypeService, UserEventTypeUserTypeEnum, UserMedicareExemptionEnum, UserRolesEnum, UserService, UserStatusEnum, UserSwitcherService, UserTitleEnum, UserToRegister, UserWorkDepreciationCalculationEnum, UserWorkingHolidayMakerEnum, Vehicle, VehicleClaim, VehicleClaimMethodEnum, VehicleLogbook, VehicleLogbookPurposeEnum, VehicleService, WORK_TANK_LOGBOOK_PURPOSE_OPTIONS, XlsxService, cloneDeep, compare, compareMatOptions, createDate, displayMatOptions, enumToList, getDocIcon, replace, roundTo, sort, sortDeep, taxReviewFilterPredicate };
|
|
10837
10812
|
//# sourceMappingURL=taxtank-core.js.map
|