@extends('dashboard.layouts.app')
@section('title', trans('admin.edit') . ' - ')
@section('speedbar')
    <div class="content-header row">
        <div class="content-header-left col-md-9 col-12 mb-2">
            <div class="row breadcrumbs-top">
                <div class="col-12">
                    <h2 class="content-header-title float-left mb-0">@lang('admin.edit')</h2>
                    <div class="breadcrumb-wrapper col-12">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item ">
                                <a href="{{ route('dashboard') }}">@lang('admin.home')</a>
                            </li>
                            <li class="breadcrumb-item ">
                                <a href="{{ route('dashboard.contract-templates.index') }}">@lang('admin.contract-templates.title')</a>
                            </li>
                            <li class="breadcrumb-item active">
                                @lang('admin.edit')
                            </li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection

@section('content')
    <div class="row">
        <div class="col-md-12 col-12">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title">@lang('admin.edit')</h4>
                </div>
                <div class="card-content">
                    <form class="form form-vertical"
                        action="{{ route('dashboard.contract-templates.update', $template->id) }}" method="post"
                        enctype="multipart/form-data">
                        @method('PUT')
                        @csrf
                        <div class="card-body">
                            <div class="form-body">
                                <div class="row">
                                    <div class="col-12">
                                        <div class="form-group">
                                            <label for="file">@lang('admin.contract-templates.file')</label>
                                            <input type="file" id="file"
                                                class="form-control @error('file') is-invalid @enderror" name="file"
                                                placeholder="@lang('admin.contract-templates.file')" accept=".doc,.docx">
                                            @error('file')
                                                <div class="invalid-feedback">
                                                    {{ $message }}
                                                </div>
                                            @enderror
                                        </div>
                                    </div>
                                </div>

                                <div class="row">
                                    <div class="col-6">
                                        <label>@lang('admin.contract-templates.lang') *</label>
                                        <fieldset class="form-group">
                                            <select class="select2 form-control" name="lang">
                                                <option @selected($template->lang == 'uz') value="uz">Uz</option>
                                                <option @selected($template->lang == 'ru') value="ru">Ru</option>
                                            </select>
                                        </fieldset>
                                    </div>
                                    <div class="col-6">
                                        <label>@lang('admin.contract-templates.company') *</label>
                                        <fieldset class="form-group">
                                            <select class="select2 form-control" name="company">
                                                <option @selected($template->company == 'getgreen') value="getgreen">getgreen</option>
                                                <option @selected($template->company == 'sunhightech') value="sunhightech">sunhightech</option>
                                            </select>
                                        </fieldset>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-12">
                                        <label>@lang('admin.contract-templates.type') *</label>
                                        <fieldset class="form-group">
                                            <select class="select2 form-control" name="type">
                                                <option @selected($template->type == 'physical') value="physical">@lang('admin.contract-templates.physical')
                                                </option>
                                                <option @selected($template->type == 'legal') value="legal">@lang('admin.contract-templates.legal')
                                                </option>
                                            </select>
                                        </fieldset>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="card-footer pb-0 pl-0 pt-1">
                            <div class="col-12 mb-0">
                                <div class="row">
                                    <div class="col-3">
                                        <button type="submit"
                                            class="btn btn-primary mr-1 mb-1 waves-effect waves-light btn-icon">
                                            <i class="feather icon-save"></i> @lang('admin.save')
                                        </button>
                                    </div>

                                    <div class="col-9">
                                        <a href="{{ route('dashboard.contract-templates.index') }}"
                                            class="btn btn-danger mr-1 mb-1 waves-effect waves-light btn-icon pull-right">
                                            <i class="feather icon-x-circle"></i> @lang('admin.cancel')
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    @endsection
