<?php

$column_value = pf_get_value($name, $item, $values);
$star = function ($rate_step) use($column_value) {
    if ($rate_step <= $column_value) {
        return '';
    } else {
        return '-empty';
    }
};
?>

<div class="block-rating--bar block-rating-input">
    <?php 
foreach ([1, 2, 3, 4, 5] as $rate_step) {
    ?>
<span data-level="<?php 
    echo $rate_step;
    ?>
" class="glyphicon glyphicon-star<?php 
    echo $star($rate_step);
    ?>
" aria-hidden="true"></span><?php 
}
?>

    <?php 
echo Form::hidden($input_name, $column_value);
?>
    <div class="clearfix"></div>
</div>
<script type="text/javascript" src="/assets/development/bower/moment/min/moment-with-locales.min.js" ></script>
<script type="text/javascript" src="/assets/development/bower/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js" ></script>

<link rel="stylesheet" href="/assets/development/bower/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.css" />

<?php 
if (isset($field['attributes']['class'])) {
    $field['attributes']['class'] .= ' form-control';
} else {
    $field['attributes']['class'] = 'form-control';
}
?>

<?php 
echo Form::input('text', $input_name, pf_get_value($name, $item, $values), $field['attributes']);
?>

<script>
    $(window).load(function() {
        $('input[name="<?php 
echo $input_name;
?>
"]').datetimepicker({
            locale: 'ru',
            sideBySide: true,
            //minDate: new Date(),
            format: 'YYYY-MM-DD HH:mm:ss'
        });
    });
</script>
<?php

if (isset($field['attributes']['class'])) {
    $field['attributes']['class'] .= ' form-control';
} else {
    $field['attributes']['class'] = 'form-control';
}
if (!isset($field['attributes']['rows'])) {
    $field['attributes']['rows'] = '3';
}
$field['attributes']['id'] = $input_name;
echo Form::textarea($input_name, pf_get_value($name, $item, $values), $field['attributes']);
<div class="checkbox">
    <label>
        <?php 
echo Form::checkbox($input_name, 1, (bool) pf_get_value($name, $item, $values), $field['attributes']) . array_get($field, 'text');
?>
    </label>
</div>
}
?>
)"></div>
    <div id="<?php 
echo $input_name;
?>
-uploadphoto"></div>
    <input name="<?php 
echo $input_name;
?>
" id="<?php 
echo $input_name;
?>
-avatar_id" type="hidden"
           value="<?php 
echo pf_get_value($name, $item, $values);
?>
"/>
</div>
<p class="font-small">В качестве изображения<br/> используйте<br/> файл в формате JPG, GIF, PNG</p>
<div class="btn btn-mini"
     onclick="$('#<?php 
echo $input_name;
?>
-photography').css('backgroundImage','url()'); $('#<?php 
echo $input_name;
?>
-avatar_id').val('');">
    Удалить изображение
</div>
<script type="text/javascript">
    $values = null;
}
// В некоторых исключительных ситуациях бывает необходимо вытащить номер текущего редактируемого объекта
echo Form::hidden('data_item_id', $item->id);
echo Form::token();
foreach ($fields as $name => $field) {
    if (!isset($field['attributes'])) {
        $field['attributes'] = [];
    }
    $input_name = $prefix . $name;
    $label = array_get($field, 'label');
    if (Lang::has($label)) {
        $label = trans($label);
    }
    if ($field['tag'] == 'hidden') {
        echo Form::hidden($input_name, pf_get_value($name, $item, $values), $field['attributes']);
    } else {
        $field_is_required = '';
        if (isset($field['attributes']['data-validation']) and str_contains($field['attributes']['data-validation'], 'notempty')) {
            $field_is_required = '<span class="text-danger" title="' . trans('prettyforms::validation.field_is_required') . '"> *</span>';
        }
        echo "<div class='row'>";
        echo "<div class='small-12 medium-3 columns'> <label for='field-{$input_name}' class='small-text-left medium-text-right inline'>{$label}{$field_is_required}";
        if (isset($field['desc'])) {
            echo "<br/><small class='text-muted' style='font-weight: normal'>{$field['desc']}</small>";
        }
        echo '</div>';
        echo '<div class="small-12 medium-9 columns">';
        echo view("prettyforms::tags.{$field['tag']}", compact('item', 'field', 'values', 'input_name', 'name', 'label'))->render();
        echo "<small style='display:none' id='validation-error-{$input_name}' class='error'></small>";
        echo '</div></div>';