Merge branch 'fatihalp' of https://github.com/openclassify/openclassify into fatihalp

This commit is contained in:
vedatakd 2021-03-29 18:09:06 +03:00
commit 2c72899729
26 changed files with 297 additions and 121 deletions

View File

@ -173,6 +173,7 @@ return [
'type' => 'anomaly.field_type.checkboxes',
'required' => true,
'config' => [
'mode' => 'tags',
'default_value' => function () {
return [config('streams::currencies.default')];
},

View File

@ -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);
}
});
});

View File

@ -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) {

View File

@ -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>

View File

@ -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 }}

View File

@ -1,4 +1,14 @@
{% if setting_value('visiosoft.module.advs::hide_price_filter') == false %}
{% set hidePriceCats = setting_value('visiosoft.module.advs::hide_price_categories') %}
{% set cats = entries('cats','category').whereIn('id', hidePriceCats).get() %}
{% set isHidden = false %}
{% for cat in cats %}
{% if request().segment(2) == cat.slug %}
{% set isHidden = true %}
{% endif %}
{% endfor %}
{% if setting_value('visiosoft.module.advs::hide_price_filter') == false and not isHidden%}
<div class="card mb-3">
<div class="card-header breadcrumb mb-0" id="priceHeading">
<h5 class="mb-0">
@ -41,4 +51,4 @@
</div>
</div>
</div>
{% endif %}
{% endif %}

View File

@ -103,11 +103,13 @@
</div>
{% set PriceValue = form.fields.price.value|split('.') %}
<div class="col-6 col-sm-7 pr-0 col-md-3">
<input class="form-control priceField whole-price" value="{{ PriceValue|first }}">
<input class="form-control priceField whole-price"
value="{{ PriceValue|first }}">
</div>
{% if setting_value('visiosoft.field_type.decimal::showDecimal') %}
<div class="col-4 col-md-1">
<input class="form-control priceDecimalField decimal-price" placeholder="00" maxlength="2"
<input class="form-control priceDecimalField decimal-price" placeholder="00"
maxlength="2"
value="{{ PriceValue[1] }}">
</div>
{% endif %}
@ -135,11 +137,13 @@
{{ trans('visiosoft.module.advs::field.options') }}
</label>
<div class="col-sm-10">
<select id="selectOptions" class="form-control options-tags" multiple="multiple"
<select id="selectOptions" class="form-control options-tags"
multiple="multiple"
name="options[]">
{% if count(options) %}
{% for option in options %}
<option id="advOption{{ option.id }}" selected="selected">{{ option.name }}</option>
<option id="advOption{{ option.id }}"
selected="selected">{{ option.name }}</option>
{% endfor %}
{% endif %}
</select>
@ -177,25 +181,28 @@
<div class="row form-group images">
<div class="col-md-12">
{{ form.fields.files.input |raw }}
<input name="doc_files" value="{{ form.fields.doc_files.value.pluck('id').all()|join(',') }}" hidden>
<input name="doc_files"
value="{{ form.fields.doc_files.value.pluck('id').all()|join(',') }}"
hidden>
<div class="doc_list small">
{% for docs in form.fields.doc_files.value %}
<a id="{{ docs.id }}" href="javascript:void(0)" onclick="deleteDocs({{ docs.id }})" class="text-dark">
{{ docs.name }}
<i class="fa fa-trash text-danger pl-2"></i>
</a><br>
<a id="{{ docs.id }}" href="javascript:void(0)"
onclick="deleteDocs({{ docs.id }})" class="text-dark">
{{ docs.name }}
<i class="fa fa-trash text-danger pl-2"></i>
</a><br>
{% endfor %}
</div>
</div>
</div>
</div>
{% if custom_fields and count(custom_fields) %}
{% set other_fields = addBlock('new-ad/other-fields',{'custom_fields':custom_fields}) %}
{% if other_fields or (custom_fields and count(custom_fields)) %}
<h5 class="mt-5 pb-1 border-bottom">
{{ trans('visiosoft.module.advs::field.additional_fields') }}
</h5>
<div class="bg-light p-4">
{{ addBlock('new-ad/other-fields',{'custom_fields':custom_fields})|raw }}
{{ other_fields|raw }}
</div>
{% endif %}

View File

