N°803 - Allow display & edition of attributes on n:n relations on Portal

- Remove input when object is in view mode
- Improve form errors handling
- Prevent row selection when clicking input 
- Attach date time picker to table instead of input to prevent popup truncating (popup will be visible but not aligned on the input)
This commit is contained in:
Benjamin Dalsass
2023-06-09 10:34:19 +02:00
parent 1b7529fcb9
commit c486aea299
21 changed files with 327 additions and 129 deletions

View File

@@ -88,6 +88,15 @@ class BsSimpleFieldRenderer extends BsFieldRenderer
// - Value regarding the field type
switch ($sFieldClass) {
case 'Combodo\\iTop\\Form\\Field\\DateTimeField':
/* @see N°803 - Allow display & edition of attributes on n:n relations on Portal
* LinkedSetFieldRenderer allow modification of link attributes, the default widget positioning truncates the popup.
*/
$sParent = '';
if ($this->oField->GetDateTimePickerWidgetParent() != null) {
$sParent = ", widgetParent: '{$this->oField->GetDateTimePickerWidgetParent()}'";
}
$oOutput->AddHtml('<div class="input-group date" id="datepicker_'.$this->oField->GetGlobalId().'">');
$oOutput->AddHtml('<input type="text" id="'.$this->oField->GetGlobalId().'" name="'.$this->oField->GetId().'" value="')->AddHtml($this->oField->GetDisplayValue(), true)->AddHtml('" class="form-control" maxlength="255" '.$sInputTags.'/>');
$oOutput->AddHtml('<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>');
@@ -96,7 +105,7 @@ class BsSimpleFieldRenderer extends BsFieldRenderer
$sLocale = Dict::S('Portal:Calendar-FirstDayOfWeek');
$oOutput->AddJs(
<<<EOF
$('#datepicker_{$this->oField->GetGlobalId()}').datetimepicker({format: $sJSFormat, locale: '$sLocale'});
$('#datepicker_{$this->oField->GetGlobalId()}').datetimepicker({format: $sJSFormat, locale: '$sLocale' $sParent});
EOF
);
break;