<?php
$default_format = function ($column, $value, $row) {
    $result = $value;
    if (in_array($column, ['fecha'])) {
        $result = date('d-m-Y', strtotime($value));
    }
    return $result;
};

$default_filter_format = function ($field, $data) {
    $result = $data;
    if (in_array($field, ['fecha'])) {
        $result = date('Y-m-d', strtotime($data));
    }
    return $result;
};

return [
    'scripts' => [
        'js/plugin/jqgrid/jquery.jqGrid.min.js',
        'js/plugin/jqgrid/grid.locale-es.js',
        'js/plugin/jqgrid/general.js',
        'js/plugin/jquery-form/jquery-form.min.js'
    ],
    'defaults' => [
        'datatype' => 'json',
        'rowNum' => 10,
        'rowList' => [10, 20, 30],
        'pager' => '#jqgrid_pager',
        'sortname' => 'id',
        'sortorder' => 'desc',
        'height' => 'auto',
        'autowidth' => true,
        'toolbarfilter' => true,
        'viewrecords' => true,
        'subGridOptions' => [
            'plusicon' => 'fa fa-plus',
            'minusicon' => 'fa fa-minus',
            'openicon' => 'fa fa-caret-right',
            'selectOnExpand' => true
        ],
        'gridComplete' => "function() {
            set_classes();
        }"
    ],
    'default_format' => $default_format,
    'default_filter_format' => $default_filter_format,
];