taxtank-core 0.30.72 → 0.30.73
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/esm2020/lib/services/http/depreciation/depreciation.service.mjs +6 -4
- package/esm2020/lib/services/http/receipt/receipt.service.mjs +1 -1
- package/fesm2015/taxtank-core.mjs +107 -106
- package/fesm2015/taxtank-core.mjs.map +1 -1
- package/fesm2020/taxtank-core.mjs +103 -102
- package/fesm2020/taxtank-core.mjs.map +1 -1
- package/lib/services/http/depreciation/depreciation.service.d.ts +3 -1
- package/package.json +1 -1
|
@@ -12481,12 +12481,112 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.4", ngImpor
|
|
|
12481
12481
|
}]
|
|
12482
12482
|
}] });
|
|
12483
12483
|
|
|
12484
|
+
/**
|
|
12485
|
+
* Abstract service class to work with transactions-like receipt files (transactions, depreciations, e.t.c.)
|
|
12486
|
+
* @Todo TT-2191 refactor service when receipts API will be updated
|
|
12487
|
+
*/
|
|
12488
|
+
class ReceiptService {
|
|
12489
|
+
constructor(http, eventDispatcherService, environment, toastService) {
|
|
12490
|
+
this.http = http;
|
|
12491
|
+
this.eventDispatcherService = eventDispatcherService;
|
|
12492
|
+
this.environment = environment;
|
|
12493
|
+
this.toastService = toastService;
|
|
12494
|
+
}
|
|
12495
|
+
listenEvents() {
|
|
12496
|
+
this.listenParentWithReceiptUpdated();
|
|
12497
|
+
this.listenParentWithoutReceiptUpdated();
|
|
12498
|
+
}
|
|
12499
|
+
/**
|
|
12500
|
+
* Entity is necessary to take the ID and the receipt file from it.
|
|
12501
|
+
*/
|
|
12502
|
+
add(receiptEntity) {
|
|
12503
|
+
const formData = new FormData();
|
|
12504
|
+
formData.append('file', receiptEntity.file);
|
|
12505
|
+
return this.http.post(`${this.environment.apiV2}/${this.entityType}/${receiptEntity.id}/receipts`, formData)
|
|
12506
|
+
.pipe(map((receipt) => {
|
|
12507
|
+
const uploadedReceipt = this.createModelInstance(receipt);
|
|
12508
|
+
this.eventDispatcherService.dispatch(new AppEvent(this.receiptCreatedEvent, uploadedReceipt));
|
|
12509
|
+
return uploadedReceipt;
|
|
12510
|
+
}));
|
|
12511
|
+
}
|
|
12512
|
+
delete(receiptEntity) {
|
|
12513
|
+
return this.http.delete(`${this.environment.apiV2}/${this.entityType}/${receiptEntity.id}/receipts/${receiptEntity.receipt.id}`)
|
|
12514
|
+
.pipe(map(() => {
|
|
12515
|
+
this.eventDispatcherService.dispatch(new AppEvent(this.receiptDeletedEvent, receiptEntity));
|
|
12516
|
+
}));
|
|
12517
|
+
}
|
|
12518
|
+
/**
|
|
12519
|
+
* Parent entity was updated with attached receipt
|
|
12520
|
+
*/
|
|
12521
|
+
listenParentWithReceiptUpdated() {
|
|
12522
|
+
this.eventDispatcherService.on(this.entityUpdatedWithReceiptEvent)
|
|
12523
|
+
.subscribe((receiptEntity) => {
|
|
12524
|
+
this.add(receiptEntity).subscribe();
|
|
12525
|
+
});
|
|
12526
|
+
}
|
|
12527
|
+
/**
|
|
12528
|
+
* Parent entity was updated, but receipt was removed
|
|
12529
|
+
*/
|
|
12530
|
+
listenParentWithoutReceiptUpdated() {
|
|
12531
|
+
this.eventDispatcherService.on(this.entityUpdatedWithDeletedReceiptEvent)
|
|
12532
|
+
.subscribe((receiptEntity) => {
|
|
12533
|
+
this.delete(receiptEntity).subscribe();
|
|
12534
|
+
});
|
|
12535
|
+
}
|
|
12536
|
+
createModelInstance(data) {
|
|
12537
|
+
return plainToClass(this.modelClass, data);
|
|
12538
|
+
}
|
|
12539
|
+
}
|
|
12540
|
+
ReceiptService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: ReceiptService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
12541
|
+
ReceiptService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: ReceiptService, providedIn: 'root' });
|
|
12542
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: ReceiptService, decorators: [{
|
|
12543
|
+
type: Injectable,
|
|
12544
|
+
args: [{
|
|
12545
|
+
providedIn: 'root'
|
|
12546
|
+
}]
|
|
12547
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
12548
|
+
type: Inject,
|
|
12549
|
+
args: ['environment']
|
|
12550
|
+
}] }, { type: ToastService }]; } });
|
|
12551
|
+
|
|
12552
|
+
/**
|
|
12553
|
+
* @Todo TT-2191 refactor service when receipts API will be updated
|
|
12554
|
+
*/
|
|
12555
|
+
class DepreciationReceiptService extends ReceiptService {
|
|
12556
|
+
constructor(http, eventDispatcherService, environment, toastService) {
|
|
12557
|
+
super(http, eventDispatcherService, environment, toastService);
|
|
12558
|
+
this.http = http;
|
|
12559
|
+
this.eventDispatcherService = eventDispatcherService;
|
|
12560
|
+
this.environment = environment;
|
|
12561
|
+
this.toastService = toastService;
|
|
12562
|
+
this.modelClass = DepreciationReceipt;
|
|
12563
|
+
this.entityType = AssetEntityTypeEnum.DEPRECIATIONS;
|
|
12564
|
+
this.receiptCreatedEvent = AppEventTypeEnum.DEPRECIATION_RECEIPT_CREATED;
|
|
12565
|
+
this.receiptDeletedEvent = AppEventTypeEnum.DEPRECIATION_RECEIPT_DELETED;
|
|
12566
|
+
this.entityUpdatedWithDeletedReceiptEvent = AppEventTypeEnum.DEPRECIATION_UPDATED_WITH_DELETED_RECEIPT;
|
|
12567
|
+
this.entityUpdatedWithReceiptEvent = AppEventTypeEnum.DEPRECIATION_UPDATED_WITH_RECEIPT;
|
|
12568
|
+
this.listenEvents();
|
|
12569
|
+
}
|
|
12570
|
+
}
|
|
12571
|
+
DepreciationReceiptService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: DepreciationReceiptService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
12572
|
+
DepreciationReceiptService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: DepreciationReceiptService, providedIn: 'root' });
|
|
12573
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: DepreciationReceiptService, decorators: [{
|
|
12574
|
+
type: Injectable,
|
|
12575
|
+
args: [{
|
|
12576
|
+
providedIn: 'root'
|
|
12577
|
+
}]
|
|
12578
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
12579
|
+
type: Inject,
|
|
12580
|
+
args: ['environment']
|
|
12581
|
+
}] }, { type: ToastService }]; } });
|
|
12582
|
+
|
|
12484
12583
|
class DepreciationService extends RestService$1 {
|
|
12485
|
-
constructor(http, eventDispatcherService, environment) {
|
|
12584
|
+
constructor(http, eventDispatcherService, environment, depreciationReceiptService) {
|
|
12486
12585
|
super(http, eventDispatcherService, environment);
|
|
12487
12586
|
this.http = http;
|
|
12488
12587
|
this.eventDispatcherService = eventDispatcherService;
|
|
12489
12588
|
this.environment = environment;
|
|
12589
|
+
this.depreciationReceiptService = depreciationReceiptService;
|
|
12490
12590
|
this.modelClass = Depreciation;
|
|
12491
12591
|
this.collectionClass = DepreciationCollection;
|
|
12492
12592
|
this.endpointUri = 'depreciations';
|
|
@@ -12597,7 +12697,7 @@ class DepreciationService extends RestService$1 {
|
|
|
12597
12697
|
});
|
|
12598
12698
|
}
|
|
12599
12699
|
}
|
|
12600
|
-
DepreciationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: DepreciationService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
12700
|
+
DepreciationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: DepreciationService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: DepreciationReceiptService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
12601
12701
|
DepreciationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: DepreciationService, providedIn: 'root' });
|
|
12602
12702
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: DepreciationService, decorators: [{
|
|
12603
12703
|
type: Injectable,
|
|
@@ -12607,7 +12707,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.4", ngImpor
|
|
|
12607
12707
|
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
12608
12708
|
type: Inject,
|
|
12609
12709
|
args: ['environment']
|
|
12610
|
-
}] }]; } });
|
|
12710
|
+
}] }, { type: DepreciationReceiptService }]; } });
|
|
12611
12711
|
|
|
12612
12712
|
/**
|
|
12613
12713
|
* Service for work with DepreciationCapitalProjects
|
|
@@ -12661,105 +12761,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.4", ngImpor
|
|
|
12661
12761
|
args: ['environment']
|
|
12662
12762
|
}] }]; } });
|
|
12663
12763
|
|
|
12664
|
-
/**
|
|
12665
|
-
* Abstract service class to work with transactions-like receipt files (transactions, depreciations, e.t.c.)
|
|
12666
|
-
* @Todo TT-2191 refactor service when receipts API will be updated
|
|
12667
|
-
*/
|
|
12668
|
-
class ReceiptService {
|
|
12669
|
-
constructor(http, eventDispatcherService, environment, toastService) {
|
|
12670
|
-
this.http = http;
|
|
12671
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
12672
|
-
this.environment = environment;
|
|
12673
|
-
this.toastService = toastService;
|
|
12674
|
-
}
|
|
12675
|
-
listenEvents() {
|
|
12676
|
-
this.listenParentWithReceiptUpdated();
|
|
12677
|
-
this.listenParentWithoutReceiptUpdated();
|
|
12678
|
-
}
|
|
12679
|
-
/**
|
|
12680
|
-
* Entity is necessary to take the ID and the receipt file from it.
|
|
12681
|
-
*/
|
|
12682
|
-
add(receiptEntity) {
|
|
12683
|
-
const formData = new FormData();
|
|
12684
|
-
formData.append('file', receiptEntity.file);
|
|
12685
|
-
return this.http.post(`${this.environment.apiV2}/${this.entityType}/${receiptEntity.id}/receipts`, formData)
|
|
12686
|
-
.pipe(map((receipt) => {
|
|
12687
|
-
const uploadedReceipt = this.createModelInstance(receipt);
|
|
12688
|
-
this.eventDispatcherService.dispatch(new AppEvent(this.receiptCreatedEvent, uploadedReceipt));
|
|
12689
|
-
return uploadedReceipt;
|
|
12690
|
-
}));
|
|
12691
|
-
}
|
|
12692
|
-
delete(receiptEntity) {
|
|
12693
|
-
return this.http.delete(`${this.environment.apiV2}/${this.entityType}/${receiptEntity.id}/receipts/${receiptEntity.receipt.id}`)
|
|
12694
|
-
.pipe(map(() => {
|
|
12695
|
-
this.eventDispatcherService.dispatch(new AppEvent(this.receiptDeletedEvent, receiptEntity));
|
|
12696
|
-
}));
|
|
12697
|
-
}
|
|
12698
|
-
/**
|
|
12699
|
-
* Parent entity was updated with attached receipt
|
|
12700
|
-
*/
|
|
12701
|
-
listenParentWithReceiptUpdated() {
|
|
12702
|
-
this.eventDispatcherService.on(this.entityUpdatedWithReceiptEvent)
|
|
12703
|
-
.subscribe((receiptEntity) => {
|
|
12704
|
-
this.add(receiptEntity).subscribe();
|
|
12705
|
-
});
|
|
12706
|
-
}
|
|
12707
|
-
/**
|
|
12708
|
-
* Parent entity was updated, but receipt was removed
|
|
12709
|
-
*/
|
|
12710
|
-
listenParentWithoutReceiptUpdated() {
|
|
12711
|
-
this.eventDispatcherService.on(this.entityUpdatedWithDeletedReceiptEvent)
|
|
12712
|
-
.subscribe((receiptEntity) => {
|
|
12713
|
-
this.delete(receiptEntity).subscribe();
|
|
12714
|
-
});
|
|
12715
|
-
}
|
|
12716
|
-
createModelInstance(data) {
|
|
12717
|
-
return plainToClass(this.modelClass, data);
|
|
12718
|
-
}
|
|
12719
|
-
}
|
|
12720
|
-
ReceiptService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: ReceiptService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
12721
|
-
ReceiptService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: ReceiptService, providedIn: 'root' });
|
|
12722
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: ReceiptService, decorators: [{
|
|
12723
|
-
type: Injectable,
|
|
12724
|
-
args: [{
|
|
12725
|
-
providedIn: 'root'
|
|
12726
|
-
}]
|
|
12727
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
12728
|
-
type: Inject,
|
|
12729
|
-
args: ['environment']
|
|
12730
|
-
}] }, { type: ToastService }]; } });
|
|
12731
|
-
|
|
12732
|
-
/**
|
|
12733
|
-
* @Todo TT-2191 refactor service when receipts API will be updated
|
|
12734
|
-
*/
|
|
12735
|
-
class DepreciationReceiptService extends ReceiptService {
|
|
12736
|
-
constructor(http, eventDispatcherService, environment, toastService) {
|
|
12737
|
-
super(http, eventDispatcherService, environment, toastService);
|
|
12738
|
-
this.http = http;
|
|
12739
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
12740
|
-
this.environment = environment;
|
|
12741
|
-
this.toastService = toastService;
|
|
12742
|
-
this.modelClass = DepreciationReceipt;
|
|
12743
|
-
this.entityType = AssetEntityTypeEnum.DEPRECIATIONS;
|
|
12744
|
-
this.receiptCreatedEvent = AppEventTypeEnum.DEPRECIATION_RECEIPT_CREATED;
|
|
12745
|
-
this.receiptDeletedEvent = AppEventTypeEnum.DEPRECIATION_RECEIPT_DELETED;
|
|
12746
|
-
this.entityUpdatedWithDeletedReceiptEvent = AppEventTypeEnum.DEPRECIATION_UPDATED_WITH_DELETED_RECEIPT;
|
|
12747
|
-
this.entityUpdatedWithReceiptEvent = AppEventTypeEnum.DEPRECIATION_UPDATED_WITH_RECEIPT;
|
|
12748
|
-
this.listenEvents();
|
|
12749
|
-
}
|
|
12750
|
-
}
|
|
12751
|
-
DepreciationReceiptService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: DepreciationReceiptService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
12752
|
-
DepreciationReceiptService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: DepreciationReceiptService, providedIn: 'root' });
|
|
12753
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: DepreciationReceiptService, decorators: [{
|
|
12754
|
-
type: Injectable,
|
|
12755
|
-
args: [{
|
|
12756
|
-
providedIn: 'root'
|
|
12757
|
-
}]
|
|
12758
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
12759
|
-
type: Inject,
|
|
12760
|
-
args: ['environment']
|
|
12761
|
-
}] }, { type: ToastService }]; } });
|
|
12762
|
-
|
|
12763
12764
|
/**
|
|
12764
12765
|
* Abstract base service that implements common services functionality
|
|
12765
12766
|
* and describe abstract methods/properties that have to be implemented in child services
|