mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
commit
760d871335
@ -219,5 +219,11 @@ class VisiosoftModuleAdvsCreateAdvsFields extends Migration
|
||||
'default_value' => 0,
|
||||
]
|
||||
],
|
||||
'count_show_ad' => [
|
||||
'type' => 'anomaly.field_type.integer',
|
||||
'config' => [
|
||||
'default_value' => 0,
|
||||
]
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@ -32,7 +32,9 @@ class VisiosoftModuleAdvsCreateAdvsStream extends Migration
|
||||
'slug' => [
|
||||
'required' => true,
|
||||
],
|
||||
'advs_desc',
|
||||
'advs_desc' => [
|
||||
'translatable' => true,
|
||||
],
|
||||
'cat1',
|
||||
'cat2',
|
||||
'cat3',
|
||||
@ -68,7 +70,8 @@ class VisiosoftModuleAdvsCreateAdvsStream extends Migration
|
||||
'adv_day',
|
||||
'cf_json',
|
||||
'cover_photo',
|
||||
'count_show_phone'
|
||||
'count_show_phone',
|
||||
'count_show_ad'
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@ -62,4 +62,94 @@ $('input[name="price"]').on('click', function () {
|
||||
{
|
||||
$(this).val("");
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
$(document).on('ajaxComplete ready shown.bs.tab', function () {
|
||||
|
||||
// Initialize WYSIWYG editors.
|
||||
$('textarea[data-field="advs_desc"]:not(.hasEditor)').each(function () {
|
||||
|
||||
/**
|
||||
* Gather available buttons / plugins.
|
||||
*/
|
||||
let textarea = $(this);
|
||||
|
||||
let buttons = textarea.data('available_buttons');
|
||||
let plugins = textarea.data('available_plugins');
|
||||
|
||||
textarea.addClass('hasEditor');
|
||||
|
||||
textarea.redactor({
|
||||
|
||||
element: $(this),
|
||||
|
||||
/**
|
||||
* Initialize the editor icons.
|
||||
*/
|
||||
callbacks: {
|
||||
init: function () {
|
||||
|
||||
let icons = {};
|
||||
|
||||
$.each(buttons, function (k, v) {
|
||||
if (v.icon) {
|
||||
icons[v.button ? v.button : k] = '<i class="' + v.icon + '"></i>';
|
||||
}
|
||||
});
|
||||
|
||||
$.each(plugins, function (k, v) {
|
||||
if (v.icon) {
|
||||
icons[v.button ? v.button : k] = '<i class="' + v.icon + '"></i>';
|
||||
}
|
||||
});
|
||||
|
||||
$.each(this.button.all(), $.proxy(function (i, s) {
|
||||
|
||||
let key = $(s).attr('rel');
|
||||
|
||||
if (typeof icons[key] !== 'undefined') {
|
||||
let icon = icons[key];
|
||||
let button = this.button.get(key);
|
||||
this.button.setIcon(button, icon);
|
||||
}
|
||||
|
||||
}, this));
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Settings
|
||||
*/
|
||||
script: false,
|
||||
structure: true,
|
||||
linkTooltip: true,
|
||||
cleanOnPaste: true,
|
||||
toolbarFixed: false,
|
||||
imagePosition: true,
|
||||
imageResizable: true,
|
||||
breakline: Boolean(textarea.data('breakline')),
|
||||
removeNewLines: Boolean(textarea.data('remove_new_lines')),
|
||||
imageFloatMargin: '20px',
|
||||
removeEmpty: ['strong', 'em', 'p'],
|
||||
|
||||
/**
|
||||
* Features
|
||||
*/
|
||||
minHeight: textarea.data('height'),
|
||||
placeholder: textarea.attr('placeholder'),
|
||||
folders: textarea.data('folders').toString().split(','),
|
||||
buttons: textarea.data('buttons').toString().split(','),
|
||||
plugins: textarea.data('plugins').toString().split(',')
|
||||
});
|
||||
|
||||
textarea.closest('form').on('submit', function () {
|
||||
textarea.val(textarea.redactor('code.get'));
|
||||
});
|
||||
|
||||
if (textarea.is('[readonly]') || textarea.is('[disabled]')) {
|
||||
textarea.redactor('button.disableAll');
|
||||
textarea.redactor('core.editor')
|
||||
.attr('contenteditable', false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
function viewed_ad() {
|
||||
var id = $('#adv-id').val();
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '/ajax/viewed/' + id,
|
||||
});
|
||||
}
|
||||
|
||||
viewed_ad();
|
||||
@ -3,7 +3,7 @@
|
||||
{% block ogdata %}
|
||||
<meta property="og:site_name"
|
||||
content="{{ template.get('og_site_name', setting_value('streams::name', config_get('streams::distribution.name'))) }}"/>
|
||||
<meta property="og:description" content="{{ template.get('og_description', trans(template.meta_description)) }}"/>
|
||||
<meta property="og:description" content="{{ adv.advs_desc|striptags|raw }}"/>
|
||||
<meta property="og:title" content="{{ adv.title }}"/>
|
||||
<meta property="og:url" content="{{ template.get('og_url', url_current()) }}"/>
|
||||
<meta property="og:image" content="{{ adv.getViewPhotoUrl|first }}">
|
||||
@ -134,8 +134,11 @@
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 offered-field offered-row">
|
||||
<span class="icon"><i class="far fa-clock"></i><a
|
||||
href="#">{{ adv.created_at|date('d/m/Y') }}</a></span>
|
||||
<span class="icon"><i class="fa fa-map-marker"></i><a href="#">{{ adv.city_name }}
|
||||
|
||||
{% if setting_value('visiosoft.module.location::detail_page_location') %}
|
||||
<span class="icon"><i class="fa fa-map-marker"></i><a href="#">{{ adv.city_name }}
|
||||
, {{ adv.country_name }}</a></span>
|
||||
{% endif %}
|
||||
{% if adv.isCorporate == 2 %}
|
||||
<span class="icon"><i class="fa fa-suitcase"></i><a
|
||||
href="{{ url_route('visiosoft.module.advs::list_user_ad', [adv.created_by_id]) }}">{{ adv.owner }}</a></span>
|
||||
@ -278,7 +281,7 @@
|
||||
{% include "visiosoft.module.customfields::list-item" %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if adv.map_Val != "" %}
|
||||
{% if adv.map_Val != "" and setting_value('visiosoft.module.location::detail_page_location') %}
|
||||
<div id="streetviewtab" class="tab-pane fade in">
|
||||
<div id="map" data-map-val="{{ adv.map_Val }}"></div>
|
||||
{% if entries('advs').isEnabled('streetview') %}
|
||||
@ -334,9 +337,11 @@
|
||||
</div>
|
||||
<!-- item-info-right -->
|
||||
<div class="user-option pull-right">
|
||||
<a href="#" data-toggle="tooltip" data-placement="top" title=""
|
||||
data-original-title="{{ advs.city_name }}, {{ advs.country_name }}"><i
|
||||
class="fa fa-map-marker"></i> </a>
|
||||
{% if setting_value('visiosoft.module.location::detail_page_location') %}
|
||||
<a href="#" data-toggle="tooltip" data-placement="top" title=""
|
||||
data-original-title="{{ advs.city_name }}, {{ advs.country_name }}"><i
|
||||
class="fa fa-map-marker"></i> </a>
|
||||
{% endif %}
|
||||
</div><!-- item-info-right -->
|
||||
</div><!-- ad-meta -->
|
||||
</div><!-- item-info -->
|
||||
@ -473,6 +478,7 @@
|
||||
{{ asset_add("scripts.js", "visiosoft.module.advs::js/list-item.js") }}
|
||||
{{ asset_add("scripts.js", "visiosoft.module.advs::js/quantity.js") }}
|
||||
{{ asset_add("scripts.js", "visiosoft.module.advs::js/phoneCounter.js") }}
|
||||
{{ asset_add("scripts.js", "visiosoft.module.advs::js/viewed.js") }}
|
||||
|
||||
{% if entries('advs').isEnabled('comments') %}
|
||||
{{ asset_add("scripts.js", "visiosoft.module.comments::js/ajaxcomment.js") }}
|
||||
|
||||
@ -60,6 +60,7 @@
|
||||
<a data-toggle="dropdown" class="sort-by-open-dropdown" href="#" aria-expanded="false">
|
||||
<span class="sort-by-selected-text">{{ trans("visiosoft.module.advs::field.pick_option") }}</span><i class="fa fa-caret-square-o-down"></i></a>
|
||||
<ul class="dropdown-menu sort-by-dropdown" x-placement="bottom-start" >
|
||||
<li><a href="#" data-value="all" class="sort-by-item">{{ trans("visiosoft.module.advs::field.pick_option") }}</a></li>
|
||||
<li><a href="#" data-value="sort_price_up" class="sort-by-item">{{ trans("visiosoft.module.advs::field.price_high") }}</a></li>
|
||||
<li><a href="#" data-value="sort_price_down" class="sort-by-item">{{ trans("visiosoft.module.advs::field.price-low") }}</a></li>
|
||||
<li><a href="#" data-value="sort_time" class="sort-by-item">{{ trans("visiosoft.module.advs::field.newest") }}</a></li>
|
||||
@ -120,7 +121,9 @@
|
||||
</video>">
|
||||
<i class="fa fa-film"></i> </a>
|
||||
{% endif %}
|
||||
<a href="{{ url_route('visiosoft.module.advs::show_ad_map_location',[adv.country_id,adv.city,adv.district]) }}" data-toggle="tooltip" data-placement="top" title="{{ adv.city_name }}, {{ adv.country_name }}"><i class="fa fa-map-marker"></i> </a>
|
||||
{% if setting_value('visiosoft.module.location::list_page_location') %}
|
||||
<a href="{{ url_route('visiosoft.module.advs::show_ad_map_location',[adv.country_id,adv.city,adv.district]) }}" data-toggle="tooltip" data-placement="top" title="{{ adv.city_name }}, {{ adv.country_name }}"><i class="fa fa-map-marker"></i> </a>
|
||||
{% endif %}
|
||||
<a class="online" href="" data-toggle="tooltip" data-placement="top" title="{{ adv.owner }}"><i class="fa fa-user"></i> </a>
|
||||
|
||||
{% if entries('advs').isEnabled('comparisons') %}
|
||||
@ -180,7 +183,9 @@
|
||||
<source src='{{ adv.isAdVideo }}' class='video-src' type='video/mp4' />
|
||||
</video>"></a>
|
||||
{% endif %}
|
||||
<a href="{{ url_route('visiosoft.module.advs::show_ad_map_location',[adv.country_id,adv.city,adv.district]) }}" data-toggle="tooltip" data-placement="top" title="{{ adv.city_name }}, {{ adv.country_name }}"><i class="fa fa-map-marker"></i> </a>
|
||||
{% if setting_value('visiosoft.module.location::list_page_location') %}
|
||||
<a href="{{ url_route('visiosoft.module.advs::show_ad_map_location',[adv.country_id,adv.city,adv.district]) }}" data-toggle="tooltip" data-placement="top" title="{{ adv.city_name }}, {{ adv.country_name }}"><i class="fa fa-map-marker"></i> </a>
|
||||
{% endif %}
|
||||
<a class="online" href="" data-toggle="tooltip" data-placement="top" title="{{ adv.owner }}"><i class="fa fa-user"></i> </a>
|
||||
|
||||
{% if entries('advs').isEnabled('comparisons') %}
|
||||
|
||||
@ -105,7 +105,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-group brand-name">
|
||||
{{ form.fields.advs_desc.input|raw }}
|
||||
{{ descField|raw }}
|
||||
</div>
|
||||
<div class="row form-group images">
|
||||
{{ form.fields.files.input |raw }}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php namespace Visiosoft\AdvsModule\Adv;
|
||||
|
||||
use Anomaly\SettingsModule\Setting\Contract\SettingRepositoryInterface;
|
||||
use Anomaly\Streams\Platform\Addon\AddonCollection;
|
||||
use Anomaly\Streams\Platform\Entry\EntryCriteria;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Visiosoft\RecentlyviewedadsModule\Recently\RecentlyModel;
|
||||
@ -97,4 +98,17 @@ class AdvCriteria extends EntryCriteria
|
||||
return $logo;
|
||||
}
|
||||
|
||||
public function Flags()
|
||||
{
|
||||
$addonCollection = app(AddonCollection::class);
|
||||
$dir = $addonCollection->themes->active('standard')->getPath('resources')."/images/flags";
|
||||
$dh = opendir($dir);
|
||||
while (false !== ($filename = readdir($dh))) {
|
||||
$files[] = $filename;
|
||||
}
|
||||
$images=preg_grep ('/\.png$/i', $files);
|
||||
$images=preg_replace('/\\.[^.\\s]{3,4}$/', '', $images);
|
||||
return $images;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -25,61 +25,66 @@ use Visiosoft\CartsModule\Cart\Command\GetCart;
|
||||
|
||||
class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
||||
{
|
||||
public function is_enabled($slug) {
|
||||
public function is_enabled($slug)
|
||||
{
|
||||
$isActive = DB::table('addons_modules')
|
||||
->where('namespace', 'visiosoft.module.'. $slug)
|
||||
->where('namespace', 'visiosoft.module.' . $slug)
|
||||
->where('installed', 1)
|
||||
->where('enabled', 1)
|
||||
->first();
|
||||
if ($isActive == null) {
|
||||
return false;
|
||||
} else
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function is_enabled_extension($slug) {
|
||||
$isActive = DB::table('addons_extensions')->where('namespace', 'visiosoft.extension.'. $slug.'_provider')->first();
|
||||
public function is_enabled_extension($slug)
|
||||
{
|
||||
$isActive = DB::table('addons_extensions')->where('namespace', 'visiosoft.extension.' . $slug . '_provider')->first();
|
||||
if ($isActive == null) {
|
||||
return 0;
|
||||
} else
|
||||
return $isActive->enabled;
|
||||
}
|
||||
|
||||
public function is_active() {
|
||||
public function is_active()
|
||||
{
|
||||
$isActive = $this->query()
|
||||
->where('advs_advs.id', $this->id)
|
||||
->where('advs_advs.slug','!=',"")
|
||||
->where('advs_advs.slug', '!=', "")
|
||||
->first();
|
||||
if ($isActive->status != 'approved') {
|
||||
return 0;
|
||||
} else
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getAdv($id = null)
|
||||
{
|
||||
if($id != null)
|
||||
{
|
||||
if ($id != null) {
|
||||
return AdvModel::query()
|
||||
->where('advs_advs.slug','!=',"")
|
||||
->where('advs_advs.slug', '!=', "")
|
||||
->find($id);
|
||||
}
|
||||
return AdvModel::query()
|
||||
->where('advs_advs.slug','!=',"");
|
||||
return AdvModel::query()
|
||||
->where('advs_advs.slug', '!=', "");
|
||||
}
|
||||
|
||||
public function userAdv() {
|
||||
public function userAdv()
|
||||
{
|
||||
|
||||
return $this->getAdv()
|
||||
->where('advs_advs.created_by_id',Auth::id());
|
||||
->where('advs_advs.created_by_id', Auth::id());
|
||||
}
|
||||
|
||||
public function getAdvByCat($cat_id) {
|
||||
public function getAdvByCat($cat_id)
|
||||
{
|
||||
return $this->userAdv()
|
||||
->where('cat1',$cat_id);
|
||||
->where('cat1', $cat_id);
|
||||
}
|
||||
|
||||
public function pendingAdvsByUser() {
|
||||
public function pendingAdvsByUser()
|
||||
{
|
||||
return $this->userAdv()
|
||||
->where('advs_advs.status', '<>', 'approved')
|
||||
->where('advs_advs.status', '<>', 'declined')
|
||||
@ -87,39 +92,43 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
||||
->orWhereNull('advs_advs.finish_at');
|
||||
}
|
||||
|
||||
public function archivedAdvsByUser() {
|
||||
public function archivedAdvsByUser()
|
||||
{
|
||||
return $this->userAdv()
|
||||
->where('advs_advs.finish_at', '<', date('Y-m-d H:i:s'))
|
||||
->WhereNotNull('advs_advs.finish_at');
|
||||
}
|
||||
|
||||
public function favsAdvsByUser($fav_ids) {
|
||||
public function favsAdvsByUser($fav_ids)
|
||||
{
|
||||
return $this->userAdv()
|
||||
->whereIn('advs_advs.id', $fav_ids)//Array favs id
|
||||
->where('advs_advs.status', 'approved');
|
||||
->whereIn('advs_advs.id', $fav_ids)//Array favs id
|
||||
->where('advs_advs.status', 'approved');
|
||||
}
|
||||
|
||||
public function myAdvsByUser() {
|
||||
public function myAdvsByUser()
|
||||
{
|
||||
return $this->userAdv()
|
||||
->where('advs_advs.status', 'approved')
|
||||
->where('advs_advs.finish_at', '>', date('Y-m-d H:i:s'));
|
||||
}
|
||||
|
||||
public function foreignCurrency($currency, $price, $curencies, $isUpdate, $settings) {
|
||||
public function foreignCurrency($currency, $price, $curencies, $isUpdate, $settings)
|
||||
{
|
||||
$currencies = explode(',', $curencies);
|
||||
$foreign_currency = array();
|
||||
|
||||
$client = new Client();
|
||||
|
||||
foreach($currencies as $currencyIn) {
|
||||
foreach ($currencies as $currencyIn) {
|
||||
if ($currencyIn == $currency) {
|
||||
$foreign_currency[$currency] = (int)$price;
|
||||
} else {
|
||||
try {
|
||||
|
||||
$url = $currency."_".$currencyIn;
|
||||
$url = $currency . "_" . $currencyIn;
|
||||
$freecurrencykey = $settings->value('visiosoft.module.advs::free_currencyconverterapi_key');
|
||||
$response = $client->get('http://free.currencyconverterapi.com/api/v6/convert?q='.$url.'&compact=y&apiKey='.$freecurrencykey);
|
||||
$response = $client->get('http://free.currencyconverterapi.com/api/v6/convert?q=' . $url . '&compact=y&apiKey=' . $freecurrencykey);
|
||||
|
||||
} catch (RequestException $e) {
|
||||
|
||||
@ -143,22 +152,22 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
||||
|
||||
public function popularAdvs()
|
||||
{
|
||||
return $this->getAdv()->where('popular_adv',1)->paginate(9);
|
||||
}
|
||||
|
||||
public function advsofDay()
|
||||
{
|
||||
return $this->getAdv()->where('adv_day',1)->paginate(9);
|
||||
return $this->getAdv()->where('popular_adv', 1)->paginate(9);
|
||||
}
|
||||
|
||||
public function statusAds($id,$status)
|
||||
public function advsofDay()
|
||||
{
|
||||
return $this->getAdv()->where('adv_day', 1)->paginate(9);
|
||||
}
|
||||
|
||||
public function statusAds($id, $status)
|
||||
{
|
||||
$this->getAdv($id)->update(['status' => $status]);
|
||||
return $status;
|
||||
|
||||
}
|
||||
|
||||
public function finish_at_Ads($id,$endDate)
|
||||
public function finish_at_Ads($id, $endDate)
|
||||
{
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$this->getAdv($id)->update(['finish_at' => date('Y-m-d H:i:s',
|
||||
@ -178,12 +187,13 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
||||
->first();
|
||||
}
|
||||
|
||||
public function getLocationNames($advs) {
|
||||
public function getLocationNames($advs)
|
||||
{
|
||||
foreach ($advs as $adv) {
|
||||
$country = CountryModel::query()->where('location_countries.id', $adv->country_id)->first();
|
||||
$city = CityModel::query()->where('location_cities.id', $adv->city)->first();
|
||||
|
||||
$adv->setAttribute('country_name' , $country->name);
|
||||
$adv->setAttribute('country_name', $country->name);
|
||||
$adv->setAttribute('city_name', $city->name);
|
||||
}
|
||||
|
||||
@ -193,13 +203,12 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
||||
|
||||
public function isAdv($id)
|
||||
{
|
||||
return $this->getAdv()->where('advs_advs.id',$id)->first();
|
||||
return $this->getAdv()->where('advs_advs.id', $id)->first();
|
||||
}
|
||||
|
||||
public function addCart($item, $quantity = 1)
|
||||
{
|
||||
if(Auth::user())
|
||||
{
|
||||
if (Auth::user()) {
|
||||
$cart = $this->dispatch(new GetCart());
|
||||
$cart->add($item, $quantity);
|
||||
return $this->dispatch(new GetCart());
|
||||
@ -210,62 +219,65 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
||||
}
|
||||
|
||||
|
||||
public function getAdvDetailLinkByModel($object,$type = null) {
|
||||
if($type != null)
|
||||
{
|
||||
public function getAdvDetailLinkByModel($object, $type = null)
|
||||
{
|
||||
if ($type != null) {
|
||||
$id = $object->id;
|
||||
$seo = str_slug($object->name);
|
||||
$seo = str_replace('_','-',$seo);
|
||||
return \route('adv_detail_seo', [$id,$seo]);
|
||||
$seo = str_replace('_', '-', $seo);
|
||||
return \route('adv_detail_seo', [$id, $seo]);
|
||||
}
|
||||
$id = $object->getObject()->id;
|
||||
$seo = str_slug($object->getObject()->name);
|
||||
$seo = str_replace('_','-',$seo);
|
||||
return \route('adv_detail_seo', [$id,$seo]);
|
||||
$seo = str_replace('_', '-', $seo);
|
||||
return \route('adv_detail_seo', [$id, $seo]);
|
||||
}
|
||||
|
||||
public function getAdvDetailLinkByAdId($id) {
|
||||
public function getAdvDetailLinkByAdId($id)
|
||||
{
|
||||
$adv = $this->find($id);
|
||||
if($adv != null)
|
||||
{
|
||||
if ($adv != null) {
|
||||
$id = $adv->id;
|
||||
$seo = str_slug($adv->name);
|
||||
$seo = str_replace('_','-',$seo);
|
||||
return \route('adv_detail_seo', [$id,$seo]);
|
||||
$seo = str_replace('_', '-', $seo);
|
||||
return \route('adv_detail_seo', [$id, $seo]);
|
||||
}
|
||||
}
|
||||
|
||||
public function getAdvimage($id) {
|
||||
public function getAdvimage($id)
|
||||
{
|
||||
return $this->getAdv($id)->files;
|
||||
}
|
||||
|
||||
public function getLatestField($slug) {
|
||||
public function getLatestField($slug)
|
||||
{
|
||||
return DB::table('streams_fields')->where('slug', $slug)->first();
|
||||
}
|
||||
|
||||
public function updateStock($id,$quantity) {
|
||||
public function updateStock($id, $quantity)
|
||||
{
|
||||
$adv = $this->getAdv($id);
|
||||
$oldStock = $adv->stock;
|
||||
$newStock = $oldStock - $quantity;
|
||||
$adv->update(['stock' => $newStock]);
|
||||
}
|
||||
|
||||
public function stockControl($id,$quantity) {
|
||||
public function stockControl($id, $quantity)
|
||||
{
|
||||
$adv = $this->getAdv($id);
|
||||
$stock = $adv->stock;
|
||||
if($stock == NULL or $stock == 0 or $stock == "0")
|
||||
{
|
||||
return "false";//Ürün yok ise ve 0 ise
|
||||
}elseif ($stock < $quantity)
|
||||
{
|
||||
if ($stock == NULL or $stock == 0) {
|
||||
return "false";
|
||||
} elseif ($stock < $quantity) {
|
||||
return "false";//Adet yetmiyorsa
|
||||
}else {
|
||||
} else {
|
||||
return "true";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function saveCustomField($category_id, $field_id, $name) {
|
||||
public function saveCustomField($category_id, $field_id, $name)
|
||||
{
|
||||
$all = array();
|
||||
$all['category_id'] = $category_id;
|
||||
$all['field_id'] = $field_id;
|
||||
@ -297,8 +309,7 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
||||
|
||||
public function AddAdsDefaultCoverImage($ad)
|
||||
{
|
||||
if($ad->cover_photo == null)
|
||||
{
|
||||
if ($ad->cover_photo == null) {
|
||||
$ad->cover_photo = $this->dispatch(new MakeImageInstance('theme::images/no-image-ads.jpg', 'img'))->url();
|
||||
} else {
|
||||
$ad->cover_photo = url($ad->cover_photo);
|
||||
@ -309,12 +320,17 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
||||
public function GetAdsDefaultCoverImageByAdId($id)
|
||||
{
|
||||
$adv = $this->find($id);
|
||||
if($adv == null or $adv->cover_photo == null)
|
||||
{
|
||||
if ($adv == null or $adv->cover_photo == null) {
|
||||
$cover_photo = $this->dispatch(new MakeImageInstance('theme::images/no-image-ads.jpg', 'img'))->url();
|
||||
} else {
|
||||
$cover_photo = url($adv->cover_photo);
|
||||
}
|
||||
return $cover_photo;
|
||||
}
|
||||
|
||||
public function viewed_Ad($id)
|
||||
{
|
||||
$ad = $this->find($id);
|
||||
$ad->update(['count_show_ad' => intval($ad->count_show_ad) + 1]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,37 +65,40 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
|
||||
// 'admin/advs/custom_fields' => 'Visiosoft\AdvsModule\Http\Controller\Admin\CustomFieldsController@index',
|
||||
// 'admin/advs/custom_fields/create' => 'Visiosoft\AdvsModule\Http\Controller\Admin\CustomFieldsController@create',
|
||||
// 'admin/advs/custom_fields/edit/{id}' => 'Visiosoft\AdvsModule\Http\Controller\Admin\CustomFieldsController@edit',
|
||||
'admin/advs/advs' => 'Visiosoft\AdvsModule\Http\Controller\Admin\AdvsController@index',
|
||||
'admin/advs/advs/create' => 'Visiosoft\AdvsModule\Http\Controller\Admin\AdvsController@create',
|
||||
'admin/advs/advs' => 'Visiosoft\AdvsModule\Http\Controller\Admin\AdvsController@index',
|
||||
'admin/advs/advs/create' => 'Visiosoft\AdvsModule\Http\Controller\Admin\AdvsController@create',
|
||||
'admin/advs/advs/edit/{id}' => 'Visiosoft\AdvsModule\Http\Controller\Admin\AdvsController@edit',
|
||||
'admin/advs/village' => 'Visiosoft\AdvsModule\Http\Controller\Admin\VillageController@index',
|
||||
'admin/advs/village/create' => 'Visiosoft\AdvsModule\Http\Controller\Admin\VillageController@create',
|
||||
'admin/advs/village' => 'Visiosoft\AdvsModule\Http\Controller\Admin\VillageController@index',
|
||||
'admin/advs/village/create' => 'Visiosoft\AdvsModule\Http\Controller\Admin\VillageController@create',
|
||||
'admin/advs/village/edit/{id}' => 'Visiosoft\AdvsModule\Http\Controller\Admin\VillageController@edit',
|
||||
'categories/checkparent/{id}' => 'Visiosoft\AdvsModule\Http\Controller\advsController@checkParentCat',
|
||||
'admin/advs/ajax' => [
|
||||
'as' => 'visiosoft.module.advs::ajax',
|
||||
'admin/advs/ajax' => [
|
||||
'as' => 'visiosoft.module.advs::ajax',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\AjaxController@locations',
|
||||
],
|
||||
|
||||
'class/ajax' => [
|
||||
'ajax/viewed/{id}' => [
|
||||
'as' => 'advs::viewed',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\AjaxController@viewed',
|
||||
],
|
||||
'class/ajax' => [
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\AjaxController@locations',
|
||||
],
|
||||
'class/ajaxCategory' => [
|
||||
'class/ajaxCategory' => [
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\AjaxController@categories',
|
||||
],
|
||||
'admin/advs' => 'Visiosoft\AdvsModule\Http\Controller\Admin\AdvsController@index',
|
||||
'admin/advs/create' => 'Visiosoft\AdvsModule\Http\Controller\Admin\AdvsController@create',
|
||||
'admin/advs' => 'Visiosoft\AdvsModule\Http\Controller\Admin\AdvsController@index',
|
||||
'admin/advs/create' => 'Visiosoft\AdvsModule\Http\Controller\Admin\AdvsController@create',
|
||||
'admin/advs/edit/{id}' => 'Visiosoft\AdvsModule\Http\Controller\Admin\AdvsController@edit',
|
||||
'admin/advs/list' => [
|
||||
'as' => 'visiosoft.module.advs::admin-list',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\Admin\AdvsController@manage'
|
||||
],
|
||||
'admin/class/actions/{id}/{type}' => 'Visiosoft\AdvsModule\Http\Controller\Admin\AdvsController@actions',
|
||||
'admin/advs/fields' => 'Visiosoft\AdvsModule\Http\Controller\Admin\FieldsController@index',
|
||||
'admin/advs/fields/choose' => 'Visiosoft\AdvsModule\Http\Controller\Admin\FieldsController@choose',
|
||||
'admin/advs/fields/create' => 'Visiosoft\AdvsModule\Http\Controller\Admin\FieldsController@create',
|
||||
'admin/advs/fields/edit/{id}' => 'Visiosoft\AdvsModule\Http\Controller\Admin\FieldsController@edit',
|
||||
'advs/list' => [
|
||||
'admin/advs/fields' => 'Visiosoft\AdvsModule\Http\Controller\Admin\FieldsController@index',
|
||||
'admin/advs/fields/choose' => 'Visiosoft\AdvsModule\Http\Controller\Admin\FieldsController@choose',
|
||||
'admin/advs/fields/create' => 'Visiosoft\AdvsModule\Http\Controller\Admin\FieldsController@create',
|
||||
'admin/advs/fields/edit/{id}' => 'Visiosoft\AdvsModule\Http\Controller\Admin\FieldsController@edit',
|
||||
'advs/list' => [
|
||||
'as' => 'visiosoft.module.advs::list',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@index'
|
||||
],
|
||||
@ -133,16 +136,16 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@create',
|
||||
],
|
||||
'class/getcats/{id}' => 'Visiosoft\AdvsModule\Http\Controller\advsController@getCats',
|
||||
'advs/save_adv' => [
|
||||
'advs/save_adv' => [
|
||||
'as' => 'visiosoft.module.advs::post_cat',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@store'
|
||||
],
|
||||
'advs/my_advs' => 'Visiosoft\AdvsModule\Http\Controller\advsController@myAdvs',
|
||||
'advs/my_advs/{params}' => 'Visiosoft\AdvsModule\Http\Controller\advsController@myAdvs',
|
||||
'advs/my_advs/{params}' => 'Visiosoft\AdvsModule\Http\Controller\advsController@myAdvs',
|
||||
'advs/edit_advs/{id}' => 'Visiosoft\AdvsModule\Http\Controller\advsController@edit',
|
||||
'advs/delete_adv/{id}' => 'Visiosoft\AdvsModule\Http\Controller\advsController@destroy',
|
||||
|
||||
'advs/status/{id},{type}' => [
|
||||
'advs/status/{id},{type}' => [
|
||||
'as' => 'visiosoft.module.advs::status',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@statusAds'
|
||||
],
|
||||
@ -314,8 +317,8 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
|
||||
// Use method injection or commands to bring in services.
|
||||
$slug = 'general_settings';
|
||||
$section = [
|
||||
'title' => 'visiosoft.module.advs::button.general_settings',
|
||||
'href' => '/admin/settings/modules/visiosoft.module.advs',
|
||||
'title' => 'visiosoft.module.advs::button.general_settings',
|
||||
'href' => '/admin/settings/modules/visiosoft.module.advs',
|
||||
];
|
||||
$slug2 = 'assets_clear';
|
||||
$section2 = [
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php namespace Visiosoft\AdvsModule\Http\Controller;
|
||||
|
||||
use Anomaly\Streams\Platform\Http\Controller\PublicController;
|
||||
use Visiosoft\AdvsModule\Adv\AdvModel;
|
||||
use Illuminate\Http\Request;
|
||||
use Visiosoft\LocationModule\City\CityModel;
|
||||
use Visiosoft\LocationModule\District\DistrictModel;
|
||||
@ -41,4 +42,9 @@ class AjaxController extends PublicController
|
||||
$datas['category'] = $catModel->searchKeyword($request->q);
|
||||
return response()->json($datas);
|
||||
}
|
||||
|
||||
public function viewed(AdvModel $advModel, $id)
|
||||
{
|
||||
$advModel->viewed_Ad($id);
|
||||
}
|
||||
}
|
||||
@ -156,9 +156,8 @@ class AdvsController extends PublicController
|
||||
AdvModel $advModel
|
||||
)
|
||||
{
|
||||
$isActive = new AdvModel();
|
||||
$isActiveComplaints = $isActive->is_enabled('complaints');
|
||||
$isCommentActive = $isActive->is_enabled('comments');
|
||||
$isActiveComplaints = $advModel->is_enabled('complaints');
|
||||
$isCommentActive = $advModel->is_enabled('comments');
|
||||
|
||||
if ($isActiveComplaints) {
|
||||
$complaints = ComplaintsComplainTypesEntryModel::all();
|
||||
@ -187,14 +186,13 @@ class AdvsController extends PublicController
|
||||
}
|
||||
}
|
||||
|
||||
if ($isActive->is_enabled('customfields')) {
|
||||
if ($advModel->is_enabled('customfields')) {
|
||||
$features = app('Visiosoft\CustomfieldsModule\Http\Controller\cfController')->view($adv);
|
||||
}
|
||||
|
||||
//Cloudinary Module
|
||||
$adv->video_url = null;
|
||||
$isActiveCloudinary = new AdvModel();
|
||||
$isActiveCloudinary = $isActiveCloudinary->is_enabled('cloudinary');
|
||||
$isActiveCloudinary = $advModel->is_enabled('cloudinary');
|
||||
if ($isActiveCloudinary) {
|
||||
|
||||
$CloudinaryModel = new VideoModel();
|
||||
@ -215,7 +213,7 @@ class AdvsController extends PublicController
|
||||
}
|
||||
$events->dispatch(new viewAd($adv));//view ad
|
||||
|
||||
$isActiveqrContact = $isActive->is_enabled('qrcontact');
|
||||
$isActiveqrContact = $advModel->is_enabled('qrcontact');
|
||||
if ($isActiveqrContact) {
|
||||
$qrModel = new QrModel();
|
||||
$qrSRC = $qrModel->source($adv);
|
||||
@ -557,13 +555,20 @@ class AdvsController extends PublicController
|
||||
AdvModel $advModel
|
||||
)
|
||||
{
|
||||
$nameField = HTMLDomParser::str_get_html($advFormBuilder->render($id)->getContent());
|
||||
$nameField = $nameField->find('.name', 0);
|
||||
$Field = HTMLDomParser::str_get_html($advFormBuilder->render($id)->getContent());
|
||||
$nameField = $Field->find('.name', 0);
|
||||
if ($nameField !== null) {
|
||||
$nameField = $nameField->innertext();
|
||||
} else {
|
||||
$nameField = "";
|
||||
}
|
||||
|
||||
$descField = $Field->find('.advs_desc', 0);
|
||||
if ($descField !== null) {
|
||||
$descField = $descField->innertext();
|
||||
} else {
|
||||
$nameField = "";
|
||||
}
|
||||
if (!Auth::user()) {
|
||||
redirect('/login?redirect=' . url()->current())->send();
|
||||
}
|
||||
@ -607,7 +612,7 @@ class AdvsController extends PublicController
|
||||
$custom_fields = app('Visiosoft\CustomfieldsModule\Http\Controller\cfController')->edit($adv, $categories, $cats);
|
||||
}
|
||||
|
||||
return $this->view->make('visiosoft.module.advs::advs/new-create', compact('id', 'cats_d', 'request', 'Cloudinary', 'cities', 'adv', 'custom_fields', 'nameField'));
|
||||
return $this->view->make('visiosoft.module.advs::advs/new-create', compact('id', 'cats_d', 'request', 'Cloudinary', 'cities', 'adv', 'custom_fields', 'nameField', 'descField'));
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
<form action="{{ url('advs/list') }}" id="home-page-search-form" method="get">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{% if setting_value('visiosoft.module.location::home_page_location') %}
|
||||
<div class="col-md-2 home-search-field">
|
||||
<div class="form-group ">
|
||||
{% set cities = entries('location','cities').orderBy('slug').get() %}
|
||||
@ -21,6 +22,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2 home-search-field">
|
||||
{% else %}
|
||||
<div class="col-md-4 home-search-field">
|
||||
{% endif %}
|
||||
<div class="form-group ">
|
||||
<ul>
|
||||
<li class="dropdown home-search-category-field">
|
||||
@ -159,10 +163,12 @@
|
||||
title="{{ trans('visiosoft.module.advs::field.online_shopping') }}"><i
|
||||
class="fa fa-shopping-cart"></i> </a>
|
||||
{% endif %}
|
||||
<a href="{{ url_route('visiosoft.module.advs::show_ad_map_location',[adv.country_id,adv.city,adv.district]) }}"
|
||||
data-toggle="tooltip" data-placement="top"
|
||||
title="{{ adv.city_name }}, {{ adv.country_name }}"><i
|
||||
class="fa fa-map-marker"></i> </a>
|
||||
{% if setting_value('visiosoft.module.location::home_page_location') %}
|
||||
<a href="{{ url_route('visiosoft.module.advs::show_ad_map_location',[adv.country_id,adv.city,adv.district]) }}"
|
||||
data-toggle="tooltip" data-placement="top"
|
||||
title="{{ adv.city_name }}, {{ adv.country_name }}"><i
|
||||
class="fa fa-map-marker"></i> </a>
|
||||
{% endif %}
|
||||
</div><!-- item-info-right -->
|
||||
</div><!-- ad-meta -->
|
||||
</div><!-- featured -->
|
||||
@ -252,10 +258,12 @@
|
||||
title="{{ adv.city_name }}, {{ adv.country_name }}"><i
|
||||
class="fa fa-shopping-cart"></i> </a>
|
||||
{% endif %}
|
||||
<a href="{{ url_route('visiosoft.module.advs::show_ad_map_location',[adv.country_id,adv.city,adv.district]) }}"
|
||||
data-toggle="tooltip" data-placement="top"
|
||||
title="{{ adv.city_name }}, {{ adv.country_name }}"><i
|
||||
class="fa fa-map-marker"></i> </a>
|
||||
{% if setting_value('visiosoft.module.location::home_page_location') %}
|
||||
<a href="{{ url_route('visiosoft.module.advs::show_ad_map_location',[adv.country_id,adv.city,adv.district]) }}"
|
||||
data-toggle="tooltip" data-placement="top"
|
||||
title="{{ adv.city_name }}, {{ adv.country_name }}"><i
|
||||
class="fa fa-map-marker"></i> </a>
|
||||
{% endif %}
|
||||
</div><!-- item-info-right -->
|
||||
</div><!-- ad-meta -->
|
||||
</div><!-- item-info -->
|
||||
@ -318,10 +326,12 @@
|
||||
title="{{ trans('visiosoft.module.advs::field.online_shopping') }}"><i
|
||||
class="fa fa-shopping-cart"></i> </a>
|
||||
{% endif %}
|
||||
<a href="{{ url_route('visiosoft.module.advs::show_ad_map_location',[adv.country_id,adv.city,adv.district]) }}"
|
||||
data-toggle="tooltip" data-placement="top"
|
||||
title="{{ adv.city_name }}, {{ adv.country_name }}"><i
|
||||
class="fa fa-map-marker"></i> </a>
|
||||
{% if setting_value('visiosoft.module.location::home_page_location') %}
|
||||
<a href="{{ url_route('visiosoft.module.advs::show_ad_map_location',[adv.country_id,adv.city,adv.district]) }}"
|
||||
data-toggle="tooltip" data-placement="top"
|
||||
title="{{ adv.city_name }}, {{ adv.country_name }}"><i
|
||||
class="fa fa-map-marker"></i> </a>
|
||||
{% endif %}
|
||||
</div><!-- item-info-right -->
|
||||
</div><!-- ad-meta -->
|
||||
</div><!-- item-info -->
|
||||
|
||||
@ -152,4 +152,5 @@
|
||||
gtag('config', '{{ setting('visiosoft.module.advs::google_statistic_code') }}');
|
||||
</script>
|
||||
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{{ blocks('advs-default-theme-footercss-bottom') }}
|
||||
@ -1,10 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
use Anomaly\Streams\Platform\Model\Location\LocationCitiesEntryModel;
|
||||
use Anomaly\Streams\Platform\Model\Location\LocationDistrictsEntryModel;
|
||||
use Visiosoft\LocationModule\Country\CountryModel;
|
||||
|
||||
return [
|
||||
'home_page_location' => [
|
||||
'type' => 'anomaly.field_type.boolean',
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
{% set Flags = entries('advs').Flags() %}
|
||||
<li class="{{ container.class }} language-navigation-field {{ toggle.class|raw }}">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{ toggle.title|raw }}<span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
{% for locale in locales %}
|
||||
<li><a href="#" onclick="window.location = '?_locale={{ locale.name }}'"><img src="{{ img('theme::images/flags/'~locale.name~'.png').url }}" class="lang-flag" >{{ trans('streams::locale.' ~ locale.name ~ '.name') }} ({{ locale.name }})</a></li>
|
||||
<li><a href="#" onclick="window.location = '?_locale={{ locale.name }}'">{% if locale.name in Flags %} <img src="{{ img('theme::images/flags/'~locale.name~'.png').url }}" class="lang-flag" > {% endif %}{{ trans('streams::locale.' ~ locale.name ~ '.name') }} ({{ locale.name }})</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user