mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
Merge pull request #124 from openclassify/vedatt
#509 add default ad limit for new ad
This commit is contained in:
commit
7d0ecb27bd
@ -73,18 +73,6 @@ return [
|
||||
'status' => [
|
||||
'name' => 'Status'
|
||||
],
|
||||
'next_add_advs_title' => [
|
||||
'name' => 'Post an Ad in just 30 seconds'
|
||||
],
|
||||
'next_add_advs_msg' => [
|
||||
'name' => 'Please DO NOT post multiple ads for the same items or service. All duplicate, spam and wrongly categorized ads will be deleted.'
|
||||
],
|
||||
'next_add_advs_btn' => [
|
||||
'name' => 'Next'
|
||||
],
|
||||
'cancel_add_advs_btn' => [
|
||||
'name' => 'or Cancel'
|
||||
],
|
||||
'pending_adv' => [
|
||||
'name' => 'Pending Ads'
|
||||
],
|
||||
|
||||
@ -8,5 +8,18 @@ return [
|
||||
'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.',
|
||||
|
||||
'max_ad_limit' => [
|
||||
'title' => "Your Free Ad Limit is Out.",
|
||||
'msg' => "You have reached your free ad limit.",
|
||||
'nextBtn' => "Show Ads",
|
||||
'cancelBtn' => "or Cancel",
|
||||
'link' => "/profile",
|
||||
],
|
||||
'create_ad_with_post_cat' => [
|
||||
'title' => "Post an Ad in just 30 seconds",
|
||||
'msg' => "Please DO NOT post multiple ads for the same items or service. All duplicate, spam and wrongly categorized ads will be deleted.",
|
||||
'nextBtn' => "Next",
|
||||
'cancelBtn' => "or Cancel",
|
||||
'link' => "",
|
||||
],
|
||||
];
|
||||
|
||||
@ -96,23 +96,6 @@ return [
|
||||
"status" => [
|
||||
"name" => "durum",
|
||||
|
||||
],
|
||||
"next_add_advs_title" => [
|
||||
"name" => "Sadece 30 saniyede bir İlan ver",
|
||||
|
||||
],
|
||||
"next_add_advs_msg" => [
|
||||
"name" => "Lütfen aynı ürün veya hizmet için birden fazla İlan yayınlamayın. Tüm yinelenen,
|
||||
spam ve yanlış sınıflandırılmış İlanlar silinecek.",
|
||||
|
||||
],
|
||||
"next_add_advs_btn" => [
|
||||
"name" => "Sonraki",
|
||||
|
||||
],
|
||||
"cancel_add_advs_btn" => [
|
||||
"name" => "ya da iptal",
|
||||
|
||||
],
|
||||
"pending_adv" => [
|
||||
"name" => "Bekleyen İlanlar",
|
||||
|
||||
@ -8,4 +8,18 @@ return [
|
||||
'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.',
|
||||
'max_ad_limit' => [
|
||||
'title' => "Ücretsiz İlan Limitiniz Bitmiştir.",
|
||||
'msg' => "Size verilen ücretsiz ilan limitine ulaştınız.",
|
||||
'nextBtn' => "İlanlarım",
|
||||
'cancelBtn' => "ve ya İptal",
|
||||
'link' => "/profile",
|
||||
],
|
||||
'create_ad_with_post_cat' => [
|
||||
'title' => "Sadece 30 saniyede İlan ver",
|
||||
'msg' => "Lütfen aynı ürün veya hizmet için birden fazla İlan yayınlamayın. Tüm yinelenen, spam ve yanlış sınıflandırılmış İlanlar silinecek.",
|
||||
'nextBtn' => "Devam Et",
|
||||
'cancelBtn' => "ve ya İptal",
|
||||
'link' => "",
|
||||
],
|
||||
];
|
||||
@ -345,26 +345,30 @@ class AdvsController extends PublicController
|
||||
|
||||
public function getCatsForNewAd($id)
|
||||
{
|
||||
$adv = $this->getCats($id);
|
||||
$cats = $this->getCats($id);
|
||||
$count_user_ads = count($this->adv_model->userAdv()->get());
|
||||
|
||||
if (empty($adv->toArray())) {
|
||||
if (empty($cats->toArray())) {
|
||||
|
||||
$adv['title'] = trans('visiosoft.module.advs::field.next_add_advs_title.name');
|
||||
$adv['msg'] = trans('visiosoft.module.advs::field.next_add_advs_msg.name');
|
||||
$adv['nextBtn'] = trans('visiosoft.module.advs::field.next_add_advs_btn.name');
|
||||
$adv['cancelBtn'] = trans('visiosoft.module.advs::field.cancel_add_advs_btn.name');
|
||||
$adv['link'] = "";
|
||||
$cats = trans('visiosoft.module.advs::message.create_ad_with_post_cat');
|
||||
|
||||
if ($this->adv_model->is_enabled('packages')) {
|
||||
$packageModel = new PackageModel();
|
||||
$parent_cat = $this->category_model->getParentCats($id, 'parent_id');
|
||||
$package = $packageModel->reduceLimit($parent_cat);
|
||||
if ($package != null) {
|
||||
return $package;
|
||||
if (setting_value('visiosoft.module.advs::default_adv_limit') <= $count_user_ads) {
|
||||
if ($this->adv_model->is_enabled('packages')) {
|
||||
$packageModel = new PackageModel();
|
||||
$parent_cat = $this->category_model->getParentCats($id, 'parent_id');
|
||||
$package = $packageModel->reduceLimit($parent_cat);
|
||||
if ($package != null) {
|
||||
return $package;
|
||||
}
|
||||
} else {
|
||||
$msg = trans('visiosoft.module.advs::message.max_ad_limit');
|
||||
return $msg;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return $adv;
|
||||
return $cats;
|
||||
}
|
||||
|
||||
public function create(Request $request, AdvFormBuilder $formBuilder, CategoryRepositoryInterface $repository)
|
||||
@ -422,13 +426,20 @@ class AdvsController extends PublicController
|
||||
/* Update Adv */
|
||||
$adv = AdvsAdvsEntryModel::find($request->update_id);
|
||||
|
||||
if ($advModel->is_enabled('packages') and $adv->slug == "") {
|
||||
$parent_cat = $categoryModel->getParentCats($request->cat1, 'parent_id');
|
||||
$packageModel = new PackageModel();
|
||||
$package = $packageModel->reduceLimit($parent_cat, 'reduce');
|
||||
if ($package != null) {
|
||||
return redirect('/')->with('error', trans('visiosoft.module.advs::message.please_buy_package'));
|
||||
}
|
||||
$count_user_ads = count($this->adv_model->userAdv()->get());
|
||||
|
||||
if (setting_value('visiosoft.module.advs::default_adv_limit') < $count_user_ads) {
|
||||
if ($advModel->is_enabled('packages') and $adv->slug == "") {
|
||||
$parent_cat = $categoryModel->getParentCats($request->cat1, 'parent_id');
|
||||
$packageModel = new PackageModel();
|
||||
$package = $packageModel->reduceLimit($parent_cat, 'reduce');
|
||||
if ($package != null)
|
||||
$this->messages->error(trans('visiosoft.module.advs::message.please_buy_package'));
|
||||
|
||||
} else
|
||||
$this->messages->error(trans('visiosoft.module.advs::message.max_ad_limit.title'));
|
||||
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
if ($advModel->is_enabled('store')) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user