Script
Script
js') }}"></script>
// function startAudio(){
// if(sound.paused){
// sound.pause();
// }
// function fmute(){
// if(sound.muted){
// sound.muted=false;
// }else{
// sound.muted=true;
// }
// }
// }
$(window).on('load', function() {
$.ajax({
url : UrlApiNew+'/notificationscount',
type: "GET",
//dataType:'json',
headers:{
'Authorization' : token
},
success: function(data) {
let dataCount = data.data;
audioDevice(localStorage.getItem("sDevice"),
dataCount.countDeviceAll);
audioPort(localStorage.getItem("sPort"),
dataCount.countPortAll);
$("#allnotif").html(dataCount.countAll);
$("#devicenotif").html(dataCount.countDeviceAll);
$("#portnotif").html(dataCount.countPortAll);
},
error: function(xhr, status) {
console.log("error getAllNotifDevice");
}
})
});
$('#setting-contact').on('click', function() {
window.location.href = window.location.origin + '/setting/contact'
})
$('#my-profile').on('click', function() {
window.location.href = window.location.origin +
'/cso/preferences/section=general'
})
$('#logout').on('click', function() {
window.location.href = window.location.origin + '/logout'
})
</script>
<script>
var apiUrlSocket = `{{config('app.apiUrlSocket')}}`;
var socket = io(apiUrlSocket);
//var messages = document.getElementById('messages');
// var form = document.getElementById('form');
// var input = document.getElementById('input');
// form.addEventListener('submit', function(e) {
// e.preventDefault();
// if (input.value) {
// socket.emit('chat message', input.value);
// input.value = '';
// }
// });
socket.on('count_all_notif', function(msg) {
//$('#allnotif').text('All Notif (' + msg + ')');
$("#allnotif").html(msg);
});
socket.on('count_device_notif', function(msg) {
$("#devicenotif").html(msg);
_getListNotifDevice();
});
socket.on('count_port_notif', function(msg) {
$("#portnotif").html(msg);
_getListNotifPort();
});
// // Onclick Event
// // onclick every item notification
//$('#itemNotif').on('click', function() {
// $(".itemnotif").click(function(){
// var notification_id = $(this).data('notificationid');
// alert(notification_id);
$('#notifall').on('click', function() {
var notification_id = $(this).data('notificationid');
console.log('notifId:', notification_id);
socket.emit('update_notif_status', { notification_id });
socket.emit('click_main_notif', 1);
updateStorage();
});
</script>
<script>
$(function(){
$("#navbar").bootnavbar();
});
$(document).ready(function() {
$("#exportexcel").click(function(){
$.ajax({
url : UrlApiNew+'/exportxlsx',
type: "POST",
//dataType:'json',
headers:{
'Authorization' : token
},
success: function(data) {
window.location = data.data.file_download_url;
setTimeout(() => {
window.location = baseUrl + '/settlement/export';
}, 2000);
},
error: function(xhr, status) {
console.log("error download");
}
})
})
$(function() {
$('[data-toggle="tooltip"]').tooltip({
placement: 'auto',
trigger: 'hover click',
boundary: 'HTMLElement',
html: true,
animation: true,
})
});
$('body').on('inserted.bs.tooltip', function(e) {
var $target = $(e.target);
$('[role="tooltip"]').hover(function() {
$(this).toggleClass('hover');
});
// $target.on('hide.bs.tooltip', function(e) {
// if ($('[role="tooltip"]').hasClass('hover')) {
// $('[role="tooltip"]').on('mouseleave', function() {
// $(this).removeClass('show')
// });
// e.preventDefault();
// return;
// }
// });
// });
$(".mobile-search-icon").on("click", function() {
$(".search-bar").addClass("full-search-bar")
}), $(".search-close").on("click", function() {
$(".search-bar").removeClass("full-search-bar")
}),
$('select').selectpicker({
container: 'body'
});
});
});
</script>
<script>
var UrlApiSe = `{{config('app.apiurlse')}}`;
var Url = `{{config('app.url')}}`;
var UrlApi = `{{config('app.apiurl')}}`;
var UrlApiNew = `{{config('app.apiurlnew')}}`;
var token = `{{config('app.token')}}`;
var ObvApi = `{{config('app.obvurl')}}`;
var BearerToken = `{{config('app.BEARERTOKEN')}}`;
var urlMap = `{{ config('app.urlmap') }}`;
var pathname = window.location.pathname;
$(document).ready(function() {
getSummaryMenu();
function updateStorage(){
$.ajax({
url : UrlApiNew+'/allnotifilist?device_type=device',
type: "GET",
//dataType:'json',
headers:{
'Authorization' : token
},
success: function(data) {
var dataNotifDevices = data.data;
localStorage.setItem("sDevice", dataNotifDevices.length);
audioDevice(localStorage.getItem("sDevice"),
dataNotifDevices.length);
},
error: function(xhr, status) {
console.log("error getAllNotifDevice");
}
});
$.ajax({
url : UrlApiNew+'/allnotifilist?device_type=port',
type: "GET",
//dataType:'json',
headers:{
'Authorization' : token
},
success: function(data) {
var dataNotifPort = data.data;
localStorage.setItem("sPort", dataNotifPort.length);
audioPort(localStorage.getItem("sPort"), dataNotifPort.length);
},
error: function(xhr, status) {
console.log("error getAllNotifPort");
}
});
}
});
cb(matches);
};
};
//audio();
function lookup(inputString) {
if (inputString.trim().length == 0) {
$('#suggestions').fadeOut(); // Hide the suggestions box
} else {
key_count_global++;
setTimeout("lookupwait(" + key_count_global + ",\"" + inputString +
"\")", 300); // Added timeout 0.3s before send query
}
}
// $('#the-basics .typeahead').typeahead({
// hint: true,
// highlight: true,
// minLength: 1,
// autocomplete: 'off',
// autofill: 'off',
// },
// {
// name: 'device',
// source: substringMatcher(device, state),
// templates: {
// // empty: [
// // '<div class="list-group search-results-dropdown"><div
class="list-group-item border-0">Nothing found.</div></div>'
// // ],
// header: [
// '<div class="list-group-item" style="background-color:
rgba(0, 0, 0, 0.05);"><p class="font-10 m-0"><b>DEFICE FOUND (1)</b></p></div>'
// ],
// suggestion: function (data) {
// return '<a href="#" class="list-group-item">' + data +
'</a>'
// }
// }
// },{
// name: 'state',
// source: substringMatcher(state),
// templates: {
// // empty: [
// // '<div class="list-group search-results-dropdown"><div
class="list-group-item border-0">Nothing found.</div></div>'
// // ],
// header: [
// '<div class="list-group-item border-top-0"
style="background-color: rgba(0, 0, 0, 0.05);"><p class="font-10 m-0"><b>STATE
FOUND (1)</b></p></div>'
// ],
// suggestion: function (data) {
// return '<a href="#" class="list-group-item d-block">' + data
+ '</a>'
// }
// }
// });
$(".waktu").click(function(){
menit = $(this).data("intervalmenit");
detik = $(this).data("intervaldetik");
if(menit >= 0 && detik >= 0){
hitung();
} else{
}
});
$(".manual").click(function(){
if(menit >= 0 && detik >= 0){
menit = 0;
detik = 0;
$('#msg').html(menit + ' menit ' + detik + ' detik ');
$("#msg").css("display","none");
}
});
function hitung() {
$("#msg").css("display","block");
setTimeout(hitung,1000);
$('#msg').html(menit + ' menit ' + detik + ' detik ');
detik --;
if(detik < 0) {
detik = 59;
menit --;
if(menit < 0) {
menit = 0;
detik = 0;
}
}else if(detik == 0 && menit == 0){
location.reload();
}
}
},
error: function(xhr, status) {
console.log("error getAllNotifDevice");
}
})
}
_getListNotifDevice();
},
error: function(xhr, status) {
console.log("error getAllNotifPort");
}
})
}
_getListNotifPort();
function getSummaryMenu() {
$.ajax({
url: UrlApiNew + "/summary/devices/device-summary",
type: "GET",
crossDomain: true,
headers : {
'Authorization' : token
},
success: function(response) {
$('#MnuDeviceUp').empty();
$('#MnuDeviceDown').empty();
$('#MnuDeviceDowns').empty();
$('#MnuTotPorts').empty();
$('#MnuSttsUp').empty();
$('#MnuSttsWrn').empty();
$('#MnuSttsDgr').empty();
$('#MnuSttsSec').empty();
$('#MnuDeviceUp').append(OnDev);
$('#MnuDeviceDown').append(OffDev);
$('#MnuDeviceDowns').append(OffDev);
$('#MnuTotPorts').append(PortAll.toLocaleString('id'));
$
('#MnuSttsUp').append(response.data.jsondata.statusok.toLocaleString('id'));
$
('#MnuSttsWrn').append(response.data.jsondata.statuswarning.toLocaleString('id'));
$
('#MnuSttsDgr').append(response.data.jsondata.statusalert.toLocaleString('id'));
$
('#MnuSttsSec').append(response.data.jsondata.statusignore.toLocaleString('id'));
},
error: function(xhr, status) {
// alert("error");
}
});
}
function getSummaryRouting() {
$.ajax({
url: UrlApiNew + "/summary/csocount",
type: "GET",
crossDomain: true,
headers : {
'Authorization' : token
},
success: function(resp) {
if (resp.meta.code == 200) {
$('#NavCountVRF').html(`(${resp.data.vrf_count})`)
$('#NavCountOSPF').html(`(${resp.data.ospf_count})`)
$('#NavCountBGP').html(`(${resp.data.bgp_all_count})`)
$('#RouteVrfs').html(resp.data.vrf_count)
$('#RouteOspf').html(resp.data.ospf_count)
$('#RouteAllSeasons').html(resp.data.bgp_all_count)
$('#RouteBgpInternal').html(resp.data.ibgp_all_count)
$('#RouteBgpExternal').html(resp.data.ebgp_all_count)
$('#RouteBgpAlert').html(resp.data.alert_bgp_all_count)
}
},
error: function () {
console.log("error getSummaryRouting")
}
})
}
getSummaryRouting()
</script>