@extends('admin.layout')

@section('content')

    <?php
    if (!isset($data)) $data = array();
    if (!$data && session("data")) {
        $data = session("data");
    }
    if (!$data && session('_old_input')) {
        $data = session("_old_input");
    }
    ?>
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>排期设置</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    @if(role('Product/Schedule/index'))
                        <div class="row">
                            <div class="col-sm-3 pull-right">
                                <a href="{{ U('Product/Schedule/index')}}" class="btn btn-sm btn-primary pull-right">返回列表</a>
                            </div>
                        </div>
                    @endif

                    <div class="row">
                        <div class="col-lg-10">
                            <form name="form_product" id="form-validation" action=""
                                  class="form-horizontal form-validation" accept-charset="UTF-8" method="post">

                                <div class="form-group">

                                    <label class="control-label col-sm-3">预约店铺</label>

                                    <div class="col-sm-9">
                                        <select class="form-control" name="data[store_id]" required>
                                            @foreach($stores as $item)
                                                <option value="{{$item->id}}"
                                                        @if(isset($data['store_id']) && $data['store_id'] == $item->id) selected @endif>
                                                    {{$item->name}}
                                                </option>
                                            @endforeach
                                        </select>
                                    </div>

                                </div>


                                <div class="form-group">

                                    <label class="control-label col-sm-3">营业时间:上午</label>

                                    <div class="col-sm-9">
                                        <div class="row">
                                            <div class="col-sm-3">
                                                <input id="data_am_start" type="time"
                                                       name="data[am_start]"
                                                       class="form-control col-sm-3"
                                                       value="{{ $data['am_start'] or ''}}"
                                                       required="" aria-required="true"
                                                       placeholder="">
                                            </div>
                                            <div class="col-sm-3">
                                                <input id="data_am_end" type="time"
                                                       name="data[am_end]"
                                                       class="form-control col-sm-3"
                                                       value="{{ $data['am_end'] or ''}}"
                                                       required="" aria-required="true"
                                                       placeholder="">
                                            </div>
                                        </div>


                                    </div>

                                </div>
                                <div class="form-group">

                                    <label class="control-label col-sm-3">营业时间:下午</label>


                                    <div class="col-sm-9">
                                        <div class="row">
                                            <div class="col-sm-3">
                                                <input id="data_pm_start" type="time"
                                                       name="data[pm_start]"
                                                       class="form-control col-sm-3"
                                                       value="{{ $data['pm_start'] or ''}}"
                                                       required="" aria-required="true"
                                                       placeholder="">
                                            </div>
                                            <div class="col-sm-3">
                                                <input id="data_pm_end" type="time"
                                                       name="data[pm_end]"
                                                       class="form-control col-sm-3"
                                                       value="{{ $data['pm_end'] or ''}}"
                                                       required="" aria-required="true"
                                                       placeholder="">
                                            </div>
                                        </div>


                                    </div>

                                </div>
                                <div class="form-group">

                                    <label class="control-label col-sm-3">时间间隔：分钟</label>

                                    <div class="col-sm-9">
                                        <input id="data_interval" name="data[interval]" class="form-control"
                                               value="{{ $data['interval'] or ''}}" required="" aria-required="true"
                                               placeholder="">
                                    </div>

                                </div>
                                <div class="form-group">

                                    <label class="control-label col-sm-3">人数上限</label>

                                    <div class="col-sm-9">
                                        <input id="data_max" name="data[max]" class="form-control"
                                               value="{{ $data['max'] or ''}}" required="" aria-required="true"
                                               placeholder="">
                                    </div>

                                </div>


                                <div class="form-group">

                                    <label class="control-label col-sm-3">休假日期</label>


                                    <div class="col-sm-9">
                                        <div class="row">
                                            <div class="col-sm-3">
                                                <input id="holiday_start" type="date"
                                                       name="data[holiday_start]"
                                                       class="form-control col-sm-3"
                                                       value="{{ $data['holiday_start'] or ''}}"
                                                       placeholder="">
                                            </div>
                                            <div class="col-sm-3">
                                                <input id="holiday_end" type="date"
                                                       name="data[holiday_end]"
                                                       class="form-control col-sm-3"
                                                       value="{{ $data['holiday_end'] or ''}}"
                                                       placeholder="">
                                            </div>
                                        </div>


                                    </div>

                                </div>


                                <div class="form-group">
                                    <label class="control-label col-sm-3">&nbsp;</label>
                                    <div class="col-sm-9">
                                        <input type="hidden" name="_referer"
                                               value="<?php echo urlencode(request()->server('HTTP_REFERER'));?>"/>
                                        <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>"/>
                                        <input type="submit" class="btn btn-success" style="margin-right:20px;">
                                        <input type="reset" class="btn btn-default">
                                    </div>
                                </div>

                            </form>
                        </div>
                        <!-- /.col-lg-10 -->
                    </div>
                    <!-- /.row -->
                </div>
            </div>
        </div>
    </div>

@endsection