@ -96,7 +96,7 @@ class AdvCriteria extends EntryCriteria
public function getCurrentLocale()
{
return locale_get_display_name(config('app.locale'));
return trans('streams::locale.' . config('app.locale') . '.name');
}
public function isEnabled($slug)

View File

@ -320,6 +320,7 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
'mime_type' => $image->mime,
'extension' => $image->extension,
]);
}
$coverPhoto = 'files/images/' . $fileName;
} else {

View File

@ -22,12 +22,16 @@ class AdvTableColumns
'wrapper' => '
<strong><span class="text-muted">#{value.id}</span>{value.name}</strong>
<br>
<small class="text-muted">{value.finish_at}</small>
<small class="text-muted">{value.date}</small>
<br>
<span>{value.category}</span>',
'value' => [
'id' => 'entry.id',
'finish_at' => 'entry.finish_at',
'date' => function(EntryInterface $entry){
$created_at = ($entry['created_at']) ?date_format($entry['created_at'], 'd.m.Y H:i'): '';
$finish_at = ($entry['finish_at']) ? date_format($entry['finish_at'], 'd.m.Y H:i'): '';
return $created_at . ' <i class="fa fa-angle-right"></i> ' . $finish_at;
},
'name' => function (EntryInterface $entry) {
if ($entry->getTitle()) {
$value = "<a href='" . $entry->getAdvDetailLinkByModel($entry, 'list') . "' > {entry.name}</a > ";

View File

@ -24,6 +24,7 @@ use Visiosoft\AdvsModule\Adv\Event\ViewAd;
use Visiosoft\AdvsModule\Adv\Form\AdvFormBuilder;
use Visiosoft\AdvsModule\Option\Contract\OptionRepositoryInterface;
use Visiosoft\AdvsModule\OptionConfiguration\Contract\OptionConfigurationRepositoryInterface;
use Visiosoft\AdvsModule\OptionConfiguration\OptionConfigurationModel;
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
use Visiosoft\CatsModule\Category\CategoryModel;

View File

@ -1,10 +1,8 @@
<?php namespace Visiosoft\AdvsModule\OptionConfiguration;
use Visiosoft\AdvsModule\Adv\AdvModel;
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
use Visiosoft\AdvsModule\OptionConfiguration\Contract\OptionConfigurationInterface;
use Anomaly\Streams\Platform\Model\Advs\AdvsOptionConfigurationEntryModel;
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
class OptionConfigurationModel extends AdvsOptionConfigurationEntryModel implements OptionConfigurationInterface
@ -24,4 +22,20 @@ class OptionConfigurationModel extends AdvsOptionConfigurationEntryModel impleme
return $adv->name . ' | ' . trim($option_group_value, ' ');
}
}
public function stockControl($id, $quantity)
{
$conf = $this->newQuery()->find($id);
$stock = $conf->stock;
if ($stock === NULL || $stock === 0) {
return 0;
}
if ($stock < $quantity) {
return 0;
}
return 1;
}
}

View File

@ -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();
}
}

View File

@ -31,4 +31,16 @@ if (!function_exists('auth_id_if_null'))
function auth_id_if_null($userId) {
return $userId ?: auth()->id();
}
}
if (!function_exists('replace_to_text'))
{
function replace_to_text($content, $array)
{
foreach ($array as $key => $value) {
$content = str_replace('${' . $key . '}', $value, $content);
}
return $content;
}
}

View File

@ -20,4 +20,26 @@ class CategoryModel extends CatsCategoryEntryModel implements CategoryInterface
{
return $this->parent_category;
}
public function getMains($id)
{
$categories = array();
$z = 1;
for ($i = 1; $i <= $z; $i++) {
if ($main = $this->newQuery()->where('id', $id)->first()) {
$new = array();
$new['id'] = $main->id;
$new['val'] = $main->name;
$new['slug'] = $main->slug;
$categories[] = $new;
if ($main->parent_category_id != null) {
$id = $main->parent_category_id;
$z++;
}
}
}
$categories = array_reverse($categories);
unset($categories[count($categories) - 1]);
return $categories;
}
}

View File

@ -9,4 +9,6 @@ interface CategoryInterface extends EntryInterface
public function getMetaDescription();
public function getParent();
public function getMains($id);
}

View File

