Merge pull request #1044 from openclassify/vedat

#3804 fixed list
This commit is contained in:
Muammer Top 2021-04-19 12:38:50 +03:00 committed by GitHub
commit 3cc67b4b6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 89 additions and 82 deletions

View File

@ -35,14 +35,16 @@
</a> </a>
{{ addBlock('ad-detail/seller/action',{'seller_id':adv.owner_id})|raw }} {{ addBlock('ad-detail/seller/action',{'seller_id':adv.owner_id})|raw }}
</div> </div>
<div class="col-md-12 m-2"> {% if setting_value('visiosoft.module.advs::market_place') %}
<i class="fas fa-hashtag"></i> <div class="col-md-12 m-2">
{{ trans('visiosoft.module.advs::field.ad_id') }}:{{ adv.id }} <i class="fas fa-hashtag"></i>
</div> {{ trans('visiosoft.module.advs::field.ad_id') }}:{{ adv.id }}
<div class="col-md-12 m-2"> </div>
<i class="far fa-clock text-dark"></i> <div class="col-md-12 m-2">
{{ adv.created_at|date('d/m/Y') }} <i class="far fa-clock text-dark"></i>
</div> {{ adv.created_at|date('d/m/Y') }}
</div>
{% endif %}
<!-- Detail With Block --> <!-- Detail With Block -->
{{ addBlock('ad-detail/details',{'adv':adv, 'options':options, 'configurations':configurations})|raw }} {{ addBlock('ad-detail/details',{'adv':adv, 'options':options, 'configurations':configurations})|raw }}

View File

@ -25,7 +25,6 @@
</div> </div>
</div> </div>
<div class="ml-4 mt-1"> <div class="ml-4 mt-1">
<p class="id-data">#{{ adv.id }}</p>
<h6 class="mb-1"> <h6 class="mb-1">
<a href="{{ adv.detail_url }}">{{ adv.name }}</a> <a href="{{ adv.detail_url }}">{{ adv.name }}</a>
</h6> </h6>
@ -36,9 +35,11 @@
</p> </p>
{% endif %} {% endif %}
{% if showLocation %} {% if showLocation %}
<p class="location-data">{{ adv.country_name}} / {{ adv.city_name }}</p> <p class="location-data">{{ adv.country_name }} / {{ adv.city_name }}</p>
{% endif %}
{% if setting_value('visiosoft.module.advs::market_place') %}
<p class="date-data">{{ adv.publish_at.value|date('d/m/Y') }}</p>
{% endif %} {% endif %}
<p class="date-data">{{ adv.publish_at.value|date('d F Y') }}</p>
</div> </div>
</div> </div>
</div> </div>

View File

