.
#
# ---------------------------------------------------------------------
#}
{% extends "generic_show_form.html.twig" %}
{% import 'components/form/fields_macros.html.twig' as fields %}
{% set params = params ?? [] %}
{% set rand = random() %}
{% block more_fields %}
{{ fields.dropdownField('DCRoom', 'dcrooms_id', item.fields['dcrooms_id'], 'DCRoom'|itemtype_name, {
'rand': rand,
}) }}
{% set current_position = item.fields['position'] %}
{% do call('Ajax::updateItemOnSelectEvent',
[
'dropdown_dcrooms_id' ~ rand,
'room_positions',
config('root_doc') ~ '/ajax/dcroom_size.php',
{
'id': '__VALUE__',
'current': current_position,
'rand': rand
}
]) %}
{% do call('Ajax::updateItemOnSelectEvent',
[
'dropdown_dcrooms_id' ~ rand,
'dropdown_locations_id' ~ rand,
config('root_doc') ~ '/ajax/dropdownLocation.php',
{
'items_id': '__VALUE__',
'itemtype': 'DCRoom'
}
]) %}
{% set initial_field %}
{% if item.fields['dcrooms_id'] > 0 %}
{% set dcroom = get_item('DCRoom', item.fields['dcrooms_id']) %}
{% if dcroom is not null %}
{% set used = dcroom.getFilled(current_position) %}
{% set positions = dcroom.getAllPositions() %}
{{ fields.dropdownArrayField('position', current_position, positions, null, {
'rand': rand,
'used': used,
'no_label': true
}) }}
{% else %}
{{ __('No room found or selected') }}
{% endif %}
{% else %}
{{ __('No room found or selected') }}
{% endif %}
{% endset %}
{{ fields.ajaxField('room_positions', initial_field, __('Position in room'), {
'rand': rand
}) }}
{{ fields.dropdownArrayField(
'room_orientation',
item.fields['room_orientation'],
{
(constant('Rack::ROOM_O_NORTH')): __('North'),
(constant('Rack::ROOM_O_EAST')): __('East'),
(constant('Rack::ROOM_O_SOUTH')): __('South'),
(constant('Rack::ROOM_O_WEST')): __('West'),
},
__('Door orientation in room'),
field_options|merge({
'rand': rand
})
) }}
{{ fields.numberField(
'number_units',
item.fields['number_units'],
__('Number of units'),
field_options|merge({
'rand': rand,
'min': 1,
'max': 100,
'step': 1,
})
) }}
{{ fields.numberField(
'width',
item.fields['width'],
__('Width'),
field_options|merge({
'rand': rand,
'min': 0,
'step': 1,
})
) }}
{{ fields.numberField(
'height',
item.fields['height'],
__('Height'),
field_options|merge({
'rand': rand,
'min': 0,
'step': 1,
})
) }}
{{ fields.numberField(
'depth',
item.fields['depth'],
__('Depth'),
field_options|merge({
'rand': rand,
'min': 0,
'step': 1,
})
) }}
{{ fields.numberField(
'max_power',
item.fields['max_power'],
__('Max. power (in watts)'),
field_options|merge({
'rand': rand,
'min': 0,
'step': 1,
})
) }}
{{ fields.numberField(
'mesured_power',
item.fields['mesured_power'],
__('Measured power (in watts)'),
field_options|merge({
'rand': rand,
'min': 0,
'step': 1,
})
) }}
{{ fields.numberField(
'max_weight',
item.fields['max_weight'],
__('Max. weight'),
field_options|merge({
'rand': rand,
'min': 0,
'step': 1,
})
) }}
{{ fields.colorField(
'bgcolor',
item.fields['bgcolor'],
__('Background color'),
field_options
) }}
{% endblock %}