McGansWebsite/admin/application/views/subject/edit_subject.php
2023-01-24 15:35:16 +05:30

281 lines
11 KiB
PHP

<link href="<?=base_url();?>/assets/datatables/plugins/bootstrap/dataTables.bootstrap4.min.css" rel="stylesheet" type="text/css" />
<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" />
<?php $this->load->view('includes/header');?>
<style>
.input-group .input-group-addon {
border-radius: 0;
border-color: #d2d6de;
background-color: #fff;
border: 1px solid #d2d6de;
padding: 6px 12px;
}
.form-control{
width: 100%;
height: 34px;
padding: 6px 12px;
background-color: #fff;
border: 1px solid #c2cad8;
box-shadow: none!important;
outline: 0!important;
transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
font-size: 14px;
line-height: 1.42857;
color: #555;
}
.fa{
padding-top:8px;
}
</style>
<div class="page-container">
<?php $this->load->view('includes/sidebar');?>
<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">Edit Subject</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();?>/subject">Subject</a>&nbsp;<i class="fa fa-angle-right"></i>
</li>
<li class="active">Edit Subject</li>
</ol>
</div>
</div>
<!-- Midium Model -->
<?php
if(isset($sub) && $sub->num_rows()>0)
{
$s=$sub->row();
$id=$s->id;
$degreeId=$s->degreeId;
$name=$s->name;
$code=$s->code;
$facultyId=$s->facultyId;
$image=$s->image;
$description=$s->description;
$facIdd = explode(",", $facultyId);
//print_r ($facIdd);
} ?>
<div class="row">
<div class="col-md-12 col-sm-12">
<div class="card card-box">
<div class="card-head">
<header>Edit Subject</header>
</div>
<div class="card-body" id="bar-parent">
<form action="<?=base_url();?>edit-subject/<?=$id;?>" method="post" enctype="multipart/form-data">
<div class="form-body">
<div class="form-group row">
<label class="control-label col-md-3">Code
<span class="required"> * </span>
</label>
<div class="col-md-5">
<input type="text" value="<?=$code;?>" name="code" data-validation="required" placeholder="Enter name" class="form-control input-height">
</div>
</div>
<div class="form-group row">
<label class="control-label col-md-3">Name of the Subject.
<span class="required"> * </span>
</label>
<div class="col-md-5">
<input name="subject" value="<?=$name;?>" type="text"data-validation="required" placeholder="Enter subject" class="form-control input-height" /> </div>
</div>
<div class="form-group row">
<label class="control-label col-md-3">Degree
<span class="required"> * </span>
</label>
<div class="col-md-5">
<select class="form-control select2" name="degree" data-validation="required">
<option value=""></option>
<?php
if(isset($degree) && $degree->num_rows()>0)
{
foreach($degree->result() as $list)
{
?> <option value="<?=$list->id;?>" <?php if($list->id==$degreeId){echo "selected";}?>><?=$list->name;?></option><?php
}
}
?>
</select>
</div>
</div>
<div class="form-group row">
<label class="control-label col-md-3">Faculty
<span class="required"> * </span>
</label>
<div class="col-md-5">
<select id="multiple" name="faculty[]" class="form-control default select2-multiple" multiple data-validation="required">
<option value="">Select..</option>
<?php
if(isset($faculty) && $faculty->num_rows()>0)
{
foreach($faculty->result() as $list1)
{
?> <option value="<?=$list1->id;?>" <?php if (in_array($list1->id, $facIdd)){ echo "selected";}?>><?=$list1->name;?></option><?php
}
}
?>
</select>
</div>
</div>
<div class="form-group row">
<label class="control-label col-md-3">Upload Picture
</label>
<div class="compose-editor">
<input type="file" name="image" placeholder="Enter img" class="default">
<input type="hidden" value="<?=$image;?>" name="hiddenImage">
</div>
</div>
<div class="form-group row">
<label class="control-label col-md-3">
</label>
<div class="col-md-5">
<img src="<?=base_url();?>uploads/subject/<?=$image;?>" style="width:75px;height:75px;"/>
</div>
</div>
<div class="form-group row">
<label class="control-label col-md-3">Description
<span class="required"> * </span>
</label>
<div class="col-md-5">
<textarea type="text" name="description" data-validation="required" placeholder="Enter Description" class="form-control input-height"><?=$description;?></textarea>
</div>
</div>
<!--Multiple Add ---->
<?php
if(isset($getMultipleImage) && $getMultipleImage->num_rows()>0)
{
$totalCount=$getMultipleImage->num_rows();
}
?>
<input type="hidden" value="<?=$totalCount;?>" id="hiddenCount"/>
<hr>
<div class="form-group row">
<div class="col-md-3"></div>
<div class="col-md-4"></div>
<div class="col-md-1">
<div class="add-new-button-blue addMore"><span style="padding-top:3px;" class="btn btn-primary">Add More<i class="fa fa-plus"></i></span></div>
</div>
</div>
<?php
if(isset($getMultipleImage) && $getMultipleImage->num_rows()>0)
{
$i=0;
foreach($getMultipleImage->result() as $list)
{
$id =$list->id ;
$title=$list->title;
$image=$list->image;
$subjectId=$list->subjectId;
?>
<div class="form-group row duplicate1">
<input type="hidden" value="<?=$id;?>" id="subjectDetailId_<?=$i;?>" name="subjectDetailName[<?=$i;?>]"/>
<label class="control-label col-md-3">Title & Image
</label>
<div class="col-md-2 compose-editor">
<input value="<?=$title;?>" name="title[<?=$i;?>]" id="subjectTitle_<?=$i;?>" type="text" class="form-control default">
</div>
<div class="col-md-2 compose-editor">
<input name="profileimage[]" id="subjectImage_<?=$i;?>" type="file" class="form-control default">
<img src="<?=base_url();?>uploads/subject/<?=$image;?>" style="width:75px;height:75px;"/>
<input value="<?=$image;?>" name="profileimageOld[<?=$i;?>]" id="subjectImageOld_<?=$i;?>" type="hidden" class="form-control default">
</div>
<div class="col-md-1">
<div class="add-new-button-blue removeButton"><span style="padding-top:3px;" class="btn btn-danger">Remove <i class="fa fa-minus"></i></span></div>
</div>
</div>
<?php
$i++;
}
}
?>
<!---Duplicate ---->
<div class="form-group duplicate1 row hide" id="imageTemplate" >
<input type="hidden" value="" id="subjectDetailId" name="subjectDetailNames[]"/>
<label class="control-label col-md-3">
</label>
<div class="col-md-2 compose-editor">
<input name="titles[]" id="subjectTitle" type="text" class="form-control default">
</div>
<div class="col-md-2 compose-editor">
<input name="profileimages[]" id="subjectImage" type="file" class="form-control default">
</div>
<div class="col-md-1">
<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>
<!---Duplicate ---->
<!--End Multiple Add ---->
</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>
<script>
//multiple add more
invIndex = $('#hiddenCount').val();
$('body').on('click','.addMore', function() {
invIndex++;
var $template = $('#imageTemplate'),
$clone = $template
.clone(true)
.removeClass('hide')
.removeAttr('id')
.attr('data-book-index', invIndex)
.insertBefore($template);
// Update the name attributes
$clone
.find('[id="subjectTitle"]').attr('id', 'subjectTitle_'+invIndex).end()
.find('[id="subjectImage"]').attr('id', 'subjectImage_'+invIndex).end()
.find('[id="subjectDetailId"]').attr('id', 'subjectDetailId_'+invIndex).end()
.find('[name="titles[]"]').attr('name', 'title['+invIndex+']').end()
.find('[name="profileimages[]"]').attr('name', 'profileimage['+invIndex+']').end()
.find('[name="subjectDetailNames[]"]').attr('name', 'subjectDetailName['+invIndex+']').end()
})
.on('click', '.removeButton', function(){
var $row = $(this).parents('.duplicate1'),
index = $row.attr('data-book-index');
$row.remove();
});
</script>