@extends('layout.main')
@section('title') @if( ! empty($title)) {{ $title }} | @endif @parent @endsection

@section('main')
<div class="">

    <div id="wrapper">
        @include('admin.sidebar_menu')
        <div id="page-wrapper">
            @if( ! empty($title))
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header"> {{ $title }} </h1>
                </div> <!-- /.col-lg-12 -->
            </div> <!-- /.row -->
            @endif

            @include('admin.flash_msg')

            <div class="container">
                <div class="container"
                    style="background-color:white;margin-top: 20px;padding-top: 25px;padding-bottom: 50px;">
                    <h3>Edit Provider</h3>
                    <form action="{{route("providers_edit", $provider->id)}}" method="post"
                        enctype="multipart/form-data">
                        @csrf
                        <div class="form-group">
                            <div class="col-xs-12">
                                <label for="logo">
                                    <h5>Logo</h5>
                                </label>
                                <p style="margin-top:10px;"><img
                                        src="/uploads/images/serviceproviders/{{ $provider->logo}}"
                                        style="max-width:50%;"> </p>
                                <input type="file" name="logo" id="logo">

                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-xs-12">
                                <label for="name">
                                    <h5>Name</h5>
                                </label>
                                <input type="text" class="form-control form-control-lg" name="name" id="name"
                                    placeholder="Name" value="{{$provider->name}} " required>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-xs-12">
                                <label for="email">
                                    <h5>Email</h5>
                                </label>
                                <input type="email" class="form-control form-control-lg" name="email" id="email"
                                    placeholder="Email" value="{{$provider->email}} " required>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-xs-12">
                                <label for="phone_number">
                                    <h5>Phone number</h5>
                                </label>
                                <input type="text" class="form-control form-control-lg" name="phone_number"
                                    id="phone_number" placeholder="phone number" value="{{$provider->phone_number}}"
                                    required>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-xs-12">
                                <label for="website">
                                    <h5>Website</h5>
                                </label>
                                <input type="text" class="form-control form-control-lg" name="website" id="website"
                                    placeholder="website" value="{{$provider->website}}" required>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-xs-12">
                                <label for="type">
                                    <h5>Type</h5>
                                </label>

                                <select type="text" class="form-control form-control-lg" name="type" id="type" required>
                                    <option value="">Choose a Provider</option>
                                    <option value="MORTGAGE" @if($provider->type == "MORTGAGE") selected @endif>MORTGAGE
                                    </option>
                                    <option value="INSURANCE" @if($provider->type == "INSURANCE")selected @endif
                                        >INSURANCE</option>
                                    <option value="INTERNET" @if($provider->type == "INTERNET")selected @endif>INTERNET
                                    </option>
                                    <option value="WATER" @if($provider->type == "WATER")selected @endif>WATER</option>
                                    <option value="TELEVISION" @if($provider->type == "TELEVISION")selected
                                        @endif>TELEVISION</option>
                                    <option value="MORTGAGE INSURANCE" @if($provider->type == "MORTGAGE INSURANCE")selected @endif>MORTGAGE INSURANCE</option>
                                    <option value="PROPERTY TAXES" @if($provider->type == "PROPERTY TAXES")selected @endif>PROPERTY TAXES</option>
                                    <!--<option value="INTERNET">INTERNET</option>-->

                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-xs-12">
                                <label for="description">
                                    <h5>Description</h5>
                                </label>
                                <textarea type="text" class="form-control form-control-lg" type="text" rows="15"
                                    name="description" id="description" required>{{$provider->description}} </textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-xs-12">
                                <label for="rate">
                                    <h5>Rate (If Applies)</h5>
                                </label>
                                <input type="number" class="form-control form-control-lg" name="rate" id="rate"
                                    value="{{$provider->rate}}" placeholder="Rate">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-xs-12">
                                <label for="price">
                                    <h5>Price (If Applies)</h5>
                                </label>
                                <input type="number" class="form-control form-control-lg" name="price" id="price"
                                    value="{{$provider->price}}" placeholder="Price">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-xs-12">
                                <label for="status">
                                    <h5>Set Status</h5>
                                </label>
                                <select type="text" class="form-control form-control-lg" name="status" id="status" required>>
                                    <option value="0" @if($provider->status == 0) selected @endif>Active</option>
                                    <option value="1" @if($provider->status == 1) selected @endif>Inactive</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-xs-12">
                                <label for="premium">
                                    <h5>Set premium</h5>
                                </label>
                                <select type="text" class="form-control form-control-lg" name="premium" id="premium" required>>
                                    <option value="0" @if($provider->is_premium == 0) selected @endif>No</option>
                                    <option value="1" @if($provider->is_premium == 1) selected @endif>Yes</option>
                                </select>
                            </div>
                        </div>



                        <div class="form-group" style='margin-top:20px'>
                            <div class="col-xs-12">
                                <button type="submit">SUBMIT</button>
                            </div>
                        </div>

                    </form>
                </div>
            </div>
        </div> <!-- /#page-wrapper -->

    </div> <!-- /#wrapper -->

</div> <!-- /#container -->
@endsection

@section('page-js')

<script>
    @if(session('success'))
            toastr.success('{{ session('success') }}', '{{ trans('app.success') }}', toastr_options);
        @endif
        @if(session('error'))
            toastr.error('{{ session('error') }}', '{{ trans('app.success') }}', toastr_options);
        @endif
</script>

@endsection