@@ -1,4 +1,4 @@ | |||
importScripts('https://www.gstatic.com/firebasejs/7.0.0/firebase-app.js'); | |||
importScripts('https://www.gstatic.com/firebasejs/7.22.0/firebase-app.js'); | |||
importScripts('https://www.gstatic.com/firebasejs/7.0.0/firebase-messaging.js'); | |||
var firebaseConfig = { |
@@ -1,216 +1,216 @@ | |||
<!DOCTYPE html> | |||
<html lang="en"> | |||
<head> | |||
@include('include.header') | |||
<style type="text/css"> | |||
select.form-control, select.form-control:focus, select.form-control:hover{ | |||
border-top: 1px solid #cccccc; | |||
border-right: 1px solid #cccccc; | |||
border-left: 1px solid #cccccc; | |||
} | |||
select.form-control:not([size]):not([multiple]) { | |||
height: auto; | |||
} | |||
.nav-tabs .slide { background: #D84315 !important; } | |||
.pcoded .pcoded-header[header-theme="theme6"] { | |||
background: #000 !important; | |||
} | |||
body.horizontal-icon .pcoded .pcoded-navbar .pcoded-item > li.pcoded-nomenu > a, body.horizontal-icon-fixed .pcoded .pcoded-navbar .pcoded-item > li.pcoded-nomenu > a { | |||
line-height: 30px; | |||
} | |||
body.horizontal-icon-fixed .pcoded[pcoded-device-type="desktop"] .pcoded-navbar .pcoded-item > li.pcoded-nomenu > a { | |||
height: 70px; | |||
} | |||
.pcoded-main-container { | |||
background: #343A40 !important; | |||
} | |||
.page-body .inner-page { margin: 0px 50px; } | |||
.card .card-header h5:after { | |||
background-color: #D84315 !important; | |||
} | |||
.page-item.active .page-link { | |||
background-color: #D84315 !important; | |||
border-color: #D84315 !important; | |||
} | |||
.icons-alert:before { top: 13px !important; } | |||
@media only screen and (max-width: 992px) { | |||
.page-body .inner-page { margin: 0px; } | |||
.header-navbar .navbar-wrapper .navbar-logo a img { | |||
width: 150px !important; | |||
} | |||
} | |||
body{ | |||
font-family: sans-serif !important; | |||
} | |||
h5, b { font-weight: 600 !important } | |||
</style> | |||
<!-- The core Firebase JS SDK is always required and must be listed first --> | |||
<script src="https://www.gstatic.com/firebasejs/7.0.0/firebase-app.js"></script> | |||
<!-- Required Jquery --> | |||
<script type="text/javascript" src="{{ asset('bower_components/jquery/js/jquery.min.js') }}"></script> | |||
<script type="text/javascript" src="{{ asset('bower_components/jquery-ui/js/jquery-ui.min.js') }}"></script> | |||
<script type="text/javascript" src="{{ asset('bower_components/popper.js/js/popper.min.js') }}"></script> | |||
<script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script> | |||
<!-- Add Firebase products that you want to use --> | |||
<script src="https://www.gstatic.com/firebasejs/7.0.0/firebase-messaging.js"></script> | |||
<script> | |||
var existingToken = '{{ $token }}'; | |||
// Your web app's Firebase configuration | |||
var firebaseConfig = { | |||
apiKey: "AIzaSyB7keN56ITS_wLImT1G8t2LwB2SY_ejedI", | |||
authDomain: "sipadu-mdch.firebaseapp.com", | |||
databaseURL: "https://sipadu-mdch.firebaseio.com", | |||
projectId: "sipadu-mdch", | |||
storageBucket: "", | |||
messagingSenderId: "379374790363", | |||
appId: "1:379374790363:web:219670d6d79a10f76d8efe" | |||
}; | |||
// Initialize Firebase | |||
firebase.initializeApp(firebaseConfig); | |||
// Retrieve Firebase Messaging object. | |||
const messaging = firebase.messaging(); | |||
messaging.usePublicVapidKey("BNi8dCDetrOMaBt9JH6_enkuzNMc8TdDdQKoyeVaaAisyrP2yX3RDALlThKNcIzqVF51JLIXWWZSx14mWTkoy68"); | |||
messaging.requestPermission().then(function() { | |||
console.log("Notification permission granted."); | |||
if(existingToken == ''){ | |||
deleteToken(); | |||
} | |||
return messaging.getToken(); | |||
}).then(function(token) { | |||
updateToken(); | |||
}).catch(function (err) { | |||
console.log('Unable to get permission to notify.'); | |||
}); | |||
messaging.onTokenRefresh(() => { | |||
messaging.getToken().then((refreshedToken) => { | |||
console.log('Token refreshed.'); | |||
setTokenSentToServer(false); | |||
sendTokenToServer(refreshedToken); | |||
updateToken(); | |||
}).catch((err) => { | |||
console.log('Unable to retrieve refreshed token ', err); | |||
}); | |||
}); | |||
messaging.onMessage(function (payload) { | |||
console.log('onMessage:', payload); | |||
notify(payload.notification.body, 'fa fa-comments', 'bottom', 'right', 'inverse', 'animated bounceIn', 'animated bounceOut'); | |||
}); | |||
function sendTokenToServer(currentToken) { | |||
if (!isTokenSentToServer()) { | |||
console.log('Sending token to server...'); | |||
$.ajax({ | |||
type: "POST", | |||
url: "{{ url('/api/update/firebase/token') }}", | |||
data: { token: currentToken, _id: '{{ $uid }}' }, | |||
success: function(result){ | |||
if(result.success == true){ | |||
console.log('Success sending token to server...'); | |||
setTokenSentToServer(true); | |||
}else { | |||
setTokenSentToServer(false); | |||
console.log('Error sending token to server...'); | |||
} | |||
} | |||
}); | |||
} else { | |||
console.log('Token already sent to server so won\'t send it again ' + | |||
'unless it changes'); | |||
} | |||
} | |||
function isTokenSentToServer() { | |||
return window.localStorage.getItem('sentToServer') === '1'; | |||
} | |||
function setTokenSentToServer(sent) { | |||
window.localStorage.setItem('sentToServer', sent ? '1' : '0'); | |||
} | |||
function updateToken() { | |||
messaging.getToken().then((currentToken) => { | |||
if (currentToken) { | |||
sendTokenToServer(currentToken); | |||
} else { | |||
// Show permission request. | |||
console.log('No Instance ID token available. Request permission to generate one.'); | |||
setTokenSentToServer(false); | |||
} | |||
}).catch((err) => { | |||
console.log('An error occurred while retrieving token. ', err); | |||
setTokenSentToServer(false); | |||
}); | |||
} | |||
function deleteToken() { | |||
messaging.getToken().then((currentToken) => { | |||
messaging.deleteToken(currentToken).then(() => { | |||
console.log('Token deleted.'); | |||
setTokenSentToServer(false); | |||
updateToken(); | |||
}).catch((err) => { | |||
console.log('Unable to delete token. ', err); | |||
}); | |||
}).catch((err) => { | |||
console.log('Error retrieving Instance ID token. ', err); | |||
}); | |||
} | |||
</script> | |||
</head> | |||
<body class="horizontal-icon-fixed"> | |||
<!-- Pre-loader start --> | |||
<div class="theme-loader"> | |||
@include('include.loader') | |||
</div> | |||
<!-- Pre-loader end --> | |||
<div id="pcoded" class="pcoded"> | |||
<div class="pcoded-overlay-box"></div> | |||
<div class="pcoded-container"> | |||
@include('include.top-menu') | |||
<!-- Sidebar chat start --> | |||
<!-- @include('include.sidebar-chat') --> | |||
<!-- Sidebar inner chat start--> | |||
<!-- @include('include.sidebar-chat-inner') --> | |||
<!-- Sidebar inner chat end--> | |||
<div class="pcoded-main-container"> | |||
@include('include.horizontal-menu') | |||
<div class="pcoded-wrapper"> | |||
<div class="pcoded-content"> | |||
<div class="pcoded-inner-content"> | |||
<!-- Main-body start --> | |||
<div class="main-body"> | |||
<div class="page-wrapper"> | |||
<!-- Page body start --> | |||
<div class="page-body"> | |||
@yield('content') | |||
</div> | |||
<!-- Page-body end --> | |||
</div> | |||
</div> | |||
<!-- Main-body end --> | |||
<!-- <div id="styleSelector"> | |||
</div> --> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
@include('include.footer') | |||
@yield('external_js') | |||
<!-- menu js --> | |||
<script src="{{ asset('assets/js/pcoded.min.js') }}"></script> | |||
<script src="{{ asset('assets/js/light-dark/menu/menu-hori-fixed.js') }}"></script> | |||
<!-- custom js --> | |||
<script type="text/javascript" src="{{ asset('assets/js/script.js') }}"></script> | |||
</body> | |||
</html> | |||
<!DOCTYPE html> | |||
<html lang="en"> | |||
<head> | |||
@include('include.header') | |||
<style type="text/css"> | |||
select.form-control, select.form-control:focus, select.form-control:hover{ | |||
border-top: 1px solid #cccccc; | |||
border-right: 1px solid #cccccc; | |||
border-left: 1px solid #cccccc; | |||
} | |||
select.form-control:not([size]):not([multiple]) { | |||
height: auto; | |||
} | |||
.nav-tabs .slide { background: #D84315 !important; } | |||
.pcoded .pcoded-header[header-theme="theme6"] { | |||
background: #000 !important; | |||
} | |||
body.horizontal-icon .pcoded .pcoded-navbar .pcoded-item > li.pcoded-nomenu > a, body.horizontal-icon-fixed .pcoded .pcoded-navbar .pcoded-item > li.pcoded-nomenu > a { | |||
line-height: 30px; | |||
} | |||
body.horizontal-icon-fixed .pcoded[pcoded-device-type="desktop"] .pcoded-navbar .pcoded-item > li.pcoded-nomenu > a { | |||
height: 70px; | |||
} | |||
.pcoded-main-container { | |||
background: #343A40 !important; | |||
} | |||
.page-body .inner-page { margin: 0px 50px; } | |||
.card .card-header h5:after { | |||
background-color: #D84315 !important; | |||
} | |||
.page-item.active .page-link { | |||
background-color: #D84315 !important; | |||
border-color: #D84315 !important; | |||
} | |||
.icons-alert:before { top: 13px !important; } | |||
@media only screen and (max-width: 992px) { | |||
.page-body .inner-page { margin: 0px; } | |||
.header-navbar .navbar-wrapper .navbar-logo a img { | |||
width: 150px !important; | |||
} | |||
} | |||
body{ | |||
font-family: sans-serif !important; | |||
} | |||
h5, b { font-weight: 600 !important } | |||
</style> | |||
<!-- The core Firebase JS SDK is always required and must be listed first --> | |||
<script src="https://www.gstatic.com/firebasejs/7.0.0/firebase-app.js"></script> | |||
<!-- Required Jquery --> | |||
<script type="text/javascript" src="{{ asset('bower_components/jquery/js/jquery.min.js') }}"></script> | |||
<script type="text/javascript" src="{{ asset('bower_components/jquery-ui/js/jquery-ui.min.js') }}"></script> | |||
<script type="text/javascript" src="{{ asset('bower_components/popper.js/js/popper.min.js') }}"></script> | |||
<script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script> | |||
<!-- Add Firebase products that you want to use --> | |||
<script src="https://www.gstatic.com/firebasejs/7.22.0/firebase-messaging.js"></script> | |||
<script> | |||
var existingToken = '{{ $token }}'; | |||
// Your web app's Firebase configuration | |||
var firebaseConfig = { | |||
apiKey: "AIzaSyBJMDMk5s1Naxq5pW0cfcC4sSg_ExMyJYM", | |||
authDomain: "sipadu-johor.firebaseapp.com", | |||
databaseURL: "https://sipadu-johor.firebaseio.com", | |||
projectId: "sipadu-johor", | |||
storageBucket: "sipadu-johor.appspot.com", | |||
messagingSenderId: "790988903295", | |||
appId: "1:790988903295:web:89a8a3754829aa5649804a" | |||
}; | |||
// Initialize Firebase | |||
firebase.initializeApp(firebaseConfig); | |||
// Retrieve Firebase Messaging object. | |||
const messaging = firebase.messaging(); | |||
messaging.usePublicVapidKey("BNi8dCDetrOMaBt9JH6_enkuzNMc8TdDdQKoyeVaaAisyrP2yX3RDALlThKNcIzqVF51JLIXWWZSx14mWTkoy68"); | |||
messaging.requestPermission().then(function() { | |||
console.log("Notification permission granted."); | |||
if(existingToken == ''){ | |||
deleteToken(); | |||
} | |||
return messaging.getToken(); | |||
}).then(function(token) { | |||
updateToken(); | |||
}).catch(function (err) { | |||
console.log('Unable to get permission to notify.'); | |||
}); | |||
messaging.onTokenRefresh(() => { | |||
messaging.getToken().then((refreshedToken) => { | |||
console.log('Token refreshed.'); | |||
setTokenSentToServer(false); | |||
sendTokenToServer(refreshedToken); | |||
updateToken(); | |||
}).catch((err) => { | |||
console.log('Unable to retrieve refreshed token ', err); | |||
}); | |||
}); | |||
messaging.onMessage(function (payload) { | |||
console.log('onMessage:', payload); | |||
notify(payload.notification.body, 'fa fa-comments', 'bottom', 'right', 'inverse', 'animated bounceIn', 'animated bounceOut'); | |||
}); | |||
function sendTokenToServer(currentToken) { | |||
if (!isTokenSentToServer()) { | |||
console.log('Sending token to server...'); | |||
$.ajax({ | |||
type: "POST", | |||
url: "{{ url('/api/update/firebase/token') }}", | |||
data: { token: currentToken, _id: '{{ $uid }}' }, | |||
success: function(result){ | |||
if(result.success == true){ | |||
console.log('Success sending token to server...'); | |||
setTokenSentToServer(true); | |||
}else { | |||
setTokenSentToServer(false); | |||
console.log('Error sending token to server...'); | |||
} | |||
} | |||
}); | |||
} else { | |||
console.log('Token already sent to server so won\'t send it again ' + | |||
'unless it changes'); | |||
} | |||
} | |||
function isTokenSentToServer() { | |||
return window.localStorage.getItem('sentToServer') === '1'; | |||
} | |||
function setTokenSentToServer(sent) { | |||
window.localStorage.setItem('sentToServer', sent ? '1' : '0'); | |||
} | |||
function updateToken() { | |||
messaging.getToken().then((currentToken) => { | |||
if (currentToken) { | |||
sendTokenToServer(currentToken); | |||
} else { | |||
// Show permission request. | |||
console.log('No Instance ID token available. Request permission to generate one.'); | |||
setTokenSentToServer(false); | |||
} | |||
}).catch((err) => { | |||
console.log('An error occurred while retrieving token. ', err); | |||
setTokenSentToServer(false); | |||
}); | |||
} | |||
function deleteToken() { | |||
messaging.getToken().then((currentToken) => { | |||
messaging.deleteToken(currentToken).then(() => { | |||
console.log('Token deleted.'); | |||
setTokenSentToServer(false); | |||
updateToken(); | |||
}).catch((err) => { | |||
console.log('Unable to delete token. ', err); | |||
}); | |||
}).catch((err) => { | |||
console.log('Error retrieving Instance ID token. ', err); | |||
}); | |||
} | |||
</script> | |||
</head> | |||
<body class="horizontal-icon-fixed"> | |||
<!-- Pre-loader start --> | |||
<div class="theme-loader"> | |||
@include('include.loader') | |||
</div> | |||
<!-- Pre-loader end --> | |||
<div id="pcoded" class="pcoded"> | |||
<div class="pcoded-overlay-box"></div> | |||
<div class="pcoded-container"> | |||
@include('include.top-menu') | |||
<!-- Sidebar chat start --> | |||
<!-- @include('include.sidebar-chat') --> | |||
<!-- Sidebar inner chat start--> | |||
<!-- @include('include.sidebar-chat-inner') --> | |||
<!-- Sidebar inner chat end--> | |||
<div class="pcoded-main-container"> | |||
@include('include.horizontal-menu') | |||
<div class="pcoded-wrapper"> | |||
<div class="pcoded-content"> | |||
<div class="pcoded-inner-content"> | |||
<!-- Main-body start --> | |||
<div class="main-body"> | |||
<div class="page-wrapper"> | |||
<!-- Page body start --> | |||
<div class="page-body"> | |||
@yield('content') | |||
</div> | |||
<!-- Page-body end --> | |||
</div> | |||
</div> | |||
<!-- Main-body end --> | |||
<!-- <div id="styleSelector"> | |||
</div> --> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
@include('include.footer') | |||
@yield('external_js') | |||
<!-- menu js --> | |||
<script src="{{ asset('assets/js/pcoded.min.js') }}"></script> | |||
<script src="{{ asset('assets/js/light-dark/menu/menu-hori-fixed.js') }}"></script> | |||
<!-- custom js --> | |||
<script type="text/javascript" src="{{ asset('assets/js/script.js') }}"></script> | |||
</body> | |||
</html> |
@@ -1,211 +1,211 @@ | |||
<!DOCTYPE html> | |||
<html lang="en"> | |||
<head> | |||
@include('include.header') | |||
<style type="text/css"> | |||
select.form-control, select.form-control:focus, select.form-control:hover{ | |||
border-top: 1px solid #cccccc; | |||
border-right: 1px solid #cccccc; | |||
border-left: 1px solid #cccccc; | |||
} | |||
select.form-control:not([size]):not([multiple]) { | |||
height: auto; | |||
} | |||
.nav-tabs .slide { background: #D84315 !important; } | |||
.pcoded .pcoded-header[header-theme="theme6"] { | |||
background: #000 !important; | |||
} | |||
body.horizontal-icon .pcoded .pcoded-navbar .pcoded-item > li.pcoded-nomenu > a, body.horizontal-icon-fixed .pcoded .pcoded-navbar .pcoded-item > li.pcoded-nomenu > a { | |||
line-height: 30px; | |||
} | |||
body.horizontal-icon-fixed .pcoded[pcoded-device-type="desktop"] .pcoded-navbar .pcoded-item > li.pcoded-nomenu > a { | |||
height: 70px; | |||
} | |||
.pcoded-main-container { | |||
background: #343A40 !important; | |||
} | |||
.page-body .inner-page { margin: 0px 50px; } | |||
.card .card-header h5:after { | |||
background-color: #D84315 !important; | |||
} | |||
.page-item.active .page-link { | |||
background-color: #D84315 !important; | |||
border-color: #D84315 !important; | |||
} | |||
.icons-alert:before { top: 13px !important; } | |||
@media only screen and (max-width: 992px) { | |||
.page-body .inner-page { margin: 0px; } | |||
.header-navbar .navbar-wrapper .navbar-logo a img { | |||
width: 150px !important; | |||
} | |||
} | |||
body{ | |||
font-family: sans-serif !important; | |||
} | |||
h5, b { font-weight: 600 !important } | |||
</style> | |||
<!-- The core Firebase JS SDK is always required and must be listed first --> | |||
<script src="https://www.gstatic.com/firebasejs/7.0.0/firebase-app.js"></script> | |||
<!-- Required Jquery --> | |||
<script type="text/javascript" src="{{ asset('bower_components/jquery/js/jquery.min.js') }}"></script> | |||
<script type="text/javascript" src="{{ asset('bower_components/jquery-ui/js/jquery-ui.min.js') }}"></script> | |||
<script type="text/javascript" src="{{ asset('bower_components/popper.js/js/popper.min.js') }}"></script> | |||
<script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script> | |||
<!-- Add Firebase products that you want to use --> | |||
<script src="https://www.gstatic.com/firebasejs/7.0.0/firebase-messaging.js"></script> | |||
<script> | |||
var existingToken = '{{ $token }}'; | |||
// Your web app's Firebase configuration | |||
var firebaseConfig = { | |||
apiKey: "AIzaSyB7keN56ITS_wLImT1G8t2LwB2SY_ejedI", | |||
authDomain: "sipadu-mdch.firebaseapp.com", | |||
databaseURL: "https://sipadu-mdch.firebaseio.com", | |||
projectId: "sipadu-mdch", | |||
storageBucket: "", | |||
messagingSenderId: "379374790363", | |||
appId: "1:379374790363:web:219670d6d79a10f76d8efe" | |||
}; | |||
// Initialize Firebase | |||
firebase.initializeApp(firebaseConfig); | |||
// Retrieve Firebase Messaging object. | |||
const messaging = firebase.messaging(); | |||
messaging.usePublicVapidKey("BNi8dCDetrOMaBt9JH6_enkuzNMc8TdDdQKoyeVaaAisyrP2yX3RDALlThKNcIzqVF51JLIXWWZSx14mWTkoy68"); | |||
messaging.requestPermission().then(function() { | |||
console.log("Notification permission granted."); | |||
if(existingToken == ''){ | |||
deleteToken(); | |||
} | |||
return messaging.getToken(); | |||
}).then(function(token) { | |||
updateToken(); | |||
}).catch(function (err) { | |||
console.log('Unable to get permission to notify.'); | |||
}); | |||
messaging.onTokenRefresh(() => { | |||
messaging.getToken().then((refreshedToken) => { | |||
console.log('Token refreshed.'); | |||
setTokenSentToServer(false); | |||
sendTokenToServer(refreshedToken); | |||
updateToken(); | |||
}).catch((err) => { | |||
console.log('Unable to retrieve refreshed token ', err); | |||
}); | |||
}); | |||
messaging.onMessage(function (payload) { | |||
console.log('onMessage:', payload); | |||
notify(payload.notification.body, 'fa fa-comments', 'bottom', 'right', 'inverse', 'animated bounceIn', 'animated bounceOut'); | |||
}); | |||
function sendTokenToServer(currentToken) { | |||
if (!isTokenSentToServer()) { | |||
console.log('Sending token to server...'); | |||
$.ajax({ | |||
type: "POST", | |||
url: origin+"/api/update/firebase/token", | |||
data: { token: currentToken, _id: '{{ $uid }}' }, | |||
success: function(result){ | |||
if(result.success == true){ | |||
console.log('Success sending token to server...'); | |||
setTokenSentToServer(true); | |||
}else { | |||
setTokenSentToServer(false); | |||
console.log('Error sending token to server...'); | |||
} | |||
} | |||
}); | |||
} else { | |||
console.log('Token already sent to server so won\'t send it again ' + | |||
'unless it changes'); | |||
} | |||
} | |||
function isTokenSentToServer() { | |||
return window.localStorage.getItem('sentToServer') === '1'; | |||
} | |||
function setTokenSentToServer(sent) { | |||
window.localStorage.setItem('sentToServer', sent ? '1' : '0'); | |||
} | |||
function updateToken() { | |||
messaging.getToken().then((currentToken) => { | |||
if (currentToken) { | |||
sendTokenToServer(currentToken); | |||
} else { | |||
// Show permission request. | |||
console.log('No Instance ID token available. Request permission to generate one.'); | |||
setTokenSentToServer(false); | |||
} | |||
}).catch((err) => { | |||
console.log('An error occurred while retrieving token. ', err); | |||
setTokenSentToServer(false); | |||
}); | |||
} | |||
function deleteToken() { | |||
messaging.getToken().then((currentToken) => { | |||
messaging.deleteToken(currentToken).then(() => { | |||
console.log('Token deleted.'); | |||
setTokenSentToServer(false); | |||
updateToken(); | |||
}).catch((err) => { | |||
console.log('Unable to delete token. ', err); | |||
}); | |||
}).catch((err) => { | |||
console.log('Error retrieving Instance ID token. ', err); | |||
}); | |||
} | |||
</script> | |||
</head> | |||
<body class="horizontal-icon-fixed"> | |||
<!-- Pre-loader start --> | |||
<div class="theme-loader"> | |||
@include('include.loader') | |||
</div> | |||
<!-- Pre-loader end --> | |||
<div id="pcoded" class="pcoded"> | |||
<div class="pcoded-overlay-box"></div> | |||
<div class="pcoded-container"> | |||
@include('include.officer-top-menu') | |||
<!-- Sidebar chat start --> | |||
<!-- @include('include.sidebar-chat') --> | |||
<!-- Sidebar inner chat start--> | |||
<!-- @include('include.sidebar-chat-inner') --> | |||
<!-- Sidebar inner chat end--> | |||
<div class="pcoded-main-container"> | |||
@include('include.officer-horizontal-menu') | |||
<div class="pcoded-wrapper"> | |||
<div class="pcoded-content"> | |||
<div class="pcoded-inner-content"> | |||
<!-- Main-body start --> | |||
<div class="main-body"> | |||
<div class="page-wrapper"> | |||
<!-- Page body start --> | |||
<div class="page-body"> | |||
@yield('content') | |||
</div> | |||
<!-- Page-body end --> | |||
</div> | |||
</div> | |||
<!-- Main-body end --> | |||
<!-- <div id="styleSelector"> | |||
</div> --> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
@include('include.footer') | |||
@yield('external_js') | |||
</body> | |||
</html> | |||
<!DOCTYPE html> | |||
<html lang="en"> | |||
<head> | |||
@include('include.header') | |||
<style type="text/css"> | |||
select.form-control, select.form-control:focus, select.form-control:hover{ | |||
border-top: 1px solid #cccccc; | |||
border-right: 1px solid #cccccc; | |||
border-left: 1px solid #cccccc; | |||
} | |||
select.form-control:not([size]):not([multiple]) { | |||
height: auto; | |||
} | |||
.nav-tabs .slide { background: #D84315 !important; } | |||
.pcoded .pcoded-header[header-theme="theme6"] { | |||
background: #000 !important; | |||
} | |||
body.horizontal-icon .pcoded .pcoded-navbar .pcoded-item > li.pcoded-nomenu > a, body.horizontal-icon-fixed .pcoded .pcoded-navbar .pcoded-item > li.pcoded-nomenu > a { | |||
line-height: 30px; | |||
} | |||
body.horizontal-icon-fixed .pcoded[pcoded-device-type="desktop"] .pcoded-navbar .pcoded-item > li.pcoded-nomenu > a { | |||
height: 70px; | |||
} | |||
.pcoded-main-container { | |||
background: #343A40 !important; | |||
} | |||
.page-body .inner-page { margin: 0px 50px; } | |||
.card .card-header h5:after { | |||
background-color: #D84315 !important; | |||
} | |||
.page-item.active .page-link { | |||
background-color: #D84315 !important; | |||
border-color: #D84315 !important; | |||
} | |||
.icons-alert:before { top: 13px !important; } | |||
@media only screen and (max-width: 992px) { | |||
.page-body .inner-page { margin: 0px; } | |||
.header-navbar .navbar-wrapper .navbar-logo a img { | |||
width: 150px !important; | |||
} | |||
} | |||
body{ | |||
font-family: sans-serif !important; | |||
} | |||
h5, b { font-weight: 600 !important } | |||
</style> | |||
<!-- The core Firebase JS SDK is always required and must be listed first --> | |||
<script src="https://www.gstatic.com/firebasejs/7.0.0/firebase-app.js"></script> | |||
<!-- Required Jquery --> | |||
<script type="text/javascript" src="{{ asset('bower_components/jquery/js/jquery.min.js') }}"></script> | |||
<script type="text/javascript" src="{{ asset('bower_components/jquery-ui/js/jquery-ui.min.js') }}"></script> | |||
<script type="text/javascript" src="{{ asset('bower_components/popper.js/js/popper.min.js') }}"></script> | |||
<script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script> | |||
<!-- Add Firebase products that you want to use --> | |||
<script src="https://www.gstatic.com/firebasejs/7.0.0/firebase-messaging.js"></script> | |||
<script> | |||
var existingToken = '{{ $token }}'; | |||
// Your web app's Firebase configuration | |||
var firebaseConfig = { | |||
apiKey: "AIzaSyBJMDMk5s1Naxq5pW0cfcC4sSg_ExMyJYM", | |||
authDomain: "sipadu-johor.firebaseapp.com", | |||
databaseURL: "https://sipadu-johor.firebaseio.com", | |||
projectId: "sipadu-johor", | |||
storageBucket: "sipadu-johor.appspot.com", | |||
messagingSenderId: "790988903295", | |||
appId: "1:790988903295:web:89a8a3754829aa5649804a" | |||
}; | |||
// Initialize Firebase | |||
firebase.initializeApp(firebaseConfig); | |||
// Retrieve Firebase Messaging object. | |||
const messaging = firebase.messaging(); | |||
messaging.usePublicVapidKey("BNi8dCDetrOMaBt9JH6_enkuzNMc8TdDdQKoyeVaaAisyrP2yX3RDALlThKNcIzqVF51JLIXWWZSx14mWTkoy68"); | |||
messaging.requestPermission().then(function() { | |||
console.log("Notification permission granted."); | |||
if(existingToken == ''){ | |||
deleteToken(); | |||
} | |||
return messaging.getToken(); | |||
}).then(function(token) { | |||
updateToken(); | |||
}).catch(function (err) { | |||
console.log('Unable to get permission to notify.'); | |||
}); | |||
messaging.onTokenRefresh(() => { | |||
messaging.getToken().then((refreshedToken) => { | |||
console.log('Token refreshed.'); | |||
setTokenSentToServer(false); | |||
sendTokenToServer(refreshedToken); | |||
updateToken(); | |||
}).catch((err) => { | |||
console.log('Unable to retrieve refreshed token ', err); | |||
}); | |||
}); | |||
messaging.onMessage(function (payload) { | |||
console.log('onMessage:', payload); | |||
notify(payload.notification.body, 'fa fa-comments', 'bottom', 'right', 'inverse', 'animated bounceIn', 'animated bounceOut'); | |||
}); | |||
function sendTokenToServer(currentToken) { | |||
if (!isTokenSentToServer()) { | |||
console.log('Sending token to server...'); | |||
$.ajax({ | |||
type: "POST", | |||
url: origin+"/api/update/firebase/token", | |||
data: { token: currentToken, _id: '{{ $uid }}' }, | |||
success: function(result){ | |||
if(result.success == true){ | |||
console.log('Success sending token to server...'); | |||
setTokenSentToServer(true); | |||
}else { | |||
setTokenSentToServer(false); | |||
console.log('Error sending token to server...'); | |||
} | |||
} | |||
}); | |||
} else { | |||
console.log('Token already sent to server so won\'t send it again ' + | |||
'unless it changes'); | |||
} | |||
} | |||
function isTokenSentToServer() { | |||
return window.localStorage.getItem('sentToServer') === '1'; | |||
} | |||
function setTokenSentToServer(sent) { | |||
window.localStorage.setItem('sentToServer', sent ? '1' : '0'); | |||
} | |||
function updateToken() { | |||
messaging.getToken().then((currentToken) => { | |||
if (currentToken) { | |||
sendTokenToServer(currentToken); | |||
} else { | |||
// Show permission request. | |||
console.log('No Instance ID token available. Request permission to generate one.'); | |||
setTokenSentToServer(false); | |||
} | |||
}).catch((err) => { | |||
console.log('An error occurred while retrieving token. ', err); | |||
setTokenSentToServer(false); | |||
}); | |||
} | |||
function deleteToken() { | |||
messaging.getToken().then((currentToken) => { | |||
messaging.deleteToken(currentToken).then(() => { | |||
console.log('Token deleted.'); | |||
setTokenSentToServer(false); | |||
updateToken(); | |||
}).catch((err) => { | |||
console.log('Unable to delete token. ', err); | |||
}); | |||
}).catch((err) => { | |||
console.log('Error retrieving Instance ID token. ', err); | |||
}); | |||
} | |||
</script> | |||
</head> | |||
<body class="horizontal-icon-fixed"> | |||
<!-- Pre-loader start --> | |||
<div class="theme-loader"> | |||
@include('include.loader') | |||
</div> | |||
<!-- Pre-loader end --> | |||
<div id="pcoded" class="pcoded"> | |||
<div class="pcoded-overlay-box"></div> | |||
<div class="pcoded-container"> | |||
@include('include.officer-top-menu') | |||
<!-- Sidebar chat start --> | |||
<!-- @include('include.sidebar-chat') --> | |||
<!-- Sidebar inner chat start--> | |||
<!-- @include('include.sidebar-chat-inner') --> | |||
<!-- Sidebar inner chat end--> | |||
<div class="pcoded-main-container"> | |||
@include('include.officer-horizontal-menu') | |||
<div class="pcoded-wrapper"> | |||
<div class="pcoded-content"> | |||
<div class="pcoded-inner-content"> | |||
<!-- Main-body start --> | |||
<div class="main-body"> | |||
<div class="page-wrapper"> | |||
<!-- Page body start --> | |||
<div class="page-body"> | |||
@yield('content') | |||
</div> | |||
<!-- Page-body end --> | |||
</div> | |||
</div> | |||
<!-- Main-body end --> | |||
<!-- <div id="styleSelector"> | |||
</div> --> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
@include('include.footer') | |||
@yield('external_js') | |||
</body> | |||
</html> |