Skip to content

Commit

Permalink
Remove broadcast
Browse files Browse the repository at this point in the history
  • Loading branch information
edersoares committed Dec 26, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 67b7ae8 commit 6f7b37a
Showing 3 changed files with 0 additions and 76 deletions.
38 changes: 0 additions & 38 deletions ieducar/intranet/scripts/notifications.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,3 @@
function startListenChannel(notificationsChannel) {
window.Echo.channel(notificationsChannel).listen('NotificationEvent', (e) => {
let notification = e.notification;
let url = e.url;
let unread = notification.read_at == null;
let className = unread ? 'unread' : 'read';
let dateObj = new Date(notification.created_at);
let dateString = dateObj.toLocaleString('pt-BR');

$j('.dropdown-content-notifications .notifications-bar').after(`
<a href="` + url + `" onclick="markAsRead(this)" data-id="` + notification.id + `" class="` +className+ `" target="_blank">
<p>` + notification.text + `</p>
<p class="date-notification"> ` + dateString + `</p>
</a>`);

$j('.notification-balloon').show();

let notifications = [];

$j.each($j('.dropdown-content-notifications').find('a'),function(index, value){
notifications.push($j(value).data('id'));
});

if (notifications.length > 5) {
let keyRemove = notifications.length - 2;
$j(".dropdown-content-notifications a[data-id='" + notifications[keyRemove] + "']").remove();
}
updateNotReadCount();
});
updateNotReadCount();
}

function updateNotReadCount() {
$j.get("/notificacoes/quantidade-nao-lidas", function (data) {
$j('.btn-mark-all-read .not-read-count').text(data);
});
};

function getNotifications() {
$j.get("/notificacoes/retorna-notificacoes-usuario", function (data) {
$j.each(data, function( index, value ) {
34 changes: 0 additions & 34 deletions laravel-echo-server.json.example

This file was deleted.

4 changes: 0 additions & 4 deletions resources/views/layout/default.blade.php
Original file line number Diff line number Diff line change
@@ -249,10 +249,6 @@ function goOrClose(url) {
<script type="text/javascript" src="{{ Asset::get("/intranet/scripts/jquery-maxlength/jquery.maxlength.min.js") }}"></script>
<script>
getNotifications();
if (window.useEcho) {
startListenChannel('ieducar-{{\DB::getDefaultConnection()}}-notification-{{md5($loggedUser->personId)}}');
}
</script>

@include('layout.vue')

0 comments on commit 6f7b37a

Please sign in to comment.