diff --git a/resources/views/layouts/app_operasi.blade.php b/resources/views/layouts/app_operasi.blade.php index ddda734..32b86c2 100644 --- a/resources/views/layouts/app_operasi.blade.php +++ b/resources/views/layouts/app_operasi.blade.php @@ -126,37 +126,7 @@ var audio = new Audio("{{ asset('sound/3.wav') }}"); audio.muted = true; - // Enable pusher logging - don't include this in production - Pusher.logToConsole = false; - - var pusher = new Pusher("{{ env('PUSHER_APP_KEY') }}", { - cluster: 'ap1', - encrypted: true - }); - - var channel = pusher.subscribe('operasi-notify'); - channel.bind('operasi-event', function(data) { - let message = JSON.stringify(data); - - $('#bell').css("color", "red"); - $('#linkz').text(data.namateller + " Pohon Kelulusan"); - $("#linkz").attr("href", "{{ url('kelulusan') }}"); - - if(window.location.pathname === '/operasi/kelulusan') - { - location.reload(); - }else{ - audio.play(); - audio.muted = false; - var countlagu = 1; - audio.onended = function() { - if(countlagu <= 3){ - countlagu++; - this.play(); - } - } - } - const Toast = Swal.mixin({ + const Toast = Swal.mixin({ toast: true, position: 'top-end', showConfirmButton: false, @@ -166,7 +136,67 @@ toast.addEventListener('mouseenter', Swal.stopTimer) toast.addEventListener('mouseleave', Swal.resumeTimer) } - }) + }); + + // Enable pusher logging - don't include this in production + Pusher.logToConsole = false; + + var pusher = new Pusher("{{ env('PUSHER_APP_KEY') }}", { + cluster: 'ap1', + encrypted: true + }); + + var kelulusanhapus = pusher.subscribe('notice-kelulusan'); + kelulusanhapus.bind('my-kelulusan', function(data) { + if(data.tagoperasi == 1){ + let message = JSON.stringify(data); + + $('#bell').css("color", "red"); + $('#linkz').text(data.namateller + " Pohon Kelulusan Dihapuskan"); + $("#linkz").attr("href", "{{ url('kelulusan') }}"); + if(window.location.pathname === '/operasi/kelulusan') + location.reload(); + else{ + audio.play(); + audio.muted = false; + var countlagu = 1; + audio.onended = function() { + if(countlagu <= 3){ + countlagu++; + this.play(); + } + } + } + Toast.fire({ + icon: 'info', + title: 'Kelulusan Dipohon Sekarang!' + }); + } + }); + + + var channel = pusher.subscribe('operasi-notify'); + channel.bind('operasi-event', function(data) { + let message = JSON.stringify(data); + + $('#bell').css("color", "red"); + $('#linkz').text(data.namateller + " Pohon Kelulusan"); + $("#linkz").attr("href", "{{ url('kelulusan') }}"); + + if(window.location.pathname === '/operasi/kelulusan') + { + location.reload(); + }else{ + audio.play(); + audio.muted = false; + var countlagu = 1; + audio.onended = function() { + if(countlagu <= 3){ + countlagu++; + this.play(); + } + } + } Toast.fire({ icon: 'error',