Merge pull request #2149 from cuneytsenturk/master
Notification page styling
This commit is contained in:
commit
1161b8cf86
@ -34,7 +34,19 @@ class Notifications extends Controller
|
||||
$notification->markAsRead();
|
||||
}
|
||||
|
||||
$message = trans('messages.success.duplicated', ['type' => trans_choice('general.items', 1)]);
|
||||
// Hide New Apps Notifications
|
||||
$module_notifications = $this->getNotifications('new-apps' );
|
||||
|
||||
foreach ($module_notifications as $module_notification) {
|
||||
setting()->set('notifications.'. user()->id . '.' . $module_notification->alias . '.name', $module_notification->name);
|
||||
setting()->set('notifications.'. user()->id . '.' . $module_notification->alias . '.message', $module_notification->alias);
|
||||
setting()->set('notifications.'. user()->id . '.' . $module_notification->alias . '.date', Date::now());
|
||||
setting()->set('notifications.'. user()->id . '.' . $module_notification->alias . '.status', '0');
|
||||
}
|
||||
|
||||
setting()->save();
|
||||
|
||||
$message = trans('messages.success.duplicated', ['type' => trans_choice('general.notificatinos', 1)]);
|
||||
|
||||
flash($message)->success();
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Livewire\Common\Notifications;
|
||||
|
||||
use Date;
|
||||
use App\Traits\Modules;
|
||||
use Livewire\Component;
|
||||
|
||||
@ -9,10 +10,91 @@ class NewApps extends Component
|
||||
{
|
||||
use Modules;
|
||||
|
||||
public function markRead($alias)
|
||||
{
|
||||
$notifications = $this->getNotifications('new-apps' );
|
||||
|
||||
foreach ($notifications as $notification) {
|
||||
if ($notification->alias != $alias) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$readed = $notification;
|
||||
}
|
||||
|
||||
setting()->set('notifications.'. user()->id . '.' . $alias . '.name', $readed->name);
|
||||
setting()->set('notifications.'. user()->id . '.' . $alias . '.message', $readed->alias);
|
||||
setting()->set('notifications.'. user()->id . '.' . $alias . '.date', Date::now());
|
||||
setting()->set('notifications.'. user()->id . '.' . $alias . '.status', '0');
|
||||
|
||||
setting()->save();
|
||||
|
||||
$this->dispatchBrowserEvent('mark-read', [
|
||||
'type' => 'new-apps',
|
||||
'message' => trans('notifications.messages.mark_read', ['type' => $notification->name]),
|
||||
]);
|
||||
}
|
||||
|
||||
public function markReadAll()
|
||||
{
|
||||
$notifications = $this->getNotifications('new-apps' );
|
||||
|
||||
foreach ($notifications as $notification) {
|
||||
setting()->set('notifications.'. user()->id . '.' . $notification->alias . '.name', $notification->name);
|
||||
setting()->set('notifications.'. user()->id . '.' . $notification->alias . '.message', $notification->alias);
|
||||
setting()->set('notifications.'. user()->id . '.' . $notification->alias . '.date', Date::now());
|
||||
setting()->set('notifications.'. user()->id . '.' . $notification->alias . '.status', '0');
|
||||
|
||||
}
|
||||
|
||||
setting()->save();
|
||||
|
||||
$this->dispatchBrowserEvent('mark-read-all', [
|
||||
'type' => 'new-apps',
|
||||
'message' => trans('notifications.messages.mark_read_all', ['type' => trans_choice('notifications.new_apps', 2)]),
|
||||
]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$notifications = $this->getNotifications('new-apps');
|
||||
|
||||
$this->clearReadNotifications($notifications);
|
||||
|
||||
return view('livewire.common.notifications.new-apps', compact('notifications'));
|
||||
}
|
||||
|
||||
protected function clearReadNotifications(&$notifications)
|
||||
{
|
||||
$hide_notifications = setting('notifications.' . user()->id);
|
||||
|
||||
if (!$hide_notifications) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$notifications) {
|
||||
return;
|
||||
}
|
||||
|
||||
$aliases = [];
|
||||
|
||||
// MarkRead app notification
|
||||
foreach ($notifications as $index => $notification) {
|
||||
$aliases[] = $notification->alias;
|
||||
|
||||
if (setting('notifications.' . user()->id . '.' . $notification->alias)) {
|
||||
unset($notifications[$index]);
|
||||
}
|
||||
}
|
||||
|
||||
// Clear setting table missing notification
|
||||
foreach ($hide_notifications as $alias => $hide_notification) {
|
||||
if (in_array($alias, $aliases)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
setting()->forget('notifications.' . user()->id . '.' . $alias);
|
||||
setting()->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
@stack('bills_recurring')
|
||||
|
||||
<livewire:common.notifications.recurring type="bill" text-title="widgets.recurring_bills" />
|
||||
<livewire:common.notifications.recurring type="bill" text-title="notifications.recurring_bills" />
|
||||
|
||||
@stack('bills_reminder')
|
||||
|
||||
@ -48,6 +48,9 @@
|
||||
document.getElementById(hash_split[1]).scrollIntoView({
|
||||
behavior: 'smooth'
|
||||
});
|
||||
|
||||
document.getElementById('collapse-' + hash_split[1]).classList.add('show');
|
||||
document.getElementById('heading-' + hash_split[1]).ariaExpanded = 'true';
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
@ -1,13 +1,14 @@
|
||||
@if ($notifications->total())
|
||||
<div class="card" id="exports">
|
||||
<div class="card-header">
|
||||
<div class="accordion" id="exports">
|
||||
<div class="card">
|
||||
<div class="card-header" id="heading-exports" data-toggle="collapse" data-target="#collapse-exports"
|
||||
aria-expanded="false" aria-controls="collapse-exports">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-8">
|
||||
<h5 class="h3 mb-0">{{ trans('general.export') }}</h5>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<h3 class="mb-0">
|
||||
{{ trans('general.export') }}
|
||||
|
||||
<div class="col-4 text-right">
|
||||
<button type="button" class="btn btn-outline-success rounded-circle btn-icon-only btn-sm mr-2"
|
||||
@if ($notifications->total())
|
||||
<button type="button" class="btn btn-outline-success rounded-circle btn-icon-only btn-sm ml-2 d-none"
|
||||
data-toggle="tooltip"
|
||||
data-placement="right"
|
||||
title="{{ trans('notifications.mark_read_all') }}"
|
||||
@ -15,10 +16,14 @@
|
||||
>
|
||||
<span class="btn-inner--icon"><i class="fas fa-check-double"></i></span>
|
||||
</button>
|
||||
@endif
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="collapse-exports" class="collapse" aria-labelledby="heading-exports" data-parent="#exports">
|
||||
@if ($notifications->total())
|
||||
<div class="table-responsive">
|
||||
<table class="table table-flush table-hover" id="tbl-export">
|
||||
<tbody>
|
||||
@ -77,7 +82,14 @@
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@else
|
||||
<div class="col-xs-12 col-sm-12 mt-4 mb-4 text-center">
|
||||
<small>{{ trans('general.no_records') }}</small>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('body_js')
|
||||
<script type="text/javascript">
|
||||
@ -98,5 +110,3 @@
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@endif
|
||||
|
@ -1,13 +1,14 @@
|
||||
@if ($notifications->total())
|
||||
<div class="card" id="imports">
|
||||
<div class="card-header">
|
||||
<div class="accordion" id="imports">
|
||||
<div class="card">
|
||||
<div class="card-header" id="heading-imports" data-toggle="collapse" data-target="#collapse-imports"
|
||||
aria-expanded="false" aria-controls="collapse-imports">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-8">
|
||||
<h5 class="h3 mb-0">{{ trans('import.import') }}</h5>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<h3 class="mb-0">
|
||||
{{ trans('import.import') }}
|
||||
|
||||
<div class="col-4 text-right">
|
||||
<button type="button" class="btn btn-outline-success rounded-circle btn-icon-only btn-sm mr-2"
|
||||
@if ($notifications->total())
|
||||
<button type="button" class="btn btn-outline-success rounded-circle btn-icon-only btn-sm mr-2 d-none"
|
||||
data-toggle="tooltip"
|
||||
data-placement="right"
|
||||
title="{{ trans('notifications.mark_read_all') }}"
|
||||
@ -15,10 +16,14 @@
|
||||
>
|
||||
<span class="btn-inner--icon"><i class="fas fa-check-double"></i></span>
|
||||
</button>
|
||||
@endif
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="collapse-imports" class="collapse" aria-labelledby="heading-imports" data-parent="#imports">
|
||||
@if ($notifications->total())
|
||||
<div class="table-responsive">
|
||||
<table class="table table-flush table-hover" id="tbl-import">
|
||||
<tbody>
|
||||
@ -78,9 +83,16 @@
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@else
|
||||
<div class="col-xs-12 col-sm-12 mt-4 mb-4 text-center">
|
||||
<small>{{ trans('general.no_records') }}</small>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('body_js')
|
||||
@push('body_js')
|
||||
<script type="text/javascript">
|
||||
window.addEventListener('mark-read', event => {
|
||||
if (event.detail.type == 'import') {
|
||||
@ -98,5 +110,4 @@
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@endif
|
||||
@endpush
|
||||
|
@ -1,27 +1,76 @@
|
||||
@if ($notifications)
|
||||
<div class="accordion" id="new-apps">
|
||||
<div class="accordion" id="new-apps">
|
||||
<div class="card">
|
||||
<div class="card-header" id="heading-new-apps" data-toggle="collapse" data-target="#collapse-new-apps" aria-expanded="true" aria-controls="collapse-new-apps">
|
||||
<div class="card-header" id="heading-new-apps" data-toggle="collapse" data-target="#collapse-new-apps"
|
||||
aria-expanded="{{ ($notifications) ? 'true' : 'false' }}" aria-controls="collapse-new-apps">
|
||||
<div class="align-items-center">
|
||||
<h4 class="mb-0">{{ trans_choice('notifications.new_apps', 2) }}</h4>
|
||||
<h3 class="mb-0">
|
||||
{{ trans_choice('notifications.new_apps', 2) }}
|
||||
|
||||
@if ($notifications)
|
||||
<button type="button" class="btn btn-outline-success rounded-circle btn-icon-only btn-sm ml-2 d-none"
|
||||
data-toggle="tooltip"
|
||||
data-placement="right"
|
||||
title="{{ trans('notifications.mark_read_all') }}"
|
||||
wire:click="markReadAll()"
|
||||
>
|
||||
<span class="btn-inner--icon"><i class="fas fa-check-double"></i></span>
|
||||
</button>
|
||||
@endif
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="collapse-new-apps" class="collapse show" aria-labelledby="heading-new-apps" data-parent="#new-apps">
|
||||
<div id="collapse-new-apps" class="collapse{{ ($notifications) ? ' show' : '' }}" aria-labelledby="heading-new-apps" data-parent="#new-apps">
|
||||
@if ($notifications)
|
||||
<div class="table-responsive">
|
||||
<table class="table table-flush table-hover" id="tbl-export">
|
||||
<tbody>
|
||||
@foreach ($notifications as $notification)
|
||||
<tr class="row align-items-center border-top-1">
|
||||
<td class="col-xs-12 col-sm-12 col-md-12 col-lg-12 col-xl-12 text-left">
|
||||
<td class="col-xs-8 col-sm-10 col-md-10 col-lg-11 col-xl-11 text-left text-wrap">
|
||||
{!! $notification->message !!}
|
||||
</td>
|
||||
|
||||
<td class="col-xs-4 col-sm-2 col-md-2 col-lg-1 col-xl-1 text-center">
|
||||
<button type="button" class="btn btn-outline-success rounded-circle btn-icon-only btn-sm"
|
||||
data-toggle="tooltip"
|
||||
data-placement="right"
|
||||
title="{{ trans('notifications.mark_read') }}"
|
||||
wire:click="markRead('{{ $notification->alias }}')"
|
||||
>
|
||||
<span class="btn-inner--icon"><i class="fa fa-check"></i></span>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@else
|
||||
<div class="col-xs-12 col-sm-12 mt-4 mb-4 text-center">
|
||||
<small>{{ trans('general.no_records') }}</small>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@push('body_js')
|
||||
<script type="text/javascript">
|
||||
window.addEventListener('mark-read', event => {
|
||||
if (event.detail.type == 'new-apps') {
|
||||
$.notify(event.detail.message, {
|
||||
type: 'success',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener('mark-read-all', event => {
|
||||
if (event.detail.type == 'new-apps') {
|
||||
$.notify(event.detail.message, {
|
||||
type: 'success',
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
@ -1,13 +1,14 @@
|
||||
@if ($notifications->count())
|
||||
<div class="card" id="recurring-{{$type}}">
|
||||
<div class="card-header">
|
||||
<div class="accordion" id="recurring-{{$type}}">
|
||||
<div class="card">
|
||||
<div class="card-header" id="heading-recurring-{{$type}}" data-toggle="collapse" data-target="#collapse-recurring-{{$type}}"
|
||||
aria-expanded="false" aria-controls="collapse-recurring-{{$type}}">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-8">
|
||||
<h5 class="h3 mb-0">{{ trans($textTitle) }}</h5>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<h3 class="mb-0">
|
||||
{{ trans($textTitle) }}
|
||||
|
||||
<div class="col-4 text-right">
|
||||
<button type="button" class="btn btn-outline-success rounded-circle btn-icon-only btn-sm mr-2"
|
||||
@if ($notifications->total())
|
||||
<button type="button" class="btn btn-outline-success rounded-circle btn-icon-only btn-sm mr-2 d-none"
|
||||
data-toggle="tooltip"
|
||||
data-placement="right"
|
||||
title="{{ trans('notifications.mark_read_all') }}"
|
||||
@ -15,10 +16,14 @@
|
||||
>
|
||||
<span class="btn-inner--icon"><i class="fas fa-check-double"></i></span>
|
||||
</button>
|
||||
@endif
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="collapse-recurring-{{$type}}" class="collapse" aria-labelledby="heading-recurring-{{$type}}" data-parent="#recurring-{{$type}}">
|
||||
@if ($notifications->total())
|
||||
<div class="table-responsive">
|
||||
<table class="table table-flush table-hover" id="tbl-recurring-{{ $type }}">
|
||||
<thead class="thead-light">
|
||||
@ -221,9 +226,16 @@
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@else
|
||||
<div class="col-xs-12 col-sm-12 mt-4 mb-4 text-center">
|
||||
<small>{{ trans('general.no_records') }}</small>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('body_js')
|
||||
@push('body_js')
|
||||
<script type="text/javascript">
|
||||
window.addEventListener('mark-read', event => {
|
||||
if (event.detail.type == 'recurring-{{ $type }}') {
|
||||
@ -241,5 +253,4 @@
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@endif
|
||||
@endpush
|
||||
|
@ -1,13 +1,14 @@
|
||||
@if ($notifications->count())
|
||||
<div class="card" id="reminder-{{$type}}">
|
||||
<div class="card-header">
|
||||
<div class="accordion" id="reminder-{{$type}}">
|
||||
<div class="card">
|
||||
<div class="card-header" id="heading-reminder-{{$type}}" data-toggle="collapse" data-target="#collapse-reminder-{{$type}}"
|
||||
aria-expanded="false" aria-controls="collapse-reminder-{{$type}}">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-8">
|
||||
<h5 class="h3 mb-0">{{ trans($textTitle) }}</h5>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<h3 class="mb-0">
|
||||
{{ trans($textTitle) }}
|
||||
|
||||
<div class="col-4 text-right">
|
||||
<button type="button" class="btn btn-outline-success rounded-circle btn-icon-only btn-sm mr-2"
|
||||
@if ($notifications->total())
|
||||
<button type="button" class="btn btn-outline-success rounded-circle btn-icon-only btn-sm mr-2 d-none"
|
||||
data-toggle="tooltip"
|
||||
data-placement="right"
|
||||
title="{{ trans('notifications.mark_read_all') }}"
|
||||
@ -15,10 +16,14 @@
|
||||
>
|
||||
<span class="btn-inner--icon"><i class="fas fa-check-double"></i></span>
|
||||
</button>
|
||||
@endif
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="collapse-reminder-{{$type}}" class="collapse" aria-labelledby="heading-reminder-{{$type}}" data-parent="#reminder-{{$type}}">
|
||||
@if ($notifications->total())
|
||||
<div class="table-responsive">
|
||||
<table class="table table-flush table-hover" id="tbl-reminder-{{ $type }}">
|
||||
<thead class="thead-light">
|
||||
@ -221,7 +226,14 @@
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@else
|
||||
<div class="col-xs-12 col-sm-12 mt-4 mb-4 text-center">
|
||||
<small>{{ trans('general.no_records') }}</small>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('body_js')
|
||||
<script type="text/javascript">
|
||||
@ -242,5 +254,3 @@
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user