@nettyapps/ntybase 0.0.5 → 0.0.7

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.
@@ -658,6 +658,30 @@ class CommonService {
658
658
  dateFormatter(dateValue) {
659
659
  return this.datePipe.transform(dateValue, 'dd-MM-yyyy') ?? '';
660
660
  }
661
+ /**
662
+ * Format date into 'dd-MM-yyyy HH:mm:ss' format for grids
663
+ * @param dateValue
664
+ * @param seconds if true, format includes seconds
665
+ * @returns
666
+ */
667
+ dateTimeFormatter(dateValue, seconds = true) {
668
+ if (seconds) {
669
+ return this.datePipe.transform(dateValue, 'dd/MM/yyyy HH:mm:ss') ?? '';
670
+ }
671
+ return this.datePipe.transform(dateValue, 'dd/MM/yyyy HH:mm') ?? '';
672
+ }
673
+ /**
674
+ * Format time into 'HH:mm' or 'HH:mm:ss' format for grids
675
+ * @param dateValue
676
+ * @param seconds if true, format includes seconds
677
+ * @returns
678
+ */
679
+ timeFormatter(dateValue, seconds = false) {
680
+ if (seconds) {
681
+ return this.datePipe.transform(dateValue, 'HH:mm:ss') ?? '';
682
+ }
683
+ return this.datePipe.transform(dateValue, 'HH:mm') ?? '';
684
+ }
661
685
  /** Reactive Signal state for tracking grid updates */
662
686
  _updates = signal(null, ...(ngDevMode ? [{ debugName: "_updates" }] : []));
663
687
  /** Read-only Signal for external components to observe updates */
@@ -1815,6 +1839,26 @@ class AgGridSaveBase {
1815
1839
  this.commonService.goBack();
1816
1840
  }
1817
1841
  }
1842
+ validateSaveRecord(recordGUID) {
1843
+ if (this.saveForm && this.saveForm.invalid) {
1844
+ Object.keys(this.saveForm.controls).forEach((key) => {
1845
+ const control = this.saveForm.controls[key];
1846
+ control.markAsTouched();
1847
+ control.markAsDirty();
1848
+ });
1849
+ this.alertService.showError('@PleaseFillRequiredFields');
1850
+ return false;
1851
+ }
1852
+ // First check if there are any visual form changes
1853
+ if (!this.formChanged && recordGUID) {
1854
+ this.alertService.showAlert('@NoChangesDetected');
1855
+ if (this.closeAfterSave()) {
1856
+ this.closeSidenav();
1857
+ }
1858
+ return false;
1859
+ }
1860
+ return true;
1861
+ }
1818
1862
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: AgGridSaveBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
1819
1863
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.7", type: AgGridSaveBase, isStandalone: true, selector: "ntybase-ag-grid-save-base", inputs: { parameters: { classPropertyName: "parameters", publicName: "parameters", isSignal: true, isRequired: false, transformFunction: null }, embedded: { classPropertyName: "embedded", publicName: "embedded", isSignal: true, isRequired: false, transformFunction: null }, closeAfterSave: { classPropertyName: "closeAfterSave", publicName: "closeAfterSave", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closeAfterSave: "closeAfterSaveChange" }, viewQueries: [{ propertyName: "saveForm", first: true, predicate: ["saveForm"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<p>ag-grid-save-base works!</p>\n", styles: [""] });
1820
1864
  }