classify admin
This commit is contained in:
57
resources/views/category/categories-order.blade.php
Normal file
57
resources/views/category/categories-order.blade.php
Normal file
@@ -0,0 +1,57 @@
|
||||
|
||||
@extends('layouts.main')
|
||||
@section('title')
|
||||
{{__("Change Categories Order")}}
|
||||
@endsection
|
||||
|
||||
@section('page-title')
|
||||
<div class="page-title">
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6 order-md-1 order-last">
|
||||
<h4>@yield('title')</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<section class="section">
|
||||
<div class="buttons">
|
||||
<a class="btn btn-primary" href="{{ route('category.index') }}">< {{__("Back to All Categories")}} </a>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12 grid-margin stretch-card">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form class="pt-3" id="update-team-member-rank-form" action="{{ route('category.order.change')}}" novalidate="novalidate">
|
||||
<ul class="sortable row col-12 d-flex justify-content-center">
|
||||
<div class="row bg-light pt-2 rounded mb-2 col-12 d-flex justify-content-center">
|
||||
@foreach( $categories as $row)
|
||||
<li id="{{$row->id}}" class="ui-state-default draggable col-md-12 col-lg-5 mr-2 col-xl-3" style="cursor:grab">
|
||||
<div class="bg-light pt-2 rounded mb-2 col-12 d-flex justify-content-center">
|
||||
<div class="row">
|
||||
<div class="col-6" style="padding-left: 15px; padding-right:5px;">
|
||||
<img src="{{$row->image}}" alt="image" class="order-change"/>
|
||||
</div>
|
||||
<div class="col-6 d-flex flex-column justify-content-center align-items-center" style="padding-left: 5px; padding-right:5px;">
|
||||
<strong> {{$row->name}} </strong>
|
||||
<div>
|
||||
<span style="font-size: 12px;">{{$row->designation}} </span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@endforeach
|
||||
</div>
|
||||
</ul>
|
||||
<input class="btn btn-primary" type="submit" value="{{ __("Update")}}"/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
|
||||
|
||||
156
resources/views/category/create.blade.php
Normal file
156
resources/views/category/create.blade.php
Normal file
@@ -0,0 +1,156 @@
|
||||
@extends('layouts.main')
|
||||
@section('title')
|
||||
{{__("Create Categories")}}
|
||||
@endsection
|
||||
|
||||
@section('page-title')
|
||||
<div class="page-title">
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6 order-md-1 order-last">
|
||||
<h4>@yield('title')</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<section class="section">
|
||||
<div class="buttons">
|
||||
<a class="btn btn-primary" href="{{ route('category.index') }}">< {{__("Back to All Categories")}} </a>
|
||||
</div>
|
||||
<div class="row">
|
||||
<form action="{{ route('category.store') }}" method="POST" data-parsley-validate enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header">{{__("Add Category")}}</div>
|
||||
|
||||
<div class="card-body mt-2">
|
||||
<ul class="nav nav-tabs" id="langTabs" role="tablist">
|
||||
@foreach($languages as $key => $lang)
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link @if($key == 0) active @endif" id="tab-{{ $lang->id }}" data-bs-toggle="tab" data-bs-target="#lang-{{ $lang->id }}" type="button" role="tab">
|
||||
{{ $lang->name }}
|
||||
</button>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
|
||||
<div class="tab-content mt-3">
|
||||
@foreach($languages as $key => $lang)
|
||||
<div class="tab-pane fade @if($key == 0) show active @endif" id="lang-{{ $lang->id }}" role="tabpanel">
|
||||
<input type="hidden" name="languages[]" value="{{ $lang->id }}">
|
||||
|
||||
<div class="form-group">
|
||||
<label>{{ __('Name') }} ({{ $lang->name }})</label>
|
||||
<input type="text"
|
||||
name="name[{{ $lang->id }}]"
|
||||
class="form-control"
|
||||
value=""
|
||||
data-parsley-maxlength="30"
|
||||
maxlength="30"
|
||||
data-parsley-maxlength-message="{{ __('Name cannot exceed 30 characters.') }}"
|
||||
@if($lang->id == 1) data-parsley-required="true" @endif>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>{{ __('Description') }} ({{ $lang->name }})</label>
|
||||
<textarea name="description[{{ $lang->id }}]" class="form-control" cols="10" rows="5"></textarea>
|
||||
</div>
|
||||
|
||||
@if($lang->id == 1)
|
||||
<div class="row mt-3">
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-12 form-group mandatory">
|
||||
<label for="category_slug" class="form-label">{{ __('Slug') }} <small>{{__('(English Only)')}}</small></label>
|
||||
<input type="text" name="slug" id="category_slug" class="form-control" data-parsley-pattern="^[a-zA-Z0-9\-_]+$"
|
||||
data-parsley-pattern-message="{{ __('Slug must be only English letters, numbers, hyphens (-) or underscores (_).') }}" placeholder="auto-generated if blank">
|
||||
<label>
|
||||
<small class="text-danger">{{ __('Note: Slug must be in English letters, numbers, hyphens (-) or underscores (_). No spaces or special characters.') }}</small>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-12 form-group">
|
||||
<label for="p_category" class="form-label">{{ __('Parent Category') }}</label>
|
||||
<select name="parent_category_id" id="p_category" class="form-select form-control select2" data-placeholder="{{__('Select Category')}}">
|
||||
<option value="">{{__('Select a Category')}}</option>
|
||||
@include('category.dropdowntree', ['categories' => $categories])
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-12 form-group mandatory">
|
||||
<label for="Field Name" class="mandatory form-label">{{ __('Image') }}</label>
|
||||
<input type="file" name="image" id="image" class="form-control" data-parsley-required="true" accept=".jpg,.jpeg,.png">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="row mt-3">
|
||||
<div class="col-md-4">
|
||||
<div class="form-check form-switch">
|
||||
<input type="hidden" name="status" id="status" value="0">
|
||||
<input class="form-check-input status-switch" type="checkbox" role="switch" id="statusSwitch">
|
||||
<label class="form-check-label" for="statusSwitch">{{ __('Active') }}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-check form-switch">
|
||||
<input type="hidden" name="is_job_category" id="is_job_category" value="0">
|
||||
<input class="form-check-input status-switch" type="checkbox" role="switch" id="jobCategorySwitch">
|
||||
<label class="form-check-label" for="jobCategorySwitch">{{ __('Job Category') }}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-check form-switch">
|
||||
<input type="hidden" name="price_optional" id="price_optional" value="0">
|
||||
<input class="form-check-input status-switch" type="checkbox" role="switch" id="priceOptionalSwitch">
|
||||
<label class="form-check-label" for="priceOptionalSwitch">{{ __('Price Optional') }}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 text-end">
|
||||
<input type="submit" class="btn btn-primary" value="{{__("Save and Back")}}">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const form = document.querySelector('form[data-parsley-validate]');
|
||||
if (!form) return;
|
||||
|
||||
const submitBtn = form.querySelector('input[type="submit"], button[type="submit"]');
|
||||
form.addEventListener('submit', function(e) {
|
||||
// Use Parsley to check validity if initialized
|
||||
if (typeof $(form).parsley === 'function') {
|
||||
if (!$(form).parsley().isValid()) {
|
||||
// If invalid, do NOT disable the button, allow user to correct form
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Disable submit button on valid submission
|
||||
if (submitBtn) {
|
||||
submitBtn.disabled = true;
|
||||
submitBtn.value = '{{ __("Saving...") }}';
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
54
resources/views/category/custom-fields.blade.php
Normal file
54
resources/views/category/custom-fields.blade.php
Normal file
@@ -0,0 +1,54 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@section('title')
|
||||
{{__("Custom Fields")}} / {{__("Sub Category")}}
|
||||
@endsection
|
||||
|
||||
@section('page-title')
|
||||
<div class="page-title">
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6 order-md-1 order-last">
|
||||
<h4>@yield('title')</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<section class="section">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<div class="buttons text-start">
|
||||
<a href="{{ route('category.index', $p_id) }}" class="btn btn-primary">< {{__("Back To Category")}} </a>
|
||||
<a href="{{ route('custom-fields.create', ['id' => $cat_id]) }}" class="btn btn-primary">+ {{__("Create Custom Field")}} / {{ $category_name }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 col-sm-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<table class="table table-borderless table-striped" aria-describedby="mydesc" id="table_list"
|
||||
data-toggle="table" data-url="{{ route('category.custom-fields.show', $cat_id) }}"
|
||||
data-click-to-select="true" data-side-pagination="server" data-pagination="true"
|
||||
data-page-list="[5, 10, 20, 50, 100, 200]" data-search="true" data-search-align="right"
|
||||
data-escape="true"
|
||||
data-toolbar="#toolbar" data-show-columns="true" data-show-refresh="true" data-fixed-columns="true"
|
||||
data-fixed-number="1" data-fixed-right-number="1" data-trim-on-search="false" data-responsive="true"
|
||||
data-sort-name="id" data-sort-order="desc" data-pagination-successively-size="3"
|
||||
data-query-params="queryParams" data-mobile-responsive="true">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th scope="col" data-field="state" data-checkbox="true"></th>
|
||||
<th scope="col" data-field="id" data-align="center" data-sortable="true">{{ __('ID') }}</th>
|
||||
<th scope="col" data-field="image" data-align="center" data-formatter='imageFormatter'>{{ __('Image') }}</th>
|
||||
<th scope="col" data-field="name" data-align="center" data-sortable="true">{{ __('Custom Field') }}</th>
|
||||
<th scope="col" data-field="operate" data-escape="false" data-sortable="false">{{ __('Action') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
3
resources/views/category/dropdowntree.blade.php
Normal file
3
resources/views/category/dropdowntree.blade.php
Normal file
@@ -0,0 +1,3 @@
|
||||
@foreach ($categories as $category)
|
||||
{!! \App\Services\HelperService::childCategoryRendering($categories,0,$category->parent_category_id) !!}
|
||||
@endforeach
|
||||
159
resources/views/category/edit.blade.php
Normal file
159
resources/views/category/edit.blade.php
Normal file
@@ -0,0 +1,159 @@
|
||||
@extends('layouts.main')
|
||||
@section('title')
|
||||
{{__("Edit Categories")}}
|
||||
@endsection
|
||||
|
||||
@section('page-title')
|
||||
<div class="page-title">
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6 order-md-1 order-last">
|
||||
<h4>@yield('title')</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<section class="section">
|
||||
<div class="buttons">
|
||||
<a class="btn btn-primary" href="{{ route('category.index') }}">< {{__("Back to All Categories")}} </a>
|
||||
</div>
|
||||
<div class="row">
|
||||
<form action="{{ route('category.update', $category_data->id) }}" method="POST" data-parsley-validate enctype="multipart/form-data">
|
||||
@method('PUT')
|
||||
@csrf
|
||||
<input type="hidden" name="edit_data" value={{ $category_data->id }}>
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header">{{__("Edit Categories")}}</div>
|
||||
<div class="card-body mt-2">
|
||||
<ul class="nav nav-tabs" id="langTabs" role="tablist">
|
||||
@foreach($languages as $key => $lang)
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link @if($key == 0) active @endif" id="tab-{{ $lang->id }}" data-bs-toggle="tab" data-bs-target="#lang-{{ $lang->id }}" type="button" role="tab">
|
||||
{{ $lang->name }}
|
||||
</button>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
|
||||
<div class="tab-content mt-3">
|
||||
@foreach($languages as $key => $lang)
|
||||
<div class="tab-pane fade @if($key == 0) show active @endif" id="lang-{{ $lang->id }}" role="tabpanel">
|
||||
<input type="hidden" name="languages[]" value="{{ $lang->id }}">
|
||||
|
||||
<div class="form-group">
|
||||
<label>{{ __('Name') }} ({{ $lang->name }})</label>
|
||||
<input type="text"
|
||||
name="name[{{ $lang->id }}]"
|
||||
class="form-control"
|
||||
value="{{ $translations[$lang->id]['name'] ?? '' }}"
|
||||
data-parsley-maxlength="30"
|
||||
maxlength="30"
|
||||
data-parsley-maxlength-message="{{ __('Name cannot exceed 30 characters.') }}"
|
||||
@if($lang->id == 1) data-parsley-required="true" @endif>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>{{ __('Description') }} ({{ $lang->name }})</label>
|
||||
<textarea name="description[{{ $lang->id }}]" class="form-control" cols="10" rows="5">{{ $translations[$lang->id]['description'] ?? '' }}</textarea>
|
||||
</div>
|
||||
|
||||
@if($lang->id == 1)
|
||||
<div class="row mt-3">
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-12 form-group mandatory">
|
||||
<label for="category_slug" class="form-label">{{ __('Slug') }} <small>{{__('(English Only)')}}</small></label>
|
||||
<input type="text" name="slug" id="category_slug" class="form-control" data-parsley-pattern="^[a-zA-Z0-9\-_]+$"
|
||||
data-parsley-pattern-message="{{ __('Slug must be only English letters, numbers, hyphens (-) or underscores (_).') }}" value="{{ $category_data->slug }}">
|
||||
<label>
|
||||
<small class="text-danger">{{ __('Note: Slug must be in English letters, numbers, hyphens (-) or underscores (_). No spaces or special characters.') }}</small>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-12 form-group mandatory">
|
||||
<label for="p_category" class="mandatory form-label">{{ __('Parent Category') }}</label>
|
||||
<select name="parent_category_id" class="form-select form-control select2" id="p_category" data-placeholder="{{ __('Select Category') }}">
|
||||
@if(isset($parent_category_data) && $parent_category_data->id)
|
||||
<option value="{{ $parent_category_data->id }}" id="default_opt" selected>
|
||||
{{ $parent_category == '' ? 'Root' : $parent_category }}
|
||||
</option>
|
||||
@else
|
||||
<option value="">{{ __('Select Category') }}</option>
|
||||
@endif
|
||||
@include('category.dropdowntree', ['categories' => $categories])
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-12 form-group mandatory">
|
||||
<label for="Field Name" class="mandatory form-label">{{ __('Image') }}</label>
|
||||
<div class="cs_field_img">
|
||||
<input type="file" name="image" class="image" style="display: none" accept=" .jpg, .jpeg, .png, .svg">
|
||||
<img src="{{ empty($category_data->image) ? asset('assets/img_placeholder.jpeg') : $category_data->image }}" alt="" class="img preview-image" id="">
|
||||
<div class='img_input'>{{__("Browse File")}}</div>
|
||||
</div>
|
||||
<div class="input_hint"> {{__("Icon (use 256 x 256 size for better view)")}}</div>
|
||||
<div class="img_error" style="color:#DC3545;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="row mt-3">
|
||||
<div class="col-md-4">
|
||||
<div class="form-check form-switch">
|
||||
<input type="hidden" name="status" id="status" value="{{ $category_data->status }}">
|
||||
<input class="form-check-input status-switch" type="checkbox" role="switch" aria-label="status" {{ $category_data->status == 1 ? 'checked' : '' }}>
|
||||
<label class="form-check-label" for="status">{{ __('Active') }}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-check form-switch">
|
||||
<input type="hidden" name="is_job_category" value="0">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
role="switch"
|
||||
name="is_job_category"
|
||||
id="job_category_switch"
|
||||
value="1"
|
||||
{{ $category_data->is_job_category == 1 ? 'checked' : '' }}
|
||||
>
|
||||
<label class="form-check-label" for="job_category_switch">{{ __('Job Category') }}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-check form-switch">
|
||||
<input type="hidden" name="price_optional" value="0">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
role="switch"
|
||||
name="price_optional"
|
||||
id="price_optional_switch"
|
||||
value="1"
|
||||
{{ $category_data->price_optional == 1 ? 'checked' : '' }}
|
||||
>
|
||||
<label class="form-check-label" for="price_optional_switch">{{ __('Price Optional') }}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 text-end">
|
||||
<input type="submit" class="btn btn-primary" value="{{__("Save and Back")}}">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
73
resources/views/category/index.blade.php
Normal file
73
resources/views/category/index.blade.php
Normal file
@@ -0,0 +1,73 @@
|
||||
@extends('layouts.main')
|
||||
@section('title')
|
||||
{{__("Categories")}}
|
||||
@endsection
|
||||
|
||||
@section('page-title')
|
||||
<div class="page-title">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-12 col-md-6">
|
||||
<h4 class="mb-0">@yield('title')</h4>
|
||||
</div>
|
||||
<div class="col-12 col-md-6 d-flex justify-content-end">
|
||||
@if (!empty($category))
|
||||
<a class="btn btn-primary me-2" href="{{ route('category.index') }}">< {{__("Back to All Categories")}} </a>
|
||||
@can('category-create')
|
||||
<a class="btn btn-primary me-2" href="{{ route('category.create', ['id' => $category->id]) }}">+ {{__("Add Subcategory")}} - /{{ $category->name }} </a>
|
||||
@endcanany
|
||||
@else
|
||||
@can('category-create')
|
||||
<a class="btn btn-primary" href="{{ route('category.create') }}">+ {{__("Add Category")}} </a>
|
||||
@endcan
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<section class="section">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="text-right col-md-12">
|
||||
<a href="{{ route('category.order') }}">+ {{__("Set Order of Categories")}} </a>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-borderless table-striped" aria-describedby="mydesc"
|
||||
id="table_list" data-toggle="table" data-url="{{ route('category.show', $category->id ?? 0) }}"
|
||||
data-click-to-select="true" data-side-pagination="server" data-pagination="true"
|
||||
data-page-list="[5, 10, 20, 50, 100, 200,500,2000]" data-search="true" data-search-align="right"
|
||||
data-toolbar="#toolbar" data-show-columns="true" data-show-refresh="true"
|
||||
data-trim-on-search="false" data-responsive="true" data-sort-name="sequence"
|
||||
data-sort-order="asc" data-pagination-successively-size="3" data-query-params="queryParams"
|
||||
data-escape="true"
|
||||
data-table="categories" data-use-row-attr-func="true" data-mobile-responsive="false"
|
||||
data-show-export="true" data-export-options='{"fileName": "category-list","ignoreColumn": ["operate"]}' data-export-types="['pdf','json', 'xml', 'csv', 'txt', 'sql', 'doc', 'excel']">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th scope="col" data-field="id" data-align="center" data-sortable="true">{{ __('ID') }}</th>
|
||||
<th scope="col" data-field="name" data-sortable="true" data-formatter="categoryNameFormatter">{{ __('Name') }}</th>
|
||||
<th scope="col" data-field="image" data-align="center" data-formatter="imageFormatter">{{ __('Image') }}</th>
|
||||
<th scope="col" data-field="subcategories_count" data-align="center" data-sortable="false">{{ __('Subcategories') }}</th>
|
||||
<th scope="col" data-field="custom_fields_count" data-align="center" data-sortable="false">{{ __('Custom Fields') }}</th>
|
||||
<th scope="col" data-field="advertisements_count" data-sortable="true" data-align="center" data-formatter="">{{ __('Advertisement Count') }}</th>
|
||||
@can('category-update')
|
||||
<th scope="col" data-field="status" data-width="5" data-sortable="true" data-formatter="statusSwitchFormatter">{{ __('Active') }}</th>
|
||||
@endcan
|
||||
@canany(['category-update', 'category-delete'])
|
||||
<th scope="col" data-field="operate" data-escape="false" data-sortable="false">{{ __('Action') }}</th>
|
||||
@endcanany
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
57
resources/views/category/sub-categories-order.blade.php
Normal file
57
resources/views/category/sub-categories-order.blade.php
Normal file
@@ -0,0 +1,57 @@
|
||||
|
||||
@extends('layouts.main')
|
||||
@section('title')
|
||||
{{__("Change Categories Order")}}
|
||||
@endsection
|
||||
|
||||
@section('page-title')
|
||||
<div class="page-title">
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6 order-md-1 order-last">
|
||||
<h4>@yield('title')</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<section class="section">
|
||||
<div class="buttons">
|
||||
<a class="btn btn-primary" href="{{ route('category.index') }}">< {{__("Back to All Categories")}} </a>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12 grid-margin stretch-card">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form class="pt-3" id="update-team-member-rank-form" action="{{ route('category.order.change')}}" novalidate="novalidate">
|
||||
<ul class="sortable row col-12 d-flex justify-content-center">
|
||||
<div class="row bg-light pt-2 rounded mb-2 col-12 d-flex justify-content-center">
|
||||
@foreach( $categories as $row)
|
||||
<li id="{{$row->id}}" class="ui-state-default draggable col-md-12 col-lg-5 mr-2 col-xl-3" style="cursor:grab">
|
||||
<div class="bg-light pt-2 rounded mb-2 col-12 d-flex justify-content-center">
|
||||
<div class="row">
|
||||
<div class="col-6" style="padding-left:15px; padding-right:5px;">
|
||||
<img src="{{$row->image}}" alt="image" class="order-change"/>
|
||||
</div>
|
||||
<div class="col-6 d-flex flex-column justify-content-center align-items-center" style="padding-left: 5px; padding-right:5px;">
|
||||
<strong> {{$row->name}} </strong>
|
||||
<div>
|
||||
<span style="font-size: 12px;">{{$row->designation}} </span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@endforeach
|
||||
</div>
|
||||
</ul>
|
||||
<input class="btn btn-primary" type="submit" value="{{ __("Update")}}"/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
|
||||
|
||||
52
resources/views/category/treeview.blade.php
Normal file
52
resources/views/category/treeview.blade.php
Normal file
@@ -0,0 +1,52 @@
|
||||
@foreach ($categories as $category)
|
||||
<div class="category">
|
||||
<div class="category-header">
|
||||
<label>
|
||||
<input type="checkbox"
|
||||
name="selected_categories[]"
|
||||
value="{{ $category->id }}"
|
||||
class="category-checkbox"
|
||||
{{ in_array($category->id, $selected_categories) ? "checked" : "" }}>
|
||||
{{ $category->name }}
|
||||
</label>
|
||||
@if (!empty($category->subcategories))
|
||||
@php
|
||||
// Get current language from Session
|
||||
$currentLang = Session::get('language');
|
||||
// Check RTL: use accessor which returns boolean (rtl != 0)
|
||||
$isRtl = false;
|
||||
if (!empty($currentLang)) {
|
||||
try {
|
||||
// Try to get raw attribute first, fallback to accessor
|
||||
$rtlRaw = method_exists($currentLang, 'getRawOriginal') ? $currentLang->getRawOriginal('rtl') : null;
|
||||
if ($rtlRaw !== null) {
|
||||
$isRtl = ($rtlRaw == 1 || $rtlRaw === true);
|
||||
} else {
|
||||
$isRtl = ($currentLang->rtl == true || $currentLang->rtl === 1);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$isRtl = ($currentLang->rtl == true || $currentLang->rtl === 1);
|
||||
}
|
||||
}
|
||||
$arrowIcon = $isRtl ? '' : ''; // fa-caret-left for RTL, fa-caret-right for LTR
|
||||
@endphp
|
||||
<i style="font-size:24px"
|
||||
class="fas toggle-button {{ in_array($category->id, $selected_all_categories) ? 'open' : '' }}">
|
||||
{!! $arrowIcon !!}
|
||||
</i>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
{{-- ✅ Same open/close logic applies recursively --}}
|
||||
<div class="subcategories"
|
||||
style="display: {{ in_array($category->id, $selected_all_categories) ? 'block' : 'none' }};">
|
||||
@if (!empty($category->subcategories))
|
||||
@include('category.treeview', [
|
||||
'categories' => $category->subcategories,
|
||||
'selected_categories' => $selected_categories,
|
||||
'selected_all_categories' => $selected_all_categories
|
||||
])
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
Reference in New Issue
Block a user