Merge branch 'master' into image-view-fix

# Conflicts:
#	addons/default/visiosoft/advs-module/resources/views/list/list.twig
This commit is contained in:
Metehan Celik 2022-01-10 17:04:00 +03:00
commit d99ae40cc9
13 changed files with 118 additions and 60 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', {

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') }}">

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;
@ -742,6 +742,13 @@ class AdvsController extends PublicController
return $cats; return $cats;
} }
public function checkUser()
{
return [
'success' => \auth()->check(),
];
}
public function create(AdvFormBuilder $formBuilder, CategoryRepositoryInterface $repository) public function create(AdvFormBuilder $formBuilder, CategoryRepositoryInterface $repository)
{ {
$isActive = new AdvModel(); $isActive = new AdvModel();

View File

@ -22,7 +22,7 @@
{{ addBlock('layouts/default/section')|raw }} {{ addBlock('layouts/default/section')|raw }}
<main id="main"> <main id="main">
<div class="container-md container-fluid"> <div class="container">
{% include "visiosoft.theme.base::partials/messages" %} {% include "visiosoft.theme.base::partials/messages" %}

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

@ -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,6 +117,8 @@ class CategoryController extends AdminController
} }
} }
if (empty($isMultiCat)) { if (empty($isMultiCat)) {
$slug = $all['slug'];
if (!$this->categoryRepository->findBySlug($slug)) {
$category = $this->categoryRepository->create(array_merge($translatableEntries, [ $category = $this->categoryRepository->create(array_merge($translatableEntries, [
'slug' => $all['slug'], 'slug' => $all['slug'],
'parent_category' => $all['parent_category'] === "" ? null : $all['parent_category'], 'parent_category' => $all['parent_category'] === "" ? null : $all['parent_category'],
@ -129,14 +129,28 @@ class CategoryController extends AdminController
$this->createIconFile($category->getId()); $this->createIconFile($category->getId());
$this->dispatch(new CalculateCategoryLevel($category->getId())); $this->dispatch(new CalculateCategoryLevel($category->getId()));
}
$this->messages->error(trans('visiosoft.module.cats::message.cat_slug_exists', [
'slug' => $slug
]));
} 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);
} }

View File

@ -66,7 +66,7 @@ class ValueTableBuilder extends TableBuilder
], ],
'rotate' => [ 'rotate' => [
'target' => '_blank', 'target' => '_blank',
'icon' => 'fa fa-sync-alt', 'icon' => 'fa fa-sync-alt fa-refresh',
'type' => 'info', 'type' => 'info',
'text' => '', 'text' => '',
'class' => 'col-4', 'class' => 'col-4',

View File

@ -41,7 +41,7 @@
"anomaly/decimal-field_type": "~2.1.0", "anomaly/decimal-field_type": "~2.1.0",
"anomaly/integer-field_type": "~2.1.0", "anomaly/integer-field_type": "~2.1.0",
"anomaly/editor-field_type": "~3.1.0", "anomaly/editor-field_type": "~3.1.0",
"anomaly/select-field_type": "~2.3.0", "anomaly/select-field_type": "2.3.8",
"anomaly/slider-field_type": "~3.0.0", "anomaly/slider-field_type": "~3.0.0",
"anomaly/addon-field_type": "~2.2.0", "anomaly/addon-field_type": "~2.2.0",
"anomaly/email-field_type": "~2.1.0", "anomaly/email-field_type": "~2.1.0",