taxtank-core 0.33.48 → 0.33.50
Sign up to get free protection for your applications and to get access to all the features.
- package/esm2022/src/lib/collections/vehicle/best-vehicle-logbook.collection.mjs +6 -2
- package/esm2022/src/lib/forms/home-office/home-office-calculator.form.mjs +9 -5
- package/esm2022/src/lib/forms/home-office/home-office-claim.form.mjs +4 -8
- package/esm2022/src/lib/models/home-office/home-office-claim.interface.mjs +1 -1
- package/esm2022/src/lib/models/home-office/home-office-claim.mjs +7 -7
- package/esm2022/src/lib/models/home-office/home-office-log.mjs +4 -3
- package/esm2022/src/lib/services/http/home-office/home-office-log.service.mjs +3 -3
- package/esm2022/src/lib/services/http/transaction/transaction.service.mjs +8 -2
- package/fesm2022/taxtank-core.mjs +31 -20
- package/fesm2022/taxtank-core.mjs.map +1 -1
- package/package.json +1 -1
- package/src/lib/collections/vehicle/best-vehicle-logbook.collection.d.ts +1 -0
- package/src/lib/models/home-office/home-office-claim.d.ts +2 -2
- package/src/lib/models/home-office/home-office-claim.interface.d.ts +3 -2
- package/src/lib/models/home-office/home-office-log.d.ts +3 -2
- package/src/lib/services/http/home-office/home-office-log.service.d.ts +3 -3
- package/src/lib/services/http/transaction/transaction.service.d.ts +1 -0
@@ -8731,9 +8731,10 @@ class BestVehicleLogbookCollection extends VehicleLogbookCollection {
|
|
8731
8731
|
}
|
8732
8732
|
/**
|
8733
8733
|
* Best period may be calculated only when user has logbooks minimum for VehicleLogbook.bestPeriodWeeks
|
8734
|
+
* and has at least one work/business trip
|
8734
8735
|
*/
|
8735
8736
|
static isBestPeriodExist(logbooks) {
|
8736
|
-
if (logbooks.length < 2) {
|
8737
|
+
if (logbooks.length < 2 || !logbooks.getClaimable().length) {
|
8737
8738
|
return false;
|
8738
8739
|
}
|
8739
8740
|
if (!(logbooks instanceof VehicleLogbookCollection)) {
|
@@ -8744,6 +8745,9 @@ class BestVehicleLogbookCollection extends VehicleLogbookCollection {
|
|
8744
8745
|
// get list of date ranges for each of passed logbook
|
8745
8746
|
static getPeriods(logbooks) {
|
8746
8747
|
const claimable = logbooks.getClaimable();
|
8748
|
+
if (!claimable.length) {
|
8749
|
+
return [];
|
8750
|
+
}
|
8747
8751
|
// get a list of date ranges that could potentially be the best
|
8748
8752
|
const periods = claimable
|
8749
8753
|
// skip logbooks whose range ends after the last logbook
|
@@ -10727,13 +10731,13 @@ __decorate([
|
|
10727
10731
|
class HomeOfficeClaim extends ObservableModel {
|
10728
10732
|
constructor() {
|
10729
10733
|
super(...arguments);
|
10730
|
-
this.hours = 0;
|
10731
10734
|
this.electricityAndGas = 0;
|
10732
10735
|
this.cleaning = 0;
|
10733
10736
|
this.internet = 0;
|
10734
10737
|
this.telephone = 0;
|
10735
10738
|
this.mobile = 0;
|
10736
|
-
this.
|
10739
|
+
this.occupancyPercent = 0;
|
10740
|
+
this.dedicatedOffice = true;
|
10737
10741
|
}
|
10738
10742
|
static { this.className = 'HomeOfficeClaim'; }
|
10739
10743
|
getChartAccountsList() {
|
@@ -10748,10 +10752,10 @@ class HomeOfficeClaim extends ObservableModel {
|
|
10748
10752
|
.add(list.TELEPHONE, this.telephone)
|
10749
10753
|
.add(list.MOBILE_PHONE, this.mobile);
|
10750
10754
|
if (this.method === HomeOfficeClaimMethodEnum.OCCUPANCY) {
|
10751
|
-
claims.add(BusinessChartAccountsEnum.HOME_OFFICE_RENT, this.
|
10752
|
-
claims.add(BusinessChartAccountsEnum.HOME_OFFICE_LOAN, this.
|
10753
|
-
claims.add(BusinessChartAccountsEnum.HOME_OFFICE_RATES, this.
|
10754
|
-
claims.add(BusinessChartAccountsEnum.HOME_OFFICE_OTHER, this.
|
10755
|
+
claims.add(BusinessChartAccountsEnum.HOME_OFFICE_RENT, this.occupancyPercent);
|
10756
|
+
claims.add(BusinessChartAccountsEnum.HOME_OFFICE_LOAN, this.occupancyPercent);
|
10757
|
+
claims.add(BusinessChartAccountsEnum.HOME_OFFICE_RATES, this.occupancyPercent);
|
10758
|
+
claims.add(BusinessChartAccountsEnum.HOME_OFFICE_OTHER, this.occupancyPercent);
|
10755
10759
|
}
|
10756
10760
|
return claims;
|
10757
10761
|
}
|
@@ -10763,7 +10767,8 @@ __decorate([
|
|
10763
10767
|
Type(() => SoleBusiness)
|
10764
10768
|
], HomeOfficeClaim.prototype, "business", void 0);
|
10765
10769
|
|
10766
|
-
class HomeOfficeLog extends
|
10770
|
+
class HomeOfficeLog extends ObservableModel {
|
10771
|
+
static { this.className = 'HomeOfficeLog'; }
|
10767
10772
|
}
|
10768
10773
|
__decorate([
|
10769
10774
|
Type(() => HomeOfficeClaim)
|
@@ -15394,6 +15399,7 @@ class TransactionService extends RestService {
|
|
15394
15399
|
this.listenDepreciationChange();
|
15395
15400
|
this.listenVehicleClaimChanges();
|
15396
15401
|
this.listenHomeOfficeClaim();
|
15402
|
+
this.listenHomeOfficeLog();
|
15397
15403
|
this.listenPropertyForecastUpdate();
|
15398
15404
|
this.listenNotifications();
|
15399
15405
|
}
|
@@ -15583,6 +15589,11 @@ class TransactionService extends RestService {
|
|
15583
15589
|
this.refreshCache();
|
15584
15590
|
});
|
15585
15591
|
}
|
15592
|
+
listenHomeOfficeLog() {
|
15593
|
+
this.eventDispatcherService.on2(...HomeOfficeLog.getEventNames('post', 'put', 'delete')).subscribe(() => {
|
15594
|
+
this.refreshCache();
|
15595
|
+
});
|
15596
|
+
}
|
15586
15597
|
/**
|
15587
15598
|
* property forecast includes claimPercent which affects property related expenses
|
15588
15599
|
* @TODO Alex move to forecast api instead of property
|
@@ -16453,7 +16464,7 @@ class HomeOfficeLogService extends RestService$1 {
|
|
16453
16464
|
constructor() {
|
16454
16465
|
super(...arguments);
|
16455
16466
|
this.endpointUri = 'home-office-logs';
|
16456
|
-
this.modelClass =
|
16467
|
+
this.modelClass = HomeOfficeLog;
|
16457
16468
|
this.collectionClass = (Collection);
|
16458
16469
|
this.disabledMethods = ['postBatch', 'putBatch', 'deleteBatch'];
|
16459
16470
|
}
|
@@ -24590,13 +24601,12 @@ class HomeOfficeClaimForm extends AbstractForm {
|
|
24590
24601
|
constructor(claim = plainToClass(HomeOfficeClaim, {})) {
|
24591
24602
|
super({
|
24592
24603
|
method: new FormControl(claim.method, Validators.required),
|
24593
|
-
hours: new FormControl(claim.hours, [Validators.required, Validators.min(0), Validators.max(5000)]),
|
24594
24604
|
electricityAndGas: new FormControl(claim.electricityAndGas, [Validators.required, Validators.min(0), Validators.max(100)]),
|
24595
24605
|
cleaning: new FormControl(claim.cleaning, [Validators.required, Validators.min(0), Validators.max(100)]),
|
24596
24606
|
internet: new FormControl(claim.internet, [Validators.required, Validators.min(0), Validators.max(100)]),
|
24597
24607
|
telephone: new FormControl(claim.telephone, [Validators.required, Validators.min(0), Validators.max(100)]),
|
24598
24608
|
mobile: new FormControl(claim.mobile, [Validators.required, Validators.min(0), Validators.max(100)]),
|
24599
|
-
|
24609
|
+
occupancyPercent: new FormControl(claim.occupancyPercent, [Validators.required, Validators.min(0), Validators.max(100)]),
|
24600
24610
|
}, claim);
|
24601
24611
|
this.listenEvents();
|
24602
24612
|
this.switchMethod(claim.method);
|
@@ -24607,11 +24617,8 @@ class HomeOfficeClaimForm extends AbstractForm {
|
|
24607
24617
|
});
|
24608
24618
|
}
|
24609
24619
|
switchMethod(method) {
|
24610
|
-
this.disable({},
|
24620
|
+
this.disable({}, this.occupancyControls);
|
24611
24621
|
switch (method) {
|
24612
|
-
case HomeOfficeClaimMethodEnum.FIXED:
|
24613
|
-
this.controls.hours.enable();
|
24614
|
-
break;
|
24615
24622
|
case HomeOfficeClaimMethodEnum.ACTUAL:
|
24616
24623
|
this.enable({}, this.actualControls);
|
24617
24624
|
break;
|
@@ -24624,7 +24631,7 @@ class HomeOfficeClaimForm extends AbstractForm {
|
|
24624
24631
|
return [this.controls.electricityAndGas, this.controls.cleaning, this.controls.internet, this.controls.telephone, this.controls.mobile];
|
24625
24632
|
}
|
24626
24633
|
get occupancyControls() {
|
24627
|
-
return [...this.actualControls, this.controls.
|
24634
|
+
return [...this.actualControls, this.controls.occupancyPercent];
|
24628
24635
|
}
|
24629
24636
|
}
|
24630
24637
|
|
@@ -24642,19 +24649,23 @@ class HomeOfficeCalculatorForm extends AbstractForm {
|
|
24642
24649
|
constructor(claim = plainToClass(HomeOfficeClaim, {})) {
|
24643
24650
|
super({
|
24644
24651
|
homeArea: new FormControl(claim.homeArea, [Validators.required]),
|
24645
|
-
officeArea: new FormControl(
|
24652
|
+
officeArea: new FormControl(claim.officeArea, [Validators.required]),
|
24646
24653
|
dedicatedOffice: new FormControl(claim.dedicatedOffice, [Validators.required]),
|
24654
|
+
workUsage: new FormControl({ value: claim.workUsage, disabled: true }, [Validators.required])
|
24647
24655
|
}, claim);
|
24648
24656
|
this.listenEvents();
|
24649
24657
|
}
|
24650
24658
|
listenEvents() {
|
24651
24659
|
this.get('dedicatedOffice').valueChanges.subscribe(() => {
|
24652
|
-
this.toggleEnabledState(this.get('
|
24660
|
+
this.toggleEnabledState(this.get('workUsage'));
|
24653
24661
|
});
|
24654
24662
|
}
|
24655
24663
|
submit() {
|
24656
|
-
|
24657
|
-
|
24664
|
+
let occupancyPercent = this.value.officeArea * 100 / this.value.homeArea;
|
24665
|
+
if (!this.value.dedicatedOffice) {
|
24666
|
+
occupancyPercent *= this.value.workUsage / 100;
|
24667
|
+
}
|
24668
|
+
return super.submit({ occupancyPercent: round(occupancyPercent, 2) });
|
24658
24669
|
}
|
24659
24670
|
}
|
24660
24671
|
|