@extends('reseller.layouts.master')

@section('page_title')
    Users - Edit User
@endsection


@push('styles')
<link rel="stylesheet" href="//cdn.datatables.net/1.10.7/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.0.3/css/buttons.dataTables.min.css">
@endpush

@section('page_content')
    <div class="page-content container-fluid" style="color:#000;">
        <div class="row">
            <div class="col-md-8 col-md-offset-2">
                <div class="panel" id="exampleWizardForm">
                    <div class="panel-heading">
                        <div class="panel-title">
                            <h3>Users - Edit</h3>
                        </div>
                    </div>
                    <div class="panel-body">
                        <form class="form-horizontal" method="POST">
                            @if(count($errors)>0)
                                <div class="alert alert-danger">
                                    <ul>
                                        @foreach($errors->all() as $error)
                                            <li>{{$error}}</li>
                                        @endforeach
                                    </ul>
                                </div>
                            @endif
                            @if (\Session::has('success'))
                                <div class="alert alert-success">
                                    <ul>
                                        <li>{!! \Session::get('success') !!}</li>
                                    </ul>
                                </div>
                            @endif
                            {{csrf_field()}}
                            {{method_field('PUT')}}

                        <div class="row" >
                            <div class="form-group">
                                <label for="organisation" class="col-sm-3 control-label form-label">Organisation<span
                                            style="color: red;"></span> </label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="organisation" id="organisation" placeholder="Enter Organisation" value="{{empty(old('organisation')) ? $record->organisation :  old('organisation')}}">
                                </div>
                            </div>
                                <div class="form-group">
                                    <label for="username" class="col-sm-3 control-label form-label">Email<span
                                                style="color: red;">*</span> </label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" name="email" id="email" placeholder="Enter Email" value="{{empty(old('email')) ? $record->email :  old('email')}}">
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label for="username" class="col-sm-3 control-label form-label">Phone Number<span
                                                style="color: red;">*</span> </label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" name="phone_number" id="phone_number" placeholder="Enter Phone Number" value="{{empty(old('phone_number')) ? $record->phone_number :  old('phone_number')}}">
                                    </div>
                                </div>
                            <div class="form-group">
                                <label for="price" class="col-sm-3 control-label form-label">SMS Price <span
                                            class="currAbbr">{{$record->currency}}</span><span
                                            style="color: red;">*</span> </label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="price" id="price"
                                           placeholder="Enter SMS Price"
                                           value="{{empty(old('price')) ? $record->credit->price :  old('price')}}">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="email_price" class="col-sm-3 control-label form-label">Email Price
                                    <span class="currAbbr">{{$record->currency}}</span><span
                                            style="color: red;">*</span> </label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="email_price" id="price"
                                           placeholder="Enter Price"
                                           value="{{empty(old('email_price')) ? $record->credit->email_price :  old('email_price')}}">
                                </div>
                            </div>
                                <div class="form-group">
                                    <label for="contact_person" class="col-sm-3 control-label form-label">Contact Person<span
                                                style="color: red;">*</span> </label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" name="contact_person" id="contact_person" placeholder="Enter Contact Person" value="{{empty(old('organisation')) ? $record->full_name :  old('contact_person')}}">
                                    </div>
                                </div>
                        </div>
                            <div class="col-md-offset-5">
                                <button type="submit" id="saveBtn" class="btn btn-primary" style="background-color: #ffcb05; color: #000;">Save Changes</button>
                                <a id="cancelBtn" href="{{route('reseller.users')}}" class="btn btn-default" style="background-color: #000; color: #ffcb05;">Cancel</a>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
