This commit is contained in:
Diatrex 2021-01-18 17:59:15 +03:00
parent 9b1c894f69
commit e1367dbfbb
6 changed files with 137 additions and 38 deletions

View File

@ -0,0 +1,48 @@
<?php
use Anomaly\Streams\Platform\Database\Migration\Migration;
class VisiosoftModuleAdvsCreateStatusStream extends Migration
{
protected $delete = true;
protected $stream = [
'slug' => 'status',
'title_column' => 'slug',
'translatable' => true,
'versionable' => false,
'trashable' => true,
'searchable' => false,
'sortable' => false,
];
protected $fields = [
"is_system" => [
"type" => "anomaly.field_type.boolean",
"config" => [
"default_value" => false,
"mode" => "radio",
]
],
"user_access" => [
"type" => "anomaly.field_type.boolean",
"config" => [
"default_value" => true,
"mode" => "radio",
]
]
];
protected $assignments = [
'name' => [
'required' => true,
'translatable' => true,
],
'slug' => [
'required' => true,
'unique' => true,
],
"is_system",
"user_access"
];
}

View File

@ -0,0 +1,26 @@
<?php
use Anomaly\Streams\Platform\Database\Migration\Migration;
class VisiosoftModuleAdvsCreateUserStatusField extends Migration
{
protected $delete = false;
protected $stream = [
'slug' => 'advs',
];
protected $fields = [
"user_status" => [
"type" => "anomaly.field_type.relationship",
"config" => [
"related" => \Visiosoft\AdvsModule\Status\StatusModel::class,
"mode" => "lookup",
]
],
];
protected $assignments = [
'user_status',
];
}

View File

