mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
Merge pull request #120 from openclassify/vedat
create edit category page && edited controller function
This commit is contained in:
commit
8f9ed8e5f7
@ -0,0 +1,34 @@
|
||||
.cat-select {
|
||||
width: 100%;
|
||||
border: none;
|
||||
overflow-y: auto
|
||||
}
|
||||
|
||||
.cat-select option {
|
||||
border-top: 1px solid #f2f2f2;
|
||||
padding: 15px 0 20px;
|
||||
position: relative;
|
||||
padding-left: 10px;
|
||||
font-size: 16px;
|
||||
color: #505050;
|
||||
}
|
||||
|
||||
.cat-item-2 {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.cat-item-3 {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.cat-item-3 .section {
|
||||
min-height: 320px;
|
||||
}
|
||||
|
||||
.btn-1 {
|
||||
background-color: #00a651;
|
||||
padding: 5px 50px 7px;
|
||||
color: #fff;
|
||||
border: 1px solid #dadada;
|
||||
margin-right: 5px;
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
$(document).ready(function () {
|
||||
$('select[name="cat1"], select[name="cat2"], select[name="cat3"], ' +
|
||||
'select[name="cat4"], select[name="cat5"], select[name="cat6"], select[name="cat7"]').on('change', function () {
|
||||
var all = $(this).val();
|
||||
$(this).val(all[all.length-1])
|
||||
})
|
||||
|
||||
const filter = {};
|
||||
filter.getCats = (catId, divId) => {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '/ajax/getcats/'+ divId,
|
||||
success: function (response) {
|
||||
if(response.length <= 0){
|
||||
$('.cat-item-3').show();
|
||||
stop();
|
||||
}
|
||||
else {
|
||||
response.forEach(function(options){
|
||||
$(catId).append("<option value="+options.id+">"+options.name+"</option>").closest('.cat-item-2').show();
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
filter.hideCats = (num) => {
|
||||
var startNo = num;
|
||||
var endNo = 6;
|
||||
|
||||
while (startNo <= endNo) {
|
||||
$('#cat'+ startNo).html("").closest('.cat-item-2').hide();
|
||||
$('.cat-item-3').hide();
|
||||
startNo++;
|
||||
}
|
||||
};
|
||||
|
||||
for (var i = 1; i <= 6; i++) {
|
||||
(function(){
|
||||
var ii = i;
|
||||
$('#cat'+i).on('change', function (i,e) {
|
||||
divId = $(this).find('option:selected').val();
|
||||
if (divId == 0) {
|
||||
filter.hideCats(ii+1);
|
||||
}
|
||||
filter.hideCats(ii+1);
|
||||
filter.getCats("#cat"+(ii+1), divId);
|
||||
});
|
||||
})();
|
||||
}
|
||||
|
||||
});
|
||||
@ -21,4 +21,7 @@ return [
|
||||
'sub_neighborhoods' => 'Sub Neighborhoods',
|
||||
'sub_village' => 'Sub Village',
|
||||
'general_settings' => 'General Settings',
|
||||
'update_category' => [
|
||||
'name' => 'Update Category'
|
||||
],
|
||||
];
|
||||
|
||||
@ -140,7 +140,7 @@ return [
|
||||
'share' => 'Share this ad',
|
||||
'report' => 'Report this ad',
|
||||
'features' => 'Features',
|
||||
"streetview" =>"Street View",
|
||||
"streetview" => "Street View",
|
||||
'recommended_ads' => 'Recommended Ads for You',
|
||||
'new' => 'New',
|
||||
'short_info' => 'Short Info',
|
||||
@ -216,4 +216,5 @@ return [
|
||||
'sold_out' => [
|
||||
'name' => 'Sold out',
|
||||
],
|
||||
'edit_category' => 'Edit Category',
|
||||
];
|
||||
|
||||
@ -5,6 +5,8 @@ return [
|
||||
'please_buy_package' => 'Please buy package',
|
||||
'please_payment' => 'Please Pay',
|
||||
'bank_account_info' => 'Bank account information',
|
||||
'agreement' =>'By clicking Post, you agree to our Terms of Use and Privacy Policy acknowledge that you are the rightful owner of this item.'
|
||||
'agreement' => 'By clicking Post, you agree to our Terms of Use and Privacy Policy acknowledge that you are the rightful owner of this item.',
|
||||
'update_category_msg' => 'The classified category will be updated.',
|
||||
'updated_category_msg' => 'Category successfully edited.',
|
||||
|
||||
];
|
||||
|
||||
@ -20,5 +20,8 @@ return[
|
||||
"sub_districts" =>"Alt Bölgeler",
|
||||
"sub_neighborhoods" =>"Alt Mahalleler",
|
||||
"sub_village" =>"Alt Köy",
|
||||
"general_settings" =>"Genel Ayarlar"
|
||||
"general_settings" =>"Genel Ayarlar",
|
||||
'update_category' => [
|
||||
'name' => 'Kategori Güncelle'
|
||||
],
|
||||
];
|
||||
@ -265,5 +265,6 @@ return [
|
||||
'sold_out' => [
|
||||
'name' => 'Tükendi',
|
||||
],
|
||||
'edit_category' => 'Kategori Düzenle',
|
||||
|
||||
];
|
||||
@ -5,6 +5,7 @@ return [
|
||||
"please_buy_package" => "Lütfen paket satın al",
|
||||
'please_payment' => 'Lütfen Ödeme Yapınız',
|
||||
'bank_account_info' => 'Banka Hesap Bilgilerimiz',
|
||||
'agreement' =>'Yayınla\'yı tıkladığınızda, Kullanım Koşulları ve Gizlilik Politikasını kabul etmiş olursunuz, bu öğenin hak sahibi olduğunuzu kabul edersiniz.'
|
||||
|
||||
'agreement' => 'Yayınla\'yı tıkladığınızda, Kullanım Koşulları ve Gizlilik Politikasını kabul etmiş olursunuz, bu öğenin hak sahibi olduğunuzu kabul edersiniz.',
|
||||
'update_category_msg' => 'İlan kategorisi güncellenecektir.',
|
||||
'updated_category_msg' => 'Kategori başarıyla güncellendi.',
|
||||
];
|
||||
@ -0,0 +1,113 @@
|
||||
{% extends "theme::layouts/default" %}
|
||||
{% block content %}
|
||||
<section id="main" class="clearfix ad-post-page">
|
||||
<div class="container">
|
||||
<div class="breadcrumb-section">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="/">{{ trans('visiosoft.module.advs::field.home') }}</a></li>
|
||||
<li>{{ adDetail(id).name }}</li>
|
||||
<li>{{ trans('visiosoft.module.advs::field.edit_category') }}</li>
|
||||
</ol>
|
||||
<h2 class="title">{{ trans('visiosoft.module.advs::field.home') }}</h2>
|
||||
</div>
|
||||
|
||||
<div id="ad-cat-section">
|
||||
<form action="{{ url_route('adv::edit_category',[id]) }}" method="post">
|
||||
<input type="hidden" name="id" value="{{ id }}">
|
||||
<div class="row category-tab">
|
||||
<div class="col-md-3 col-sm-6 cat-item">
|
||||
<div class="section cat-option select-category post-option">
|
||||
<h4>{{ trans('visiosoft.module.advs::field.select_a_category') }}</h4>
|
||||
<ul role="tablist">
|
||||
<select class="cat-select" name="cat1" id="cat1" multiple id="">
|
||||
{% for cat in main_cats %}
|
||||
<option value="{{ cat.id }}"><span
|
||||
style="font-size: 20px">{{ cat.name }}</span></option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6 cat-item cat-item-2">
|
||||
<div class="section cat-option select-category post-option">
|
||||
<h4>{{ trans('visiosoft.module.advs::field.select_a_sub_category') }}</h4>
|
||||
<ul role="tablist">
|
||||
<select class="cat-select" name="cat2" id="cat2" multiple id="">
|
||||
|
||||
</select>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6 cat-item cat-item-2">
|
||||
<div class="section cat-option select-category post-option">
|
||||
<h4>{{ trans('visiosoft.module.advs::field.select_a_sub_category') }}</h4>
|
||||
<ul role="tablist">
|
||||
<select class="cat-select" name="cat3" id="cat3" multiple id="">
|
||||
|
||||
</select>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6 cat-item cat-item-2">
|
||||
<div class="section cat-option select-category post-option">
|
||||
<h4>{{ trans('visiosoft.module.advs::field.select_a_sub_category') }}</h4>
|
||||
<ul role="tablist">
|
||||
<select class="cat-select" name="cat4" id="cat4" multiple id="">
|
||||
|
||||
</select>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6 cat-item cat-item-2">
|
||||
<div class="section cat-option select-category post-option">
|
||||
<h4>{{ trans('visiosoft.module.advs::field.select_a_sub_category') }}</h4>
|
||||
<ul role="tablist">
|
||||
<select class="cat-select" name="cat5" id="cat5" multiple id="">
|
||||
|
||||
</select>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6 cat-item cat-item-2">
|
||||
<div class="section cat-option select-category post-option">
|
||||
<h4>{{ trans('visiosoft.module.advs::field.select_a_sub_category') }}</h4>
|
||||
<ul role="tablist">
|
||||
<select class="cat-select" name="cat6" id="cat6" multiple id="">
|
||||
|
||||
</select>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6 cat-item cat-item-2">
|
||||
<div class="section cat-option select-category post-option">
|
||||
<h4>{{ trans('visiosoft.module.advs::field.select_a_sub_category') }}</h4>
|
||||
<ul role="tablist">
|
||||
<select class="cat-select" name="cat7" id="cat7" multiple id="">
|
||||
|
||||
</select>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3 col-sm-6 cat-item cat-item-3">
|
||||
<div class="section">
|
||||
<h3>{{ trans('visiosoft.module.advs::message.update_category_msg') }}</h3>
|
||||
<button type="submit" name="action" value="update" class="btn btn-success"><i
|
||||
class="fa fa-save"></i> {{ trans('visiosoft.module.advs::button.update_category.name') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-8 col-sm-offset-2 text-center">
|
||||
{{ blocks('center-add-ad-banner-area') }}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{{ asset_add("scripts.js", "visiosoft.module.advs::js/edit_cats.js") }}
|
||||
{{ asset_style("visiosoft.module.advs::css/edit_category.css") }}
|
||||
{% endblock %}
|
||||
@ -51,6 +51,7 @@
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
<a href="{{ url_route('adv::edit_category',[id]) }}"><i class="fas fa-pencil-alt"></i> {{ trans('visiosoft.module.advs::field.edit_category') }}</a>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="row form-group add-title">
|
||||
|
||||
@ -13,91 +13,90 @@
|
||||
|
||||
<div id="ad-cat-section">
|
||||
<form action="{{ url_route('visiosoft.module.advs::post_cat') }}" method="post">
|
||||
<div class="row category-tab">
|
||||
<div class="col-md-3 col-sm-6 cat-item">
|
||||
<div class="section cat-option select-category post-option">
|
||||
<h4>{{ trans('visiosoft.module.advs::field.select_a_category') }}</h4>
|
||||
<ul role="tablist">
|
||||
<select class="cat-select" name="cat1" id="cat1" multiple id="">
|
||||
{% for cat in main_cats %}
|
||||
<option value="{{ cat.id }}"><span style="font-size: 20px">{{ cat.name }}</span></option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</ul>
|
||||
<div class="row category-tab">
|
||||
<div class="col-md-3 col-sm-6 cat-item">
|
||||
<div class="section cat-option select-category post-option">
|
||||
<h4>{{ trans('visiosoft.module.advs::field.select_a_category') }}</h4>
|
||||
<ul role="tablist">
|
||||
<select class="cat-select" name="cat1" id="cat1" multiple id="">
|
||||
{% for cat in main_cats %}
|
||||
<option value="{{ cat.id }}"><span
|
||||
style="font-size: 20px">{{ cat.name }}</span></option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6 cat-item cat-item-2">
|
||||
<div class="section cat-option select-category post-option">
|
||||
<h4>{{ trans('visiosoft.module.advs::field.select_a_sub_category') }}</h4>
|
||||
<ul role="tablist">
|
||||
<select class="cat-select" name="cat2" id="cat2" multiple id="">
|
||||
|
||||
</select>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6 cat-item cat-item-2">
|
||||
<div class="section cat-option select-category post-option">
|
||||
<h4>{{ trans('visiosoft.module.advs::field.select_a_sub_category') }}</h4>
|
||||
<ul role="tablist">
|
||||
<select class="cat-select" name="cat3" id="cat3" multiple id="">
|
||||
|
||||
</select>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6 cat-item cat-item-2">
|
||||
<div class="section cat-option select-category post-option">
|
||||
<h4>{{ trans('visiosoft.module.advs::field.select_a_sub_category') }}</h4>
|
||||
<ul role="tablist">
|
||||
<select class="cat-select" name="cat4" id="cat4" multiple id="">
|
||||
|
||||
</select>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6 cat-item cat-item-2">
|
||||
<div class="section cat-option select-category post-option">
|
||||
<h4>{{ trans('visiosoft.module.advs::field.select_a_sub_category') }}</h4>
|
||||
<ul role="tablist">
|
||||
<select class="cat-select" name="cat5" id="cat5" multiple id="">
|
||||
|
||||
</select>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6 cat-item cat-item-2">
|
||||
<div class="section cat-option select-category post-option">
|
||||
<h4>{{ trans('visiosoft.module.advs::field.select_a_sub_category') }}</h4>
|
||||
<ul role="tablist">
|
||||
<select class="cat-select" name="cat6" id="cat6" multiple id="">
|
||||
|
||||
</select>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6 cat-item cat-item-2">
|
||||
<div class="section cat-option select-category post-option">
|
||||
<h4>{{ trans('visiosoft.module.advs::field.select_a_sub_category') }}</h4>
|
||||
<ul role="tablist">
|
||||
<select class="cat-select" name="cat7" id="cat7" multiple id="">
|
||||
|
||||
</select>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 col-sm-6 cat-item cat-item-3">
|
||||
|
||||
</div><!-- next-stap -->
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-8 col-sm-offset-2 text-center">
|
||||
{{ blocks('center-add-ad-banner-area') }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6 cat-item cat-item-2">
|
||||
<div class="section cat-option select-category post-option">
|
||||
<h4>{{ trans('visiosoft.module.advs::field.select_a_sub_category') }}</h4>
|
||||
<ul role="tablist">
|
||||
<select class="cat-select" name="cat2" id="cat2" multiple id="">
|
||||
|
||||
</select>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6 cat-item cat-item-2">
|
||||
<div class="section cat-option select-category post-option">
|
||||
<h4>{{ trans('visiosoft.module.advs::field.select_a_sub_category') }}</h4>
|
||||
<ul role="tablist">
|
||||
<select class="cat-select" name="cat3" id="cat3" multiple id="">
|
||||
|
||||
</select>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6 cat-item cat-item-2">
|
||||
<div class="section cat-option select-category post-option">
|
||||
<h4>{{ trans('visiosoft.module.advs::field.select_a_sub_category') }}</h4>
|
||||
<ul role="tablist">
|
||||
<select class="cat-select" name="cat4" id="cat4" multiple id="">
|
||||
|
||||
</select>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6 cat-item cat-item-2">
|
||||
<div class="section cat-option select-category post-option">
|
||||
<h4>{{ trans('visiosoft.module.advs::field.select_a_sub_category') }}</h4>
|
||||
<ul role="tablist">
|
||||
<select class="cat-select" name="cat5" id="cat5" multiple id="">
|
||||
|
||||
</select>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6 cat-item cat-item-2">
|
||||
<div class="section cat-option select-category post-option">
|
||||
<h4>{{ trans('visiosoft.module.advs::field.select_a_sub_category') }}</h4>
|
||||
<ul role="tablist">
|
||||
<select class="cat-select" name="cat6" id="cat6" multiple id="">
|
||||
|
||||
</select>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6 cat-item cat-item-2">
|
||||
<div class="section cat-option select-category post-option">
|
||||
<h4>{{ trans('visiosoft.module.advs::field.select_a_sub_category') }}</h4>
|
||||
<ul role="tablist">
|
||||
<select class="cat-select" name="cat7" id="cat7" multiple id="">
|
||||
|
||||
</select>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 col-sm-6 cat-item cat-item-3">
|
||||
|
||||
</div><!-- next-stap -->
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-8 col-sm-offset-2 text-center">
|
||||
<div class="ad-section">
|
||||
<a href="#"><img src="{{ img('theme::images/ads/3.jpg').url }}" alt="Image" class="img-responsive"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- row -->
|
||||
</form>
|
||||
</div>
|
||||
</div><!-- container -->
|
||||
@ -108,6 +107,7 @@
|
||||
border: none;
|
||||
overflow-y: auto
|
||||
}
|
||||
|
||||
.cat-select option {
|
||||
border-top: 1px solid #f2f2f2;
|
||||
padding: 15px 0 20px;
|
||||
@ -116,15 +116,19 @@
|
||||
font-size: 16px;
|
||||
color: #505050;
|
||||
}
|
||||
|
||||
.cat-item-2 {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.cat-item-3 {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#main {
|
||||
background-image: {{ img('theme::images/bg/main.png').url }} !important;
|
||||
}
|
||||
|
||||
.btn-1 {
|
||||
background-color: #00a651;
|
||||
padding: 5px 50px 7px;
|
||||
|
||||
@ -137,7 +137,7 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
|
||||
'as' => 'post_adv',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@create',
|
||||
],
|
||||
'class/getcats/{id}' => 'Visiosoft\AdvsModule\Http\Controller\advsController@getCats',
|
||||
'class/getcats/{id}' => 'Visiosoft\AdvsModule\Http\Controller\advsController@getCatsForNewAd',
|
||||
'advs/save_adv' => [
|
||||
'as' => 'visiosoft.module.advs::post_cat',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@store'
|
||||
@ -190,6 +190,14 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
|
||||
'as' => 'assets_clear',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\Admin\AdvsController@assetsClear',
|
||||
],
|
||||
'adv/edit/category/{id}' => [
|
||||
'as' => 'adv::edit_category',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@editCategoryForAd',
|
||||
],
|
||||
'ajax/getcats/{id}' => [
|
||||
'as' => 'ajax::getCats',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@getCats',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@ -56,63 +56,147 @@ use Visiosoft\StoreModule\User\UserModel;
|
||||
|
||||
class AdvsController extends PublicController
|
||||
{
|
||||
private $adv_model;
|
||||
private $adv_repository;
|
||||
|
||||
private $country_repository;
|
||||
|
||||
private $city_model;
|
||||
|
||||
private $district_model;
|
||||
|
||||
private $neighborhood_model;
|
||||
|
||||
private $village_model;
|
||||
|
||||
private $profile_model;
|
||||
private $profile_repository;
|
||||
|
||||
private $category_model;
|
||||
private $category_repository;
|
||||
|
||||
private $requestHttp;
|
||||
private $settings_repository;
|
||||
private $event;
|
||||
|
||||
public function __construct(
|
||||
AdvModel $advModel,
|
||||
AdvRepositoryInterface $advRepository,
|
||||
|
||||
CountryRepositoryInterface $country_repository,
|
||||
|
||||
CityModel $city_model,
|
||||
|
||||
DistrictModel $district_model,
|
||||
|
||||
NeighborhoodModel $neighborhood_model,
|
||||
|
||||
VillageModel $village_model,
|
||||
|
||||
ProfileModel $profile_model,
|
||||
ProfileRepositoryInterface $profile_repository,
|
||||
|
||||
CategoryModel $categoryModel,
|
||||
CategoryRepositoryInterface $category_repository,
|
||||
|
||||
SettingRepositoryInterface $settings_repository,
|
||||
|
||||
Dispatcher $events,
|
||||
|
||||
Request $request
|
||||
)
|
||||
{
|
||||
$this->adv_model = $advModel;
|
||||
$this->adv_repository = $advRepository;
|
||||
|
||||
$this->country_repository = $country_repository;
|
||||
|
||||
$this->city_model = $city_model;
|
||||
|
||||
$this->district_model = $district_model;
|
||||
|
||||
$this->neighborhood_model = $neighborhood_model;
|
||||
|
||||
$this->village_model = $village_model;
|
||||
|
||||
|
||||
public function index(AdvRepositoryInterface $advRepository,
|
||||
CategoryRepositoryInterface $categories,
|
||||
CountryRepositoryInterface $countries,
|
||||
ProfileRepositoryInterface $profileRepository,
|
||||
Request $request)
|
||||
$this->profile_model = $profile_model;
|
||||
$this->profile_repository = $profile_repository;
|
||||
|
||||
$this->category_model = $categoryModel;
|
||||
$this->category_repository = $category_repository;
|
||||
|
||||
$this->settings_repository = $settings_repository;
|
||||
|
||||
$this->event = $events;
|
||||
|
||||
$this->requestHttp = $request;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\View|mixed
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$customParameters = array();
|
||||
$param = $request->toArray();
|
||||
$advmodel = new AdvModel();
|
||||
$isActiveDopings = $advmodel->is_enabled('dopings');
|
||||
$isActiveCustomFields = $advmodel->is_enabled('customfields');
|
||||
// AdvRepository
|
||||
$advs = $advRepository->searchAdvs('list', $param, $customParameters);
|
||||
$featured_advs = array();
|
||||
$subCats = array();
|
||||
|
||||
$param = $this->requestHttp->toArray();
|
||||
|
||||
$countries = $this->country_repository->viewAll();
|
||||
|
||||
$isActiveDopings = $this->adv_model->is_enabled('dopings');
|
||||
|
||||
$isActiveCustomFields = $this->adv_model->is_enabled('customfields');
|
||||
|
||||
$advs = $this->adv_repository->searchAdvs('list', $param, $customParameters);
|
||||
|
||||
$advs = $this->adv_repository->addAttributes($advs);
|
||||
|
||||
$advs = $advRepository->addAttributes($advs);
|
||||
|
||||
$featured_advs = [];
|
||||
if ($isActiveDopings) {
|
||||
$dopingModel = new DopingModel();
|
||||
$featured_advs = $dopingModel->filterAdvs(2, $advs);
|
||||
|
||||
foreach ($featured_advs as $index => $ad) {
|
||||
$featured_advs[$index]->detail_url = $advmodel->getAdvDetailLinkByModel($ad, 'list');
|
||||
$featured_advs[$index] = $advmodel->AddAdsDefaultCoverImage($ad);
|
||||
$featured_advs[$index]->detail_url = $this->adv_model->getAdvDetailLinkByModel($ad, 'list');
|
||||
$featured_advs[$index] = $this->adv_model->AddAdsDefaultCoverImage($ad);
|
||||
}
|
||||
|
||||
$advs = $dopingModel->reFilterAdvs(2, $advs);
|
||||
}
|
||||
|
||||
foreach ($advs as $index => $ad) {
|
||||
$advs[$index]->detail_url = $advmodel->getAdvDetailLinkByModel($ad, 'list');
|
||||
$advs[$index] = $advmodel->AddAdsDefaultCoverImage($ad);
|
||||
$advs[$index]->detail_url = $this->adv_model->getAdvDetailLinkByModel($ad, 'list');
|
||||
$advs[$index] = $this->adv_model->AddAdsDefaultCoverImage($ad);
|
||||
|
||||
if ($isActiveCustomFields && isset($param['cat']) and $param['cat'] != "") {
|
||||
$rtnvalues = app('Visiosoft\CustomfieldsModule\Http\Controller\cfController')->indexseen($ad, $param['cat'], $advs, $index);
|
||||
$rtnvalues = app('Visiosoft\CustomfieldsModule\Http\Controller\cfController')
|
||||
->indexseen($ad, $param['cat'], $advs, $index);
|
||||
$advs = $rtnvalues['advs'];
|
||||
$seenList = $rtnvalues['seenList'];
|
||||
}
|
||||
}
|
||||
$countries = $countries->viewAll();
|
||||
|
||||
$subCats = [];
|
||||
if (isset($param['cat']) and $param['cat'] != "") {
|
||||
$cat = $param['cat'];
|
||||
$mainCats = new CategoryModel();
|
||||
|
||||
$seo_keywords = $mainCats->getMeta_keywords($param['cat']);
|
||||
$seo_description = $mainCats->getMeta_description($param['cat']);
|
||||
$seo_title = $mainCats->getMeta_title($param['cat']);
|
||||
$seo_keywords = $this->category_model->getMeta_keywords($param['cat']);
|
||||
$seo_description = $this->category_model->getMeta_description($param['cat']);
|
||||
$seo_title = $this->category_model->getMeta_title($param['cat']);
|
||||
|
||||
$this->template->set('meta_keywords', implode(',', $seo_keywords));
|
||||
$this->template->set('meta_description', $seo_description);
|
||||
$this->template->set('meta_title', $seo_title);
|
||||
|
||||
$mainCats = $mainCats->getParentCats($cat, 'category_ids');
|
||||
$subCats = $categories->getSubCatById($cat);
|
||||
$mainCats = $this->category_model->getParentCats($cat, 'category_ids');
|
||||
$subCats = $this->category_repository->getSubCatById($cat);
|
||||
} else {
|
||||
$cat = null;
|
||||
$mainCats = $categories->mainCats();
|
||||
$mainCats = $this->category_repository->mainCats();
|
||||
}
|
||||
|
||||
if ($isActiveCustomFields) {
|
||||
@ -124,20 +208,22 @@ class AdvsController extends PublicController
|
||||
}
|
||||
|
||||
if (!empty($param['user'])) {
|
||||
$user = $profileRepository->getUser($param['user']);
|
||||
$userProfile = $profileRepository->getProfile($user->id);
|
||||
$user = $this->profile_repository->getUser($param['user']);
|
||||
$userProfile = $this->profile_repository->getProfile($user->id);
|
||||
}
|
||||
|
||||
$compact = compact('advs', 'countries', 'mainCats', 'subCats', 'textfields', 'checkboxes', 'request',
|
||||
'user', 'userProfile', 'featured_advs', 'type', 'topfields', 'ranges', 'seenList');
|
||||
|
||||
Cookie::queue(Cookie::make('last_search', $request->getRequestUri(), 84000));
|
||||
Cookie::queue(Cookie::make('last_search', $this->requestHttp->getRequestUri(), 84000));
|
||||
|
||||
$viewType = $request->cookie('viewType');
|
||||
if (isset($viewType) and $viewType == 'table') {
|
||||
$viewType = $this->requestHttp->cookie('viewType');
|
||||
|
||||
if (isset($viewType) and $viewType == 'table')
|
||||
return $this->view->make('visiosoft.module.advs::advs/table', $compact);
|
||||
} elseif (isset($viewType) and $viewType == 'map') {
|
||||
elseif (isset($viewType) and $viewType == 'map')
|
||||
return $this->view->make('visiosoft.module.advs::advs/map', $compact);
|
||||
}
|
||||
|
||||
return $this->view->make('visiosoft.module.advs::advs/list', $compact);
|
||||
}
|
||||
|
||||
@ -147,37 +233,30 @@ class AdvsController extends PublicController
|
||||
return redirect($this->request->headers->get('referer'));
|
||||
}
|
||||
|
||||
public function view
|
||||
(
|
||||
$id,
|
||||
CategoryRepositoryInterface $categoryRepository,
|
||||
Dispatcher $events,
|
||||
AdvRepositoryInterface $advRepository,
|
||||
AdvModel $advModel
|
||||
)
|
||||
public function view($id)
|
||||
{
|
||||
$isActiveComplaints = $advModel->is_enabled('complaints');
|
||||
$isCommentActive = $advModel->is_enabled('comments');
|
||||
$categories = array();
|
||||
$categories_id = array();
|
||||
$isActiveComplaints = $this->adv_model->is_enabled('complaints');
|
||||
$isCommentActive = $this->adv_model->is_enabled('comments');
|
||||
|
||||
if ($isActiveComplaints) {
|
||||
$complaints = ComplaintsComplainTypesEntryModel::all();
|
||||
}
|
||||
|
||||
$adv = $advRepository->getListItemAdv($id);
|
||||
$adv = $this->adv_repository->getListItemAdv($id);
|
||||
|
||||
$recommended_advs = $this->adv_repository->getRecommendedAds($adv->id);
|
||||
|
||||
$recommended_advs = $advRepository->getRecommendedAds($adv->id);
|
||||
foreach ($recommended_advs as $index => $ad) {
|
||||
$recommended_advs[$index]->detail_url = $advModel->getAdvDetailLinkByModel($ad, 'list');
|
||||
$recommended_advs[$index] = $advModel->AddAdsDefaultCoverImage($ad);
|
||||
$recommended_advs[$index]->detail_url = $this->adv_model->getAdvDetailLinkByModel($ad, 'list');
|
||||
$recommended_advs[$index] = $this->adv_model->AddAdsDefaultCoverImage($ad);
|
||||
}
|
||||
|
||||
$categories = array();
|
||||
$categories_id = array();
|
||||
|
||||
for ($i = 1; $i < 7; $i++) {
|
||||
$cat = "cat" . $i;
|
||||
if ($adv->$cat != null) {
|
||||
$item = $categoryRepository->getItem($adv->$cat);
|
||||
$item = $this->category_repository->getItem($adv->$cat);
|
||||
$categories['cat' . $i] = [
|
||||
'name' => $item->name,
|
||||
'id' => $item->id
|
||||
@ -186,13 +265,13 @@ class AdvsController extends PublicController
|
||||
}
|
||||
}
|
||||
|
||||
if ($advModel->is_enabled('customfields')) {
|
||||
if ($this->adv_model->is_enabled('customfields')) {
|
||||
$features = app('Visiosoft\CustomfieldsModule\Http\Controller\cfController')->view($adv);
|
||||
}
|
||||
|
||||
//Cloudinary Module
|
||||
$adv->video_url = null;
|
||||
$isActiveCloudinary = $advModel->is_enabled('cloudinary');
|
||||
$isActiveCloudinary = $this->adv_model->is_enabled('cloudinary');
|
||||
if ($isActiveCloudinary) {
|
||||
|
||||
$CloudinaryModel = new VideoModel();
|
||||
@ -203,17 +282,16 @@ class AdvsController extends PublicController
|
||||
}
|
||||
}
|
||||
|
||||
$profile = new ProfileModel();
|
||||
$profile = $profile->getProfile($adv->created_by_id)->first();
|
||||
$profile = $this->profile_model->getProfile($adv->created_by_id)->first();
|
||||
|
||||
|
||||
if ($isCommentActive) {
|
||||
$CommentModel = new CommentModel();
|
||||
$comments = $CommentModel->getComments($adv->id)->get();
|
||||
}
|
||||
$events->dispatch(new viewAd($adv));//view ad
|
||||
$this->event->dispatch(new viewAd($adv));//view ad
|
||||
|
||||
$isActiveqrContact = $advModel->is_enabled('qrcontact');
|
||||
$isActiveqrContact = $this->adv_model->is_enabled('qrcontact');
|
||||
if ($isActiveqrContact) {
|
||||
$qrModel = new QrModel();
|
||||
$qrSRC = $qrModel->source($adv);
|
||||
@ -231,21 +309,21 @@ class AdvsController extends PublicController
|
||||
|
||||
}
|
||||
|
||||
public function getLocations(Request $request)
|
||||
public function getLocations()
|
||||
{
|
||||
$table = $request->table;
|
||||
$id = $request->id;
|
||||
$db = $request->typeDb;
|
||||
$table = $this->requestHttp->table;
|
||||
$id = $this->requestHttp->id;
|
||||
$db = $this->requestHttp->typeDb;
|
||||
|
||||
$location = "";
|
||||
if ($table == "cities") {
|
||||
$location = CityModel::query()->where($db, $id)->get();
|
||||
$location = $this->city_model->query()->where($db, $id)->get();
|
||||
} elseif ($table == "districts") {
|
||||
$location = DistrictModel::query()->whereIn($db, $id)->get();
|
||||
$location = $this->district_model->query()->whereIn($db, $id)->get();
|
||||
} elseif ($table == "neighborhoods") {
|
||||
$location = NeighborhoodModel::query()->where($db, $id)->get();
|
||||
$location = $this->neighborhood_model->query()->where($db, $id)->get();
|
||||
} elseif ($table == "village") {
|
||||
$location = VillageModel::query()->where($db, $id)->get();
|
||||
$location = $this->village_model->query()->where($db, $id)->get();
|
||||
}
|
||||
|
||||
return $location;
|
||||
@ -260,9 +338,14 @@ class AdvsController extends PublicController
|
||||
return back();
|
||||
}
|
||||
|
||||
public function getCats($id, SettingRepositoryInterface $settings, CategoryRepositoryInterface $category, AdvModel $advModel, CategoryModel $categoryModel)
|
||||
public function getCats($id)
|
||||
{
|
||||
$adv = $category->getSubCatById($id);
|
||||
return $this->category_repository->getSubCatById($id);
|
||||
}
|
||||
|
||||
public function getCatsForNewAd($id)
|
||||
{
|
||||
$adv = $this->getCats($id);
|
||||
|
||||
if (empty($adv->toArray())) {
|
||||
|
||||
@ -272,9 +355,9 @@ class AdvsController extends PublicController
|
||||
$adv['cancelBtn'] = trans('visiosoft.module.advs::field.cancel_add_advs_btn.name');
|
||||
$adv['link'] = "";
|
||||
|
||||
if ($advModel->is_enabled('packages')) {
|
||||
if ($this->adv_model->is_enabled('packages')) {
|
||||
$packageModel = new PackageModel();
|
||||
$parent_cat = $categoryModel->getParentCats($id, 'parent_id');
|
||||
$parent_cat = $this->category_model->getParentCats($id, 'parent_id');
|
||||
$package = $packageModel->reduceLimit($parent_cat);
|
||||
if ($package != null) {
|
||||
return $package;
|
||||
@ -627,9 +710,9 @@ class AdvsController extends PublicController
|
||||
|
||||
}
|
||||
|
||||
public function statusAds($id, $type, SettingRepositoryInterface $settings, Dispatcher $events, AdvModel $advModel)
|
||||
public function statusAds($id, $type, SettingRepositoryInterface $settings, Dispatcher $events)
|
||||
{
|
||||
$ad = $advModel->getAdv($id);
|
||||
$ad = $this->adv_model->getAdv($id);
|
||||
$auto_approved = $settings->value('visiosoft.module.advs::auto_approve');
|
||||
$default_published_time = $settings->value('visiosoft.module.advs::default_published_time');
|
||||
|
||||
@ -638,41 +721,78 @@ class AdvsController extends PublicController
|
||||
}
|
||||
|
||||
if ($type == "approved") {
|
||||
$advModel->publish_at_Ads($id);
|
||||
$this->adv_model->publish_at_Ads($id);
|
||||
if ($ad->finish_at == NULL AND $type == "approved") {
|
||||
if ($advModel->is_enabled('packages')) {
|
||||
if ($this->adv_model->is_enabled('packages')) {
|
||||
$packageModel = new PackageModel();
|
||||
$published_time = $packageModel->reduceTimeLimit($ad->cat1);
|
||||
if ($published_time != null) {
|
||||
$default_published_time = $published_time;
|
||||
}
|
||||
}
|
||||
$advModel->finish_at_Ads($id, $default_published_time);
|
||||
$this->adv_model->finish_at_Ads($id, $default_published_time);
|
||||
}
|
||||
}
|
||||
|
||||
$isActiveAlgolia = $advModel->is_enabled('algolia');
|
||||
$isActiveAlgolia = $this->adv_model->is_enabled('algolia');
|
||||
if ($isActiveAlgolia) {
|
||||
$algolia = new SearchModel();
|
||||
$algolia->updateStatus($id, $type, $settings);
|
||||
}
|
||||
|
||||
$advModel->statusAds($id, $type);
|
||||
$this->adv_model->statusAds($id, $type);
|
||||
$events->dispatch(new ChangeStatusAd($id, $settings));//Create Notify
|
||||
return back();
|
||||
}
|
||||
|
||||
public function cats(CategoryRepositoryInterface $repository)
|
||||
public function cats()
|
||||
{
|
||||
if (!Auth::user()) {
|
||||
redirect('/login?redirect=' . url()->current())->send();
|
||||
}
|
||||
$main_cats = $repository->mainCats();
|
||||
$main_cats = $this->category_repository->mainCats();
|
||||
|
||||
return $this->view->make('visiosoft.module.advs::advs/post-cat', compact('main_cats'));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|mixed
|
||||
*/
|
||||
public function editCategoryForAd($id)
|
||||
{
|
||||
if (!Auth::user()) {
|
||||
redirect('/login?redirect=' . url()->current())->send();
|
||||
}
|
||||
|
||||
$is_ad = $this->adv_model->userAdv($id)->find($id);
|
||||
|
||||
if (is_null($is_ad)) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
if ($this->requestHttp->action == 'update') {
|
||||
$params = $this->requestHttp->all();
|
||||
unset($params['action']);
|
||||
|
||||
for ($i = 2; $i <= 7; $i++) {
|
||||
if (!isset($params['cat' . $i])) {
|
||||
$params['cat' . $i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
$is_ad->update($params);
|
||||
$this->messages->success(trans('visiosoft.module.advs::message.updated_category_msg'));
|
||||
return redirect('/advs/edit_advs/' . $id);
|
||||
}
|
||||
|
||||
$main_cats = $this->category_repository->mainCats();
|
||||
|
||||
return $this->view->make('visiosoft.module.advs::advs/edit-cat', compact('main_cats', 'id'));
|
||||
|
||||
}
|
||||
|
||||
public function login()
|
||||
{
|
||||
if (auth()->check()) {
|
||||
|
||||
@ -20,9 +20,40 @@ class BlockSeeder extends Seeder
|
||||
->orWhere('slug', 'middle-home-banner-area')
|
||||
->orWhere('slug', 'right-home-banner-area')
|
||||
->orWhere('slug', 'list-item-right-sidebar')
|
||||
->orWhere('slug', 'center-add-ad-banner-area')
|
||||
->orWhere('slug', 'profile-right-sidebar')
|
||||
->delete();
|
||||
|
||||
// Add Ad Center Banner Area
|
||||
$center_add_ad_banner_area = BlocksAreasEntryModel::create([
|
||||
'en' => [
|
||||
'name' => 'Center Add Ad Banner Area',
|
||||
],
|
||||
'tr' => [
|
||||
'name' => 'İlan Ver Orta Reklam Alanı',
|
||||
],
|
||||
'slug' => 'center-add-ad-banner-area',
|
||||
]);
|
||||
|
||||
$center_add_ad_banner_html = HtmlBlockBlocksEntryModel::create([
|
||||
'en' => [
|
||||
'html' => file_get_contents(__DIR__ . '/Blocks/middle-home-banner-area.twig'),
|
||||
],
|
||||
'tr' => [
|
||||
'html' => file_get_contents(__DIR__ . '/Blocks/middle-home-banner-area.twig'),
|
||||
],
|
||||
]);
|
||||
|
||||
BlocksBlocksEntryModel::create([
|
||||
'area_id' => $center_add_ad_banner_area->id,
|
||||
'area_type' => 'Anomaly\BlocksModule\Area\AreaModel',
|
||||
'field_id' => 52,
|
||||
'extension' => 'anomaly.extension.html_block',
|
||||
'display_title' => 0,
|
||||
'entry_type' => 'Anomaly\HtmlBlockExtension\Block\BlockModel',
|
||||
'entry_id' => $center_add_ad_banner_html->id,
|
||||
]);
|
||||
|
||||
// left Home Banner Area
|
||||
$left_home_banner_area = BlocksAreasEntryModel::create([
|
||||
'en' => [
|
||||
|
||||
Loading…
Reference in New Issue
Block a user