taxtank-core 0.27.3 → 0.27.6
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 +448 -163
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/chart-accounts.collection.js +3 -3
- package/esm2015/lib/collections/transaction/transaction.collection.js +5 -2
- package/esm2015/lib/collections/vehicle/vehicle-claim.collection.js +2 -4
- package/esm2015/lib/collections/vehicle/vehicle-logbook.collection.js +15 -30
- package/esm2015/lib/db/Enums/depreciation-calculation.enum.js +2 -1
- package/esm2015/lib/db/Enums/sole-invoice-statuses.enum.js +8 -0
- package/esm2015/lib/db/Enums/sole-invoice-template-tax-type.enum.js +7 -0
- package/esm2015/lib/db/Models/chart-accounts/chart-accounts.js +1 -1
- package/esm2015/lib/db/Models/sole/sole-invoice-template.js +1 -1
- package/esm2015/lib/db/Models/sole/sole-invoice.js +1 -1
- package/esm2015/lib/db/Models/user/user.js +1 -1
- package/esm2015/lib/forms/abstract.form.js +11 -5
- package/esm2015/lib/forms/bank/bank-account/bank-account-add-manual.form.js +6 -10
- package/esm2015/lib/forms/bank/bank-account/bank-account-allocation.form.js +6 -3
- package/esm2015/lib/forms/sole/index.js +3 -1
- package/esm2015/lib/forms/sole/sole-business-allocations.form.js +2 -1
- package/esm2015/lib/forms/sole/sole-invoice-item.form.js +43 -0
- package/esm2015/lib/forms/sole/sole-invoice-template.form.js +6 -4
- package/esm2015/lib/forms/sole/sole-invoice.form.js +51 -0
- package/esm2015/lib/forms/vehicle/vehicle-claim-details.form.js +3 -7
- package/esm2015/lib/forms/vehicle/vehicle-claim.form.js +8 -2
- package/esm2015/lib/forms/vehicle/vehicle-logbook.form.js +22 -15
- package/esm2015/lib/models/account-setup/account-setup-items.const.js +2 -2
- package/esm2015/lib/models/bank/bank-account.js +4 -1
- package/esm2015/lib/models/chart-accounts/chart-accounts.js +9 -9
- package/esm2015/lib/models/endpoint/endpoints.const.js +5 -1
- package/esm2015/lib/models/financial-year/financial-year.js +2 -1
- package/esm2015/lib/models/report/my-tax/my-tax-deductions/my-tax-deductions.js +2 -2
- package/esm2015/lib/models/sole/sole-details.js +3 -1
- package/esm2015/lib/models/sole/sole-invoice-item.js +8 -1
- package/esm2015/lib/models/sole/sole-invoice-template.js +15 -4
- package/esm2015/lib/models/sole/sole-invoice.js +55 -2
- package/esm2015/lib/models/transaction/transaction.js +3 -3
- package/esm2015/lib/models/vehicle/logbook-period.js +2 -1
- package/esm2015/lib/models/vehicle/vehicle-claim-details.js +12 -11
- package/esm2015/lib/models/vehicle/vehicle-claim.js +14 -13
- package/esm2015/lib/models/vehicle/vehicle-logbook.js +18 -5
- package/esm2015/lib/services/account-setup/account-setup.service.js +2 -2
- package/esm2015/lib/services/affiliate/rewardful/rewardful.service.js +34 -0
- package/esm2015/lib/services/http/depreciation/depreciation.service.js +1 -2
- package/esm2015/lib/services/http/sole/index.js +2 -1
- package/esm2015/lib/services/http/sole/sole-invoice/sole-invoice.service.js +21 -0
- package/esm2015/lib/services/http/transaction/transaction.service.js +1 -2
- package/esm2015/lib/services/http/vehicle/vehicle-claim-details.service.js +7 -6
- package/esm2015/lib/services/http/vehicle/vehicle-claim.service.js +10 -10
- package/esm2015/lib/services/index.js +2 -1
- package/esm2015/public-api.js +3 -1
- package/fesm2015/taxtank-core.js +379 -139
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/chart-accounts.collection.d.ts +2 -2
- package/lib/collections/transaction/transaction.collection.d.ts +2 -2
- package/lib/collections/vehicle/vehicle-claim.collection.d.ts +1 -3
- package/lib/collections/vehicle/vehicle-logbook.collection.d.ts +4 -9
- package/lib/db/Enums/depreciation-calculation.enum.d.ts +1 -0
- package/lib/db/Enums/sole-invoice-statuses.enum.d.ts +6 -0
- package/lib/db/Enums/sole-invoice-template-tax-type.enum.d.ts +5 -0
- package/lib/db/Models/chart-accounts/chart-accounts.d.ts +1 -0
- package/lib/db/Models/sole/sole-invoice-template.d.ts +2 -1
- package/lib/db/Models/sole/sole-invoice.d.ts +2 -1
- package/lib/db/Models/user/user.d.ts +1 -0
- package/lib/forms/abstract.form.d.ts +3 -1
- package/lib/forms/bank/bank-account/bank-account-add-manual.form.d.ts +1 -3
- package/lib/forms/bank/bank-account/bank-account-allocation.form.d.ts +4 -2
- package/lib/forms/sole/index.d.ts +2 -0
- package/lib/forms/sole/sole-business-allocations.form.d.ts +1 -0
- package/lib/forms/sole/sole-invoice-item.form.d.ts +10 -0
- package/lib/forms/sole/sole-invoice-template.form.d.ts +3 -2
- package/lib/forms/sole/sole-invoice.form.d.ts +14 -0
- package/lib/forms/vehicle/vehicle-claim-details.form.d.ts +1 -6
- package/lib/forms/vehicle/vehicle-claim.form.d.ts +3 -0
- package/lib/forms/vehicle/vehicle-logbook.form.d.ts +4 -0
- package/lib/models/bank/bank-account.d.ts +2 -0
- package/lib/models/chart-accounts/chart-accounts.d.ts +6 -6
- package/lib/models/financial-year/financial-year.d.ts +1 -0
- package/lib/models/sole/sole-details.d.ts +2 -0
- package/lib/models/sole/sole-invoice-item.d.ts +2 -0
- package/lib/models/sole/sole-invoice-template.d.ts +5 -1
- package/lib/models/sole/sole-invoice.d.ts +12 -0
- package/lib/models/transaction/transaction.d.ts +2 -2
- package/lib/models/vehicle/logbook-period.d.ts +1 -0
- package/lib/models/vehicle/vehicle-claim-details.d.ts +8 -2
- package/lib/models/vehicle/vehicle-claim.d.ts +6 -4
- package/lib/models/vehicle/vehicle-logbook.d.ts +8 -4
- package/lib/services/affiliate/rewardful/rewardful.service.d.ts +13 -0
- package/lib/services/http/sole/index.d.ts +1 -0
- package/lib/services/http/sole/sole-invoice/sole-invoice.service.d.ts +11 -0
- package/lib/services/index.d.ts +1 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('class-transformer'), require('@auth0/angular-jwt'), require('lodash/get'), require('lodash/last'), require('lodash/flatten'), require('lodash/hasIn'), require('lodash/first'), require('moment'), require('moment-range'), require('lodash/uniqBy'), require('lodash/concat'), require('rxjs/internal/observable/throwError'), require('lodash/cloneDeep'), require('lodash/compact'), require('@angular/forms'), require('lodash/isEqual'), require('lodash/fromPairs'), require('lodash'), require('event-source-polyfill/src/eventsource.min.js'), require('@angular/router'), require('lodash/clone'), require('html2pdf.js'), require('jspdf'), require('jspdf-autotable'), require('@stripe/stripe-js'), require('xlsx'), require('file-saver')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define('taxtank-core', ['exports', '@angular/core', '@angular/common', '@angular/common/http', 'rxjs', 'rxjs/operators', 'class-transformer', '@auth0/angular-jwt', 'lodash/get', 'lodash/last', 'lodash/flatten', 'lodash/hasIn', 'lodash/first', 'moment', 'moment-range', 'lodash/uniqBy', 'lodash/concat', 'rxjs/internal/observable/throwError', 'lodash/cloneDeep', 'lodash/compact', '@angular/forms', 'lodash/isEqual', 'lodash/fromPairs', 'lodash', 'event-source-polyfill/src/eventsource.min.js', '@angular/router', 'lodash/clone', 'html2pdf.js', 'jspdf', 'jspdf-autotable', '@stripe/stripe-js', 'xlsx', 'file-saver'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["taxtank-core"] = {}, global.ng.core, global.ng.common, global.ng.common.http, global.rxjs, global.rxjs.operators, global.classTransformer, global.angularJwt, global.get, global.last, global.flatten, global.hasIn, global.first, global.moment, global.momentRange, global.uniqBy, global.concat, global.rxjs["internal/observable/throwError"], global.cloneDeep$1, global.compact, global.ng.forms, global.isEqual, global.fromPairs, global._, global.eventsource_min_js, global.ng.router, global.clone, global.html2pdf, global.jsPDF, global.autoTable, global.stripeJs, global.xlsx, global.FileSaver));
|
|
5
|
-
})(this, (function (exports, i0, i1$1, i1, rxjs, operators, classTransformer, angularJwt, get, last, flatten, hasIn, first, moment, momentRange, uniqBy, concat, throwError, cloneDeep$1, compact, forms, isEqual, fromPairs, _, eventsource_min_js, i1$2, clone, html2pdf, jsPDF, autoTable, stripeJs, xlsx, FileSaver) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["taxtank-core"] = {}, global.ng.core, global.ng.common, global.ng.common.http, global.rxjs, global.rxjs.operators, global.classTransformer, global.angularJwt, global.get, global.last, global.flatten, global.hasIn, global.first, global.moment$1, global.momentRange, global.uniqBy, global.concat, global.rxjs["internal/observable/throwError"], global.cloneDeep$1, global.compact, global.ng.forms, global.isEqual, global.fromPairs, global._, global.eventsource_min_js, global.ng.router, global.clone, global.html2pdf, global.jsPDF, global.autoTable, global.stripeJs, global.xlsx, global.FileSaver));
|
|
5
|
+
})(this, (function (exports, i0, i1$1, i1, rxjs, operators, classTransformer, angularJwt, get, last, flatten, hasIn, first, moment$1, momentRange, uniqBy, concat, throwError, cloneDeep$1, compact, forms, isEqual, fromPairs, _, eventsource_min_js, i1$2, clone, html2pdf, jsPDF, autoTable, stripeJs, xlsx, FileSaver) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
var flatten__default = /*#__PURE__*/_interopDefaultLegacy(flatten);
|
|
33
33
|
var hasIn__default = /*#__PURE__*/_interopDefaultLegacy(hasIn);
|
|
34
34
|
var first__default = /*#__PURE__*/_interopDefaultLegacy(first);
|
|
35
|
-
var moment__namespace = /*#__PURE__*/_interopNamespace(moment);
|
|
35
|
+
var moment__namespace = /*#__PURE__*/_interopNamespace(moment$1);
|
|
36
36
|
var uniqBy__default = /*#__PURE__*/_interopDefaultLegacy(uniqBy);
|
|
37
37
|
var concat__default = /*#__PURE__*/_interopDefaultLegacy(concat);
|
|
38
38
|
var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep$1);
|
|
@@ -1059,6 +1059,10 @@
|
|
|
1059
1059
|
SOLE_BUSINESSES_PUT: new Endpoint('PUT', '\\/sole-businesses\\/\\d+'),
|
|
1060
1060
|
SOLE_DEPRECIATION_METHODS_GET: new Endpoint('GET', '\\/sole-depreciation-methods'),
|
|
1061
1061
|
SOLE_DEPRECIATION_METHODS_PUT: new Endpoint('PUT', '\\/sole-depreciation-methods\\/\\d+'),
|
|
1062
|
+
SOLE_INVOICES_GET: new Endpoint('GET', '\\/sole-invoices'),
|
|
1063
|
+
SOLE_INVOICES_POST: new Endpoint('POST', '\\/sole-invoices'),
|
|
1064
|
+
SOLE_INVOICES_PUT: new Endpoint('PUT', '\\/sole-invoices\\/\\d+'),
|
|
1065
|
+
SOLE_INVOICES_DELETE: new Endpoint('DELETE', '\\/sole-invoices\\/\\d+'),
|
|
1062
1066
|
SOLE_INVOICE_TEMPLATES_GET: new Endpoint('GET', '\\/sole-invoice-templates'),
|
|
1063
1067
|
SOLE_INVOICE_TEMPLATES_POST: new Endpoint('POST', '\\/sole-invoice-templates'),
|
|
1064
1068
|
SOLE_INVOICE_TEMPLATES_PUT: new Endpoint('PUT', '\\/sole-invoice-templates\\/\\d+'),
|
|
@@ -1674,6 +1678,7 @@
|
|
|
1674
1678
|
};
|
|
1675
1679
|
return FinancialYear;
|
|
1676
1680
|
}());
|
|
1681
|
+
FinancialYear.weeksInYear = 52;
|
|
1677
1682
|
FinancialYear.startMonthIndex = 6;
|
|
1678
1683
|
|
|
1679
1684
|
/**
|
|
@@ -2983,26 +2988,26 @@
|
|
|
2983
2988
|
return this.name;
|
|
2984
2989
|
};
|
|
2985
2990
|
/**
|
|
2986
|
-
* Check if chart accounts id is related for '
|
|
2991
|
+
* Check if chart accounts id is related for 'Kms travelled for work' category
|
|
2987
2992
|
*/
|
|
2988
|
-
ChartAccounts.prototype.
|
|
2993
|
+
ChartAccounts.prototype.isKmsForWork = function () {
|
|
2989
2994
|
return this.id === exports.ChartAccountsListEnum.KLMS_TRAVELLED_FOR_WORK;
|
|
2990
2995
|
};
|
|
2991
2996
|
/**
|
|
2992
|
-
* Check if chart accounts id is related for '
|
|
2997
|
+
* Check if chart accounts id is related for 'Kms travelled for sole' category
|
|
2993
2998
|
*/
|
|
2994
|
-
ChartAccounts.prototype.
|
|
2999
|
+
ChartAccounts.prototype.isKmsForSole = function () {
|
|
2995
3000
|
return this.id === exports.ChartAccountsListEnum.KLMS_TRAVELLED;
|
|
2996
3001
|
};
|
|
2997
3002
|
/**
|
|
2998
|
-
* Check if accounts id is related for
|
|
3003
|
+
* Check if accounts id is related for KMs category related to passed tank type
|
|
2999
3004
|
*/
|
|
3000
|
-
ChartAccounts.prototype.
|
|
3005
|
+
ChartAccounts.prototype.isKMsByTankType = function (tankType) {
|
|
3001
3006
|
switch (tankType) {
|
|
3002
3007
|
case exports.TankTypeEnum.WORK:
|
|
3003
|
-
return this.
|
|
3008
|
+
return this.isKmsForWork();
|
|
3004
3009
|
case exports.TankTypeEnum.SOLE:
|
|
3005
|
-
return this.
|
|
3010
|
+
return this.isKmsForSole();
|
|
3006
3011
|
default:
|
|
3007
3012
|
return false;
|
|
3008
3013
|
}
|
|
@@ -3125,8 +3130,17 @@
|
|
|
3125
3130
|
var SoleInvoiceItem = /** @class */ (function (_super) {
|
|
3126
3131
|
__extends(SoleInvoiceItem, _super);
|
|
3127
3132
|
function SoleInvoiceItem() {
|
|
3128
|
-
|
|
3133
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
3134
|
+
_this.isGST = false;
|
|
3135
|
+
return _this;
|
|
3129
3136
|
}
|
|
3137
|
+
Object.defineProperty(SoleInvoiceItem.prototype, "amount", {
|
|
3138
|
+
get: function () {
|
|
3139
|
+
return this.price * this.quantity;
|
|
3140
|
+
},
|
|
3141
|
+
enumerable: false,
|
|
3142
|
+
configurable: true
|
|
3143
|
+
});
|
|
3130
3144
|
return SoleInvoiceItem;
|
|
3131
3145
|
}(SoleInvoiceItem$1));
|
|
3132
3146
|
__decorate([
|
|
@@ -3187,13 +3201,28 @@
|
|
|
3187
3201
|
return SoleInvoiceTemplate;
|
|
3188
3202
|
}(AbstractModel));
|
|
3189
3203
|
|
|
3204
|
+
exports.SoleInvoiceTemplateTaxTypeEnum = void 0;
|
|
3205
|
+
(function (SoleInvoiceTemplateTaxTypeEnum) {
|
|
3206
|
+
SoleInvoiceTemplateTaxTypeEnum[SoleInvoiceTemplateTaxTypeEnum["EXCLUSIVE"] = 0] = "EXCLUSIVE";
|
|
3207
|
+
SoleInvoiceTemplateTaxTypeEnum[SoleInvoiceTemplateTaxTypeEnum["INCLUSIVE"] = 1] = "INCLUSIVE";
|
|
3208
|
+
SoleInvoiceTemplateTaxTypeEnum[SoleInvoiceTemplateTaxTypeEnum["NONE"] = 2] = "NONE";
|
|
3209
|
+
})(exports.SoleInvoiceTemplateTaxTypeEnum || (exports.SoleInvoiceTemplateTaxTypeEnum = {}));
|
|
3210
|
+
|
|
3190
3211
|
var SoleInvoiceTemplate = /** @class */ (function (_super) {
|
|
3191
3212
|
__extends(SoleInvoiceTemplate, _super);
|
|
3192
3213
|
function SoleInvoiceTemplate() {
|
|
3193
|
-
|
|
3214
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
3215
|
+
_this.taxType = exports.SoleInvoiceTemplateTaxTypeEnum.NONE;
|
|
3216
|
+
return _this;
|
|
3194
3217
|
}
|
|
3195
|
-
SoleInvoiceTemplate.
|
|
3196
|
-
return
|
|
3218
|
+
SoleInvoiceTemplate.prototype.isNoTax = function () {
|
|
3219
|
+
return this.taxType === exports.SoleInvoiceTemplateTaxTypeEnum.NONE;
|
|
3220
|
+
};
|
|
3221
|
+
SoleInvoiceTemplate.prototype.isTaxExclusive = function () {
|
|
3222
|
+
return this.taxType === exports.SoleInvoiceTemplateTaxTypeEnum.EXCLUSIVE;
|
|
3223
|
+
};
|
|
3224
|
+
SoleInvoiceTemplate.prototype.isTaxInclusive = function () {
|
|
3225
|
+
return this.taxType === exports.SoleInvoiceTemplateTaxTypeEnum.INCLUSIVE;
|
|
3197
3226
|
};
|
|
3198
3227
|
return SoleInvoiceTemplate;
|
|
3199
3228
|
}(SoleInvoiceTemplate$1));
|
|
@@ -3204,11 +3233,105 @@
|
|
|
3204
3233
|
classTransformer.Type(function () { return BankAccount; })
|
|
3205
3234
|
], SoleInvoiceTemplate.prototype, "bankAccount", void 0);
|
|
3206
3235
|
|
|
3236
|
+
exports.SoleInvoiceStatusesEnum = void 0;
|
|
3237
|
+
(function (SoleInvoiceStatusesEnum) {
|
|
3238
|
+
SoleInvoiceStatusesEnum[SoleInvoiceStatusesEnum["CANCELED"] = 0] = "CANCELED";
|
|
3239
|
+
SoleInvoiceStatusesEnum[SoleInvoiceStatusesEnum["DRAFT"] = 1] = "DRAFT";
|
|
3240
|
+
SoleInvoiceStatusesEnum[SoleInvoiceStatusesEnum["PENDING"] = 2] = "PENDING";
|
|
3241
|
+
SoleInvoiceStatusesEnum[SoleInvoiceStatusesEnum["PAID"] = 3] = "PAID";
|
|
3242
|
+
})(exports.SoleInvoiceStatusesEnum || (exports.SoleInvoiceStatusesEnum = {}));
|
|
3243
|
+
|
|
3244
|
+
var SoleDetails$1 = /** @class */ (function (_super) {
|
|
3245
|
+
__extends(SoleDetails, _super);
|
|
3246
|
+
function SoleDetails() {
|
|
3247
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3248
|
+
}
|
|
3249
|
+
return SoleDetails;
|
|
3250
|
+
}(AbstractModel));
|
|
3251
|
+
|
|
3252
|
+
var SoleDetails = /** @class */ (function (_super) {
|
|
3253
|
+
__extends(SoleDetails, _super);
|
|
3254
|
+
function SoleDetails() {
|
|
3255
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3256
|
+
}
|
|
3257
|
+
return SoleDetails;
|
|
3258
|
+
}(SoleDetails$1));
|
|
3259
|
+
SoleDetails.GSTPercentMultiplier = 0.1;
|
|
3260
|
+
SoleDetails.GSTPercentDivider = 11;
|
|
3261
|
+
__decorate([
|
|
3262
|
+
classTransformer.Type(function () { return User; })
|
|
3263
|
+
], SoleDetails.prototype, "user", void 0);
|
|
3264
|
+
|
|
3207
3265
|
var SoleInvoice = /** @class */ (function (_super) {
|
|
3208
3266
|
__extends(SoleInvoice, _super);
|
|
3209
3267
|
function SoleInvoice() {
|
|
3210
|
-
|
|
3268
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
3269
|
+
_this.items = [classTransformer.plainToClass(SoleInvoiceItem, {})];
|
|
3270
|
+
_this.status = exports.SoleInvoiceStatusesEnum.DRAFT;
|
|
3271
|
+
return _this;
|
|
3211
3272
|
}
|
|
3273
|
+
Object.defineProperty(SoleInvoice.prototype, "amount", {
|
|
3274
|
+
get: function () {
|
|
3275
|
+
return this.items.reduce(function (sum, item) { return sum + item.amount; }, 0);
|
|
3276
|
+
},
|
|
3277
|
+
enumerable: false,
|
|
3278
|
+
configurable: true
|
|
3279
|
+
});
|
|
3280
|
+
SoleInvoice.prototype.getGSTItems = function () {
|
|
3281
|
+
return this.items.filter(function (item) { return item.isGST; });
|
|
3282
|
+
};
|
|
3283
|
+
SoleInvoice.prototype.getGSTItemsAmount = function () {
|
|
3284
|
+
return this.getGSTItems().reduce(function (sum, item) { return sum + item.amount; }, 0);
|
|
3285
|
+
};
|
|
3286
|
+
Object.defineProperty(SoleInvoice.prototype, "subtotal", {
|
|
3287
|
+
get: function () {
|
|
3288
|
+
var _a;
|
|
3289
|
+
if ((_a = this.template) === null || _a === void 0 ? void 0 : _a.isTaxInclusive()) {
|
|
3290
|
+
return this.amount - this.GSTAmount;
|
|
3291
|
+
}
|
|
3292
|
+
return this.amount;
|
|
3293
|
+
},
|
|
3294
|
+
enumerable: false,
|
|
3295
|
+
configurable: true
|
|
3296
|
+
});
|
|
3297
|
+
Object.defineProperty(SoleInvoice.prototype, "GSTAmount", {
|
|
3298
|
+
get: function () {
|
|
3299
|
+
var _a, _b;
|
|
3300
|
+
switch (true) {
|
|
3301
|
+
case (_a = this.template) === null || _a === void 0 ? void 0 : _a.isTaxInclusive():
|
|
3302
|
+
return +(this.getGSTItemsAmount() / SoleDetails.GSTPercentDivider).toFixed(2);
|
|
3303
|
+
case (_b = this.template) === null || _b === void 0 ? void 0 : _b.isTaxExclusive():
|
|
3304
|
+
return +(this.getGSTItemsAmount() * SoleDetails.GSTPercentMultiplier).toFixed(2);
|
|
3305
|
+
default:
|
|
3306
|
+
return 0;
|
|
3307
|
+
}
|
|
3308
|
+
},
|
|
3309
|
+
enumerable: false,
|
|
3310
|
+
configurable: true
|
|
3311
|
+
});
|
|
3312
|
+
Object.defineProperty(SoleInvoice.prototype, "total", {
|
|
3313
|
+
get: function () {
|
|
3314
|
+
var _a;
|
|
3315
|
+
if ((_a = this.template) === null || _a === void 0 ? void 0 : _a.isTaxExclusive()) {
|
|
3316
|
+
return this.amount + this.GSTAmount;
|
|
3317
|
+
}
|
|
3318
|
+
return this.amount;
|
|
3319
|
+
},
|
|
3320
|
+
enumerable: false,
|
|
3321
|
+
configurable: true
|
|
3322
|
+
});
|
|
3323
|
+
SoleInvoice.prototype.isDraft = function () {
|
|
3324
|
+
return this.status === exports.SoleInvoiceStatusesEnum.DRAFT;
|
|
3325
|
+
};
|
|
3326
|
+
SoleInvoice.prototype.isCancelled = function () {
|
|
3327
|
+
return this.status === exports.SoleInvoiceStatusesEnum.CANCELED;
|
|
3328
|
+
};
|
|
3329
|
+
SoleInvoice.prototype.isPending = function () {
|
|
3330
|
+
return this.status === exports.SoleInvoiceStatusesEnum.PENDING;
|
|
3331
|
+
};
|
|
3332
|
+
SoleInvoice.prototype.isPaid = function () {
|
|
3333
|
+
return this.status === exports.SoleInvoiceStatusesEnum.PAID;
|
|
3334
|
+
};
|
|
3212
3335
|
return SoleInvoice;
|
|
3213
3336
|
}(SoleInvoice$1));
|
|
3214
3337
|
__decorate([
|
|
@@ -3236,6 +3359,7 @@
|
|
|
3236
3359
|
/**
|
|
3237
3360
|
* Class contains traveled kilometers and work usage percent in 12 weeks date range
|
|
3238
3361
|
* @TODO Vik: Best period: move this and related logic to backend
|
|
3362
|
+
* @TODO Alex: check if we need this class when calculation refactored with backend
|
|
3239
3363
|
*/
|
|
3240
3364
|
var LogbookPeriod = /** @class */ (function () {
|
|
3241
3365
|
function LogbookPeriod() {
|
|
@@ -3272,6 +3396,7 @@
|
|
|
3272
3396
|
return VehicleLogbook;
|
|
3273
3397
|
}(AbstractModel));
|
|
3274
3398
|
|
|
3399
|
+
var moment = momentRange.extendMoment(moment__namespace);
|
|
3275
3400
|
var VehicleLogbook = /** @class */ (function (_super) {
|
|
3276
3401
|
__extends(VehicleLogbook, _super);
|
|
3277
3402
|
function VehicleLogbook() {
|
|
@@ -3297,14 +3422,19 @@
|
|
|
3297
3422
|
VehicleLogbook.prototype.isSoleTank = function () {
|
|
3298
3423
|
return !!this.business;
|
|
3299
3424
|
};
|
|
3425
|
+
/**
|
|
3426
|
+
* Get logbook period date range from logbook date and weeksInPeriod duration
|
|
3427
|
+
*/
|
|
3428
|
+
VehicleLogbook.prototype.getPeriod = function () {
|
|
3429
|
+
return moment.rangeFromInterval('weeks', VehicleLogbook.bestPeriodWeeks, this.date);
|
|
3430
|
+
};
|
|
3300
3431
|
return VehicleLogbook;
|
|
3301
3432
|
}(VehicleLogbook$1));
|
|
3302
3433
|
/**
|
|
3303
|
-
*
|
|
3304
|
-
*
|
|
3305
|
-
* The logbook period is a minimum continuous period of 12 weeks." © Nicole Kelly
|
|
3434
|
+
* Logbook period duration in weeks.
|
|
3435
|
+
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/211517441/Logbook+Vehicle
|
|
3306
3436
|
*/
|
|
3307
|
-
VehicleLogbook.
|
|
3437
|
+
VehicleLogbook.bestPeriodWeeks = 12;
|
|
3308
3438
|
__decorate([
|
|
3309
3439
|
classTransformer.Type(function () { return Date; })
|
|
3310
3440
|
], VehicleLogbook.prototype, "date", void 0);
|
|
@@ -3348,22 +3478,21 @@
|
|
|
3348
3478
|
var VehicleClaimDetails = /** @class */ (function (_super) {
|
|
3349
3479
|
__extends(VehicleClaimDetails, _super);
|
|
3350
3480
|
function VehicleClaimDetails() {
|
|
3351
|
-
|
|
3481
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
3482
|
+
/**
|
|
3483
|
+
* Init default values for the new instances
|
|
3484
|
+
*/
|
|
3485
|
+
_this.isManual = true;
|
|
3486
|
+
_this.method = exports.VehicleClaimDetailsMethodEnum.KMS;
|
|
3487
|
+
_this.financialYear = new FinancialYear().year;
|
|
3488
|
+
return _this;
|
|
3352
3489
|
}
|
|
3353
3490
|
VehicleClaimDetails.prototype.isLogbookMethod = function () {
|
|
3354
3491
|
return this.method === exports.VehicleClaimDetailsMethodEnum.LOGBOOK;
|
|
3355
3492
|
};
|
|
3356
|
-
VehicleClaimDetails.prototype.
|
|
3493
|
+
VehicleClaimDetails.prototype.isKmsMethod = function () {
|
|
3357
3494
|
return this.method === exports.VehicleClaimDetailsMethodEnum.KMS;
|
|
3358
3495
|
};
|
|
3359
|
-
// @TODO Alex: discuss with Vik and think about abstract method in AbstractModel
|
|
3360
|
-
VehicleClaimDetails.create = function () {
|
|
3361
|
-
return classTransformer.plainToClass(VehicleClaimDetails, {
|
|
3362
|
-
isManual: true,
|
|
3363
|
-
method: exports.VehicleClaimDetailsMethodEnum.KMS,
|
|
3364
|
-
financialYear: new FinancialYear().year
|
|
3365
|
-
});
|
|
3366
|
-
};
|
|
3367
3496
|
return VehicleClaimDetails;
|
|
3368
3497
|
}(VehicleClaimDetails$1));
|
|
3369
3498
|
__decorate([
|
|
@@ -3373,7 +3502,10 @@
|
|
|
3373
3502
|
var VehicleClaim = /** @class */ (function (_super) {
|
|
3374
3503
|
__extends(VehicleClaim, _super);
|
|
3375
3504
|
function VehicleClaim() {
|
|
3376
|
-
|
|
3505
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
3506
|
+
_this.kilometers = 0;
|
|
3507
|
+
_this.workUsage = 0;
|
|
3508
|
+
return _this;
|
|
3377
3509
|
}
|
|
3378
3510
|
VehicleClaim.prototype.isWorkTank = function () {
|
|
3379
3511
|
return !this.business;
|
|
@@ -3389,9 +3521,9 @@
|
|
|
3389
3521
|
configurable: true
|
|
3390
3522
|
});
|
|
3391
3523
|
/**
|
|
3392
|
-
* Claim amount for
|
|
3524
|
+
* Claim amount for KMs method. Exists only for KMs method.
|
|
3393
3525
|
*/
|
|
3394
|
-
VehicleClaim.prototype.
|
|
3526
|
+
VehicleClaim.prototype.getKMSClaimAmount = function (vehicleClaimRate) {
|
|
3395
3527
|
return +(this.kilometers * vehicleClaimRate).toFixed(2);
|
|
3396
3528
|
};
|
|
3397
3529
|
/**
|
|
@@ -3406,20 +3538,14 @@
|
|
|
3406
3538
|
// Math.abs because amount will be negative (because we sum expenses), but we don't want negative percent value
|
|
3407
3539
|
return Math.abs(transactionsAmount) * this.workUsage / 100;
|
|
3408
3540
|
};
|
|
3409
|
-
VehicleClaim.prototype.
|
|
3410
|
-
|
|
3541
|
+
VehicleClaim.prototype.getAverageWeeklyKMS = function () {
|
|
3542
|
+
return this.kilometers / FinancialYear.weeksInYear;
|
|
3543
|
+
};
|
|
3544
|
+
VehicleClaim.getKMSChartAccountsIdByTankType = function (tankType) {
|
|
3411
3545
|
return tankType === exports.TankTypeEnum.WORK
|
|
3412
3546
|
? exports.ChartAccountsListEnum.KLMS_TRAVELLED_FOR_WORK
|
|
3413
3547
|
: exports.ChartAccountsListEnum.KLMS_TRAVELLED;
|
|
3414
3548
|
};
|
|
3415
|
-
VehicleClaim.create = function (details, business) {
|
|
3416
|
-
return classTransformer.plainToClass(VehicleClaim, {
|
|
3417
|
-
kilometers: 0,
|
|
3418
|
-
workUsage: 0,
|
|
3419
|
-
details: details,
|
|
3420
|
-
business: business
|
|
3421
|
-
});
|
|
3422
|
-
};
|
|
3423
3549
|
return VehicleClaim;
|
|
3424
3550
|
}(VehicleClaim$1));
|
|
3425
3551
|
/**
|
|
@@ -3521,6 +3647,7 @@
|
|
|
3521
3647
|
(function (DepreciationCalculationEnum) {
|
|
3522
3648
|
DepreciationCalculationEnum[DepreciationCalculationEnum["PRIME_COST"] = 1] = "PRIME_COST";
|
|
3523
3649
|
DepreciationCalculationEnum[DepreciationCalculationEnum["DIMINISHING"] = 2] = "DIMINISHING";
|
|
3650
|
+
DepreciationCalculationEnum[DepreciationCalculationEnum["CAPITAL"] = 3] = "CAPITAL";
|
|
3524
3651
|
DepreciationCalculationEnum[DepreciationCalculationEnum["LVP"] = 4] = "LVP";
|
|
3525
3652
|
DepreciationCalculationEnum[DepreciationCalculationEnum["AMORTISATION"] = 5] = "AMORTISATION";
|
|
3526
3653
|
DepreciationCalculationEnum[DepreciationCalculationEnum["SBP"] = 6] = "SBP";
|
|
@@ -4057,9 +4184,9 @@
|
|
|
4057
4184
|
enumerable: false,
|
|
4058
4185
|
configurable: true
|
|
4059
4186
|
});
|
|
4060
|
-
Object.defineProperty(Transaction.prototype, "
|
|
4187
|
+
Object.defineProperty(Transaction.prototype, "isKmsChartAccountsCategory", {
|
|
4061
4188
|
/**
|
|
4062
|
-
* Check if transaction has '
|
|
4189
|
+
* Check if transaction has 'Kms travelled for work' chart accounts category
|
|
4063
4190
|
*/
|
|
4064
4191
|
get: function () {
|
|
4065
4192
|
return this.chartAccounts.id === exports.ChartAccountsListEnum.KLMS_TRAVELLED_FOR_WORK;
|
|
@@ -4580,25 +4707,6 @@
|
|
|
4580
4707
|
return SoleDepreciationMethod;
|
|
4581
4708
|
}(SoleDepreciationMethod$1));
|
|
4582
4709
|
|
|
4583
|
-
var SoleDetails$1 = /** @class */ (function (_super) {
|
|
4584
|
-
__extends(SoleDetails, _super);
|
|
4585
|
-
function SoleDetails() {
|
|
4586
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
4587
|
-
}
|
|
4588
|
-
return SoleDetails;
|
|
4589
|
-
}(AbstractModel));
|
|
4590
|
-
|
|
4591
|
-
var SoleDetails = /** @class */ (function (_super) {
|
|
4592
|
-
__extends(SoleDetails, _super);
|
|
4593
|
-
function SoleDetails() {
|
|
4594
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
4595
|
-
}
|
|
4596
|
-
return SoleDetails;
|
|
4597
|
-
}(SoleDetails$1));
|
|
4598
|
-
__decorate([
|
|
4599
|
-
classTransformer.Type(function () { return User; })
|
|
4600
|
-
], SoleDetails.prototype, "user", void 0);
|
|
4601
|
-
|
|
4602
4710
|
var User = /** @class */ (function (_super) {
|
|
4603
4711
|
__extends(User, _super);
|
|
4604
4712
|
function User() {
|
|
@@ -5474,6 +5582,13 @@
|
|
|
5474
5582
|
function BankAccount() {
|
|
5475
5583
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
5476
5584
|
}
|
|
5585
|
+
Object.defineProperty(BankAccount.prototype, "bank", {
|
|
5586
|
+
get: function () {
|
|
5587
|
+
return this.bankConnection.bank;
|
|
5588
|
+
},
|
|
5589
|
+
enumerable: false,
|
|
5590
|
+
configurable: true
|
|
5591
|
+
});
|
|
5477
5592
|
/**
|
|
5478
5593
|
* Get current opening balance amount
|
|
5479
5594
|
*/
|
|
@@ -6150,9 +6265,8 @@
|
|
|
6150
6265
|
}
|
|
6151
6266
|
/**
|
|
6152
6267
|
* Get remaining kilometers limit. Total limit ({@link VehicleClaim.totalKmsLimit}) - claimed kilometers from other vehicle claims
|
|
6153
|
-
* @param claim may not exist when user come to vehicle claim page 1st time and not created claim yet
|
|
6154
6268
|
*/
|
|
6155
|
-
VehicleClaimCollection.prototype.
|
|
6269
|
+
VehicleClaimCollection.prototype.getKmsLimitForClaim = function (claim) {
|
|
6156
6270
|
var collection = this;
|
|
6157
6271
|
if (claim) {
|
|
6158
6272
|
collection = collection.removeBy('id', claim.id);
|
|
@@ -6161,7 +6275,6 @@
|
|
|
6161
6275
|
};
|
|
6162
6276
|
/**
|
|
6163
6277
|
* Get remaining work usage limit. Total limit ({@link VehicleClaim.totalWorkUsagePercent}) - claimed percent from other vehicle claims
|
|
6164
|
-
* @param claim may not exist when user come to vehicle claim page 1st time and not created claim yet
|
|
6165
6278
|
*/
|
|
6166
6279
|
VehicleClaimCollection.prototype.getWorkUsageLimitForClaim = function (claim) {
|
|
6167
6280
|
var collection = this;
|
|
@@ -6179,14 +6292,14 @@
|
|
|
6179
6292
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
6180
6293
|
}
|
|
6181
6294
|
/**
|
|
6182
|
-
* Best period may be calculated only when user has logbooks minimum for
|
|
6295
|
+
* Best period may be calculated only when user has logbooks minimum for VehicleLogbook.bestPeriodWeeks
|
|
6183
6296
|
* @TODO Vik: Best period: move this and related logic to backend
|
|
6184
6297
|
*/
|
|
6185
6298
|
VehicleLogbookCollection.prototype.isBestPeriodExist = function () {
|
|
6186
6299
|
if (this.items.length < 2) {
|
|
6187
6300
|
return false;
|
|
6188
6301
|
}
|
|
6189
|
-
return VehicleLogbook.
|
|
6302
|
+
return VehicleLogbook.bestPeriodWeeks < (this.last.date.getTime() - this.first.date.getTime());
|
|
6190
6303
|
};
|
|
6191
6304
|
/**
|
|
6192
6305
|
* Get collection of non-personal logbooks (work-related, sole-related).
|
|
@@ -6196,15 +6309,14 @@
|
|
|
6196
6309
|
return this.filterBy('isPersonal', false);
|
|
6197
6310
|
};
|
|
6198
6311
|
/**
|
|
6199
|
-
* Logbook Period
|
|
6200
|
-
* Best period duration is defined as
|
|
6312
|
+
* Get Logbook Period with the biggest work usage percent
|
|
6313
|
+
* Best period duration is defined as VehicleLogbook.bestPeriodWeeks by the ATO
|
|
6201
6314
|
* @TODO Vik: Best period: move this and related logic to backend
|
|
6202
6315
|
*/
|
|
6203
6316
|
VehicleLogbookCollection.prototype.getBestPeriod = function () {
|
|
6204
6317
|
if (!this.isBestPeriodExist()) {
|
|
6205
6318
|
return null;
|
|
6206
6319
|
}
|
|
6207
|
-
// declare best period variable
|
|
6208
6320
|
var bestPeriod;
|
|
6209
6321
|
// get list of all logbooks available for best period calculation
|
|
6210
6322
|
var claimableLogbooks = this.getClaimableLogbooks().toArray();
|
|
@@ -6214,12 +6326,12 @@
|
|
|
6214
6326
|
break;
|
|
6215
6327
|
}
|
|
6216
6328
|
// get date range started from current handling logbook date
|
|
6217
|
-
var dateRange =
|
|
6329
|
+
var dateRange = claimableLogbooks[i].getPeriod();
|
|
6218
6330
|
// get all logbooks included in current logbook period
|
|
6219
|
-
var logbooksInRange = this.filterByRange('date', dateRange.
|
|
6331
|
+
var logbooksInRange = this.filterByRange('date', dateRange.start, dateRange.end);
|
|
6220
6332
|
var currentPeriod = classTransformer.plainToClass(LogbookPeriod, {
|
|
6221
|
-
from: dateRange.
|
|
6222
|
-
to: dateRange.
|
|
6333
|
+
from: dateRange.start,
|
|
6334
|
+
to: dateRange.end,
|
|
6223
6335
|
kilometers: logbooksInRange.getClaimableLogbooks().kilometers,
|
|
6224
6336
|
workUsage: logbooksInRange.getWorkUsage(),
|
|
6225
6337
|
logbooks: logbooksInRange
|
|
@@ -6257,28 +6369,15 @@
|
|
|
6257
6369
|
var workKilometers = this.getClaimableLogbooks().kilometers;
|
|
6258
6370
|
return Math.round(workKilometers / this.kilometers * 100);
|
|
6259
6371
|
};
|
|
6260
|
-
/**
|
|
6261
|
-
* Get LOGBOOK_PERIOD_DURATION date range from passed start date
|
|
6262
|
-
* @TODO Vik: Best period: move this and related logic to backend
|
|
6263
|
-
*/
|
|
6264
|
-
VehicleLogbookCollection.prototype.getPeriodRange = function (from) {
|
|
6265
|
-
// set end date as VehicleLogbook.periodDuration after start date
|
|
6266
|
-
var to = new Date(from.getTime() + VehicleLogbook.periodDuration);
|
|
6267
|
-
var financialYear = new FinancialYear();
|
|
6268
|
-
// set as period last VehicleLogbook.periodDuration of current year if period end date after end of current year
|
|
6269
|
-
if (to > financialYear.endDate) {
|
|
6270
|
-
to = financialYear.endDate;
|
|
6271
|
-
from = new Date(to.getTime() - VehicleLogbook.periodDuration);
|
|
6272
|
-
}
|
|
6273
|
-
return { from: from, to: to };
|
|
6274
|
-
};
|
|
6275
6372
|
/**
|
|
6276
6373
|
* Get list of logbooks related to passed vehicle claim
|
|
6277
6374
|
*/
|
|
6278
|
-
VehicleLogbookCollection.prototype.getByVehicleClaim = function (
|
|
6279
|
-
return
|
|
6280
|
-
|
|
6281
|
-
|
|
6375
|
+
VehicleLogbookCollection.prototype.getByVehicleClaim = function (vehicleClaim) {
|
|
6376
|
+
return vehicleClaim.isSoleTank()
|
|
6377
|
+
// sole tank may have multiple vehicle claims, so we need to filter by business.id
|
|
6378
|
+
? this.filterBy('business.id', vehicleClaim.business.id)
|
|
6379
|
+
// work tank may have only one vehicle claim, so we need to filter by tank type
|
|
6380
|
+
: this.filterBy('tankType', exports.TankTypeEnum.WORK);
|
|
6282
6381
|
};
|
|
6283
6382
|
return VehicleLogbookCollection;
|
|
6284
6383
|
}(Collection));
|
|
@@ -6438,9 +6537,9 @@
|
|
|
6438
6537
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
6439
6538
|
}
|
|
6440
6539
|
/**
|
|
6441
|
-
* Get '
|
|
6540
|
+
* Get 'Kms travelled for work' related chart account value
|
|
6442
6541
|
*/
|
|
6443
|
-
ChartAccountsCollection.prototype.
|
|
6542
|
+
ChartAccountsCollection.prototype.getVehicleKmsRate = function (year) {
|
|
6444
6543
|
if (year === void 0) { year = new FinancialYear().year; }
|
|
6445
6544
|
return this.findBy('id', exports.ChartAccountsListEnum.KLMS_TRAVELLED_FOR_WORK).getValueByYear(year).value;
|
|
6446
6545
|
};
|
|
@@ -6801,6 +6900,9 @@
|
|
|
6801
6900
|
* Get list of vehicle transactions filtered by vehicle claim
|
|
6802
6901
|
*/
|
|
6803
6902
|
TransactionCollection.prototype.getByVehicleClaim = function (vehicleClaim) {
|
|
6903
|
+
if (!vehicleClaim) {
|
|
6904
|
+
return this.create([]);
|
|
6905
|
+
}
|
|
6804
6906
|
return vehicleClaim.isSoleTank()
|
|
6805
6907
|
// sole tank may have multiple vehicle claims, so we need to filter by business.id
|
|
6806
6908
|
? this.getVehicleTransactions().filterBy('business.id', vehicleClaim.business.id)
|
|
@@ -6808,7 +6910,7 @@
|
|
|
6808
6910
|
: this.getVehicleTransactions().filterBy('tankType', exports.TankTypeEnum.WORK);
|
|
6809
6911
|
};
|
|
6810
6912
|
/**
|
|
6811
|
-
* Get list of vehicle transactions except
|
|
6913
|
+
* Get list of vehicle transactions except KMS transactions
|
|
6812
6914
|
*/
|
|
6813
6915
|
TransactionCollection.prototype.getLogbookTransactions = function () {
|
|
6814
6916
|
return this
|
|
@@ -10176,7 +10278,7 @@
|
|
|
10176
10278
|
return 0;
|
|
10177
10279
|
};
|
|
10178
10280
|
MyTaxDeductions.prototype.setVehicleClaimData = function () {
|
|
10179
|
-
this.klmsMethodClaimAmount = this.vehicleClaim.
|
|
10281
|
+
this.klmsMethodClaimAmount = this.vehicleClaim.getKMSClaimAmount(this.vehicleClaimRate);
|
|
10180
10282
|
this.totalExpensesAmount = this.vehicleClaim.getLogbookClaimAmount(new TransactionCollection(__spreadArray(__spreadArray([], __read(this.transactions.getByTankType(this.vehicleClaim.tankType))), __read(this.depreciations.getByTankType(this.vehicleClaim.tankType).toTransactions().toArray()))));
|
|
10181
10283
|
};
|
|
10182
10284
|
/**
|
|
@@ -11173,6 +11275,26 @@
|
|
|
11173
11275
|
}] }];
|
|
11174
11276
|
} });
|
|
11175
11277
|
|
|
11278
|
+
var SoleInvoiceService = /** @class */ (function (_super) {
|
|
11279
|
+
__extends(SoleInvoiceService, _super);
|
|
11280
|
+
function SoleInvoiceService() {
|
|
11281
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
11282
|
+
_this.modelClass = SoleInvoice;
|
|
11283
|
+
_this.url = 'sole-invoices';
|
|
11284
|
+
_this.isHydra = true;
|
|
11285
|
+
return _this;
|
|
11286
|
+
}
|
|
11287
|
+
return SoleInvoiceService;
|
|
11288
|
+
}(RestService));
|
|
11289
|
+
SoleInvoiceService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleInvoiceService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
11290
|
+
SoleInvoiceService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleInvoiceService, providedIn: 'root' });
|
|
11291
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleInvoiceService, decorators: [{
|
|
11292
|
+
type: i0.Injectable,
|
|
11293
|
+
args: [{
|
|
11294
|
+
providedIn: 'root'
|
|
11295
|
+
}]
|
|
11296
|
+
}] });
|
|
11297
|
+
|
|
11176
11298
|
var SoleInvoiceTemplateService = /** @class */ (function (_super) {
|
|
11177
11299
|
__extends(SoleInvoiceTemplateService, _super);
|
|
11178
11300
|
function SoleInvoiceTemplateService() {
|
|
@@ -11248,10 +11370,7 @@
|
|
|
11248
11370
|
*/
|
|
11249
11371
|
VehicleClaimService.prototype.listenVehicleClaimDetailsChanges = function () {
|
|
11250
11372
|
var _this = this;
|
|
11251
|
-
this.eventDispatcherService.on(
|
|
11252
|
-
exports.AppEventTypeEnum.VEHICLE_CLAIM_DETAILS_CREATED,
|
|
11253
|
-
exports.AppEventTypeEnum.VEHICLE_CLAIM_DETAILS_UPDATED
|
|
11254
|
-
])
|
|
11373
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.VEHICLE_CLAIM_DETAILS_UPDATED)
|
|
11255
11374
|
.subscribe(function () {
|
|
11256
11375
|
_this.resetCache();
|
|
11257
11376
|
});
|
|
@@ -11278,14 +11397,17 @@
|
|
|
11278
11397
|
*/
|
|
11279
11398
|
VehicleClaimService.prototype.updateWorkUsage = function (bestPeriod) {
|
|
11280
11399
|
var _this = this;
|
|
11281
|
-
//
|
|
11282
|
-
|
|
11400
|
+
// no need to update if cache not exist
|
|
11401
|
+
if (!this.cache) {
|
|
11402
|
+
return;
|
|
11403
|
+
}
|
|
11404
|
+
// @TODO Vik (TT-2210): need batch endpoint for this update
|
|
11405
|
+
// @TODO Alex (TT-2210): fix frontend when endpoint ready
|
|
11283
11406
|
var batch$ = this.cache.map(function (claim) {
|
|
11284
11407
|
var claimToUpdate = classTransformer.plainToClass(VehicleClaim, Object.assign({}, claim, { workUsage: bestPeriod === null || bestPeriod === void 0 ? void 0 : bestPeriod.getWorkUsageByClaim(claim) }));
|
|
11285
11408
|
return _this.update(claimToUpdate);
|
|
11286
11409
|
});
|
|
11287
|
-
|
|
11288
|
-
rxjs.combineLatest(batch$).pipe(operators.take(1)).subscribe();
|
|
11410
|
+
rxjs.combineLatest(batch$).subscribe();
|
|
11289
11411
|
};
|
|
11290
11412
|
return VehicleClaimService;
|
|
11291
11413
|
}(RestService));
|
|
@@ -11364,11 +11486,12 @@
|
|
|
11364
11486
|
* @TODO Vik: Best period move this and related logic to backend
|
|
11365
11487
|
*/
|
|
11366
11488
|
VehicleClaimDetailsService.prototype.updateToManual = function () {
|
|
11367
|
-
//
|
|
11368
|
-
|
|
11489
|
+
// no need to update if cache not exist
|
|
11490
|
+
if (!this.cache) {
|
|
11491
|
+
return;
|
|
11492
|
+
}
|
|
11369
11493
|
var vehicleClaimDetails = classTransformer.plainToClass(VehicleClaimDetails, Object.assign({}, this.cache, { isManual: true }));
|
|
11370
|
-
|
|
11371
|
-
this.update(vehicleClaimDetails).pipe(operators.take(1)).subscribe();
|
|
11494
|
+
this.update(vehicleClaimDetails).subscribe();
|
|
11372
11495
|
};
|
|
11373
11496
|
return VehicleClaimDetailsService;
|
|
11374
11497
|
}());
|
|
@@ -11539,6 +11662,41 @@
|
|
|
11539
11662
|
}]
|
|
11540
11663
|
}] });
|
|
11541
11664
|
|
|
11665
|
+
/**
|
|
11666
|
+
* Service to work with Rewardful (affiliate program) API
|
|
11667
|
+
* https://developers.rewardful.com/javascript-api/overview#executing-code-when-rewardful-loads
|
|
11668
|
+
*/
|
|
11669
|
+
var RewardfulService = /** @class */ (function () {
|
|
11670
|
+
function RewardfulService(environment) {
|
|
11671
|
+
this.environment = environment;
|
|
11672
|
+
}
|
|
11673
|
+
RewardfulService.prototype.getReferralCode = function () {
|
|
11674
|
+
var _this = this;
|
|
11675
|
+
return new rxjs.Observable(function (observer) {
|
|
11676
|
+
if (!_this.environment.rewardfulId) {
|
|
11677
|
+
return observer.next(null);
|
|
11678
|
+
}
|
|
11679
|
+
window['rewardful']('ready', function () {
|
|
11680
|
+
observer.next(window['Rewardful'].referral);
|
|
11681
|
+
});
|
|
11682
|
+
});
|
|
11683
|
+
};
|
|
11684
|
+
return RewardfulService;
|
|
11685
|
+
}());
|
|
11686
|
+
RewardfulService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: RewardfulService, deps: [{ token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
11687
|
+
RewardfulService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: RewardfulService, providedIn: 'root' });
|
|
11688
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: RewardfulService, decorators: [{
|
|
11689
|
+
type: i0.Injectable,
|
|
11690
|
+
args: [{
|
|
11691
|
+
providedIn: 'root'
|
|
11692
|
+
}]
|
|
11693
|
+
}], ctorParameters: function () {
|
|
11694
|
+
return [{ type: undefined, decorators: [{
|
|
11695
|
+
type: i0.Inject,
|
|
11696
|
+
args: ['environment']
|
|
11697
|
+
}] }];
|
|
11698
|
+
} });
|
|
11699
|
+
|
|
11542
11700
|
/**
|
|
11543
11701
|
* Service for logbook best period calculation
|
|
11544
11702
|
* @TODO Vik: improve structure for such cases (TT-2043)
|
|
@@ -11653,7 +11811,7 @@
|
|
|
11653
11811
|
}),
|
|
11654
11812
|
_a[AccountSetupItemsEnum.WORK_LOGBOOK] = classTransformer.plainToClass(AccountSetupItem, {
|
|
11655
11813
|
title: 'Set up your logbook method',
|
|
11656
|
-
description: 'Do you use your vehicle for work? Select your method and the
|
|
11814
|
+
description: 'Do you use your vehicle for work? Select your method and the kms or logbook % to automate accurately all vehicle expenses throughout the year.',
|
|
11657
11815
|
url: '/client/work-tank/logbook',
|
|
11658
11816
|
urlFragment: 'productTour'
|
|
11659
11817
|
}),
|
|
@@ -12595,7 +12753,6 @@
|
|
|
12595
12753
|
this.eventDispatcherService.on([
|
|
12596
12754
|
exports.AppEventTypeEnum.VEHICLE_CLAIM_CREATED,
|
|
12597
12755
|
exports.AppEventTypeEnum.VEHICLE_CLAIM_UPDATED,
|
|
12598
|
-
exports.AppEventTypeEnum.VEHICLE_CLAIM_DETAILS_CREATED,
|
|
12599
12756
|
exports.AppEventTypeEnum.VEHICLE_CLAIM_DETAILS_UPDATED
|
|
12600
12757
|
]).subscribe(function () {
|
|
12601
12758
|
_this.resetCache();
|
|
@@ -12703,7 +12860,7 @@
|
|
|
12703
12860
|
}
|
|
12704
12861
|
// Bank feeds item is completed when user added at least one bank account (basiq or manual)
|
|
12705
12862
|
batch.push(this.create(AccountSetupItemsEnum.BANK_FEEDS, this.bankAccountsService.get()));
|
|
12706
|
-
// Logbook item is completed when user has at least one vehicle claim with any method (
|
|
12863
|
+
// Logbook item is completed when user has at least one vehicle claim with any method (kms or logbook)
|
|
12707
12864
|
batch.push(this.getLogbookItem());
|
|
12708
12865
|
// @TODO waiting for sole tank forecast page
|
|
12709
12866
|
// Sole item is completed when user added at least one sole income source
|
|
@@ -13939,7 +14096,6 @@
|
|
|
13939
14096
|
this.eventDispatcherService.on([
|
|
13940
14097
|
exports.AppEventTypeEnum.VEHICLE_CLAIM_CREATED,
|
|
13941
14098
|
exports.AppEventTypeEnum.VEHICLE_CLAIM_UPDATED,
|
|
13942
|
-
exports.AppEventTypeEnum.VEHICLE_CLAIM_DETAILS_CREATED,
|
|
13943
14099
|
exports.AppEventTypeEnum.VEHICLE_CLAIM_DETAILS_UPDATED
|
|
13944
14100
|
]).subscribe(function () {
|
|
13945
14101
|
_this.resetCache();
|
|
@@ -16430,7 +16586,7 @@
|
|
|
16430
16586
|
/**
|
|
16431
16587
|
* Abstract form class
|
|
16432
16588
|
* @TODO rename to AbstractFormGroup
|
|
16433
|
-
* @TODO Alex: refactor: check and improve logic
|
|
16589
|
+
* @TODO Alex TT-2190: refactor: check and improve logic
|
|
16434
16590
|
*/
|
|
16435
16591
|
var AbstractForm = /** @class */ (function (_super) {
|
|
16436
16592
|
__extends(AbstractForm, _super);
|
|
@@ -16447,9 +16603,7 @@
|
|
|
16447
16603
|
if (model && !model['id']) {
|
|
16448
16604
|
_this.markAsUnsaved();
|
|
16449
16605
|
}
|
|
16450
|
-
_this.
|
|
16451
|
-
!!model && !!model['id'] && isEqual__default["default"](_this.value, _this.initialValue) ? _this.markAsSaved() : _this.markAsUnsaved();
|
|
16452
|
-
});
|
|
16606
|
+
_this.listenValueChanges();
|
|
16453
16607
|
return _this;
|
|
16454
16608
|
}
|
|
16455
16609
|
Object.defineProperty(AbstractForm.prototype, "saved", {
|
|
@@ -16459,6 +16613,13 @@
|
|
|
16459
16613
|
enumerable: false,
|
|
16460
16614
|
configurable: true
|
|
16461
16615
|
});
|
|
16616
|
+
Object.defineProperty(AbstractForm.prototype, "currentValue", {
|
|
16617
|
+
get: function () {
|
|
16618
|
+
return this.createModelInstance(Object.assign({}, this.model, this.getRawValue()));
|
|
16619
|
+
},
|
|
16620
|
+
enumerable: false,
|
|
16621
|
+
configurable: true
|
|
16622
|
+
});
|
|
16462
16623
|
/**
|
|
16463
16624
|
* Check validation and return a new instance of generic model.
|
|
16464
16625
|
* Merge form value to initial object
|
|
@@ -16489,6 +16650,12 @@
|
|
|
16489
16650
|
if (data === void 0) { data = {}; }
|
|
16490
16651
|
return classTransformer.plainToClass(this.modelClass, data);
|
|
16491
16652
|
};
|
|
16653
|
+
AbstractForm.prototype.listenValueChanges = function () {
|
|
16654
|
+
var _this = this;
|
|
16655
|
+
this.valueChanges.subscribe(function () {
|
|
16656
|
+
!!_this.model && !!_this.model['id'] && isEqual__default["default"](_this.value, _this.initialValue) ? _this.markAsSaved() : _this.markAsUnsaved();
|
|
16657
|
+
});
|
|
16658
|
+
};
|
|
16492
16659
|
return AbstractForm;
|
|
16493
16660
|
}(forms.FormGroup));
|
|
16494
16661
|
|
|
@@ -16783,6 +16950,7 @@
|
|
|
16783
16950
|
/**
|
|
16784
16951
|
* Form array with bank account business allocations
|
|
16785
16952
|
* @TODO create AbstractFormArray
|
|
16953
|
+
* @TODO Alex/Vik (TT-2184): copypasted from bank-account-properties.form, improve logic and create common parent class maybe
|
|
16786
16954
|
*/
|
|
16787
16955
|
var SoleBusinessAllocationsForm = /** @class */ (function (_super) {
|
|
16788
16956
|
__extends(SoleBusinessAllocationsForm, _super);
|
|
@@ -16882,15 +17050,119 @@
|
|
|
16882
17050
|
return SoleDetailsForm;
|
|
16883
17051
|
}(AbstractForm));
|
|
16884
17052
|
|
|
17053
|
+
var SoleInvoiceItemForm = /** @class */ (function (_super) {
|
|
17054
|
+
__extends(SoleInvoiceItemForm, _super);
|
|
17055
|
+
function SoleInvoiceItemForm(item) {
|
|
17056
|
+
var _this = this;
|
|
17057
|
+
var _a;
|
|
17058
|
+
_this = _super.call(this, {
|
|
17059
|
+
description: new forms.FormControl(item.description, forms.Validators.required),
|
|
17060
|
+
quantity: new forms.FormControl(item.quantity, forms.Validators.required),
|
|
17061
|
+
price: new forms.FormControl(item.price, forms.Validators.required),
|
|
17062
|
+
isGST: new forms.FormControl({ value: item.isGST, disabled: !((_a = item.chartAccounts) === null || _a === void 0 ? void 0 : _a.isGST) }),
|
|
17063
|
+
chartAccounts: new forms.FormControl(item.chartAccounts, forms.Validators.required)
|
|
17064
|
+
}, item) || this;
|
|
17065
|
+
_this.listenEvents();
|
|
17066
|
+
return _this;
|
|
17067
|
+
}
|
|
17068
|
+
SoleInvoiceItemForm.prototype.listenEvents = function () {
|
|
17069
|
+
this.listenChartAccountsChanges();
|
|
17070
|
+
};
|
|
17071
|
+
SoleInvoiceItemForm.prototype.onTemplateChanged = function (template) {
|
|
17072
|
+
this.template = template;
|
|
17073
|
+
if (this.template.isNoTax()) {
|
|
17074
|
+
this.get('isGST').setValue(false);
|
|
17075
|
+
this.get('isGST').disable();
|
|
17076
|
+
}
|
|
17077
|
+
else {
|
|
17078
|
+
this.get('isGST').enable();
|
|
17079
|
+
}
|
|
17080
|
+
};
|
|
17081
|
+
SoleInvoiceItemForm.prototype.listenChartAccountsChanges = function () {
|
|
17082
|
+
var _this = this;
|
|
17083
|
+
this.get('chartAccounts').valueChanges.subscribe(function (chartAccounts) {
|
|
17084
|
+
if (_this.template.isNoTax()) {
|
|
17085
|
+
return;
|
|
17086
|
+
}
|
|
17087
|
+
if (chartAccounts.isGST) {
|
|
17088
|
+
_this.get('isGST').enable();
|
|
17089
|
+
}
|
|
17090
|
+
else {
|
|
17091
|
+
_this.get('isGST').setValue(false);
|
|
17092
|
+
_this.get('isGST').disable();
|
|
17093
|
+
}
|
|
17094
|
+
});
|
|
17095
|
+
};
|
|
17096
|
+
return SoleInvoiceItemForm;
|
|
17097
|
+
}(AbstractForm));
|
|
17098
|
+
|
|
17099
|
+
var SoleInvoiceForm = /** @class */ (function (_super) {
|
|
17100
|
+
__extends(SoleInvoiceForm, _super);
|
|
17101
|
+
function SoleInvoiceForm(invoice) {
|
|
17102
|
+
var _this = _super.call(this, {
|
|
17103
|
+
dateFrom: new forms.FormControl(invoice.dateFrom, forms.Validators.required),
|
|
17104
|
+
dateTo: new forms.FormControl(invoice.dateTo, forms.Validators.required),
|
|
17105
|
+
items: new forms.FormArray(invoice.items.map(function (item) { return new SoleInvoiceItemForm(item); })),
|
|
17106
|
+
payer: new forms.FormControl(invoice.payer, forms.Validators.required),
|
|
17107
|
+
template: new forms.FormControl(invoice.template, forms.Validators.required)
|
|
17108
|
+
}, invoice) || this;
|
|
17109
|
+
if (invoice.id) {
|
|
17110
|
+
_this.updateItemsForm(invoice.template);
|
|
17111
|
+
}
|
|
17112
|
+
_this.listenEvents();
|
|
17113
|
+
return _this;
|
|
17114
|
+
}
|
|
17115
|
+
Object.defineProperty(SoleInvoiceForm.prototype, "items", {
|
|
17116
|
+
get: function () {
|
|
17117
|
+
return this.get('items');
|
|
17118
|
+
},
|
|
17119
|
+
enumerable: false,
|
|
17120
|
+
configurable: true
|
|
17121
|
+
});
|
|
17122
|
+
SoleInvoiceForm.prototype.listenEvents = function () {
|
|
17123
|
+
this.listenTemplateChanges();
|
|
17124
|
+
};
|
|
17125
|
+
SoleInvoiceForm.prototype.addItem = function () {
|
|
17126
|
+
this.items.push(new SoleInvoiceItemForm(classTransformer.plainToClass(SoleInvoiceItem, {})));
|
|
17127
|
+
};
|
|
17128
|
+
SoleInvoiceForm.prototype.removeItem = function (index) {
|
|
17129
|
+
// do not remove the last item
|
|
17130
|
+
if (this.items.length === 1) {
|
|
17131
|
+
return;
|
|
17132
|
+
}
|
|
17133
|
+
this.items.removeAt(index);
|
|
17134
|
+
};
|
|
17135
|
+
SoleInvoiceForm.prototype.submit = function (data) {
|
|
17136
|
+
if (data === void 0) { data = {}; }
|
|
17137
|
+
var items = this.items.controls.map(function (control) { return control.submit(); });
|
|
17138
|
+
return _super.prototype.submit.call(this, Object.assign({}, data, { items: items }));
|
|
17139
|
+
};
|
|
17140
|
+
SoleInvoiceForm.prototype.listenTemplateChanges = function () {
|
|
17141
|
+
var _this = this;
|
|
17142
|
+
this.get('template').valueChanges.subscribe(function (template) {
|
|
17143
|
+
_this.updateItemsForm(template);
|
|
17144
|
+
});
|
|
17145
|
+
};
|
|
17146
|
+
SoleInvoiceForm.prototype.updateItemsForm = function (template) {
|
|
17147
|
+
this.items.controls.forEach(function (itemForm) {
|
|
17148
|
+
itemForm.onTemplateChanged(template);
|
|
17149
|
+
});
|
|
17150
|
+
};
|
|
17151
|
+
return SoleInvoiceForm;
|
|
17152
|
+
}(AbstractForm));
|
|
17153
|
+
|
|
16885
17154
|
var SoleInvoiceTemplateForm = /** @class */ (function (_super) {
|
|
16886
17155
|
__extends(SoleInvoiceTemplateForm, _super);
|
|
16887
|
-
function SoleInvoiceTemplateForm(invoiceTemplate) {
|
|
16888
|
-
|
|
17156
|
+
function SoleInvoiceTemplateForm(invoiceTemplate, soleDetails) {
|
|
17157
|
+
var _this = _super.call(this, {
|
|
16889
17158
|
name: new forms.FormControl(invoiceTemplate.name, forms.Validators.required),
|
|
16890
|
-
|
|
17159
|
+
// taxType always 'No Tax' when sole details are not GST registered
|
|
17160
|
+
taxType: new forms.FormControl({ value: invoiceTemplate.taxType, disabled: !soleDetails.isGST }, forms.Validators.required),
|
|
16891
17161
|
term: new forms.FormControl(invoiceTemplate.term, [forms.Validators.required, forms.Validators.min(0)]),
|
|
16892
|
-
bankAccount: new forms.FormControl(invoiceTemplate.bankAccount)
|
|
17162
|
+
bankAccount: new forms.FormControl(invoiceTemplate.bankAccount, [forms.Validators.required])
|
|
16893
17163
|
}, invoiceTemplate) || this;
|
|
17164
|
+
_this.soleDetails = soleDetails;
|
|
17165
|
+
return _this;
|
|
16894
17166
|
}
|
|
16895
17167
|
return SoleInvoiceTemplateForm;
|
|
16896
17168
|
}(AbstractForm));
|
|
@@ -16908,10 +17180,13 @@
|
|
|
16908
17180
|
if (bankAccount === null || bankAccount === void 0 ? void 0 : bankAccount.isSoleTank()) {
|
|
16909
17181
|
_this.addControl('businessAllocations', new SoleBusinessAllocationsForm(bankAccount.businessAllocations));
|
|
16910
17182
|
}
|
|
16911
|
-
_this.
|
|
17183
|
+
_this.listenEvents();
|
|
16912
17184
|
return _this;
|
|
16913
17185
|
}
|
|
16914
|
-
BankAccountAllocationForm.prototype.
|
|
17186
|
+
BankAccountAllocationForm.prototype.listenEvents = function () {
|
|
17187
|
+
this.listenTankTypeChanges();
|
|
17188
|
+
};
|
|
17189
|
+
BankAccountAllocationForm.prototype.listenTankTypeChanges = function () {
|
|
16915
17190
|
var _this = this;
|
|
16916
17191
|
this.get('tankType').valueChanges.subscribe(function (tankType) {
|
|
16917
17192
|
var _a, _b;
|
|
@@ -16959,17 +17234,13 @@
|
|
|
16959
17234
|
function BankAccountAddManualForm(connection) {
|
|
16960
17235
|
var _this = _super.call(this) || this;
|
|
16961
17236
|
_this.connection = connection;
|
|
16962
|
-
_this
|
|
16963
|
-
|
|
16964
|
-
|
|
16965
|
-
|
|
16966
|
-
|
|
16967
|
-
_this.listenEvents();
|
|
17237
|
+
_this.addControl('type', new forms.FormControl(null, forms.Validators.required));
|
|
17238
|
+
_this.addControl('accountName', new forms.FormControl(null, forms.Validators.required));
|
|
17239
|
+
_this.addControl('currentBalance', new forms.FormControl(null, forms.Validators.required));
|
|
17240
|
+
_this.addControl('accountNumber', new forms.FormControl(null, [forms.Validators.required, forms.Validators.pattern(BankAccountAddManualForm.accountNumberPattern)]));
|
|
17241
|
+
_this.listenTypeChanges();
|
|
16968
17242
|
return _this;
|
|
16969
17243
|
}
|
|
16970
|
-
BankAccountAddManualForm.prototype.listenEvents = function () {
|
|
16971
|
-
this.listenTypeChanges();
|
|
16972
|
-
};
|
|
16973
17244
|
/**
|
|
16974
17245
|
* Add/Remove loan form depends on selected bank account type
|
|
16975
17246
|
*/
|
|
@@ -17649,17 +17920,23 @@
|
|
|
17649
17920
|
* @param details required for form controls disabled state management
|
|
17650
17921
|
*/
|
|
17651
17922
|
function VehicleClaimForm(vehicleClaim, details) {
|
|
17652
|
-
|
|
17923
|
+
var _this = _super.call(this, {
|
|
17653
17924
|
kilometers: new forms.FormControl({
|
|
17654
17925
|
value: vehicleClaim.kilometers,
|
|
17655
17926
|
disabled: !details.isManual || details.isLogbookMethod()
|
|
17656
17927
|
}),
|
|
17657
17928
|
workUsage: new forms.FormControl({
|
|
17658
17929
|
value: vehicleClaim.workUsage,
|
|
17659
|
-
disabled: !details.isManual || details.
|
|
17930
|
+
disabled: !details.isManual || details.isKmsMethod()
|
|
17660
17931
|
})
|
|
17661
17932
|
}, vehicleClaim) || this;
|
|
17933
|
+
_this.vehicleClaim = vehicleClaim;
|
|
17934
|
+
_this.details = details;
|
|
17935
|
+
return _this;
|
|
17662
17936
|
}
|
|
17937
|
+
VehicleClaimForm.prototype.getAverageWeeklyKMS = function () {
|
|
17938
|
+
return this.get('kilometers').value / FinancialYear.weeksInYear;
|
|
17939
|
+
};
|
|
17663
17940
|
return VehicleClaimForm;
|
|
17664
17941
|
}(AbstractForm));
|
|
17665
17942
|
|
|
@@ -17668,16 +17945,12 @@
|
|
|
17668
17945
|
*/
|
|
17669
17946
|
var VehicleClaimDetailsForm = /** @class */ (function (_super) {
|
|
17670
17947
|
__extends(VehicleClaimDetailsForm, _super);
|
|
17671
|
-
|
|
17672
|
-
* @param vehicleClaimDetails required because we create a new details with prefilled data (like Financial year)
|
|
17673
|
-
* @param logbooks required for isManual field disabled state management
|
|
17674
|
-
*/
|
|
17675
|
-
function VehicleClaimDetailsForm(vehicleClaimDetails, logbooks) {
|
|
17948
|
+
function VehicleClaimDetailsForm(vehicleClaimDetails, isBestPeriodExist) {
|
|
17676
17949
|
return _super.call(this, {
|
|
17677
17950
|
method: new forms.FormControl(vehicleClaimDetails.method, forms.Validators.required),
|
|
17678
17951
|
isManual: new forms.FormControl({
|
|
17679
17952
|
value: vehicleClaimDetails.isManual,
|
|
17680
|
-
disabled: !
|
|
17953
|
+
disabled: !isBestPeriodExist
|
|
17681
17954
|
}),
|
|
17682
17955
|
}, vehicleClaimDetails) || this;
|
|
17683
17956
|
}
|
|
@@ -17704,36 +17977,44 @@
|
|
|
17704
17977
|
date: new forms.FormControl(logbook.date, forms.Validators.required),
|
|
17705
17978
|
odometerStart: new forms.FormControl(logbook.odometerStart, forms.Validators.required),
|
|
17706
17979
|
odometerEnd: new forms.FormControl(logbook.odometerEnd, forms.Validators.required),
|
|
17707
|
-
business: new forms.FormControl(logbook.business)
|
|
17708
|
-
// @TODO Alex: remove when backend fixed
|
|
17709
|
-
purpose: new forms.FormControl(exports.VehicleLogbookPurposeEnum.BUSINESS)
|
|
17980
|
+
business: new forms.FormControl(logbook.business)
|
|
17710
17981
|
}, logbook) || this;
|
|
17711
17982
|
_this.logbook = logbook;
|
|
17712
17983
|
_this.logbooks = logbooks;
|
|
17984
|
+
_this.updateStateAndValidators();
|
|
17985
|
+
return _this;
|
|
17986
|
+
}
|
|
17987
|
+
/**
|
|
17988
|
+
* Set logbook validators and disable state depends of initial logbook and its place in the whole list
|
|
17989
|
+
*/
|
|
17990
|
+
VehicleLogbookForm.prototype.updateStateAndValidators = function () {
|
|
17713
17991
|
switch (true) {
|
|
17714
17992
|
// Create the first or edit the single logbook
|
|
17715
|
-
case !logbook.id && !logbooks.length:
|
|
17716
|
-
case !!logbook.id && logbooks.length === 1:
|
|
17717
|
-
|
|
17718
|
-
|
|
17993
|
+
case !this.logbook.id && !this.logbooks.length:
|
|
17994
|
+
case !!this.logbook.id && this.logbooks.length === 1:
|
|
17995
|
+
this.get('odometerStart').setValidators(forms.Validators.min(0));
|
|
17996
|
+
this.get('date').setValidators(dateRangeValidator(new FinancialYear().startDate, new FinancialYear().endDate));
|
|
17719
17997
|
break;
|
|
17720
|
-
// Create the non-first
|
|
17721
|
-
case !logbook.id && !!logbooks.length:
|
|
17722
|
-
|
|
17723
|
-
|
|
17724
|
-
|
|
17725
|
-
|
|
17726
|
-
|
|
17727
|
-
|
|
17998
|
+
// Create the non-first
|
|
17999
|
+
case !this.logbook.id && !!this.logbooks.length:
|
|
18000
|
+
this.get('odometerStart').disable();
|
|
18001
|
+
this.get('odometerEnd').setValidators(forms.Validators.min(this.logbooks.last.odometerEnd));
|
|
18002
|
+
this.get('date').setValidators(dateRangeValidator(this.logbooks.last.date, new FinancialYear().endDate));
|
|
18003
|
+
break;
|
|
18004
|
+
// Edit the last logbook
|
|
18005
|
+
case !!this.logbook.id && this.logbook.id === this.logbooks.last.id && this.logbooks.length > 1:
|
|
18006
|
+
this.get('odometerStart').disable();
|
|
18007
|
+
this.get('odometerEnd').setValidators(forms.Validators.min(this.logbooks.last.odometerEnd));
|
|
18008
|
+
var preLastDate = this.logbooks.toArray()[this.logbooks.length - 1].date;
|
|
18009
|
+
this.get('date').setValidators(dateRangeValidator(preLastDate, new FinancialYear().endDate));
|
|
17728
18010
|
break;
|
|
17729
18011
|
// Edit the non-last logbook
|
|
17730
|
-
case !!logbook.id && logbook.id !== logbooks.last.id && logbooks.length > 1:
|
|
17731
|
-
|
|
17732
|
-
|
|
17733
|
-
|
|
18012
|
+
case !!this.logbook.id && this.logbook.id !== this.logbooks.last.id && this.logbooks.length > 1:
|
|
18013
|
+
this.get('odometerStart').disable();
|
|
18014
|
+
this.get('odometerEnd').disable();
|
|
18015
|
+
this.get('date').disable();
|
|
17734
18016
|
}
|
|
17735
|
-
|
|
17736
|
-
}
|
|
18017
|
+
};
|
|
17737
18018
|
return VehicleLogbookForm;
|
|
17738
18019
|
}(AbstractForm));
|
|
17739
18020
|
VehicleLogbookForm.maxDescriptionLength = 60;
|
|
@@ -17964,6 +18245,7 @@
|
|
|
17964
18245
|
exports.ReportItemCollection = ReportItemCollection;
|
|
17965
18246
|
exports.ReportItemDetails = ReportItemDetails;
|
|
17966
18247
|
exports.ResetPasswordForm = ResetPasswordForm;
|
|
18248
|
+
exports.RewardfulService = RewardfulService;
|
|
17967
18249
|
exports.SUBSCRIPTION_DESCRIPTION = SUBSCRIPTION_DESCRIPTION;
|
|
17968
18250
|
exports.SUBSCRIPTION_TITLE = SUBSCRIPTION_TITLE;
|
|
17969
18251
|
exports.SalaryForecast = SalaryForecast;
|
|
@@ -17996,7 +18278,10 @@
|
|
|
17996
18278
|
exports.SoleForecast = SoleForecast;
|
|
17997
18279
|
exports.SoleForecastService = SoleForecastService;
|
|
17998
18280
|
exports.SoleInvoice = SoleInvoice;
|
|
18281
|
+
exports.SoleInvoiceForm = SoleInvoiceForm;
|
|
17999
18282
|
exports.SoleInvoiceItem = SoleInvoiceItem;
|
|
18283
|
+
exports.SoleInvoiceItemForm = SoleInvoiceItemForm;
|
|
18284
|
+
exports.SoleInvoiceService = SoleInvoiceService;
|
|
18000
18285
|
exports.SoleInvoiceTemplate = SoleInvoiceTemplate;
|
|
18001
18286
|
exports.SoleInvoiceTemplateForm = SoleInvoiceTemplateForm;
|
|
18002
18287
|
exports.SoleInvoiceTemplateService = SoleInvoiceTemplateService;
|