Commit 162646a2 authored by ZeMKI's avatar ZeMKI
Browse files

Notifications design Improvement + admin area

* now in the admin area you can see better messages.
* layout of the notifications improved.
parent 4d6878ba
......@@ -6,9 +6,7 @@ use App\Notifications\NotificationFromStaff;
use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Notification;
use mysql_xdevapi\Exception;
use phpDocumentor\Reflection\Types\Boolean;
use PhpParser\Node\Expr\Cast\Bool_;
class NotificationController extends Controller
{
......@@ -31,6 +29,16 @@ class NotificationController extends Controller
public function store(Request $request)
{
if(!auth()->user()->isAdmin()) abort(401);
$attributes = request()->validate([
'title' => 'required',
'message' => 'required',
]);
if((!$request->has('all') || !$request->Input('all')) && $request->input('email') == "")
{
return view('admin.notifications', ['message' => 'Fill email or send to all']);
}
if ($request->input('all')) {
$users = User::all();
......
......@@ -9,35 +9,33 @@
<a class="inline" @click.prevent="shownotificationbox = !shownotificationbox">
<svg xmlns="http://www.w3.org/2000/svg" class="fill-current h-8 w-8" viewBox="0 0 20 20" fill="currentColor">
<svg xmlns="http://www.w3.org/2000/svg" class="inline fill-current h-8 w-8" viewBox="0 0 20 20" fill="currentColor">
<path d="M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zM10 18a3 3 0 01-3-3h6a3 3 0 01-3 3z" />
</svg>
</a>
</div>
<div
class="w-64 absolute border-2 border-gray-300 overflow-auto h-64 border-solid mr-20 z-50 bg-gray-100 "
class="w-64 absolute border-2 border-gray-400 overflow-auto h-64 border-solid mr-20 z-50 bg-gray-100 "
style="top:50px;"
v-show="shownotificationbox">
<div class="w-full flex bg-gray-100 p-2">
<p class="flex-1 text-blue-300 font-bold text-center align-middle">{{ trans('Notifications') }}</p>
<div class="w-full bg-gray-200 p-2">
<p class="text-blue-400 font-bold text-center align-middle">{{ trans('Notifications') }}</p>
</div>
<div
class="w-auto relative border-t border-b border-blue-500 text-blue-700 pb-2 z-10 border-b-4 border-solid"
:class="notification.read_at == null ? 'bg-blue-200' : 'bg-blue-100'"
class="w-auto relative border-t border-b border-gray-400 text-black pb-6 z-10 border-b-4 border-solid"
:class="notification.read_at == null ? 'bg-gray-500' : 'bg-gray-300'"
role="relative px-3 py-3 mb-4 border rounded"
v-for="notification in usernotifications">
<div class="w-full flex bg-blue-300 p-2">
<p class="flex-1 text-gray-100 align-middle">
<div class="w-full bg-gray-200 p-2 justify-center align-middle items-center">
<p class="text-blue-600 inline">
{{ formatDate(notification.created_at) }}
</p>
<a v-if="notification.read_at == null" role="button"
class="hover:text-gray-300 w-auto text-xs right-0 flex-shrink-1 bg-blue-500 hover:bg-blue-700 text-gray-100 font-bold py-2 px-4 rounded z-50"
class="inline text-blue-400 text-xs right-0 flex-shrink-1 bg-gray-900 hover:bg-gray-700 text-white font-bold py-2 px-4 z-50"
@click.prevent="togglenotification(notification.id)"> {{ trans('Set to READ') }}
</a>
</div>
......@@ -45,7 +43,7 @@
<p class="break-word font-normal block text-xs text-justify mt-1 px-4 ">
<span class="font-bold text-sm"> {{ notification.data['title'] }} </span>
<br>
<span v-html="notification.data['message']"></span></p>
<span class="break-words" v-html="notification.data['message']"></span></p>
</div>
......@@ -66,7 +64,7 @@ export default {
};
}, created() {
let self = this;
axios.post(window.location.origin + this.productionUrl + 'users/notifications').then(response => {
axios.post(window.location.origin + this.productionUrl + '/users/notifications').then(response => {
self.usernotifications = response.data;
self.howmanyunreadnotifications = 0;
for (let i = 0;
......
......@@ -128,15 +128,16 @@
<div class="w-2/3 mx-auto mt-2">
@if(session()->has('message'))
<b-notification
aria-close-label="Close notification"
type="is-danger"
role="alert"
>
{{session()->get('message')}}
</b-notification>
@if(session()->has('message') || !empty($message))
<div class="w-auto mx-auto bg-yellow-100 border-t border-b border-blue-500 text-blue-700 px-4 py-3 text-center" role="alert">
<p class="font-bold">
<span class="relative h-3 w-3">
<span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-pink-400 opacity-75"></span>
<span class="relative inline-flex rounded-full h-3 w-3 bg-pink-500"></span>
</span>
{{session()->get('message') ? session()->get('message') : $message}}</p>
</div>
@endif
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment