Reload page when download pdf notis peringatan call center
This commit is contained in:
@@ -1430,8 +1430,11 @@ class NotisController extends Controller
|
||||
|
||||
}
|
||||
|
||||
public function jananotisperingatan2($notisid,$cawid)
|
||||
public function jananotisperingatan2(Request $request)
|
||||
{
|
||||
$notisid = $request->notisid;
|
||||
$cawid = $request->cawid;
|
||||
|
||||
$user = Auth::user();
|
||||
$caw = Cawangan::where('id', '=', $cawid)->first();
|
||||
|
||||
@@ -1480,8 +1483,11 @@ public function jananotisperingatan2($notisid,$cawid)
|
||||
return $pdf->download('Penjanaan Notis Peringatan Fasa 1 ' . $notisid . '.pdf');
|
||||
}
|
||||
|
||||
public function jananotisperingatan2fasa2($notisid,$cawid)
|
||||
public function jananotisperingatan2fasa2(Request $request)
|
||||
{
|
||||
$notisid = $request->notisid;
|
||||
$cawid = $request->cawid;
|
||||
|
||||
$user = Auth::user();
|
||||
$caw = Cawangan::where('id', '=', $cawid)->first();
|
||||
|
||||
|
||||
@@ -152,9 +152,9 @@
|
||||
</td>
|
||||
<td class="text-center">
|
||||
@if($caw['fasa'] == 1)
|
||||
<a class="confirmrefresh btn m-1 btn-info" href="{{ route('notisperingatan.jananotisperingatan2',['notisid'=>$caw['notis_id'],'cawid'=>$caw['id_cawangan']]) }}" data-toggle="tooltip" data-placement="top" title="Muat Turun Notis Peringatan Fasa 1" style="margin-right:40px" ><i class="fas fa-download"></i></a>
|
||||
<a class="confirmrefresh btn m-1 btn-info downloadFasa1" data-notisid="{{$caw['notis_id']}}" data-cawid="{{$caw['id_cawangan']}}" data-toggle="tooltip" data-placement="top" title="Muat Turun Notis Peringatan Fasa 1" style="margin-right:40px" ><i class="fas fa-download"></i></a>
|
||||
@elseif($caw['fasa'] == 2)
|
||||
<a class="confirmrefresh btn m-1 btn-info" href="{{ route('notisperingatan.jananotisperingatan2fasa2',['notisid'=>$caw['notis_id'],'cawid'=>$caw['id_cawangan']]) }}" data-toggle="tooltip" data-placement="top" title="Muat Turun Notis Peringatan Fasa 2" style="margin-right:40px" ><i class="fas fa-download"></i></a>
|
||||
<a class="confirmrefresh btn m-1 btn-info downloadFasa2" data-notisid="{{$caw['notis_id']}}" data-cawid="{{$caw['id_cawangan']}}" data-toggle="tooltip" data-placement="top" title="Muat Turun Notis Peringatan Fasa 2" style="margin-right:40px" ><i class="fas fa-download"></i></a>
|
||||
@endif
|
||||
</td>
|
||||
<td class="text-center">
|
||||
@@ -340,7 +340,7 @@
|
||||
"searching":false,
|
||||
"info": false,
|
||||
"lengthChange": false,
|
||||
"pageLength": 15,
|
||||
"pageLength": 100,
|
||||
dom: 'Bfrtip',
|
||||
buttons: [
|
||||
|
||||
@@ -367,6 +367,89 @@
|
||||
$(this).prop('checked', cb.checked);
|
||||
})
|
||||
}
|
||||
|
||||
$(".downloadFasa1").click(function(){
|
||||
var notisid = $(this).data("notisid");
|
||||
var cawid = $(this).data("cawid");
|
||||
$.confirm({
|
||||
content: function() {
|
||||
var self = this;
|
||||
var data = '';
|
||||
return $.ajax({
|
||||
method: 'GET',
|
||||
url: "{{ route('notisperingatan.jananotisperingatan2') }}",
|
||||
data: {
|
||||
notisid: notisid,
|
||||
cawid: cawid
|
||||
},
|
||||
xhrFields: {
|
||||
responseType: 'blob'
|
||||
},
|
||||
}).done(function(response) {
|
||||
var blob = new Blob([response]);
|
||||
var link = document.createElement('a');
|
||||
link.href = window.URL.createObjectURL(blob);
|
||||
link.download = "Penjanaan Notis Peringatan Fasa 1 " + notisid + ".pdf";
|
||||
link.click();
|
||||
self.setTitle('<span style="color:green;">Muat Turun Berjaya.</span>');
|
||||
}).fail(function(response) {
|
||||
console.log(response);
|
||||
alert(response);
|
||||
self.setTitle('<span style="color:red;">Gagal! Sila hubungi iT.</span>');
|
||||
});
|
||||
},
|
||||
buttons: {
|
||||
ok: {
|
||||
keys: ['enter'],
|
||||
action: function(){
|
||||
location.reload();
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(".downloadFasa2").click(function(){
|
||||
var notisid = $(this).data("notisid");
|
||||
var cawid = $(this).data("cawid");
|
||||
$.confirm({
|
||||
content: function() {
|
||||
var self = this;
|
||||
var data = '';
|
||||
return $.ajax({
|
||||
method: 'GET',
|
||||
url: "{{ route('notisperingatan.jananotisperingatan2fasa2') }}",
|
||||
data: {
|
||||
notisid: notisid,
|
||||
cawid: cawid
|
||||
},
|
||||
xhrFields: {
|
||||
responseType: 'blob'
|
||||
},
|
||||
}).done(function(response) {
|
||||
var blob = new Blob([response]);
|
||||
var link = document.createElement('a');
|
||||
link.href = window.URL.createObjectURL(blob);
|
||||
link.download = "Penjanaan Notis Peringatan Fasa 2 " + notisid + ".pdf";
|
||||
link.click();
|
||||
self.setTitle('<span style="color:green;">Muat Turun Berjaya.</span>');
|
||||
}).fail(function(response) {
|
||||
console.log(response);
|
||||
alert(response);
|
||||
self.setTitle('<span style="color:red;">Gagal! Sila hubungi iT.</span>');
|
||||
});
|
||||
},
|
||||
buttons: {
|
||||
ok: {
|
||||
keys: ['enter'],
|
||||
action: function(){
|
||||
location.reload();
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@endsection
|
||||
|
||||
+2
-2
@@ -659,8 +659,8 @@ Route::group(['middleware' => ['permission:notisperingatan'], 'prefix' => 'notis
|
||||
Route::get('/gadaibycawnotisfasa1excel/{tempoh}/{tempoh2}',['as'=>'notisperingatan.gadaibycawnotisfasa1excel','uses'=>'NotisController@gadaibycawnotisfasa1excel']);
|
||||
|
||||
Route::get('/kemaskinidatanotis/{tarikhnotis}',['as'=>'notisperingatan.kemaskinidatanotis','uses'=>'NotisController@kemaskinidatanotis']);
|
||||
Route::get('/jananotisperingatan2/{notisid}/{cawid}',['as'=>'notisperingatan.jananotisperingatan2','uses'=>'NotisController@jananotisperingatan2']);
|
||||
Route::get('/jananotisperingatan2fasa2/{notisid}/{cawid}',['as'=>'notisperingatan.jananotisperingatan2fasa2','uses'=>'NotisController@jananotisperingatan2fasa2']);
|
||||
Route::get('/jananotisperingatan2',['as'=>'notisperingatan.jananotisperingatan2','uses'=>'NotisController@jananotisperingatan2']);
|
||||
Route::get('/jananotisperingatan2fasa2',['as'=>'notisperingatan.jananotisperingatan2fasa2','uses'=>'NotisController@jananotisperingatan2fasa2']);
|
||||
Route::get('/blastnotisperingatan/{notisid}/{cawid}',['as'=>'notisperingatan.blastnotisperingatan','uses'=>'NotisController@blastnotisperingatan']);
|
||||
|
||||
Route::get('/failedjob',['as'=>'notisperingatan.failedjob','uses'=>'NotisController@failedjob']);
|
||||
|
||||
Reference in New Issue
Block a user