236 lines
14 KiB
PHP
Executable File
236 lines
14 KiB
PHP
Executable File
@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.services.index') }}">@lang('admin.services.title')</a>
|
|
</li>
|
|
<li class="breadcrumb-item active">
|
|
@lang('admin.edit')
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
@push('css')
|
|
<link rel="stylesheet" type="text/css"
|
|
href="{{ asset('/vendor/dashboard/app-assets/vendors/css/forms/select/select2.min.css') }}">
|
|
@endpush
|
|
@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.services.update', $service->id) }}"
|
|
enctype="multipart/form-data" method="post">
|
|
@method('put')
|
|
@csrf
|
|
<div class="card-body">
|
|
<div class="form-body">
|
|
<p>@lang('admin.all_fields_with')</p>
|
|
<div class="row">
|
|
|
|
<div class="col-12">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="form-group">
|
|
<label for="name_uz">@lang('admin.services.name') (uz) *</label>
|
|
<input type="text" id="name_uz" required
|
|
class="form-control @error('name_uz') is-invalid @enderror"
|
|
name="name_uz" value="{{ old('name_uz', $service->name['uz']) }}"
|
|
placeholder="@lang('admin.services.name') (uz)">
|
|
@error('name_uz')
|
|
<div class="invalid-feedback">
|
|
{{ $message }}
|
|
</div>
|
|
@enderror
|
|
</div>
|
|
</div>
|
|
<div class="col-12">
|
|
<div class="form-group">
|
|
<label for="name_ru">@lang('admin.services.name') (ru) *</label>
|
|
<input type="text" id="name_ru" required
|
|
class="form-control @error('name_ru') is-invalid @enderror"
|
|
name="name_ru" value="{{ old('name_ru', $service->name['ru']) }}"
|
|
placeholder="@lang('admin.services.name') (ru)">
|
|
@error('name_ru')
|
|
<div class="invalid-feedback">
|
|
{{ $message }}
|
|
</div>
|
|
@enderror
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-12">
|
|
<div class="form-group">
|
|
<label for="image">@lang('admin.services.image') @if (is_file($service->image))
|
|
<a href="/{{ $service->image }}" target="_blank">@lang('admin.see')</a>
|
|
@endif
|
|
</label>
|
|
<input type="file" id="image"
|
|
class="form-control @error('image') is-invalid @enderror" name="image"
|
|
value="{{ old('image') }}" placeholder="@lang('admin.services.image')">
|
|
@error('image')
|
|
<div class="invalid-feedback">
|
|
{{ $message }}
|
|
</div>
|
|
@enderror
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-12">
|
|
<label>@lang('admin.partners.status') *</label>
|
|
<fieldset class="form-group">
|
|
<select class="select2 form-control" name="status" required>
|
|
<option @selected($service->status == 'new') value="new">@lang('admin.partners.status_new')
|
|
</option>
|
|
<option @selected($service->status == 'published') value="published">@lang('admin.partners.status_published')
|
|
</option>
|
|
<option @selected($service->status == 'soon') value="soon">@lang('admin.partners.status_soon')
|
|
</option>
|
|
</select>
|
|
</fieldset>
|
|
</div>
|
|
|
|
<div class="col-12">
|
|
<div class="form-group">
|
|
<label for="position">@lang('admin.slider.position')</label>
|
|
<input type="number" id="position"
|
|
class="form-control @error('position') is-invalid @enderror" name="position"
|
|
value="{{ old('position', $service->position) }}"
|
|
placeholder="@lang('admin.slider.position')">
|
|
@error('position')
|
|
<div class="invalid-feedback">
|
|
{{ $message }}
|
|
</div>
|
|
@enderror
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-12">
|
|
<div class="form-group">
|
|
<fieldset class="checkbox">
|
|
<div class="vs-checkbox-con vs-checkbox-primary">
|
|
<input type="checkbox" @checked($service->is_power == 1) value="1"
|
|
name="is_power">
|
|
<span class="vs-checkbox">
|
|
<span class="vs-checkbox--check">
|
|
<i class="vs-icon feather icon-check"></i>
|
|
</span>
|
|
</span>
|
|
|
|
<span class="">
|
|
@lang('admin.services.with_power')
|
|
</span>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-12">
|
|
<div class="form-group">
|
|
<fieldset class="checkbox">
|
|
<div class="vs-checkbox-con vs-checkbox-primary">
|
|
<input type="checkbox" @checked($service->with_problem == 1) old('with_problem')
|
|
value="1" name="with_problem" id="with_problem_checkbox">
|
|
<span class="vs-checkbox">
|
|
<span class="vs-checkbox--check">
|
|
<i class="vs-icon feather icon-check"></i>
|
|
</span>
|
|
</span>
|
|
<span>
|
|
@lang('admin.services.with_problem')
|
|
</span>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-12" id="problem_block" style="display: none;">
|
|
<label>@lang('admin.problems.problems') *</label>
|
|
<fieldset class="form-group">
|
|
<select multiple class="select2 form-control" name="problems[]">
|
|
<option disabled>@lang('admin.problems.choose')</option>
|
|
@foreach ($problems as $problem)
|
|
<option value="{{ $problem->id }}"
|
|
{{ in_array($problem->id, old('problems', $service->problems->pluck('id')->toArray())) ? 'selected' : '' }}>
|
|
{{ $problem->getTitle() }}
|
|
</option>
|
|
@endforeach
|
|
</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.services.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>
|
|
</div>
|
|
@endsection
|
|
|
|
@push('js')
|
|
<script src="{{ asset('/vendor/dashboard/app-assets/vendors/js/forms/select/select2.full.min.js') }}"></script>
|
|
<script src="{{ asset('/vendor/dashboard/app-assets/js/scripts/forms/select/form-select2.js') }}"></script>
|
|
|
|
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
// Listen for changes on the checkbox
|
|
$('#with_problem_checkbox').on('change', function() {
|
|
if ($(this).is(':checked')) {
|
|
$('#problem_block').show(); // Show the block when checked
|
|
} else {
|
|
$('#problem_block').hide(); // Hide the block when unchecked
|
|
}
|
|
});
|
|
|
|
// init problem_block
|
|
if ($('#with_problem_checkbox').is(':checked')) {
|
|
$('#problem_block').show(); // Show the block when checked
|
|
} else {
|
|
$('#problem_block').hide(); // Hide the block when unchecked
|
|
}
|
|
});
|
|
</script>
|
|
@endpush
|