2727 </div >
2828 @include (' panichd::tickets.partials.modal_agent' )
2929 @include (' panichd::tickets.partials.priority_popover_form' )
30-
31- @if ($ticketList == ' newest' )
32- @include (' panichd::tickets.datatable.modal_page_reload' )
33- @endif
3430 @stop
3531
3632 @section (' footer' )
3733 @include (' panichd::tickets.datatable.loader' )
3834 @include (' panichd::tickets.datatable.events' )
3935 @append
40- @endif
36+ @endif
37+
38+ @if ($ticketList == ' newest' && $setting -> grab (' newest_list_reload_seconds' ) )
39+ @php
40+ $toast_html = ' <div class="alert alert-info">'
41+ . ' <span id="toast_countdown">' . trans (' panichd::lang.page-reload-modal-countdown' , [' num' => ' 3' , ' num_class' => ' bg-info' ])
42+ . ' <button id="toast_cancel" type="button" class="btn btn-light btn-xs ml-2" data-new-countdown="no">' . trans (' panichd::lang.btn-cancel' ) . ' </button></span>'
43+ . ' <span id="toast_reloading">' . trans (' panichd::lang.page-reload-modal-reloading' ) . ' </span>'
44+ . ' '
45+ . ' </div>' ;
46+ @endphp
47+ @include (' panichd::shared.bottom_toast' , [' toast_html' => $toast_html ] )
48+ @section (' footer' )
49+ <script type =" text/javascript" >
50+ var page_reload = " " ;
51+
52+ function show_bottom_toast (reload_secs )
53+ {
54+ // Show bottom toast
55+ $ (' #toast_countdown #counter' ).text (reload_secs- 1 );
56+ $ (' #toast_countdown' ).show ();
57+ $ (' #toast_reloading' ).hide ();
58+ $ (' #bottom_toast' ).addClass (' show' );
59+
60+ // Update the count down every 1 second
61+ page_reload = setInterval (function () {
62+ reload_secs = reload_secs - 1 ;
63+
64+ // Output the result in an element with id="demo"
65+ $ (' #toast_countdown #counter' ).text (reload_secs);
66+
67+ // If the count down is over, replace text
68+ if (reload_secs == 0 ) {
69+ $ (' #toast_countdown' ).hide ();
70+ $ (' #toast_reloading' ).show ();
71+
72+ clearInterval (page_reload);
73+ window .location .reload (false );
74+ }
75+ }, 1000 );
76+ }
77+
78+ $ (function (){
79+ var toast_countdown = ({{ $setting -> grab (' newest_list_reload_seconds' ) } } - 3 )* 1000 ;
80+ var toast_countdown = 2000 ;
81+ var reload_secs = 4 ;
82+
83+ setTimeout (function (){ show_bottom_toast (reload_secs) }, toast_countdown);
84+
85+ $ (' #toast_cancel' ).click ( function () {
86+ // Clear countdown
87+ clearInterval (page_reload);
88+ $ (' #bottom_toast' ).removeClass (' show' );
89+
90+ // If set to create a new countdown
91+ if ($ (this ).data (' new-countdown' ) == ' yes' ){
92+ page_reload = " " ;
93+ reload_secs = 4 ;
94+ setTimeout (function (){ show_bottom_toast (reload_secs) }, toast_countdown);
95+
96+ }
97+ });
98+ });
99+ </script >
100+ @append
101+ @endif
0 commit comments