mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-24 22:11:01 -06:00
Merge branch 'master' of https://github.com/openclassify/openclassify
This commit is contained in:
commit
94e9198dde
@ -70,7 +70,7 @@ promiseForCategory.then(function (categories_list) {
|
|||||||
function CategoryField(name, level) {
|
function CategoryField(name, level) {
|
||||||
return '<div class="col-12 px-0 py-1 category-select-mobile category-box" data-level="' + level + '">\n' +
|
return '<div class="col-12 px-0 py-1 category-select-mobile category-box" data-level="' + level + '">\n' +
|
||||||
'</span>\n<select data-level="' + level + '" class="form-control cat-select ' + name + '">\n' +
|
'</span>\n<select data-level="' + level + '" class="form-control cat-select ' + name + '">\n' +
|
||||||
'<option> ...</option>' +
|
'<option>'+ catsPlaceholder +'</option>' +
|
||||||
'</select>\n</div>';
|
'</select>\n</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,13 +129,4 @@ $('.set_category').on('click', function () {
|
|||||||
|
|
||||||
$('#filterModal').find('form').attr("action", '/advs/list');
|
$('#filterModal').find('form').attr("action", '/advs/list');
|
||||||
$('#filterModal').modal('toggle');
|
$('#filterModal').modal('toggle');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Move filter on small screen
|
|
||||||
$(window).on("load resize", function () {
|
|
||||||
const width = (window.innerWidth > 0) ? window.innerWidth : screen.width;
|
|
||||||
if (width <= 575) {
|
|
||||||
const detach = $('#listFilterForm').detach();
|
|
||||||
$('#modalListFilterForm').append(detach);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@ -163,7 +163,8 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function getCities(country) {
|
function getCities(country) {
|
||||||
return crudAjax(`id=${country}`, '/ajax/getCities', 'POST', () => {}, true)
|
return crudAjax(`id=${country}`, '/ajax/getCities', 'POST', () => {
|
||||||
|
}, true)
|
||||||
.then(function (cities) {
|
.then(function (cities) {
|
||||||
$('select[name="filter_City"]').html("<option value=''>" + $('select[name=filter_City] option:first-child').text() + "</option>");
|
$('select[name="filter_City"]').html("<option value=''>" + $('select[name=filter_City] option:first-child').text() + "</option>");
|
||||||
$.each(cities, function (index, value) {
|
$.each(cities, function (index, value) {
|
||||||
@ -172,9 +173,10 @@ function getCities(country) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#listFilterForm").submit(function(e) {
|
$("#listFilterForm, #listFilterFormMobile").submit(function (e) {
|
||||||
// Disable unselected inputs
|
// Disable unselected inputs
|
||||||
const inputs = $('#listFilterForm :input');
|
const inputs = $('#' + $(this).attr('id') + ' :input');
|
||||||
|
|
||||||
[...inputs].forEach((input) => {
|
[...inputs].forEach((input) => {
|
||||||
if (input.type === 'checkbox' || input.type === 'radio') {
|
if (input.type === 'checkbox' || input.type === 'radio') {
|
||||||
if ($(input).prop("checked") == false) {
|
if ($(input).prop("checked") == false) {
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
var categories = {};
|
let categories = {}
|
||||||
|
catsPlaceholder = '{{ trans("visiosoft.module.advs::field.categories.name") }}';
|
||||||
</script>
|
</script>
|
||||||
{{ asset_add('scripts.js','visiosoft.module.advs::js/filter_modal.js') }}
|
{{ asset_add('scripts.js','visiosoft.module.advs::js/filter_modal.js') }}
|
||||||
<div class="modal fade" id="filterModal" tabindex="-1" role="dialog" aria-labelledby="filterModal" aria-hidden="true">
|
<div class="modal fade" id="filterModal" tabindex="-1" role="dialog" aria-labelledby="filterModal" aria-hidden="true">
|
||||||
@ -35,7 +36,9 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div id="modalListFilterForm"></div>
|
<div id="modalListFilterForm">
|
||||||
|
{% include 'visiosoft.module.advs::list/partials/list-filter' with {"filter_id": 'listFilterFormMobile'} %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
{% set formHtml %}
|
{% set formHtml %}
|
||||||
<form action="{{ url_route('visiosoft.module.advs::list') }}" method="get" id="listFilterForm" rel="nofollow">
|
<form action="{{ url_route('visiosoft.module.advs::list') }}" method="get" id="{{ (filter_id) ? filter_id : "listFilterForm" }}" rel="nofollow">
|
||||||
{% endset %}
|
{% endset %}
|
||||||
{% set catSlug = null %}
|
{% set catSlug = null %}
|
||||||
{% set citySlug = null %}
|
{% set citySlug = null %}
|
||||||
@ -12,7 +12,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if catSlug %}
|
{% if catSlug %}
|
||||||
{% set formHtml %}
|
{% set formHtml %}
|
||||||
<form action="{{ url_route('adv_list_seo', [catSlug, citySlug]) }}" method="get" id="listFilterForm" rel="nofollow">
|
<form action="{{ url_route('adv_list_seo', [catSlug, citySlug]) }}" method="get" id="{{ (filter_id) ? filter_id : "listFilterForm" }}" rel="nofollow">
|
||||||
{% endset %}
|
{% endset %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ formHtml }}
|
{{ formHtml }}
|
||||||
|
|||||||
@ -9,85 +9,88 @@ use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueReposit
|
|||||||
class OptionConfigurationRepository extends EntryRepository implements OptionConfigurationRepositoryInterface
|
class OptionConfigurationRepository extends EntryRepository implements OptionConfigurationRepositoryInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The entry model.
|
* The entry model.
|
||||||
*
|
*
|
||||||
* @var OptionConfigurationModel
|
* @var OptionConfigurationModel
|
||||||
*/
|
*/
|
||||||
protected $model;
|
protected $model;
|
||||||
protected $advRepository;
|
protected $advRepository;
|
||||||
protected $productOptionsValueRepository;
|
protected $productOptionsValueRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new OptionConfigurationRepository instance.
|
* Create a new OptionConfigurationRepository instance.
|
||||||
*
|
*
|
||||||
* @param OptionConfigurationModel $model
|
* @param OptionConfigurationModel $model
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
OptionConfigurationModel $model,
|
OptionConfigurationModel $model,
|
||||||
AdvRepositoryInterface $advRepository,
|
AdvRepositoryInterface $advRepository,
|
||||||
ProductoptionsValueRepositoryInterface $productoptionsValueRepository
|
ProductoptionsValueRepositoryInterface $productoptionsValueRepository
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$this->model = $model;
|
$this->model = $model;
|
||||||
$this->advRepository = $advRepository;
|
$this->advRepository = $advRepository;
|
||||||
$this->productOptionsValueRepository = $productoptionsValueRepository;
|
$this->productOptionsValueRepository = $productoptionsValueRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createConfigration($ad_id, $price, $currency, $stock, $option_json)
|
public function createConfigration($ad_id, $price, $currency, $stock, $option_json)
|
||||||
{
|
{
|
||||||
return $this->create([
|
return $this->create([
|
||||||
'parent_adv_id' => $ad_id,
|
'parent_adv_id' => $ad_id,
|
||||||
'price' => $price,
|
'price' => $price,
|
||||||
'currency' => $currency,
|
'currency' => $currency,
|
||||||
'stock' => $stock,
|
'stock' => $stock,
|
||||||
'option_json' => $option_json,
|
'option_json' => $option_json,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getConf($ad_id)
|
public function getConf($ad_id)
|
||||||
{
|
{
|
||||||
$adv = $this->advRepository->find($ad_id);
|
$adv = $this->advRepository->find($ad_id);
|
||||||
$configurations = array();
|
$configurations = array();
|
||||||
|
|
||||||
$product_configurations = $this->model->where('stock', '>', '0')->where('parent_adv_id', $ad_id)->get();
|
$product_configurations = $this->model->where('stock', '>', '0')
|
||||||
|
->where('parent_adv_id', $ad_id)
|
||||||
|
->orderBy('created_at', 'ASC')
|
||||||
|
->get();
|
||||||
|
|
||||||
foreach ($product_configurations as $product_configuration) {
|
foreach ($product_configurations as $product_configuration) {
|
||||||
$configurations_item = json_decode($product_configuration->option_json, true);
|
$configurations_item = json_decode($product_configuration->option_json, true);
|
||||||
$option_group_value = "";
|
$option_group_value = "";
|
||||||
foreach ($configurations_item as $option_id => $value) {
|
foreach ($configurations_item as $option_id => $value) {
|
||||||
$value_entry = $this->productOptionsValueRepository->find($value);
|
$value_entry = $this->productOptionsValueRepository->find($value);
|
||||||
$option_group_value .= " " . $value_entry->getName();
|
$option_group_value .= " " . $value_entry->getName();
|
||||||
}
|
}
|
||||||
$configurations[$product_configuration->getId()] = [
|
$configurations[$product_configuration->getId()] = [
|
||||||
'name' => $option_group_value,
|
'name' => $option_group_value,
|
||||||
'price' => $product_configuration->price,
|
'price' => $product_configuration->price,
|
||||||
'currency' => $product_configuration->currency,
|
'currency' => $product_configuration->currency,
|
||||||
'stock' => $product_configuration->stock,
|
'stock' => $product_configuration->stock,
|
||||||
'adv' => $adv->name . ' (' . trim($option_group_value, ' ') . ')',
|
'adv' => $adv->name . ' (' . trim($option_group_value, ' ') . ')',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $configurations;
|
return $configurations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUnusedConfigs()
|
public function getUnusedConfigs()
|
||||||
{
|
{
|
||||||
return $this->newQuery()
|
return $this->newQuery()
|
||||||
->leftJoin('advs_advs as ads', 'advs_option_configuration.parent_adv_id', 'ads.id')
|
->leftJoin('advs_advs as ads', 'advs_option_configuration.parent_adv_id', 'ads.id')
|
||||||
->whereNull('ads.id')
|
->whereNull('ads.id')
|
||||||
->orWhereNotNull('deleted_at')
|
->orWhereNotNull('deleted_at')
|
||||||
->pluck('parent_adv_id')
|
->pluck('parent_adv_id')
|
||||||
->all();
|
->all();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteUnusedConfigs($adsIDs)
|
public function deleteUnusedConfigs($adsIDs)
|
||||||
{
|
{
|
||||||
return $this->newQuery()->whereIn('parent_adv_id', $adsIDs)->delete();
|
return $this->newQuery()->whereIn('parent_adv_id', $adsIDs)->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteAdsConfigs($adID)
|
public function deleteAdsConfigs($adID)
|
||||||
{
|
{
|
||||||
return $this->newQuery()->where('parent_adv_id', $adID)->delete();
|
return $this->newQuery()->where('parent_adv_id', $adID)->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,7 @@ function Locations(cat, level, name) {
|
|||||||
url: "/class/ajax",
|
url: "/class/ajax",
|
||||||
success: function (msg) {
|
success: function (msg) {
|
||||||
$('select[name="' + name + '"]').find('option').remove();
|
$('select[name="' + name + '"]').find('option').remove();
|
||||||
$('select[name="' + name + '"]').append('<option>...</option>');
|
$('select[name="' + name + '"]').append('<option value="">...</option>');
|
||||||
$.each(msg, function (key, value) {
|
$.each(msg, function (key, value) {
|
||||||
$('select[name="' + name + '"]').append('<option value="' + value.id + '">' + value.name + '</option>');
|
$('select[name="' + name + '"]').append('<option value="' + value.id + '">' + value.name + '</option>');
|
||||||
});
|
});
|
||||||
|
|||||||
@ -7,6 +7,7 @@ return [
|
|||||||
'general_setting' => [
|
'general_setting' => [
|
||||||
'title' => 'visiosoft.module.profile::section.general_setting',
|
'title' => 'visiosoft.module.profile::section.general_setting',
|
||||||
'fields' => [
|
'fields' => [
|
||||||
|
'required_district',
|
||||||
'show_my_ads',
|
'show_my_ads',
|
||||||
'upload_avatar',
|
'upload_avatar',
|
||||||
'show_tax_office',
|
'show_tax_office',
|
||||||
|
|||||||
@ -70,4 +70,10 @@ return [
|
|||||||
"education" => "anomaly.field_type.tags",
|
"education" => "anomaly.field_type.tags",
|
||||||
"state_of_education" => "anomaly.field_type.tags",
|
"state_of_education" => "anomaly.field_type.tags",
|
||||||
"profession" => "anomaly.field_type.tags",
|
"profession" => "anomaly.field_type.tags",
|
||||||
|
'required_district' => [
|
||||||
|
'type' => 'anomaly.field_type.boolean',
|
||||||
|
'config' => [
|
||||||
|
'default_value' => false,
|
||||||
|
]
|
||||||
|
],
|
||||||
];
|
];
|
||||||
@ -47,4 +47,7 @@ return [
|
|||||||
'name' => 'Hide Register Type in Profile Page',
|
'name' => 'Hide Register Type in Profile Page',
|
||||||
'instructions' => 'Hides the register type field in the profile edit page.',
|
'instructions' => 'Hides the register type field in the profile edit page.',
|
||||||
],
|
],
|
||||||
|
'required_district' => [
|
||||||
|
'name' => 'Required District'
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -26,7 +26,9 @@ class AdressFormFields
|
|||||||
'city' => [
|
'city' => [
|
||||||
'required' => true,
|
'required' => true,
|
||||||
],
|
],
|
||||||
'district',
|
'district' => [
|
||||||
|
'required' => setting_value( 'visiosoft.module.profile::required_district'),
|
||||||
|
],
|
||||||
'adress_content' => [
|
'adress_content' => [
|
||||||
'required' => true,
|
'required' => true,
|
||||||
],
|
],
|
||||||
|
|||||||
@ -134,8 +134,15 @@ class MyProfileController extends PublicController
|
|||||||
{
|
{
|
||||||
$message = [];
|
$message = [];
|
||||||
|
|
||||||
|
$error_district = false;
|
||||||
|
if (setting_value('visiosoft.module.profile::required_district') and (!$this->request->district or $this->request->district == "")) {
|
||||||
|
$error_district = true;
|
||||||
|
}
|
||||||
|
|
||||||
$error = $form->build()->validate()->getFormErrors()->getMessages();
|
$error = $form->build()->validate()->getFormErrors()->getMessages();
|
||||||
if (!empty($error)) {
|
|
||||||
|
if (!empty($error) or $error_district) {
|
||||||
|
$this->messages->flush();
|
||||||
$message['status'] = "error";
|
$message['status'] = "error";
|
||||||
$message['msg'] = trans('visiosoft.module.profile::message.required_all');
|
$message['msg'] = trans('visiosoft.module.profile::message.required_all');
|
||||||
return $message;
|
return $message;
|
||||||
@ -248,19 +255,19 @@ class MyProfileController extends PublicController
|
|||||||
return response()->json(['status' => 'success', 'data' => $profile]);
|
return response()->json(['status' => 'success', 'data' => $profile]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEducation(Request $request)
|
public function getEducation(Request $request)
|
||||||
{
|
{
|
||||||
$user = $this->userRepository->find(auth()->id());
|
$user = $this->userRepository->find(auth()->id());
|
||||||
$education = EducationModel::all();
|
$education = EducationModel::all();
|
||||||
$educationPart = EducationPartModel::query()->where('education_id', $user->education)->get();
|
$educationPart = EducationPartModel::query()->where('education_id', $user->education)->get();
|
||||||
return response()->json(['user' => $user, 'education' => $education, 'education-part' => $educationPart], 200);
|
return response()->json(['user' => $user, 'education' => $education, 'education-part' => $educationPart], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function changeEducation(Request $request)
|
public function changeEducation(Request $request)
|
||||||
{
|
{
|
||||||
if ($request->info == 'education') {
|
if ($request->info == 'education') {
|
||||||
$education = EducationPartModel::query()->where('education_id', $request->education)->get();
|
$education = EducationPartModel::query()->where('education_id', $request->education)->get();
|
||||||
}
|
}
|
||||||
return response()->json(['data' => $education], 200);
|
return response()->json(['data' => $education], 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user