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.
Files changed (476) hide show
  1. package/.browserslistrc +16 -0
  2. package/karma.conf.js +44 -0
  3. package/ng-package.json +12 -0
  4. package/package.json +13 -12
  5. package/src/lib/collections/abstract.collection.ts +83 -0
  6. package/src/lib/collections/bank-account.collection.ts +171 -0
  7. package/src/lib/collections/bank-transaction.collection.ts +153 -0
  8. package/src/lib/collections/client-movement.collection.ts +42 -0
  9. package/src/lib/collections/client-portfolio-report.collection.ts +47 -0
  10. package/src/lib/collections/client.collection.ts +5 -0
  11. package/src/lib/collections/collection-dictionary.ts +112 -0
  12. package/src/lib/collections/depreciation-forecast.collection.ts +25 -0
  13. package/src/lib/collections/depreciation.collection.ts +113 -0
  14. package/src/lib/collections/employee.collection.ts +14 -0
  15. package/src/lib/collections/income-source.collection.ts +44 -0
  16. package/src/lib/collections/loan.collection.ts +22 -0
  17. package/src/lib/collections/logbook.collection.ts +129 -0
  18. package/src/lib/collections/message-document.collection.ts +16 -0
  19. package/src/lib/collections/message.collection.ts +27 -0
  20. package/src/lib/collections/property.collection.ts +88 -0
  21. package/src/lib/collections/service-price.collection.ts +13 -0
  22. package/src/lib/collections/service-subscription.collection.ts +20 -0
  23. package/src/lib/collections/tax-return-category-item.collection.ts +148 -0
  24. package/src/lib/collections/tax-review.collection.ts +64 -0
  25. package/src/lib/collections/transaction-allocation.collection.ts +54 -0
  26. package/src/lib/collections/transaction.collection.ts +170 -0
  27. package/src/lib/collections/user-event-setting.collection.ts +70 -0
  28. package/src/lib/db/Enums/address-type.enum.ts +4 -0
  29. package/src/lib/db/Enums/bank-account-status.enum.ts +4 -0
  30. package/src/lib/db/Enums/bank-account-type.enum.ts +10 -0
  31. package/src/lib/db/Enums/bank-connection-status.enum.ts +5 -0
  32. package/src/lib/db/Enums/bank-transaction-type.enum.ts +4 -0
  33. package/src/lib/db/Enums/chart-accounts-category.enum.ts +13 -0
  34. package/src/lib/db/Enums/chart-accounts-etp.enum.ts +7 -0
  35. package/src/lib/db/Enums/chart-accounts-heading-tax-deductible.enum.ts +6 -0
  36. package/src/lib/db/Enums/chart-accounts-heading-taxable.enum.ts +6 -0
  37. package/src/lib/db/Enums/chart-accounts-heading-vehicle-list.enum.ts +4 -0
  38. package/src/lib/db/Enums/chart-accounts-list.enum.ts +19 -0
  39. package/src/lib/db/Enums/chart-accounts-metadata-list.enum.ts +14 -0
  40. package/src/lib/db/Enums/chart-accounts-metadata-type.enum.ts +4 -0
  41. package/src/lib/db/Enums/chart-accounts-type.enum.ts +4 -0
  42. package/src/lib/db/Enums/chat-status.enum.ts +4 -0
  43. package/src/lib/db/Enums/client-details-medicare-exemption.enum.ts +5 -0
  44. package/src/lib/db/Enums/client-details-work-depreciation-calculation.enum.ts +4 -0
  45. package/src/lib/db/Enums/client-details-working-holiday-maker.enum.ts +5 -0
  46. package/src/lib/db/Enums/client-invite-status.enum.ts +4 -0
  47. package/src/lib/db/Enums/client-invite-type.enum.ts +4 -0
  48. package/src/lib/db/Enums/depreciation-calculation-percent.enum.ts +7 -0
  49. package/src/lib/db/Enums/depreciation-calculation.enum.ts +7 -0
  50. package/src/lib/db/Enums/depreciation-type.enum.ts +6 -0
  51. package/src/lib/db/Enums/depreciation-write-off-amount.enum.ts +4 -0
  52. package/src/lib/db/Enums/firm-type.enum.ts +4 -0
  53. package/src/lib/db/Enums/income-source-type-list-other.enum.ts +6 -0
  54. package/src/lib/db/Enums/income-source-type-list-salary.enum.ts +3 -0
  55. package/src/lib/db/Enums/income-source-type-list-work.enum.ts +8 -0
  56. package/src/lib/db/Enums/income-source-type.enum.ts +5 -0
  57. package/src/lib/db/Enums/invite-status.enum.ts +5 -0
  58. package/src/lib/db/Enums/loan-bank-type.enum.ts +10 -0
  59. package/src/lib/db/Enums/loan-frequency.enum.ts +6 -0
  60. package/src/lib/db/Enums/loan-interest-type.enum.ts +4 -0
  61. package/src/lib/db/Enums/loan-payout-type.enum.ts +4 -0
  62. package/src/lib/db/Enums/loan-repayment-frequency.enum.ts +5 -0
  63. package/src/lib/db/Enums/loan-repayment-type.enum.ts +4 -0
  64. package/src/lib/db/Enums/loan-type.enum.ts +12 -0
  65. package/src/lib/db/Enums/loan-vehicle-type.enum.ts +5 -0
  66. package/src/lib/db/Enums/phone-type.enum.ts +4 -0
  67. package/src/lib/db/Enums/property-depreciation-calculation.enum.ts +4 -0
  68. package/src/lib/db/Enums/property-owner-access.enum.ts +4 -0
  69. package/src/lib/db/Enums/property-owner-status.enum.ts +5 -0
  70. package/src/lib/db/Enums/registration-invite-status.enum.ts +4 -0
  71. package/src/lib/db/Enums/salary-forecast-frequency.enum.ts +6 -0
  72. package/src/lib/db/Enums/service-notification-status.enum.ts +5 -0
  73. package/src/lib/db/Enums/service-notification-type.enum.ts +4 -0
  74. package/src/lib/db/Enums/service-payment-status.enum.ts +4 -0
  75. package/src/lib/db/Enums/service-price-recurring-interval.enum.ts +6 -0
  76. package/src/lib/db/Enums/service-price-type.enum.ts +4 -0
  77. package/src/lib/db/Enums/service-subscription-status.enum.ts +8 -0
  78. package/src/lib/db/Enums/spare-document-spare-type.enum.ts +4 -0
  79. package/src/lib/db/Enums/tank-type.enum.ts +5 -0
  80. package/src/lib/db/Enums/tax-calculation-medicare-exemption.enum.ts +4 -0
  81. package/src/lib/db/Enums/tax-calculation-type.enum.ts +12 -0
  82. package/src/lib/db/Enums/tax-return-category-list.enum.ts +26 -0
  83. package/src/lib/db/Enums/tax-return-category-section.enum.ts +6 -0
  84. package/src/lib/db/Enums/tax-review-status.enum.ts +11 -0
  85. package/src/lib/db/Enums/tax-summary-list.enum.ts +15 -0
  86. package/src/lib/db/Enums/tax-summary-section.enum.ts +6 -0
  87. package/src/lib/db/Enums/tax-summary-tax-summary.enum.ts +15 -0
  88. package/src/lib/db/Enums/ticket-feedback.enum.ts +4 -0
  89. package/src/lib/db/Enums/ticket-status.enum.ts +7 -0
  90. package/src/lib/db/Enums/ticket-types.enum.ts +3 -0
  91. package/src/lib/db/Enums/transaction-operation.enum.ts +5 -0
  92. package/src/lib/db/Enums/transaction-source.enum.ts +4 -0
  93. package/src/lib/db/Enums/transaction-type.enum.ts +4 -0
  94. package/src/lib/db/Enums/user-event-status.enum.ts +6 -0
  95. package/src/lib/db/Enums/user-event-type-frequency.enum.ts +6 -0
  96. package/src/lib/db/Enums/user-event-type-reminder-type.enum.ts +6 -0
  97. package/src/lib/db/Enums/user-event-type-reminder.enum.ts +5 -0
  98. package/src/lib/db/Enums/user-event-type-type.enum.ts +33 -0
  99. package/src/lib/db/Enums/user-medicare-exemption.enum.ts +5 -0
  100. package/src/lib/db/Enums/user-roles.enum.ts +13 -0
  101. package/src/lib/db/Enums/user-status.enum.ts +6 -0
  102. package/src/lib/db/Enums/user-title.enum.ts +7 -0
  103. package/src/lib/db/Enums/user-work-depreciation-calculation.enum.ts +4 -0
  104. package/src/lib/db/Enums/user-working-holiday-maker.enum.ts +5 -0
  105. package/src/lib/db/Enums/vehicle-claim-method.enum.ts +4 -0
  106. package/src/lib/db/Enums/vehicle-logbook-purpose.enum.ts +4 -0
  107. package/src/lib/db/Models/address.ts +20 -0
  108. package/src/lib/db/Models/bank-account-balance.ts +13 -0
  109. package/src/lib/db/Models/bank-account-property.ts +9 -0
  110. package/src/lib/db/Models/bank-account.ts +34 -0
  111. package/src/lib/db/Models/bank-connection.ts +15 -0
  112. package/src/lib/db/Models/bank-provider-account.ts +13 -0
  113. package/src/lib/db/Models/bank-transaction-import.ts +12 -0
  114. package/src/lib/db/Models/bank-transaction-rule.ts +26 -0
  115. package/src/lib/db/Models/bank-transaction.ts +17 -0
  116. package/src/lib/db/Models/bank.ts +12 -0
  117. package/src/lib/db/Models/basiq-job.ts +9 -0
  118. package/src/lib/db/Models/borrowing-expense-loan.ts +15 -0
  119. package/src/lib/db/Models/borrowing-expense.ts +7 -0
  120. package/src/lib/db/Models/capital-cost-property.ts +14 -0
  121. package/src/lib/db/Models/capital-cost.ts +4 -0
  122. package/src/lib/db/Models/chart-accounts-depreciation.ts +11 -0
  123. package/src/lib/db/Models/chart-accounts-heading.ts +7 -0
  124. package/src/lib/db/Models/chart-accounts-metadata.ts +12 -0
  125. package/src/lib/db/Models/chart-accounts-value.ts +13 -0
  126. package/src/lib/db/Models/chart-accounts.ts +24 -0
  127. package/src/lib/db/Models/chat.ts +18 -0
  128. package/src/lib/db/Models/client-details.ts +30 -0
  129. package/src/lib/db/Models/client-invite.ts +17 -0
  130. package/src/lib/db/Models/client-movement.ts +13 -0
  131. package/src/lib/db/Models/country.ts +5 -0
  132. package/src/lib/db/Models/depreciation-capital-project.ts +14 -0
  133. package/src/lib/db/Models/depreciation-forecast.ts +19 -0
  134. package/src/lib/db/Models/depreciation-receipt.ts +12 -0
  135. package/src/lib/db/Models/depreciation.ts +43 -0
  136. package/src/lib/db/Models/document-base.ts +10 -0
  137. package/src/lib/db/Models/document-folder.ts +10 -0
  138. package/src/lib/db/Models/document.ts +12 -0
  139. package/src/lib/db/Models/employee-details.ts +8 -0
  140. package/src/lib/db/Models/employee-invite.ts +10 -0
  141. package/src/lib/db/Models/financial-data-system.ts +10 -0
  142. package/src/lib/db/Models/firm-invite.ts +15 -0
  143. package/src/lib/db/Models/firm.ts +29 -0
  144. package/src/lib/db/Models/income-source-forecast.ts +13 -0
  145. package/src/lib/db/Models/income-source-type.ts +9 -0
  146. package/src/lib/db/Models/income-source.ts +21 -0
  147. package/src/lib/db/Models/loan-payout.ts +13 -0
  148. package/src/lib/db/Models/loan.ts +34 -0
  149. package/src/lib/db/Models/message-document.ts +16 -0
  150. package/src/lib/db/Models/message.ts +16 -0
  151. package/src/lib/db/Models/occupation.ts +5 -0
  152. package/src/lib/db/Models/phone.ts +13 -0
  153. package/src/lib/db/Models/property-capital-cost.ts +14 -0
  154. package/src/lib/db/Models/property-category-movement.ts +18 -0
  155. package/src/lib/db/Models/property-category.ts +14 -0
  156. package/src/lib/db/Models/property-document.ts +14 -0
  157. package/src/lib/db/Models/property-forecast.ts +15 -0
  158. package/src/lib/db/Models/property-owner.ts +21 -0
  159. package/src/lib/db/Models/property-sold.ts +13 -0
  160. package/src/lib/db/Models/property-subscription.ts +10 -0
  161. package/src/lib/db/Models/property-valuation.ts +13 -0
  162. package/src/lib/db/Models/property.ts +42 -0
  163. package/src/lib/db/Models/registration-invite.ts +13 -0
  164. package/src/lib/db/Models/salary-forecast.ts +16 -0
  165. package/src/lib/db/Models/service-notification.ts +14 -0
  166. package/src/lib/db/Models/service-payment.ts +12 -0
  167. package/src/lib/db/Models/service-price.ts +16 -0
  168. package/src/lib/db/Models/service-product.ts +13 -0
  169. package/src/lib/db/Models/service-subscription-item.ts +10 -0
  170. package/src/lib/db/Models/service-subscription.ts +15 -0
  171. package/src/lib/db/Models/spare-document-category.ts +6 -0
  172. package/src/lib/db/Models/spare-document.ts +16 -0
  173. package/src/lib/db/Models/tax-calculation.ts +19 -0
  174. package/src/lib/db/Models/tax-return-category.ts +13 -0
  175. package/src/lib/db/Models/tax-return-item.ts +16 -0
  176. package/src/lib/db/Models/tax-return.ts +9 -0
  177. package/src/lib/db/Models/tax-review.ts +14 -0
  178. package/src/lib/db/Models/ticket.ts +20 -0
  179. package/src/lib/db/Models/transaction-allocation.ts +9 -0
  180. package/src/lib/db/Models/transaction-base.ts +33 -0
  181. package/src/lib/db/Models/transaction-metadata.ts +12 -0
  182. package/src/lib/db/Models/transaction-receipt.ts +12 -0
  183. package/src/lib/db/Models/transaction.ts +44 -0
  184. package/src/lib/db/Models/user-event-setting.ts +11 -0
  185. package/src/lib/db/Models/user-event-type.ts +16 -0
  186. package/src/lib/db/Models/user-event.ts +14 -0
  187. package/src/lib/db/Models/user.ts +52 -0
  188. package/src/lib/db/Models/vehicle-claim.ts +12 -0
  189. package/src/lib/db/Models/vehicle-logbook.ts +17 -0
  190. package/src/lib/db/Models/vehicle.ts +9 -0
  191. package/src/lib/functions/array/index.ts +3 -0
  192. package/src/lib/functions/array/replace.ts +5 -0
  193. package/src/lib/functions/array/sort-deep.ts +19 -0
  194. package/src/lib/functions/array/sort.ts +8 -0
  195. package/src/lib/functions/clone-deep.ts +4 -0
  196. package/src/lib/functions/create-date.ts +7 -0
  197. package/src/lib/functions/enum-to-list.ts +16 -0
  198. package/src/lib/functions/get-doc-icon.ts +21 -0
  199. package/src/lib/functions/mat-options-functions.ts +11 -0
  200. package/src/lib/functions/mat-sort-options.ts +9 -0
  201. package/src/lib/functions/round-to.ts +9 -0
  202. package/src/lib/functions/tax-review-filter-predicate.ts +11 -0
  203. package/src/lib/interfaces/asset-entity-type.enum.ts +10 -0
  204. package/src/lib/interfaces/asset-type.enum.ts +9 -0
  205. package/src/lib/interfaces/asset.interface.ts +18 -0
  206. package/src/lib/interfaces/chart-data.interface.ts +11 -0
  207. package/src/lib/interfaces/chart-serie.interface.ts +8 -0
  208. package/src/lib/interfaces/document.interface.ts +20 -0
  209. package/src/lib/interfaces/documentable.interface.ts +9 -0
  210. package/src/lib/interfaces/event-listener.interface.ts +9 -0
  211. package/src/lib/interfaces/income-source-forecast.interface.ts +7 -0
  212. package/src/lib/interfaces/option.interface.ts +4 -0
  213. package/src/lib/interfaces/photoable.ts +14 -0
  214. package/src/lib/interfaces/receipt.interface.ts +13 -0
  215. package/src/lib/interfaces/salary-forecast.interface.ts +17 -0
  216. package/src/lib/interfaces/tank.interface.ts +9 -0
  217. package/src/lib/models/address/address.ts +24 -0
  218. package/src/lib/models/address/country.ts +17 -0
  219. package/src/lib/models/bank/bank-account-chart-data.ts +42 -0
  220. package/src/lib/models/bank/bank-account-property.ts +8 -0
  221. package/src/lib/models/bank/bank-account-types.const.ts +15 -0
  222. package/src/lib/models/bank/bank-account.ts +136 -0
  223. package/src/lib/models/bank/bank-connection.ts +12 -0
  224. package/src/lib/models/bank/bank-transaction-chart-data.ts +132 -0
  225. package/src/lib/models/bank/bank-transaction-summary-fields.enum.ts +4 -0
  226. package/src/lib/models/bank/bank-transaction.ts +74 -0
  227. package/src/lib/models/bank/bank.ts +21 -0
  228. package/src/lib/models/bank/basiq-job.ts +4 -0
  229. package/src/lib/models/bank/basiq-token.ts +16 -0
  230. package/src/lib/models/bank/type-loan.const.ts +7 -0
  231. package/src/lib/models/borrowing-expense/borrowing-expense-loan.ts +4 -0
  232. package/src/lib/models/borrowing-expense/borrowing-expense.ts +4 -0
  233. package/src/lib/models/chart/chart-data.ts +13 -0
  234. package/src/lib/models/chart/chart-serie.ts +8 -0
  235. package/src/lib/models/chart-accounts/chart-accounts-categories.const.ts +85 -0
  236. package/src/lib/models/chart-accounts/chart-accounts-depreciation.ts +14 -0
  237. package/src/lib/models/chart-accounts/chart-accounts-heading.ts +6 -0
  238. package/src/lib/models/chart-accounts/chart-accounts-metadata.ts +15 -0
  239. package/src/lib/models/chart-accounts/chart-accounts-tax-labels.enum.ts +5 -0
  240. package/src/lib/models/chart-accounts/chart-accounts.ts +137 -0
  241. package/src/lib/models/chat/chat-view-type.enum.ts +4 -0
  242. package/src/lib/models/chat/chat.ts +23 -0
  243. package/src/lib/models/chat/message-document.ts +18 -0
  244. package/src/lib/models/chat/message.ts +40 -0
  245. package/src/lib/models/client/client-details.ts +4 -0
  246. package/src/lib/models/client/client-invite.ts +70 -0
  247. package/src/lib/models/client/client-movement.ts +25 -0
  248. package/src/lib/models/client/client-portfolio-chart-data.ts +65 -0
  249. package/src/lib/models/client/client-portfolio-report.ts +10 -0
  250. package/src/lib/models/depreciation/depreciation-capital-project.ts +10 -0
  251. package/src/lib/models/depreciation/depreciation-forecast.ts +31 -0
  252. package/src/lib/models/depreciation/depreciation-group-item.ts +20 -0
  253. package/src/lib/models/depreciation/depreciation-group.enum.ts +7 -0
  254. package/src/lib/models/depreciation/depreciation-group.ts +25 -0
  255. package/src/lib/models/depreciation/depreciation-groups.const.ts +35 -0
  256. package/src/lib/models/depreciation/depreciation-receipt.ts +9 -0
  257. package/src/lib/models/depreciation/depreciation.ts +174 -0
  258. package/src/lib/models/document/document-api-url-prefix.enum.ts +7 -0
  259. package/src/lib/models/document/document-file-types.const.ts +22 -0
  260. package/src/lib/models/document/document-folder.ts +11 -0
  261. package/src/lib/models/document/document.ts +29 -0
  262. package/src/lib/models/employee/employee-details.ts +8 -0
  263. package/src/lib/models/employee/employee-invite.ts +12 -0
  264. package/src/lib/models/endpoint/endpoint.ts +35 -0
  265. package/src/lib/models/endpoint/endpoints.const.ts +157 -0
  266. package/src/lib/models/event/app-event-type.enum.ts +37 -0
  267. package/src/lib/models/event/app-event.ts +9 -0
  268. package/src/lib/models/file/icons-file.enum.ts +5 -0
  269. package/src/lib/models/financial-year/financial-year.ts +57 -0
  270. package/src/lib/models/financial-year/month-name-short.enum.ts +19 -0
  271. package/src/lib/models/financial-year/month-number.enum.ts +19 -0
  272. package/src/lib/models/financial-year/months.const.ts +1 -0
  273. package/src/lib/models/firm/firm.ts +31 -0
  274. package/src/lib/models/income-position/income-position.ts +13 -0
  275. package/src/lib/models/income-source/income-source-chart-data.ts +57 -0
  276. package/src/lib/models/income-source/income-source-forecast.ts +35 -0
  277. package/src/lib/models/income-source/income-source-type.ts +30 -0
  278. package/src/lib/models/income-source/income-source.ts +57 -0
  279. package/src/lib/models/income-source/salary-forecast.ts +23 -0
  280. package/src/lib/models/loan/loan-max-number-of-payments.enum.ts +8 -0
  281. package/src/lib/models/loan/loan-payment.ts +17 -0
  282. package/src/lib/models/loan/loan-payout.ts +13 -0
  283. package/src/lib/models/loan/loan.ts +38 -0
  284. package/src/lib/models/logbook/default-vehicle-expense.ts +20 -0
  285. package/src/lib/models/logbook/logbook-period.ts +12 -0
  286. package/src/lib/models/logbook/logbook-purpose-options.const.ts +6 -0
  287. package/src/lib/models/logbook/vehicle-claim.ts +27 -0
  288. package/src/lib/models/logbook/vehicle-logbook.ts +16 -0
  289. package/src/lib/models/logbook/vehicle.ts +46 -0
  290. package/src/lib/models/notification/notification-event-types.const.ts +43 -0
  291. package/src/lib/models/notification/notification.ts +66 -0
  292. package/src/lib/models/phone/phone.ts +10 -0
  293. package/src/lib/models/property/calculation-form-item.ts +24 -0
  294. package/src/lib/models/property/calculation-form-type.enum.ts +7 -0
  295. package/src/lib/models/property/capital-costs-itmes.const.ts +57 -0
  296. package/src/lib/models/property/corelogic-suggestion.ts +18 -0
  297. package/src/lib/models/property/ownership-filter-options.enum.ts +8 -0
  298. package/src/lib/models/property/property-capital-cost.ts +4 -0
  299. package/src/lib/models/property/property-category-movement.ts +18 -0
  300. package/src/lib/models/property/property-category.ts +9 -0
  301. package/src/lib/models/property/property-document.ts +21 -0
  302. package/src/lib/models/property/property-equity-chart-data.ts +188 -0
  303. package/src/lib/models/property/property-equity-chart-item.ts +35 -0
  304. package/src/lib/models/property/property-equity-chart-type.enum.ts +4 -0
  305. package/src/lib/models/property/property-forecast.ts +55 -0
  306. package/src/lib/models/property/property-owner.ts +50 -0
  307. package/src/lib/models/property/property-sold.ts +10 -0
  308. package/src/lib/models/property/property-subscription.ts +11 -0
  309. package/src/lib/models/property/property-valuation.ts +24 -0
  310. package/src/lib/models/property/property.ts +157 -0
  311. package/src/lib/models/registration-invite/registration-invite.ts +12 -0
  312. package/src/lib/models/service-subscription/module-url-list.const.ts +11 -0
  313. package/src/lib/models/service-subscription/service-payment.ts +8 -0
  314. package/src/lib/models/service-subscription/service-price.ts +8 -0
  315. package/src/lib/models/service-subscription/service-product.ts +11 -0
  316. package/src/lib/models/service-subscription/service-subscription-item.ts +12 -0
  317. package/src/lib/models/service-subscription/service-subscription.ts +151 -0
  318. package/src/lib/models/service-subscription/subscription-description.const.ts +8 -0
  319. package/src/lib/models/service-subscription/subscription-title.const.ts +8 -0
  320. package/src/lib/models/service-subscription/subscription-type.enum.ts +6 -0
  321. package/src/lib/models/tax-review/tax-review.ts +96 -0
  322. package/src/lib/models/tax-summary/tax-return-category-item-details.ts +14 -0
  323. package/src/lib/models/tax-summary/tax-return-category-item.ts +22 -0
  324. package/src/lib/models/tax-summary/tax-summary-section.ts +32 -0
  325. package/src/lib/models/tax-summary/tax-summary-type.enum.ts +7 -0
  326. package/src/lib/models/tax-summary/tax-summary.ts +79 -0
  327. package/src/lib/models/transaction/income-amount-type.enum.ts +7 -0
  328. package/src/lib/models/transaction/transaction-allocation.ts +20 -0
  329. package/src/lib/models/transaction/transaction-metadata.ts +8 -0
  330. package/src/lib/models/transaction/transaction-receipt.ts +9 -0
  331. package/src/lib/models/transaction/transaction.ts +241 -0
  332. package/src/lib/models/user/my-account-history-initiated-by.enum.ts +4 -0
  333. package/src/lib/models/user/my-account-history-status.enum.ts +4 -0
  334. package/src/lib/models/user/my-account-history-type.enum.ts +5 -0
  335. package/src/lib/models/user/my-account-history.ts +12 -0
  336. package/src/lib/models/user/occupation.ts +4 -0
  337. package/src/lib/models/user/user-roles.const.ts +13 -0
  338. package/src/lib/models/user/user-to-register.ts +7 -0
  339. package/src/lib/models/user/user-work-position.const.ts +7 -0
  340. package/src/lib/models/user/user.ts +160 -0
  341. package/src/lib/models/user-event/user-event-category.enum.ts +9 -0
  342. package/src/lib/models/user-event/user-event-category.ts +9 -0
  343. package/src/lib/models/user-event/user-event-setting-field.enum.ts +8 -0
  344. package/src/lib/models/user-event/user-event-setting.ts +11 -0
  345. package/src/lib/models/user-event/user-event-type.ts +22 -0
  346. package/src/lib/services/address/address.service.spec.ts +12 -0
  347. package/src/lib/services/address/address.service.ts +36 -0
  348. package/src/lib/services/asset/assets.service.spec.ts +12 -0
  349. package/src/lib/services/asset/assets.service.ts +51 -0
  350. package/src/lib/services/auth/auth.service.ts +48 -0
  351. package/src/lib/services/auth/jwt.service.ts +37 -0
  352. package/src/lib/services/bank/bank-account-calculation.service.spec.ts +16 -0
  353. package/src/lib/services/bank/bank-account-calculation.service.ts +38 -0
  354. package/src/lib/services/bank/bank-account.service.spec.ts +12 -0
  355. package/src/lib/services/bank/bank-account.service.ts +120 -0
  356. package/src/lib/services/bank/bank-connection.service.spec.ts +12 -0
  357. package/src/lib/services/bank/bank-connection.service.ts +42 -0
  358. package/src/lib/services/bank/bank-transaction-calculation.service.spec.ts +16 -0
  359. package/src/lib/services/bank/bank-transaction-calculation.service.ts +71 -0
  360. package/src/lib/services/bank/bank-transaction.service.spec.ts +12 -0
  361. package/src/lib/services/bank/bank-transaction.service.ts +97 -0
  362. package/src/lib/services/bank/bank.service.spec.ts +12 -0
  363. package/src/lib/services/bank/bank.service.ts +16 -0
  364. package/src/lib/services/bank/basiq.service.spec.ts +12 -0
  365. package/src/lib/services/bank/basiq.service.ts +103 -0
  366. package/src/lib/services/base-rest.service.spec.ts +13 -0
  367. package/src/lib/services/base-rest.service.ts +229 -0
  368. package/src/lib/services/borrowing-expense/borrowing-expense.service.spec.ts +12 -0
  369. package/src/lib/services/borrowing-expense/borrowing-expense.service.ts +82 -0
  370. package/src/lib/services/chart-accounts/chart-accounts-depreciations.service.spec.ts +16 -0
  371. package/src/lib/services/chart-accounts/chart-accounts-depreciations.service.ts +34 -0
  372. package/src/lib/services/chart-accounts/chart-accounts.service.spec.ts +12 -0
  373. package/src/lib/services/chart-accounts/chart-accounts.service.ts +101 -0
  374. package/src/lib/services/chat/chat.service.spec.ts +16 -0
  375. package/src/lib/services/chat/chat.service.ts +79 -0
  376. package/src/lib/services/chat/message-document.service.spec.ts +16 -0
  377. package/src/lib/services/chat/message-document.service.ts +133 -0
  378. package/src/lib/services/chat/message.service.spec.ts +16 -0
  379. package/src/lib/services/chat/message.service.ts +61 -0
  380. package/src/lib/services/client/client-invite.service.spec.ts +16 -0
  381. package/src/lib/services/client/client-invite.service.ts +111 -0
  382. package/src/lib/services/client/client-movement.service.spec.ts +16 -0
  383. package/src/lib/services/client/client-movement.service.ts +114 -0
  384. package/src/lib/services/client/client-portfolio-report.service.spec.ts +16 -0
  385. package/src/lib/services/client/client-portfolio-report.service.ts +34 -0
  386. package/src/lib/services/depreciation/capital-project.service.spec.ts +16 -0
  387. package/src/lib/services/depreciation/capital-project.service.ts +69 -0
  388. package/src/lib/services/depreciation/depreciation.service.spec.ts +12 -0
  389. package/src/lib/services/depreciation/depreciation.service.ts +171 -0
  390. package/src/lib/services/document/document-folder.service.spec.ts +16 -0
  391. package/src/lib/services/document/document-folder.service.ts +95 -0
  392. package/src/lib/services/employee/employee-invite.service.spec.ts +16 -0
  393. package/src/lib/services/employee/employee-invite.service.ts +53 -0
  394. package/src/lib/services/employee/employee.service.spec.ts +16 -0
  395. package/src/lib/services/employee/employee.service.ts +35 -0
  396. package/src/lib/services/event/event-dispatcher.service.spec.ts +16 -0
  397. package/src/lib/services/event/event-dispatcher.service.ts +29 -0
  398. package/src/lib/services/event/sse.service.spec.ts +16 -0
  399. package/src/lib/services/event/sse.service.ts +42 -0
  400. package/src/lib/services/firm/firm.service.spec.ts +16 -0
  401. package/src/lib/services/firm/firm.service.ts +93 -0
  402. package/src/lib/services/header-title/header-title.service.spec.ts +12 -0
  403. package/src/lib/services/header-title/header-title.service.ts +31 -0
  404. package/src/lib/services/income-source/income-source-forecast.service.spec.ts +16 -0
  405. package/src/lib/services/income-source/income-source-forecast.service.ts +91 -0
  406. package/src/lib/services/income-source/income-source.service.spec.ts +12 -0
  407. package/src/lib/services/income-source/income-source.service.ts +127 -0
  408. package/src/lib/services/income-source/salary-forecast.service.spec.ts +16 -0
  409. package/src/lib/services/income-source/salary-forecast.service.ts +92 -0
  410. package/src/lib/services/intercom/intercom.service.spec.ts +16 -0
  411. package/src/lib/services/intercom/intercom.service.ts +37 -0
  412. package/src/lib/services/loan/loan.service.spec.ts +12 -0
  413. package/src/lib/services/loan/loan.service.ts +166 -0
  414. package/src/lib/services/notification/notification.service.spec.ts +12 -0
  415. package/src/lib/services/notification/notification.service.ts +60 -0
  416. package/src/lib/services/preloader/preloader.service.spec.ts +16 -0
  417. package/src/lib/services/preloader/preloader.service.ts +28 -0
  418. package/src/lib/services/property/corelogic.service.spec.ts +12 -0
  419. package/src/lib/services/property/corelogic.service.ts +47 -0
  420. package/src/lib/services/property/property-calculation.service.spec.ts +16 -0
  421. package/src/lib/services/property/property-calculation.service.ts +166 -0
  422. package/src/lib/services/property/property-capital-cost.service.ts +42 -0
  423. package/src/lib/services/property/property-category.service.spec.ts +16 -0
  424. package/src/lib/services/property/property-category.service.ts +15 -0
  425. package/src/lib/services/property/property-document.service.spec.ts +16 -0
  426. package/src/lib/services/property/property-document.service.ts +74 -0
  427. package/src/lib/services/property/property-owner.service.spec.ts +12 -0
  428. package/src/lib/services/property/property-owner.service.ts +134 -0
  429. package/src/lib/services/property/property-sold.service.spec.ts +16 -0
  430. package/src/lib/services/property/property-sold.service.ts +15 -0
  431. package/src/lib/services/property/property.service.spec.ts +12 -0
  432. package/src/lib/services/property/property.service.ts +136 -0
  433. package/src/lib/services/subscription/subscription.service.spec.ts +12 -0
  434. package/src/lib/services/subscription/subscription.service.ts +153 -0
  435. package/src/lib/services/tax-review/tax-review-history.service.spec.ts +16 -0
  436. package/src/lib/services/tax-review/tax-review-history.service.ts +35 -0
  437. package/src/lib/services/tax-review/tax-review.service.spec.ts +16 -0
  438. package/src/lib/services/tax-review/tax-review.service.ts +114 -0
  439. package/src/lib/services/tax-summary/tax-summary.service.ts +70 -0
  440. package/src/lib/services/transaction/transaction-allocation.service.spec.ts +12 -0
  441. package/src/lib/services/transaction/transaction-allocation.service.ts +92 -0
  442. package/src/lib/services/transaction/transaction-calculation.service.spec.ts +16 -0
  443. package/src/lib/services/transaction/transaction-calculation.service.ts +50 -0
  444. package/src/lib/services/transaction/transaction.service.spec.ts +12 -0
  445. package/src/lib/services/transaction/transaction.service.ts +374 -0
  446. package/src/lib/services/user/occupation.service.spec.ts +12 -0
  447. package/src/lib/services/user/occupation.service.ts +42 -0
  448. package/src/lib/services/user/user-switcher.service.ts +34 -0
  449. package/src/lib/services/user/user.service.spec.ts +12 -0
  450. package/src/lib/services/user/user.service.ts +140 -0
  451. package/src/lib/services/user-event/user-event-setting.service.spec.ts +16 -0
  452. package/src/lib/services/user-event/user-event-setting.service.ts +60 -0
  453. package/src/lib/services/user-event/user-event-type.service.spec.ts +16 -0
  454. package/src/lib/services/user-event/user-event-type.service.ts +24 -0
  455. package/src/lib/services/work/work-tank.service.spec.ts +12 -0
  456. package/src/lib/services/work/work-tank.service.ts +277 -0
  457. package/src/lib/tt-core.module.ts +22 -0
  458. package/src/lib/tt-core.service.spec.ts +16 -0
  459. package/src/lib/tt-core.service.ts +17 -0
  460. package/src/public-api.ts +425 -0
  461. package/src/test.ts +27 -0
  462. package/tsconfig.lib.json +15 -0
  463. package/tsconfig.lib.prod.json +10 -0
  464. package/tsconfig.spec.json +17 -0
  465. package/bundles/taxtank-core.umd.js +0 -97
  466. package/bundles/taxtank-core.umd.js.map +0 -1
  467. package/esm2015/lib/tt-core.module.js +0 -33
  468. package/esm2015/lib/tt-core.service.js +0 -23
  469. package/esm2015/public-api.js +0 -6
  470. package/esm2015/taxtank-core.js +0 -5
  471. package/fesm2015/taxtank-core.js +0 -64
  472. package/fesm2015/taxtank-core.js.map +0 -1
  473. package/lib/tt-core.module.d.ts +0 -9
  474. package/lib/tt-core.service.d.ts +0 -8
  475. package/public-api.d.ts +0 -2
  476. package/taxtank-core.d.ts +0 -5