@ -0,0 +1,62 @@
<tfoot>
{% if table.actions|length or table.data.pagination.links|length %}
<tr>
<th colspan="100%" style="padding: 10px;">
<div class="pull-left actions table__actions">
{{ buttons(table.actions)|raw }}
</div>
{% if table.data.pagination.links|length %}
<div class="pull-right">
<select onchange="window.location=this.value;"
class="custom-select table-limit">
<option {{ table.options.limit == 5 ? 'selected' }}
value="{{ url_current() }}?{{ http_build_query({(table.options.prefix ~ 'limit'): 5} + request_query()) }}">
5 {{ trans('streams::message.results') }}</option>
<option {{ table.options.limit == 10 ? 'selected' }}
value="{{ url_current() }}?{{ http_build_query({(table.options.prefix ~ 'limit'): 10} + request_query()) }}">
10 {{ trans('streams::message.results') }}</option>
<option {{ table.options.limit == 15 ? 'selected' }}
value="{{ url_current() }}?{{ http_build_query({(table.options.prefix ~ 'limit'): 15} + request_query()) }}">
15 {{ trans('streams::message.results') }}</option>
<option {{ table.options.limit == 25 ? 'selected' }}
value="{{ url_current() }}?{{ http_build_query({(table.options.prefix ~ 'limit'): 25} + request_query()) }}">
25 {{ trans('streams::message.results') }}</option>
<option {{ table.options.limit == 50 ? 'selected' }}
value="{{ url_current() }}?{{ http_build_query({(table.options.prefix ~ 'limit'): 50} + request_query()) }}">
50 {{ trans('streams::message.results') }}</option>
<option {{ table.options.limit == 75 ? 'selected' }}
value="{{ url_current() }}?{{ http_build_query({(table.options.prefix ~ 'limit'): 75} + request_query()) }}">
75 {{ trans('streams::message.results') }}</option>
<option {{ table.options.limit == 100 ? 'selected' }}
value="{{ url_current() }}?{{ http_build_query({(table.options.prefix ~ 'limit'): 100} + request_query()) }}">
100 {{ trans('streams::message.results') }}</option>
<option {{ table.options.limit == 150 ? 'selected' }}
value="{{ url_current() }}?{{ http_build_query({(table.options.prefix ~ 'limit'): 150} + request_query()) }}">
150 {{ trans('streams::message.results') }}</option>
<option {{ table.options.limit == 1000 ? 'selected' }}
value="{{ url_current() }}?{{ http_build_query({(table.options.prefix ~ 'limit'): 1000} + request_query()) }}">
{{ trans('streams::message.show_all') }}</option>
</select>
{{ table.data.pagination.links|raw }}
</div>
{% endif %}
<div style="clear: both;"></div>
</th>
</tr>
{% endif %}
{% if table.options.total_results %}
<tr>
<td colspan="100%">
<small class="text-muted pull-right">
{{ table.options.total_results }} {{ trans('streams::message.results') }}
</small>
</td>
</tr>
{% endif %}
</tfoot>

View File

@ -27,6 +27,10 @@ class DefaultadminThemeServiceProvider extends AddonServiceProvider
],
];
protected $overrides = [
'streams::table/partials/footer' => 'visiosoft.theme.defaultadmin::table/partials/footer'
];
public function register()
{
AbstractPaginator::$defaultView = 'visiosoft.theme.defaultadmin::pagination/bootstrap-4';

View File

@ -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>');
});

View File

@ -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',

View File

@ -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,
]
],
];

View File

@ -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'
],
];

View File

@ -26,7 +26,9 @@ class AdressFormFields
'city' => [
'required' => true,
],
'district',
'district' => [
'required' => setting_value( 'visiosoft.module.profile::required_district'),
],
'adress_content' => [
'required' => true,
],

View File

@ -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);
}
}

View File

@ -180,6 +180,17 @@ class Loader extends FileLoader
$lines = array_replace_recursive($lines, $this->files->getRequire($file));
}
}
//Override System
$override_list = config('streams::translate.override');
foreach ($override_list as $override) {
$override = explode(':', $override);
if (count($override) > 1) {
$lines = $this->findArrayValue($override[0], $override[1], $lines);
}
}
if (config()->has('override_text')) {
foreach (config()->get('override_text') as $override) {
$override = explode(':', $override);

View File

@ -0,0 +1,7 @@
<?php
return [
'override' => [
'Sümüklüböcek:Benzersiz İsim',
],
];