mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-09 14:56:13 -06:00
commit
3ae16acf24
@ -1,6 +1,16 @@
|
|||||||
$(document).ready( function () {
|
$(document).ready( function () {
|
||||||
$('#stockReport').DataTable({
|
$('#stockReport').DataTable({
|
||||||
ajax: '/admin/api/classified/report/stock',
|
ajax: {
|
||||||
|
url: '/admin/api/classified/report/stock',
|
||||||
|
dataSrc( json ) {
|
||||||
|
json.recordsTotal = json.total;
|
||||||
|
json.recordsFiltered = json.total;
|
||||||
|
|
||||||
|
return json.data;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
processing: true,
|
||||||
|
serverSide: true,
|
||||||
order: [[ 1, "asc" ]],
|
order: [[ 1, "asc" ]],
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
@ -26,7 +36,17 @@ $(document).ready( function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#unexplainedReport').DataTable({
|
$('#unexplainedReport').DataTable({
|
||||||
ajax: '/admin/api/classified/report/unexplained',
|
ajax: {
|
||||||
|
url: '/admin/api/classified/report/unexplained',
|
||||||
|
dataSrc( json ) {
|
||||||
|
json.recordsTotal = json.total;
|
||||||
|
json.recordsFiltered = json.total;
|
||||||
|
|
||||||
|
return json.data;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
processing: true,
|
||||||
|
serverSide: true,
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
data: 'name',
|
data: 'name',
|
||||||
@ -42,7 +62,17 @@ $(document).ready( function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#noImageReport').DataTable({
|
$('#noImageReport').DataTable({
|
||||||
ajax: '/admin/api/classified/report/no-image',
|
ajax: {
|
||||||
|
url: '/admin/api/classified/report/no-image',
|
||||||
|
dataSrc( json ) {
|
||||||
|
json.recordsTotal = json.total;
|
||||||
|
json.recordsFiltered = json.total;
|
||||||
|
|
||||||
|
return json.data;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
processing: true,
|
||||||
|
serverSide: true,
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
data: 'name',
|
data: 'name',
|
||||||
@ -58,7 +88,17 @@ $(document).ready( function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#metaPageReport').DataTable({
|
$('#metaPageReport').DataTable({
|
||||||
ajax: '/admin/api/classified/report/page',
|
ajax: {
|
||||||
|
url: '/admin/api/classified/report/page',
|
||||||
|
dataSrc( json ) {
|
||||||
|
json.recordsTotal = json.total;
|
||||||
|
json.recordsFiltered = json.total;
|
||||||
|
|
||||||
|
return json.data;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
processing: true,
|
||||||
|
serverSide: true,
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
data: 'name',
|
data: 'name',
|
||||||
|
|||||||
@ -542,7 +542,6 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
|||||||
return $query
|
return $query
|
||||||
->whereDate('finish_at', '>=', date("Y-m-d H:i:s"))
|
->whereDate('finish_at', '>=', date("Y-m-d H:i:s"))
|
||||||
->where('status', '=', 'approved')
|
->where('status', '=', 'approved')
|
||||||
->where('slug', '!=', '')
|
->where('slug', '!=', '');
|
||||||
->orderBy('publish_at', 'desc');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -603,16 +603,28 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
|
|
||||||
public function getStockReport()
|
public function getStockReport()
|
||||||
{
|
{
|
||||||
return $this->newQuery()
|
$classifieds = $this->newQuery()
|
||||||
->current()
|
->current()
|
||||||
->select('stock', 'name', 'advs_advs.id', 'slug')
|
->select('stock', 'name', 'advs_advs.id', 'slug')
|
||||||
->where('is_get_adv', true)
|
->where('is_get_adv', true)
|
||||||
->where('stock', '<=', 10)
|
|
||||||
->leftJoin('advs_advs_translations as classified_trans', function ($join) {
|
->leftJoin('advs_advs_translations as classified_trans', function ($join) {
|
||||||
$join->on('advs_advs.id', '=', 'classified_trans.entry_id');
|
$join->on('advs_advs.id', '=', 'classified_trans.entry_id');
|
||||||
$join->whereIn('locale', [config('app.locale'), setting_value('streams::default_locale'), 'en']);
|
$join->whereIn('locale', [config('app.locale'), setting_value('streams::default_locale'), 'en']);
|
||||||
})
|
});
|
||||||
->get();
|
|
||||||
|
if ($search = request('search.value')) {
|
||||||
|
$classifieds = $classifieds->where('name', 'LIKE', "%$search%");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($orderDir = request('order.0.dir')) {
|
||||||
|
$classifieds = $classifieds->orderBy(request('order.0.column') == 1 ? 'stock' : 'name', $orderDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
$start = request('start');
|
||||||
|
$limit = request('length') ?: 10;
|
||||||
|
$page = $start ? $start / $limit + 1 : 1;
|
||||||
|
|
||||||
|
return $classifieds->paginate($limit, ['*'], 'page', $page);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAllClassifiedsCount()
|
public function getAllClassifiedsCount()
|
||||||
@ -630,25 +642,38 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
|
|
||||||
public function getUnexplainedClassifiedsReport()
|
public function getUnexplainedClassifiedsReport()
|
||||||
{
|
{
|
||||||
return $this->newQuery()
|
$classifieds = $this->newQuery()
|
||||||
->current()
|
->current()
|
||||||
->select('name', 'advs_advs.id', 'slug')
|
->select('classified_trans.name', 'advs_advs.id', 'slug')
|
||||||
->where(function ($query) {
|
->where(function ($query) {
|
||||||
$query->where('advs_desc', '=', '')
|
$query->where('classified_trans.advs_desc', '=', '')
|
||||||
->orWhereNull('advs_desc');
|
->orWhereNull('classified_trans.advs_desc');
|
||||||
})
|
})
|
||||||
->leftJoin('advs_advs_translations as classified_trans', function ($join) {
|
->leftJoin('advs_advs_translations as classified_trans', function ($join) {
|
||||||
$join->on('advs_advs.id', '=', 'classified_trans.entry_id');
|
$join->on('advs_advs.id', '=', 'classified_trans.entry_id');
|
||||||
$join->whereIn('locale', [config('app.locale'), setting_value('streams::default_locale'), 'en']);
|
$join->whereIn('locale', [config('app.locale'), setting_value('streams::default_locale'), 'en']);
|
||||||
})
|
});
|
||||||
->get();
|
|
||||||
|
if ($search = request('search.value')) {
|
||||||
|
$classifieds = $classifieds->where('classified_trans.name', 'LIKE', "%$search%");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($orderDir = request('order.0.dir')) {
|
||||||
|
$classifieds = $classifieds->orderBy('name', $orderDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
$start = request('start');
|
||||||
|
$limit = request('length') ?: 10;
|
||||||
|
$page = $start ? $start / $limit + 1 : 1;
|
||||||
|
|
||||||
|
return $classifieds->paginate($limit, ['*'], 'page', $page);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNoImageClassifiedsReport()
|
public function getNoImageClassifiedsReport()
|
||||||
{
|
{
|
||||||
return $this->newQuery()
|
$classifieds = $this->newQuery()
|
||||||
->current()
|
->current()
|
||||||
->select('name', 'advs_advs.id', 'slug')
|
->select('classified_trans.name', 'advs_advs.id', 'slug')
|
||||||
->where(function ($query) {
|
->where(function ($query) {
|
||||||
$query->where('cover_photo', '=', '')
|
$query->where('cover_photo', '=', '')
|
||||||
->orWhereNull('cover_photo');
|
->orWhereNull('cover_photo');
|
||||||
@ -656,7 +681,20 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
->leftJoin('advs_advs_translations as classified_trans', function ($join) {
|
->leftJoin('advs_advs_translations as classified_trans', function ($join) {
|
||||||
$join->on('advs_advs.id', '=', 'classified_trans.entry_id');
|
$join->on('advs_advs.id', '=', 'classified_trans.entry_id');
|
||||||
$join->whereIn('locale', [config('app.locale'), setting_value('streams::default_locale'), 'en']);
|
$join->whereIn('locale', [config('app.locale'), setting_value('streams::default_locale'), 'en']);
|
||||||
})
|
});
|
||||||
->get();
|
|
||||||
|
if ($search = request('search.value')) {
|
||||||
|
$classifieds = $classifieds->where('classified_trans.name', 'LIKE', "%$search%");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($orderDir = request('order.0.dir')) {
|
||||||
|
$classifieds = $classifieds->orderBy('name', $orderDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
$start = request('start');
|
||||||
|
$limit = request('length') ?: 10;
|
||||||
|
$page = $start ? $start / $limit + 1 : 1;
|
||||||
|
|
||||||
|
return $classifieds->paginate($limit, ['*'], 'page', $page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,9 +16,7 @@ class ReportController extends AdminController
|
|||||||
|
|
||||||
public function stock()
|
public function stock()
|
||||||
{
|
{
|
||||||
return [
|
return $this->advRepository->getStockReport();
|
||||||
'data' => $this->advRepository->getStockReport()
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function status()
|
public function status()
|
||||||
@ -42,16 +40,12 @@ class ReportController extends AdminController
|
|||||||
|
|
||||||
public function unexplained()
|
public function unexplained()
|
||||||
{
|
{
|
||||||
return [
|
return $this->advRepository->getUnexplainedClassifiedsReport();
|
||||||
'data' => $this->advRepository->getUnexplainedClassifiedsReport()
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function noImage()
|
public function noImage()
|
||||||
{
|
{
|
||||||
return [
|
return $this->advRepository->getNoImageClassifiedsReport();
|
||||||
'data' => $this->advRepository->getNoImageClassifiedsReport()
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function page(PageRepositoryInterface $pageRepository)
|
public function page(PageRepositoryInterface $pageRepository)
|
||||||
@ -65,11 +59,20 @@ class ReportController extends AdminController
|
|||||||
->leftJoin('pages_pages_translations as pages_trans', function ($join) {
|
->leftJoin('pages_pages_translations as pages_trans', function ($join) {
|
||||||
$join->on('pages_pages.id', '=', 'pages_trans.entry_id');
|
$join->on('pages_pages.id', '=', 'pages_trans.entry_id');
|
||||||
$join->whereIn('locale', [config('app.locale'), setting_value('streams::default_locale'), 'en']);
|
$join->whereIn('locale', [config('app.locale'), setting_value('streams::default_locale'), 'en']);
|
||||||
})
|
});
|
||||||
->get();
|
|
||||||
|
|
||||||
return [
|
if ($search = request('search.value')) {
|
||||||
'data' => $pages
|
$pages = $pages->where('title', 'LIKE', "%$search%");
|
||||||
];
|
}
|
||||||
|
|
||||||
|
if ($orderDir = request('order.0.dir')) {
|
||||||
|
$pages = $pages->orderBy('title', $orderDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
$start = request('start');
|
||||||
|
$limit = request('length') ?: 10;
|
||||||
|
$page = $start ? $start / $limit + 1 : 1;
|
||||||
|
|
||||||
|
return $pages->paginate($limit, ['*'], 'page', $page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,16 @@
|
|||||||
$(document).ready( function () {
|
$(document).ready( function () {
|
||||||
$('#newMemberReport').DataTable({
|
$('#newMemberReport').DataTable({
|
||||||
ajax: '/admin/api/profile/report/latest',
|
ajax: {
|
||||||
order: [[ 1, "desc" ]],
|
url: '/admin/api/profile/report/latest',
|
||||||
|
dataSrc( json ) {
|
||||||
|
json.recordsTotal = json.total;
|
||||||
|
json.recordsFiltered = json.total;
|
||||||
|
|
||||||
|
return json.data;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
processing: true,
|
||||||
|
serverSide: true,
|
||||||
columns: [
|
columns: [
|
||||||
{ data: 'member', defaultContent: usersReportTrans.undefined_member },
|
{ data: 'member', defaultContent: usersReportTrans.undefined_member },
|
||||||
{ data: 'date' },
|
{ data: 'date' },
|
||||||
@ -9,8 +18,17 @@ $(document).ready( function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#loginMemberReport').DataTable({
|
$('#loginMemberReport').DataTable({
|
||||||
ajax: '/admin/api/profile/report/login',
|
ajax: {
|
||||||
order: [[ 1, "desc" ]],
|
url: '/admin/api/profile/report/login',
|
||||||
|
dataSrc( json ) {
|
||||||
|
json.recordsTotal = json.total;
|
||||||
|
json.recordsFiltered = json.total;
|
||||||
|
|
||||||
|
return json.data;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
processing: true,
|
||||||
|
serverSide: true,
|
||||||
columns: [
|
columns: [
|
||||||
{ data: 'member', defaultContent: usersReportTrans.undefined_member },
|
{ data: 'member', defaultContent: usersReportTrans.undefined_member },
|
||||||
{ data: 'date' },
|
{ data: 'date' },
|
||||||
|
|||||||
@ -17,13 +17,24 @@ class ReportController extends AdminController
|
|||||||
public function latest()
|
public function latest()
|
||||||
{
|
{
|
||||||
$members = $this->userRepository->newQuery()
|
$members = $this->userRepository->newQuery()
|
||||||
->selectRaw("DATE_FORMAT(created_at, '%d.%m.%Y %H:%i') as date, CONCAT_WS('', first_name, ' ', last_name) AS member")
|
->selectRaw("DATE_FORMAT(created_at, '%d.%m.%Y %H:%i') as date, CONCAT_WS('', first_name, ' ', last_name) AS member, id AS user_id")
|
||||||
->where('created_at', '>=', Carbon::today()->subWeek())
|
->where('created_at', '>=', Carbon::today()->subWeek());
|
||||||
->get();
|
|
||||||
|
|
||||||
return [
|
if ($search = request('search.value')) {
|
||||||
'data' => $members
|
$members = $members->whereRaw("
|
||||||
];
|
(SELECT CONCAT_WS('', first_name, ' ', last_name) AS member) LIKE '%$search%'
|
||||||
|
");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($orderDir = request('order.0.dir')) {
|
||||||
|
$members = $members->orderBy('member', $orderDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
$start = request('start');
|
||||||
|
$limit = request('length') ?: 10;
|
||||||
|
$page = $start ? $start / $limit + 1 : 1;
|
||||||
|
|
||||||
|
return $members->paginate($limit, ['*'], 'page', $page);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function login()
|
public function login()
|
||||||
@ -31,11 +42,22 @@ class ReportController extends AdminController
|
|||||||
$members = $this->userRepository->newQuery()
|
$members = $this->userRepository->newQuery()
|
||||||
->selectRaw("DATE_FORMAT(last_login_at, '%d.%m.%Y %H:%i') as date, CONCAT_WS('', first_name, ' ', last_name) AS member")
|
->selectRaw("DATE_FORMAT(last_login_at, '%d.%m.%Y %H:%i') as date, CONCAT_WS('', first_name, ' ', last_name) AS member")
|
||||||
->whereNotNull('last_login_at')
|
->whereNotNull('last_login_at')
|
||||||
->where('last_login_at', '>=', Carbon::today()->subWeek())
|
->where('last_login_at', '>=', Carbon::today()->subWeek());
|
||||||
->get();
|
|
||||||
|
|
||||||
return [
|
if ($search = request('search.value')) {
|
||||||
'data' => $members
|
$members = $members->whereRaw("
|
||||||
];
|
(SELECT CONCAT_WS('', first_name, ' ', last_name) AS member) LIKE '%$search%'
|
||||||
|
");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($orderDir = request('order.0.dir')) {
|
||||||
|
$members = $members->orderBy('member', $orderDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
$start = request('start');
|
||||||
|
$limit = request('length') ?: 10;
|
||||||
|
$page = $start ? $start / $limit + 1 : 1;
|
||||||
|
|
||||||
|
return $members->paginate($limit, ['*'], 'page', $page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user