BBnepal-Accounts/application/views/admin/importStudentList.php

372 lines
15 KiB
PHP
Raw Normal View History

2024-07-10 12:43:19 +00:00
<style type="text/css">
.error-style {
color: red;
}
</style>
<style type="text/css">
.error-style {
color: red;
}
.import-filter-sec {
display: flex;
}
.select-box {
padding: 3px 10px !important;
width: 100%;
border-radius: 5px;
border: 1px solid #ccc !important;
font-size: 15px;
color: black;
height: calc(1.85rem + 8px) !important;
}
.filter-head {
display: flex;
align-items: center;
justify-content: space-between;
}
.mt-5 {
margin-top: 2.5rem !important;
}
.btn-info {
color: #fff;
background-color: #2c9f0f;
border: none !important;
}
.delete-modal-btn {
margin-bottom: 15px;
margin-top: 2.6rem !important;
}
li {
list-style-type: none;
}
</style>
<div class="wraper responsive-width">
<main class="long-tbl-main students_list_table" id="main">
<div class="from-group adding-class form-group_lng form_group_twobtn">
</div>
<!-- admin template section -->
<div class="admin_tempblock">
<div class="admin_tempsec">
<div class="admin_sec">
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<h5 class="alert-heading font-weignt-bold " style="color: red;">Note</h5>
<p class="mb-1" style="padding-left: 10px;font-size:14px;"><i class="fa fa-arrow-right mr-5" aria-hidden="true"></i>the csv file, except address2 column, rest all are mandatory fields.</p>
<p class="mb-1" style="padding-left: 10px;font-size:14px;"><i class="fa fa-arrow-right mr-5" aria-hidden="true"></i>Allowed values for gender are : Male, Female, Other . These values are case sensitive.</p>
<p class="mb-1" style="padding-left: 10px;font-size:14px;"><i class="fa fa-arrow-right mr-5" aria-hidden="true"></i>Allowed values for country are : Nepal, India . These values are case sensitive.</p>
<p class="mb-1" style="padding-left: 10px;font-size:14px;"><i class="fa fa-arrow-right mr-5" aria-hidden="true"></i>dob & registered_on should be in dd-mm-yyyy format</p>
<p class="mb-1" style="padding-left: 10px;font-size:14px;"><i class="fa fa-arrow-right mr-5" aria-hidden="true"></i>Allowed values for hostel, payment_status & assign_status are : yes, no. These values are case sensitive.</p>
<p class="mb-1" style="padding-left: 10px;font-size:14px;"><i class="fa fa-arrow-right mr-5" aria-hidden="true"></i>Max allowed entries per csv file is 100 only.</p>
</div>
<?php if ($this->session->flashdata('success')) { ?>
<div class="alert alert-success alert-dismissible fade show" role="alert">
<p><?php echo $this->session->flashdata('success') ?></p>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php } ?>
<?php if ($this->session->flashdata('failed')) { ?>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<p><?php echo $this->session->flashdata('failed') ?></p>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php } ?>
<div class="subsec_sec">
<div class="subject_r">
<div class="subject_lsec">
<div class="filter-head">
<div class="subject_lhead text-center mt-3 mb-4">Add Existing Students</div>
<div class="">
<a href="<?php echo base_url() . 'admin/downloadCsvFile' ?>" class="btn btn-success btn-sm float-left"><i class="fa fa-download" aria-hidden="true"></i> &nbsp;Sample Download</a>
</div>
</div>
<?php
// var_dump($batch);
?>
<form enctype="multipart/form-data" method="post" action="<?php echo base_url() . 'admin/importStudents' ?>" id="ImportStudent">
<div class="import-filter-sec">
<div class="form-group mx-2">
<label class=" col-form-label">Select Batch</label>
<div class="">
<select id="" name="batch" class="select-box ">
<option value="">--- Select Batch ---</option>
<?php foreach ($batch as $key => $value) { ?>
<option value="<?php echo $value['id'] ?>">
<?php //echo batchdateFormatTo($value['b_from'], $value['b_end']);
?>
<?= $value['b_name']; ?>
</option>
<?php } ?>
</select>
</div>
<div class="text-center">
<label id="batch-error" class="error error-style" for="batch"></label>
</div>
</div>
<div class="form-group mx-2">
<label class="col-form-label">Select Course</label>
<div class="">
<select id="course_select" name="course" class="select-box ">
<option value="">--- Select Course ---</option>
<?php foreach ($course as $key => $value) { ?>
<option value="<?php echo $value['id'] ?>">
<?php echo $value['course_name']; ?>
</option>
<?php } ?>
</select>
</div>
<div class=" text-center">
<label id="course_select-error" class="error error-style" for="course_select"></label>
</div>
</div>
<div class="form-group mx-2">
<label class=" col-form-label">Select Section</label>
<div class="">
<select id="section_select" name="section" class="select-box ">
<option value="">--- Select Section ---</option>
</select>
</div>
<div class=" text-center">
<label id="section_select-error" class="error error-style" for="section_select"></label>
</div>
</div>
<div class="form-group mx-2">
<label class=" col-form-label">Excel File</label>
<div class="mt-1">
<input id="upload" name="file" type="file" accept=".csv, .xlsx" />
<buttom class="btn btn-info btn-sm float-left" id="upload_link">Upload File</button>
</div>
</div>
<div class="delete-modal-btn mt-4 btn-md text-center">
<button type="submit" class="subject_addbtn ">Submit</button>
</div>
</div>
</form>
<form method="post" id="downloadAll" action="<?php echo base_url(); ?>Admin/downloadAll">
<div class="applicnts-list-wrap ">
<div class="">
<table id="tbl1" class="display table-responsive">
<thead>
<tr>
<th>SI No</th>
<th>Student Id</th>
<th>Name of Student</th>
<th>Email</th>
<th>Contact No.</th>
<th>Application Date</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php if ($view_data) {
$i = 1;
foreach ($view_data as $key => $value) {
?>
<tr>
<td><?php echo $i; ?></td>
<td><?php echo ($value['status'] == 'duplicate') ? '-------' : $value['studentId'] ?></td>
<td><?php echo $value['name']; ?></td>
<td><?php echo $value['email']; ?></td>
<td><?php echo $value['mobile']; ?></td>
<td><?php echo $value['registered_on']; ?></td>
<td style="color:<?php echo ($value['status'] == 'success') ? 'green' : 'red'; ?>;"><?php echo $value['status']; ?></td>
</tr>
<?php $i++;
}
}
unset($_SESSION['promote_table']); ?>
</tbody>
</table>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- admin template section end -->
</main>
<!--End right-top side-->
</div>
<style type="text/css">
#upload_link {
text-decoration: none;
}
#upload {
display: none
}
</style>
<script>
//file uplaod link trigger
$(function() {
$("#upload_link").on('click', function(e) {
e.preventDefault();
$("#upload:hidden").trigger('click');
});
});
$(document).ready(function() {
$('.user-drpdown').click(function() {
$('.drpdown-items').toggle();
});
//table js
$('#tbl1').DataTable({
"lengthMenu": [
[5, 10, 25, 50, -1],
[5, 10, 25, 50, "All"]
],
dom: 'lBfrtip',
buttons: [{
extend: 'pdfHtml5',
title: 'Student List',
exportOptions: {
columns: [1, 3, 4, 5, 6, 7]
}
},
{
extend: 'csvHtml5',
exportOptions: {
columns: [1, 3, 4, 5, 6, 7]
}
}
]
});
//table js end
//multiple select js start
$('select').selectpicker();
//multiple select js end
});
$(document).ready(function() {
$("#ImportStudent").validate({
rules: {
batch: {
required: true
},
course: {
required: true
},
section: {
required: true
},
file: {
required: true
}
},
messages: {
batch: {
required: "Please Select Batch "
},
file: {
required: "Please add Excel file"
},
course: {
required: "Please Select Course"
},
section: {
required: "Please Select Section"
},
},
submitHandler: function(form) {
form.submit();
}
});
});
$('#course_select').change(function() {
var id = $('#course_select').find(":selected").val();
$.ajax({
url: '<?php echo base_url() . 'admin/get_sections_from_classroom/' ?>' + id,
type: 'GET',
dataType: 'json',
success: function(result) {
let section = '';
section += '<option value=""> - Select Section - </option>';
$.each(result, function(key, value) {
section += '<option value="' + value['id'] + '">' + value['section_name'] + '</option>';
});
$("#section_select").empty().append(section);
}
});
});
</script>
</body>
</html>