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

View File

@ -25,7 +25,6 @@
</div>
</div>
<div class="ml-4 mt-1">
<p class="id-data">#{{ adv.id }}</p>
<h6 class="mb-1">
<a href="{{ adv.detail_url }}">{{ adv.name }}</a>
</h6>
@ -36,9 +35,11 @@
</p>
{% endif %}
{% 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 %}
<p class="date-data">{{ adv.publish_at.value|date('d F Y') }}</p>
</div>
</div>
</div>

View File

@ -4,66 +4,70 @@
<div id="listing">
<table class="w-100 text-center">
<thead>
<tr class="text-white">
<th class="text-nowrap" colspan="2">{{ trans('visiosoft.module.advs::field.ad_title') }}</th>
{% if listLocation %}
<th class="text-nowrap">
{{ trans('visiosoft.module.advs::field.city.name') }} / {{ trans('visiosoft.module.advs::field.district.name') }}
</th>
{% endif %}
<tr class="text-white">
<th class="text-nowrap" colspan="2">{{ trans('visiosoft.module.advs::field.ad_title') }}</th>
{% if listLocation %}
<th class="text-nowrap">
{{ trans('visiosoft.module.advs::field.city.name') }}
/ {{ trans('visiosoft.module.advs::field.district.name') }}
</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.price.name') }}</th>
</tr>
{% endif %}
<th class="text-nowrap">{{ trans('visiosoft.module.advs::field.price.name') }}</th>
</tr>
</thead>
<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 %}
<tr class="{{ adv.doping_type ? 'doping_type' ~ adv.doping_type }}">
<td>
<a href="{{ adv.detail_url }}">
<img src="{{ img('visiosoft.theme.base::images/no-image.png').url }}" class="rounded lazy"
alt="{{ adv.name }}" data-src="{{ adv.cover_photo }}">
</a>
{% for adv in advs %}
<tr class="{{ adv.doping_type ? 'doping_type' ~ adv.doping_type }}">
<td>
<a href="{{ adv.detail_url }}">
<img src="{{ img('visiosoft.theme.base::images/no-image.png').url }}" class="rounded lazy"
alt="{{ adv.name }}" data-src="{{ adv.cover_photo }}">
</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 class="text-left pl-2">
<p class="id-data">#{{ adv.id }}</p>
<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 %}
{% endif %}
{% if setting_value('visiosoft.module.advs::market_place') %}
<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>
</td>
<td class="price-data">
{% if not hideStandard %}
<p class="text-nowrap">
<s>
{{ adv.standard_price != adv.price and adv.standard_price != '0' ? currency_format(adv.standard_price,adv.currency) : '' }}
</s>
</p>
{% endif %}
{% endif %}
<td class="price-data">
{% if not hideStandard %}
<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>
</td>
</tr>
{% endfor %}
{% endif %}
<p class="text-nowrap">
{{ adv.price != '0' ? currency_format(adv.price,adv.currency) : trans('visiosoft.module.advs::field.free') }}
</p>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>

View File

@ -258,11 +258,11 @@ class AdvsController extends PublicController
$advs[$index]->detail_url = $this->adv_model->getAdvDetailLinkByModel($ad, 'list');
$advs[$index] = $this->adv_model->AddAdsDefaultCoverImage($ad);
$foreign_currencies = json_decode($advs[$index]->foreign_currencies, true);
if (isset($_COOKIE['currency']) && $advs[$index]->foreign_currencies && array_key_exists($_COOKIE['currency'], $foreign_currencies)) {
$advs[$index]->currency = $_COOKIE['currency'];
$advs[$index]->price = $foreign_currencies[$_COOKIE['currency']];
}
$foreign_currencies = json_decode($advs[$index]->foreign_currencies, true);
if (isset($_COOKIE['currency']) && $advs[$index]->foreign_currencies && array_key_exists($_COOKIE['currency'], $foreign_currencies)) {
$advs[$index]->currency = $_COOKIE['currency'];
$advs[$index]->price = $foreign_currencies[$_COOKIE['currency']];
}
}
$seenList = array();
@ -280,15 +280,8 @@ class AdvsController extends PublicController
if ($category) {
$mainCats = $this->category_repository->getParentCategoryById($category->id);
$subCats = $this->category_repository->getCategoryById($category->id);
//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
}
$mainCats = $this->category_repository->getParentCategoryByOrder($category->id);
$subCats = $category->getSubCategories();
$allCats = false;
} else {
$mainCats = $this->category_repository->getMainCategories();
@ -586,11 +579,11 @@ class AdvsController extends PublicController
$configurations = $this->optionConfigurationRepository->getConf($adv->id);
$foreign_currencies = json_decode($adv->foreign_currencies, true);
if (isset($_COOKIE['currency']) && $_COOKIE['currency'] && $adv->foreign_currencies && array_key_exists($_COOKIE['currency'], $foreign_currencies)) {
$adv->currency = $_COOKIE['currency'];
$adv->price = $foreign_currencies[$_COOKIE['currency']];
}
$foreign_currencies = json_decode($adv->foreign_currencies, true);
if (isset($_COOKIE['currency']) && $_COOKIE['currency'] && $adv->foreign_currencies && array_key_exists($_COOKIE['currency'], $foreign_currencies)) {
$adv->currency = $_COOKIE['currency'];
$adv->price = $foreign_currencies[$_COOKIE['currency']];
}
// Check if hide price
$hidePrice = false;
@ -1034,7 +1027,7 @@ class AdvsController extends PublicController
}
$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'));
return redirect('/advs/edit_advs/' . $id);
}
@ -1106,6 +1099,7 @@ class AdvsController extends PublicController
}
return $response;
}
public function stockControl(Request $request, AdvRepositoryInterface $advRepository)
{
$quantity = $request->quantity;

View File

@ -4,7 +4,7 @@
<li>
<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 %}
<img src="{{ categoryIcon }}" alt="{{ main_category.name }}" class="img-responsive">
{% endif %}

View File

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

View File

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

View File

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