@extends('layouts.auth') @section('title') {{__('words.Add Brand')}} @endsection @push('page_style') @endpush @section('content')
@php $brandClass = ($brand == \App\Models\AddNewBrand::FOR_BRAND) ? 'brand' : ($brand == \App\Models\AddNewBrand::FOR_TIRE_BRAND ? 'tireBrand' : 'partBrand'); $brandNameText = (!empty($brand) && $brand == \App\Models\AddNewBrand::FOR_BRAND) ? ' Brand ' :((!empty($brand) && $brand == \App\Models\AddNewBrand::FOR_TIRE_BRAND) ? ' Tire Brand ' :' Part Brand '); @endphp
@csrf

{{__('words.Add'.$brandNameText.'Name')}}

{{-- {{dd(session('brand_name'))}} --}}
0 / 60
0 / 500
@php $world = App\Models\Country::select('id', 'name', 'iso2')->orderBy('name', 'asc')->get(); @endphp
@if ($errors->has('country_id')) {{ $errors->first('country_id') }} @endif
{{ __( 'words.Certificate registration number', ) }}
@if ($errors->has('file')) {{ $errors->first('file') }} @endif

@if(!empty($brand) && $brand == \App\Models\AddNewBrand::FOR_BRAND)
@php $AllGeneralCategories = []; $genCat = []; $lang = session('locale'); $langFile = resource_path("lang/$lang/category.php"); $translations = include $langFile; @endphp @foreach (collect(getcategoryList())->slice(4) as $category) @if ($category->slug != 'services' && $category->slug != 'jobs') @php $cat = \App\Models\Category::where('parent_id', $category->id + 1) ->where('has_brand', 1) ->get(); if ($cat->isNotEmpty()) { $subCats = []; foreach ($cat as $catItem) { $findSubGeneralCategory = \App\Models\Category::where('parent_id', $catItem->id) ->where('has_brand', 1) ->get(); if ($findSubGeneralCategory->isNotEmpty()) { $subSubCats = []; foreach ($findSubGeneralCategory as $subCatItem) { $findSubSubGeneralCategory = \App\Models\Category::where('parent_id', $subCatItem->id) ->where('has_brand', 1) ->get(); if ($findSubSubGeneralCategory->isNotEmpty()) { $subSubSubCats = []; foreach ($findSubSubGeneralCategory as $subSubCatItem) { $findSubSubSubGeneralCategory = \App\Models\Category::where('parent_id', $subSubCatItem->id) ->where('has_brand', 1) ->get(); if ($findSubSubSubGeneralCategory->isEmpty()) { $data = []; $data["id"] = $subSubCatItem->id; $data["title"] = $translations[$subSubCatItem->title] ?? $subSubCatItem->title; $data["slug"] = $subSubCatItem->slug; $subSubSubCats[] = $data; } } $AllGeneralCategories[] = [ 'general_category' => ($translations[$category->title] ?? $category->title) . ' >> ' . ($translations[$catItem->title] ?? $catItem->title) . ' >> ' . ($translations[$subCatItem->title] ?? $subCatItem->title), 'sub_cat' => $subSubSubCats, ]; } else { $data = []; $data["id"] = $subCatItem->id; $data["title"] = $translations[$subCatItem->title] ?? $subCatItem->title; $data["slug"] = $subCatItem->slug; $subSubCats[] = $data; } } $AllGeneralCategories[] = [ 'general_category' => ($translations[$category->title] ?? $category->title) . ' >> ' . ($translations[$catItem->title] ?? $catItem->title), 'sub_cat' => $subSubCats, ]; } else { $data = []; $data["id"] = $catItem->id; $data["title"] = $translations[$catItem->title] ?? $catItem->title; $data["slug"] = $catItem->slug; $subCats[] = $data; } } $AllGeneralCategories[] = [ 'general_category' => $translations[$category->title] ?? $category->title, 'sub_cat' => $subCats, ]; } else { $data = []; $data["id"] = $category->id; $data["title"] = $translations[$category->title] ?? $category->title; $data["slug"] = $category->slug; $genCat[] = $data; } @endphp @endif @endforeach @php $AllGeneralCategories[] = [ 'general_category' => $translations["General"] ?? "General", 'sub_cat' => $genCat ]; @endphp @php $AllGeneralCategories = collect($AllGeneralCategories) ->sortBy('general_category', SORT_NATURAL | SORT_FLAG_CASE) ->values() ->all(); @endphp
@php $groupIndex = 0; @endphp @foreach ($AllGeneralCategories as $generalCategory) @php $groupAttr = 'group-' . $groupIndex++; @endphp
@foreach ($generalCategory["sub_cat"] as $sub_cat)
@endforeach
@endforeach
{{-- select Cateories to add brand --}}
@elseif(!empty($brand) && $brand == \App\Models\AddNewBrand::FOR_TIRE_BRAND)
@php $tireRimsCategory = App\Models\Category::where('slug','tires_rims')->first(); @endphp
@foreach ($tireRimsCategory->getAllSubCategory($tireRimsCategory->id) as $category) @if($category->title!="Other" && $category->slug!="wheels")
@endif @endforeach
@elseif(!empty($brand) && $brand == \App\Models\AddNewBrand::FOR_PART_BRAND)
@php $partBrandCategory = App\Models\Category::where('slug','vehicles_parts_supplies')->first(); @endphp
@foreach ($partBrandCategory->getAllSubCategory($partBrandCategory->id) as $category) @if($category->title!="Other" && $category->slug!="consumables_accessories")
@php if(!empty(\App\Models\Category::getAllSubCategory($category->id))) $cat = \App\Models\Category::where('parent_id', $category->id)->where('has_brand',1)->get(); @endphp
@endif @endforeach
@endif

{{ __('words.Please review the fields marked in red and correct the information.') }}

@include('advertisment.partials.brandModal') {{-- cropper modal end --}}
@push('page_script') @endpush @endsection