taxtank-core 0.24.0 → 0.24.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 +190 -83
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/client-invite.collection.js +10 -0
- package/esm2015/lib/models/endpoint/endpoints.const.js +3 -1
- package/esm2015/lib/models/event/app-event-type.enum.js +13 -8
- package/esm2015/lib/services/http/transaction/transaction-receipt/transaction-receipt.service.js +70 -0
- package/esm2015/lib/services/http/transaction/transaction.service.js +44 -28
- package/esm2015/public-api.js +3 -1
- package/fesm2015/taxtank-core.js +171 -80
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/client-invite.collection.d.ts +8 -0
- package/lib/models/event/app-event-type.enum.d.ts +12 -7
- package/lib/services/http/transaction/transaction-receipt/transaction-receipt.service.d.ts +28 -0
- package/lib/services/http/transaction/transaction.service.d.ts +12 -5
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
|
@@ -586,13 +586,18 @@
|
|
|
586
586
|
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_CREATED"] = 37] = "TRANSACTION_CREATED";
|
|
587
587
|
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_DELETED"] = 38] = "TRANSACTION_DELETED";
|
|
588
588
|
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED"] = 39] = "TRANSACTION_UPDATED";
|
|
589
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
590
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
591
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
592
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
593
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
594
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
595
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
589
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_CREATED_WITH_NEW_RECEIPT"] = 40] = "TRANSACTION_CREATED_WITH_NEW_RECEIPT";
|
|
590
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_NEW_RECEIPT"] = 41] = "TRANSACTION_UPDATED_WITH_NEW_RECEIPT";
|
|
591
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_DELETED_RECEIPT"] = 42] = "TRANSACTION_UPDATED_WITH_DELETED_RECEIPT";
|
|
592
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_CREATED"] = 43] = "TRANSACTION_RECEIPT_CREATED";
|
|
593
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_DELETED"] = 44] = "TRANSACTION_RECEIPT_DELETED";
|
|
594
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTIONS_CREATED"] = 45] = "TRANSACTIONS_CREATED";
|
|
595
|
+
AppEventTypeEnum[AppEventTypeEnum["USER_UPDATED"] = 46] = "USER_UPDATED";
|
|
596
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_UPDATED"] = 47] = "VEHICLE_CLAIM_UPDATED";
|
|
597
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 48] = "VEHICLE_CLAIM_CREATED";
|
|
598
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_CREATED"] = 49] = "VEHICLE_LOGBOOK_CREATED";
|
|
599
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_UPDATED"] = 50] = "VEHICLE_LOGBOOK_UPDATED";
|
|
600
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 51] = "VEHICLE_LOGBOOK_DELETED";
|
|
596
601
|
})(exports.AppEventTypeEnum || (exports.AppEventTypeEnum = {}));
|
|
597
602
|
|
|
598
603
|
var EventDispatcherService = /** @class */ (function () {
|
|
@@ -1056,6 +1061,8 @@
|
|
|
1056
1061
|
TRANSACTIONS_ALLOCATIONS_GET: new Endpoint('GET', '\\/transactions-allocations'),
|
|
1057
1062
|
TRANSACTIONS_ALLOCATIONS_POST: new Endpoint('POST', '\\/transactions-allocations'),
|
|
1058
1063
|
TRANSACTIONS_ALLOCATIONS_DELETE: new Endpoint('DELETE', '\\/transactions-allocations\\/\\d+'),
|
|
1064
|
+
TRANSACTION_RECEIPTS_POST: new Endpoint('POST', '\\/transactions\\/\\d+\\/receipts'),
|
|
1065
|
+
TRANSACTION_RECEIPTS_DELETE: new Endpoint('DELETE', '\\/transactions\\/\\d+\\/receipts\\/\\d+'),
|
|
1059
1066
|
USER_CONFIRMATION_POST: new Endpoint('POST', '\\/users\\/confirmation'),
|
|
1060
1067
|
USER_CONFIRMATION_RESEND_POST: new Endpoint('POST', '\\/users\\/confirmation\\/resend'),
|
|
1061
1068
|
USER_CURRENT_GET: new Endpoint('GET', '\\/users\\/current'),
|
|
@@ -7588,6 +7595,70 @@
|
|
|
7588
7595
|
return VehicleCollection;
|
|
7589
7596
|
}(Collection));
|
|
7590
7597
|
|
|
7598
|
+
/**
|
|
7599
|
+
* Collection of tax review
|
|
7600
|
+
*/
|
|
7601
|
+
var ClientInviteCollection = /** @class */ (function (_super) {
|
|
7602
|
+
__extends(ClientInviteCollection, _super);
|
|
7603
|
+
function ClientInviteCollection() {
|
|
7604
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
7605
|
+
}
|
|
7606
|
+
ClientInviteCollection.prototype.getPending = function () {
|
|
7607
|
+
return this.filter(function (invite) { return invite.isPending(); });
|
|
7608
|
+
};
|
|
7609
|
+
return ClientInviteCollection;
|
|
7610
|
+
}(Collection));
|
|
7611
|
+
|
|
7612
|
+
/**
|
|
7613
|
+
* @TODO Alex/Vik: think and create some new collection type
|
|
7614
|
+
* @TODO Alex: research all constants and make the same structure
|
|
7615
|
+
*/
|
|
7616
|
+
var ChartAccountsCategoryECollection = /** @class */ (function () {
|
|
7617
|
+
function ChartAccountsCategoryECollection(items) {
|
|
7618
|
+
this.items = items || [
|
|
7619
|
+
exports.ChartAccountsCategoryEnum.PROPERTY_INCOME,
|
|
7620
|
+
exports.ChartAccountsCategoryEnum.PROPERTY_EXPENSE,
|
|
7621
|
+
exports.ChartAccountsCategoryEnum.PROPERTY_DEPRECIATION,
|
|
7622
|
+
exports.ChartAccountsCategoryEnum.PROPERTY_CAPITAL_WORKS,
|
|
7623
|
+
exports.ChartAccountsCategoryEnum.WORK_DEPRECIATION,
|
|
7624
|
+
exports.ChartAccountsCategoryEnum.WORK_INCOME,
|
|
7625
|
+
exports.ChartAccountsCategoryEnum.WORK_EXPENSE,
|
|
7626
|
+
exports.ChartAccountsCategoryEnum.OTHER_INCOME,
|
|
7627
|
+
exports.ChartAccountsCategoryEnum.OTHER_EXPENSE,
|
|
7628
|
+
exports.ChartAccountsCategoryEnum.PERSONAL_INCOME,
|
|
7629
|
+
exports.ChartAccountsCategoryEnum.PERSONAL_EXPENSE,
|
|
7630
|
+
exports.ChartAccountsCategoryEnum.SOLE_INCOME,
|
|
7631
|
+
exports.ChartAccountsCategoryEnum.SOLE_EXPENSE,
|
|
7632
|
+
exports.ChartAccountsCategoryEnum.SOLE_DEPRECIATION
|
|
7633
|
+
];
|
|
7634
|
+
}
|
|
7635
|
+
ChartAccountsCategoryECollection.prototype.getByType = function (types) {
|
|
7636
|
+
var _this = this;
|
|
7637
|
+
if (!Array.isArray(types)) {
|
|
7638
|
+
types = [types];
|
|
7639
|
+
}
|
|
7640
|
+
var items = [];
|
|
7641
|
+
types.forEach(function (type) {
|
|
7642
|
+
var filtered = _this.items.filter(function (item) { return exports.ChartAccountsCategoryEnum[item].includes(type.toUpperCase()); });
|
|
7643
|
+
items.push.apply(items, __spreadArray([], __read(filtered)));
|
|
7644
|
+
});
|
|
7645
|
+
return new ChartAccountsCategoryECollection(items);
|
|
7646
|
+
};
|
|
7647
|
+
ChartAccountsCategoryECollection.prototype.getByTankType = function (tankTypes) {
|
|
7648
|
+
var _this = this;
|
|
7649
|
+
if (!Array.isArray(tankTypes)) {
|
|
7650
|
+
tankTypes = [tankTypes];
|
|
7651
|
+
}
|
|
7652
|
+
var items = [];
|
|
7653
|
+
tankTypes.forEach(function (tankType) {
|
|
7654
|
+
var filtered = _this.items.filter(function (item) { return exports.ChartAccountsCategoryEnum[item].includes(tankType.toUpperCase()); });
|
|
7655
|
+
items.push.apply(items, __spreadArray([], __read(filtered)));
|
|
7656
|
+
});
|
|
7657
|
+
return new ChartAccountsCategoryECollection(items);
|
|
7658
|
+
};
|
|
7659
|
+
return ChartAccountsCategoryECollection;
|
|
7660
|
+
}());
|
|
7661
|
+
|
|
7591
7662
|
exports.ChartAccountsEtpEnum = void 0;
|
|
7592
7663
|
(function (ChartAccountsEtpEnum) {
|
|
7593
7664
|
ChartAccountsEtpEnum[ChartAccountsEtpEnum["ETP_R"] = 549] = "ETP_R";
|
|
@@ -8345,56 +8416,6 @@
|
|
|
8345
8416
|
classTransformer.Type(function () { return ChartSerie; })
|
|
8346
8417
|
], ChartData.prototype, "data", void 0);
|
|
8347
8418
|
|
|
8348
|
-
/**
|
|
8349
|
-
* @TODO Alex/Vik: think and create some new collection type
|
|
8350
|
-
* @TODO Alex: research all constants and make the same structure
|
|
8351
|
-
*/
|
|
8352
|
-
var ChartAccountsCategoryECollection = /** @class */ (function () {
|
|
8353
|
-
function ChartAccountsCategoryECollection(items) {
|
|
8354
|
-
this.items = items || [
|
|
8355
|
-
exports.ChartAccountsCategoryEnum.PROPERTY_INCOME,
|
|
8356
|
-
exports.ChartAccountsCategoryEnum.PROPERTY_EXPENSE,
|
|
8357
|
-
exports.ChartAccountsCategoryEnum.PROPERTY_DEPRECIATION,
|
|
8358
|
-
exports.ChartAccountsCategoryEnum.PROPERTY_CAPITAL_WORKS,
|
|
8359
|
-
exports.ChartAccountsCategoryEnum.WORK_DEPRECIATION,
|
|
8360
|
-
exports.ChartAccountsCategoryEnum.WORK_INCOME,
|
|
8361
|
-
exports.ChartAccountsCategoryEnum.WORK_EXPENSE,
|
|
8362
|
-
exports.ChartAccountsCategoryEnum.OTHER_INCOME,
|
|
8363
|
-
exports.ChartAccountsCategoryEnum.OTHER_EXPENSE,
|
|
8364
|
-
exports.ChartAccountsCategoryEnum.PERSONAL_INCOME,
|
|
8365
|
-
exports.ChartAccountsCategoryEnum.PERSONAL_EXPENSE,
|
|
8366
|
-
exports.ChartAccountsCategoryEnum.SOLE_INCOME,
|
|
8367
|
-
exports.ChartAccountsCategoryEnum.SOLE_EXPENSE,
|
|
8368
|
-
exports.ChartAccountsCategoryEnum.SOLE_DEPRECIATION
|
|
8369
|
-
];
|
|
8370
|
-
}
|
|
8371
|
-
ChartAccountsCategoryECollection.prototype.getByType = function (types) {
|
|
8372
|
-
var _this = this;
|
|
8373
|
-
if (!Array.isArray(types)) {
|
|
8374
|
-
types = [types];
|
|
8375
|
-
}
|
|
8376
|
-
var items = [];
|
|
8377
|
-
types.forEach(function (type) {
|
|
8378
|
-
var filtered = _this.items.filter(function (item) { return exports.ChartAccountsCategoryEnum[item].includes(type.toUpperCase()); });
|
|
8379
|
-
items.push.apply(items, __spreadArray([], __read(filtered)));
|
|
8380
|
-
});
|
|
8381
|
-
return new ChartAccountsCategoryECollection(items);
|
|
8382
|
-
};
|
|
8383
|
-
ChartAccountsCategoryECollection.prototype.getByTankType = function (tankTypes) {
|
|
8384
|
-
var _this = this;
|
|
8385
|
-
if (!Array.isArray(tankTypes)) {
|
|
8386
|
-
tankTypes = [tankTypes];
|
|
8387
|
-
}
|
|
8388
|
-
var items = [];
|
|
8389
|
-
tankTypes.forEach(function (tankType) {
|
|
8390
|
-
var filtered = _this.items.filter(function (item) { return exports.ChartAccountsCategoryEnum[item].includes(tankType.toUpperCase()); });
|
|
8391
|
-
items.push.apply(items, __spreadArray([], __read(filtered)));
|
|
8392
|
-
});
|
|
8393
|
-
return new ChartAccountsCategoryECollection(items);
|
|
8394
|
-
};
|
|
8395
|
-
return ChartAccountsCategoryECollection;
|
|
8396
|
-
}());
|
|
8397
|
-
|
|
8398
8419
|
var ChartAccountsDepreciation$1 = /** @class */ (function (_super) {
|
|
8399
8420
|
__extends(ChartAccountsDepreciation, _super);
|
|
8400
8421
|
function ChartAccountsDepreciation() {
|
|
@@ -11428,13 +11449,87 @@
|
|
|
11428
11449
|
return list;
|
|
11429
11450
|
}
|
|
11430
11451
|
|
|
11452
|
+
var TransactionReceiptService = /** @class */ (function () {
|
|
11453
|
+
function TransactionReceiptService(http, eventDispatcherService, environment) {
|
|
11454
|
+
this.http = http;
|
|
11455
|
+
this.eventDispatcherService = eventDispatcherService;
|
|
11456
|
+
this.environment = environment;
|
|
11457
|
+
this.url = 'receipts';
|
|
11458
|
+
this.listenEvents();
|
|
11459
|
+
}
|
|
11460
|
+
/**
|
|
11461
|
+
* Transaction instance is necessary to take the ID and the receipt file from it.
|
|
11462
|
+
*/
|
|
11463
|
+
TransactionReceiptService.prototype.add = function (transaction) {
|
|
11464
|
+
var _this = this;
|
|
11465
|
+
var formData = new FormData();
|
|
11466
|
+
formData.append('file', transaction.file);
|
|
11467
|
+
this.http.post(this.environment.apiV2 + "/transactions/" + transaction.id + "/" + this.url, formData)
|
|
11468
|
+
.subscribe(function (receiptResponse) {
|
|
11469
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.TRANSACTION_RECEIPT_CREATED, classTransformer.plainToClass(TransactionReceipt, receiptResponse)));
|
|
11470
|
+
});
|
|
11471
|
+
};
|
|
11472
|
+
/**
|
|
11473
|
+
* Transaction instance is necessary to take the ID and the receipt ID from it.
|
|
11474
|
+
*/
|
|
11475
|
+
TransactionReceiptService.prototype.delete = function (transaction) {
|
|
11476
|
+
var _this = this;
|
|
11477
|
+
this.http.delete(this.environment.apiV2 + "/transactions/" + transaction.id + "/" + this.url + "/" + transaction.receipt.id)
|
|
11478
|
+
.subscribe(function () {
|
|
11479
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.TRANSACTION_RECEIPT_DELETED, transaction));
|
|
11480
|
+
});
|
|
11481
|
+
};
|
|
11482
|
+
TransactionReceiptService.prototype.listenEvents = function () {
|
|
11483
|
+
this.listenTransactionWithReceiptUpdated();
|
|
11484
|
+
this.listenTransactionWithoutReceiptUpdated();
|
|
11485
|
+
};
|
|
11486
|
+
TransactionReceiptService.prototype.listenTransactionWithReceiptUpdated = function () {
|
|
11487
|
+
var _this = this;
|
|
11488
|
+
this.eventDispatcherService.on([
|
|
11489
|
+
exports.AppEventTypeEnum.TRANSACTION_CREATED_WITH_NEW_RECEIPT,
|
|
11490
|
+
exports.AppEventTypeEnum.TRANSACTION_UPDATED_WITH_NEW_RECEIPT
|
|
11491
|
+
]).subscribe(function (transaction) {
|
|
11492
|
+
_this.add(transaction);
|
|
11493
|
+
});
|
|
11494
|
+
};
|
|
11495
|
+
/**
|
|
11496
|
+
* Case when transaction was updated, but receipt was removed
|
|
11497
|
+
*/
|
|
11498
|
+
TransactionReceiptService.prototype.listenTransactionWithoutReceiptUpdated = function () {
|
|
11499
|
+
var _this = this;
|
|
11500
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.TRANSACTION_UPDATED_WITH_DELETED_RECEIPT)
|
|
11501
|
+
.subscribe(function (transaction) {
|
|
11502
|
+
_this.delete(transaction);
|
|
11503
|
+
});
|
|
11504
|
+
};
|
|
11505
|
+
return TransactionReceiptService;
|
|
11506
|
+
}());
|
|
11507
|
+
TransactionReceiptService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TransactionReceiptService, deps: [{ token: i1__namespace.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
11508
|
+
TransactionReceiptService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TransactionReceiptService, providedIn: 'root' });
|
|
11509
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TransactionReceiptService, decorators: [{
|
|
11510
|
+
type: i0.Injectable,
|
|
11511
|
+
args: [{
|
|
11512
|
+
providedIn: 'root'
|
|
11513
|
+
}]
|
|
11514
|
+
}], ctorParameters: function () {
|
|
11515
|
+
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
11516
|
+
type: i0.Inject,
|
|
11517
|
+
args: ['environment']
|
|
11518
|
+
}] }];
|
|
11519
|
+
} });
|
|
11520
|
+
|
|
11431
11521
|
/**
|
|
11432
11522
|
* Service for transactions business logic
|
|
11433
11523
|
*/
|
|
11434
11524
|
var TransactionService = /** @class */ (function (_super) {
|
|
11435
11525
|
__extends(TransactionService, _super);
|
|
11436
|
-
function TransactionService() {
|
|
11437
|
-
var _this = _super.
|
|
11526
|
+
function TransactionService(http, eventDispatcherService, environment, toastService, transactionReceiptService) {
|
|
11527
|
+
var _this = _super.call(this, http, eventDispatcherService, environment, toastService) || this;
|
|
11528
|
+
_this.http = http;
|
|
11529
|
+
_this.eventDispatcherService = eventDispatcherService;
|
|
11530
|
+
_this.environment = environment;
|
|
11531
|
+
_this.toastService = toastService;
|
|
11532
|
+
_this.transactionReceiptService = transactionReceiptService;
|
|
11438
11533
|
// url part for Transaction API
|
|
11439
11534
|
_this.url = 'transactions';
|
|
11440
11535
|
_this.modelClass = Transaction;
|
|
@@ -11447,6 +11542,8 @@
|
|
|
11447
11542
|
TransactionService.prototype.listenEvents = function () {
|
|
11448
11543
|
this.listenDepreciationChange();
|
|
11449
11544
|
this.listenPropertyShareUpdate();
|
|
11545
|
+
this.listenReceiptAdded();
|
|
11546
|
+
this.listenReceiptDeleted();
|
|
11450
11547
|
};
|
|
11451
11548
|
/**
|
|
11452
11549
|
* get list of all user's TaxTank transactions
|
|
@@ -11541,11 +11638,10 @@
|
|
|
11541
11638
|
transactions.forEach(function (transaction, index) {
|
|
11542
11639
|
// @TODO backend: need to upload file in the same backend endpoint with transaction add/update
|
|
11543
11640
|
// check if passed receipt and upload file
|
|
11544
|
-
// @TODO Alex: refactor. Move receipt to separated service and use event dispatcher to handle it
|
|
11545
11641
|
if (transaction.file && (transaction.file instanceof File)) {
|
|
11546
11642
|
transaction.id = response[index].id;
|
|
11547
11643
|
addedTransactions[index].file = transaction.file;
|
|
11548
|
-
_this.
|
|
11644
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.TRANSACTION_CREATED_WITH_NEW_RECEIPT, addedTransactions[index]));
|
|
11549
11645
|
}
|
|
11550
11646
|
// @TODO Viktor: implement API for saving of nested transactions
|
|
11551
11647
|
// add child transactions if exist
|
|
@@ -11579,10 +11675,13 @@
|
|
|
11579
11675
|
var updatedTransaction = classTransformer.plainToClass(Transaction, response);
|
|
11580
11676
|
// @TODO need to upload file in the same backend endpoint with transaction add/update
|
|
11581
11677
|
// check if passed new receipt and upload file
|
|
11582
|
-
// @TODO Alex: refactor. Move receipt to separated service and use event dispatcher to handle it
|
|
11583
11678
|
if (transaction.file && (transaction.file instanceof File)) {
|
|
11584
11679
|
updatedTransaction.file = transaction.file;
|
|
11585
|
-
_this.
|
|
11680
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.TRANSACTION_UPDATED_WITH_NEW_RECEIPT, updatedTransaction));
|
|
11681
|
+
// receipt file was removed from form - we should delete receipt from transaction
|
|
11682
|
+
}
|
|
11683
|
+
else if (!transaction.file && transaction.receipt) {
|
|
11684
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.TRANSACTION_UPDATED_WITH_DELETED_RECEIPT, updatedTransaction));
|
|
11586
11685
|
}
|
|
11587
11686
|
// @TODO Viktor: implement API for saving of nested transactions
|
|
11588
11687
|
if (transaction.transactions.length) {
|
|
@@ -11654,24 +11753,6 @@
|
|
|
11654
11753
|
_this.transactionDeleted.emit(model);
|
|
11655
11754
|
}));
|
|
11656
11755
|
};
|
|
11657
|
-
/**
|
|
11658
|
-
* upload transaction receipt image
|
|
11659
|
-
* @param transaction Еhe transaction for which the receipt will be imported
|
|
11660
|
-
*/
|
|
11661
|
-
TransactionService.prototype.uploadReceipt = function (transaction) {
|
|
11662
|
-
var _this = this;
|
|
11663
|
-
var formData = new FormData();
|
|
11664
|
-
formData.append('file', transaction.file);
|
|
11665
|
-
transaction.receipt = null;
|
|
11666
|
-
this.http.post(this.environment.apiV2 + "/" + this.url + "/" + transaction.id + "/receipts", formData)
|
|
11667
|
-
.subscribe(function (receiptResponse) {
|
|
11668
|
-
// we don't need to keep file after save
|
|
11669
|
-
transaction.file = null;
|
|
11670
|
-
transaction.receipt = classTransformer.plainToClass(TransactionReceipt, receiptResponse);
|
|
11671
|
-
replace(_this.cache, transaction);
|
|
11672
|
-
_this.updateCache();
|
|
11673
|
-
});
|
|
11674
|
-
};
|
|
11675
11756
|
/**
|
|
11676
11757
|
* calculate gross income amount based on transaction amount and taxes (fees)
|
|
11677
11758
|
* @param transaction Transaction instance for calculation
|
|
@@ -11733,16 +11814,41 @@
|
|
|
11733
11814
|
var _this = this;
|
|
11734
11815
|
this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_SHARE_UPDATED).subscribe(function () { return _this.resetCache(); });
|
|
11735
11816
|
};
|
|
11817
|
+
TransactionService.prototype.listenReceiptAdded = function () {
|
|
11818
|
+
var _this = this;
|
|
11819
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.TRANSACTION_RECEIPT_CREATED).subscribe(function (transactionReceipt) {
|
|
11820
|
+
var transactionToUpdate = _this.find(transactionReceipt.transaction.id);
|
|
11821
|
+
// we don't need to keep file after save
|
|
11822
|
+
transactionToUpdate.file = null;
|
|
11823
|
+
transactionToUpdate.receipt = transactionReceipt;
|
|
11824
|
+
replace(_this.cache, transactionToUpdate);
|
|
11825
|
+
_this.updateCache();
|
|
11826
|
+
});
|
|
11827
|
+
};
|
|
11828
|
+
TransactionService.prototype.listenReceiptDeleted = function () {
|
|
11829
|
+
var _this = this;
|
|
11830
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.TRANSACTION_RECEIPT_DELETED).subscribe(function (transaction) {
|
|
11831
|
+
var transactionToUpdate = _this.find(transaction.id);
|
|
11832
|
+
transactionToUpdate.receipt = null;
|
|
11833
|
+
replace(_this.cache, transactionToUpdate);
|
|
11834
|
+
_this.updateCache();
|
|
11835
|
+
});
|
|
11836
|
+
};
|
|
11736
11837
|
return TransactionService;
|
|
11737
11838
|
}(RestService));
|
|
11738
|
-
TransactionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TransactionService, deps:
|
|
11839
|
+
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 }, { token: TransactionReceiptService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
11739
11840
|
TransactionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TransactionService, providedIn: 'root' });
|
|
11740
11841
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TransactionService, decorators: [{
|
|
11741
11842
|
type: i0.Injectable,
|
|
11742
11843
|
args: [{
|
|
11743
11844
|
providedIn: 'root'
|
|
11744
11845
|
}]
|
|
11745
|
-
}]
|
|
11846
|
+
}], ctorParameters: function () {
|
|
11847
|
+
return [{ type: i1__namespace.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
11848
|
+
type: i0.Inject,
|
|
11849
|
+
args: ['environment']
|
|
11850
|
+
}] }, { type: ToastService }, { type: TransactionReceiptService }];
|
|
11851
|
+
} });
|
|
11746
11852
|
|
|
11747
11853
|
/**
|
|
11748
11854
|
* Service handling user's account setup process.
|
|
@@ -16873,6 +16979,7 @@
|
|
|
16873
16979
|
exports.ClientIncomeTypesForm = ClientIncomeTypesForm;
|
|
16874
16980
|
exports.ClientIncomeTypesService = ClientIncomeTypesService;
|
|
16875
16981
|
exports.ClientInvite = ClientInvite;
|
|
16982
|
+
exports.ClientInviteCollection = ClientInviteCollection;
|
|
16876
16983
|
exports.ClientInviteService = ClientInviteService;
|
|
16877
16984
|
exports.ClientMovement = ClientMovement;
|
|
16878
16985
|
exports.ClientMovementCollection = ClientMovementCollection;
|