final commit

This commit is contained in:
Sujit Prasad
2016-06-14 19:57:06 +05:30
parent 3fbc55c0d8
commit ca82fa0b8a
6 changed files with 186 additions and 160 deletions

View File

@@ -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;
}
}

View File

@@ -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'));

View File

@@ -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>&nbsp<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>&nbsp<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>&nbsp<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>&nbsp<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>&nbsp<img src="{{$user->profile_pic}}" class="img-circle" style="width:6%;height: 6%" alt="User Image" />
<label for='cl'><span></span>&nbsp<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>&nbsp<img src="{{$user->profile_pic}}" class="img-circle" style="width:6%;height: 6%" alt="User Image" />
<label for='cl'><span></span>&nbsp<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">

View File

@@ -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>
@@ -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">
@@ -402,12 +399,10 @@ $("textarea").wysihtml5();
// alert(response);
// $("#gif-update").hide();
// }
// })
// return false;
// });
// });
$(function() {
//Enable iCheck plugin for checkboxes
//iCheck for checkbox and radio inputs
@@ -415,7 +410,6 @@ $('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');
@@ -428,7 +422,6 @@ $("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();
@@ -436,13 +429,11 @@ e.preventDefault();
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");
@@ -450,6 +441,31 @@ $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> -->

View File

@@ -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>

View File

@@ -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">&times;</button>
{!! Session::get('warning') !!}
</div>
@endif
<!-- failure message -->
@if(Session::has('fails'))
@if(Session::has('check'))