@ -4,66 +4,70 @@
<div id="listing"> <div id="listing">
<table class="w-100 text-center"> <table class="w-100 text-center">
<thead> <thead>
<tr class="text-white"> <tr class="text-white">
<th class="text-nowrap" colspan="2">{{ trans('visiosoft.module.advs::field.ad_title') }}</th> <th class="text-nowrap" colspan="2">{{ trans('visiosoft.module.advs::field.ad_title') }}</th>
{% if listLocation %} {% if listLocation %}
<th class="text-nowrap"> <th class="text-nowrap">
{{ trans('visiosoft.module.advs::field.city.name') }} / {{ trans('visiosoft.module.advs::field.district.name') }} {{ trans('visiosoft.module.advs::field.city.name') }}
</th> / {{ trans('visiosoft.module.advs::field.district.name') }}
{% endif %} </th>
{% endif %}
{% if setting_value('visiosoft.module.advs::market_place') %}
<th class="text-nowrap">{{ trans('visiosoft.module.advs::field.listing_date') }}</th> <th class="text-nowrap">{{ trans('visiosoft.module.advs::field.listing_date') }}</th>
<th class="text-nowrap">{{ trans('visiosoft.module.advs::field.price.name') }}</th> {% endif %}
</tr> <th class="text-nowrap">{{ trans('visiosoft.module.advs::field.price.name') }}</th>
</tr>
</thead> </thead>
<tbody> <tbody>
{{ addBlock('ad-list/partials/ads', {'featured_advs': featured_advs, 'vars': _context})|raw }} {{ addBlock('ad-list/partials/ads', {'featured_advs': featured_advs, 'vars': _context})|raw }}
{% for adv in advs %} {% for adv in advs %}
<tr class="{{ adv.doping_type ? 'doping_type' ~ adv.doping_type }}"> <tr class="{{ adv.doping_type ? 'doping_type' ~ adv.doping_type }}">
<td> <td>
<a href="{{ adv.detail_url }}"> <a href="{{ adv.detail_url }}">
<img src="{{ img('visiosoft.theme.base::images/no-image.png').url }}" class="rounded lazy" <img src="{{ img('visiosoft.theme.base::images/no-image.png').url }}" class="rounded lazy"
alt="{{ adv.name }}" data-src="{{ adv.cover_photo }}"> alt="{{ adv.name }}" data-src="{{ adv.cover_photo }}">
</a> </a>
</td>
<td class="text-left pl-2">
<h6 class="mb-1">
<a href="{{ adv.detail_url }}">{{ adv.name }}</a>
</h6>
<p class="cat-data mb-1">{{ adv.cat1_name }} /{{ adv.cat2_name }}</p>
<div class="action-data d-flex align-items-center">
{{ addBlock('list/extra-actions', {'ad': adv, 'vars': _context})|raw }}
</div>
</td>
{% if listLocation %}
<td class="location-data">
<p>{{ adv.country_name }}</p>
<p>{{ adv.city_name }}</p>
</td> </td>
<td class="text-left pl-2"> {% endif %}
<p class="id-data">#{{ adv.id }}</p> {% if setting_value('visiosoft.module.advs::market_place') %}
<h6 class="mb-1">
<a href="{{ adv.detail_url }}">{{ adv.name }}</a>
</h6>
<p class="cat-data mb-1">{{ adv.cat1_name }} /{{ adv.cat2_name }}</p>
<div class="action-data d-flex align-items-center">
{{ addBlock('list/extra-actions', {'ad': adv, 'vars': _context})|raw }}
</div>
</td>
{% if listLocation %}
<td class="location-data">
<p>{{ adv.country_name }}</p>
<p>{{ adv.city_name }}</p>
</td>
{% endif %}
<td class="date-data"> <td class="date-data">
<p>{{ adv.publish_at.value|date('d F') }}</p> <p>{{ adv.publish_at.value|date('d/m') }}</p>
<p>{{ adv.publish_at.value|date('Y') }}</p> <p>{{ adv.publish_at.value|date('Y') }}</p>
</td> </td>
<td class="price-data"> {% endif %}
{% if not hideStandard %} <td class="price-data">
<p class="text-nowrap"> {% if not hideStandard %}
<s>
{{ adv.standard_price != adv.price and adv.standard_price != '0' ? currency_format(adv.standard_price,adv.currency) : '' }}
</s>
</p>
{% endif %}
<p class="text-nowrap"> <p class="text-nowrap">
{{ adv.price != '0' ? currency_format(adv.price,adv.currency) : trans('visiosoft.module.advs::field.free') }} <s>
{{ adv.standard_price != adv.price and adv.standard_price != '0' ? currency_format(adv.standard_price,adv.currency) : '' }}
</s>
</p> </p>
</td> {% endif %}
</tr> <p class="text-nowrap">
{% endfor %} {{ adv.price != '0' ? currency_format(adv.price,adv.currency) : trans('visiosoft.module.advs::field.free') }}
</p>
</td>
</tr>
{% endfor %}
</tbody> </tbody>
</table> </table>
</div> </div>

View File

