<div id="records-toolbar" data-control="toolbar">

    <?php
        echo $this->makePartial('$/martin/forms/controllers/records/partials/_action_button.htm', [
            'type'            => 'danger',
            'icon'            => 'oc-icon-trash',
            'label'           => e(trans('backend::lang.list.delete_selected')),
            'onclick'         => "$(this).data('request-data', { checked: $('.control-list').listWidget('getChecked') })",
            'needs_selected'  => true,
            'request'         => 'onDelete',
            'request_confirm' => e(trans('backend::lang.list.delete_selected_confirm')),
            'request_success' => "
                $('#records-toolbar').find('button').prop('disabled', true);
                $.oc.flashMsg({
                    'text': '" . e(trans('backend::lang.list.delete_selected_success')) . "',
                    'class': 'success',
                    'interval': 3
                });
                $.oc.sideNav.setCounter('forms/records', data.counter);
                $('#Lists').html(data.list['#Lists']);
            ",
        ]);
    ?>

    <div class="btn-group">
    <?php
        echo $this->makePartial('$/martin/forms/controllers/records/partials/_action_button.htm', [
            'type'            => 'default',
            'icon'            => 'oc-icon-eye-slash',
            'label'           => e(trans('martin.forms::lang.controllers.records.buttons.unread')),
            'onclick'         => "$(this).data('request-data', { state: 'unread', checked: $('.control-list').listWidget('getChecked') })",
            'needs_selected'  => true,
            'request'         => 'onReadState',
            'request_confirm' => '',
            'request_success' => "
                $('#records-toolbar').find('button').prop('disabled', true);
                $.oc.sideNav.setCounter('forms/records', data.counter);
                $('#Lists').html(data.list['#Lists']);
            ",
        ]);

        echo $this->makePartial('$/martin/forms/controllers/records/partials/_action_button.htm', [
            'type'            => 'default',
            'icon'            => 'oc-icon-eye',
            'label'           => e(trans('martin.forms::lang.controllers.records.buttons.read')),
            'onclick'         => "$(this).data('request-data', { state: 'read', checked: $('.control-list').listWidget('getChecked') })",
            'needs_selected'  => true,
            'request'         => 'onReadState',
            'request_confirm' => '',
            'request_success' => "
                $('#records-toolbar').find('button').prop('disabled', true);
                $.oc.sideNav.setCounter('forms/records', data.counter);
                $('#Lists').html(data.list['#Lists']);
            ",
        ]);
    ?>
    </div>

    <?php
        if(Martin\Forms\Models\Settings::get('gdpr_enable')) {
            echo $this->makePartial('$/martin/forms/controllers/records/partials/_action_button.htm', [
                'type'            => 'danger',
                'icon'            => 'oc-icon-history',
                'label'           => e(trans('martin.forms::lang.controllers.records.buttons.gdpr_clean')),
                'request'         => 'onGDPRClean',
                'request_confirm' => e(trans('martin.forms::lang.controllers.records.alerts.gdpr_confirm')),
                'request_success' => "
                    $('#records-toolbar').find('button').blur();
                    $.oc.sideNav.setCounter('forms/records', data.counter);
                    $('#Lists').html(data.list['#Lists']);
                ",
            ]);
        }
    ?>

</div>