Merge pull request #743 from openclassify/dia

#2440 [emadencilik] campaign definition
This commit is contained in:
Fatih Alp 2020-10-26 19:45:13 +03:00 committed by GitHub
commit 2fa3aa0879
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 82 additions and 8 deletions

View File

@ -60,7 +60,7 @@ return [
'filter' => [
'title' => 'visiosoft.module.advs::section.filter',
'fields' => [
'hide_price_filter', 'hide_date_filter', 'hide_photo_filter', 'hide_map_filter'
'hide_price_filter', 'hide_date_filter', 'hide_photo_filter', 'hide_map_filter', 'user_filter_limit'
],
],
],

View File

@ -283,4 +283,10 @@ return [
'default_value' => 'top-right',
]
],
'user_filter_limit' => [
'type' => 'anomaly.field_type.integer',
'config' => [
'default_value' => 5,
],
],
];

View File

@ -40,4 +40,8 @@
.select2-container--default .select2-selection--single .select2-selection__arrow {
top: unset;
}
select[name=filter_User] + .select2 {
min-width: 20rem;
}

View File

@ -220,4 +220,8 @@ a.sort-by-open-dropdown:hover {
.filter-section .countries input[type=checkbox] {
display: none;
}
.gallery-tn {
object-fit: cover;
}

View File

@ -151,7 +151,25 @@ $(document).ready(function () {
// User filter
$("select[name=filter_User]").select2({
placeholder: $('select[name=filter_User] option:first-child').text()
placeholder: $('select[name=filter_User] option:first-child').text(),
ajax: {
url: '/api/profile/query-users',
dataType: 'json',
processResults: function (data) {
let formattedData = [];
Object.keys(data).forEach(function (id) {
formattedData.push({
'id': id,
'text': data[id]
})
})
return {
results: formattedData
}
}
}
});
// Country filter

View File

@ -176,4 +176,8 @@ return [
'watermark_position' => [
'name' => 'Watermark Position',
],
'user_filter_limit' => [
'name' => 'User Filter Limit',
'instructions' => 'In the admin panel'
]
];

View File

@ -7,7 +7,7 @@
<div class="row p-2" style="min-height: 150px;">
<a href="{{ adv.detail_url }}">
<div class="col-md-12 justify-content-center align-self-center">
<img class="card-img-top img-fluid img-thumbnail"
<img class="card-img-top img-fluid img-thumbnail gallery-tn"
src="{{ adv.cover_photo }}"
style="height: 150px">
</div>

View File

@ -167,10 +167,6 @@ class AdvsController extends AdminController
$cities = $cityModel->all()->pluck('name', 'id')->all();
$users = $userModel->newQuery()
->select(DB::raw("CONCAT_WS('', first_name, ' ', last_name, ' (', gsm_phone, ' || ', email, ')') AS display_name"), 'id')
->pluck('display_name', 'id')
->toArray();
$categories = $categoryModel::query()->where('parent_category_id', null)
->leftJoin('cats_category_translations', 'cats_category.id', '=', 'cats_category_translations.entry_id')
->where('locale', config('app.locale'))
@ -194,7 +190,6 @@ class AdvsController extends AdminController
'exact' => true,
'filter' => 'select',
'query' => UserFilterQuery::class,
'options' => $users,
],
'status' => [
'filter' => 'select',

View File

@ -4,5 +4,31 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
interface CategoryInterface extends EntryInterface
{
public function getCat($id);
public function getParentCats($id, $type = null);
public function getCatLevel($id);
public function getParentsCount($id);
public function getSubCategories($id, $get = null);
public function getAllSubCategories($id);
public function deleteSubCategories($id);
public function searchKeyword($keyword, $selected = null);
public function getMainCategory();
public function getMeta_keywords($cat_id);
public function getMeta_description($cat_id);
public function getMeta_title($cat_id);
public function getMains($id);
public function getParent();
}

View File

@ -1,6 +1,8 @@
<?php namespace Visiosoft\ProfileModule\Http\Controller\Admin;
use Anomaly\Streams\Platform\Http\Controller\AdminController;
use Anomaly\UsersModule\User\Contract\UserRepositoryInterface;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Facades\Excel;
use Visiosoft\ProfileModule\Profile\UsersExport;
@ -10,4 +12,18 @@ class UsersController extends AdminController
{
return Excel::download(new UsersExport(), 'users-' . time() . '.csv');
}
public function queryUsers(UserRepositoryInterface $userRepository)
{
$term = request()->term;
if ($term) {
return $userRepository->newQuery()
->select(DB::raw("CONCAT_WS('', first_name, ' ', last_name, ' (', gsm_phone, ' || ', email, ')') AS name"), 'id')
->where('first_name', 'LIKE', "%$term%")
->orWhere('last_name', 'LIKE', "%$term%")
->orWhere('gsm_phone', 'LIKE', "%$term%")
->limit(setting_value('visiosoft.module.advs::user_filter_limit'))
->pluck('name', 'id');
}
}
}

View File

@ -69,6 +69,7 @@ class ProfileModuleServiceProvider extends AddonServiceProvider
'as' => 'users::exportUsers',
'uses' => 'Visiosoft\ProfileModule\Http\Controller\Admin\UsersController@exportUsers'
],
'api/profile/query-users' => 'Visiosoft\ProfileModule\Http\Controller\Admin\UsersController@queryUsers',
// MyProfileController
'profile/ads' => [