@extends('layouts.admin.app')
@section('title', __('trans.admin.add_new'))

@section('content')
    <div class="card mb-4">
        <h5 class="card-header">
            <a href="{{ url('admin/admins') }}" class="btn rounded-pill btn-label-primary">
                <i class="ti me-2 ti-arrow-forward-up"></i> {{ __('trans.admin.title') }}
            </a>
            @yield('title')
        </h5>
        <div class="card-body">
            <form action="{{ route('admins.update', $admin->id) }}" method="post">
                @csrf
                @method('put')

                <div class="row">
                    <div class="col-md-4 mb-3">
                        <label class="form-label">{{ __('trans.admin.name') }} <b class="text-danger">*</b></label>
                        <input type="text" class="form-control" required name="name"
                            value="{{ old('name', $admin->name) }}" placeholder="{{ __('trans.admin.name') }}" />
                    </div>

                    <div class="col-md-4 mb-3">
                        <label class="form-label">{{ __('trans.email') }} <b class="text-danger">*</b></label>
                        <input type="email" class="form-control" required name="email"
                            value="{{ old('email', $admin->email) }}" placeholder="{{ __('trans.email') }}" />
                    </div>


                    <div class="col-md-4 mb-3">
                        <div class="form-password-toggle">
                            <label class="form-label">{{ __('trans.password') }} <b class="text-danger">*</b></label>
                            <div class="input-group input-group-merge">
                                <input type="password" name="password" required class="form-control"
                                    placeholder="&#xb7;&#xb7;&#xb7;&#xb7;&#xb7;" />
                                <span class="input-group-text cursor-pointer" id="basic-default-password">
                                    <i class="ti ti-eye-off"></i>
                                </span>
                            </div>
                        </div>
                    </div>

                    <div class="col-md-4 mb-3">
                        <label>{{ __('trans.admin.img') }} <b class="text-danger">*</b></label>
                        <div class="input-group">
                            <span class="input-group-btn">
                                <a data-input="thumbnail" data-preview="holder" class="UploadFile btn btn-info text-white">
                                    {{ __('trans.choose') }}
                                </a>
                            </span>
                            <input id="thumbnail" dir="ltr" required class="form-control" type="text" name="img"
                                value="{{ old('img', $admin->img) }}" readonly />
                        </div>
                        <div id="holder" style="margin-top:15px;max-height:100px;">
                            @if (!empty(old('img', $admin->img)))
                                <img src="{{ old('img', $admin->img) }}" style="height: 5rem;">
                            @endif
                        </div>
                    </div>

                    <div class="col-md-12">
                        <button class="btn btn-primary btn-create px-5">{{ __('trans.save') }}</button>
                    </div>
                </div> {{-- End Row --}}
            </form>
        </div>
    </div>

@endsection
