@extends('admin.layouts.container')

@section('content')
<div class="side-title">
    <h3>{{ $head ?? '' }}</h3>
</div>

<div class="border-item">
    <form class="form-row" method="post" action="{{ $action }}" enctype="multipart/form-data">
        @if($member ?? ''  && $member->id)
            @method('PUT')
        @endif
        @CSRF

        
        <div class="form-group col-lg-6">
            <label>{{ meta('username', getCurrentLocale()) ?? __('members.username') }} </label>
            <input type="text" class="form-control {{ $errors->has('username') ? 'is-invalid' : '' }}" name="username" placeholder="{{ meta('username', getCurrentLocale()) ?? __('members.username') }}" value='{{ old("username", $member->username ?? "") }}'/>
        </div>
        
        <div class="form-group col-lg-6">
            <label>{{ meta('full_name', getCurrentLocale()) ?? __('members.full_name') }} </label>
            <input type="text" class="form-control {{ $errors->has('full_name') ? 'is-invalid' : '' }}" name="full_name" placeholder="{{ meta('full_name', getCurrentLocale()) ?? __('members.full_name') }}" value='{{ old("full_name", $member->full_name ?? "") }}'/>
        </div>
        
        <div class="form-group col-lg-6">
            <label>{{ meta('email', getCurrentLocale()) ?? __('members.email') }} </label>
            <input type="email" class="form-control {{ $errors->has('email') ? 'is-invalid' : '' }}" name="email" placeholder="{{ meta('email', getCurrentLocale()) ?? __('members.email') }}" value='{{ old("email", $member->email ?? "") }}'/>
        </div>


        

        <div class="form-group col-lg-6">
            <label>{{ meta('password', getCurrentLocale()) ?? __('members.password') }} </label>
            <input type="password" class="form-control {{ $errors->has('password') ? 'is-invalid' : '' }}" name="password" placeholder="{{ meta('password', getCurrentLocale()) ?? __('members.password') }}" value='{{ old("password", "") }}'/>
        </div>

        

        <div class="form-group col-lg-6">
            <label>{{ meta('phone', getCurrentLocale()) ?? __('members.phone') }} </label>
            <input type="number" class="form-control {{ $errors->has('phone') ? 'is-invalid' : '' }}" name="phone" placeholder="{{ meta('phone', getCurrentLocale()) ?? __('members.phone') }}" value='{{ old("phone", $member->phone ?? "") }}'/>
        </div>


        

        <div class="form-group col-lg-6">
            <label>{{ meta('gender', getCurrentLocale()) ?? __('members.gender') }} </label>
              <select name="gender" class="form-control {{ $errors->has('gender') ? 'is-invalid' : '' }}">
                <option @if(isset($member))@if($member->gender == 'male') selected @endif @endif value="male">{{__('members.male')}}</option>
                <option @if(isset($member))@if($member->gender == 'female') selected @endif @endif value="female">{{__('members.female')}}</option>
            </select>

        </div>
        <div class="form-group col-lg-6">
            <label>{{ meta('img', getCurrentLocale()) ?? __('members.img') }} </label>
            <input type="file" class="form-control {{ $errors->has('img') ? 'is-invalid' : '' }}" name="img"/>
        </div>
        <div class="form-group col-lg-6">
            <label>{{ meta('city', getCurrentLocale()) ?? __('members.city') }} </label>
            <input type="text" class="form-control {{ $errors->has('city') ? 'is-invalid' : '' }}" name="city" placeholder="{{ meta('city', getCurrentLocale()) ?? __('members.city') }}" value='{{ old("city", $member->city ?? "") }}'/>
        </div>        

      <div class="form-group col-lg-6">
            <label>{{ meta('job', getCurrentLocale()) ?? __('members.job') }} </label>
             <input type="text" class="form-control {{ $errors->has('job') ? 'is-invalid' : '' }}" name="job" placeholder="{{ meta('job', getCurrentLocale()) ?? __('members.job') }}" value='{{ old("job", $member->job ?? "") }}'/>
            </div>
            @if(!isset($member))
            <div class="form-group col-lg-12">
            <label>{{ meta('package_id', getCurrentLocale()) ?? __('members.package_id') }} </label>
              <select name="package_id" class="form-control {{ $errors->has('package_id') ? 'is-invalid' : '' }}">
                  @foreach($packages as $row)
                <option value="{{$row->id}}">{{packagename($row->id)}}</option>
                @endforeach
            </select>
</div>
@endif
        



        <div class="text-center mt-5 col-12">
            <button class="butn"><span>{{ __('site.save') }}</span></button>
        </div>
    </form>
</div>

@endsection

@section('inner_js')
    <!-- Editor JS files -->
{{--    <script src="{{ asset('/assets/admin/js/lib/tinymce.min.js') }}"></script>--}}
            <script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
    <script>
        let route_prefix = "{{ url(config('lfm.prefix')) }}",
            url = "{{url('/')}}/",
            imagePath = "{{asset('')}}";
    </script>
    <script src="{{ asset('assets/admin/js/editor.js') }}"></script>
    <script src="{{ asset('assets/admin/js/lfm.js') }}"></script>
@endsection
