diff --git a/addons/default/visiosoft/advs-module/resources/js/admin/dashboard/report.js b/addons/default/visiosoft/advs-module/resources/js/admin/dashboard/report.js new file mode 100644 index 000000000..92522a569 --- /dev/null +++ b/addons/default/visiosoft/advs-module/resources/js/admin/dashboard/report.js @@ -0,0 +1,59 @@ +$(document).ready( function () { + $('#stockReport').DataTable({ + ajax: '/admin/api/classified/report/stock', + order: [[ 1, "asc" ]], + columns: [ + { + data: 'name', + render: function ( data, type, row, meta ) { + return ` + + ${data ?? productsReportTrans.undefined_product} + + `; + } + }, + { data: 'stock' }, + ], + }); + + $('#activePassiveReport').DataTable({ + ajax: '/admin/api/classified/report/status', + columns: [ + { data: 'status' }, + { data: 'count' }, + ], + }); + + $('#unexplainedReport').DataTable({ + ajax: '/admin/api/classified/report/unexplained', + columns: [ + { + data: 'name', + render: function ( data, type, row, meta ) { + return ` + + ${data ?? productsReportTrans.undefined_product} + + `; + } + }, + ], + }); + + $('#noImageReport').DataTable({ + ajax: '/admin/api/classified/report/no-image', + columns: [ + { + data: 'name', + render: function ( data, type, row, meta ) { + return ` + + ${data ?? productsReportTrans.undefined_product} + + `; + } + }, + ], + }); +} ); diff --git a/addons/default/visiosoft/advs-module/resources/lang/en/field.php b/addons/default/visiosoft/advs-module/resources/lang/en/field.php index b26c57483..f1ecaee86 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/en/field.php +++ b/addons/default/visiosoft/advs-module/resources/lang/en/field.php @@ -383,4 +383,13 @@ return [ 'name_a_z' => 'Name (A to Z)', 'name_z_a' => 'Name (Z to A)', 'select_lang_ads' => 'select the language of the ads', + + // Report + 'product_stock_report' => 'Product Stock Report', + 'active_passive_products_report' => 'Active-Passive Products Report', + 'unexplained_products_report' => 'Unexplained Products Report', + 'non_image_products_report' => 'Non-Image Products Report', + 'product' => 'Product', + 'count' => 'Count', + 'undefined_product' => 'Undefined Product', ]; diff --git a/addons/default/visiosoft/advs-module/resources/views/admin/dashboard/report.twig b/addons/default/visiosoft/advs-module/resources/views/admin/dashboard/report.twig new file mode 100644 index 000000000..9f7e14ae4 --- /dev/null +++ b/addons/default/visiosoft/advs-module/resources/views/admin/dashboard/report.twig @@ -0,0 +1,64 @@ +
+ {% set reports = [ + { + 'title': trans('visiosoft.module.advs::field.product_stock_report'), + 'id': 'stockReport', + 'columns': [ + trans('visiosoft.module.advs::field.product'), + trans('visiosoft.module.advs::field.stock.name'), + ], + }, + { + 'title': trans('visiosoft.module.advs::field.active_passive_products_report'), + 'id': 'activePassiveReport', + 'columns': [ + trans('visiosoft.module.advs::field.status.name'), + trans('visiosoft.module.advs::field.count'), + ], + }, + { + 'title': trans('visiosoft.module.advs::field.unexplained_products_report'), + 'id': 'unexplainedReport', + 'columns': [ + trans('visiosoft.module.advs::field.product'), + ], + }, + { + 'title': trans('visiosoft.module.advs::field.non_image_products_report'), + 'id': 'noImageReport', + 'columns': [ + trans('visiosoft.module.advs::field.product'), + ], + }, + ] %} + + {% for report in reports %} +
+
+
+
{{ report.title }}
+
+ +
+ + + + {% for column in report.columns %} + + {% endfor %} + + +
{{ column }}
+
+
+
+ {% endfor %} +
+ + + +{{ asset_add('scripts.js', 'visiosoft.module.advs::js/admin/dashboard/report.js') }} diff --git a/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php b/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php index 484aba9e9..3bde3c4f4 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php +++ b/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php @@ -536,4 +536,13 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface return $lastCat; } + + public function scopeCurrent($query) + { + return $query + ->whereDate('finish_at', '>=', date("Y-m-d H:i:s")) + ->where('status', '=', 'approved') + ->where('slug', '!=', '') + ->orderBy('publish_at', 'desc'); + } } diff --git a/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php b/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php index c34007876..cea08a2ce 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php +++ b/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php @@ -592,4 +592,63 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface return false; } + + public function getStockReport() + { + return $this->newQuery() + ->current() + ->select('stock', 'name', 'advs_advs.id', 'slug') + ->where('is_get_adv', true) + ->where('stock', '<=', 10) + ->leftJoin('advs_advs_translations as classified_trans', function ($join) { + $join->on('advs_advs.id', '=', 'classified_trans.entry_id'); + $join->whereIn('locale', [config('app.locale'), setting_value('streams::default_locale'), 'en']); + }) + ->get(); + } + + public function getAllClassifiedsCount() + { + return $this->newQuery() + ->count(); + } + + public function getCurrentClassifiedsCount() + { + return $this->newQuery() + ->current() + ->count(); + } + + public function getUnexplainedClassifiedsReport() + { + return $this->newQuery() + ->current() + ->select('name', 'advs_advs.id', 'slug') + ->where(function ($query) { + $query->where('advs_desc', '=', '') + ->orWhereNull('advs_desc'); + }) + ->leftJoin('advs_advs_translations as classified_trans', function ($join) { + $join->on('advs_advs.id', '=', 'classified_trans.entry_id'); + $join->whereIn('locale', [config('app.locale'), setting_value('streams::default_locale'), 'en']); + }) + ->get(); + } + + public function getNoImageClassifiedsReport() + { + return $this->newQuery() + ->current() + ->select('name', 'advs_advs.id', 'slug') + ->where(function ($query) { + $query->where('cover_photo', '=', '') + ->orWhereNull('cover_photo'); + }) + ->leftJoin('advs_advs_translations as classified_trans', function ($join) { + $join->on('advs_advs.id', '=', 'classified_trans.entry_id'); + $join->whereIn('locale', [config('app.locale'), setting_value('streams::default_locale'), 'en']); + }) + ->get(); + } } diff --git a/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvInterface.php b/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvInterface.php index e38e2a87a..6622c30aa 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvInterface.php +++ b/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvInterface.php @@ -95,4 +95,6 @@ interface AdvInterface extends EntryInterface public function getCatsIDs(); public function lastCategory(); + + public function scopeCurrent($query); } diff --git a/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvRepositoryInterface.php b/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvRepositoryInterface.php index 53e667867..4856c3bd3 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvRepositoryInterface.php +++ b/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvRepositoryInterface.php @@ -60,4 +60,14 @@ interface AdvRepositoryInterface extends EntryRepositoryInterface public function findByCFJSON($key, $value); public function uploadImage(); + + public function getStockReport(); + + public function getAllClassifiedsCount(); + + public function getCurrentClassifiedsCount(); + + public function getUnexplainedClassifiedsReport(); + + public function getNoImageClassifiedsReport(); } diff --git a/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php b/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php index 8b96de2d9..b92a5472f 100644 --- a/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php +++ b/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php @@ -248,6 +248,12 @@ class AdvsModuleServiceProvider extends AddonServiceProvider 'as' => 'visiosoft.module.advs::ad.change.status', 'uses' => 'Visiosoft\AdvsModule\Http\Controller\StatusController@change' ], + + // Admin ReportController + 'admin/api/classified/report/stock' => 'Visiosoft\AdvsModule\Http\Controller\Admin\ReportController@stock', + 'admin/api/classified/report/status' => 'Visiosoft\AdvsModule\Http\Controller\Admin\ReportController@status', + 'admin/api/classified/report/unexplained' => 'Visiosoft\AdvsModule\Http\Controller\Admin\ReportController@unexplained', + 'admin/api/classified/report/no-image' => 'Visiosoft\AdvsModule\Http\Controller\Admin\ReportController@noImage', ]; protected $middleware = [ diff --git a/addons/default/visiosoft/advs-module/src/Http/Controller/Admin/ReportController.php b/addons/default/visiosoft/advs-module/src/Http/Controller/Admin/ReportController.php new file mode 100644 index 000000000..8acc6ac6b --- /dev/null +++ b/addons/default/visiosoft/advs-module/src/Http/Controller/Admin/ReportController.php @@ -0,0 +1,55 @@ +advRepository = $advRepository; + } + + public function stock() + { + return [ + 'data' => $this->advRepository->getStockReport() + ]; + } + + public function status() + { + $all = $this->advRepository->getAllClassifiedsCount(); + $active = $this->advRepository->getCurrentClassifiedsCount(); + + return [ + 'data' => [ + [ + 'status' => 'Active', + 'count' => $active, + ], + [ + 'status' => 'Passive', + 'count' => $all - $active, + ], + ] + ]; + } + + public function unexplained() + { + return [ + 'data' => $this->advRepository->getUnexplainedClassifiedsReport() + ]; + } + + public function noImage() + { + return [ + 'data' => $this->advRepository->getNoImageClassifiedsReport() + ]; + } +} diff --git a/addons/default/visiosoft/base-theme/resources/css/bootstrap-notify-visio.css b/addons/default/visiosoft/base-theme/resources/css/bootstrap-notify-visio.css index 68a2dbc48..ecb8f02a3 100644 --- a/addons/default/visiosoft/base-theme/resources/css/bootstrap-notify-visio.css +++ b/addons/default/visiosoft/base-theme/resources/css/bootstrap-notify-visio.css @@ -1,7 +1,6 @@ .swal2-container { display: grid; position: fixed; - z-index: 1060; top: 0; right: 0; bottom: 0; @@ -53,4 +52,8 @@ body.swal2-toast-shown .swal2-container.swal2-top-end, body.swal2-toast-shown .s grid-column: 3; align-self: start; justify-self: end; +} + +.swal2-title { + max-width: 14rem; } \ No newline at end of file diff --git a/addons/default/visiosoft/base-theme/resources/js/script.js b/addons/default/visiosoft/base-theme/resources/js/script.js index 23442b5e7..7c62c80c7 100644 --- a/addons/default/visiosoft/base-theme/resources/js/script.js +++ b/addons/default/visiosoft/base-theme/resources/js/script.js @@ -1,4 +1,4 @@ $('.categories-list .show-all').on('click', function () { - $(this).siblings('.hidden-category').toggleClass('hidden') - $(this).find('a span').toggleClass('hidden') + $(this).siblings('.hidden-category').toggleClass('hidden'); + $(this).find('a span').toggleClass('hidden'); }); diff --git a/addons/default/visiosoft/defaultadmin-theme/resources/css/theme.css b/addons/default/visiosoft/defaultadmin-theme/resources/css/theme.css index 1157324b0..142fa6a55 100644 --- a/addons/default/visiosoft/defaultadmin-theme/resources/css/theme.css +++ b/addons/default/visiosoft/defaultadmin-theme/resources/css/theme.css @@ -2628,8 +2628,8 @@ body { display: none; } #login .login-container .logo svg, #login .login-container .logo img { - width: 45px; - max-height: 82px; + /*width: 45px;*/ + /*max-height: 82px;*/ fill: #ffffff; margin-top: -30px; vertical-align: middle; @@ -2668,8 +2668,8 @@ body { font-family: "Montserrat", sans-serif; } #login .logo svg, #login .logo img { - width: 45px; - max-height: 82px; + width: 8rem; + height: 8rem; margin-top: -30px; vertical-align: middle; object-fit: contain; @@ -2724,8 +2724,8 @@ body { margin-bottom: 2rem; } #login .login-container .logo svg, #login .login-container .logo img { - width: 55px; - max-height: 100px; + width: 8rem; + height: auto; } } @media (max-width: 767px) { diff --git a/addons/default/visiosoft/profile-module/resources/assets/js/admin/dashboard/report.js b/addons/default/visiosoft/profile-module/resources/assets/js/admin/dashboard/report.js new file mode 100644 index 000000000..bd649e8d1 --- /dev/null +++ b/addons/default/visiosoft/profile-module/resources/assets/js/admin/dashboard/report.js @@ -0,0 +1,19 @@ +$(document).ready( function () { + $('#newMemberReport').DataTable({ + ajax: '/admin/api/profile/report/latest', + order: [[ 1, "desc" ]], + columns: [ + { data: 'member', defaultContent: usersReportTrans.undefined_member }, + { data: 'date' }, + ], + }); + + $('#loginMemberReport').DataTable({ + ajax: '/admin/api/profile/report/login', + order: [[ 1, "desc" ]], + columns: [ + { data: 'member', defaultContent: usersReportTrans.undefined_member }, + { data: 'date' }, + ], + }); +} ); diff --git a/addons/default/visiosoft/profile-module/resources/lang/en/field.php b/addons/default/visiosoft/profile-module/resources/lang/en/field.php index 62a8abf0d..1f8b23fc6 100644 --- a/addons/default/visiosoft/profile-module/resources/lang/en/field.php +++ b/addons/default/visiosoft/profile-module/resources/lang/en/field.php @@ -496,4 +496,12 @@ return [ 'receive_messages_email' => [ 'name' => 'Receive Messages Email', ], + + // Report + 'member' => 'Member', + 'registered_at' => 'Registered At', + 'login_at' => 'Login At', + 'undefined_member' => 'Undefined Member', + 'new_membership_report' => 'New Membership Report', + 'member_login_reports' => 'Member Login Reports', ]; diff --git a/addons/default/visiosoft/profile-module/resources/views/admin/dashboard/report.twig b/addons/default/visiosoft/profile-module/resources/views/admin/dashboard/report.twig new file mode 100644 index 000000000..63fe3e20d --- /dev/null +++ b/addons/default/visiosoft/profile-module/resources/views/admin/dashboard/report.twig @@ -0,0 +1,50 @@ +
+ {% set reports = [ + { + 'title': trans('visiosoft.module.profile::field.new_membership_report'), + 'id': 'newMemberReport', + 'columns': [ + trans('visiosoft.module.profile::field.member'), + trans('visiosoft.module.profile::field.registered_at'), + ], + }, + { + 'title': trans('visiosoft.module.profile::field.member_login_reports'), + 'id': 'loginMemberReport', + 'columns': [ + trans('visiosoft.module.profile::field.member'), + trans('visiosoft.module.profile::field.login_at'), + ], + }, + ] %} + + {% for report in reports %} +
+
+
+
{{ report.title }}
+
+ +
+ + + + {% for column in report.columns %} + + {% endfor %} + + +
{{ column }}
+
+
+
+ {% endfor %} +
+ + + +{{ asset_add('scripts.js', 'visiosoft.module.profile::assets/js/admin/dashboard/report.js') }} diff --git a/addons/default/visiosoft/profile-module/src/Http/Controller/Admin/ReportController.php b/addons/default/visiosoft/profile-module/src/Http/Controller/Admin/ReportController.php new file mode 100644 index 000000000..cb27c4684 --- /dev/null +++ b/addons/default/visiosoft/profile-module/src/Http/Controller/Admin/ReportController.php @@ -0,0 +1,41 @@ +userRepository = $userRepository; + } + + public function latest() + { + $members = $this->userRepository->newQuery() + ->selectRaw("DATE_FORMAT(created_at, '%d.%m.%Y %H:%i') as date, CONCAT_WS('', first_name, ' ', last_name) AS member") + ->where('created_at', '>=', Carbon::today()->subWeek()) + ->get(); + + return [ + 'data' => $members + ]; + } + + public function login() + { + $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") + ->whereNotNull('last_login_at') + ->where('last_login_at', '>=', Carbon::today()->subWeek()) + ->get(); + + return [ + 'data' => $members + ]; + } +} diff --git a/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php b/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php index b43cd7ceb..3cb843f31 100644 --- a/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php +++ b/addons/default/visiosoft/profile-module/src/ProfileModuleServiceProvider.php @@ -124,6 +124,10 @@ class ProfileModuleServiceProvider extends AddonServiceProvider // CacheController 'ajax/get-user-info' => 'Visiosoft\ProfileModule\Http\Controller\CacheController@getUserInfo', + + // Admin ReportController + 'admin/api/profile/report/latest' => 'Visiosoft\ProfileModule\Http\Controller\Admin\ReportController@latest', + 'admin/api/profile/report/login' => 'Visiosoft\ProfileModule\Http\Controller\Admin\ReportController@login', ]; protected $aliases = [ diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php index 1670987c1..395c518bc 100644 --- a/app/Providers/BroadcastServiceProvider.php +++ b/app/Providers/BroadcastServiceProvider.php @@ -18,4 +18,4 @@ class BroadcastServiceProvider extends ServiceProvider require base_path('routes/channels.php'); } -} \ No newline at end of file +} diff --git a/config/broadcasting.php b/config/broadcasting.php index 47a8db467..8b5ba4b16 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -32,15 +32,15 @@ return [ 'pusher' => [ 'driver' => 'pusher', - 'key' => env('PUSHER_APP_KEY', '12345'), - 'secret' => env('PUSHER_APP_SECRET', '12345'), - 'app_id' => env('PUSHER_APP_ID', '12345'), + 'key' => env('PUSHER_APP_KEY'), + 'secret' => env('PUSHER_APP_SECRET'), + 'app_id' => env('PUSHER_APP_ID'), 'options' => [ - 'cluster' => env('PUSHER_APP_CLUSTER', 'mt1'), - 'encrypted' => env('BROADCAST_SSL', false), + 'cluster' => env('PUSHER_APP_CLUSTER'), + 'encrypted' => true, 'host' => '127.0.0.1', 'port' => 6001, - 'scheme' => env('BROADCAST_SSL', false) ? 'https' : 'http', + 'scheme' => 'https', 'curl_options' => [ CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSL_VERIFYPEER => 0, diff --git a/routes/channels.php b/routes/channels.php index 5d451e1fa..9c586faf0 100644 --- a/routes/channels.php +++ b/routes/channels.php @@ -13,6 +13,6 @@ use Illuminate\Support\Facades\Broadcast; | */ -Broadcast::channel('App.Models.User.{id}', function ($user, $id) { +Broadcast::channel('Anomaly.UsersModule.User.UserModel.{id}', function ($user, $id) { return (int) $user->id === (int) $id; });