Rapport-Laravel/resources/views/form/rapport-team3/download-1682181475-19f5d78...

219 lines
11 KiB
PHP
Executable File

<!DOCTYPE html>
<html lang="en">
<head>
@include('layouts.shared/title-meta', ['title' => "Form"])
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="pageloader">
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
</div>
<div class="account-pages mt-2 mb-2">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8 col-lg-6 col-xl-5">
<div class="card">
<div class="card-body">
<h4 class="header-title mb-4">Copt link of Email all assets</h4>
<ul class="nav nav-pills navtab-bg nav-justified" role="tablist">
<li class="nav-item" role="presentation">
<a href="#downloadlink" data-bs-toggle="tab" aria-expanded="false" class="nav-link active" aria-selected="false" role="tab" tabindex="-1">
Copy download link
</a>
</li>
<li class="nav-item" role="presentation">
<a href="#emailassets" data-bs-toggle="tab" aria-expanded="true" class="nav-link" aria-selected="true" role="tab">
Email all assets
</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active show" id="downloadlink" role="tabpanel">
<div class="row">
<div class="col-md-8 mb-2">
<textarea name="" id="linkcontainer" rows="3" class="form-control">https://stage.buildrapport.co/form/downloadpersonalizationzip/{{$encripted}}</textarea>
</div>
<div class="col-md-4">
<div class="align-center">
<button type="button" class="btn btn-primary" id="copylink" style="margin-top:0px!important;">Copy Link</button>
</div>
</div>
</div>
</div>
<div class="tab-pane" id="emailassets" role="tabpanel">
<form method="POST" action="/form/downloadpersonalization?action=email" id="report-form" enctype="multipart/form-data">
<div class="col-md-12 mb-2">
<label for="field-email" class="form-label"> Your Email Id <span class="text-danger">*</span> </label>
<input type="email" id="field-email" name="email" class="form-control" required>
</div>
<div class="text-center d-grid mt-3">
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- <div class="card p-2">
<div class="col-8">
<h4 class="page-title">Email all assets</h4>
</div>
<form method="POST" action="/form/downloadpersonalization?action=email" id="report-form" enctype="multipart/form-data">
<div class="col-md-12 mb-2">
<label for="field-email" class="form-label"> Your Email Id <span class="text-danger">*</span> </label>
<input type="email" id="field-email" name="email" class="form-control" required>
</div>
<div class="text-center d-grid mt-3">
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
</div>
</form>
</div> -->
<div class="card">
<div class="col-8 p-2">
<h4 class="page-title">Download assets</h4>
</div>
@if(isset($pdf_file))
<div class="card-body">
<iframe src="/storage/{{$folder}}{{$pdf_file}}" style="border: none; width: 70vw%; height:50vh;"></iframe>
<div class="text-center">
<!-- <p class="text-muted font-14 mt-2"> Now click below button to download the PDF</p> -->
<a href="/storage/{{$folder}}{{$pdf_file}}" download class="btn btn-primary waves-effect waves-light mb-3 mt-1">Download PDF</a>
<!-- <a href="/" class="btn btn-dark waves-effect waves-light mt-3">Homepage</a> -->
</div>
</div> <!-- end card-body -->
@endif
@foreach($images as $image)
<div class="card-body p-3">
<img src="/storage/{{$folder}}{{$image}}" class="img-fluid">
<div class="text-center">
<!-- <p class="text-muted font-14 mt-2"> Now click below button to download </p> -->
<a href="/storage/{{$folder}}{{$image}}" download class="btn btn-primary waves-effect waves-light mb-3 mt-1">Download Image</a>
<!-- <a href="/" class="btn btn-dark waves-effect waves-light mt-3">Homepage</a> -->
</div>
</div> <!-- end card-body -->
@endforeach
</div>
<!-- end card -->
</div> <!-- end col -->
</div>
<!-- end row -->
</div>
<!-- end container -->
</div>
<!-- end page -->
</body>
<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>
@include('layouts.shared/footer-script')
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
<script src="{{ URL::asset('assets/libs/jquery-toast/jquery-toast.min.js')}}"></script>
<script src="{{ URL::asset('assets/js/pages/toastr.init.js')}}"></script>
<script type="text/javascript">
jQuery(document).ready(function($){
$('#copylink').click(function(){
try {
copyToClipboard('https://stage.buildrapport.co/form/downloadpersonalizationzip/{{$encripted}}');
//$.NotificationApp.send("success!", "Copied the link to your Clipboard", 'top-center', '#5ba035', 'success');
} catch (err) {
//$.NotificationApp.send("Oops, unable to copy!", "Please copy the link manually.", 'top-center', '#bf441d', 'error');
//console.log('Oops, unable to copy');
}
});
$('#report-form').on('submit', function(event){
event.preventDefault();
$("#pageloader").fadeIn();
$.ajax({
type: "GET",
url: '/form/downloadpersonalization?action=email&email=' + $('#field-email').val(),
//data: new FormData($('#report-form')[0]),
processData: false,
contentType: false,
success: function( data ) {
$("#pageloader").fadeOut();
if(data.status == 'success') {
Swal.fire({
title: 'Great!',
text: 'We have emailed you all the assets!',
icon: 'success'
})
$('#report-form').trigger("reset");
} else {
Swal.fire({
icon: 'error',
title: 'Email not sent',
text: 'Something went wrong, please try again after some time!'
})
}
},
});
});
});
function copyToClipboard(textToCopy) {
var textArea;
function isOS() {
//can use a better detection logic here
return navigator.userAgent.match(/ipad|iphone/i);
}
function createTextArea(text) {
textArea = document.createElement('textArea');
textArea.readOnly = true;
textArea.contentEditable = true;
textArea.value = text;
document.body.appendChild(textArea);
}
function selectText() {
var range, selection;
if (isOS()) {
range = document.createRange();
range.selectNodeContents(textArea);
selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
textArea.setSelectionRange(0, 999999);
} else {
textArea.select();
}
}
function copyTo() {
document.execCommand('copy');
document.body.removeChild(textArea);
}
createTextArea(textToCopy);
selectText();
copyTo();
}
</script>
</html>