Merge remote-tracking branch 'origin/master'

This commit is contained in:
Metehan Celik 2022-01-10 12:53:05 +03:00
commit 565e038495
10 changed files with 109 additions and 58 deletions

View File

@ -7,7 +7,9 @@
{% block content %} {% block content %}
<div id="listingPage" class=""> {% include "visiosoft.module.advs::list/partials/mobile-list" %}
<div id="listingPage" class="d-none d-sm-block">
{% include "visiosoft.module.advs::list/partials/breadcrumb" %} {% include "visiosoft.module.advs::list/partials/breadcrumb" %}
@ -15,7 +17,7 @@
{% include "visiosoft.module.advs::list/partials/list-filter" %} {% include "visiosoft.module.advs::list/partials/list-filter" %}
<div id="listingContainer" class="flex-fill ml-s-4 ml-0"> <div id="listingContainer" class="flex-fill ml-4">
<div id="pageTitle" class="d-flex justify-content-between border-bottom pb-2 px-3 mb-3"> <div id="pageTitle" class="d-flex justify-content-between border-bottom pb-2 px-3 mb-3">
<p> <p>
{{ trans('visiosoft.module.advs::field.search_ad_result_text', { {{ trans('visiosoft.module.advs::field.search_ad_result_text', {
@ -65,7 +67,7 @@
{{ addBlock('ads-list/row',{'topfields':topfields,'selectRange':selectRange,'advs':advs, 'mainCats':mainCats|length})|raw }} {{ addBlock('ads-list/row',{'topfields':topfields,'selectRange':selectRange,'advs':advs, 'mainCats':mainCats|length})|raw }}
<div id="listingWrapper" class="border rounded p-s-3 p-0"> <div id="listingWrapper" class="border rounded p-3">
{% block listContent %} {% block listContent %}
{% include "visiosoft.module.advs::list/partials/ads" %} {% include "visiosoft.module.advs::list/partials/ads" %}
{% endblock %} {% endblock %}

View File

@ -1,6 +1,6 @@
<div id="breadcrumb" class="border-bottom border-right border-left d-flex justify-content-between pl-s-3 p-0"> <div id="breadcrumb" class="border-bottom border-right border-left d-flex justify-content-between">
<div class="overflow-hidden d-flex align-items-center"> <div class="overflow-hidden d-flex align-items-center">
<span class="text-truncate d-s-block d-none"> <span class="text-truncate">
<a href="{{ url('/') }}" data-toggle="tooltip" data-placement="bottom" <a href="{{ url('/') }}" data-toggle="tooltip" data-placement="bottom"
title="{{ trans("visiosoft.module.advs::field.home") }}"> title="{{ trans("visiosoft.module.advs::field.home") }}">
{{ trans("visiosoft.module.advs::field.home") }} {{ trans("visiosoft.module.advs::field.home") }}

View File

@ -26,9 +26,9 @@
<a href="javascript:;" <a href="javascript:;"
class="text-decoration-none text-truncate d-block selected-category-name"> class="text-decoration-none text-truncate d-block selected-category-name">
{% if app.request.get('cat') %} {% if category %}
{% for category_breadcrumbs in mainCats %} {% for category_breadcrumbs in mainCats %}
{{ category_breadcrumbs['val'] }} {{ category_breadcrumbs['name'] }}
{% if count(mainCats) != loop.index %} {% if count(mainCats) != loop.index %}
, ,
{% endif %} {% endif %}

View File

@ -3,7 +3,7 @@
{% set citySlug = pathInfo|length is same as(4) ? pathInfo[3] : null %} {% set citySlug = pathInfo|length is same as(4) ? pathInfo[3] : null %}
{% set formAction = catSlug ? url_route('adv_list_seo', [catSlug, citySlug]) : url_route('visiosoft.module.advs::list') %} {% set formAction = catSlug ? url_route('adv_list_seo', [catSlug, citySlug]) : url_route('visiosoft.module.advs::list') %}
<form action="{{ formAction }}" method="get" id="{{ (filter_id) ? filter_id : "listFilterForm" }}" rel="nofollow" <form action="{{ formAction }}" method="get" id="{{ (filter_id) ? filter_id : "listFilterForm" }}" rel="nofollow"
class="flex-shrink-0 d-md-block d-none"> class="flex-shrink-0">
<input type="hidden" name="cat" value="{{ app.request.get('cat') }}"> <input type="hidden" name="cat" value="{{ app.request.get('cat') }}">
<input type="hidden" name="user" value="{{ app.request.get('user') }}"> <input type="hidden" name="user" value="{{ app.request.get('user') }}">
@ -26,26 +26,26 @@
{% include 'visiosoft.module.cats::ads-list/partials/cat-filter' %} {% include 'visiosoft.module.cats::ads-list/partials/cat-filter' %}
</div> </div>
{{ addBlock('ads-list/partials/list-filter',{ {{ addBlock('ads-list/partials/list-filter',{
'mainCats':mainCats, 'mainCats':mainCats,
'subCats':subCats, 'subCats':subCats,
'ranges':ranges, 'ranges':ranges,
'text':text, 'text':text,
'checkboxes':checkboxes, 'checkboxes':checkboxes,
'topfields' : topfields, 'topfields' : topfields,
'selectDropdown' : selectDropdown, 'selectDropdown' : selectDropdown,
'selectRange' : selectRange, 'selectRange' : selectRange,
'selectImage' : selectImage, 'selectImage' : selectImage,
'radio':radio, 'radio':radio,
'countries':countries, 'countries':countries,
'cities':cities, 'cities':cities,
'districts':districts, 'districts':districts,
'neighborhoods':neighborhoods, 'neighborhoods':neighborhoods,
'villages':villages, 'villages':villages,
'param':param, 'param':param,
'category':category, 'category':category,
'cityId':cityId 'cityId':cityId
})|raw }} })|raw }}
<!-- Price Filter Start --> <!-- Price Filter Start -->
{% include 'visiosoft.module.advs::list/partials/price-filter' %} {% include 'visiosoft.module.advs::list/partials/price-filter' %}

View File

@ -4,7 +4,7 @@
<a href="{{ url('/') }}">{{ trans("visiosoft.module.advs::field.home") }}</a> <a href="{{ url('/') }}">{{ trans("visiosoft.module.advs::field.home") }}</a>
</li> </li>
{{ addBlock('ads-list/partials/breadcrumb-mobile', {'mainCats': mainCats, 'category': categoryId})|raw }} {{ addBlock('ads-list/partials/breadcrumb-mobile', {'mainCats': mainCats, 'category': category})|raw }}
</ul> </ul>
</div> </div>

View File

@ -0,0 +1,46 @@
<div id="mobileListingPage" class="d-sm-none mb-5">
{% if setting_value('visiosoft.module.advs::show_subcats_mobile') %}
{% include "visiosoft.module.advs::list/partials/sub-categories-mobile" %}
{% endif %}
{% if not hideBreadcrump %}
{% include "visiosoft.module.advs::list/partials/mobile-breadcrumb" %}
{% endif %}
{% if not hideActions %}
<div id="mobileListNav" class="d-flex p-2 align-items-center mb-1">
<div id="filter_modal_btn" class="d-flex flex-column align-items-center mobile-list-nav-item">
{{ img('visiosoft.module.advs::images/listing/mobile-filter.svg').data|raw }}
<p class="mt-1">{{ trans('visiosoft.module.advs::field.filter') }}</p>
</div>
<div class="divider"></div>
<div id="sort_modal_btn" class="d-flex flex-column align-items-center mobile-list-nav-item">
{{ img('visiosoft.module.advs::images/listing/mobile-sort.svg').data|raw }}
<p class="mt-1">{{ trans('visiosoft.module.advs::field.sort') }}</p>
</div>
<div class="divider"></div>
{{ addBlock('ads-list/mobile/action-bar')|raw }}
</div>
{% endif %}
<div id="mobileListing">
{{ addBlock('ad-list/partials/mobile-list', {'featured_advs': featured_advs, 'vars': _context})|raw }}
{% for adv in advs %}
<a href="{{ adv.detail_url }}" class="listing-item d-flex p-2">
<img src="{{ adv.cover_photo }}" alt="{{ adv.name }}" class="rounded-sm">
<div class="ml-3 mt-1">
<h6 class="mb-1">{{ adv.name }}</h6>
{% if listLocation %}
<p class="mb-1">{{ adv.country_name }} / {{ adv.city_name }}</p>
{% endif %}
<p>{{ adv.price != '0' ? currency_format(adv.price,adv.currency) : trans('visiosoft.module.advs::field.free') }}</p>
</div>
</a>
{% endfor %}
</div>
{% include "visiosoft.module.advs::list/partials/pagination" %}
</div>

View File

@ -271,7 +271,7 @@ class AdvsController extends PublicController
if ($category) { if ($category) {
$mainCats = $this->category_repository->getParentCategoryByOrder($category->id); $mainCats = collect($this->category_repository->getParentCategoryByOrder($category->id));
$subCats = $category->getSubCategories(); $subCats = $category->getSubCategories();
$allCats = false; $allCats = false;
} else { } else {
@ -450,9 +450,9 @@ class AdvsController extends PublicController
if ($city) { if ($city) {
$catText = "$city->name $catText"; $catText = "$city->name $catText";
} elseif (count($mainCats) == 1 || count($mainCats) == 2) { } elseif (count($mainCats) == 1 || count($mainCats) == 2) {
$catText = end($mainCats)->name; $catText = $mainCats->last()->name;
} elseif (count($mainCats) > 2) { } elseif (count($mainCats) > 2) {
$catArray = array_slice($mainCats, 2); $catArray = $mainCats->slice(2);
$loop = 0; $loop = 0;
foreach ($catArray as $cat) { foreach ($catArray as $cat) {
$catText = !$loop ? $catText . $cat->name : $catText . ' ' . $cat->name; $catText = !$loop ? $catText . $cat->name : $catText . ' ' . $cat->name;

View File

@ -2,4 +2,5 @@
return [ return [
'categories_mass_delete_success' => 'Categories and related sub-categories has been deleted successfully!', 'categories_mass_delete_success' => 'Categories and related sub-categories has been deleted successfully!',
'cat_slug_exists' => 'A category with a slug of :slug already exists!',
]; ];

View File

@ -6,4 +6,4 @@
</a> </a>
</li> </li>
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@ -63,8 +63,6 @@ class CategoryController extends AdminController
public function create(FileUploader $uploader, FolderRepositoryInterface $folderRepository, MountManager $manager) public function create(FileUploader $uploader, FolderRepositoryInterface $folderRepository, MountManager $manager)
{ {
if ($this->request->action == "save") { if ($this->request->action == "save") {
$all = $this->request->all(); $all = $this->request->all();
$id = $all['parent_category']; $id = $all['parent_category'];
$parent_id = $all['parent_category']; $parent_id = $all['parent_category'];
@ -119,24 +117,40 @@ class CategoryController extends AdminController
} }
} }
if (empty($isMultiCat)) { if (empty($isMultiCat)) {
$category = $this->categoryRepository->create(array_merge($translatableEntries, [ $slug = $all['slug'];
'slug' => $all['slug'], if (!$this->categoryRepository->findBySlug($slug)) {
'parent_category' => $all['parent_category'] === "" ? null : $all['parent_category'], $category = $this->categoryRepository->create(array_merge($translatableEntries, [
'seo_keyword' => $all['seo_keyword'], 'slug' => $all['slug'],
'seo_description' => $all['seo_description'], 'parent_category' => $all['parent_category'] === "" ? null : $all['parent_category'],
'seo_keyword' => $all['seo_keyword'],
'seo_description' => $all['seo_description'],
]));
$this->createIconFile($category->getId());
$this->dispatch(new CalculateCategoryLevel($category->getId()));
}
$this->messages->error(trans('visiosoft.module.cats::message.cat_slug_exists', [
'slug' => $slug
])); ]));
$this->createIconFile($category->getId());
$this->dispatch(new CalculateCategoryLevel($category->getId()));
} else { } else {
for ($i = 0; $i < count($isMultiCat[0]); $i++) { for ($i = 0; $i < count($isMultiCat[0]); $i++) {
foreach ($isMultiCat as $cat) { foreach ($isMultiCat as $cat) {
$translatableEntries = array_merge($translatableEntries, $cat[$i]); $translatableEntries = array_merge($translatableEntries, $cat[$i]);
} }
$slug = $this->str->slug(reset($translatableEntries)['name'], '_');
if ($this->categoryRepository->findBySlug($slug)) {
$this->messages->error(trans('visiosoft.module.cats::message.cat_slug_exists', [
'slug' => $slug
]));
continue;
}
$category = $this->categoryRepository->create(array_merge($translatableEntries, [ $category = $this->categoryRepository->create(array_merge($translatableEntries, [
'slug' => $this->str->slug(reset($translatableEntries)['name'], '_'), 'slug' => $slug,
'parent_category' => $all['parent_category'] === "" ? null : $all['parent_category'], 'parent_category' => $all['parent_category'] === "" ? null : $all['parent_category'],
'seo_keyword' => $all['seo_keyword'], 'seo_keyword' => $all['seo_keyword'],
'seo_description' => $all['seo_description'], 'seo_description' => $all['seo_description'],
@ -148,18 +162,6 @@ class CategoryController extends AdminController
} }
}; };
// $this->categoryRepository->create(array_merge($translatableEntries, [
// 'slug' => $all['slug'],
// 'parent_category' => $all['parent_category'],
// 'icon' => $all['icon'],
// 'seo_keyword' => $all['seo_keyword'],
// 'seo_description' => $all['seo_description'],
// ]));
// $form->make();
// if ($form->hasFormErrors()) {
// return $this->redirect->to('/admin/cats/create');
// }
if ($parent_id != "") { if ($parent_id != "") {
return $this->redirect->to('/admin/cats?cat=' . $parent_id); return $this->redirect->to('/admin/cats?cat=' . $parent_id);
} }