mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
Merge pull request #617 from openclassify/dia
make tab title clearer and cleaner
This commit is contained in:
commit
f816eac213
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use Anomaly\Streams\Platform\Database\Migration\Migration;
|
||||
|
||||
class VisiosoftModuleAdvsCreateStandardPriceField extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Don't delete stream on rollback
|
||||
* because this isn't creating the
|
||||
* stream only referencing it.
|
||||
*/
|
||||
protected $delete = false;
|
||||
|
||||
/**
|
||||
* Any additional information will
|
||||
* be updated. Slug helps find
|
||||
* the stream to work with for
|
||||
* assignments that follow.
|
||||
*/
|
||||
protected $stream = [
|
||||
'slug' => 'advs',
|
||||
];
|
||||
|
||||
/**
|
||||
* The addon fields.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fields = [
|
||||
'standard_price' => [
|
||||
'type' => 'visiosoft.field_type.decimal',
|
||||
'config' => [
|
||||
'decimal' => 2,
|
||||
'separator' => '.',
|
||||
'point' => ','
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The field's assignment.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $assignments = [
|
||||
'standard_price' => [
|
||||
'required' => true
|
||||
],
|
||||
];
|
||||
|
||||
}
|
||||
@ -3,6 +3,16 @@
|
||||
border-color: #ffc107 #ffc107 #ffc107;
|
||||
}
|
||||
|
||||
.ad-price-standard {
|
||||
color: #f00;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.ad-price-standard-percentage {
|
||||
background-color: #f00;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
/* Pending screen */
|
||||
.pending-screen {
|
||||
background-color: #f2f2f2;
|
||||
@ -13,4 +23,4 @@
|
||||
}
|
||||
.pending-screen p {
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
$(".priceField").inputmask('currency', {
|
||||
$(".priceField, .standard-price-field").inputmask('currency', {
|
||||
rightAlign: true,
|
||||
prefix: "",
|
||||
'groupSeparator': '.',
|
||||
@ -200,7 +200,7 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
$(".priceDecimalField").inputmask('99', {
|
||||
$(".priceDecimalField, .standard-price-decimal-field").inputmask('99', {
|
||||
rightAlign: true,
|
||||
prefix: "",
|
||||
autoUnmask: true,
|
||||
@ -210,11 +210,13 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
$(".priceField, .priceDecimalField").on('change', function () {
|
||||
let price = $(".priceField").val() === "" ? '0' : $(".priceField").val();
|
||||
$(".decimal-price, .whole-price").on('change', function (e) {
|
||||
const parent = e.target.closest('.select-price')
|
||||
let price = $(parent).find('.whole-price').val() === "" ? '0' : $(parent).find('.whole-price').val();
|
||||
price = parseInt(price.replace(/\./g, ''));
|
||||
let decimal = parseInt($(".priceDecimalField").val());
|
||||
$('.priceHidden').find('input').val(parseFloat(price + "." + decimal));
|
||||
let decimal = parseInt($(parent).find('.decimal-price').val());
|
||||
|
||||
$(parent).find('input[type=number]').val(parseFloat(price + "." + decimal));
|
||||
});
|
||||
|
||||
// Add dynamic option creation
|
||||
|
||||
@ -19,6 +19,9 @@ return [
|
||||
'price' => [
|
||||
'name' => 'Price'
|
||||
],
|
||||
'standard_price' => [
|
||||
'name' => 'Standard Price'
|
||||
],
|
||||
'date' => [
|
||||
'name' => 'Date'
|
||||
],
|
||||
|
||||
@ -4,6 +4,10 @@
|
||||
{% include "visiosoft.module.advs::ad-detail/partials/ogdata" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block styles %}
|
||||
{{ asset_style("visiosoft.module.advs::css/detail.css") }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<section id="main" class="clearfix details-page">
|
||||
<div class="container">
|
||||
@ -52,6 +56,5 @@
|
||||
</section>
|
||||
|
||||
{{ asset_add("scripts.js", "visiosoft.module.advs::js/viewed.js") }}
|
||||
{{ asset_add("styles.css", "visiosoft.module.advs::css/detail.css") }}
|
||||
|
||||
{% endblock %}
|
||||
@ -1,5 +1,16 @@
|
||||
<div class="slider-text">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 offered-field offered-row">
|
||||
{% set standardPrice = adv.standard_price.value %}
|
||||
{% if standardPrice %}
|
||||
<div class="d-flex flex-wrap align-items-center">
|
||||
<h3 class="ad-price-standard mr-3 text-truncate">
|
||||
<b>{{ adv.standard_price.currency(null,'currency') }}</b>
|
||||
</h3>
|
||||
<h3 class="ad-price-standard-percentage text-white p-2">
|
||||
<b>%{{ (100 - ((100 * adv.price.value) / adv.standard_price.value))|round(0, 'common') }}</b>
|
||||
</h3>
|
||||
</div>
|
||||
{% endif %}
|
||||
<h3 class="ad-price">
|
||||
<b>{{ adv.price.currency(null,'currency') }}</b>
|
||||
<!-- priceField with Block -->
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-3 pr-0">
|
||||
<a href="{{ url_route('visiosoft.module.advs::view_type',['gallery']) }}"
|
||||
<a href="{{ url_route('visiosoft.module.advs::view_type',['gallery']) }}">
|
||||
class="text-dark d-flex align-items-center justify-content-center">
|
||||
<img src="{{ img('visiosoft.module.advs::images/gallery-icon.svg').url }}" alt="gallery icon" class="mr-1">
|
||||
<small> {{ trans('visiosoft.module.advs::field.gallery') }}</small>
|
||||
|
||||
@ -29,9 +29,9 @@
|
||||
<div class="col-md-4 py-1 px-0">
|
||||
<select name="currency" id="currency" class="form-control">
|
||||
{% for currency in active_currencies %}
|
||||
<option {% if app.request.get('currency') == currency %}
|
||||
selected
|
||||
{% endif %}value="{{ currency }}">{{ currency_symbol(currency) }}</option>
|
||||
<option {{ app.request.get('currency') == currency ? 'selected' }} value="{{ currency }}">
|
||||
{{ currency_symbol(currency) }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@ -59,6 +59,27 @@
|
||||
</div>
|
||||
</div>
|
||||
{{ addBlock('new-ad/fields',{'adv':adv})|raw }}
|
||||
|
||||
<div class="row form-group select-price">
|
||||
<label class="col-sm-2 col-xs-12">
|
||||
{{ form.fields.standard_price.label|raw }}
|
||||
<span class="required">*</span>
|
||||
</label>
|
||||
<div class="col-12 standard-price-hidden d-none">
|
||||
{{ form.fields.standard_price.setAttributes({
|
||||
'required' :true
|
||||
}).input|raw }}
|
||||
</div>
|
||||
{% set standardPriceValue = form.fields.standard_price.value|split('.') %}
|
||||
<div class="col-8 pr-0 col-md-3">
|
||||
<input class="form-control standard-price-field whole-price" value="{{ standardPriceValue|first }}">
|
||||
</div>
|
||||
<div class="col-4 col-md-1">
|
||||
<input class="form-control standard-price-decimal-field decimal-price" placeholder="00" maxlength="2"
|
||||
value="{{ standardPriceValue[1] }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row form-group select-price">
|
||||
<label class="col-sm-2 col-xs-12">
|
||||
{{ form.fields.price.label|raw }}
|
||||
@ -71,10 +92,10 @@
|
||||
</div>
|
||||
{% set PriceValue = form.fields.price.value|split('.') %}
|
||||
<div class="col-8 pr-0 col-md-3">
|
||||
<input class="form-control priceField" value="{{ PriceValue|first }}">
|
||||
<input class="form-control priceField whole-price" value="{{ PriceValue|first }}">
|
||||
</div>
|
||||
<div class="col-4 col-md-1">
|
||||
<input class="form-control priceDecimalField" placeholder="00" maxlength="2"
|
||||
<input class="form-control priceDecimalField decimal-price" placeholder="00" maxlength="2"
|
||||
value="{{ PriceValue[1] }}">
|
||||
</div>
|
||||
<div class="col-sm-3 col-xs-6">
|
||||
|
||||
@ -91,8 +91,10 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
||||
});
|
||||
}
|
||||
}
|
||||
if (!empty($param['country'])) {
|
||||
$query = $query->where('country_id', $param['country']);
|
||||
$country = isset($param['country']) ?
|
||||
$param['country'] : setting_value('visiosoft.module.location::default_country');
|
||||
if ($country) {
|
||||
$query = $query->where('country_id', $country);
|
||||
}
|
||||
if ($city) {
|
||||
$query = $query->where('city', $city->id);
|
||||
|
||||
@ -22,6 +22,9 @@ class AdvFormBuilder extends FormBuilder
|
||||
'price' => [
|
||||
'type' => 'anomaly.field_type.text'
|
||||
],
|
||||
'standard_price' => [
|
||||
'type' => 'anomaly.field_type.text'
|
||||
],
|
||||
'advs_desc',
|
||||
'cat1',
|
||||
'cat2',
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
{% set title = trans(template.meta_title) %}
|
||||
{% set showTitle = template.showTitle is same as(false) ? false : true %}
|
||||
{% if showTitle %}
|
||||
{% set title = setting_value('streams::name', config_get('streams::distribution.name'))~"|"~trans(template.meta_title) %}
|
||||
{% set title = setting_value('streams::name', config_get('streams::distribution.name'))~" | "~trans(template.meta_title) %}
|
||||
{% endif %}
|
||||
{{ title|slice(0,60) }}
|
||||
</title>
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'sitemap_dividing_number' => [
|
||||
"type" => "anomaly.field_type.integer",
|
||||
"config" => [
|
||||
"default_value" => 5000,
|
||||
]
|
||||
],
|
||||
];
|
||||
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'sitemap_dividing_number' => [
|
||||
'name' => 'Sitemap Dividing Number',
|
||||
],
|
||||
];
|
||||
@ -1,9 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
{% for category in categories %}
|
||||
{% for link in sitemapLinks %}
|
||||
<url>
|
||||
<loc>{{ url_route('adv_list_seo', [category.slug]) }}</loc>
|
||||
<lastmod>{{ category.created_at.tz('UTC').toAtomString() }}</lastmod>
|
||||
<loc>{{ link }}</loc>
|
||||
<changefreq>weekly</changefreq>
|
||||
</url>
|
||||
{% endfor %}
|
||||
|
||||
@ -50,14 +50,8 @@ class CategoryRepository extends EntryRepository implements CategoryRepositoryIn
|
||||
|
||||
public function getSubCatById($id)
|
||||
{
|
||||
$orderBy = $this->model->getParentsCount($id) >= 1 ? 'name' : 'sort_order';
|
||||
return $this->model->newQuery()
|
||||
->join('cats_category_translations', 'cats_category.id', '=', 'cats_category_translations.entry_id')
|
||||
->where('cats_category_translations.locale', config('app.locale'))
|
||||
->where('parent_category_id', $id)
|
||||
->where('deleted_at', null)
|
||||
->select('cats_category.*')
|
||||
->orderBy($orderBy)
|
||||
->get();
|
||||
}
|
||||
|
||||
|
||||
@ -2,22 +2,31 @@
|
||||
|
||||
use Anomaly\Streams\Platform\Http\Controller\PublicController;
|
||||
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
|
||||
use Visiosoft\LocationModule\City\Contract\CityRepositoryInterface;
|
||||
|
||||
class SitemapController extends PublicController
|
||||
{
|
||||
|
||||
private $categoryRepository;
|
||||
private $cityRepository;
|
||||
|
||||
public function __construct(CategoryRepositoryInterface $categoryRepository)
|
||||
public function __construct(
|
||||
CategoryRepositoryInterface $categoryRepository,
|
||||
CityRepositoryInterface $cityRepository
|
||||
)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->categoryRepository = $categoryRepository;
|
||||
$this->cityRepository = $cityRepository;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$categoriesCount = $this->categoryRepository->count();
|
||||
$pagesCount = ceil($categoriesCount / 5000);
|
||||
$citiesCount = $this->cityRepository->count();
|
||||
|
||||
$pagesCount = $citiesCount ? $categoriesCount * $citiesCount : $categoriesCount;
|
||||
$pagesCount = ceil($pagesCount / setting_value('visiosoft.module.cats::sitemap_dividing_number'));
|
||||
|
||||
return response()->view('visiosoft.module.cats::sitemap.index', [
|
||||
'pagesCount' => $pagesCount,
|
||||
@ -26,13 +35,44 @@ class SitemapController extends PublicController
|
||||
|
||||
public function categories()
|
||||
{
|
||||
$sitemapDividingNumber = setting_value('visiosoft.module.cats::sitemap_dividing_number');
|
||||
$page = request()->page ?: 1;
|
||||
$skip = $page - 1;
|
||||
|
||||
$categories = $this->categoryRepository->newQuery()->skip(5000 * $skip)->take(5000)->get();
|
||||
$citiesCount = $this->cityRepository->count();
|
||||
if ($citiesCount) {
|
||||
$categoriesCount = $this->categoryRepository->count();
|
||||
|
||||
$takeCategories = $categoriesCount / ($categoriesCount * $citiesCount / $sitemapDividingNumber);
|
||||
|
||||
$categories = $this->categoryRepository
|
||||
->newQuery()
|
||||
->skip($takeCategories * $skip)
|
||||
->take($takeCategories)
|
||||
->get();
|
||||
|
||||
$sitemapLinks = array();
|
||||
$cities = $this->cityRepository->all();
|
||||
foreach ($categories as $category) {
|
||||
foreach ($cities as $city) {
|
||||
$sitemapLinks[] = route('adv_list_seo', [$category->slug, $city->slug]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$categories = $this->categoryRepository
|
||||
->newQuery()
|
||||
->skip($sitemapDividingNumber * $skip)
|
||||
->take($sitemapDividingNumber)
|
||||
->get();
|
||||
|
||||
$sitemapLinks = array();
|
||||
foreach ($categories as $category) {
|
||||
$sitemapLinks[] = route('adv_list_seo', [$category->slug]);
|
||||
}
|
||||
}
|
||||
|
||||
return response()->view('visiosoft.module.cats::sitemap.categories', [
|
||||
'categories' => $categories,
|
||||
'sitemapLinks' => $sitemapLinks,
|
||||
])->header('Content-Type', 'text/xml');
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,14 +3,21 @@
|
||||
<b>
|
||||
<span class="float-left">{{ trans('visiosoft.module.location::field.address.name') }}</span>
|
||||
</b>
|
||||
{% set country = setting_value('visiosoft.module.location::default_country') %}
|
||||
{% if app.request.get('country') %}
|
||||
{% set country = app.request.get('country') %}
|
||||
{% endif %}
|
||||
{% set defaultCountry = setting_value('visiosoft.module.location::default_country') %}
|
||||
{% set selectedCountry = app.request.get('country') %}
|
||||
<a href="#" class="a-sahibinden-type selected-country filter-country-btn float-right">
|
||||
<small>{{ getCountry(country).name }}</small>
|
||||
{% set countryValue = '' %}
|
||||
{% if selectedCountry %}
|
||||
{% set countryName = getCountry(selectedCountry).name %}
|
||||
{% set countryValue = defaultCountry == selectedCountry ? '' : selectedCountry %}
|
||||
{% elseif defaultCountry %}
|
||||
{% set countryName = getCountry(defaultCountry).name %}
|
||||
{% else %}
|
||||
{% set countryName = trans("visiosoft.module.location::field.country.name") %}
|
||||
{% endif %}
|
||||
<small>{{ countryName }}</small>
|
||||
</a>
|
||||
<input name="country" value="{{ country }}" type="hidden">
|
||||
<input name="country" value="{{ countryValue }}" type="hidden">
|
||||
</div>
|
||||
<div class="col-12 px-0 py-1">
|
||||
<button type="button" class="btn btn-default border border-1 w-100 filter-city-btn" data-toggle="modal"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user