@@ -0,0 +1,20 @@
1
+ import { TransactionSourceEnum } from '../../db/Enums/transaction-source.enum';
2
+ import { TankTypeEnum } from '../../db/Enums/tank-type.enum';
3
+ import { TransactionTypeEnum } from '../../db/Enums/transaction-type.enum';
4
+ import { ChartAccountsListEnum } from '../../db/Enums/chart-accounts-list.enum';
5
+ import { FinancialYear } from '../financial-year/financial-year';
6
+
7
+ /**
8
+ * Default vehicle transaction object,
9
+ * which could be used to create transaction with 'Klms travelled for work' chart accounts category
10
+ */
11
+ export const DEFAULT_VEHICLE_EXPENSE: object = {
12
+ source: TransactionSourceEnum.CASH,
13
+ tankType: TankTypeEnum.WORK,
14
+ type: TransactionTypeEnum.DEBIT,
15
+ taxWithheld: 0,
16
+ description: 'Klm’s method',
17
+ date: new Date(`${new FinancialYear().year}-06-30`),
18
+ chartAccounts: {id: ChartAccountsListEnum.KLMS_TRAVELLED_FOR_WORK},
19
+ claimPercent: 100
20
+ };
@@ -0,0 +1,12 @@
1
+ import { Type } from 'class-transformer';
2
+
3
+ export class LogbookPeriod {
4
+ @Type(() => Date)
5
+ from: Date;
6
+
7
+ @Type(() => Date)
8
+ to: Date;
9
+
10
+ kilometers: number;
11
+ workUsage: number;
12
+ }
@@ -0,0 +1,6 @@
1
+ import { VehicleLogbookPurposeEnum } from '../../db/Enums/vehicle-logbook-purpose.enum';
2
+
3
+ export const WORK_TANK_LOGBOOK_PURPOSE_OPTIONS: {[key: string]: VehicleLogbookPurposeEnum | string}[] = [
4
+ { label: 'Business', value: VehicleLogbookPurposeEnum.BUSINESS },
5
+ { label: 'Personal', value: VehicleLogbookPurposeEnum.PERSONAL }
6
+ ];
@@ -0,0 +1,27 @@
1
+ import { VehicleClaim as VehicleClaimBase } from '../../db/Models/vehicle-claim';
2
+ import { VehicleClaimMethodEnum } from '../../db/Enums/vehicle-claim-method.enum';
3
+ import { FinancialYear } from '../financial-year/financial-year';
4
+
5
+ const WEEKS_IN_YEAR = 52;
6
+
7
+ export class VehicleClaim extends VehicleClaimBase {
8
+ // limit for kms claim method
9
+ kmsLimit: number = 5000;
10
+ financialYear: number = new FinancialYear().year;
11
+
12
+ method: VehicleClaimMethodEnum = VehicleClaimMethodEnum.KMS;
13
+ kilometers: number = 0;
14
+ workUsage: number = 0;
15
+ isManual: boolean = true;
16
+
17
+ /**
18
+ * get amount of kilometres per week
19
+ */
20
+ get averageWeeklyTraveledKms(): number {
21
+ return this.kilometers / WEEKS_IN_YEAR;
22
+ }
23
+
24
+ get isLogbookMethod(): boolean {
25
+ return this.method === VehicleClaimMethodEnum.LOGBOOK;
26
+ }
27
+ }
@@ -0,0 +1,16 @@
1
+ import { VehicleLogbook as VehicleLogbookBase } from '../../db/Models/vehicle-logbook';
2
+ import { VehicleLogbookPurposeEnum } from '../../db/Enums/vehicle-logbook-purpose.enum';
3
+ import { Type } from 'class-transformer';
4
+
5
+ export class VehicleLogbook extends VehicleLogbookBase {
6
+ @Type(() => Date)
7
+ date: Date;
8
+
9
+ get kilometres(): number {
10
+ return this.odometerEnd - this.odometerStart;
11
+ }
12
+
13
+ get isWork(): boolean {
14
+ return this.purpose === VehicleLogbookPurposeEnum.BUSINESS;
15
+ }
16
+ }
@@ -0,0 +1,46 @@
1
+ import { Vehicle as VehicleBase } from '../../db/Models/vehicle';
2
+ import { VehicleLogbookPurposeEnum } from '../../db/Enums/vehicle-logbook-purpose.enum';
3
+ import { VehicleLogbook } from './vehicle-logbook';
4
+ import { Type } from 'class-transformer';
5
+
6
+ export class Vehicle extends VehicleBase {
7
+ @Type(() => VehicleLogbook)
8
+ logbook: VehicleLogbook[];
9
+
10
+ get workKilometersPercentage(): number {
11
+ return this.workKilometres / this.totalKilometres * 100;
12
+ }
13
+
14
+ get totalKilometres(): number {
15
+ let kilometers: number = 0;
16
+
17
+ this.logbook.forEach((lb: VehicleLogbook) => {
18
+ kilometers += lb.kilometres;
19
+ });
20
+
21
+ return kilometers;
22
+ }
23
+
24
+ get workKilometres(): number {
25
+ let kilometers: number = 0;
26
+
27
+ this.logbook.forEach((lb: VehicleLogbook) => {
28
+ if (lb.purpose === VehicleLogbookPurposeEnum.BUSINESS) {
29
+ kilometers += lb.kilometres;
30
+ }
31
+ });
32
+
33
+ return kilometers;
34
+ }
35
+
36
+ get personalKilometres(): number {
37
+ return this.totalKilometres - this.workKilometres;
38
+ }
39
+
40
+ get lastLogbook(): VehicleLogbook | {odometerEnd: number} {
41
+ if (!this.logbook.length) {
42
+ return {odometerEnd: 0};
43
+ }
44
+ return this.logbook.slice(-1)[0];
45
+ }
46
+ }
@@ -0,0 +1,43 @@
1
+ import { UserEventTypeTypeEnum } from '../../db/Enums/user-event-type-type.enum';
2
+
3
+ /**
4
+ * Notification events grouped by types
5
+ */
6
+ export const NOTIFICATION_EVENT_TYPES: {[key: string]: UserEventTypeTypeEnum[]} = {
7
+ // events from employees to clients
8
+ employeeInvite: [
9
+ UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_REGISTER_ACCEPTED,
10
+ UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_JOIN_ACCEPTED,
11
+ UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_JOIN_REJECTED,
12
+ UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_REGISTER,
13
+ UserEventTypeTypeEnum.CLIENT_INVITE_TO_JOIN,
14
+ ],
15
+ // events from clients to employee
16
+ employeeInviteFromClient: [
17
+ UserEventTypeTypeEnum.EMPLOYEE_INVITE_TO_JOIN,
18
+ ],
19
+ bankConnection: [
20
+ UserEventTypeTypeEnum.BASIQ_NEW_ACCOUNTS,
21
+ UserEventTypeTypeEnum.BASIQ_FIRST_IMPORT_COMPLETE,
22
+ UserEventTypeTypeEnum.BASIQ_AUTHORIZATION_FAIL
23
+ ],
24
+ clientInvite: [
25
+ UserEventTypeTypeEnum.CLIENT_INVITE_TO_JOIN_ACCEPTED,
26
+ UserEventTypeTypeEnum.CLIENT_INVITE_TO_JOIN_REJECTED,
27
+ UserEventTypeTypeEnum.CLIENT_INVITE_TO_REGISTER
28
+ ],
29
+ clientMovement: [
30
+ UserEventTypeTypeEnum.CLIENT_LEFT_FIRM,
31
+ UserEventTypeTypeEnum.EMPLOYEE_LOST_CLIENT,
32
+ UserEventTypeTypeEnum.EMPLOYEE_RECEIVED_CLIENT
33
+ ],
34
+ propertyOwner: [
35
+ UserEventTypeTypeEnum.CO_OWNER_INVITE_SEND,
36
+ UserEventTypeTypeEnum.CO_OWNER_INVITE_ACCEPT,
37
+ UserEventTypeTypeEnum.CO_OWNER_INVITE_REJECT,
38
+ UserEventTypeTypeEnum.CO_OWNER_REGISTER,
39
+ UserEventTypeTypeEnum.CO_OWNER_CHANGES_OFFER,
40
+ UserEventTypeTypeEnum.CO_OWNER_CHANGES_ACCEPT,
41
+ UserEventTypeTypeEnum.CO_OWNER_CHANGES_REJECT
42
+ ]
43
+ };
@@ -0,0 +1,66 @@
1
+ import { ServiceNotification as ServiceNotificationBase } from '../../db/Models/service-notification';
2
+ import { UserEventTypeTypeEnum } from '../../db/Enums/user-event-type-type.enum';
3
+ import { Expose, Transform, Type } from 'class-transformer';
4
+ import { User } from '../user/user';
5
+ import { NOTIFICATION_EVENT_TYPES } from './notification-event-types.const';
6
+
7
+ export class Notification extends ServiceNotificationBase {
8
+ @Type(() => User)
9
+ sender: User;
10
+
11
+ // notification redirection link
12
+ @Expose({toClassOnly: true})
13
+ @Transform(({obj}) => {
14
+ switch (true) {
15
+ case NOTIFICATION_EVENT_TYPES.employeeInvite.includes(obj.eventType):
16
+ return '/client/users/firms';
17
+ case NOTIFICATION_EVENT_TYPES.bankConnection.includes(obj.eventType):
18
+ return '/client/bank-feeds';
19
+ case NOTIFICATION_EVENT_TYPES.clientInvite.includes(obj.eventType):
20
+ return '/client/users/invitations';
21
+ case NOTIFICATION_EVENT_TYPES.propertyOwner.includes(obj.eventType):
22
+ return '/client/users/co-owners';
23
+ case NOTIFICATION_EVENT_TYPES.employeeInviteFromClient.includes(obj.eventType):
24
+ return '/firm/clients/invites';
25
+ default:
26
+ return '';
27
+ }
28
+ })
29
+ redirectionLink: string;
30
+
31
+ get eventType(): UserEventTypeTypeEnum {
32
+ return this.userEvent.userEventType.type;
33
+ }
34
+
35
+ /**
36
+ * Set redirection link based on current event type
37
+ */
38
+ private setRedirectionLink(): void {
39
+ switch (true) {
40
+ case NOTIFICATION_EVENT_TYPES.employeeInvite.includes(this.eventType):
41
+ this.redirectionLink = '/client/users/firms';
42
+ break;
43
+ case NOTIFICATION_EVENT_TYPES.bankConnection.includes(this.eventType):
44
+ this.redirectionLink = '/client/bank-feeds';
45
+ break;
46
+ case NOTIFICATION_EVENT_TYPES.clientInvite.includes(this.eventType):
47
+ this.redirectionLink = '/client/users/invitations';
48
+ break;
49
+ case NOTIFICATION_EVENT_TYPES.propertyOwner.includes(this.eventType):
50
+ this.redirectionLink = '/client/users/co-owners';
51
+ break;
52
+ case NOTIFICATION_EVENT_TYPES.employeeInviteFromClient.includes(this.eventType):
53
+ this.redirectionLink = '/firm/clients/invites';
54
+ break;
55
+ default:
56
+ this.redirectionLink = '';
57
+ }
58
+ }
59
+
60
+ /**
61
+ * Check if notification is from user or not
62
+ */
63
+ isFromUser(): boolean {
64
+ return !!this.sender;
65
+ }
66
+ }
@@ -0,0 +1,10 @@
1
+ import { Phone as PhoneBase } from '../../db/Models/phone';
2
+ import { PhoneTypeEnum } from '../../db/Enums/phone-type.enum';
3
+
4
+ export class Phone extends PhoneBase {
5
+ type: PhoneTypeEnum = PhoneTypeEnum.MOBILE;
6
+
7
+ toString(): string {
8
+ return `+${this.country.callingCode} ${this.number}`;
9
+ }
10
+ }
@@ -0,0 +1,24 @@
1
+ import { ValidatorFn } from '@angular/forms';
2
+ import { Expose, Transform } from 'class-transformer';
3
+ import { CalculationFormTypeEnum } from './calculation-form-type.enum';
4
+
5
+ /**
6
+ * Fields to implement custom calculation form
7
+ */
8
+ export class CalculationFormItem {
9
+ name: string;
10
+ value: number | boolean;
11
+ // label for form control
12
+ label: string;
13
+ // type of control (input, select, e.t.c)
14
+ type: CalculationFormTypeEnum = CalculationFormTypeEnum.SELECT;
15
+ // array of dependent fields for control
16
+ dependentFields?: string[];
17
+ // flag to check if field is disabled
18
+ isDisabled: boolean;
19
+
20
+ @Transform(({obj}) => obj.type === CalculationFormTypeEnum.SELECT)
21
+ @Expose() isSelect: boolean;
22
+
23
+ validators?: ValidatorFn[];
24
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Calculation form control types
3
+ */
4
+ export enum CalculationFormTypeEnum {
5
+ INPUT = 1,
6
+ SELECT = 2,
7
+ }
@@ -0,0 +1,57 @@
1
+ import { Validators } from '@angular/forms';
2
+ import { plainToClass } from 'class-transformer';
3
+ import { CalculationFormItem } from './calculation-form-item';
4
+ import { CalculationFormTypeEnum } from './calculation-form-type.enum';
5
+
6
+ export const CAPITAL_COSTS_ITEMS: CalculationFormItem[] = [
7
+ plainToClass(CalculationFormItem, {
8
+ name: 'rentingWholeProperty',
9
+ value: null,
10
+ label: 'Are you renting out the whole property?',
11
+ type: CalculationFormTypeEnum.SELECT,
12
+ dependentFields: ['howBigIsProperty', 'howBigIsLetArea', 'howBigIsCommonAreas'],
13
+ isDisabled: false,
14
+ validators: [Validators.required]
15
+ }),
16
+ plainToClass(CalculationFormItem, {
17
+ name: 'rentingWholeYear',
18
+ value: null,
19
+ label: 'Are you renting out for the whole year?',
20
+ type: CalculationFormTypeEnum.SELECT,
21
+ dependentFields: ['howManyDays'],
22
+ isDisabled: false,
23
+ validators: [Validators.required]
24
+ }),
25
+ plainToClass(CalculationFormItem, {
26
+ name: 'howBigIsProperty',
27
+ value: null,
28
+ label: 'How big is the property?',
29
+ type: CalculationFormTypeEnum.INPUT,
30
+ isDisabled: true,
31
+ validators: [Validators.required, Validators.min(1)]
32
+ }),
33
+ plainToClass(CalculationFormItem, {
34
+ name: 'howBigIsLetArea',
35
+ value: null,
36
+ label: 'How big is the let area?',
37
+ type: CalculationFormTypeEnum.INPUT,
38
+ isDisabled: true,
39
+ validators: [Validators.required, Validators.min(1)]
40
+ }),
41
+ plainToClass(CalculationFormItem, {
42
+ name: 'howBigIsCommonAreas',
43
+ value: null,
44
+ label: 'How big are the common areas?',
45
+ type: CalculationFormTypeEnum.INPUT,
46
+ isDisabled: true,
47
+ validators: [Validators.required, Validators.min(1)]
48
+ }),
49
+ plainToClass(CalculationFormItem, {
50
+ name: 'howManyDays',
51
+ value: null,
52
+ label: 'How many days of the year is the property available for rent?',
53
+ type: CalculationFormTypeEnum.INPUT,
54
+ isDisabled: true,
55
+ validators: [Validators.required, Validators.min(1)]
56
+ }),
57
+ ];
@@ -0,0 +1,18 @@
1
+ /**
2
+ * https://api-uat.corelogic.asia/property/au/v2/suggest.json
3
+ * address suggestion from corelogic service
4
+ */
5
+ export class CorelogicSuggestion {
6
+ councilAreaId: number;
7
+ countryId: number;
8
+ isActiveProperty: boolean;
9
+ isBodyCorporate: boolean;
10
+ isUnit: boolean;
11
+ localityId: number;
12
+ postcodeId: number;
13
+ propertyId: number;
14
+ stateId: number;
15
+ streetId: number;
16
+ suggestion: string;
17
+ suggestionType: string;
18
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Enum with properties ownership filter options
3
+ */
4
+ export enum OwnershipFilterOptionsEnum {
5
+ ALL_PROPERTIES = 1,
6
+ OWN_PROPERTIES = 2,
7
+ SHARED_PROPERTIES = 3
8
+ }
@@ -0,0 +1,4 @@
1
+ import { PropertyCapitalCost as PropertyCapitalCostBase } from '../../db/Models/property-capital-cost';
2
+
3
+ export class PropertyCapitalCost extends PropertyCapitalCostBase {
4
+ }
@@ -0,0 +1,18 @@
1
+ import { PropertyCategoryMovement as PropertyCategoryMovementBase } from '../../db/Models/property-category-movement';
2
+ import { Type } from 'class-transformer';
3
+ import { PropertyValuation } from './property-valuation';
4
+ import { PropertyCategory } from './property-category';
5
+
6
+ export class PropertyCategoryMovement extends PropertyCategoryMovementBase {
7
+ @Type(() => PropertyValuation)
8
+ valuation: PropertyValuation;
9
+
10
+ @Type(() => PropertyCategory)
11
+ propertyCategory: PropertyCategory;
12
+
13
+ @Type(() => Date)
14
+ fromDate: Date;
15
+
16
+ @Type(() => Date)
17
+ toDate: Date;
18
+ }
@@ -0,0 +1,9 @@
1
+ import { PropertyCategory as PropertyCategoryBase } from '../../db/Models/property-category';
2
+
3
+ export class PropertyCategory extends PropertyCategoryBase {
4
+
5
+ // @Todo check if category is Owner Occupied. If will be needed to check more categories - move the checking to the backend
6
+ isOwnerOccupied(): boolean {
7
+ return this.name === 'Owner Occupied';
8
+ }
9
+ }
@@ -0,0 +1,21 @@
1
+ import { PropertyDocument as PropertyDocumentBase } from '../../db/Models/property-document';
2
+ import { IAsset } from '../../interfaces/asset.interface';
3
+ import { IDocument } from '../../interfaces/document.interface';
4
+ import { AssetTypeEnum } from '../../interfaces/asset-type.enum';
5
+ import { AssetEntityTypeEnum } from '../../interfaces/asset-entity-type.enum';
6
+ import { Documentable } from '../../interfaces/documentable.interface';
7
+ import { Property } from './property';
8
+
9
+ export class PropertyDocument extends PropertyDocumentBase implements IAsset, IDocument {
10
+ type: AssetTypeEnum = AssetTypeEnum.DOCUMENTS;
11
+ entityType: AssetEntityTypeEnum = AssetEntityTypeEnum.PROPERTIES;
12
+ property: Property;
13
+
14
+ getApiUrlPrefix(): string {
15
+ return '';
16
+ }
17
+
18
+ getEntity(): Documentable {
19
+ return this.property;
20
+ }
21
+ }
@@ -0,0 +1,188 @@
1
+ import first from 'lodash/first';
2
+ import { PropertyEquityChartItem } from './property-equity-chart-item';
3
+ import { PropertyCollection } from '../../collections/property.collection';
4
+ import { BankAccountCollection } from '../../collections/bank-account.collection';
5
+ import { LoanCollection } from '../../collections/loan.collection';
6
+ import { FinancialYear } from '../financial-year/financial-year';
7
+ import { PropertyEquityChartTypeEnum } from './property-equity-chart-type.enum';
8
+ import { Property } from './property';
9
+ import { BankAccount } from '../bank/bank-account';
10
+
11
+ // count of years for future values
12
+ const FORECAST_YEARS: number = 25;
13
+
14
+ /**
15
+ * class contain actual and forecasted market values and loan balances for passed properties
16
+ * X axis - years from the first actual data year to the last forecasted year
17
+ * Y axis - amounts of market values, loan balances
18
+ * Also on hover appear equity positions point
19
+ */
20
+ export class PropertyEquityChartData {
21
+ // list of equity positions for all years range
22
+ list: PropertyEquityChartItem[];
23
+ // current financial year
24
+ currentYear: number;
25
+ // list of properties this collection based on
26
+ private properties: PropertyCollection;
27
+ private bankAccounts: BankAccountCollection;
28
+ private loans: LoanCollection;
29
+
30
+ constructor(
31
+ properties: PropertyCollection,
32
+ bankAccounts: BankAccountCollection,
33
+ loans: LoanCollection,
34
+ private registerDate: Date
35
+ ) {
36
+ this.properties = properties;
37
+ this.bankAccounts = bankAccounts.getLoanAccounts();
38
+ this.loans = loans;
39
+ this.currentYear = new FinancialYear(new Date()).year;
40
+ this.initItems();
41
+ this.buildHistoryItems();
42
+ this.buildActualItem();
43
+ this.buildForecastedItems();
44
+ this.checkZeroLoanBalance();
45
+ }
46
+
47
+ /**
48
+ * get items list in chart series format
49
+ * @param type
50
+ */
51
+ getChartSeries(type: PropertyEquityChartTypeEnum): number[][] {
52
+ return this.list.map((item: PropertyEquityChartItem) => item.getSerie(type));
53
+ }
54
+
55
+ /**
56
+ * get prepared chart data
57
+ */
58
+ getChartData(): object[] {
59
+ return [
60
+ {
61
+ id: 'marketValue',
62
+ name: 'Market Value',
63
+ series: this.getChartSeries(PropertyEquityChartTypeEnum.MARKET_VALUE),
64
+ // display future market value with dash line and past market value with solid line
65
+ zones: [{
66
+ // line style after current calendar year
67
+ value: this.currentYear,
68
+ dashStyle: 'Solid'
69
+ }, {
70
+ // default line style
71
+ dashStyle: 'Dash'
72
+ }]
73
+ },
74
+ {
75
+ // id used to add/remove serie to chart
76
+ id: 'loanBalance',
77
+ name: 'Loan Balance',
78
+ series: this.getChartSeries(PropertyEquityChartTypeEnum.LOAN_BALANCE)
79
+ }
80
+ ];
81
+ }
82
+
83
+ /**
84
+ * create empty equity position item for each year in collection
85
+ */
86
+ private initItems(): void {
87
+ this.list = [];
88
+ for (let year: number = new FinancialYear(this.registerDate).year - 1; year <= (this.currentYear + FORECAST_YEARS); year++) {
89
+ this.list.push(new PropertyEquityChartItem(year));
90
+ }
91
+ }
92
+
93
+ /**
94
+ * collect equity position items with past values from properties forecasts
95
+ */
96
+ private buildHistoryItems(): void {
97
+ // get items for past and current years
98
+ const items: PropertyEquityChartItem[] = this.list.filter((item: PropertyEquityChartItem) => item.year <= this.currentYear);
99
+ items.forEach((item: PropertyEquityChartItem) => {
100
+ // increase item values with property actual forecasts for item year
101
+ item.marketValue = this.properties.items.reduce((sum: number, property: Property): number => {
102
+ return sum + this.getMarketValueForPropertyByYear(property, item.year);
103
+ }, 0);
104
+
105
+ item.loanBalance = Math.abs(this.properties.items.reduce((sum: number, property: Property): number => {
106
+ return sum + this.getLoanBalanceForPropertyByYear(property, item.year);
107
+ }, 0));
108
+ });
109
+ }
110
+
111
+ /**
112
+ * set actual year's real data
113
+ * @private
114
+ */
115
+ private buildActualItem(): void {
116
+ const item: PropertyEquityChartItem = this.list.find((i: PropertyEquityChartItem) => i.year === this.currentYear);
117
+ item.marketValue = this.properties.marketValue;
118
+ item.loanBalance = this.properties.items.reduce((sum: number, property: Property): number => {
119
+ return sum + Math.abs(this.bankAccounts.getPropertyBalanceAmount(property.id));
120
+ }, 0);
121
+ }
122
+
123
+ /**
124
+ * collect equity position items with forecasted (future) calculated values
125
+ */
126
+ private buildForecastedItems(): void {
127
+ // calculate future values for all properties separately
128
+ this.properties.items.forEach((property: Property) => {
129
+ let forecastedMarketValue: number = (property.growthPercent / 100) * property.marketValue + property.marketValue;
130
+
131
+ // calculate future values for each future year for current handling property
132
+ this.list
133
+ .filter((item: PropertyEquityChartItem) => item.year > this.currentYear)
134
+ .forEach((item: PropertyEquityChartItem) => {
135
+ const propertyBankAccounts: BankAccountCollection = this.bankAccounts.getByPropertyId(property.id);
136
+ // increase loan balance amount for handling equity position item
137
+ item.loanBalance += this.getLoanBalanceByYear(property, item.year, propertyBankAccounts, this.loans.getByBankAccountsIds(propertyBankAccounts.getIds()));
138
+
139
+ // increase market value amount for handling equity position item
140
+ item.marketValue += forecastedMarketValue;
141
+
142
+ // increase current market value forecast for the next cycle iteration
143
+ forecastedMarketValue += forecastedMarketValue * (property.growthPercent / 100);
144
+ });
145
+ });
146
+ }
147
+
148
+ /**
149
+ * Get property loan balance by financial year
150
+ * @param property Property instance for filter
151
+ * @param year Financial year number
152
+ * @param bankAccounts List of bank accounts
153
+ * @param loans List of loans
154
+ * @private
155
+ */
156
+ private getLoanBalanceByYear(property: Property, year: number, bankAccounts: BankAccountCollection, loans: LoanCollection): number {
157
+ return bankAccounts.items.reduce((totalSum: number, bankAccount: BankAccount): number => {
158
+ return totalSum + (bankAccount.getPropertyPercentage(property.id) * (loans.getByBankAccountId(bankAccount.id)?.getLastPaymentByYear(year)?.totalOwed || 0));
159
+ }, 0);
160
+ }
161
+
162
+ getMarketValueForPropertyByYear(property: Property, year: number): number {
163
+ if (new FinancialYear(property.purchaseDate).year > year) {
164
+ return 0;
165
+ }
166
+
167
+ return (property.getForecastByYear(year) || first(property.forecasts)).marketValue;
168
+ }
169
+
170
+ getLoanBalanceForPropertyByYear(property: Property, year: number): number {
171
+ if (new FinancialYear(property.purchaseDate).year > year) {
172
+ return 0;
173
+ }
174
+
175
+ return property.getForecastByYear(year)?.loanBalance || this.bankAccounts.getPropertyBalanceAmount(property.id);
176
+ }
177
+
178
+ /**
179
+ * Check if loan balance is 0 and set it as null (to not to draw point on the chart)
180
+ */
181
+ private checkZeroLoanBalance(): void {
182
+ this.list.forEach((item: PropertyEquityChartItem) => {
183
+ if (item.loanBalance === 0) {
184
+ item.loanBalance = null;
185
+ }
186
+ });
187
+ }
188
+ }
@@ -0,0 +1,35 @@
1
+ import { PropertyEquityChartTypeEnum } from './property-equity-chart-type.enum';
2
+
3
+ /**
4
+ * class contains equity information for passed financial year
5
+ */
6
+ export class PropertyEquityChartItem {
7
+ year: number;
8
+ marketValue: number;
9
+ loanBalance: number;
10
+
11
+ constructor(
12
+ year: number,
13
+ marketValue?: number,
14
+ loanBalance?: number
15
+ ) {
16
+ this.year = year;
17
+ this.marketValue = marketValue || 0;
18
+ this.loanBalance = loanBalance || 0;
19
+ }
20
+
21
+ /**
22
+ * calculate equity position
23
+ */
24
+ get equityPosition(): number {
25
+ return this.marketValue - this.loanBalance;
26
+ }
27
+
28
+ /**
29
+ * return this equity position instance as chart serie
30
+ * @param type
31
+ */
32
+ getSerie(type: PropertyEquityChartTypeEnum): number[] {
33
+ return [this.year, this[type]];
34
+ }
35
+ }
@@ -0,0 +1,4 @@
1
+ export enum PropertyEquityChartTypeEnum {
2
+ MARKET_VALUE = 'marketValue',
3
+ LOAN_BALANCE = 'loanBalance'
4
+ }