@extends('admin.layouts.container')

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

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

            <div class="form-group col-lg-6">
                <label>{{ meta('code', getCurrentLocale()) ?? __('cobons.code')}}</label>
                <input type="text"  class="form-control  {{ $errors->has('code') ? 'is-invalid' : '' }}" name="code" placeholder="{{ meta('code', getCurrentLocale()) ?? __('cobons.code') }}" value='{{ old("code", $cobon->code ?? "") }}'/>
            </div>
            <div class="form-group col-lg-6">
                <label>{{ __('cobons.discount_type') }} </label>
                <select id="discount_type" class="form-control {{ $errors->has('discount_type') ? 'is-invalid' : '' }}" name="discount_type">
                    <option {{ (isset($cobon) ? $cobon->discount_type : null) == 'value' ? 'selected' : '' }} value="value">{{__('cobons.value')}}</option>
                    <option {{ (isset($cobon) ? $cobon->discount_type : null) == 'percentage' ? 'selected' : '' }} value="percentage">{{__('cobons.percentage')}}</option>
                </select>
            </div>

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

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

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

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

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


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

@endsection

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



