From c692ef664aa6ed9922a0cf5b2badbc76a7d02947 Mon Sep 17 00:00:00 2001 From: Kurund Jalmi Date: Fri, 3 Nov 2023 17:50:14 +0000 Subject: [PATCH] add admin configuration to set the date defaults --- .../ang/afGuiEditor/elements/afGuiField-menu.html | 10 +++++++++- .../ang/afGuiEditor/elements/afGuiField.component.js | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ext/afform/admin/ang/afGuiEditor/elements/afGuiField-menu.html b/ext/afform/admin/ang/afGuiEditor/elements/afGuiField-menu.html index 9c49cbcccd..5f01636f58 100644 --- a/ext/afform/admin/ang/afGuiEditor/elements/afGuiField-menu.html +++ b/ext/afform/admin/ang/afGuiEditor/elements/afGuiField-menu.html @@ -56,7 +56,15 @@ {{:: ts('Default value') }} -
  • +
  • +
    + +
    +
  • +
  • diff --git a/ext/afform/admin/ang/afGuiEditor/elements/afGuiField.component.js b/ext/afform/admin/ang/afGuiEditor/elements/afGuiField.component.js index 1b9f03495d..ace876defb 100644 --- a/ext/afform/admin/ang/afGuiEditor/elements/afGuiField.component.js +++ b/ext/afform/admin/ang/afGuiEditor/elements/afGuiField.component.js @@ -53,6 +53,10 @@ this.searchOperators = _.pick(this.searchOperators, ctrl.fieldDefn.operators); } setDateOptions(); + + if (ctrl.getDefn().input_type == 'Date' && !getSet('default_date_type')) { + ctrl.defaultDateType = getSet('default_date_type', 'fixed_date'); + } }; this.getFkEntity = function() { @@ -267,6 +271,10 @@ } }; + $scope.setDefaultDateType = function() { + ctrl.defaultDateType = getSet('default_date_type'); + }; + $scope.defaultValueContains = function(val) { val = '' + val; var defaultVal = getSet('afform_default'); -- 2.25.1