taxtank-core 0.0.1 → 0.1.1
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/.browserslistrc +16 -0
- package/karma.conf.js +44 -0
- package/ng-package.json +12 -0
- package/package.json +13 -12
- package/src/lib/collections/abstract.collection.ts +83 -0
- package/src/lib/collections/bank-account.collection.ts +171 -0
- package/src/lib/collections/bank-transaction.collection.ts +153 -0
- package/src/lib/collections/client-movement.collection.ts +42 -0
- package/src/lib/collections/client-portfolio-report.collection.ts +47 -0
- package/src/lib/collections/client.collection.ts +5 -0
- package/src/lib/collections/collection-dictionary.ts +112 -0
- package/src/lib/collections/depreciation-forecast.collection.ts +25 -0
- package/src/lib/collections/depreciation.collection.ts +113 -0
- package/src/lib/collections/employee.collection.ts +14 -0
- package/src/lib/collections/income-source.collection.ts +44 -0
- package/src/lib/collections/loan.collection.ts +22 -0
- package/src/lib/collections/logbook.collection.ts +129 -0
- package/src/lib/collections/message-document.collection.ts +16 -0
- package/src/lib/collections/message.collection.ts +27 -0
- package/src/lib/collections/property.collection.ts +88 -0
- package/src/lib/collections/service-price.collection.ts +13 -0
- package/src/lib/collections/service-subscription.collection.ts +20 -0
- package/src/lib/collections/tax-return-category-item.collection.ts +148 -0
- package/src/lib/collections/tax-review.collection.ts +64 -0
- package/src/lib/collections/transaction-allocation.collection.ts +54 -0
- package/src/lib/collections/transaction.collection.ts +170 -0
- package/src/lib/collections/user-event-setting.collection.ts +70 -0
- package/src/lib/db/Enums/address-type.enum.ts +4 -0
- package/src/lib/db/Enums/bank-account-status.enum.ts +4 -0
- package/src/lib/db/Enums/bank-account-type.enum.ts +10 -0
- package/src/lib/db/Enums/bank-connection-status.enum.ts +5 -0
- package/src/lib/db/Enums/bank-transaction-type.enum.ts +4 -0
- package/src/lib/db/Enums/chart-accounts-category.enum.ts +13 -0
- package/src/lib/db/Enums/chart-accounts-etp.enum.ts +7 -0
- package/src/lib/db/Enums/chart-accounts-heading-tax-deductible.enum.ts +6 -0
- package/src/lib/db/Enums/chart-accounts-heading-taxable.enum.ts +6 -0
- package/src/lib/db/Enums/chart-accounts-heading-vehicle-list.enum.ts +4 -0
- package/src/lib/db/Enums/chart-accounts-list.enum.ts +19 -0
- package/src/lib/db/Enums/chart-accounts-metadata-list.enum.ts +14 -0
- package/src/lib/db/Enums/chart-accounts-metadata-type.enum.ts +4 -0
- package/src/lib/db/Enums/chart-accounts-type.enum.ts +4 -0
- package/src/lib/db/Enums/chat-status.enum.ts +4 -0
- package/src/lib/db/Enums/client-details-medicare-exemption.enum.ts +5 -0
- package/src/lib/db/Enums/client-details-work-depreciation-calculation.enum.ts +4 -0
- package/src/lib/db/Enums/client-details-working-holiday-maker.enum.ts +5 -0
- package/src/lib/db/Enums/client-invite-status.enum.ts +4 -0
- package/src/lib/db/Enums/client-invite-type.enum.ts +4 -0
- package/src/lib/db/Enums/depreciation-calculation-percent.enum.ts +7 -0
- package/src/lib/db/Enums/depreciation-calculation.enum.ts +7 -0
- package/src/lib/db/Enums/depreciation-type.enum.ts +6 -0
- package/src/lib/db/Enums/depreciation-write-off-amount.enum.ts +4 -0
- package/src/lib/db/Enums/firm-type.enum.ts +4 -0
- package/src/lib/db/Enums/income-source-type-list-other.enum.ts +6 -0
- package/src/lib/db/Enums/income-source-type-list-salary.enum.ts +3 -0
- package/src/lib/db/Enums/income-source-type-list-work.enum.ts +8 -0
- package/src/lib/db/Enums/income-source-type.enum.ts +5 -0
- package/src/lib/db/Enums/invite-status.enum.ts +5 -0
- package/src/lib/db/Enums/loan-bank-type.enum.ts +10 -0
- package/src/lib/db/Enums/loan-frequency.enum.ts +6 -0
- package/src/lib/db/Enums/loan-interest-type.enum.ts +4 -0
- package/src/lib/db/Enums/loan-payout-type.enum.ts +4 -0
- package/src/lib/db/Enums/loan-repayment-frequency.enum.ts +5 -0
- package/src/lib/db/Enums/loan-repayment-type.enum.ts +4 -0
- package/src/lib/db/Enums/loan-type.enum.ts +12 -0
- package/src/lib/db/Enums/loan-vehicle-type.enum.ts +5 -0
- package/src/lib/db/Enums/phone-type.enum.ts +4 -0
- package/src/lib/db/Enums/property-depreciation-calculation.enum.ts +4 -0
- package/src/lib/db/Enums/property-owner-access.enum.ts +4 -0
- package/src/lib/db/Enums/property-owner-status.enum.ts +5 -0
- package/src/lib/db/Enums/registration-invite-status.enum.ts +4 -0
- package/src/lib/db/Enums/salary-forecast-frequency.enum.ts +6 -0
- package/src/lib/db/Enums/service-notification-status.enum.ts +5 -0
- package/src/lib/db/Enums/service-notification-type.enum.ts +4 -0
- package/src/lib/db/Enums/service-payment-status.enum.ts +4 -0
- package/src/lib/db/Enums/service-price-recurring-interval.enum.ts +6 -0
- package/src/lib/db/Enums/service-price-type.enum.ts +4 -0
- package/src/lib/db/Enums/service-subscription-status.enum.ts +8 -0
- package/src/lib/db/Enums/spare-document-spare-type.enum.ts +4 -0
- package/src/lib/db/Enums/tank-type.enum.ts +5 -0
- package/src/lib/db/Enums/tax-calculation-medicare-exemption.enum.ts +4 -0
- package/src/lib/db/Enums/tax-calculation-type.enum.ts +12 -0
- package/src/lib/db/Enums/tax-return-category-list.enum.ts +26 -0
- package/src/lib/db/Enums/tax-return-category-section.enum.ts +6 -0
- package/src/lib/db/Enums/tax-review-status.enum.ts +11 -0
- package/src/lib/db/Enums/tax-summary-list.enum.ts +15 -0
- package/src/lib/db/Enums/tax-summary-section.enum.ts +6 -0
- package/src/lib/db/Enums/tax-summary-tax-summary.enum.ts +15 -0
- package/src/lib/db/Enums/ticket-feedback.enum.ts +4 -0
- package/src/lib/db/Enums/ticket-status.enum.ts +7 -0
- package/src/lib/db/Enums/ticket-types.enum.ts +3 -0
- package/src/lib/db/Enums/transaction-operation.enum.ts +5 -0
- package/src/lib/db/Enums/transaction-source.enum.ts +4 -0
- package/src/lib/db/Enums/transaction-type.enum.ts +4 -0
- package/src/lib/db/Enums/user-event-status.enum.ts +6 -0
- package/src/lib/db/Enums/user-event-type-frequency.enum.ts +6 -0
- package/src/lib/db/Enums/user-event-type-reminder-type.enum.ts +6 -0
- package/src/lib/db/Enums/user-event-type-reminder.enum.ts +5 -0
- package/src/lib/db/Enums/user-event-type-type.enum.ts +33 -0
- package/src/lib/db/Enums/user-medicare-exemption.enum.ts +5 -0
- package/src/lib/db/Enums/user-roles.enum.ts +13 -0
- package/src/lib/db/Enums/user-status.enum.ts +6 -0
- package/src/lib/db/Enums/user-title.enum.ts +7 -0
- package/src/lib/db/Enums/user-work-depreciation-calculation.enum.ts +4 -0
- package/src/lib/db/Enums/user-working-holiday-maker.enum.ts +5 -0
- package/src/lib/db/Enums/vehicle-claim-method.enum.ts +4 -0
- package/src/lib/db/Enums/vehicle-logbook-purpose.enum.ts +4 -0
- package/src/lib/db/Models/address.ts +20 -0
- package/src/lib/db/Models/bank-account-balance.ts +13 -0
- package/src/lib/db/Models/bank-account-property.ts +9 -0
- package/src/lib/db/Models/bank-account.ts +34 -0
- package/src/lib/db/Models/bank-connection.ts +15 -0
- package/src/lib/db/Models/bank-provider-account.ts +13 -0
- package/src/lib/db/Models/bank-transaction-import.ts +12 -0
- package/src/lib/db/Models/bank-transaction-rule.ts +26 -0
- package/src/lib/db/Models/bank-transaction.ts +17 -0
- package/src/lib/db/Models/bank.ts +12 -0
- package/src/lib/db/Models/basiq-job.ts +9 -0
- package/src/lib/db/Models/borrowing-expense-loan.ts +15 -0
- package/src/lib/db/Models/borrowing-expense.ts +7 -0
- package/src/lib/db/Models/capital-cost-property.ts +14 -0
- package/src/lib/db/Models/capital-cost.ts +4 -0
- package/src/lib/db/Models/chart-accounts-depreciation.ts +11 -0
- package/src/lib/db/Models/chart-accounts-heading.ts +7 -0
- package/src/lib/db/Models/chart-accounts-metadata.ts +12 -0
- package/src/lib/db/Models/chart-accounts-value.ts +13 -0
- package/src/lib/db/Models/chart-accounts.ts +24 -0
- package/src/lib/db/Models/chat.ts +18 -0
- package/src/lib/db/Models/client-details.ts +30 -0
- package/src/lib/db/Models/client-invite.ts +17 -0
- package/src/lib/db/Models/client-movement.ts +13 -0
- package/src/lib/db/Models/country.ts +5 -0
- package/src/lib/db/Models/depreciation-capital-project.ts +14 -0
- package/src/lib/db/Models/depreciation-forecast.ts +19 -0
- package/src/lib/db/Models/depreciation-receipt.ts +12 -0
- package/src/lib/db/Models/depreciation.ts +43 -0
- package/src/lib/db/Models/document-base.ts +10 -0
- package/src/lib/db/Models/document-folder.ts +10 -0
- package/src/lib/db/Models/document.ts +12 -0
- package/src/lib/db/Models/employee-details.ts +8 -0
- package/src/lib/db/Models/employee-invite.ts +10 -0
- package/src/lib/db/Models/financial-data-system.ts +10 -0
- package/src/lib/db/Models/firm-invite.ts +15 -0
- package/src/lib/db/Models/firm.ts +29 -0
- package/src/lib/db/Models/income-source-forecast.ts +13 -0
- package/src/lib/db/Models/income-source-type.ts +9 -0
- package/src/lib/db/Models/income-source.ts +21 -0
- package/src/lib/db/Models/loan-payout.ts +13 -0
- package/src/lib/db/Models/loan.ts +34 -0
- package/src/lib/db/Models/message-document.ts +16 -0
- package/src/lib/db/Models/message.ts +16 -0
- package/src/lib/db/Models/occupation.ts +5 -0
- package/src/lib/db/Models/phone.ts +13 -0
- package/src/lib/db/Models/property-capital-cost.ts +14 -0
- package/src/lib/db/Models/property-category-movement.ts +18 -0
- package/src/lib/db/Models/property-category.ts +14 -0
- package/src/lib/db/Models/property-document.ts +14 -0
- package/src/lib/db/Models/property-forecast.ts +15 -0
- package/src/lib/db/Models/property-owner.ts +21 -0
- package/src/lib/db/Models/property-sold.ts +13 -0
- package/src/lib/db/Models/property-subscription.ts +10 -0
- package/src/lib/db/Models/property-valuation.ts +13 -0
- package/src/lib/db/Models/property.ts +42 -0
- package/src/lib/db/Models/registration-invite.ts +13 -0
- package/src/lib/db/Models/salary-forecast.ts +16 -0
- package/src/lib/db/Models/service-notification.ts +14 -0
- package/src/lib/db/Models/service-payment.ts +12 -0
- package/src/lib/db/Models/service-price.ts +16 -0
- package/src/lib/db/Models/service-product.ts +13 -0
- package/src/lib/db/Models/service-subscription-item.ts +10 -0
- package/src/lib/db/Models/service-subscription.ts +15 -0
- package/src/lib/db/Models/spare-document-category.ts +6 -0
- package/src/lib/db/Models/spare-document.ts +16 -0
- package/src/lib/db/Models/tax-calculation.ts +19 -0
- package/src/lib/db/Models/tax-return-category.ts +13 -0
- package/src/lib/db/Models/tax-return-item.ts +16 -0
- package/src/lib/db/Models/tax-return.ts +9 -0
- package/src/lib/db/Models/tax-review.ts +14 -0
- package/src/lib/db/Models/ticket.ts +20 -0
- package/src/lib/db/Models/transaction-allocation.ts +9 -0
- package/src/lib/db/Models/transaction-base.ts +33 -0
- package/src/lib/db/Models/transaction-metadata.ts +12 -0
- package/src/lib/db/Models/transaction-receipt.ts +12 -0
- package/src/lib/db/Models/transaction.ts +44 -0
- package/src/lib/db/Models/user-event-setting.ts +11 -0
- package/src/lib/db/Models/user-event-type.ts +16 -0
- package/src/lib/db/Models/user-event.ts +14 -0
- package/src/lib/db/Models/user.ts +52 -0
- package/src/lib/db/Models/vehicle-claim.ts +12 -0
- package/src/lib/db/Models/vehicle-logbook.ts +17 -0
- package/src/lib/db/Models/vehicle.ts +9 -0
- package/src/lib/functions/array/index.ts +3 -0
- package/src/lib/functions/array/replace.ts +5 -0
- package/src/lib/functions/array/sort-deep.ts +19 -0
- package/src/lib/functions/array/sort.ts +8 -0
- package/src/lib/functions/clone-deep.ts +4 -0
- package/src/lib/functions/create-date.ts +7 -0
- package/src/lib/functions/enum-to-list.ts +16 -0
- package/src/lib/functions/get-doc-icon.ts +21 -0
- package/src/lib/functions/mat-options-functions.ts +11 -0
- package/src/lib/functions/mat-sort-options.ts +9 -0
- package/src/lib/functions/round-to.ts +9 -0
- package/src/lib/functions/tax-review-filter-predicate.ts +11 -0
- package/src/lib/interfaces/asset-entity-type.enum.ts +10 -0
- package/src/lib/interfaces/asset-type.enum.ts +9 -0
- package/src/lib/interfaces/asset.interface.ts +18 -0
- package/src/lib/interfaces/chart-data.interface.ts +11 -0
- package/src/lib/interfaces/chart-serie.interface.ts +8 -0
- package/src/lib/interfaces/document.interface.ts +20 -0
- package/src/lib/interfaces/documentable.interface.ts +9 -0
- package/src/lib/interfaces/event-listener.interface.ts +9 -0
- package/src/lib/interfaces/income-source-forecast.interface.ts +7 -0
- package/src/lib/interfaces/option.interface.ts +4 -0
- package/src/lib/interfaces/photoable.ts +14 -0
- package/src/lib/interfaces/receipt.interface.ts +13 -0
- package/src/lib/interfaces/salary-forecast.interface.ts +17 -0
- package/src/lib/interfaces/tank.interface.ts +9 -0
- package/src/lib/models/address/address.ts +24 -0
- package/src/lib/models/address/country.ts +17 -0
- package/src/lib/models/bank/bank-account-chart-data.ts +42 -0
- package/src/lib/models/bank/bank-account-property.ts +8 -0
- package/src/lib/models/bank/bank-account-types.const.ts +15 -0
- package/src/lib/models/bank/bank-account.ts +136 -0
- package/src/lib/models/bank/bank-connection.ts +12 -0
- package/src/lib/models/bank/bank-transaction-chart-data.ts +132 -0
- package/src/lib/models/bank/bank-transaction-summary-fields.enum.ts +4 -0
- package/src/lib/models/bank/bank-transaction.ts +74 -0
- package/src/lib/models/bank/bank.ts +21 -0
- package/src/lib/models/bank/basiq-job.ts +4 -0
- package/src/lib/models/bank/basiq-token.ts +16 -0
- package/src/lib/models/bank/type-loan.const.ts +7 -0
- package/src/lib/models/borrowing-expense/borrowing-expense-loan.ts +4 -0
- package/src/lib/models/borrowing-expense/borrowing-expense.ts +4 -0
- package/src/lib/models/chart/chart-data.ts +13 -0
- package/src/lib/models/chart/chart-serie.ts +8 -0
- package/src/lib/models/chart-accounts/chart-accounts-categories.const.ts +85 -0
- package/src/lib/models/chart-accounts/chart-accounts-depreciation.ts +14 -0
- package/src/lib/models/chart-accounts/chart-accounts-heading.ts +6 -0
- package/src/lib/models/chart-accounts/chart-accounts-metadata.ts +15 -0
- package/src/lib/models/chart-accounts/chart-accounts-tax-labels.enum.ts +5 -0
- package/src/lib/models/chart-accounts/chart-accounts.ts +137 -0
- package/src/lib/models/chat/chat-view-type.enum.ts +4 -0
- package/src/lib/models/chat/chat.ts +23 -0
- package/src/lib/models/chat/message-document.ts +18 -0
- package/src/lib/models/chat/message.ts +40 -0
- package/src/lib/models/client/client-details.ts +4 -0
- package/src/lib/models/client/client-invite.ts +70 -0
- package/src/lib/models/client/client-movement.ts +25 -0
- package/src/lib/models/client/client-portfolio-chart-data.ts +65 -0
- package/src/lib/models/client/client-portfolio-report.ts +10 -0
- package/src/lib/models/depreciation/depreciation-capital-project.ts +10 -0
- package/src/lib/models/depreciation/depreciation-forecast.ts +31 -0
- package/src/lib/models/depreciation/depreciation-group-item.ts +20 -0
- package/src/lib/models/depreciation/depreciation-group.enum.ts +7 -0
- package/src/lib/models/depreciation/depreciation-group.ts +25 -0
- package/src/lib/models/depreciation/depreciation-groups.const.ts +35 -0
- package/src/lib/models/depreciation/depreciation-receipt.ts +9 -0
- package/src/lib/models/depreciation/depreciation.ts +174 -0
- package/src/lib/models/document/document-api-url-prefix.enum.ts +7 -0
- package/src/lib/models/document/document-file-types.const.ts +22 -0
- package/src/lib/models/document/document-folder.ts +11 -0
- package/src/lib/models/document/document.ts +29 -0
- package/src/lib/models/employee/employee-details.ts +8 -0
- package/src/lib/models/employee/employee-invite.ts +12 -0
- package/src/lib/models/endpoint/endpoint.ts +35 -0
- package/src/lib/models/endpoint/endpoints.const.ts +157 -0
- package/src/lib/models/event/app-event-type.enum.ts +37 -0
- package/src/lib/models/event/app-event.ts +9 -0
- package/src/lib/models/file/icons-file.enum.ts +5 -0
- package/src/lib/models/financial-year/financial-year.ts +57 -0
- package/src/lib/models/financial-year/month-name-short.enum.ts +19 -0
- package/src/lib/models/financial-year/month-number.enum.ts +19 -0
- package/src/lib/models/financial-year/months.const.ts +1 -0
- package/src/lib/models/firm/firm.ts +31 -0
- package/src/lib/models/income-position/income-position.ts +13 -0
- package/src/lib/models/income-source/income-source-chart-data.ts +57 -0
- package/src/lib/models/income-source/income-source-forecast.ts +35 -0
- package/src/lib/models/income-source/income-source-type.ts +30 -0
- package/src/lib/models/income-source/income-source.ts +57 -0
- package/src/lib/models/income-source/salary-forecast.ts +23 -0
- package/src/lib/models/loan/loan-max-number-of-payments.enum.ts +8 -0
- package/src/lib/models/loan/loan-payment.ts +17 -0
- package/src/lib/models/loan/loan-payout.ts +13 -0
- package/src/lib/models/loan/loan.ts +38 -0
- package/src/lib/models/logbook/default-vehicle-expense.ts +20 -0
- package/src/lib/models/logbook/logbook-period.ts +12 -0
- package/src/lib/models/logbook/logbook-purpose-options.const.ts +6 -0
- package/src/lib/models/logbook/vehicle-claim.ts +27 -0
- package/src/lib/models/logbook/vehicle-logbook.ts +16 -0
- package/src/lib/models/logbook/vehicle.ts +46 -0
- package/src/lib/models/notification/notification-event-types.const.ts +43 -0
- package/src/lib/models/notification/notification.ts +66 -0
- package/src/lib/models/phone/phone.ts +10 -0
- package/src/lib/models/property/calculation-form-item.ts +24 -0
- package/src/lib/models/property/calculation-form-type.enum.ts +7 -0
- package/src/lib/models/property/capital-costs-itmes.const.ts +57 -0
- package/src/lib/models/property/corelogic-suggestion.ts +18 -0
- package/src/lib/models/property/ownership-filter-options.enum.ts +8 -0
- package/src/lib/models/property/property-capital-cost.ts +4 -0
- package/src/lib/models/property/property-category-movement.ts +18 -0
- package/src/lib/models/property/property-category.ts +9 -0
- package/src/lib/models/property/property-document.ts +21 -0
- package/src/lib/models/property/property-equity-chart-data.ts +188 -0
- package/src/lib/models/property/property-equity-chart-item.ts +35 -0
- package/src/lib/models/property/property-equity-chart-type.enum.ts +4 -0
- package/src/lib/models/property/property-forecast.ts +55 -0
- package/src/lib/models/property/property-owner.ts +50 -0
- package/src/lib/models/property/property-sold.ts +10 -0
- package/src/lib/models/property/property-subscription.ts +11 -0
- package/src/lib/models/property/property-valuation.ts +24 -0
- package/src/lib/models/property/property.ts +157 -0
- package/src/lib/models/registration-invite/registration-invite.ts +12 -0
- package/src/lib/models/service-subscription/module-url-list.const.ts +11 -0
- package/src/lib/models/service-subscription/service-payment.ts +8 -0
- package/src/lib/models/service-subscription/service-price.ts +8 -0
- package/src/lib/models/service-subscription/service-product.ts +11 -0
- package/src/lib/models/service-subscription/service-subscription-item.ts +12 -0
- package/src/lib/models/service-subscription/service-subscription.ts +151 -0
- package/src/lib/models/service-subscription/subscription-description.const.ts +8 -0
- package/src/lib/models/service-subscription/subscription-title.const.ts +8 -0
- package/src/lib/models/service-subscription/subscription-type.enum.ts +6 -0
- package/src/lib/models/tax-review/tax-review.ts +96 -0
- package/src/lib/models/tax-summary/tax-return-category-item-details.ts +14 -0
- package/src/lib/models/tax-summary/tax-return-category-item.ts +22 -0
- package/src/lib/models/tax-summary/tax-summary-section.ts +32 -0
- package/src/lib/models/tax-summary/tax-summary-type.enum.ts +7 -0
- package/src/lib/models/tax-summary/tax-summary.ts +79 -0
- package/src/lib/models/transaction/income-amount-type.enum.ts +7 -0
- package/src/lib/models/transaction/transaction-allocation.ts +20 -0
- package/src/lib/models/transaction/transaction-metadata.ts +8 -0
- package/src/lib/models/transaction/transaction-receipt.ts +9 -0
- package/src/lib/models/transaction/transaction.ts +241 -0
- package/src/lib/models/user/my-account-history-initiated-by.enum.ts +4 -0
- package/src/lib/models/user/my-account-history-status.enum.ts +4 -0
- package/src/lib/models/user/my-account-history-type.enum.ts +5 -0
- package/src/lib/models/user/my-account-history.ts +12 -0
- package/src/lib/models/user/occupation.ts +4 -0
- package/src/lib/models/user/user-roles.const.ts +13 -0
- package/src/lib/models/user/user-to-register.ts +7 -0
- package/src/lib/models/user/user-work-position.const.ts +7 -0
- package/src/lib/models/user/user.ts +160 -0
- package/src/lib/models/user-event/user-event-category.enum.ts +9 -0
- package/src/lib/models/user-event/user-event-category.ts +9 -0
- package/src/lib/models/user-event/user-event-setting-field.enum.ts +8 -0
- package/src/lib/models/user-event/user-event-setting.ts +11 -0
- package/src/lib/models/user-event/user-event-type.ts +22 -0
- package/src/lib/services/address/address.service.spec.ts +12 -0
- package/src/lib/services/address/address.service.ts +36 -0
- package/src/lib/services/asset/assets.service.spec.ts +12 -0
- package/src/lib/services/asset/assets.service.ts +51 -0
- package/src/lib/services/auth/auth.service.ts +48 -0
- package/src/lib/services/auth/jwt.service.ts +37 -0
- package/src/lib/services/bank/bank-account-calculation.service.spec.ts +16 -0
- package/src/lib/services/bank/bank-account-calculation.service.ts +38 -0
- package/src/lib/services/bank/bank-account.service.spec.ts +12 -0
- package/src/lib/services/bank/bank-account.service.ts +120 -0
- package/src/lib/services/bank/bank-connection.service.spec.ts +12 -0
- package/src/lib/services/bank/bank-connection.service.ts +42 -0
- package/src/lib/services/bank/bank-transaction-calculation.service.spec.ts +16 -0
- package/src/lib/services/bank/bank-transaction-calculation.service.ts +71 -0
- package/src/lib/services/bank/bank-transaction.service.spec.ts +12 -0
- package/src/lib/services/bank/bank-transaction.service.ts +97 -0
- package/src/lib/services/bank/bank.service.spec.ts +12 -0
- package/src/lib/services/bank/bank.service.ts +16 -0
- package/src/lib/services/bank/basiq.service.spec.ts +12 -0
- package/src/lib/services/bank/basiq.service.ts +103 -0
- package/src/lib/services/base-rest.service.spec.ts +13 -0
- package/src/lib/services/base-rest.service.ts +229 -0
- package/src/lib/services/borrowing-expense/borrowing-expense.service.spec.ts +12 -0
- package/src/lib/services/borrowing-expense/borrowing-expense.service.ts +82 -0
- package/src/lib/services/chart-accounts/chart-accounts-depreciations.service.spec.ts +16 -0
- package/src/lib/services/chart-accounts/chart-accounts-depreciations.service.ts +34 -0
- package/src/lib/services/chart-accounts/chart-accounts.service.spec.ts +12 -0
- package/src/lib/services/chart-accounts/chart-accounts.service.ts +101 -0
- package/src/lib/services/chat/chat.service.spec.ts +16 -0
- package/src/lib/services/chat/chat.service.ts +79 -0
- package/src/lib/services/chat/message-document.service.spec.ts +16 -0
- package/src/lib/services/chat/message-document.service.ts +133 -0
- package/src/lib/services/chat/message.service.spec.ts +16 -0
- package/src/lib/services/chat/message.service.ts +61 -0
- package/src/lib/services/client/client-invite.service.spec.ts +16 -0
- package/src/lib/services/client/client-invite.service.ts +111 -0
- package/src/lib/services/client/client-movement.service.spec.ts +16 -0
- package/src/lib/services/client/client-movement.service.ts +114 -0
- package/src/lib/services/client/client-portfolio-report.service.spec.ts +16 -0
- package/src/lib/services/client/client-portfolio-report.service.ts +34 -0
- package/src/lib/services/depreciation/capital-project.service.spec.ts +16 -0
- package/src/lib/services/depreciation/capital-project.service.ts +69 -0
- package/src/lib/services/depreciation/depreciation.service.spec.ts +12 -0
- package/src/lib/services/depreciation/depreciation.service.ts +171 -0
- package/src/lib/services/document/document-folder.service.spec.ts +16 -0
- package/src/lib/services/document/document-folder.service.ts +95 -0
- package/src/lib/services/employee/employee-invite.service.spec.ts +16 -0
- package/src/lib/services/employee/employee-invite.service.ts +53 -0
- package/src/lib/services/employee/employee.service.spec.ts +16 -0
- package/src/lib/services/employee/employee.service.ts +35 -0
- package/src/lib/services/event/event-dispatcher.service.spec.ts +16 -0
- package/src/lib/services/event/event-dispatcher.service.ts +29 -0
- package/src/lib/services/event/sse.service.spec.ts +16 -0
- package/src/lib/services/event/sse.service.ts +42 -0
- package/src/lib/services/firm/firm.service.spec.ts +16 -0
- package/src/lib/services/firm/firm.service.ts +93 -0
- package/src/lib/services/header-title/header-title.service.spec.ts +12 -0
- package/src/lib/services/header-title/header-title.service.ts +31 -0
- package/src/lib/services/income-source/income-source-forecast.service.spec.ts +16 -0
- package/src/lib/services/income-source/income-source-forecast.service.ts +91 -0
- package/src/lib/services/income-source/income-source.service.spec.ts +12 -0
- package/src/lib/services/income-source/income-source.service.ts +127 -0
- package/src/lib/services/income-source/salary-forecast.service.spec.ts +16 -0
- package/src/lib/services/income-source/salary-forecast.service.ts +92 -0
- package/src/lib/services/intercom/intercom.service.spec.ts +16 -0
- package/src/lib/services/intercom/intercom.service.ts +37 -0
- package/src/lib/services/loan/loan.service.spec.ts +12 -0
- package/src/lib/services/loan/loan.service.ts +166 -0
- package/src/lib/services/notification/notification.service.spec.ts +12 -0
- package/src/lib/services/notification/notification.service.ts +60 -0
- package/src/lib/services/preloader/preloader.service.spec.ts +16 -0
- package/src/lib/services/preloader/preloader.service.ts +28 -0
- package/src/lib/services/property/corelogic.service.spec.ts +12 -0
- package/src/lib/services/property/corelogic.service.ts +47 -0
- package/src/lib/services/property/property-calculation.service.spec.ts +16 -0
- package/src/lib/services/property/property-calculation.service.ts +166 -0
- package/src/lib/services/property/property-capital-cost.service.ts +42 -0
- package/src/lib/services/property/property-category.service.spec.ts +16 -0
- package/src/lib/services/property/property-category.service.ts +15 -0
- package/src/lib/services/property/property-document.service.spec.ts +16 -0
- package/src/lib/services/property/property-document.service.ts +74 -0
- package/src/lib/services/property/property-owner.service.spec.ts +12 -0
- package/src/lib/services/property/property-owner.service.ts +134 -0
- package/src/lib/services/property/property-sold.service.spec.ts +16 -0
- package/src/lib/services/property/property-sold.service.ts +15 -0
- package/src/lib/services/property/property.service.spec.ts +12 -0
- package/src/lib/services/property/property.service.ts +136 -0
- package/src/lib/services/subscription/subscription.service.spec.ts +12 -0
- package/src/lib/services/subscription/subscription.service.ts +153 -0
- package/src/lib/services/tax-review/tax-review-history.service.spec.ts +16 -0
- package/src/lib/services/tax-review/tax-review-history.service.ts +35 -0
- package/src/lib/services/tax-review/tax-review.service.spec.ts +16 -0
- package/src/lib/services/tax-review/tax-review.service.ts +114 -0
- package/src/lib/services/tax-summary/tax-summary.service.ts +70 -0
- package/src/lib/services/transaction/transaction-allocation.service.spec.ts +12 -0
- package/src/lib/services/transaction/transaction-allocation.service.ts +92 -0
- package/src/lib/services/transaction/transaction-calculation.service.spec.ts +16 -0
- package/src/lib/services/transaction/transaction-calculation.service.ts +50 -0
- package/src/lib/services/transaction/transaction.service.spec.ts +12 -0
- package/src/lib/services/transaction/transaction.service.ts +374 -0
- package/src/lib/services/user/occupation.service.spec.ts +12 -0
- package/src/lib/services/user/occupation.service.ts +42 -0
- package/src/lib/services/user/user-switcher.service.ts +34 -0
- package/src/lib/services/user/user.service.spec.ts +12 -0
- package/src/lib/services/user/user.service.ts +140 -0
- package/src/lib/services/user-event/user-event-setting.service.spec.ts +16 -0
- package/src/lib/services/user-event/user-event-setting.service.ts +60 -0
- package/src/lib/services/user-event/user-event-type.service.spec.ts +16 -0
- package/src/lib/services/user-event/user-event-type.service.ts +24 -0
- package/src/lib/services/work/work-tank.service.spec.ts +12 -0
- package/src/lib/services/work/work-tank.service.ts +277 -0
- package/src/lib/tt-core.module.ts +22 -0
- package/src/lib/tt-core.service.spec.ts +16 -0
- package/src/lib/tt-core.service.ts +17 -0
- package/src/public-api.ts +425 -0
- package/src/test.ts +27 -0
- package/tsconfig.lib.json +15 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +17 -0
- package/bundles/taxtank-core.umd.js +0 -97
- package/bundles/taxtank-core.umd.js.map +0 -1
- package/esm2015/lib/tt-core.module.js +0 -33
- package/esm2015/lib/tt-core.service.js +0 -23
- package/esm2015/public-api.js +0 -6
- package/esm2015/taxtank-core.js +0 -5
- package/fesm2015/taxtank-core.js +0 -64
- package/fesm2015/taxtank-core.js.map +0 -1
- package/lib/tt-core.module.d.ts +0 -9
- package/lib/tt-core.service.d.ts +0 -8
- package/public-api.d.ts +0 -2
- package/taxtank-core.d.ts +0 -5
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import has from 'lodash/has';
|
|
2
|
+
import get from 'lodash/get';
|
|
3
|
+
import flatten from 'lodash/flatten';
|
|
4
|
+
import { AbstractCollection } from './abstract.collection';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* List of collections grouped by passed property
|
|
8
|
+
*/
|
|
9
|
+
export class CollectionDictionary<Collection extends AbstractCollection<object>> {
|
|
10
|
+
/**
|
|
11
|
+
* List of grouped collections
|
|
12
|
+
*/
|
|
13
|
+
private items: { [key: string]: Collection } = {};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Constructor function of passed collection for creating new instances
|
|
17
|
+
*/
|
|
18
|
+
private collectionConstructor: new (items: object[]) => Collection;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @param collection The Collection instance to be grouped
|
|
22
|
+
* @param path Path to the property to be grouped (Examples: 'transaction', 'property.category')
|
|
23
|
+
* @param prop Optional: Field to group by (Default 'id', Examples: 'id', 'amount', 'date')
|
|
24
|
+
*/
|
|
25
|
+
constructor(
|
|
26
|
+
collection: Collection,
|
|
27
|
+
path: string = '',
|
|
28
|
+
prop: string = 'id'
|
|
29
|
+
) {
|
|
30
|
+
this.collectionConstructor = collection.constructor as new (items: object[]) => Collection;
|
|
31
|
+
|
|
32
|
+
// Nothing to group when collection is empty
|
|
33
|
+
if (!collection.length) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Check if the first collection item has property by path
|
|
38
|
+
if (!has(collection.items[0], path) && path) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
this.groupItems(collection, path, prop);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* List of collections keys
|
|
47
|
+
*/
|
|
48
|
+
get keys(): string[] {
|
|
49
|
+
return Object.keys(this.items);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Get collection by key or return empty collection if key does not exist
|
|
54
|
+
*/
|
|
55
|
+
get(key: string | number): Collection {
|
|
56
|
+
return this.items[key] ? this.items[key] : this.createCollection([]);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Add new item by key
|
|
61
|
+
*/
|
|
62
|
+
add(key: string | number, value: Collection) {
|
|
63
|
+
this.items[key] = value;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Join several collections by ids
|
|
68
|
+
*/
|
|
69
|
+
merge(keys: number[]): Collection {
|
|
70
|
+
return this.createCollection(
|
|
71
|
+
flatten(
|
|
72
|
+
keys.map((id: number): object[] => this.get(id.toString()).items)
|
|
73
|
+
)
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Create instance of collection
|
|
79
|
+
*/
|
|
80
|
+
createCollection(items: object[] = []): Collection {
|
|
81
|
+
return new this.collectionConstructor(items);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Group collection items by passed path into items object
|
|
86
|
+
*/
|
|
87
|
+
private groupItems(collection: Collection, path: string, prop: string): void {
|
|
88
|
+
// Create empty initial object for groups
|
|
89
|
+
const obj: { [key: string]: Array<object> } = {};
|
|
90
|
+
|
|
91
|
+
// Group collection items
|
|
92
|
+
collection.items.forEach((item: object): void => {
|
|
93
|
+
let key: string = get(item, `${path ? path + '.' : ''}${prop}`);
|
|
94
|
+
|
|
95
|
+
// if object does not have property for grouping it will be grouped as 'other'
|
|
96
|
+
if (key === undefined) {
|
|
97
|
+
key = 'other';
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (!obj[key]) {
|
|
101
|
+
obj[key] = [];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
obj[key].push(item);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// Create collections from groups
|
|
108
|
+
Object.keys(obj).forEach((key: string): void => {
|
|
109
|
+
this.items[key] = this.createCollection(obj[key]);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AbstractCollection } from './abstract.collection';
|
|
2
|
+
import { DepreciationForecast } from '../models/depreciation/depreciation-forecast';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Collection of depreciations
|
|
6
|
+
*/
|
|
7
|
+
export class DepreciationForecastCollection extends AbstractCollection<DepreciationForecast> {
|
|
8
|
+
filterByYear(financialYear: number): any {
|
|
9
|
+
return new DepreciationForecastCollection(
|
|
10
|
+
this.items.filter((forecast: DepreciationForecast) => forecast.financialYear === financialYear)
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
getClaimAmountByMonth(month: number): number {
|
|
15
|
+
return this.items.reduce((sum: number, item: DepreciationForecast): number => sum + item.getClaimAmountByMonth(month), 0);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get amount(): number {
|
|
19
|
+
return this.getSummary('amount');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
get claimAmount(): number {
|
|
23
|
+
return this.getSummary('claimAmount');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { TankTypeEnum } from '../db/Enums/tank-type.enum';
|
|
2
|
+
import { AbstractCollection } from './abstract.collection';
|
|
3
|
+
import { Depreciation } from '../models/depreciation/depreciation';
|
|
4
|
+
import uniqBy from 'lodash/uniqBy';
|
|
5
|
+
import compact from 'lodash/compact';
|
|
6
|
+
import { DepreciationCapitalProject } from '../models/depreciation/depreciation-capital-project';
|
|
7
|
+
|
|
8
|
+
export class DepreciationCollection extends AbstractCollection<Depreciation> {
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Get total amount of all depreciations in the collection
|
|
12
|
+
*/
|
|
13
|
+
get amount(): number {
|
|
14
|
+
return this.items.reduce((sum: number, depreciation: Depreciation): number => sum + depreciation.amount, 0);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
get claimAmount(): number {
|
|
18
|
+
return this.items.reduce((sum: number, depreciation: Depreciation) => {
|
|
19
|
+
return sum + depreciation.claimAmount;
|
|
20
|
+
}, 0);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
getClaimAmountByYear(year: number): number {
|
|
24
|
+
return this.items.reduce((sum: number, depreciation: Depreciation): number => {
|
|
25
|
+
return sum + depreciation.getClaimAmountByYear(year);
|
|
26
|
+
}, 0);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
get assetValue(): number {
|
|
30
|
+
return this.sumBy('assetValue');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Get new depreciations collections filtered by tank type
|
|
35
|
+
*/
|
|
36
|
+
getByTankType(tankType: TankTypeEnum): DepreciationCollection {
|
|
37
|
+
if (tankType === TankTypeEnum.PROPERTY) {
|
|
38
|
+
return new DepreciationCollection(
|
|
39
|
+
this.items.filter((depreciation: Depreciation): boolean => depreciation.isPropertyTank())
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return new DepreciationCollection(
|
|
44
|
+
this.items.filter((depreciation: Depreciation): boolean => depreciation.isWorkTank())
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
getByPropertiesIds(ids: number[]) {
|
|
49
|
+
return new DepreciationCollection(
|
|
50
|
+
this.items.filter((depreciation: Depreciation): boolean => ids.includes(depreciation.property?.id))
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
getWithoutBorrowingExpenses(): DepreciationCollection {
|
|
55
|
+
return new DepreciationCollection(
|
|
56
|
+
this.items.filter((depreciation: Depreciation): boolean => !depreciation.isBorrowingExpense())
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
getWorkDepreciations(): DepreciationCollection {
|
|
61
|
+
return new DepreciationCollection(
|
|
62
|
+
this.items.filter((depreciation: Depreciation): boolean => depreciation.isWorkTank())
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
getPropertyDepreciations(): DepreciationCollection {
|
|
67
|
+
return new DepreciationCollection(
|
|
68
|
+
this.items.filter((depreciation: Depreciation): boolean => depreciation.isPropertyTank())
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
getPlantEquipment(): DepreciationCollection {
|
|
73
|
+
return new DepreciationCollection(
|
|
74
|
+
this.items.filter((depreciation: Depreciation): boolean => depreciation.isPlantEquipment())
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
getCapitalDepreciations(): DepreciationCollection {
|
|
79
|
+
return new DepreciationCollection(
|
|
80
|
+
this.items.filter((depreciation: Depreciation): boolean => depreciation.isCapital())
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
getBorrowingExpenseDepreciations(): DepreciationCollection {
|
|
85
|
+
return new DepreciationCollection(
|
|
86
|
+
this.items.filter((depreciation: Depreciation): boolean => depreciation.isBorrowingExpense())
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
getWrittenOffDepreciations(): DepreciationCollection {
|
|
91
|
+
return new DepreciationCollection(
|
|
92
|
+
this.items.filter((depreciation: Depreciation): boolean => depreciation.isWrittenOff())
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
getLowValuePoolDepreciations(): DepreciationCollection {
|
|
97
|
+
return new DepreciationCollection(
|
|
98
|
+
this.items.filter((depreciation: Depreciation): boolean => depreciation.isLowValuePool())
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
getCapitalProjects(): DepreciationCapitalProject[] {
|
|
103
|
+
return uniqBy(
|
|
104
|
+
compact(
|
|
105
|
+
this.items.map((depreciation: Depreciation): DepreciationCapitalProject => {
|
|
106
|
+
return depreciation.depreciationCapitalProject;
|
|
107
|
+
})
|
|
108
|
+
),
|
|
109
|
+
'id'
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AbstractCollection } from './abstract.collection';
|
|
2
|
+
import { User } from '../models/user/user';
|
|
3
|
+
import { FirmTypeEnum } from '../db/Enums/firm-type.enum';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export class EmployeeCollection extends AbstractCollection<User> {
|
|
7
|
+
get accountant(): User {
|
|
8
|
+
return this.items.filter((user: User) => user.employeeDetails.firm.type === FirmTypeEnum.ACCOUNTANT)[0] ?? null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
get advisors(): User[] {
|
|
12
|
+
return this.items.filter((user: User) => user.employeeDetails.firm.type === FirmTypeEnum.ADVISOR);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AbstractCollection } from './abstract.collection';
|
|
2
|
+
import { IncomeSource } from '../models/income-source/income-source';
|
|
3
|
+
import { TankTypeEnum } from '../db/Enums/tank-type.enum';
|
|
4
|
+
import { IncomeSourceTypeEnum } from '../db/Enums/income-source-type.enum';
|
|
5
|
+
import { ISalaryForecast } from '../interfaces/salary-forecast.interface';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Collection of income sources
|
|
9
|
+
*/
|
|
10
|
+
export class IncomeSourceCollection extends AbstractCollection<IncomeSource> {
|
|
11
|
+
filterByTank(tank: TankTypeEnum): IncomeSource[] {
|
|
12
|
+
return this.items.filter((incomeSource: IncomeSource) => {
|
|
13
|
+
switch (tank) {
|
|
14
|
+
case TankTypeEnum.OTHER:
|
|
15
|
+
return incomeSource.isOtherIncome();
|
|
16
|
+
default:
|
|
17
|
+
return incomeSource.isSalaryIncome() || incomeSource.isWorkIncome();
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Filter income sources by provided tyoes
|
|
24
|
+
* @param types
|
|
25
|
+
*/
|
|
26
|
+
filterByTypes(types: IncomeSourceTypeEnum[]): IncomeSource[] {
|
|
27
|
+
return this.items.filter((incomeSource: IncomeSource) => types.includes(incomeSource.type));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Get income source by provided Id
|
|
32
|
+
* @param id
|
|
33
|
+
*/
|
|
34
|
+
getById(id: number): IncomeSource {
|
|
35
|
+
return this.items.find((incomeSource: IncomeSource) => incomeSource.id === id);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Get income sources list of forecasts
|
|
40
|
+
*/
|
|
41
|
+
get forecasts(): ISalaryForecast[] {
|
|
42
|
+
return this.items.map((incomeSource: IncomeSource) => incomeSource.forecasts).flat();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AbstractCollection } from './abstract.collection';
|
|
2
|
+
import { Loan } from '../models/loan/loan';
|
|
3
|
+
|
|
4
|
+
export class LoanCollection extends AbstractCollection<Loan> {
|
|
5
|
+
/**
|
|
6
|
+
* Get new collection of loans filtered by bank accounts ids
|
|
7
|
+
* @param ids list of bank accounts ids for filter
|
|
8
|
+
*/
|
|
9
|
+
getByBankAccountsIds(ids: number[]): LoanCollection {
|
|
10
|
+
return new LoanCollection(
|
|
11
|
+
this.items.filter((loan: Loan): boolean => ids.includes(loan.bankAccount?.id))
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Get single loan by bank account id
|
|
17
|
+
* @param id id of bank account
|
|
18
|
+
*/
|
|
19
|
+
getByBankAccountId(id: number): Loan {
|
|
20
|
+
return this.items.find((loan: Loan): boolean => loan.bankAccount?.id === id);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { VehicleLogbook } from '../models/logbook/vehicle-logbook';
|
|
2
|
+
import { FinancialYear } from '../models/financial-year/financial-year';
|
|
3
|
+
import { LogbookPeriod } from '../models/logbook/logbook-period';
|
|
4
|
+
import { Vehicle } from '../models/logbook/vehicle';
|
|
5
|
+
import { plainToClass } from 'class-transformer';
|
|
6
|
+
|
|
7
|
+
// Class contain array of vehicle logbooks and calculate the best period for logbook claim method
|
|
8
|
+
export class LogbookCollection {
|
|
9
|
+
// array of all trips
|
|
10
|
+
trips: VehicleLogbook[];
|
|
11
|
+
// 12 weeks in milliseconds to check logbooks range
|
|
12
|
+
logbookClaimRange: number = 12 * 7 * 24 * 3600 * 1000;
|
|
13
|
+
// current financial year object
|
|
14
|
+
financialYear: FinancialYear;
|
|
15
|
+
// default best period used for comparison in calculation
|
|
16
|
+
private _bestPeriod: LogbookPeriod;
|
|
17
|
+
|
|
18
|
+
constructor(
|
|
19
|
+
vehicles: Vehicle[]
|
|
20
|
+
) {
|
|
21
|
+
this.trips = vehicles.map((vehicle: Vehicle) => vehicle.logbook).flat();
|
|
22
|
+
this.financialYear = new FinancialYear();
|
|
23
|
+
this.setInitialBestPeriod();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// check if summary logbooks date range less than 84 days (12 weeks)
|
|
27
|
+
get isAutomaticLogbookCalculationAllowed(): boolean {
|
|
28
|
+
// forbid automatic logbook calculation if no logbook trips exist
|
|
29
|
+
if (!this.trips.length) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// forbid automatic logbook calculation if logbook trips summary date range less than 12 weeks
|
|
34
|
+
return this.trips.slice(-1)[0].date.getTime() - this.trips[0].date.getTime() >= this.logbookClaimRange;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
get bestPeriod(): LogbookPeriod {
|
|
38
|
+
// don't calculate if not allowed
|
|
39
|
+
if (!this.isAutomaticLogbookCalculationAllowed) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
this.calculateBestPeriod();
|
|
44
|
+
|
|
45
|
+
return this._bestPeriod;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private get workTrips(): VehicleLogbook[] {
|
|
49
|
+
return this.trips.filter((logbook: VehicleLogbook) => logbook.isWork);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// calculate best period for logbook claim method
|
|
53
|
+
private calculateBestPeriod(): void {
|
|
54
|
+
|
|
55
|
+
// set default best period values for real values comparison
|
|
56
|
+
this.setInitialBestPeriod();
|
|
57
|
+
|
|
58
|
+
// get best period with each trip date as start date
|
|
59
|
+
this.workTrips.forEach((logbook: VehicleLogbook) => {
|
|
60
|
+
const dateRange: {from: Date, to: Date} = this.getDateRange(logbook.date);
|
|
61
|
+
|
|
62
|
+
// get all trips included in current 12 weeks period
|
|
63
|
+
const tripsInRange: VehicleLogbook[] = this.trips.filter((l: VehicleLogbook) => {
|
|
64
|
+
return l.date >= dateRange.from && l.date <= dateRange.to;
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// get work trips included in current 12 weeks period
|
|
68
|
+
const workTripsInRange: VehicleLogbook[] = tripsInRange.filter((l: VehicleLogbook) => l.isWork);
|
|
69
|
+
|
|
70
|
+
// calculate sum of work kilometers in current 12 weeks range
|
|
71
|
+
const currentRangeKilometers: number = this.getKilometersAmount(workTripsInRange);
|
|
72
|
+
|
|
73
|
+
// overwrite best period with current 12 weeks range if amount of kilometers is bigger
|
|
74
|
+
if (currentRangeKilometers > this._bestPeriod.kilometers) {
|
|
75
|
+
this._bestPeriod = {
|
|
76
|
+
from: dateRange.from,
|
|
77
|
+
to: dateRange.to,
|
|
78
|
+
kilometers: currentRangeKilometers,
|
|
79
|
+
workUsage: this.getLogbooksWorkUsage(tripsInRange, workTripsInRange)
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private getDateRange(from: Date): {from: Date, to: Date} {
|
|
86
|
+
// set end date after 12 weeks after start date
|
|
87
|
+
let to: Date = new Date(from.getTime() + this.logbookClaimRange);
|
|
88
|
+
|
|
89
|
+
// set as period last 12 weeks of current year if period end date after end of current year
|
|
90
|
+
if (to > this.financialYear.endDate) {
|
|
91
|
+
to = this.financialYear.endDate;
|
|
92
|
+
from = new Date(to.getTime() - this.logbookClaimRange);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return {from, to};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// calculate kilometers amount for passed trips
|
|
99
|
+
private getKilometersAmount(logbooks: VehicleLogbook[]): number {
|
|
100
|
+
if (!logbooks.length) {
|
|
101
|
+
return 0;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return logbooks.map((logbook: VehicleLogbook) => logbook.odometerEnd - logbook.odometerStart)
|
|
105
|
+
.reduce((prev: number, next: number) => prev + Number(next));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// calculate work usage for passed trips
|
|
109
|
+
private getLogbooksWorkUsage(logbooks: VehicleLogbook[], workLogbooks: VehicleLogbook[]): number {
|
|
110
|
+
const kilometers: number = this.getKilometersAmount(logbooks);
|
|
111
|
+
const workKilometers: number = this.getKilometersAmount(workLogbooks);
|
|
112
|
+
return Math.round(workKilometers / kilometers * 100);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// set default best period with zero values and fin year start date for comparison in calculation
|
|
116
|
+
private setInitialBestPeriod(): void {
|
|
117
|
+
// set 1st of July of current year as default start date for best period
|
|
118
|
+
const startDate: Date = this.financialYear.startDate;
|
|
119
|
+
// set end custom-date after 12 weeks from start date
|
|
120
|
+
const endDate: Date = new Date(startDate.getTime() + this.logbookClaimRange);
|
|
121
|
+
|
|
122
|
+
this._bestPeriod = plainToClass(LogbookPeriod, {
|
|
123
|
+
from: startDate,
|
|
124
|
+
to: endDate,
|
|
125
|
+
kilometers: 0,
|
|
126
|
+
workUsage: 0
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AbstractCollection } from './abstract.collection';
|
|
2
|
+
import { MessageDocument } from '../models/chat/message-document';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Collection of MessageDocument instances
|
|
6
|
+
*/
|
|
7
|
+
export class MessageDocumentCollection extends AbstractCollection<MessageDocument> {
|
|
8
|
+
/**
|
|
9
|
+
* get list of documents which are not attached to any message
|
|
10
|
+
*/
|
|
11
|
+
getUnattached(): MessageDocumentCollection {
|
|
12
|
+
return new MessageDocumentCollection(
|
|
13
|
+
this.items.filter((doc: MessageDocument): boolean => !doc.message)
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AbstractCollection } from './abstract.collection';
|
|
2
|
+
import { Message } from '../models/chat/message';
|
|
3
|
+
import { User } from '../models/user/user';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export class MessageCollection extends AbstractCollection<Message> {
|
|
7
|
+
getFirstUnreadMessage(user: User): Message {
|
|
8
|
+
return this.items.find((message: Message): boolean => {
|
|
9
|
+
return !message.isRead() && message.isFromEmployee() !== user.isEmployee();
|
|
10
|
+
}
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Get List of unread chats
|
|
16
|
+
*/
|
|
17
|
+
getUnread(): Message[] {
|
|
18
|
+
return this.items.filter((message: Message): boolean => !message.readAt);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Check if chat has unread chats
|
|
23
|
+
*/
|
|
24
|
+
hasUnread(): boolean {
|
|
25
|
+
return !!this.getUnread().length;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { AbstractCollection } from './abstract.collection';
|
|
2
|
+
import { Property } from '../models/property/property';
|
|
3
|
+
import { FinancialYear } from '../models/financial-year/financial-year';
|
|
4
|
+
|
|
5
|
+
export class PropertyCollection extends AbstractCollection<Property> {
|
|
6
|
+
/**
|
|
7
|
+
* Get new property collection filtered by category id
|
|
8
|
+
* @param id id of category for filter
|
|
9
|
+
*/
|
|
10
|
+
getByCategoryId(id: number): PropertyCollection {
|
|
11
|
+
return new PropertyCollection(
|
|
12
|
+
this.items.filter((property: Property): boolean => property.category.id === id)
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Get new property collection filtered by active status
|
|
18
|
+
*/
|
|
19
|
+
getActiveProperties(): PropertyCollection {
|
|
20
|
+
return new PropertyCollection(
|
|
21
|
+
this.items.filter((property: Property): boolean => property.isActive)
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Get new property collection filtered by owner
|
|
27
|
+
*/
|
|
28
|
+
getOwnProperties(): PropertyCollection {
|
|
29
|
+
return new PropertyCollection(
|
|
30
|
+
this.items.filter((property: Property): boolean => property.isOwn())
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Get new property collection filtered by shared
|
|
36
|
+
*/
|
|
37
|
+
getSharedProperties(): PropertyCollection {
|
|
38
|
+
return new PropertyCollection(
|
|
39
|
+
this.items.filter((property: Property): boolean => !property.isOwn())
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Get total purchase price for all properties in the collection
|
|
45
|
+
*/
|
|
46
|
+
get purchasePrice(): number {
|
|
47
|
+
return this.sumBy('purchasePrice');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
get growthPercent(): number {
|
|
51
|
+
return this.sumBy('growthPercent');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
get marketValue(): number {
|
|
55
|
+
return this.sumBy('marketValue');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
get forecastedRentalReturn(): number {
|
|
59
|
+
return this.sumBy('forecastedRentalReturn');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
get forecastedTaxPosition(): number {
|
|
63
|
+
return this.sumBy('forecastedTaxPosition');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
get firstForecastYear(): number {
|
|
67
|
+
return this.items.reduce((min: number, property: Property): number => {
|
|
68
|
+
const current: number = property.firstForecastYear;
|
|
69
|
+
return min > current ? current : min;
|
|
70
|
+
}, new FinancialYear().year);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
get marketValueGrowth(): number {
|
|
74
|
+
return this.sumBy('marketValueGrowth');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
getOwnerOccupiedProperties(): PropertyCollection {
|
|
78
|
+
return new PropertyCollection(
|
|
79
|
+
this.items.filter((property: Property): boolean => property.category.isOwnerOccupied())
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
get earliestPurchaseDate(): Date {
|
|
84
|
+
return this.items.reduce((min: Date, property: Property): Date => {
|
|
85
|
+
return min < property.purchaseDate ? min : property.purchaseDate;
|
|
86
|
+
}, new FinancialYear(new Date()).startDate);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AbstractCollection } from './abstract.collection';
|
|
2
|
+
import { ServicePrice } from '../models/service-subscription/service-price';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export class ServicePriceCollection extends AbstractCollection<ServicePrice> {
|
|
6
|
+
get work(): ServicePrice {
|
|
7
|
+
return this.items.filter((price: ServicePrice) => price.product.isWork())[0];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
get property(): ServicePrice {
|
|
11
|
+
return this.items.filter((price: ServicePrice) => price.product.isProperty())[0];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AbstractCollection } from './abstract.collection';
|
|
2
|
+
import { ServiceSubscription } from '../models/service-subscription/service-subscription';
|
|
3
|
+
|
|
4
|
+
export class ServiceSubscriptionCollection extends AbstractCollection<ServiceSubscription> {
|
|
5
|
+
get individual(): ServiceSubscription {
|
|
6
|
+
return this.items.filter((subscription: ServiceSubscription) => subscription.isIndividual())[0];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
get investor(): ServiceSubscription {
|
|
10
|
+
return this.items.filter((subscription: ServiceSubscription) => subscription.isInvestor())[0];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
get investorPlus(): ServiceSubscription {
|
|
14
|
+
return this.items.filter((subscription: ServiceSubscription) => subscription.isInvestorPlus())[0];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getRecommended(properties: number): ServiceSubscription {
|
|
18
|
+
return this.items.filter((subscription: ServiceSubscription) => subscription.propertyQuantity === properties)[0] ?? this.investor;
|
|
19
|
+
}
|
|
20
|
+
}
|