tin-spa 20.4.3 → 20.4.4

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.
@@ -781,14 +781,14 @@ class DetailsDialogProcessor {
781
781
  static loadDetailsFromUrl(detailsConfig, formConfig) {
782
782
  let action;
783
783
  if (formConfig.loadAction) {
784
- if (detailsConfig.heroField && detailsConfig.details) {
785
- // console.log("DetailsConfig Hero ID Field " + detailsConfig.heroField);
786
- action = { url: `${formConfig.loadAction.url}/${detailsConfig.details[detailsConfig.heroField]}` };
787
- }
788
- else if (formConfig.heroField && detailsConfig.details) {
784
+ if (formConfig.heroField && detailsConfig.details) { // Changed: prioritize formConfig.heroField - the form's own identity field takes precedence over parent's heroField
789
785
  // console.log("FormConfig Hero ID Field " + formConfig.heroField);
790
786
  action = { url: `${formConfig.loadAction.url}/${detailsConfig.details[formConfig.heroField]}` };
791
787
  }
788
+ else if (detailsConfig.heroField && detailsConfig.details) { // Changed: fallback to detailsConfig.heroField when formConfig doesn't define one
789
+ // console.log("DetailsConfig Hero ID Field " + detailsConfig.heroField);
790
+ action = { url: `${formConfig.loadAction.url}/${detailsConfig.details[detailsConfig.heroField]}` };
791
+ }
792
792
  else if (detailsConfig.heroValue) {
793
793
  // console.log("Defined Hero Value " + detailsConfig.heroValue);
794
794
  action = { url: `${formConfig.loadAction.url}/${detailsConfig.heroValue}` };
@@ -3153,7 +3153,7 @@ class AccountingService {
3153
3153
  { name: 'unitPrice', type: 'money', alias: 'Unit Price', required: true }, // Changed: Unit price field (backend will populate for Product/Service)
3154
3154
  { name: 'poNumber', type: 'text', alias: 'PO Number', }, // Added: PO Number for invoice bundling
3155
3155
  ],
3156
- loadAction: { url: 'invoiceitems/id/{invoiceItemID}' },
3156
+ loadAction: { url: 'invoiceitems/id' }, // Fixed: removed placeholder - TinCore appends ID automatically
3157
3157
  heroField: 'invoiceItemID',
3158
3158
  };
3159
3159
  this.invoiceItemEditButton = { name: 'edit', dialog: true, action: { url: 'invoiceitems?action=edit', method: 'post' }, disabled: x => x.status != InvoiceStatus.Draft };
@@ -3174,7 +3174,7 @@ class AccountingService {
3174
3174
  { name: 'description', type: 'label', alias: 'Item', readonly: true, span: true },
3175
3175
  { name: 'invoiceID', type: 'select', alias: 'Move to Invoice', required: true, span: true, loadAction: { url: 'invoiceitems/list/draft-invoices' } }
3176
3176
  ],
3177
- loadAction: { url: 'invoiceitems/id/{invoiceItemID}' },
3177
+ loadAction: { url: 'invoiceitems/id' }, // Fixed: removed placeholder - TinCore appends ID automatically
3178
3178
  heroField: 'invoiceItemID'
3179
3179
  };
3180
3180
  // Added: Move item details dialog config
@@ -3545,11 +3545,15 @@ class AccountingService {
3545
3545
  { name: '#81C784', condition: (x) => x.status == 3 },
3546
3546
  { name: '#E57373', condition: (x) => x.status == 4 }
3547
3547
  ]
3548
+ },
3549
+ { name: 'errorMessage', type: 'text', alias: 'Error',
3550
+ colors: [{ name: 'red', condition: (x) => !!x.errorMessage }] // Changed: Show error details in red
3548
3551
  }
3549
3552
  ],
3550
3553
  buttons: [
3551
3554
  { name: 'edit', dialog: true, action: { url: 'transactionimport?action=edit', method: 'post' } },
3552
- { name: 'delete', action: { url: 'transactionimport?action=delete', method: 'post' }, confirm: { message: 'Delete this import item?' }, visible: (x) => x.status != 3 } // Changed: Allow deleting non-Processed items
3555
+ { name: 'delete', action: { url: 'transactionimport?action=delete', method: 'post' }, confirm: { message: 'Delete this import item?' }, visible: (x) => x.status != 3 },
3556
+ { name: 'reverse', display: 'Reverse', icon: { name: 'undo' }, action: { url: 'transactionimport?action=reverse', method: 'post' }, confirm: { message: 'Reverse this transaction?' }, visible: (x) => x.status == 3 } // Changed: Per-row reverse for Processed items
3553
3557
  ],
3554
3558
  loadAction: { url: 'transactionimport/all/x' }, // Changed: Load all user items (no batch filter)
3555
3559
  formConfig: this.transactionImportItemFormConfig
@@ -3587,6 +3591,11 @@ class AccountingService {
3587
3591
  visible: (x) => (x.resolvedCount ?? 0) > 0,
3588
3592
  confirm: { message: 'Post all items?' },
3589
3593
  action: { url: 'transactionimport/process', method: 'post' } },
3594
+ { name: 'undo', display: 'Undo', inDialog: true, keepOpen: true, icon: { name: 'undo' },
3595
+ visible: (x) => !!x.hasProcessed,
3596
+ confirm: { message: 'Reverse all posted transactions?' },
3597
+ action: { url: 'transactionimport/reverse', method: 'post' } // Changed: Batch reversal of all processed items
3598
+ },
3590
3599
  { name: 'clear', display: 'Clear', inDialog: true, keepOpen: true, resetMode: 'create', icon: { name: 'clear_all' },
3591
3600
  visible: (x) => !!x.hasItems,
3592
3601
  confirm: { message: 'Clear all imported items?' },