taxtank-core 0.28.52 → 0.28.54

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.
@@ -1075,6 +1075,7 @@
1075
1075
  SOLE_BUSINESS_LOSSES_PUT: new Endpoint('PUT', '\\/sole-business-losses\\/\\d+'),
1076
1076
  SOLE_BUSINESS_LOSS_OFFSET_RULES_GET: new Endpoint('GET', '\\/sole-business-loss-offset-rules'),
1077
1077
  SOLE_BUSINESS_LOGO_POST: new Endpoint('POST', '\\/sole-businesses\\/\\d+\\/logo'),
1078
+ SOLE_CONTACTS_GET: new Endpoint('GET', '\\/sole-contacts'),
1078
1079
  SOLE_CONTACTS_POST: new Endpoint('POST', '\\/sole-contacts'),
1079
1080
  SOLE_CONTACTS_PUT: new Endpoint('PUT', '\\/sole-contacts\\/\\d+'),
1080
1081
  BUSINESS_ACTIVITIES_GET: new Endpoint('GET', '\\/sole-business-activities'),
@@ -1087,6 +1088,7 @@
1087
1088
  SOLE_INVOICES_POST: new Endpoint('POST', '\\/sole-invoices'),
1088
1089
  SOLE_INVOICES_PUT: new Endpoint('PUT', '\\/sole-invoices\\/\\d+'),
1089
1090
  SOLE_INVOICES_DELETE: new Endpoint('DELETE', '\\/sole-invoices\\/\\d+'),
1091
+ SOLE_INVOICES_EMAIL_POST: new Endpoint('POST', '\\/sole-invoices\\/\\d+\\/send'),
1090
1092
  SOLE_INVOICE_TEMPLATES_GET: new Endpoint('GET', '\\/sole-invoice-templates'),
1091
1093
  SOLE_INVOICE_TEMPLATES_POST: new Endpoint('POST', '\\/sole-invoice-templates'),
1092
1094
  SOLE_INVOICE_TEMPLATES_PUT: new Endpoint('PUT', '\\/sole-invoice-templates\\/\\d+'),
@@ -17648,7 +17650,6 @@
17648
17650
  invoices.toArray().forEach(function (invoice) {
17649
17651
  allocationsByInvoices.add(invoice.id, allocations.filterBy('transaction.id', invoice.getTransactionsIds()));
17650
17652
  });
17651
- console.log(allocationsByInvoices);
17652
17653
  return allocationsByInvoices;
17653
17654
  };
17654
17655
  TransactionCalculationService.prototype.getBankTransactionsUnallocatedAmount = function (bankTransactions, allocations) {
@@ -18719,7 +18720,9 @@
18719
18720
 
18720
18721
  var SoleInvoiceForm = /** @class */ (function (_super) {
18721
18722
  __extends(SoleInvoiceForm, _super);
18722
- function SoleInvoiceForm(invoice, soleDetailsGST) {
18723
+ function SoleInvoiceForm(invoice, soleDetailsGST,
18724
+ // default template to be preselected
18725
+ defaultTemplate) {
18723
18726
  var _this = _super.call(this, {
18724
18727
  dateFrom: new forms.FormControl(invoice.dateFrom || new Date(), forms.Validators.required),
18725
18728
  dateTo: new forms.FormControl(invoice.dateTo, forms.Validators.required),
@@ -18729,10 +18732,13 @@
18729
18732
  bankAccount: new forms.FormControl(invoice.bankAccount, forms.Validators.required),
18730
18733
  reference: new forms.FormControl(invoice.reference)
18731
18734
  }, invoice) || this;
18735
+ _this.invoice = invoice;
18732
18736
  _this.soleDetailsGST = soleDetailsGST;
18737
+ _this.defaultTemplate = defaultTemplate;
18733
18738
  // we need invoice template only for new invoices
18734
18739
  if (!invoice.id) {
18735
- _this.addControl('template', new forms.FormControl(invoice.template));
18740
+ _this.addControl('template', new forms.FormControl(_this.defaultTemplate));
18741
+ _this.updateTemplateRelatedFields(_this.defaultTemplate);
18736
18742
  }
18737
18743
  // invoice.taxType is always NONE ('No Tax') when soleDetails.isGST === false
18738
18744
  if (!_this.soleDetailsGST) {
@@ -18743,6 +18749,10 @@
18743
18749
  _this.disableItemGST(itemForm);
18744
18750
  });
18745
18751
  }
18752
+ else {
18753
+ // set tax type as 'Tax Exclusive' by default for new invoice if soleDetails.isGST === true
18754
+ _this.get('taxType').setValue(_this.invoice.id ? _this.invoice.taxType : exports.SoleInvoiceTaxTypeEnum.TAX_EXCLUSIVE);
18755
+ }
18746
18756
  _this.listenEvents();
18747
18757
  return _this;
18748
18758
  }
@@ -18792,15 +18802,7 @@
18792
18802
  SoleInvoiceForm.prototype.listenTemplateChanges = function () {
18793
18803
  var _this = this;
18794
18804
  this.get('template').valueChanges.subscribe(function (template) {
18795
- _this.get('bankAccount').setValue(template.bankAccount);
18796
- var dateFrom = _this.get('dateFrom').value;
18797
- if (dateFrom) {
18798
- _this.get('dateTo').setValue(new Date(dateFrom.getTime() + template.termTime));
18799
- }
18800
- // invoice.taxType is always 'No Tax' when soleDetails.isGST = false and not available for changing
18801
- if (_this.soleDetailsGST) {
18802
- _this.get('taxType').setValue(template.taxType);
18803
- }
18805
+ _this.updateTemplateRelatedFields(template);
18804
18806
  });
18805
18807
  };
18806
18808
  /**
@@ -18820,6 +18822,17 @@
18820
18822
  });
18821
18823
  });
18822
18824
  };
18825
+ SoleInvoiceForm.prototype.updateTemplateRelatedFields = function (template) {
18826
+ this.get('bankAccount').setValue(template.bankAccount);
18827
+ var dateFrom = this.get('dateFrom').value;
18828
+ if (dateFrom) {
18829
+ this.get('dateTo').setValue(new Date(dateFrom.getTime() + template.termTime));
18830
+ }
18831
+ // invoice.taxType is always 'No Tax' when soleDetails.isGST = false and not available for changing
18832
+ if (this.soleDetailsGST) {
18833
+ this.get('taxType').setValue(template.taxType);
18834
+ }
18835
+ };
18823
18836
  /**
18824
18837
  * GST availability depends of chart accounts isGST flag
18825
18838
  */