final commit
This commit is contained in:
@@ -7,12 +7,11 @@ use App\Model\helpdesk\Notification\Notification;
|
||||
use App\Model\helpdesk\Notification\UserNotification;
|
||||
use App\User;
|
||||
|
||||
class NotificationController extends Controller
|
||||
{
|
||||
class NotificationController extends Controller {
|
||||
|
||||
public $user;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
public function __construct() {
|
||||
$user = new User();
|
||||
$this->user = $user;
|
||||
}
|
||||
@@ -22,8 +21,7 @@ class NotificationController extends Controller
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public static function getNotifications()
|
||||
{
|
||||
public static function getNotifications() {
|
||||
$notifications = UserNotification::join('notifications', 'user_notification.notification_id', '=', 'notifications.id')
|
||||
->join('notification_types', 'notifications.type_id', '=', 'notification_types.id')
|
||||
->where('user_notification.user_id', '=', \Auth::user()->id)
|
||||
@@ -32,8 +30,7 @@ class NotificationController extends Controller
|
||||
return $notifications;
|
||||
}
|
||||
|
||||
public function create($model_id, $userid_created, $type_id, $forwhome = [])
|
||||
{
|
||||
public function create($model_id, $userid_created, $type_id, $forwhome = []) {
|
||||
try {
|
||||
if (empty($forwhome)) {
|
||||
$forwhome = $this->user->where('role', '!=', 'user')->get()->toArray();
|
||||
@@ -52,8 +49,16 @@ class NotificationController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function markRead($id)
|
||||
{
|
||||
public function markAllRead($id) {
|
||||
$markasread = UserNotification::where('user_id', '=', \Auth::user()->id)->where('is_read', '=', '0')->get();
|
||||
foreach ($markasread as $mark) {
|
||||
$mark->is_read = '1';
|
||||
$mark->save();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function markRead($id) {
|
||||
$markasread = UserNotification::where('notification_id', '=', $id)->where('user_id', '=', \Auth::user()->id)->where('is_read', '=', '0')->get();
|
||||
foreach ($markasread as $mark) {
|
||||
$mark->is_read = '1';
|
||||
@@ -63,15 +68,13 @@ class NotificationController extends Controller
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function show()
|
||||
{
|
||||
public function show() {
|
||||
$notifications = $this->getNotifications();
|
||||
|
||||
return view('notifications-all', compact('notifications'));
|
||||
}
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
public function delete($id) {
|
||||
$markasread = UserNotification::where('notification_id', '=', $id)->where('user_id', '=', \Auth::user()->id)->get();
|
||||
foreach ($markasread as $mark) {
|
||||
$mark->delete();
|
||||
@@ -79,4 +82,5 @@ class NotificationController extends Controller
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -33,6 +33,7 @@ Route::group(['middleware' => 'roles', 'middleware' => 'auth', 'middleware' => '
|
||||
|
||||
//Notification marking
|
||||
Route::post('mark-read/{id}', 'Common\NotificationController@markRead');
|
||||
Route::post('mark-all-read/{id}', 'Common\NotificationController@markAllRead');
|
||||
Breadcrumbs::register('notification.list', function ($breadcrumbs) {
|
||||
$breadcrumbs->parent('dashboard');
|
||||
$breadcrumbs->push('All Notifications', route('notification.list'));
|
||||
|
@@ -122,7 +122,7 @@ class="active"
|
||||
|
||||
<!-- checkbox -->
|
||||
<input type="checkbox" value="" name="cc" class="noti_User clickfun" id="{{$notification -> notification_id}}">
|
||||
<label for='cl' data-toggle="tooltip" data-placement="top" title="Mark Read"><span></span> <img src="{{$user->profile_pic}}" class="img-circle" style="width:6%;height: 6%" alt="User Image" />
|
||||
<label for='cl' data-toggle="tooltip" data-placement="top" title="Mark Read"><span></span> <img src="{{$user->profile_pic}}" class="img-circle" style="width:25px;height: 25px" alt="User Image" />
|
||||
<!-- todo text -->
|
||||
<h6 class="textcontent marginzero"><a href="{!! route('user.show', $notification->notification_id) !!}" id="{{$notification -> notification_id}}" class='noti_User'>{!! $notification->message !!}</a></h6>
|
||||
<small class="label label-danger"><i class="fa fa-clock-o"></i> {{ $notification -> created_at }}</small></label> <!-- Emphasis label -->
|
||||
@@ -139,7 +139,7 @@ class="active"
|
||||
|
||||
<!-- checkbox -->
|
||||
<input type="checkbox" value="" name="cc" class="noti_User clickfun" id="{{$notification -> notification_id}}">
|
||||
<label for='cl' data-toggle="tooltip" data-placement="top" title="Mark Read"><span></span> <img src="{{$user->profile_pic}}" class="img-circle" style="width:6%;height: 6%" alt="User Image" />
|
||||
<label for='cl' data-toggle="tooltip" data-placement="top" title="Mark Read"><span></span> <img src="{{$user->profile_pic}}" class="img-circle" style="width:25px;height: 25px" alt="User Image" />
|
||||
<!-- todo text -->
|
||||
<h6 class="textcontent marginzero"><a href="{!! route('user.show', $notification->notification_id) !!}" id="{{$notification -> notification_id}}" class='noti_User'>{!! $notification->message !!}</a></h6>
|
||||
<small class="label label-danger"><i class="fa fa-clock-o"></i> {{ $notification -> created_at }}</small></label> <!-- Emphasis label -->
|
||||
@@ -156,7 +156,7 @@ class="active"
|
||||
<li class="task">
|
||||
<?php $ticket_number = App\Model\helpdesk\Ticket\Tickets::whereId($notification -> model_id)->first(); ?>
|
||||
<input type="checkbox" value="" name="cc" data-toggle="tooltip" data-placement="top" title="Mark Read" class="noti_User clickfun" id="{{$notification -> notification_id}}">
|
||||
<label for='cl'><span></span> <img src="{{$user->profile_pic}}" class="img-circle" style="width:6%;height: 6%" alt="User Image" />
|
||||
<label for='cl'><span></span> <img src="{{$user->profile_pic}}" class="img-circle" style="width:25px;height: 25px" alt="User Image" />
|
||||
<h6 class="textcontent marginzero"><a href="{!! route('ticket.thread', $notification->model_id) !!}" id='{{ $notification->notification_id }}' class='noti_User'>{!! $notification->message !!} with id "{!!$ticket_number->ticket_number!!}"</a></h6>
|
||||
<small class="label label-info"><i class="fa fa-clock-o"></i> {{ $notification -> created_at }}</small>
|
||||
</label><div class="tools">
|
||||
@@ -168,7 +168,7 @@ class="active"
|
||||
<li>
|
||||
<?php $ticket_number = App\Model\helpdesk\Ticket\Tickets::whereId($notification -> model_id)->first(); ?>
|
||||
<input type="checkbox" value="" name="cc" data-toggle="tooltip" data-placement="top" title="Mark Read" class="noti_User clickfun" id="{{$notification -> notification_id}}">
|
||||
<label for='cl'><span></span> <img src="{{$user->profile_pic}}" class="img-circle" style="width:6%;height: 6%" alt="User Image" />
|
||||
<label for='cl'><span></span> <img src="{{$user->profile_pic}}" class="img-circle" style="width:25px;height: 25px" alt="User Image" />
|
||||
<h6 class="textcontent marginzero"><a href="{!! route('ticket.thread', $notification->model_id) !!}" id='{{ $notification->notification_id }}' class='noti_User'>{!! $notification->message !!} with id "{!!$ticket_number->ticket_number!!}"</a></h6>
|
||||
<small class="label label-info"><i class="fa fa-clock-o"></i> {{ $notification -> created_at }}</small>
|
||||
</label><div class="tools">
|
||||
|
@@ -45,13 +45,11 @@
|
||||
<?php
|
||||
$replacetop = 0;
|
||||
$replacetop = \Event::fire('service.desk.admin.topbar.replace', array());
|
||||
|
||||
if (count($replacetop) == 0) {
|
||||
$replacetop = 0;
|
||||
}
|
||||
$replaceside = 0;
|
||||
$replaceside = \Event::fire('service.desk.admin.sidebar.replace', array());
|
||||
|
||||
if (count($replaceside) == 0) {
|
||||
$replaceside = 0;
|
||||
}
|
||||
@@ -90,9 +88,7 @@
|
||||
<i class="fa fa-bell-o"></i>
|
||||
<span class="label label-danger" id="count">{!! count($noti) !!}</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu" style="width: -moz-max-content;
|
||||
width: -webkit-max-content;
|
||||
width: -o-max-content;">
|
||||
<ul class="dropdown-menu" style="width:500px">
|
||||
|
||||
<div id="alert11" class="alert alert-success alert-dismissable" style="display:none;">
|
||||
<button id="dismiss11" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
@@ -102,7 +98,7 @@
|
||||
|
||||
<li id="refreshNote">
|
||||
|
||||
<li class="header">You have {!! count($noti) !!} notifications. <a class="pull-right" id="read-all" href="#">Mark all as read.</a></li>
|
||||
<li class="header">You have {!! count($noti) !!} notifications. <a class="pull-right" id="read-all" href="#">Mark all as read.</a> </li>
|
||||
|
||||
<ul class="menu">
|
||||
@foreach($notifications as $notification)
|
||||
@@ -123,7 +119,7 @@
|
||||
@endif
|
||||
@else
|
||||
|
||||
<?php $ticket_number = App\Model\helpdesk\Ticket\Tickets::whereId($notification -> model_id)->first(); ?>
|
||||
<?php $ticket_number = App\Model\helpdesk\Ticket\Tickets::whereId($notification->model_id)->first(); ?>
|
||||
@if($notification->is_read == 1)
|
||||
<li class="task" style="list-style: none;margin-left: -30px"><span> <img src="{{$user->profile_pic}}" class="img-circle" style="width:6%;height: 5%" alt="User Image" />
|
||||
<a href="{!! route('ticket.thread', $notification->model_id) !!}" id='{{ $notification->notification_id}}' class='noti_User'>
|
||||
@@ -173,7 +169,7 @@
|
||||
<!-- Menu Footer-->
|
||||
<li class="user-footer" style="background-color:#1a2226;">
|
||||
<div class="pull-left">
|
||||
<a href="{{url('profile')}}" class="btn btn-info btn-sm"><b>{!! Lang::get('lang.profile') !!}</b></a>
|
||||
<a href="{{url('admin-profile')}}" class="btn btn-info btn-sm"><b>{!! Lang::get('lang.profile') !!}</b></a>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<a href="{{url('auth/logout')}}" class="btn btn-danger btn-sm"><b>{!! Lang::get('lang.sign_out') !!}</b></a>
|
||||
@@ -310,7 +306,8 @@
|
||||
</li>
|
||||
<li class="header">{!! Lang::get('lang.Updates') !!}</li>
|
||||
<li @yield('update')>
|
||||
<?php $update = App\Model\helpdesk\Utility\Version_Check::where('id', '=', 1)->first();
|
||||
<?php
|
||||
$update = App\Model\helpdesk\Utility\Version_Check::where('id', '=', 1)->first();
|
||||
if ($update->current_version == $update->new_version) {
|
||||
?>
|
||||
<a href="{!! URL::route('checkupdate') !!}" id="checkUpdate">
|
||||
@@ -329,7 +326,7 @@
|
||||
<?php } ?>
|
||||
</li>
|
||||
@endif
|
||||
<?php \Event::fire('service.desk.admin.sidebar', array()); ?>
|
||||
<?php \Event::fire('service.desk.admin.sidebar', array()); ?>
|
||||
</ul>
|
||||
</section>
|
||||
<!-- /.sidebar -->
|
||||
@@ -388,7 +385,7 @@
|
||||
<script>
|
||||
$(function() {
|
||||
//Add text editor
|
||||
$("textarea").wysihtml5();
|
||||
$("textarea").wysihtml5();
|
||||
});
|
||||
// $(function(){
|
||||
// $("#checkUpdate").on('click',function(){
|
||||
@@ -402,54 +399,73 @@ $("textarea").wysihtml5();
|
||||
// alert(response);
|
||||
// $("#gif-update").hide();
|
||||
// }
|
||||
|
||||
// })
|
||||
// return false;
|
||||
// });
|
||||
// });
|
||||
|
||||
$(function() {
|
||||
//Enable iCheck plugin for checkboxes
|
||||
//iCheck for checkbox and radio inputs
|
||||
$('input[type="checkbox"]').iCheck({
|
||||
checkboxClass: 'icheckbox_flat-blue',
|
||||
radioClass: 'iradio_flat-blue'
|
||||
});
|
||||
|
||||
$('input[type="checkbox"]').iCheck({
|
||||
checkboxClass: 'icheckbox_flat-blue',
|
||||
radioClass: 'iradio_flat-blue'
|
||||
});
|
||||
//Enable check and uncheck all functionality
|
||||
$(".checkbox-toggle").click(function() {
|
||||
var clicks = $(this).data('clicks');
|
||||
if (clicks) {
|
||||
$(".checkbox-toggle").click(function() {
|
||||
var clicks = $(this).data('clicks');
|
||||
if (clicks) {
|
||||
//Uncheck all checkboxes
|
||||
$("input[type='checkbox']", ".mailbox-messages").iCheck("uncheck");
|
||||
} else {
|
||||
$("input[type='checkbox']", ".mailbox-messages").iCheck("uncheck");
|
||||
} else {
|
||||
//Check all checkboxes
|
||||
$("input[type='checkbox']", ".mailbox-messages").iCheck("check");
|
||||
}
|
||||
$(this).data("clicks", !clicks);
|
||||
});
|
||||
|
||||
$("input[type='checkbox']", ".mailbox-messages").iCheck("check");
|
||||
}
|
||||
$(this).data("clicks", !clicks);
|
||||
});
|
||||
//Handle starring for glyphicon and font awesome
|
||||
$(".mailbox-star").click(function(e) {
|
||||
e.preventDefault();
|
||||
$(".mailbox-star").click(function(e) {
|
||||
e.preventDefault();
|
||||
//detect type
|
||||
var $this = $(this).find("a > i");
|
||||
var glyph = $this.hasClass("glyphicon");
|
||||
var fa = $this.hasClass("fa");
|
||||
|
||||
var $this = $(this).find("a > i");
|
||||
var glyph = $this.hasClass("glyphicon");
|
||||
var fa = $this.hasClass("fa");
|
||||
//Switch states
|
||||
if (glyph) {
|
||||
$this.toggleClass("glyphicon-star");
|
||||
$this.toggleClass("glyphicon-star-empty");
|
||||
}
|
||||
|
||||
if (fa) {
|
||||
$this.toggleClass("fa-star");
|
||||
$this.toggleClass("fa-star-o");
|
||||
}
|
||||
});
|
||||
if (glyph) {
|
||||
$this.toggleClass("glyphicon-star");
|
||||
$this.toggleClass("glyphicon-star-empty");
|
||||
}
|
||||
if (fa) {
|
||||
$this.toggleClass("fa-star");
|
||||
$this.toggleClass("fa-star-o");
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$('#read-all').click(function() {
|
||||
|
||||
var id2 = <?php echo \Auth::user()->id ?>;
|
||||
var dataString = 'id=' + id2;
|
||||
$.ajax
|
||||
({
|
||||
type: "POST",
|
||||
url: "{{url('mark-all-read')}}" + "/" + id2,
|
||||
data: dataString,
|
||||
cache: false,
|
||||
beforeSend: function() {
|
||||
$('#myDropdown').on('hide.bs.dropdown', function() {
|
||||
return false;
|
||||
});
|
||||
$("#refreshNote").hide();
|
||||
$("#notification-loader").show();
|
||||
},
|
||||
success: function(response) {
|
||||
$("#refreshNote").load("<?php echo $_SERVER['REQUEST_URI']; ?> #refreshNote");
|
||||
$("#notification-loader").hide();
|
||||
$('#myDropdown').removeClass('open');
|
||||
}
|
||||
});
|
||||
});</script>
|
||||
<!-- // <script src="../plugins/jQuery/jQuery-2.1.3.min.js"></script> -->
|
||||
<script src="{{asset("lb-faveo/js/tabby.js")}}"></script>
|
||||
<!-- // <script src="{{asset("dist/js/editor.js")}}"></script> -->
|
||||
|
@@ -102,9 +102,7 @@
|
||||
<i class="fa fa-bell-o"></i>
|
||||
<span class="label label-danger" id="count">{!! count($noti) !!}</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu" style="width: -moz-max-content;
|
||||
width: -webkit-max-content;
|
||||
width: -o-max-content;">
|
||||
<ul class="dropdown-menu" style="width:500px">
|
||||
|
||||
<div id="alert11" class="alert alert-success alert-dismissable" style="display:none;">
|
||||
<button id="dismiss11" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
|
@@ -192,6 +192,13 @@
|
||||
{{Session::get('success')}}
|
||||
</div>
|
||||
@endif
|
||||
@if(Session::has('warning'))
|
||||
<div class="alert alert-warning alert-dismissable">
|
||||
<i class="fa fa-check-circle"></i>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
{!! Session::get('warning') !!}
|
||||
</div>
|
||||
@endif
|
||||
<!-- failure message -->
|
||||
@if(Session::has('fails'))
|
||||
@if(Session::has('check'))
|
||||
|
Reference in New Issue
Block a user