@ -258,11 +258,11 @@ class AdvsController extends PublicController
$advs[$index]->detail_url = $this->adv_model->getAdvDetailLinkByModel($ad, 'list'); $advs[$index]->detail_url = $this->adv_model->getAdvDetailLinkByModel($ad, 'list');
$advs[$index] = $this->adv_model->AddAdsDefaultCoverImage($ad); $advs[$index] = $this->adv_model->AddAdsDefaultCoverImage($ad);
$foreign_currencies = json_decode($advs[$index]->foreign_currencies, true); $foreign_currencies = json_decode($advs[$index]->foreign_currencies, true);
if (isset($_COOKIE['currency']) && $advs[$index]->foreign_currencies && array_key_exists($_COOKIE['currency'], $foreign_currencies)) { if (isset($_COOKIE['currency']) && $advs[$index]->foreign_currencies && array_key_exists($_COOKIE['currency'], $foreign_currencies)) {
$advs[$index]->currency = $_COOKIE['currency']; $advs[$index]->currency = $_COOKIE['currency'];
$advs[$index]->price = $foreign_currencies[$_COOKIE['currency']]; $advs[$index]->price = $foreign_currencies[$_COOKIE['currency']];
} }
} }
$seenList = array(); $seenList = array();
@ -280,15 +280,8 @@ class AdvsController extends PublicController
if ($category) { if ($category) {
$mainCats = $this->category_repository->getParentCategoryById($category->id); $mainCats = $this->category_repository->getParentCategoryByOrder($category->id);
$subCats = $this->category_repository->getCategoryById($category->id); $subCats = $category->getSubCategories();
//if there is no subcategory
if (count($subCats) < 1 and count($mainCats) > 1) {
//fetch subcategories of the last category
$subCats = $this->category_repository->getCategoryById($mainCats[1]['id']);
unset($mainCats[0]);//remove last category
}
$allCats = false; $allCats = false;
} else { } else {
$mainCats = $this->category_repository->getMainCategories(); $mainCats = $this->category_repository->getMainCategories();
@ -586,11 +579,11 @@ class AdvsController extends PublicController
$configurations = $this->optionConfigurationRepository->getConf($adv->id); $configurations = $this->optionConfigurationRepository->getConf($adv->id);
$foreign_currencies = json_decode($adv->foreign_currencies, true); $foreign_currencies = json_decode($adv->foreign_currencies, true);
if (isset($_COOKIE['currency']) && $_COOKIE['currency'] && $adv->foreign_currencies && array_key_exists($_COOKIE['currency'], $foreign_currencies)) { if (isset($_COOKIE['currency']) && $_COOKIE['currency'] && $adv->foreign_currencies && array_key_exists($_COOKIE['currency'], $foreign_currencies)) {
$adv->currency = $_COOKIE['currency']; $adv->currency = $_COOKIE['currency'];
$adv->price = $foreign_currencies[$_COOKIE['currency']]; $adv->price = $foreign_currencies[$_COOKIE['currency']];
} }
// Check if hide price // Check if hide price
$hidePrice = false; $hidePrice = false;
@ -1034,7 +1027,7 @@ class AdvsController extends PublicController
} }
$adv->update($params); $adv->update($params);
$this->event->dispatch(new EditedAdCategory($before_editing_ad_params,$adv)); $this->event->dispatch(new EditedAdCategory($before_editing_ad_params, $adv));
$this->messages->success(trans('visiosoft.module.advs::message.updated_category_msg')); $this->messages->success(trans('visiosoft.module.advs::message.updated_category_msg'));
return redirect('/advs/edit_advs/' . $id); return redirect('/advs/edit_advs/' . $id);
} }
@ -1106,6 +1099,7 @@ class AdvsController extends PublicController
} }
return $response; return $response;
} }
public function stockControl(Request $request, AdvRepositoryInterface $advRepository) public function stockControl(Request $request, AdvRepositoryInterface $advRepository)
{ {
$quantity = $request->quantity; $quantity = $request->quantity;

View File

@ -4,7 +4,7 @@
<li> <li>
<div class="d-flex"> <div class="d-flex">
{% if (not categoryId) or (loop.first and categoryId) %} {% if (not category) or (loop.first and category) %}
{% set categoryIcon = (maincat.icon.value) ? maincat.icon.value : img('visiosoft.module.advs::images/listing/sample-cat-icon.svg').url %} {% set categoryIcon = (maincat.icon.value) ? maincat.icon.value : img('visiosoft.module.advs::images/listing/sample-cat-icon.svg').url %}
<img src="{{ categoryIcon }}" alt="{{ main_category.name }}" class="img-responsive"> <img src="{{ categoryIcon }}" alt="{{ main_category.name }}" class="img-responsive">
{% endif %} {% endif %}

View File

@ -102,12 +102,16 @@ class CategoryRepository extends EntryRepository implements CategoryRepositoryIn
$parents_count++; $parents_count++;
} }
} }
return $parents; return $parents;
} }
return null; return null;
} }
public function getParentCategoryByOrder($id)
{
return array_reverse($this->getParentCategoryById($id));
}
public function getLevelById($id) public function getLevelById($id)
{ {
$parents = $this->getParentCategoryById($id); $parents = $this->getParentCategoryById($id);

View File

@ -16,6 +16,8 @@ interface CategoryRepositoryInterface extends EntryRepositoryInterface
public function getParentCategoryById($id); public function getParentCategoryById($id);
public function getParentCategoryByOrder($id);
public function getLevelById($id); public function getLevelById($id);
public function getDeletedCategories(); public function getDeletedCategories();

View File

@ -64,7 +64,7 @@ class ValueTableBuilder extends TableBuilder
'show_headers' => false, 'show_headers' => false,
'sortable_headers' => false, 'sortable_headers' => false,
'table_view' => 'anomaly.field_type.file::table', 'table_view' => 'anomaly.field_type.file::table',
'no_results_message' => 'visiosoft.field_type.singlefile::message.no_file_selected', 'no_results_message' => null,
]; ];
/** /**