mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -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) {
|
||||
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' +
|
||||
'<option> ...</option>' +
|
||||
'<option>'+ catsPlaceholder +'</option>' +
|
||||
'</select>\n</div>';
|
||||
}
|
||||
|
||||
@ -129,13 +129,4 @@ $('.set_category').on('click', function () {
|
||||
|
||||
$('#filterModal').find('form').attr("action", '/advs/list');
|
||||
$('#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) {
|
||||
return crudAjax(`id=${country}`, '/ajax/getCities', 'POST', () => {}, true)
|
||||
return crudAjax(`id=${country}`, '/ajax/getCities', 'POST', () => {
|
||||
}, true)
|
||||
.then(function (cities) {
|
||||
$('select[name="filter_City"]').html("<option value=''>" + $('select[name=filter_City] option:first-child').text() + "</option>");
|
||||
$.each(cities, function (index, value) {
|
||||
@ -172,9 +173,10 @@ function getCities(country) {
|
||||
})
|
||||
}
|
||||
|
||||
$("#listFilterForm").submit(function(e) {
|
||||
$("#listFilterForm, #listFilterFormMobile").submit(function (e) {
|
||||
// Disable unselected inputs
|
||||
const inputs = $('#listFilterForm :input');
|
||||
const inputs = $('#' + $(this).attr('id') + ' :input');
|
||||
|
||||
[...inputs].forEach((input) => {
|
||||
if (input.type === 'checkbox' || input.type === 'radio') {
|
||||
if ($(input).prop("checked") == false) {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<script>
|
||||
var categories = {};
|
||||
let categories = {}
|
||||
catsPlaceholder = '{{ trans("visiosoft.module.advs::field.categories.name") }}';
|
||||
</script>
|
||||
{{ 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">
|
||||
@ -35,7 +36,9 @@
|
||||
{% endif %}
|
||||
</a>
|
||||
</div>
|
||||
<div id="modalListFilterForm"></div>
|
||||
<div id="modalListFilterForm">
|
||||
{% include 'visiosoft.module.advs::list/partials/list-filter' with {"filter_id": 'listFilterFormMobile'} %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{% 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 %}
|
||||
{% set catSlug = null %}
|
||||
{% set citySlug = null %}
|
||||
@ -12,7 +12,7 @@
|
||||
{% endif %}
|
||||
{% if catSlug %}
|
||||
{% 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 %}
|
||||
{% endif %}
|
||||
{{ formHtml }}
|
||||
|
||||
@ -9,85 +9,88 @@ use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueReposit
|
||||
class OptionConfigurationRepository extends EntryRepository implements OptionConfigurationRepositoryInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* The entry model.
|
||||
*
|
||||
* @var OptionConfigurationModel
|
||||
*/
|
||||
protected $model;
|
||||
protected $advRepository;
|
||||
protected $productOptionsValueRepository;
|
||||
/**
|
||||
* The entry model.
|
||||
*
|
||||
* @var OptionConfigurationModel
|
||||
*/
|
||||
protected $model;
|
||||
protected $advRepository;
|
||||
protected $productOptionsValueRepository;
|
||||
|
||||
/**
|
||||
* Create a new OptionConfigurationRepository instance.
|
||||
*
|
||||
* @param OptionConfigurationModel $model
|
||||
*/
|
||||
public function __construct(
|
||||
OptionConfigurationModel $model,
|
||||
AdvRepositoryInterface $advRepository,
|
||||
ProductoptionsValueRepositoryInterface $productoptionsValueRepository
|
||||
)
|
||||
{
|
||||
$this->model = $model;
|
||||
$this->advRepository = $advRepository;
|
||||
$this->productOptionsValueRepository = $productoptionsValueRepository;
|
||||
}
|
||||
/**
|
||||
* Create a new OptionConfigurationRepository instance.
|
||||
*
|
||||
* @param OptionConfigurationModel $model
|
||||
*/
|
||||
public function __construct(
|
||||
OptionConfigurationModel $model,
|
||||
AdvRepositoryInterface $advRepository,
|
||||
ProductoptionsValueRepositoryInterface $productoptionsValueRepository
|
||||
)
|
||||
{
|
||||
$this->model = $model;
|
||||
$this->advRepository = $advRepository;
|
||||
$this->productOptionsValueRepository = $productoptionsValueRepository;
|
||||
}
|
||||
|
||||
public function createConfigration($ad_id, $price, $currency, $stock, $option_json)
|
||||
{
|
||||
return $this->create([
|
||||
'parent_adv_id' => $ad_id,
|
||||
'price' => $price,
|
||||
'currency' => $currency,
|
||||
'stock' => $stock,
|
||||
'option_json' => $option_json,
|
||||
]);
|
||||
}
|
||||
public function createConfigration($ad_id, $price, $currency, $stock, $option_json)
|
||||
{
|
||||
return $this->create([
|
||||
'parent_adv_id' => $ad_id,
|
||||
'price' => $price,
|
||||
'currency' => $currency,
|
||||
'stock' => $stock,
|
||||
'option_json' => $option_json,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getConf($ad_id)
|
||||
{
|
||||
$adv = $this->advRepository->find($ad_id);
|
||||
$configurations = array();
|
||||
public function getConf($ad_id)
|
||||
{
|
||||
$adv = $this->advRepository->find($ad_id);
|
||||
$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) {
|
||||
$configurations_item = json_decode($product_configuration->option_json, true);
|
||||
$option_group_value = "";
|
||||
foreach ($configurations_item as $option_id => $value) {
|
||||
$value_entry = $this->productOptionsValueRepository->find($value);
|
||||
$option_group_value .= " " . $value_entry->getName();
|
||||
}
|
||||
$configurations[$product_configuration->getId()] = [
|
||||
'name' => $option_group_value,
|
||||
'price' => $product_configuration->price,
|
||||
'currency' => $product_configuration->currency,
|
||||
'stock' => $product_configuration->stock,
|
||||
'adv' => $adv->name . ' (' . trim($option_group_value, ' ') . ')',
|
||||
];
|
||||
}
|
||||
foreach ($product_configurations as $product_configuration) {
|
||||
$configurations_item = json_decode($product_configuration->option_json, true);
|
||||
$option_group_value = "";
|
||||
foreach ($configurations_item as $option_id => $value) {
|
||||
$value_entry = $this->productOptionsValueRepository->find($value);
|
||||
$option_group_value .= " " . $value_entry->getName();
|
||||
}
|
||||
$configurations[$product_configuration->getId()] = [
|
||||
'name' => $option_group_value,
|
||||
'price' => $product_configuration->price,
|
||||
'currency' => $product_configuration->currency,
|
||||
'stock' => $product_configuration->stock,
|
||||
'adv' => $adv->name . ' (' . trim($option_group_value, ' ') . ')',
|
||||
];
|
||||
}
|
||||
|
||||
return $configurations;
|
||||
}
|
||||
return $configurations;
|
||||
}
|
||||
|
||||
public function getUnusedConfigs()
|
||||
{
|
||||
return $this->newQuery()
|
||||
public function getUnusedConfigs()
|
||||
{
|
||||
return $this->newQuery()
|
||||
->leftJoin('advs_advs as ads', 'advs_option_configuration.parent_adv_id', 'ads.id')
|
||||
->whereNull('ads.id')
|
||||
->orWhereNotNull('deleted_at')
|
||||
->pluck('parent_adv_id')
|
||||
->all();
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteUnusedConfigs($adsIDs)
|
||||
{
|
||||
return $this->newQuery()->whereIn('parent_adv_id', $adsIDs)->delete();
|
||||
}
|
||||
public function deleteUnusedConfigs($adsIDs)
|
||||
{
|
||||
return $this->newQuery()->whereIn('parent_adv_id', $adsIDs)->delete();
|
||||
}
|
||||
|
||||
public function deleteAdsConfigs($adID)
|
||||
{
|
||||
return $this->newQuery()->where('parent_adv_id', $adID)->delete();
|
||||
}
|
||||
public function deleteAdsConfigs($adID)
|
||||
{
|
||||
return $this->newQuery()->where('parent_adv_id', $adID)->delete();
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ function Locations(cat, level, name) {
|
||||
url: "/class/ajax",
|
||||
success: function (msg) {
|
||||
$('select[name="' + name + '"]').find('option').remove();
|
||||
$('select[name="' + name + '"]').append('<option>...</option>');
|
||||
$('select[name="' + name + '"]').append('<option value="">...</option>');
|
||||
$.each(msg, function (key, value) {
|
||||
$('select[name="' + name + '"]').append('<option value="' + value.id + '">' + value.name + '</option>');
|
||||
});
|
||||
|
||||
@ -7,6 +7,7 @@ return [
|
||||
'general_setting' => [
|
||||
'title' => 'visiosoft.module.profile::section.general_setting',
|
||||
'fields' => [
|
||||
'required_district',
|
||||
'show_my_ads',
|
||||
'upload_avatar',
|
||||
'show_tax_office',
|
||||
|
||||
@ -70,4 +70,10 @@ return [
|
||||
"education" => "anomaly.field_type.tags",
|
||||
"state_of_education" => "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',
|
||||
'instructions' => 'Hides the register type field in the profile edit page.',
|
||||
],
|
||||
'required_district' => [
|
||||
'name' => 'Required District'
|
||||
],
|
||||
];
|
||||
|
||||
@ -26,7 +26,9 @@ class AdressFormFields
|
||||
'city' => [
|
||||
'required' => true,
|
||||
],
|
||||
'district',
|
||||
'district' => [
|
||||
'required' => setting_value( 'visiosoft.module.profile::required_district'),
|
||||
],
|
||||
'adress_content' => [
|
||||
'required' => true,
|
||||
],
|
||||
|
||||
@ -134,8 +134,15 @@ class MyProfileController extends PublicController
|
||||
{
|
||||
$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();
|
||||
if (!empty($error)) {
|
||||
|
||||
if (!empty($error) or $error_district) {
|
||||
$this->messages->flush();
|
||||
$message['status'] = "error";
|
||||
$message['msg'] = trans('visiosoft.module.profile::message.required_all');
|
||||
return $message;
|
||||
@ -248,19 +255,19 @@ class MyProfileController extends PublicController
|
||||
return response()->json(['status' => 'success', 'data' => $profile]);
|
||||
}
|
||||
|
||||
public function getEducation(Request $request)
|
||||
{
|
||||
$user = $this->userRepository->find(auth()->id());
|
||||
$education = EducationModel::all();
|
||||
$educationPart = EducationPartModel::query()->where('education_id', $user->education)->get();
|
||||
return response()->json(['user' => $user, 'education' => $education, 'education-part' => $educationPart], 200);
|
||||
}
|
||||
public function getEducation(Request $request)
|
||||
{
|
||||
$user = $this->userRepository->find(auth()->id());
|
||||
$education = EducationModel::all();
|
||||
$educationPart = EducationPartModel::query()->where('education_id', $user->education)->get();
|
||||
return response()->json(['user' => $user, 'education' => $education, 'education-part' => $educationPart], 200);
|
||||
}
|
||||
|
||||
public function changeEducation(Request $request)
|
||||
{
|
||||
if ($request->info == 'education') {
|
||||
$education = EducationPartModel::query()->where('education_id', $request->education)->get();
|
||||
}
|
||||
return response()->json(['data' => $education], 200);
|
||||
}
|
||||
public function changeEducation(Request $request)
|
||||
{
|
||||
if ($request->info == 'education') {
|
||||
$education = EducationPartModel::query()->where('education_id', $request->education)->get();
|
||||
}
|
||||
return response()->json(['data' => $education], 200);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user