Rapport-Laravel/resources/views/common/exportdownload.blade.php

97 lines
3.4 KiB
PHP

@extends('layouts.vertical', ['page_title' => 'Add & Edit Products'])
@section('css')
<style type="text/css">
#pageloader {
background: rgba(255, 255, 255, 0.8);
display: none;
height: 100%;
position: fixed;
width: 100%;
z-index: 9999;
}
#pageloader img {
left: 50%;
margin-left: -32px;
margin-top: -32px;
position: absolute;
top: 50%;
}
</style>
<link href="{{ asset('assets/libs/sweetalert2/sweetalert2.min.css') }}" rel="stylesheet" type="text/css" />
@endsection
@section('content')
<div id="pageloader">
<img src="{{ asset('assets/images/loader-large.gif') }}" alt="processing..." />
</div>
<div class="container-fluid">
@if (session()->has('message'))
<div class="alert alert-success mt-3">
{{ session()->get('message') }}
</div>
@endif
<div class="row mt-3">
<div class="col-xl-12">
<div class="card">
<input type="hidden" id="export_id" value="{{ $export_id }}">
</div>
</div>
</div>
</div>
<style type="text/css">
.ms-container {
max-width: 100%
}
</style>
@endsection
@section('script')
<script src="{{ asset('assets/libs/sweetalert2/sweetalert2.min.js') }}"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$("#pageloader").fadeIn();
worker();
});
function worker() {
$.ajax({
type: "GET",
url: '/formexport/getstatus?id=' + document.getElementById('export_id').value,
processData: false,
contentType: false,
success: function(data) {
// console.log(data);
var sweet_loader = '<div class="sweet_loader"> <div> <button class="btn btn-info btn-sm" onclick="history.back()">Go Back</button> </div> </div>';
var sweet_loader_download = '<div class="sweet_loader"> <div> <a class="btn-success btn-sm" href=' + data.download_url + '>Download</a> </div> </div>';
if (data.state == 'ready') {
$("#pageloader").fadeOut();
Swal.fire({
title: 'Data Exported Successfully!',
icon: 'success',
showConfirmButton: false,
onRender: function() {
$('.swal2-content').prepend(sweet_loader_download);
}
})
} else {
$("#pageloader").fadeOut();
swal.fire({
title: 'Exporting Data!',
allowOutsideClick: false,
didOpen: () => {
Swal.showLoading()
},
onRender: function() {
$('.swal2-content').prepend(sweet_loader);
}
});
}
},
});
}
var refInterval = window.setInterval('worker()', 5000);
</script>
@endsection