<div class="box-footer">

    {{ csrf_field() }}

    <div class="col-md-{{$width['label']}}">
    </div>

    <div class="col-md-{{$width['field']}}">

        @if(in_array('submit', $buttons))

        <div id="form-submit" class="btn-group pull-right">
            <button type="submit" class="btn btn-primary">{{ trans('admin.submit') }}</button>
        </div>

        @if($tab_size > 1)
        <div id="tab-next-step" class="btn-group pull-right" style="margin: 0 10px 0 0;">
            <button type="button" class="btn btn-primary">下一步</button>
        </div>

        <div id="tab-last-step" class="btn-group pull-right" style="margin: 0 10px 0 0;">
            <button type="button" class="btn btn-primary">上一步</button>
        </div>
        @endif

        @if(in_array('continue_editing', $checkboxes))
        <label class="pull-right" style="margin: 5px 10px 0 0;">
            <input type="checkbox" class="after-submit" name="after-save" value="1"> {{ trans('admin.continue_editing') }}
        </label>
        @endif

        @if(in_array('continue_creating', $checkboxes))
            <label class="pull-right" style="margin: 5px 10px 0 0;">
                <input type="checkbox" class="after-submit" name="after-save" value="2"> {{ trans('admin.continue_creating') }}
            </label>
        @endif

        @if(in_array('view', $checkboxes))
        <label class="pull-right" style="margin: 5px 10px 0 0;">
            <input type="checkbox" class="after-submit" name="after-save" value="3"> {{ trans('admin.view') }}
        </label>
        @endif

        @endif

        @if(in_array('reset', $buttons))
        <div class="btn-group pull-left">
            <button type="reset" class="btn btn-warning">{{ trans('admin.reset') }}</button>
        </div>
        @endif
    </div>
</div>
<script>
    @if($tab_size > 1)
        var tab_size = {{$tab_size}};
        var now_tab = 1;

        if (tab_size == 1) {
            $('#tab-next-step').hide();
            $('#tab-last-step').hide();
        }
        else {
            $('#form-submit').hide();
            $('#tab-last-step').hide();
        }

        $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
            now_tab = e.target.getAttribute('data-count');
            $('#form-submit').hide();
            $('#tab-next-step').hide();
            $('#tab-last-step').hide();

            if (now_tab == 1 && now_tab < tab_size) {
                $('#tab-next-step').show();
            }
            else if (now_tab > 1 && now_tab < tab_size) {
                $('#tab-next-step').show();
                $('#tab-last-step').show();
            }
            else if (now_tab == tab_size) {
                $('#form-submit').show();
                $('#tab-last-step').show();
            }
        });

        $('#tab-next-step').on('click', function () {
            var tab_name = "tab-form-" + (parseInt(now_tab) + 1);
            $('a[href="#'+tab_name+'"]').tab('show');
            scrollTo(0,0);
        });

        $('#tab-last-step').on('click', function () {
            var tab_name = "tab-form-" + (parseInt(now_tab) - 1);
            $('a[href="#'+tab_name+'"]').tab('show');
            scrollTo(0,0);
        });
    @endif
</script>