@extends('layouts.agencies') @section('content')

    <?php Fun::lang()?>
    <style>
        .select2-container--default .select2-selection--single {
            border: none;
        }
        .select2-container--default .select2-selection--single .select2-selection__arrow b {
            border-style: none;
        }
    </style>
    <ol class="breadcrumb">
        <li><a href="#">{{__('administrator.Dashboard')}}</a></li>
        <li><a href="">{{__('administrator.crm')}}</a></li>
        <li class="active">{{__('administrator.add_lead')}}</li>
    </ol>
    <div class="page">
<div class=container-fluid>
        <div class="top-content">
            <div class="row">
                <div class="col-sm-12 col-xs-12">
                    <div class="title-add">
                        <div class="pull-left">
                            <h3>{{__('administrator.close_deal')}}</h3>
                        </div>
                        <div class="pull-right">

                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="master-form">
                    {!! Form::open(array('route' => 'lead.save-agent-agency','method'=>'POST')) !!}
                    <div class="form-group col-sm-12 col-xs-12">
                        <fieldset>
                            <legend>
                                {{__('administrator.lead_info')}}
                            </legend>
                            <div class="form-group col-sm-6 col-xs-12">
                                <div class="col-sm-3 col-xs-12 ">
                                    <label>{{__('administrator.date')}} </label>
                                </div>
                                <div class="col-sm-9">
                                    {!! Form::text('date', $lead->date, array('placeholder' =>__('administrator.date'),'class' => 'form-control no-border','readonly')) !!}
                                </div>
                            </div>
                            <div class="form-group col-sm-6 col-xs-12">
                                <div class="col-sm-3 col-xs-12 ">
                                    <label>{{__('administrator.agent')}} </label>
                                </div>
                                <div class="col-sm-9">
                                    {!! Form::text('agent', optional($lead->agent)->user_firstname.' '.optional($lead->agent)->user_lastname, array('placeholder' =>__('administrator.agent'),'class' => 'form-control no-border','readonly')) !!}
                                    {!! Form::hidden('agent_id', $lead->agent_id) !!}
                                </div>
                            </div>
                            <div class="form-group col-sm-6 col-xs-12">
                                <div class="col-sm-3 col-xs-12 ">
                                    <label>{{__('administrator.family_name')}} </label>
                                </div>
                                <div class="col-sm-9">
                                    {!! Form::text('family_name', $lead->family_name, array('placeholder' =>__('administrator.agent'),'class' => 'form-control no-border','readonly')) !!}
                                </div>
                            </div>
                            <div class="form-group col-sm-6 col-xs-12">
                                <div class="col-sm-3 col-xs-12 ">
                                    <label>{{__('administrator.last_name')}}</label>
                                </div>
                                <div class="col-sm-9">
                                    {!! Form::text('lead', $lead->name, array('placeholder' =>__('administrator.lead_source'),'class' => 'form-control no-border','readonly')) !!}
                                    {!! Form::hidden('lead_id', $lead->id, array('readonly')) !!}
                                </div>
                            </div>
                            <div class="form-group col-sm-6 col-xs-12">
                                <div class="col-sm-3 col-xs-12 ">
                                    <label>{{__('administrator.sex')}} </label>
                                </div>
                                <div class="col-sm-9">
                                    {!! Form::select('sex', [''=>__('administrator.please_select'),'Female'=>__('administrator.female'),'Male'=>__('administrator.male') ], $lead->sex,array('class' => 'select2 form-control noborder','readonly')) !!}
                                </div>
                            </div>
                            <div class="form-group col-sm-6 col-xs-12">
                                <div class="col-sm-3 col-xs-12 ">
                                    <label>{{__('administrator.contact')}} </label>
                                </div>
                                <div class="col-sm-9">
                                    {!! Form::text('contact', $lead->contact, array('placeholder' =>__('administrator.contact'),'class' => 'form-control no-border','readonly')) !!}
                                </div>
                            </div>
                            <div class="form-group col-sm-6 col-xs-12">
                                <div class="col-sm-3 col-xs-12 ">
                                    <label>{{__('administrator.email')}} </label>
                                </div>
                                <div class="col-sm-9">
                                    {!! Form::text('email', $lead->email, array('placeholder' =>__('administrator.email'),'class' => 'form-control no-border','readonly')) !!}
                                </div>
                            </div>
                            <div class="form-group col-sm-6 col-xs-12">
                                <div class="col-sm-3 col-xs-12 ">
                                    <label>{{__('administrator.address')}} </label>
                                </div>
                                <div class="col-sm-9">
                                    {!! Form::text('address', $lead->address, array('placeholder' =>__('administrator.address'),'class' => 'form-control no-border','readonly')) !!}
                                </div>
                            </div>
                            <div class="form-group col-sm-6 col-xs-12">
                                <div class="col-sm-3 col-xs-12 ">
                                    <label>{{__('administrator.lead_source')}} </label>
                                </div>
                                <div class="col-sm-9">
                                    {!! Form::text('lead_sources', optional($lead->lead_sources)->source_name, array('placeholder' =>__('administrator.lead_source'),'class' => 'form-control no-border','readonly')) !!}
                                </div>
                            </div>
                            <div class="form-group col-sm-6 col-xs-12">
                                <div class="col-sm-3 col-xs-12 ">
                                    <label>{{__('administrator.job')}} </label>
                                </div>
                                <div class="col-sm-9">
                                    {!! Form::text('job', $lead->job, array('placeholder' =>__('administrator.job'),'class' => 'form-control no-border','readonly')) !!}
                                </div>
                            </div>
                            <div class="form-group col-sm-6 col-xs-12">
                                <div class="col-sm-3 col-xs-12 ">
                                    <label>{{__('administrator.workplace')}} </label>
                                </div>
                                <div class="col-sm-9">
                                    {!! Form::text('workplace', $lead->workplace, array('placeholder' =>__('administrator.workplace'),'class' => 'form-control no-border','readonly')) !!}
                                </div>
                            </div>
                        </fieldset>
                    </div>
                    <div class="form-group col-sm-12 col-xs-12">
                        <fieldset>
                            <legend>
                                {{__('administrator.call_log')}}
                            </legend>
                            <div class="form-group col-sm-12 col-xs-12">
                                <table class="table table-hover">
                                    <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>{{__('administrator.date')}}</th>
                                        <th>{{__('administrator.time')}}</th>
                                        <th>{{__('administrator.subject')}}</th>
                                        <th>{{__('administrator.status')}}</th>
                                        <th>{{__('administrator.call_type')}}</th>
                                        <th>{{__('administrator.call_duration')}}</th>
                                        <th>{{__('administrator.out_come')}}</th>
                                        <th width="16%">{{__('administrator.result_percentage')}}</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    @if($call_log->count()>0)
                                        @foreach($call_log as $k => $row)
                                            <tr>
                                                <td>{{$k+1}}</td>
                                                <td>{{date('Y-m-d',strtotime($row->date))}}</td>
                                                <td>{{$row->hour.':'.$row->minutes.':'.$row->shift}}</td>
                                                <td>{{$row->subject}}</td>
                                                <td>{!! $row->complete_status==1?'<span class="label label-success">Completed</span>':'<span class="label label-warning">Pending</span>'!!}</td>
                                                <td>{{$row->call_type?$row->call_type:'N/A'}}</td>
                                                <td>{{$row->call_duration?$row->call_duration:'N/A'}}</td>
                                                <td>{{$row->out_come?$row->out_come:'N/A'}}</td>
                                                <td>{{$row->result_percentage?$row->result_percentage.'%':'N/A'}}</td>
                                            </tr>
                                        @endforeach
                                    @else
                                        <tr>
                                            <td colspan="9" class="text-center">{{__('administrator.no_data')}}</td>
                                        </tr>
                                    @endif
                                    </tbody>
                                </table>
                            </div>
                        </fieldset>
                    </div>
                    <div class="form-group col-sm-12 col-xs-12">
                        <fieldset>
                            <legend>
                                {{__('administrator.appointment_log')}}
                            </legend>
                            <div class="form-group col-sm-12 col-xs-12">
                                <table class="table table-hover">
                                    <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>{{__('administrator.date')}}</th>
                                        <th>{{__('administrator.time')}}</th>
                                        <th>{{__('administrator.subject')}}</th>
                                        <th>{{__('administrator.place')}}</th>
                                        <th>{{__('administrator.status')}}</th>
                                        <th>{{__('administrator.out_come')}}</th>
                                        <th width="16%">{{__('administrator.result_percentage')}}</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    @if($appointment->count()>0)
                                        @foreach($appointment as $k => $row)
                                            <tr>
                                                <td>{{$k+1}}</td>
                                                <td>{{date('Y-m-d',strtotime($row->date))}}</td>
                                                <td>{{$row->hour.':'.$row->minutes.':'.$row->shift}}</td>
                                                <td>{{$row->subject}}</td>
                                                <td>{{$row->where}}</td>
                                                <td>{!! $row->complete_status==1?'<span class="label label-success">Completed</span>':'<span class="label label-warning">Pending</span>'!!}</td>
                                                <td>{{$row->out_come?$row->out_come:'N/A'}}</td>
                                                <td>{{$row->result_percentage?$row->result_percentage.'%':'N/A'}}</td>
                                            </tr>
                                        @endforeach
                                    @else
                                        <tr>
                                            <td colspan="8" class="text-center">{{__('administrator.no_data')}}</td>
                                        </tr>
                                    @endif

                                    </tbody>
                                </table>
                            </div>
                        </fieldset>
                    </div>
                    <div class="form-group col-sm-12 col-xs-12">
                        <fieldset>
                            <legend>
                                {{__('administrator.meeting_log')}}
                            </legend>
                            <div class="form-group col-sm-12 col-xs-12">
                                <table class="table table-hover">
                                    <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>{{__('administrator.date')}}</th>
                                        <th>{{__('administrator.time')}}</th>
                                        <th>{{__('administrator.subject')}}</th>
                                        <th>{{__('administrator.place')}}</th>
                                        <th>{{__('administrator.status')}}</th>
                                        <th>{{__('administrator.out_come')}}</th>
                                        <th width="16%">{{__('administrator.result_percentage')}}</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    @if($meeting->count()>0)
                                        @foreach($meeting as $k => $row)
                                            <tr>
                                                <td>{{$k+1}}</td>
                                                <td>{{date('Y-m-d',strtotime($row->date))}}</td>
                                                <td>{{$row->hour.':'.$row->minutes.':'.$row->shift}}</td>
                                                <td>{{$row->subject}}</td>
                                                <td>{{$row->where}}</td>
                                                <td>{!! $row->complete_status==1?'<span class="label label-success">Completed</span>':'<span class="label label-warning">Pending</span>'!!}</td>
                                                <td>{{$row->out_come?$row->out_come:'N/A'}}</td>
                                                <td>{{$row->result_percentage?$row->result_percentage.'%':'N/A'}}</td>
                                            </tr>
                                        @endforeach
                                    @else
                                        <tr>
                                            <td colspan="8" class="text-center">{{__('administrator.no_data')}}</td>
                                        </tr>
                                    @endif
                                    </tbody>
                                </table>
                            </div>
                        </fieldset>
                    </div>
                    <div class="form-group col-sm-12 col-xs-12">
                        <fieldset>
                            <legend>
                                {{__('administrator.close_deal')}}
                            </legend>
                            <div class="form-group col-sm-6 col-xs-12">
                                <div class="col-sm-3 col-xs-12 ">
                                    <label class="required">{{__('administrator.result')}} </label>
                                </div>
                                <div class="col-sm-9">
                                    {!! Form::select('close_deal', [''=>__('administrator.please_select'),'1'=>__('administrator.success'),'2'=>__('administrator.fail')],null, array('class' => 'form-control','required')) !!}
                                </div>
                            </div>
                            <div class="form-group col-sm-6 col-xs-12">
                                <div class="col-sm-3 col-xs-12 ">
                                    <label>{{__('administrator.note')}} </label>
                                </div>
                                <div class="col-sm-9">
                                    {!! Form::textarea('close_deal_note',null, array('class' => 'form-control no-resize','rows'=>'4')) !!}
                                </div>
                            </div>
                        </fieldset>
                    </div>
                    <div class="col-sm-12 col-xs-12">
                        <div class="form-group footer-save">
                            <button type="submit" class="button_sm button_primary pull-right"><span
                                        class="fa fa-save"></span> {{__('administrator.close_deal')}}</button>
                            <button type="button" onClick="javascript:history.go(-1)"
                                    class="button_sm button_warning pull-right">
                                <span class=" fa fa-arrow-circle-left"></span> {{__('administrator.back')}}</button>
                        </div>
                    </div>
                    {!! Form::close() !!}
                </div>
            </div>
        </div>
    </div>
@endsection
@section('script')
    <script type="text/javascript">
        $(document).ready(function () {

        });
    </script>
@endsection