diff --git a/app/resources/locales/en_US/default.po b/app/resources/locales/en_US/default.po index 53a59b73c..641462743 100644 --- a/app/resources/locales/en_US/default.po +++ b/app/resources/locales/en_US/default.po @@ -453,6 +453,9 @@ msgstr "Required" msgid "match.fd.resolution_mode" msgstr "Resolution Mode" +msgid "match.fd.resolution_time" +msgstr "Resolution Time" + msgid "match.fd.RuleAttributes.match_empty" msgstr "Match Empty Values" diff --git a/app/src/View/Helper/FieldHelper.php b/app/src/View/Helper/FieldHelper.php index 57028dfda..c94fe17c6 100644 --- a/app/src/View/Helper/FieldHelper.php +++ b/app/src/View/Helper/FieldHelper.php @@ -34,7 +34,7 @@ use \Cake\View\Helper; class FieldHelper extends Helper { - public $helpers = ['Form']; + public $helpers = ['Form', 'Time']; // Is this read-only or read-write? protected $editable = true; @@ -65,6 +65,7 @@ public function control(string $fieldName, array $childControls=[]) { $coptions = $options; $coptions['label'] = false; + $isRequired = $required; // We might override this below $label = null; $desc = null; @@ -106,6 +107,17 @@ public function control(string $fieldName, } } + $control = ''; + + if(is_object($this->viewObj->$fieldName) + && get_class($this->viewObj->$fieldName) == 'Cake\I18n\FrozenTime') { + // This is a read-only timestamp, use the field to render itself + $control = $this->viewObj->$fieldName->nice(); + $isRequired = false; + } else { + $control = $this->Form->control($fieldName, $coptions); + } + $children = ''; if(!empty($childControls)) { @@ -120,18 +132,23 @@ public function control(string $fieldName, $children .= ""; } + if(isset($options['readonly']) && $options['readonly']) { + // Read only attributes can't be required + $isRequired = false; + } + return '
  • ' . ($this->editable ? $this->Form->label($fieldName, $label) : $label) - . ($required ? ' *' : '') . ' + . ($isRequired ? ' *' : '') . '
    ' . ($desc ? '' . $desc . '' : "") .'
    - ' . $this->Form->control($fieldName, $coptions) . ' + ' . $control . ' ' . $children . '
  • diff --git a/app/templates/MatchgridRecords/fields.inc b/app/templates/MatchgridRecords/fields.inc index 79cad5130..b39a255f4 100644 --- a/app/templates/MatchgridRecords/fields.inc +++ b/app/templates/MatchgridRecords/fields.inc @@ -51,4 +51,9 @@ if($action == 'add' || $action == 'edit') { } print $this->Field->control('referenceid', [], false, __('match.fd.referenceid', [1])); +} + +if($action == 'edit') { + print $this->Field->control('request_time'); + print $this->Field->control('resolution_time'); } \ No newline at end of file