{{ Form::open(['route' => 'DueDiligence.Admin.CountryParam.store', 'id' => 'country_param-form', 'autocomplete' => 'off', 'files' => true]) }}

	<input type="hidden" name="id" value="{{ $country_param['id'] ?? null }}">
	<input type="hidden" name="distributor_id" value="{{ $country_param['distributor_id'] ?? null }}">

	<div class="row">
		<div class="col-8">

			<div class="row mb-3">
				<div class="col-md-4">
					{{ Form::label('name', __('date')) }}<br/>
					@include('components.form.datepicker', ['name' => 'date', 'value' => $country_param['date'] ?? null])
				</div>
				<div class="col-md-2">
					{{ Form::label('name', __('ope_rrai')) }}<br/>
					@include('components.form.input', ['name' => 'rrai', 'value' => $country_param['rrai'] ?? null])
				</div>
				<div class="col-md-3">
					{{ Form::label('name', __('color')) }}<br/>
					@include('components.form.select', ['name' => 'index', 'list' => App\Repositories\DueDiligence\CountryParams::getRiskColors(), 'value' => $country_param['index'] ?? null, 'with_empty' => ''])
				</div>
				<div class="col-md-3">
					{{ Form::label('name', __('broken_arrows')) }}<br/>
					@include('components.form.input', ['name' => 'broken', 'value' => $country_param['broken'] ?? null])
				</div>
			</div>

			<div class="row mb-3">
				<div class="col-12">
					{{ Form::label('name', __('comments')) }}<br/>
					@include('components.form.editor', ['name' => 'comments', 'value' => $country_param['comments'] ?? null])
				</div>
			</div>

		</div>
		<div class="col-4">
			@include('components.widgets.pdfPreview',['container' => 'country_param-file'])

			{{ Form::label('name', __('file')) }}<br/>
			@include('components.file', ['name' => 'file', 'value' => $country_param['file'] ?? null])
		</div>
	</div>
	
</form>

<script>
		
	$(function() {
		initSelect2();
		var id = {{ $country_param['id'] ?? 'false' }};
		var distributor_id = {{ $country_param['distributor_id'] ?? 'false' }};

		var path = '/DueDiligence/Admin/CountryParam';
		@if (isset($country_param['file']))			
			var file = path + '/getDocument/' + distributor_id + '/' + encodeURIComponent("{{ $country_param['file'] }}");
			PDFObject.embed(file, "#country_param-file-preview");
			$('#country_param-file').removeClass('d-none');
		@endif

		$('.file').fileinput({
			showCaption: false,
			dropZoneEnabled: false,
			showUpload: false,
		});

		$('.datepicker').datetimepicker({
			format: 'L',
			@if (!isset($country_param['date']))
			date: new Date()
			@endif

		});

		$('.editor').tinymce({});
	});
</script>