@ -24,6 +24,11 @@ class AdvsModule extends Module
],
],
],
'status' => [
'buttons' => [
'new_status',
],
],
'product_options' => [
'title' => 'visiosoft.module.advs::section.product_options.title',
'buttons' => [

View File

@ -125,43 +125,70 @@ function addAdsRow(id, href, image, name, formatted_price, city, country, cat1,
}
function dropdownRow(id, type) {
var dropdown = "<div class='dropdown my-ads-dropdown' data-id='" + id + "'>\n" +
" <button class='dropdown-toggle btn btn-outline-dark' type='button' id='dropdownMenuButton' data-toggle='dropdown'>\n" +
"<i class=\"fas fa-ellipsis-v\"></i>" +
" </button>\n" +
" <div class='dropdown-menu' aria-labelledby='dropdownMenuButton'>\n";
var dropdown = `
<div class='dropdown my-ads-dropdown' data-id='${id}'>
<button class='dropdown-toggle btn btn-outline-dark' type='button' id='dropdownMenuButton'
data-toggle='dropdown'>
<i class="fas fa-ellipsis-v"></i>
</button>
<div class='dropdown-menu' aria-labelledby='dropdownMenuButton'>
`;
if (type == "passive") {
dropdown += "<a class='dropdown-item text-success' href='/advs/status/" + id + ",approved'>" +
"<i class='fas fa-eye'></i> " +
approve +
"</a>\n";
dropdown += `
<a class='dropdown-item text-success' href='/advs/status/${id},approved'>
<i class='fas fa-eye'></i>
${approve}
</a>
`;
} else {
dropdown += "<a class='dropdown-item text-secondary' href='/advs/status/" + id + ",passive'>" +
"<i class='fas fa-eye-slash'></i> " +
passive +
"</a>\n";
dropdown += `
<a class='dropdown-item text-secondary' href='/advs/status/${id},passive'>
<i class='fas fa-eye-slash'></i>
${passive}
</a>
`;
}
dropdown += "<a class='dropdown-item text-primary' href='/advs/edit_advs/" + id + "'>" +
"<i class='fas fa-pencil-alt'></i> " +
edit_ad +
"</a>\n";
dropdown += "<a class='dropdown-item text-danger' href='/advs/delete/" + id + "'>" +
"<i class='fas fa-trash'></i> " +
delete_ad +
"</a>\n";
dropdown += "<a class='dropdown-item text-info' href='/advs/extend/" + id + "'>" +
"<i class='fas fa-calendar'></i> " +
extend_ad +
"</a>\n";
dropdown += "</div></div>";
dropdown += `
<a class='dropdown-item text-primary' href='/advs/edit_advs/${id}'>
<i class='fas fa-pencil-alt'></i>
${edit_ad}
</a>
<a class='dropdown-item text-danger' href='/advs/delete/${id}'>
<i class='fas fa-trash'></i>
${delete_ad}
</a>
<a class='dropdown-item text-info' href='/advs/extend/${id}'>
<i class='fas fa-calendar'></i>
${extend_ad}
</a>
<div class="btn-group dropleft">
<button type="button" class="btn btn-secondary dropdown-toggle adv-status-toggle" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false">
Dropleft
</button>
<div class="dropdown-menu">
<!-- Dropdown menu links -->
</div>
</div>
</div>
</div>
`;
return dropdown;
}
$(document).on('click', '.adv-status-toggle', function (e) {
e.stopPropagation();
e.preventDefault();
if (!$(this).next('div').hasClass('show')) {
$(this).next('div').addClass('show');
} else {
$(this).next('div').removeClass('show');
}
})
function addDropdownBlock() {
const dropdowns = $('.my-ads-dropdown')
for (let i = 0; i < dropdowns.length; i++) {

View File

@ -38,4 +38,4 @@
<div class="overlay"></div>
{{ asset_add("scripts.js", "visiosoft.module.profile::assets/js/profile-nav.js") }}
{{ asset_add("scripts.js", "visiosoft.module.profile::assets/js/profile-nav.js") }}

View File

@ -2,31 +2,24 @@
use Anomaly\SettingsModule\Setting\Contract\SettingRepositoryInterface;
use Anomaly\Streams\Platform\Http\Controller\PublicController;
use Anomaly\Streams\Platform\Model\Options\OptionsAdvertisementEntryModel;
use Anomaly\Streams\Platform\Model\Users\UsersUsersEntryModel;
use Anomaly\UsersModule\User\Contract\UserRepositoryInterface;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Rinvex\Subscriptions\Models\Plan;
use Rinvex\Subscriptions\Models\PlanSubscription;
use Visiosoft\AdvsModule\Adv\AdvModel;
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
use Visiosoft\AdvsModule\Adv\Event\ChangeStatusAd;
use Visiosoft\LocationModule\Country\CountryModel;
use Visiosoft\AlgoliaModule\Search\SearchModel;
use Visiosoft\CloudsiteModule\CloudsiteModule;
use Visiosoft\CloudsiteModule\Site\SiteModel;
use Visiosoft\OrdersModule\Orderdetail\Event\AgainPuchaseOrder;
use Visiosoft\PackagesModule\Http\Controller\PackageFEController;
use Visiosoft\MessagesModule\Message\MessageModel;
use Visiosoft\PackagesModule\Package\PackageModel;
use Visiosoft\PackagesModule\User\UserModel;
use Visiosoft\ProfileModule\Adress\AdressModel;
use Visiosoft\ProfileModule\Adress\Contract\AdressRepositoryInterface;
use Visiosoft\ProfileModule\Adress\Form\AdressFormBuilder;
use Visiosoft\ProfileModule\Education\EducationModel;
use Visiosoft\ProfileModule\EducationPart\EducationPartModel;
use Visiosoft\ProfileModule\EducationPartOption\EducationPartOptionModel;
use Visiosoft\ProfileModule\Profile\Form\ProfileFormBuilder;
use Illuminate\Contracts\Events\Dispatcher;
@ -51,7 +44,7 @@ class MyProfileController extends PublicController
protected $user;
public function home(ProfileFormBuilder $form, AdvRepositoryInterface $advRepository)
public function home(ProfileFormBuilder $form)
{
$advs_count = new AdvModel();
$advs_count = count($advs_count->myAdvsByUser()->get());