@extends('base.base')
@section('base')
    <!-- 内容区域 -->
    <div class="main-panel">
        <div class="content-wrapper">
            <div class="page-header">
                <h3 class="page-title">
                     <span class="page-title-icon bg-gradient-primary text-white mr-2">
                <i class="mdi mdi-wrench"></i>
              </span>
                    {{ __('auto.跟进管理') }}
                </h3>
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">{{ __('auto.跟进管理') }}</a></li>
                        <li class="breadcrumb-item active" aria-current="page">{{ __('auto.跟进列表') }}</li>
                    </ol>
                </nav>
            </div>
            <div class="row">
                <div class="col-lg-12 grid-margin stretch-card">
                    <div class="card">
                        <div class="card-body">
                            <h4 class="card-title">{{ __('auto.跟进管理') }}</h4>
                            <form class="well form-inline margin-top-20" id="follow_form" method="post" action='/admin/custom/follow_add'>
                                <spen style="padding-left: 10px" >{{ __('auto.写跟进：') }}</spen>

                                <spen style="padding-left: 10px" >{{ __('auto.跟进内容：') }}</spen>
                                <input class="form-control" type="hidden" name="UserID" id="UserID" value="{{$id}}" >

                                <input class="form-control" type="text" name="f_content" id="follow_content" style="width: 20%" >

                                <spen style="padding-left: 10px" >{{ __('auto.跟进类型：') }}</spen>
                                <select class="form-control" name="f_type"   style="color: black">
                                    <option value="1">what's app</option>
                                    <option value="2">Email</option>
                                    <option value="3">{{ __('auto.短信') }}</option>
                                    <option value="4">Telegram</option>
                                    <option value="5">{{ __('auto.电话') }}</option>
                                </select>

                                <input type="submit" class="btn btn-sm btn-gradient-dark btn-icon-text" value="{{ __('auto.提交跟进') }}" />&nbsp;&nbsp;
                            </form>
                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th>{{ __('auto.时间') }}</th>
                                    <th>{{ __('auto.跟进类型') }}</th>
                                    <th>{{ __('auto.内容') }}</th>
                                    <th>{{ __('auto.操作人') }}</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($list as $k=>$v)
                                    <tr>
                                        <td style="width: 10%">{{ date('Y-m-d H:i:s',$v->created) }}</td>
                                        <td style="width: 5%">{{ $followType[$v->f_type]}}</td>
                                        <td style="width: 35%">{{ $v->f_content}}</td>
                                        <td style="width: 35%">{{ $v->admin}}</td>

                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        var follow_sub = 0;

        $( '.follow_sub' ).click( function () {
            if ( follow_sub ) {
                return false;
            }
            if(!$("#follow_content").val()){
                alert('{{ __('auto.跟进内容不能为空') }}');
                return false;
            }
            follow_sub = 1;
            $( '#follow_form' ).submit();
            return false;
        } );

    </script>
@endsection
