<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\sortable\Sortable;
use kartik\sortinput\SortableInput;

$this->title = Yii::t('app', 'Change Images Order');
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Items'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => Yii::$app->language == 'ar' ? $item->arabic_name : $item->english_name . ' images', 'url' => ['update-images', 'id' => $item->id]];
$this->params['breadcrumbs'][] = $this->title;

?>
<div class="images-sort-form">
    <?php $form = ActiveForm::begin(); ?>

    <?=
        SortableInput::widget([
            'name'=> 'images_sort',
            // 'value'=> $value,
            'items' => $images,
            // 'hideInput' => false,
            'options' => ['class'=>'form-control', 'readonly'=>true],
            'sortableOptions' => ['type'=>'grid']
            ]);
    ?>

    <div class="form-group">
        <?= Html::submitButton(Yii::t('app', 'Save'), ['class' => 'btn btn-success']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>

<?php

    if(Yii::$app->session->hasFlash('updated')){
        echo "<div class='alert alert-success'>";
        echo Yii::$app->session->getFlash('updated');
        echo "</div>";
    }
    
?>