@extends('back-end.master.app')
@section('title', 'New Info')

@section('body')
    <main class="app-content">
        <div class="card">
            <div class="card-body">
                <div class="row">
                    <div class="col-md-9">
                        <h5>Website Info</h5>
                    </div>
                    <div class="col-md-3">
                        <a href="{{ route('info.index') }}" style="float: right;"
                            class="btn btn-primary btn-sm btn-rounded">List</a>
                    </div>
                </div>
                <div class="row mt-5">
                    <form method="POST" action="{{ route('info.update', $info->id) }}" enctype="multipart/form-data">
                        @method('PUT')
                        @csrf
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-outline">
                                    <input type="test" id="title" name="website_title" required
                                        value="{{ old('title') ?? $info->website_title }}" class="form-control" />
                                    <label class="form-label" for="title">title</label>
                                </div>
                            </div>
                            <div class="col-md-3">
                                <select id="language_id" type="text"
                                    class="form-control select2 @error('language_id') is-invalid @enderror" required
                                    name="language_id">
                                    <option value="">Choose Language</option>
                                    @foreach ($languages as $row)
                                        <option value="{{ $row->id }}"
                                            @if ($row->id == $info->language_id) {{ 'selected' }} @endif>
                                            {{ $row->title_en }}</option>
                                    @endforeach
                                </select>
                                @error('cat_id')
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                                @enderror
                            </div>
                            <div class="col-md-4 mt-3">
                                <div class="form-outline">
                                    <input type="test" id="phone1" name="phone1" required
                                        value="{{ old('phone1') ?? $info->phone1 }}" class="form-control" />
                                    <label class="form-label" for="phone1">First Phone</label>
                                </div>
                            </div>
                            <div class="col-md-4 mt-3">
                                <div class="form-outline">
                                    <input type="test" id="phone2" name="phone2" required
                                        value="{{ old('phone2') ?? $info->phone2 }}" class="form-control" />
                                    <label class="form-label" for="phone1">Second Phone</label>
                                </div>
                            </div>
                            <div class="col-md-4 mt-3">
                                <div class="form-outline">
                                    <input type="email" id="email" name="email" required
                                        value="{{ old('email') ?? $info->email }}" class="form-control" />
                                    <label class="form-label" for="email">Email</label>
                                </div>
                            </div>
                            <div class="col-md-4 mt-3">
                                <div class="form-outline">
                                    <input type="text" id="facebook_url" name="facebook_url" required
                                        value="{{ old('facebook_url') ?? $info->facebook_url }}" class="form-control" />
                                    <label class="form-label" for="facebook_url">facebook_url</label>
                                </div>
                            </div>
                            <div class="col-md-4 mt-3">
                                <div class="form-outline">
                                    <input type="text" id="twitter_url" name="twitter_url" required
                                        value="{{ old('twitter_url') ?? $info->twitter_url }}" class="form-control" />
                                    <label class="form-label" for="twitter_url">twitter_url</label>
                                </div>
                            </div>
                            <div class="col-md-4 mt-3">
                                <div class="form-outline">
                                    <input type="text" id="youtube_url" name="youtube_url" required
                                        value="{{ old('youtube_url') ?? $info->youtube_url }}" class="form-control" />
                                    <label class="form-label" for="youtube_url">youtube_url</label>
                                </div>
                            </div>
                            <div class="col-md-4 mt-3">
                                <div class="form-outline">
                                    <input type="text" id="instegram_url" name="instegram_url" required
                                        value="{{ old('instegram_url') ?? $info->instegram_url }}" class="form-control" />
                                    <label class="form-label" for="instegram_url"> instegram_url</label>
                                </div>
                            </div>
                            <div class="col-md-4 mt-3">
                                <div class="form-outline">
                                    <input type="text" id="tiktok_url" name="tiktok_url" required
                                        value="{{ old('tiktok_url') ?? $info->tiktok_url }}" class="form-control" />
                                    <label class="form-label" for="tiktok_url">tiktok_url</label>
                                </div>
                            </div>
                            <div class="col-md-4 mt-3">
                                <div class="form-outline">
                                    <input type="text" id="lingding_url" name="lingding_url" required
                                        value="{{ old('lingding_url') ?? $info->lingding_url }}" class="form-control" />
                                    <label class="form-label" for="lingding_url">lingding_url</label>
                                </div>
                            </div>
                            <div class="col-md-4 mt-3">
                                <div class="form-outline">
                                    <input type="text" id="whats_app" name="whats_app" required
                                        value="{{ old('whats_app') ?? $info->whats_app }}" class="form-control" />
                                    <label class="form-label" for="whats_app">whats_app_number</label>
                                </div>
                            </div>
                            <div class="col-md-4 mt-3">
                                <div class="form-outline">
                                    <input type="text" id="address" name="address" required
                                        value="{{ old('address') ?? $info->local_address }}" class="form-control" />
                                    <label class="form-label" for="address">address</label>
                                </div>
                            </div>
                            <div class="col-md-4 mt-3">
                                <div class="form-outline">
                                    <input type="file" id="image" name="image" 
                                        value="{{ old('image') }}" class="form-control" />
                                    <label class="form-label" for="image">Logo</label>
                                </div>
                            </div>
                            <div class="col-md-12 mt-3">
                                <div class="form-outline">
                                    <textarea cols="30" rows="3" id="about" name="about" required value=""
                                        class="form-control">{{ old('about') ?? $info->about }}</textarea>
                                    <label class="form-label" for="about">About</label>
                                </div>
                            </div>
                            <div class="col-md-12 mt-3">
                                <div class="form-outline">
                                    <textarea cols="30" rows="3" id="mission" name="mission" required value=""
                                        class="form-control">{{ old('mission') ?? $info->mission }}</textarea>
                                    <label class="form-label" for="mission">mission</label>
                                </div>
                            </div>
                            <div class="col-md-12 mt-3">
                                <div class="form-outline">
                                    <textarea cols="30" rows="3" id="vission" name="vission" required value=""
                                        class="form-control">{{ old('vission') ?? $info->vission }}</textarea>
                                    <label class="form-label" for="vission">vission</label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group row mt-3">
                            <div class="col-md-6 ">
                                <button type="submit" class="btn btn-primary">
                                    {{ __('Save') }}
                                </button>
                            </div>
                    </form>
                </div>
            </div>
        </div>
    </main>

@endsection


@section('pageJs')
    <script type="text/javascript">
        $(".app-menu").removeClass("active");
        $("#nav_setting").addClass("active");
        $("#nav_settingi").addClass("is-expanded");
        $("#nav_sub_info").addClass("active");
        <?php
if (session()->has("msg")) {
    ?>

        $.notify({
            title: "Notice: ",
            message: "<?= session()->get('msg') ?>",
            icon: "fa fa-check"
        }, {
            type: "success"
        });
        <?php
}
?>
    </script>
@endsection
