]> _ Git - fluidbook-toolbox.git/commitdiff
wait #5835 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 29 Mar 2023 17:29:38 +0000 (19:29 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 29 Mar 2023 17:29:38 +0000 (19:29 +0200)
app/Widgets.php
public/packages/fluidbook/toolbox/css/style.less
resources/views/tasks/index.blade.php
resources/views/tasks/list.blade.php [new file with mode: 0644]
resources/views/vendor/backpack/base/dashboard.blade.php

index 3507109ed535b1733365a801754937640a290b79..b6c90ce7b0e9f577e278403f456a4325fafd1f26 100644 (file)
@@ -57,4 +57,21 @@ class Widgets
             ]);
         }
     }
+
+    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,
+            ]);
+
+        }
+    }
 }
index 7bd94ff2246a5b1674137e13ed3205a2626f4486..8810e810b60f82afb615e0545e067ad61c97bba7 100644 (file)
@@ -465,6 +465,14 @@ body.embeded {
     }
 }
 
+.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";
 
index 23fc162fc1be07db92b6a77a92cf2e6bfd12be4c..9e7dc75571e5a501a4a06d306943f2479faf2248 100644 (file)
@@ -1,91 +1,10 @@
-{{-- __('!! É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
 
 
diff --git a/resources/views/tasks/list.blade.php b/resources/views/tasks/list.blade.php
new file mode 100644 (file)
index 0000000..c8799bc
--- /dev/null
@@ -0,0 +1,95 @@
+@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>
index 89b72e3da61e301b145141fa24804f0cae209d4a..db8e3d162c94e0fd6b60f570c25f0ebb8305eb6b 100644 (file)
@@ -3,7 +3,8 @@
 
 @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