Raffales-LMS/resources/views/nepcoms/home.blade.php
2024-04-16 15:43:24 +05:45

338 lines
13 KiB
PHP

@extends(env('CLIENT_PATH') . '.welcome')
@section('content')
@if(session('registration_error'))
<script>window.alert('{{ session("registration_error") }}');</script>
@endif
<div class="form-box">
<div class="boximage">
<img src="<?php echo site_url(SITEVARS->Campaigns[0]->cover_photo); ?>" class="img-fluid" />
</div>
<!-- <div class="infotext">
<h1> <?php //echo SITEVARS->Campaigns[0]->title;
?></h1>
</div> -->
<form method="post" action="#" id="enquiry-form">
@csrf
<input type="hidden" name="sources_id" value="3" />
<input type="hidden" name="campaigns_id" value="<?php echo SITEVARS->Campaigns[0]->campaign_id; ?>" />
<div class="form-row">
<div class="col-12 col-sm-12 col-md-12 col-lg-12">
<div class="form-group"><label for="from-name">Name</label><span class="required-input">*</span>
<input class="form-control" type="text" id="from-name" name="name" required="">
</div>
</div>
</div>
<div class="form-row">
<div class="col-12 col-sm-6 col-md-12 col-lg-6">
<div class="form-group"><label for="from-email">Email</label><span class="required-input">*</span>
<input class="form-control" type="email" id="from-email" name="email" required="">
</div>
</div>
<div class="col-12 col-sm-6 col-md-12 col-lg-6">
<div class="form-group"><label for="from-phone">Mobile Number</label><span
class="required-input">*</span>
<div class="input-group">
<input class="form-control" type="text" id="from-phone" name="mobile" required
pattern="9\d{9}">
</div>
</div>
</div>
</div>
<div class="form-row">
<div class="col-12 col-sm-12 col-md-6 col-lg-6">
<div class="form-group"><label for="from-qualifications">Highest Qualification</label><span
class="required-input">*</span>
<select class="form-control" id="from-qualifications" type="text" name="qualification"
required="">
<option value="">Select Qualification</option>
<option value="SEE/SLC">SEE/SLC</option>
<option value="A levels">A levels</option>
<option value="10+2/PCL">10+2/PCL</option>
<option value="Bachelors (3 years)">Bachelors (3 Years)</option>
<option value="Bachelors (4 years)">Bachelors (4 Years)</option>
<option value="Master's and Above">Master's and Above</option>
</select>
</div>
</div>
<!--div class="col-12 col-sm-6 col-md-12 col-lg-6">
<div class="form-group"><label for="board">University / Board:</label><span class="required-input">*</span>
<div class="input-group">
<input class="form-control" type="text" id="board" name="board" autocomplete="off">
</div>
</div>
</div-->
<div class="col-md-6">
<div class="form-group"><label for="preferred_destination">Preferred Study Destination:</label>
<div class="select-group">
<select name="preferred_destination" class="form-control field-info">
<option value="" selected="" disabled="">Preferred Study Destination</option>
<option value="UK">Study in UK</option>
<option value="Australia">Study in Australia</option>
<option value="USA">Study in USA</option>
<option value="Canada">Study in Canada</option>
<option value="Other Destination">Others</option>
</select>
</div>
</div>
</div>
</div>
<div class="form-row">
<div class="col-12 col-sm-12 col-md-12 col-lg-12">
<div class="form-group"><label for="from-calltime">Message / Enquiry</label>
<textarea name="message" class="form-control" rows="5"></textarea>
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<input type="hidden" name="g-recaptcha-response" value="">
<div class="col"><button class="btn btn-success btn-block" type="submit"
id="submitButton">Register</button></div>
</div>
</div>
</div>
</form>
<?php //pre(SITEVARS->Campaigns[0]);
?>
<div class="modal fade" id="success-modal" tabindex="-1" role="dialog" aria-labelledby="success-modal-label"
aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header" style="display: none;">
<h5 class="modal-title" id="success-modal-label">Success</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<!-- <div id="modal-text-area">
</div> -->
<div id="success-modal-qr">
</div>
<!-- <div id="canvas-area">
</div> -->
</div>
<div class="modal-footer">
<button type="button" id="downloadButton" class="btn btn-success full-width"
style="width: 100%;">Download</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="error-modal" tabindex="-1" role="dialog" aria-labelledby="error-modal-label"
aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="error-modal-label">Form Validation Errors</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<!-- Error messages will be displayed here -->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('js')
<script>
$(document).ready(function() {
$('#enquiry-form').submit(function(e) {
e.preventDefault();
$("#submitButton").prop("disabled",true);
var formData = $(this).serialize();
var response = "";
$.ajax({
type: 'POST',
url: '<?php echo route('registration.submit'); ?>',
data: formData,
success: function(response) {
if (response.status) {
$('#registration-id').text(response.registration_id);
$('#success-modal-label').text("Registration is successful");
$('#success-modal-qr').html("<img src='" + response.qr_code +
"' class='img-fluid' />");
var downloadLink = document.createElement('a');
downloadLink.href = response.qr_code;
downloadLink.download =
'nepcoms_eduexpo_qrcode.png';
$('#success-modal').modal('show');
$form[0].reset();
$("#submitButton").prop("disabled",false);
} else if (response.message ==
'Mobile number already exists. Returning existing data.') {
var existingRegistrationData = response.registration;
var downloadLink = document.createElement('a');
downloadLink.href = response.qr_code;
downloadLink.download =
'nepcoms_eduexpo_qrcode.png';
$('#success-modal-label').text(response.message);
$('#success-modal-qr').html("<img src='" + response.qr_code +
"' class='img-fluid' />");
$('#success-modal').modal('show');
$("#submitButton").prop("disabled",false);
} else {
var errorMessages = '';
$.each(response.errors, function(field, errors) {
errorMessages += errors.join('<br>');
});
$('#error-modal .modal-body').html(errorMessages);
$('#error-modal').modal('show');
$("#submitButton").prop("disabled",false);
}
}
});
});
$('#success-modal').on('hidden.bs.modal', function() {
$('#enquiry-form')[0].reset(); // Reset the form
fbq('track', 'CompleteRegistration', {
currency: "USD",
value: 1.00
});
});
$('#downloadButton').on('click', function() {
var downloadLink = document.createElement('a');
downloadLink.href = $('#success-modal-qr img').attr('src');
downloadLink.download = 'nepcoms_eduexpo_qrcode.png';
downloadLink.click();
$("#submitButton").prop("disabled",false);
});
});
</script>
@endpush
@push('css')
<style>
* {
box-sizing: border-box;
}
body {
background: #9c1e5b;
}
.form-box {
display: block;
margin: 0 auto;
margin-top: 5%;
margin-bottom: 5%;
background-color: white;
width: 98%;
border-radius: 5px;
box-shadow: 10px 10px 0 0 #3e2c75;
}
.boximage {
width: 100%;
height: auto;
background-size: cover;
border-radius: 5px 5px 0 0;
}
.infotext {
width: 100%;
padding: 3%;
text-align: center;
color: #162c38;
font-family: sans-serif;
}
h1 {
font-family: 'Roboto Slab', serif;
font-size: 1.1em;
color: #162c38;
text-transform: uppercase;
}
.infotext p {
line-height: 1.5em;
letter-spacing: 0.05em;
}
form {
width: 100%;
padding: 5%;
}
.required-input {
color: #f00;
}
input {
display: block;
width: 100%;
border: solid 1px #bbb7b7;
border-radius: 5px;
margin-bottom: 15px;
padding: 2%;
font-size: 0.8em;
font-family: sans-serif;
letter-spacing: 0.1em;
color: #888;
text-align: left;
}
input[type=submit] {
border: none;
border-radius: 5px;
background-color: #a82d2d;
color: #fff;
text-align: center;
}
input[type=submit]:hover {
background-color: #711616;
cursor: pointer;
}
.form-control {
height: 50px;
background: #ecf0f4;
border-color: transparent;
padding: 0 15px;
font-size: 16px;
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
.form-control:focus {
border-color: #00bcd9;
-webkit-box-shadow: 0px 0px 20px rgba(0, 0, 0, .1);
-moz-box-shadow: 0px 0px 20px rgba(0, 0, 0, .1);
box-shadow: 0px 0px 20px rgba(0, 0, 0, .1);
}
textarea.form-control {
height: 160px;
padding-top: 15px;
resize: none;
}
.content-column ul li {
list-style-type: disc;
margin-left: 20px;
}
</style>
@endpush