diff --git a/app/resources/locales/en_US/menu.po b/app/resources/locales/en_US/menu.po index caf73c689..ab4c885a1 100644 --- a/app/resources/locales/en_US/menu.po +++ b/app/resources/locales/en_US/menu.po @@ -223,7 +223,7 @@ msgid "options" msgstr "Options" msgid "person.canvas" -msgstr "Person Canvas +msgstr "Person Canvas" msgid "my.canvas" msgstr "my canvas" diff --git a/app/templates/element/peopleAutocomplete.php b/app/templates/element/peopleAutocomplete.php index 148abd0ec..ab8204105 100644 --- a/app/templates/element/peopleAutocomplete.php +++ b/app/templates/element/peopleAutocomplete.php @@ -30,145 +30,167 @@ // - 'search', used when we find a person and display the fullname along with the ID // - 'field', used for model records. It has a postfix with a link to the person canvas $type = $type ?? 'stand-alone'; - // In the context of a type=field we will pass vv_field_arguments - // In the context of a stand-alone field we will have vv_autocomplete_arguments - $vv_field_arguments = $vv_field_arguments ?? $vv_autocomplete_arguments ?? []; - $label = $label ?? $vv_field_arguments["fieldLabel"] ?? __d('operation','autocomplete.people.label'); - $fieldName = $fieldName ?? 'person_id'; - // Used by the SearchFilter Configuration - $personType = $personType ?? 'person'; - $htmlId = $htmlId ?? 'person-id-picker'; - // Does it have a value already. Default or stored - // CAKEPHP automatically generates a select element if the value is an integer. This is not helpful here. - $inputValue = $inputValue ?? $vv_field_arguments["fieldOptions"]["default"] ?? $vv_field_arguments["fieldOptions"]["value"] ?? ''; - // Mainly required for the Group Members people picker since this is placed as an action url - $actionUrl = $actionUrl ?? []; // the url of the page to launch on select for a stand-alone picker - $viewConfigParameters = $viewConfigParameters ?? []; - $containerClasses = $containerClasses ?? 'cm-autocomplete-container'; + // For a frozen field, print the referenced person (if one exists) and link to the person canvas. + if($type == 'field' && $vv_obj['frozen']) { + $personId = $vv_obj[$vv_field_arguments['fieldName']]; + if(!empty($personId)) { + $personRecord = $this->Petition->getRecordForId( + 'person_id', $personId, ['PrimaryName', 'EmailAddresses'] + ); + print $this->Html->link( + $personRecord['primary_name']['full_name'], + ['controller' => 'people', 'action' => 'edit', $personId] + ); + } + // Otherwise, build the people picker. + } else { + // In the context of a type=field we will pass vv_field_arguments + // In the context of a stand-alone field we will have vv_autocomplete_arguments + $vv_field_arguments = $vv_field_arguments ?? $vv_autocomplete_arguments ?? []; + $label = $label ?? $vv_field_arguments["fieldLabel"] ?? __d('operation', 'autocomplete.people.label'); + $fieldName = $fieldName ?? 'person_id'; + // Used by the SearchFilter Configuration + $personType = $personType ?? 'person'; + $htmlId = $htmlId ?? 'person-id-picker'; + // Does it have a value already. Default or stored + // CAKEPHP automatically generates a select element if the value is an integer. This is not helpful here. + $inputValue = $inputValue ?? $vv_field_arguments["fieldOptions"]["default"] ?? $vv_field_arguments["fieldOptions"]["value"] ?? ''; - // Load my helper functions - $vueHelper = $this->loadHelper('Vue'); - - // If we have the $actionUrl array, construct the URL - $constructedActionUrl = ''; - if(!empty($actionUrl)) { - $constructedActionUrl = $this->Url->build($actionUrl); - } + // Mainly required for the Group Members people picker since this is placed as an action url + $actionUrl = $actionUrl ?? []; // the url of the page to launch on select for a stand-alone picker + $viewConfigParameters = $viewConfigParameters ?? []; + $containerClasses = $containerClasses ?? 'cm-autocomplete-container'; - // This is the peopleAutocomplete element. If we have the id we need to self construct the - // - the person canvas link - // - Get the person record for view or edit - if (!empty($inputValue)) { - $personRecord = $this->Petition->getRecordForId('person_id', $inputValue, ['PrimaryName', 'EmailAddresses']); - $canvasUrl = $this->Url->build(['controller' => 'people', 'action' => 'edit', $inputValue]); - } - $searchPeople = $this->request->getAttribute('webroot') . 'api/ajax/v2/people/pick?co_id=' . $vv_cur_co->id; - if (isset($vv_petition->id)) { + // Load my helper functions + $vueHelper = $this->loadHelper('Vue'); + + // If we have the $actionUrl array, construct the URL + $constructedActionUrl = ''; + if(!empty($actionUrl)) { + $constructedActionUrl = $this->Url->build($actionUrl); + } + + // This is the peopleAutocomplete element. If we have the id we need to self construct the + // - the person canvas link + // - Get the person record for view or edit + if(!empty($inputValue)) { + $personRecord = $this->Petition->getRecordForId('person_id', $inputValue, ['PrimaryName', 'EmailAddresses']); + $canvasUrl = $this->Url->build(['controller' => 'people', 'action' => 'edit', $inputValue]); + } + $searchPeople = $this->request->getAttribute('webroot') . 'api/ajax/v2/people/pick?co_id=' . $vv_cur_co->id; + if(isset($vv_petition->id)) { $searchPeople = $this->request->getAttribute('webroot') . 'api/ajax/v2/people/pick?co_id=' . $vv_cur_co->id . '&petition_id=' . $vv_petition->id; - } + } - // This is the actual field that will be submitted. - print $this->Form->control($fieldName, [ - 'id' => $fieldName, - 'value' => '', - 'type' => 'text', - 'class' => 'visually-hidden', - 'label' => false, - ] - ); + // This is the actual field that will be submitted. + print $this->Form->control($fieldName, [ + 'id' => $fieldName, + 'value' => '', + 'type' => 'text', + 'class' => 'visually-hidden', + 'label' => false, + ] + ); + } ?> - + // Mount the component and provide a global reference for this app instance. + window.= str_replace('-', '', $htmlId) ?> = app.mount("#= $htmlId ?>-container"); + -
+ + + diff --git a/app/webroot/css/co-base.css b/app/webroot/css/co-base.css index a76acb75e..01f31f71d 100644 --- a/app/webroot/css/co-base.css +++ b/app/webroot/css/co-base.css @@ -1630,8 +1630,20 @@ ul.form-list input[type="number"]:focus, ul.form-list input[type="password"]:focus { background-color: var(--cmg-color-highlight-002); } -ul.form-list input[readonly="readonly"] { - color: var(--cmg-color-txt-soft); +ul.form-list input[type="text"][readonly="readonly"], +ul.form-list input[type="number"][readonly="readonly"] { + border: none; + background-color: transparent; + appearance: textfield; + padding: 0; +} +ul.form-list select[readonly="readonly"] { + appearance: none; + --bs-form-select-bg-img: none; + background-color: transparent !important; + padding: 0; + border: none; + font-size: 1em; } ul.form-list select { width: auto; /* select boxes should fit to their content, typically */ @@ -1641,7 +1653,7 @@ ul.form-list select { border-color: var(--cmg-color-bg-007); } ul.form-list .not-set { - padding: 4px 6px; + padding: 0; } .form-select:disabled { background-color: var(--cmg-color-bg-009); @@ -2127,6 +2139,7 @@ body.start .submit { #dialog .modal-header { background-color: var(--cmg-color-bg-004); border-bottom: none; + justify-content: space-between; } #dialog .modal-footer { border-top: none;