]);
}
}
+
+ public static function notificationsWidget($wrapper = null, $class = '', $heading = '')
+ {
+ $notifications = backpack_user()->notifications->slice(0, 10);
+ if (count($notifications)) {
+
+ Widget::add([
+ 'type' => 'view',
+ 'view' => 'tasks.list',
+ 'wrapper' => $wrapper,
+ 'class' => $class,
+ 'heading' => $heading,
+ 'notifications' => $notifications,
+ ]);
+
+ }
+ }
}
}
}
+.dashboard-wrapper {
+ background-color: #ffffff;
+ padding: 20px;
+ border-radius: 2px;
+ margin: 15px 0;
+ box-shadow: 0 0 4px rgba(0, 0, 0, 0.1);
+}
+
@import "context-menu";
@import "loader";
-{{-- __('!! Équipe') --}}
+{{-- __('!! Notifications') --}}
@extends(backpack_view('blank'))
-@push('after_scripts')
- <script>
- (function ($) {
- $(function () {
- $(document).on('click', '[data-button-type="delete"]', function () {
- let $this = this;
- $.ajax({
- url: '{{url('tasks/notification/')}}/' + $(this).attr('data-id'),
- method: 'post',
- data: {_method: 'delete'},
- success: function () {
- $this.closest('tr').remove();
- },
- });
- });
- });
- })(jQuery);
- </script>
-@endpush
-@section('content')
- <style>
- .table td, .table th {
- vertical-align: middle;
- }
-
- .table tr.unread td {
- font-weight: 600;
- }
-
- .table tr ul {
- list-style: none;
- padding: 3px 0;
- margin: 0;
- }
- .table tr ul li {
- margin: 2px 0;
- }
-
- .table tr.unread i.unread {
- background-color: #f00;
- border-radius: 50%;
- width: 8px;
- height: 8px;
- display: block;
- }
- </style>
- {{-- <h2 style="margin-top: 50px">{{__('Tâches en cours')}}</h2>--}}
- <h2 style="margin-top: 50px">{{__('Notifications')}}</h2>
- <table id="crudTable"
- class="bg-white table table-striped table-hover nowrap rounded shadow-xs border-xs mt-2 dataTable dtr-inline">
- {{-- <thead>--}}
- {{-- <tr role="row">--}}
- {{-- <th></th>--}}
- {{-- <th>{{__('Bulletin')}}</th>--}}
- {{-- <th>{{__('Date')}}</th>--}}
- {{-- <th></th>--}}
- {{-- </tr>--}}
- {{-- </thead>--}}
- <tbody>
-
- @if(!$notifications || !count($notifications))
- {{__('Aucune notification')}}
- @endif
- @foreach($notifications as $id=>$notification)
- <tr role="row" @if($notification->read_at===null) class="unread" @endif>
- <td></td>
- <td>{{$notification->data['subject']}}<br>
- <ul>
- @foreach($notification->data['actions'] as $label=>$url)
- <li>{{$label}} : <a href="{{$url}}" target="_blank">{{$url}}</a></li>
- @endforeach
- </ul>
- </td>
- <td><i class="unread"></i></td>
- <td>{{$notification->created_at}}</td>
- <td>
- <a href="#" class="btn btn-sm btn-link" data-button-type="delete" data-id="{{$notification->id}}"><i
- class="la la-trash"></i></a>
- </td>
- </tr>
- @endforeach
- </tbody>
- </table>
+@section('content')
+ @include('tasks.list')
@endsection
--- /dev/null
+@php
+ if(isset($widget['notifications'])){
+ $notifications=$widget['notifications'];
+ }
+@endphp
+
+@push('after_scripts')
+ <script>
+ (function ($) {
+ $(function () {
+ $(document).on('click', '[data-button-type="delete"]', function () {
+ let $this = this;
+ $.ajax({
+ url: '{{url('tasks/notification/')}}/' + $(this).attr('data-id'),
+ method: 'post',
+ data: {_method: 'delete'},
+ success: function () {
+ $this.closest('tr').remove();
+ },
+ });
+ });
+ });
+ })(jQuery);
+ </script>
+@endpush
+
+
+<style>
+ .table.notifications td, .table.notifications th {
+ vertical-align: middle;
+ }
+
+ .table.notifications tr.unread td {
+ font-weight: 600;
+ }
+
+ .table.notifications tr ul {
+ list-style: none;
+ padding: 3px 0;
+ margin: 0;
+ }
+
+ .table.notifications tr ul li {
+ margin: 2px 0;
+ }
+
+ .table.notifications tr.unread i.unread {
+ background-color: #f00;
+ border-radius: 50%;
+ width: 8px;
+ height: 8px;
+ display: block;
+ }
+</style>
+{{-- <h2 style="margin-top: 50px">{{__('Tâches en cours')}}</h2>--}}
+@if(isset($widget))
+ <h4>{{__('Notifications')}}</h4>
+@else
+ <h2 style="margin-top: 50px">{{__('Notifications')}}</h2>
+@endif
+<table id="crudTable"
+ class="bg-white table table-striped table-hover nowrap rounded shadow-xs border-xs mt-2 dataTable dtr-inline notifications">
+ {{-- <thead>--}}
+ {{-- <tr role="row">--}}
+ {{-- <th></th>--}}
+ {{-- <th>{{__('Bulletin')}}</th>--}}
+ {{-- <th>{{__('Date')}}</th>--}}
+ {{-- <th></th>--}}
+ {{-- </tr>--}}
+ {{-- </thead>--}}
+ <tbody>
+
+ @if(!$notifications || !count($notifications))
+ {{__('Aucune notification')}}
+ @endif
+ @foreach($notifications as $id=>$notification)
+ <tr role="row" @if($notification->read_at===null) class="unread" @endif>
+ <td></td>
+ <td>{{$notification->data['subject']}}<br>
+ <ul>
+ @foreach($notification->data['actions'] as $label=>$url)
+ <li>{{$label}} : <a href="{{$url}}" target="_blank">{{$url}}</a></li>
+ @endforeach
+ </ul>
+ </td>
+ <td><i class="unread"></i></td>
+ <td>{{$notification->created_at}}</td>
+ <td>
+ <a href="#" class="btn btn-sm btn-link" data-button-type="delete" data-id="{{$notification->id}}"><i
+ class="la la-trash"></i></a>
+ </td>
+ </tr>
+ @endforeach
+ </tbody>
+</table>
@php
\App\Widgets::fluidbookQuoteWidgets();
- \App\Widgets::teamWidgets(['class' => 'col-sm-4 leave-calendar-wrapper'],'dashboard',__('Planning de l\'équipe'));
+ \App\Widgets::notificationsWidget(['class' => 'col-sm-8 dashboard-wrapper'],'dashboard',__('Notifications'));
+ \App\Widgets::teamWidgets(['class' => 'col-sm-4 dashboard-wrapper'],'dashboard',__('Planning de l\'équipe'));
@endphp