File: /home/bdedition/public_html/core/storage/framework/views/5426597fc969abede5ccc9ed9817d8fd.php
<script src="<?php echo e(asset('assets/global/js/firebase/firebase-8.3.2.js')); ?>"></script>
<script>
"use strict";
var permission = null;
var authenticated = '<?php echo e(auth()->user() ? true : false); ?>';
var pushNotify = <?php echo json_encode(gs('pn'), 15, 512) ?>;
var firebaseConfig = <?php echo json_encode(gs('firebase_config'), 15, 512) ?>;
function pushNotifyAction() {
permission = Notification.permission;
if (!('Notification' in window)) {
notify('info', 'Push notifications not available in your browser. Try Chromium.')
} else if (permission === 'denied' || permission == 'default') { //Notice for users dashboard
$('.notice').append(`
<div class="alert alert-primary" role="alert">
<div class="alert__icon"><i class="fas fa-bell"></i></div>
<p class="alert__message m-0">
<span class="fw-bold d-block"><?php echo app('translator')->get('Please Allow / Reset Browser Notification'); ?></span>
<small><i><?php echo app('translator')->get('If you want to get push notification then you have to allow notification from your browser'); ?> </i></small>
</p>
</div>
`);
}
}
//If enable push notification from admin panel
if (pushNotify == 1) {
pushNotifyAction();
}
//When users allow browser notification
if (permission != 'denied' && firebaseConfig) {
//Firebase
firebase.initializeApp(firebaseConfig);
const messaging = firebase.messaging();
navigator.serviceWorker.register("<?php echo e(asset('assets/global/js/firebase/firebase-messaging-sw.js')); ?>")
.then((registration) => {
messaging.useServiceWorker(registration);
function initFirebaseMessagingRegistration() {
messaging
.requestPermission()
.then(function() {
return messaging.getToken()
})
.then(function(token) {
$.ajax({
url: '<?php echo e(route('user.add.device.token')); ?>',
type: 'POST',
data: {
token: token,
'_token': "<?php echo e(csrf_token()); ?>"
},
success: function(response) {},
error: function(err) {},
});
}).catch(function(error) {});
}
messaging.onMessage(function(payload) {
const title = payload.notification.title;
const options = {
body: payload.notification.body,
icon: payload.data.icon,
image: payload.notification.image,
click_action: payload.data.click_action,
vibrate: [200, 100, 200]
};
new Notification(title, options);
});
//For authenticated users
if (authenticated) {
initFirebaseMessagingRegistration();
}
});
}
</script>
<?php $__env->startPush('style'); ?>
<style>
/* alert design css */
.alert {
margin-bottom: 0;
font-weight: 400;
padding: 17px 24px;
border-radius: 5px;
display: flex;
align-items: flex-start;
gap: 12px;
justify-content: flex-start;
margin-bottom: 16px;
}
@media screen and (max-width: 991px) {
.alert {
padding: 16px;
}
}
@media screen and (max-width: 575px) {
.alert {
padding: 12px;
}
}
.alert__icon {
font-size: 1.5rem;
line-height: 1;
}
.alert__content {
width: calc(100% - 24px);
padding-left: 32px;
}
@media screen and (max-width: 991px) {
.alert__content {
padding-left: 16px;
}
}
@media screen and (max-width: 575px) {
.alert__content {
padding-left: 0;
width: 100%;
margin-top: 6px;
}
}
.alert__title {
color: hsl(var(--base-two) / 0.8);
font-weight: 600;
font-family: var(--heading-font);
margin-bottom: 6px;
}
.alert__desc {
color: hsl(var(--base-two) / 0.5);
display: block;
line-height: 1.375;
}
@media screen and (max-width: 424px) {
.alert__desc {
font-size: 0.8125rem;
}
}
.alert__link {
position: relative;
}
.alert--info {
border: 1px solid rgb(0 147 255 / 30%);
background-color: rgb(0 147 255 / 5%);
}
.alert--info .alert__icon {
color: rgb(0 147 255);
}
.alert--primary {
border: 1px solid rgb(70 52 255 / 30%);
background-color: rgb(70 52 255 / 5%);
}
.alert--primary .alert__icon {
color: rgb(70 52 255);
}
.alert--danger {
border: 1px solid rgb(220 53 69 / 50%);
background-color: rgb(220 53 69 / 5%);
}
.alert--danger .alert__icon {
color: rgb(220 53 69);
}
.alert--warning {
border: 1px solid rgba(220, 206, 53, 0.5);
background-color: rgba(220, 206, 53, 0.05);
}
.alert--warning .alert__icon {
color: rgba(220, 206, 53);
}
/* end alert */
</style>
<?php $__env->stopPush(); ?>
<?php /**PATH /home/bdedition/public_html/core/resources/views/partials/push_script.blade.php ENDPATH**/ ?>