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
|
@@ -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
|
}
|
|
@@ -5881,14 +5906,14 @@
|
|
|
5881
5906
|
});
|
|
5882
5907
|
Object.defineProperty(Transaction.prototype, "debit", {
|
|
5883
5908
|
get: function () {
|
|
5884
|
-
return this.isDebit() ? Math.abs(this.amount) :
|
|
5909
|
+
return this.isDebit() ? Math.abs(this.amount) : 0;
|
|
5885
5910
|
},
|
|
5886
5911
|
enumerable: false,
|
|
5887
5912
|
configurable: true
|
|
5888
5913
|
});
|
|
5889
5914
|
Object.defineProperty(Transaction.prototype, "credit", {
|
|
5890
5915
|
get: function () {
|
|
5891
|
-
return this.isCredit() ? Math.abs(this.amount) :
|
|
5916
|
+
return this.isCredit() ? Math.abs(this.amount) : 0;
|
|
5892
5917
|
},
|
|
5893
5918
|
enumerable: false,
|
|
5894
5919
|
configurable: true
|
|
@@ -6666,64 +6691,6 @@
|
|
|
6666
6691
|
AlphabetColorsEnum["Z"] = "#E3C9CE";
|
|
6667
6692
|
})(exports.AlphabetColorsEnum || (exports.AlphabetColorsEnum = {}));
|
|
6668
6693
|
|
|
6669
|
-
/**
|
|
6670
|
-
* Class to generate data-table structure based on provided collection.
|
|
6671
|
-
* Use to work with HTML/PDF/XLSX tables
|
|
6672
|
-
*/
|
|
6673
|
-
var DataTable = /** @class */ (function () {
|
|
6674
|
-
function DataTable(collection, columns, caption, footerCaption) {
|
|
6675
|
-
this.caption = caption;
|
|
6676
|
-
this.columns = columns;
|
|
6677
|
-
this.setRows(collection);
|
|
6678
|
-
if (footerCaption) {
|
|
6679
|
-
this.setFooterRow(collection, footerCaption);
|
|
6680
|
-
}
|
|
6681
|
-
}
|
|
6682
|
-
DataTable.prototype.setRows = function (collection) {
|
|
6683
|
-
var _this = this;
|
|
6684
|
-
this.rows = collection.items.map(function (item) {
|
|
6685
|
-
// parse table columns to return items based on column properties
|
|
6686
|
-
return _this.columns.map(function (column) {
|
|
6687
|
-
// if the pipe is provided - transform the return value
|
|
6688
|
-
if (column.pipe) {
|
|
6689
|
-
return column.pipe.transform(item[column.key]);
|
|
6690
|
-
}
|
|
6691
|
-
return (item[column.key] ? item[column.key] : '-').toString();
|
|
6692
|
-
});
|
|
6693
|
-
});
|
|
6694
|
-
};
|
|
6695
|
-
DataTable.prototype.setFooterRow = function (collection, footerCaption) {
|
|
6696
|
-
this.footerRow = this.columns.map(function (column, index) {
|
|
6697
|
-
if (index === 0) {
|
|
6698
|
-
return footerCaption.toString();
|
|
6699
|
-
}
|
|
6700
|
-
if (!column.total) {
|
|
6701
|
-
return '';
|
|
6702
|
-
}
|
|
6703
|
-
var totalValue = collection.items.reduce(function (sum, item) {
|
|
6704
|
-
// check if current collection item has value. If not - don't add it to the sum
|
|
6705
|
-
return item[column.key] !== null ? sum + Number(item[column.key]) : sum;
|
|
6706
|
-
}, null);
|
|
6707
|
-
return (totalValue !== null && totalValue !== void 0 ? totalValue : '-').toString();
|
|
6708
|
-
});
|
|
6709
|
-
};
|
|
6710
|
-
return DataTable;
|
|
6711
|
-
}());
|
|
6712
|
-
|
|
6713
|
-
var DataTableColumn = /** @class */ (function () {
|
|
6714
|
-
function DataTableColumn(name, key, total, pipe) {
|
|
6715
|
-
/**
|
|
6716
|
-
* Flag that shows should the column be in the total calculation or not
|
|
6717
|
-
*/
|
|
6718
|
-
this.total = false;
|
|
6719
|
-
this.name = name;
|
|
6720
|
-
this.key = key;
|
|
6721
|
-
this.total = total;
|
|
6722
|
-
this.pipe = pipe;
|
|
6723
|
-
}
|
|
6724
|
-
return DataTableColumn;
|
|
6725
|
-
}());
|
|
6726
|
-
|
|
6727
6694
|
exports.DepreciationLvpRateEnum = void 0;
|
|
6728
6695
|
(function (DepreciationLvpRateEnum) {
|
|
6729
6696
|
DepreciationLvpRateEnum[DepreciationLvpRateEnum["FIRST_YEAR"] = 0.1875] = "FIRST_YEAR";
|
|
@@ -6968,6 +6935,12 @@
|
|
|
6968
6935
|
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 37] = "VEHICLE_CLAIM_CREATED";
|
|
6969
6936
|
})(exports.AppEventTypeEnum || (exports.AppEventTypeEnum = {}));
|
|
6970
6937
|
|
|
6938
|
+
exports.ExportFormatEnum = void 0;
|
|
6939
|
+
(function (ExportFormatEnum) {
|
|
6940
|
+
ExportFormatEnum["PDF"] = "PDF";
|
|
6941
|
+
ExportFormatEnum["XLSX"] = "XLSX";
|
|
6942
|
+
})(exports.ExportFormatEnum || (exports.ExportFormatEnum = {}));
|
|
6943
|
+
|
|
6971
6944
|
exports.IconsFileEnum = void 0;
|
|
6972
6945
|
(function (IconsFileEnum) {
|
|
6973
6946
|
IconsFileEnum["JPG"] = "icon-image-jpg";
|
|
@@ -10757,24 +10730,13 @@
|
|
|
10757
10730
|
var PdfService = /** @class */ (function () {
|
|
10758
10731
|
function PdfService() {
|
|
10759
10732
|
}
|
|
10760
|
-
// @Todo remove 'any' type
|
|
10761
|
-
/**
|
|
10762
|
-
* Download generated PDF file
|
|
10763
|
-
*/
|
|
10764
|
-
PdfService.prototype.download = function (tables, title, fileName) {
|
|
10765
|
-
var document = this.generatePdfFile(tables, title);
|
|
10766
|
-
document.save(fileName + ".pdf");
|
|
10767
|
-
};
|
|
10768
10733
|
/**
|
|
10769
|
-
*
|
|
10734
|
+
* Export file form provided HTML tables
|
|
10770
10735
|
*/
|
|
10771
10736
|
PdfService.prototype.exportTables = function (tables, title, fileName) {
|
|
10772
10737
|
var document = this.generateFromTables(tables, title);
|
|
10773
10738
|
document.save(fileName + ".pdf");
|
|
10774
10739
|
};
|
|
10775
|
-
/**
|
|
10776
|
-
* @Todo rename when all DataTable dependent methods will be cleared-up
|
|
10777
|
-
*/
|
|
10778
10740
|
PdfService.prototype.generateFromTables = function (tables, title) {
|
|
10779
10741
|
var pdf = new jsPDF__default["default"]();
|
|
10780
10742
|
this.setDocumentTitle(pdf, title);
|
|
@@ -10823,35 +10785,6 @@
|
|
|
10823
10785
|
logo.src = PDF_CONFIG.logo.src;
|
|
10824
10786
|
doc.addImage(logo, 'PNG', PDF_CONFIG.logo.positionX, PDF_CONFIG.logo.positionY, PDF_CONFIG.logo.width, PDF_CONFIG.logo.height);
|
|
10825
10787
|
};
|
|
10826
|
-
/**
|
|
10827
|
-
* @Todo remove/refactor when all DataTable dependent methods will be cleared-up
|
|
10828
|
-
* Generate PDF file from provided data
|
|
10829
|
-
*/
|
|
10830
|
-
PdfService.prototype.generatePdfFile = function (tables, title) {
|
|
10831
|
-
var pdf = new jsPDF__default["default"]();
|
|
10832
|
-
// set document font params
|
|
10833
|
-
pdf.setFontSize(PDF_CONFIG.text.fontSize)
|
|
10834
|
-
.setFont(PDF_CONFIG.text.fontName, PDF_CONFIG.text.fontStyle, PDF_CONFIG.text.fontWeight)
|
|
10835
|
-
.text(title, PDF_CONFIG.text.positionX, PDF_CONFIG.text.positionY);
|
|
10836
|
-
tables.forEach(function (table) {
|
|
10837
|
-
// coords of last table
|
|
10838
|
-
var lastTableCoords = pdf['lastAutoTable'].finalY || PDF_CONFIG.contentCoords.marginTop;
|
|
10839
|
-
pdf.text(table.caption, PDF_CONFIG.contentCoords.marginLeft, lastTableCoords + PDF_CONFIG.contentCoords.marginTop);
|
|
10840
|
-
// table options
|
|
10841
|
-
var options = {
|
|
10842
|
-
startY: lastTableCoords + PDF_CONFIG.contentTitleCoords.marginTop,
|
|
10843
|
-
head: [table['columns'].map(function (column) { return column.name; })],
|
|
10844
|
-
body: table['rows'],
|
|
10845
|
-
foot: [table['footerRow']],
|
|
10846
|
-
footStyles: {
|
|
10847
|
-
fillColor: PDF_CONFIG.text.fillColor,
|
|
10848
|
-
textColor: PDF_CONFIG.text.textColor
|
|
10849
|
-
}
|
|
10850
|
-
};
|
|
10851
|
-
autoTable__default["default"](pdf, options);
|
|
10852
|
-
});
|
|
10853
|
-
return pdf;
|
|
10854
|
-
};
|
|
10855
10788
|
return PdfService;
|
|
10856
10789
|
}());
|
|
10857
10790
|
PdfService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
@@ -11800,6 +11733,34 @@
|
|
|
11800
11733
|
ToastService.prototype.add = function (toast) {
|
|
11801
11734
|
this.toast$.next(toast);
|
|
11802
11735
|
};
|
|
11736
|
+
ToastService.prototype.success = function (message) {
|
|
11737
|
+
this.add(classTransformer.plainToClass(Toast, {
|
|
11738
|
+
type: exports.ToastTypeEnum.SUCCESS,
|
|
11739
|
+
title: 'Success!',
|
|
11740
|
+
message: message,
|
|
11741
|
+
}));
|
|
11742
|
+
};
|
|
11743
|
+
ToastService.prototype.warning = function (message) {
|
|
11744
|
+
this.add(classTransformer.plainToClass(Toast, {
|
|
11745
|
+
type: exports.ToastTypeEnum.WARNING,
|
|
11746
|
+
title: 'Warning!',
|
|
11747
|
+
message: message,
|
|
11748
|
+
}));
|
|
11749
|
+
};
|
|
11750
|
+
ToastService.prototype.error = function (message) {
|
|
11751
|
+
this.add(classTransformer.plainToClass(Toast, {
|
|
11752
|
+
type: exports.ToastTypeEnum.ERROR,
|
|
11753
|
+
title: 'Error!',
|
|
11754
|
+
message: message,
|
|
11755
|
+
}));
|
|
11756
|
+
};
|
|
11757
|
+
ToastService.prototype.info = function (message) {
|
|
11758
|
+
this.add(classTransformer.plainToClass(Toast, {
|
|
11759
|
+
type: exports.ToastTypeEnum.INFO,
|
|
11760
|
+
title: 'Information',
|
|
11761
|
+
message: message,
|
|
11762
|
+
}));
|
|
11763
|
+
};
|
|
11803
11764
|
return ToastService;
|
|
11804
11765
|
}());
|
|
11805
11766
|
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 +11785,24 @@
|
|
|
11824
11785
|
return list;
|
|
11825
11786
|
}
|
|
11826
11787
|
|
|
11788
|
+
var MessagesEnum;
|
|
11789
|
+
(function (MessagesEnum) {
|
|
11790
|
+
MessagesEnum["DELETED_MESSAGE"] = "Transaction deleted";
|
|
11791
|
+
MessagesEnum["UPDATED_MESSAGE"] = "Transaction updated";
|
|
11792
|
+
MessagesEnum["CREATED_MESSAGE"] = "Transaction(s) created";
|
|
11793
|
+
})(MessagesEnum || (MessagesEnum = {}));
|
|
11794
|
+
|
|
11827
11795
|
/**
|
|
11828
11796
|
* Service for transactions business logic
|
|
11829
11797
|
*/
|
|
11830
11798
|
var TransactionService = /** @class */ (function (_super) {
|
|
11831
11799
|
__extends(TransactionService, _super);
|
|
11832
|
-
function TransactionService(http, eventDispatcherService, environment) {
|
|
11800
|
+
function TransactionService(http, eventDispatcherService, environment, toastService) {
|
|
11833
11801
|
var _this = _super.call(this, http, eventDispatcherService, environment) || this;
|
|
11834
11802
|
_this.http = http;
|
|
11835
11803
|
_this.eventDispatcherService = eventDispatcherService;
|
|
11836
11804
|
_this.environment = environment;
|
|
11805
|
+
_this.toastService = toastService;
|
|
11837
11806
|
// url part for Transaction API
|
|
11838
11807
|
_this.url = 'transactions';
|
|
11839
11808
|
_this.modelClass = Transaction;
|
|
@@ -11846,6 +11815,7 @@
|
|
|
11846
11815
|
*/
|
|
11847
11816
|
TransactionService.prototype.listenEvents = function () {
|
|
11848
11817
|
this.listenDepreciationChange();
|
|
11818
|
+
this.listenPropertyShareUpdate();
|
|
11849
11819
|
};
|
|
11850
11820
|
/**
|
|
11851
11821
|
* get list of all user's TaxTank transactions
|
|
@@ -11954,6 +11924,7 @@
|
|
|
11954
11924
|
_this.updateCache();
|
|
11955
11925
|
}
|
|
11956
11926
|
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.TRANSACTIONS_CREATED, addedTransactions));
|
|
11927
|
+
_this.toastService.success(MessagesEnum.CREATED_MESSAGE);
|
|
11957
11928
|
return addedTransactions;
|
|
11958
11929
|
}));
|
|
11959
11930
|
};
|
|
@@ -11990,6 +11961,7 @@
|
|
|
11990
11961
|
_this.addBatch(childTransactionsToAdd).subscribe();
|
|
11991
11962
|
}
|
|
11992
11963
|
}
|
|
11964
|
+
_this.toastService.success(MessagesEnum.UPDATED_MESSAGE);
|
|
11993
11965
|
replace(_this.cache, updatedTransaction);
|
|
11994
11966
|
_this.updateCache();
|
|
11995
11967
|
return updatedTransaction;
|
|
@@ -12038,6 +12010,7 @@
|
|
|
12038
12010
|
return transaction.id !== model.id && ((_a = transaction.parentTransaction) === null || _a === void 0 ? void 0 : _a.id) !== model.id;
|
|
12039
12011
|
});
|
|
12040
12012
|
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.TRANSACTION_DELETED, model));
|
|
12013
|
+
_this.toastService.success(MessagesEnum.DELETED_MESSAGE);
|
|
12041
12014
|
_this.updateCache();
|
|
12042
12015
|
_this.transactionDeleted.emit(model);
|
|
12043
12016
|
}));
|
|
@@ -12122,9 +12095,16 @@
|
|
|
12122
12095
|
});
|
|
12123
12096
|
});
|
|
12124
12097
|
};
|
|
12098
|
+
/**
|
|
12099
|
+
* Listen to EventDispatcherService event related to Property Share changing
|
|
12100
|
+
*/
|
|
12101
|
+
TransactionService.prototype.listenPropertyShareUpdate = function () {
|
|
12102
|
+
var _this = this;
|
|
12103
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_SHARE_UPDATED).subscribe(function () { return _this.resetCache(); });
|
|
12104
|
+
};
|
|
12125
12105
|
return TransactionService;
|
|
12126
12106
|
}(RestService));
|
|
12127
|
-
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 });
|
|
12107
|
+
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 });
|
|
12128
12108
|
TransactionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TransactionService, providedIn: 'root' });
|
|
12129
12109
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TransactionService, decorators: [{
|
|
12130
12110
|
type: i0.Injectable,
|
|
@@ -12135,7 +12115,7 @@
|
|
|
12135
12115
|
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
12136
12116
|
type: i0.Inject,
|
|
12137
12117
|
args: ['environment']
|
|
12138
|
-
}] }];
|
|
12118
|
+
}] }, { type: ToastService }];
|
|
12139
12119
|
} });
|
|
12140
12120
|
|
|
12141
12121
|
// @TODO Don't look at the commented code. Will be refactored/removed during TT-1503
|
|
@@ -12757,18 +12737,17 @@
|
|
|
12757
12737
|
var XlsxService = /** @class */ (function () {
|
|
12758
12738
|
function XlsxService() {
|
|
12759
12739
|
}
|
|
12760
|
-
|
|
12761
|
-
|
|
12762
|
-
* Download generated Excel file
|
|
12740
|
+
/**
|
|
12741
|
+
* Export file form provided HTML tables
|
|
12763
12742
|
*/
|
|
12764
|
-
XlsxService.prototype.
|
|
12765
|
-
var excelFile = this.
|
|
12743
|
+
XlsxService.prototype.exportTables = function (tables, title, fileName) {
|
|
12744
|
+
var excelFile = this.generateFromTables(tables, title);
|
|
12766
12745
|
var data = new Blob([excelFile], {
|
|
12767
12746
|
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8'
|
|
12768
12747
|
});
|
|
12769
12748
|
FileSaver__namespace.saveAs(data, fileName + ".xlsx");
|
|
12770
12749
|
};
|
|
12771
|
-
XlsxService.prototype.
|
|
12750
|
+
XlsxService.prototype.generateFromTables = function (tables, title) {
|
|
12772
12751
|
// create new workbook
|
|
12773
12752
|
var workbook = xlsx__namespace.utils.book_new();
|
|
12774
12753
|
// create empty worksheet
|
|
@@ -12776,19 +12755,13 @@
|
|
|
12776
12755
|
SheetNames: [],
|
|
12777
12756
|
Sheets: {}
|
|
12778
12757
|
};
|
|
12779
|
-
|
|
12780
|
-
// add caption
|
|
12781
|
-
|
|
12782
|
-
|
|
12783
|
-
|
|
12784
|
-
|
|
12785
|
-
|
|
12786
|
-
]);
|
|
12787
|
-
});
|
|
12788
|
-
sheetData.forEach(function (data) {
|
|
12789
|
-
xlsx__namespace.utils.sheet_add_json(worksheet, data, { origin: -1, skipHeader: true });
|
|
12790
|
-
// set empty row after each table
|
|
12791
|
-
xlsx__namespace.utils.sheet_add_json(worksheet, [], { origin: -1 });
|
|
12758
|
+
tables.forEach(function (data) {
|
|
12759
|
+
// add caption for the current table
|
|
12760
|
+
xlsx__namespace.utils.sheet_add_aoa(worksheet, [[data.caption.innerText]], { origin: -1 });
|
|
12761
|
+
// add table table data to the worksheet
|
|
12762
|
+
xlsx__namespace.utils.sheet_add_dom(worksheet, data, { origin: -1, raw: true });
|
|
12763
|
+
// set empty row after current table
|
|
12764
|
+
xlsx__namespace.utils.sheet_add_aoa(worksheet, [], { origin: -1 });
|
|
12792
12765
|
});
|
|
12793
12766
|
xlsx__namespace.utils.book_append_sheet(workbook, worksheet);
|
|
12794
12767
|
return xlsx__namespace.write(workbook, { bookType: 'xlsx', type: 'array' });
|
|
@@ -13062,8 +13035,6 @@
|
|
|
13062
13035
|
exports.DEFAULT_VEHICLE_EXPENSE = DEFAULT_VEHICLE_EXPENSE;
|
|
13063
13036
|
exports.DEPRECIATION_GROUPS = DEPRECIATION_GROUPS;
|
|
13064
13037
|
exports.DOCUMENT_FILE_TYPES = DOCUMENT_FILE_TYPES;
|
|
13065
|
-
exports.DataTable = DataTable;
|
|
13066
|
-
exports.DataTableColumn = DataTableColumn;
|
|
13067
13038
|
exports.Depreciation = Depreciation;
|
|
13068
13039
|
exports.DepreciationCapitalProject = DepreciationCapitalProject;
|
|
13069
13040
|
exports.DepreciationCapitalProjectService = DepreciationCapitalProjectService;
|