@extends('layouts.admin')


@section('content')
    @include('admin.left-sidebar')

    <div class="content-wrapper">

        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                数据库管理
                <small> （请谨慎操作）</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="{{ url('/')}}"><i class="fa fa-dashboard"></i> 主页</a></li>
                <li><a href="{{ url('/sql') }}">数据库</a></li>
            </ol>
        </section>
        <!-- Main content -->
        <section class="content">
            <!-- Default box -->
            <div class="box">
                <div class="box-header">
                    <h3 class="box-title">数据备份记录</h3>
                </div>
                <!-- /.box-header -->
                <div class="box-body">
                    <div id="example2_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
                        <div class="row">
                            <div class="col-sm-11"></div>
                            <div class="col-sm-1">
                                <a class="btn btn-primary tooltips" data-toggle="modal" data-target="#myModal">
                                    <i class="fa fa-plus"></i> 新建备份</a>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-12">
                                <table class="table mb30">
                                    <thead>
                                    <tr>
                                        <th>ID</th>
                                        <th>备份名</th>
                                        <th>备注</th>
                                        <th>时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    @foreach($data as $value)
                                        <tr>
                                            <td>{{ $value->id }}</td>
                                            <td>{{ $value->name }}</td>
                                            <td>{{ $value->description }}</td>
                                            <td>{{ $value->created_at }}</td>
                                            <td>
                                                <a href="{{ url('/sql/download/'.$value->id) }}" class=" btn-sm btn-success"><i class="fa  fa-cloud-download"></i> 导出</a>
                                                <a href="{{ url('/sql/recovery/'.$value->id) }}" class=" btn-sm btn-danger"><i class="fa fa-mail-reply"></i>&nbsp;恢复</a>
                                            </td>
                                        </tr>
                                        @endforeach
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-5">
                                <div class="dataTables_info" id="example2_info" role="status" aria-live="polite"></div>
                            </div>
                            <div class="col-sm-7">
                                <div class="dataTables_paginate paging_simple_numbers" id="example2_paginate">
                                    <ul class="pagination">

                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /.box-body -->
            </div>
            <!-- /.box -->

        </section>
        <!-- /.content -->
    </div>

    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <form action="{{ url('/sql/backups') }}" method="post">
            {{ csrf_field() }}
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">备份</h4>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <input class="form-control" name="name" placeholder="输入备份名...">
                    </div>
                    <div class="form-group">
                        <textarea class="form-control" name="description" placeholder="输入备份备注...100字以内"></textarea>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">返回</button>
                    <button id="sub" type="submit" class="btn btn-primary">提交</button>
                </div>
            </div>
        </div>
        </form>
    </div>

    @endsection