McGansWebsite/admin/application/views/semester/add_semester.php

203 lines
7.2 KiB
PHP
Raw Normal View History

<?php $this->load->view('includes/header');?>
<link href="<?=base_url();?>/assets/datatables/plugins/bootstrap/dataTables.bootstrap4.min.css" rel="stylesheet" type="text/css" />
<!--select2-->
<link href="<?=base_url();?>assets/select2/css/select2.css" rel="stylesheet" type="text/css" />
<link href="<?=base_url();?>assets/select2/css/select2-bootstrap.min.css" rel="stylesheet" type="text/css" />
<div class="page-container">
<!-- start sidebar menu -->
<?php $this->load->view('includes/sidebar');?>
<!-- start page content -->
<div class="page-content-wrapper">
<div class="page-content">
<div class="page-bar">
<div class="page-title-breadcrumb">
<div class=" pull-left">
<div class="page-title">Add Semester</div>
</div>
<ol class="breadcrumb page-breadcrumb pull-right">
<li><i class="fa fa-home"></i>&nbsp;<a class="parent-item" href="<?=base_url();?>/dashboard">Home</a>&nbsp;<i class="fa fa-angle-right"></i>
</li>
<li>&nbsp;<a class="parent-item" href="<?=base_url();?>/semester">Semester</a>&nbsp;<i class="fa fa-angle-right"></i>
</li>
<li class="active">Add Semester</li>
</ol>
</div>
</div>
<!-- Midium Model -->
<div class="row">
<div class="col-md-12 col-sm-12">
<div class="card card-box">
<div class="card-head">
<header>Semester</header>
</div>
<div class="card-body" id="bar-parent">
<form class="form-horizontal" action="<?=base_url();?>add-semester" method="post">
<div class="form-body">
<div class="form-group row">
<div class="col-md-5">
2023-01-25 12:47:55 +00:00
<label class="control-label">Name
<span class="required"> * </span>
</label>
2023-01-25 12:47:55 +00:00
<input name="name" type="text" data-validation="required" placeholder="Enter Degree Name" class="form-control input-height" />
</div>
<div class="col-md-5">
2023-01-25 12:47:55 +00:00
<label class="control-label">Year
<span class="required"> * </span>
</label>
<input name="year" type="number" data-validation="required" placeholder="Enter Semester Year" class="form-control input-height" />
</div>
</div>
2023-01-25 12:47:55 +00:00
<!--Multiple Row-->
<div class="form-group row">
2023-01-25 12:47:55 +00:00
<div class="col-md-5">
<label class="control-label">Degree<span class="required"> * </span></label>
<select class="form-control select2" name="degreeId[0]" id="degreeId_0" data-validation="required">
<option value="" selected="selected" id="degreeId" >Select</option>
<?php
if(isset($degree) && $degree->num_rows()>0)
{
foreach($degree->result() as $list)
{
?> <option value="<?=$list->id;?>"><?=$list->name;?></option><?php
}
}
?>
</select>
</div>
<div class="col-md-5">
<label class="control-label">Subject<span class="required"> * </span></label>
<select multiple class="form-control select2" id="subjectId_0" name="subjectId[0][]" data-validation="required">
<option value="">Select..</option>
<?php
if(isset($subject) && $subject->num_rows()>0)
{
foreach($subject->result() as $list)
{
?> <option value="<?=$list->id;?>"><?=$list->name;?></option><?php
}
}
?>
</select>
</div>
2023-01-25 12:47:55 +00:00
<div class="col-md-1">
<label class="control-label"></label>
<div class="add-new-button-blue addMore"><span class="btn btn-primary">Add <i class="fa fa-plus"></i></span></div>
</div>
</div>
2023-01-25 12:47:55 +00:00
<!--Duplicate-->
<div class="form-group row duplicate1 hide" id="addMoreTemplate">
<div class="col-md-5">
<label class="control-label">Degree<span class="required"> * </span></label>
<select class="form-control" id="degreeId" name="degreeIds[]" data-validation="required">
<option value="" selected="selected">Select</option>
<?php
2023-01-25 12:47:55 +00:00
if(isset($degree) && $degree->num_rows()>0)
{
2023-01-25 12:47:55 +00:00
foreach($degree->result() as $list)
{
2023-01-25 12:47:55 +00:00
?> <option value="<?=$list->id;?>"><?=$list->name;?></option><?php
}
}
?>
</select>
</div>
2023-01-25 12:47:55 +00:00
<div class="col-md-5">
<label class="control-label">Subject<span class="required"> * </span></label>
<select multiple class="form-control" id="subjectId" name="subjectIds[][]" data-validation="required">
<option value="">Select..</option>
<?php
2023-01-25 12:47:55 +00:00
if(isset($subject) && $subject->num_rows()>0)
{
2023-01-25 12:47:55 +00:00
foreach($subject->result() as $list)
{
?> <option value="<?=$list->id;?>"><?=$list->name;?></option><?php
}
}
?>
</select>
</div>
2023-01-25 12:47:55 +00:00
<div class="col-md-1">
<label class="control-label"></label>
<div class="add-new-button-blue removeButton" id="cat_add_id"><span class="btn btn-danger">Remove <i class="fa fa-minus"></i></span></div>
</div>
</div>
2023-01-25 12:47:55 +00:00
<!--Duplicate-->
<!--Multiple Row-->
</div>
</div>
<div class="form-actions">
<div class="row">
<div class="offset-md-3 col-md-9">
<input type="submit" name="submit" class="btn btn-info m-r-20" value="Submit">
<button type="button" class="btn btn-default">Cancel</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
</div>
</div>
</div>
<?php $this->load->view('includes/footer');?>
<script src="<?=base_url();?>assets/select2/js/select2.js"></script>
<script src="<?=base_url();?>assets/select2/js/select2-init.js"></script>
<script src="<?=base_url();?>assets/jquery.form-validator.min.js"></script>
2023-01-25 12:47:55 +00:00
<script>
//multiple add more
invIndex = 0;
$('body').on('click','.addMore', function() {
invIndex++;
var $template = $('#addMoreTemplate'),
$clone = $template
.clone(true)
.removeClass('hide')
.removeAttr('id')
.attr('data-book-index', invIndex)
.insertBefore($template);
// Update the name attributes
$clone
.find('[id="degreeId"]').attr('id', 'degreeId_'+invIndex).end()
.find('[id="subjectId"]').attr('id', 'subjectId_'+invIndex).end()
.find('[name="degreeIds[]"]').attr('name', 'degreeId['+invIndex+']').end()
.find('[name="subjectIds[][]"]').attr('name', 'subjectId['+invIndex+'][]').end()
function initializeSelect2(selectElementObj)
{
selectElementObj.select2({
width: "100%",
tags: true
});
}
$("#degreeId_"+invIndex).each(function() {
initializeSelect2($(this));
});
//product
$("#subjectId_"+invIndex).each(function() {
initializeSelect2($(this));
});
})
.on('click', '.removeButton', function(){
var $row = $(this).parents('.duplicate1'),
index = $row.attr('data-book-index');
$row.remove();
});
</script>