486 lines
22 KiB
PHP
486 lines
22 KiB
PHP
|
<link href="<?=base_url();?>bassets/select2/css/select2.css" rel="stylesheet" type="text/css" />
|
||
|
<link href="<?=base_url();?>bassets/select2/css/select2-bootstrap.min.css" rel="stylesheet" type="text/css" />
|
||
|
<?php $CI=&get_instance();
|
||
|
$CI->load->model('Policy_model'); ?>
|
||
|
<?php $this->load->view('admin/includes/header');?>
|
||
|
<div class="page-container">
|
||
|
<?php $this->load->view('admin/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">Policy Edit</div>
|
||
|
</div>
|
||
|
<ol class="breadcrumb page-breadcrumb pull-right">
|
||
|
<li><i class="fa fa-home"></i> <a class="parent-item" href="index.html">Home</a> <i class="fa fa-angle-right"></i>
|
||
|
</li>
|
||
|
<li><a class="parent-item" href="<?=base_url();?>admin/policies">Policy</a> <i class="fa fa-angle-right"></i>
|
||
|
</li>
|
||
|
<li class="active">Policy Edit</li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?php $this->load->view('admin/includes/msg');?>
|
||
|
<div class="row">
|
||
|
<div class="col-md-12">
|
||
|
<div class="card card-topline-orange">
|
||
|
<div class="white-box">
|
||
|
<div class="card card-box">
|
||
|
<div class="card-head">
|
||
|
<header>Edit Policy</header>
|
||
|
|
||
|
</div>
|
||
|
<?php
|
||
|
if(isset($pol)&& $pol->num_rows()>0)
|
||
|
{
|
||
|
$s=$pol->row();
|
||
|
$id=$s->id;
|
||
|
$name=$s->name;
|
||
|
$image=$s->image;
|
||
|
$company=$s->company;
|
||
|
$category=$s->category;
|
||
|
$catname=$s->catname;
|
||
|
$cmpname=$s->cmpname;
|
||
|
$intro=$s->intro;
|
||
|
$amount=$s->amount;
|
||
|
$amount_period=$s->amount_period;
|
||
|
$guarantee=$s->guarantee;
|
||
|
$policy_period=$s->policy_period;
|
||
|
$benefits=$s->benefits;
|
||
|
$specializations=$s->specializations;
|
||
|
$max_cover_age=$s->max_cover_age;
|
||
|
$is_this_top_plan=$s->is_this_top_plan;
|
||
|
$life_cover=$s->life_cover;
|
||
|
$claimed_settlement=$s->claimed_settlement;
|
||
|
|
||
|
$pp=explode(" ", $policy_period);
|
||
|
$ppnumber=$pp[0];
|
||
|
$ppperiod=$pp[1];
|
||
|
$g=explode(" ", $guarantee);
|
||
|
$gnumber=$g[0];
|
||
|
$gperiod=$g[1];
|
||
|
if($life_cover!=""){
|
||
|
$lc=explode(" ", $life_cover);
|
||
|
$lcnumber=$lc[0];
|
||
|
$lcperiod=$lc[1];
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
$lcnumber="";
|
||
|
$lcperiod="";
|
||
|
}
|
||
|
$com=$CI->Policy_model->get_compare_master($category);
|
||
|
|
||
|
}
|
||
|
?>
|
||
|
<div class="card-body ">
|
||
|
<?=form_open_multipart(base_url().'admin/edit-policy/'.$id);?>
|
||
|
<div class="row">
|
||
|
<div class="form-group col-md-6">
|
||
|
<label for="simpleFormEmail"> Policy Name <span class="required">*</span></label>
|
||
|
<input type="text" name="policyname" value="<?=$name;?>" autocomplete="off" class="form-control" data-validation="required" placeholder="Policy Name">
|
||
|
</div>
|
||
|
<div class="form-group col-md-6">
|
||
|
<label for="simpleFormEmail"> Company <span class="required">*</span></label>
|
||
|
<select type="text" name="Company" autocomplete="off" class="select2 form-control" data-validation="required" placeholder="Subtitle">
|
||
|
|
||
|
<?php if(isset($cmp)&& $cmp->num_rows()>0)
|
||
|
{ foreach($cmp->result() as $c)
|
||
|
{ $cmid=$c->id;
|
||
|
$cmname=$c->name;?>
|
||
|
<option value="<?=$cmid;?>" <?php if($cmid==$company){echo "selected";}?>><?=$cmname;?></option>
|
||
|
<?php } }?>
|
||
|
</select>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="row">
|
||
|
<div class="form-group col-md-6">
|
||
|
<label for="simpleFormEmail"> Category <span class="required">*</span></label>
|
||
|
<select type="text" name="Category" autocomplete="off" class="select2 form-control" data-validation="required" placeholder="Subtitle">
|
||
|
<?php if(isset($cat)&& $cat->num_rows()>0)
|
||
|
{ foreach($cat->result() as $ca)
|
||
|
{ $cid=$ca->id;
|
||
|
$cname=$ca->name;?>
|
||
|
<option value="<?=$cid;?>" <?php if($cid==$category){echo "selected";}?> ><?=$cname;?></option>
|
||
|
<?php } }?>
|
||
|
</select>
|
||
|
</div>
|
||
|
<div class="form-group col-md-6">
|
||
|
<label for="simpleFormEmail"> Policy Amount <span class="required">*</span></label>
|
||
|
<div class="row">
|
||
|
<div class="col-md-7">
|
||
|
<input type="text" name="p_amount" value="<?=$amount;?>" id="PolicyAmount" placeholder="Policy Amount" autocomplete="off" class="form-control" data-validation="required" >
|
||
|
</div>
|
||
|
<div class="col-md-5">
|
||
|
<select type="text" name="pa_period" autocomplete="off" class="select2 form-control" data-validation="required" placeholder="Subtitle">
|
||
|
|
||
|
<option value="Years" <?php if($ppperiod=="Years"){echo "selected";}?> >Year</option>
|
||
|
<option value="Months" <?php if($ppperiod=="Months"){echo "selected";}?>>Months</option>
|
||
|
<option value="Days" <?php if($ppperiod=="Days"){echo "selected";}?>>Days</option>
|
||
|
|
||
|
</select>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
<div class="row">
|
||
|
<div class="form-group col-md-6">
|
||
|
<label for="simpleFormEmail"> Policy Period <span class="required">*</span></label>
|
||
|
<div class="row">
|
||
|
<div class="col-md-7">
|
||
|
<input type="text" name="p_period" value="<?=$ppnumber;?>" id="PolicyPeriod" placeholder="Policy Period" autocomplete="off" class="form-control" data-validation="required" >
|
||
|
</div>
|
||
|
<div class="col-md-5">
|
||
|
<select type="text" name="pp_period" autocomplete="off" class="select2 form-control" data-validation="required" placeholder="Subtitle">
|
||
|
|
||
|
<option value="Years" <?php if($ppperiod=="Years"){echo "selected";}?> >Year</option>
|
||
|
<option value="Months" <?php if($ppperiod=="Months"){echo "selected";}?>>Months</option>
|
||
|
<option value="Days" <?php if($ppperiod=="Days"){echo "selected";}?>>Days</option>
|
||
|
|
||
|
|
||
|
</select>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="form-group col-md-6">
|
||
|
<label for="simpleFormEmail"> Guarantee <span class="required">*</span></label>
|
||
|
<div class="row">
|
||
|
<div class="col-md-7">
|
||
|
<input type="text" value="<?=$gnumber;?>" name="guarantee" id="guarantee" placeholder="Guarantee" autocomplete="off" class="form-control" data-validation="required" >
|
||
|
</div>
|
||
|
<div class="col-md-5">
|
||
|
<select type="text" name="g_period" autocomplete="off" class="select2 form-control" data-validation="required" placeholder="Subtitle">
|
||
|
|
||
|
<option value="Years" <?php if($gperiod=="Years"){echo "selected";}?> >Year</option>
|
||
|
<option value="Months" <?php if($gperiod=="Months"){echo "selected";}?>>Months</option>
|
||
|
<option value="Days" <?php if($gperiod=="Days"){echo "selected";}?>>Days</option>
|
||
|
|
||
|
|
||
|
</select>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
<div class="row">
|
||
|
<div class="form-group col-md-6">
|
||
|
<label for="simpleFormEmail"> Image </label>
|
||
|
<input type="file" name="Image" autocomplete="off" class="form-control" >
|
||
|
<input type="hidden" name="oldimage" value="<?=$image;?>" autocomplete="off" class="form-control" >
|
||
|
</div>
|
||
|
<div class="form-group col-md-6">
|
||
|
<label for="simpleFormEmail"> Intro <span class="required">*</span></label>
|
||
|
<textarea name="Intro" autocomplete="off" class="form-control" data-validation="required" placeholder="Introduction"><?=$intro;?></textarea>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="row">
|
||
|
<div class="form-group col-md-4">
|
||
|
<div class="row">
|
||
|
<div class="col-md-7">
|
||
|
<label for="simpleFormEmail"> Life Cover Amount <span class="required">*</span></label>
|
||
|
|
||
|
<input type="text" name="lifecover" value="<?=$lcnumber;?>" autocomplete="off" class="form-control" data-validation="number" data-validation-allowing="float" placeholder="EX : 1 ">
|
||
|
</div>
|
||
|
<div class="col-md-5">
|
||
|
<label for="simpleFormEmail"> Amount type <span class="required">*</span></label>
|
||
|
|
||
|
<select type="text" name="am_type" autocomplete="off" class="select2 form-control" data-validation="required" placeholder="Subtitle">
|
||
|
|
||
|
<option value="LAC" <?php if($lcperiod=="LAC"){echo "selected";}?>>LAC</option>
|
||
|
<option value="CR" <?php if($lcperiod=="CR"){echo "selected";}?>>CR</option>
|
||
|
|
||
|
|
||
|
</select>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="form-group col-md-2">
|
||
|
<label for="simpleFormEmail">Is Top Plan <span class="required">*</span></label>
|
||
|
<input type="checkbox" id="topplan" name="topplan" <?php if($is_this_top_plan==1){?> checked <?php }?> value="<?=$is_this_top_plan;?>" autocomplete="off" class="form-control" >
|
||
|
</div>
|
||
|
|
||
|
<div class="form-group col-md-3">
|
||
|
<label for="simpleFormEmail"> Claim Settlement ( % ) <span class="required">*</span></label>
|
||
|
<input type="text" name="claimsettleper" value="<?=$claimed_settlement;?>" autocomplete="off" class="form-control" data-validation="number" data-validation-allowing="float" placeholder="EX : 98">
|
||
|
</div>
|
||
|
<div class="form-group col-md-3">
|
||
|
<label for="simpleFormEmail"> Max Age Limit (Years)<span class="required">*</span></label>
|
||
|
<input type="text" name="maxager" value="<?=$max_cover_age;?>" autocomplete="off" class="form-control" data-validation="number length" data-validation-length="2" placeholder="EX : 75">
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
<div class="row">
|
||
|
<div class="form-group col-md-6">
|
||
|
<div class="">
|
||
|
<label for="simpleFormEmail"> Benefits <span class="required">*</span> </label>
|
||
|
<button type="button" style="margin-top:0px" class="btn btn-primary addButton" ><i class="fa fa-plus"></i></button>
|
||
|
</div>
|
||
|
<?php
|
||
|
$i=1;
|
||
|
$benef=explode(",", $benefits);
|
||
|
foreach($benef as $ben)
|
||
|
{ if($ben!=" "){ ?>
|
||
|
<div class="form-group form-group1" >
|
||
|
<div class="row" >
|
||
|
<div class="col-md-10">
|
||
|
<input type="text" name="benefits[]" value="<?=$ben;?>" id="benefits_0" placeholder="Benefits" autocomplete="off" class="form-control" data-validation="required" >
|
||
|
</div>
|
||
|
<div class="col-md-2">
|
||
|
<button type="button" style="margin-top:0px" class="btn btn-danger removeButton" ><i class="fa fa-minus"></i></button>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?php } $i++; } ?>
|
||
|
<!--new row-->
|
||
|
<div class="form-group form-group1 hide" id="bookTemplate">
|
||
|
<div class="row">
|
||
|
<div class="col-md-10">
|
||
|
<input type="text" name="benefits[]" id="benefits" placeholder="Benefits" autocomplete="off" class="form-control" data-validation="required" >
|
||
|
</div>
|
||
|
<div class="col-md-2">
|
||
|
<button type="button" style="margin-top:0px" class="btn btn-danger removeButton" ><i class="fa fa-minus"></i></button>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="form-group col-md-6">
|
||
|
<div class=" ">
|
||
|
<label for="simpleFormEmail"> Specialization <span class="required">*</span></label>
|
||
|
<button type="button" style="margin-top:0px" class="btn btn-primary addButton1" ><i class="fa fa-plus"></i></button>
|
||
|
|
||
|
</div>
|
||
|
<?php
|
||
|
$j=0;
|
||
|
$spec=explode(",", $specializations);
|
||
|
foreach($spec as $sp)
|
||
|
{ if($sp!=" "){ ?>
|
||
|
<div class="form-group form-group1">
|
||
|
<div class="row">
|
||
|
<div class="col-md-10">
|
||
|
<input type="text" name="Specialization[]" value="<?=$sp;?>" id="Specialization_<?=$j;?>" placeholder="Specialization" autocomplete="off" class="form-control" data-validation="required" >
|
||
|
</div>
|
||
|
<div class="col-md-2">
|
||
|
<button type="button" style="margin-top:0px" class="btn btn-danger removeButton1" ><i class="fa fa-minus"></i></button>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?php } $j++; } ?>
|
||
|
<!--new row-->
|
||
|
<div class="form-group form-group1 hide" id="bookTemplate1">
|
||
|
<div class="row">
|
||
|
<div class="col-md-10">
|
||
|
<input type="text" name="Specialization[]" id="Specialization" placeholder="Specialization" autocomplete="off" class="form-control" data-validation="required" >
|
||
|
</div>
|
||
|
<div class="col-md-2">
|
||
|
<button type="button" style="margin-top:0px" class="btn btn-danger removeButton1" ><i class="fa fa-minus"></i></button>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="row">
|
||
|
<div class="form-group col-md-12">
|
||
|
<div class="">
|
||
|
<label for="simpleFormEmail"> Compare Details <span class="required">*</span> </label>
|
||
|
|
||
|
<button type="button" style="margin-top:0px" class="btn btn-primary addButton2" ><i class="fa fa-plus"></i></button>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
<?php
|
||
|
if(isset($cmp_det)&& $cmp_det->num_rows()>0)
|
||
|
{
|
||
|
$p=1;
|
||
|
foreach($cmp_det->result() as $s)
|
||
|
{
|
||
|
$primary=$s->id;
|
||
|
$pricpid=$s->compare;
|
||
|
$compare_name=$s->compare_name;
|
||
|
$comparedetail=$s->comparedetail;
|
||
|
?>
|
||
|
<div class="form-group form-group1">
|
||
|
<div class="row">
|
||
|
<input type="hidden" name="hiddenprimary[]" id="hiddenprimary_<?=$p;?>" value="<?=$primary;?>">
|
||
|
<div class="col-md-6">
|
||
|
<select type="text" name="Compare[]" value=" " id="Compare_<?=$p;?>" class="form-control Compare " data-validation="required" >
|
||
|
<?php foreach($com->result() as $c){
|
||
|
$comid=$c->id;
|
||
|
$compare_name=$c->compare_name;?>
|
||
|
<option value="<?=$comid;?>" <?php if($comid==$pricpid){echo "selected";}?>><?=$compare_name;?></option>
|
||
|
<?php }?>
|
||
|
</select>
|
||
|
</div>
|
||
|
<div class="col-md-5">
|
||
|
<input type="text" name="cmp_detail[]" value="<?=$comparedetail;?>" id="cmp_detail_<?=$p;?>" placeholder="Compare Details" autocomplete="off" class="form-control" data-validation="required" >
|
||
|
</div>
|
||
|
<div class="col-md-1">
|
||
|
<button type="button" style="margin-top:0px" class="btn btn-danger removeButton2" ><i class="fa fa-minus"></i></button>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?php $p++; } } ?>
|
||
|
<!--new row-->
|
||
|
<div class="form-group form-group1 hide" id="bookTemplate2">
|
||
|
<div class="row">
|
||
|
<input type="hidden" name="hiddenprimary[]" id="hiddenprimary" value="">
|
||
|
<div class="col-md-6">
|
||
|
<select type="text" name="Compare[]" id="Compare" class="form-control Compare " data-validation="required" >
|
||
|
<?php foreach($com->result() as $c){
|
||
|
$comid=$c->id;
|
||
|
$compare_name=$c->compare_name;?>
|
||
|
<option value="<?=$comid;?>"><?=$compare_name;?></option>
|
||
|
<?php }?>
|
||
|
</select>
|
||
|
</div>
|
||
|
<div class="col-md-5">
|
||
|
<input type="text" name="cmp_detail[]" id="cmp_detail" placeholder="Compare Details" autocomplete="off" class="form-control" data-validation="required" >
|
||
|
</div>
|
||
|
<div class="col-md-1">
|
||
|
<button type="button" style="margin-top:0px" class="btn btn-danger removeButton2" ><i class="fa fa-minus"></i></button>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<input type="submit" name="edit" class="btn btn-primary" value="Submit">
|
||
|
<?=form_close();?>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<!--modal -->
|
||
|
<div class="modal fade" id="rolepop" tabindex="-1" role="basic" aria-hidden="true">
|
||
|
<div class="modal-dialog">
|
||
|
<div class="modal-content">
|
||
|
<div class="viewdetails">
|
||
|
<img src="<?=base_url();?>bassets/admin/img/process.gif" class="loader-img">
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?php $this->load->view('admin/includes/footer');?>
|
||
|
<script type="text/javascript" src="<?=base_url();?>bassets/admin/js/jquery.cookie.min.js"></script>
|
||
|
<script src="<?=base_url();?>bassets/select2/js/select2.js"></script>
|
||
|
<script src="<?=base_url();?>bassets/select2/js/select2-init.js"></script>
|
||
|
<script>
|
||
|
sevIndex = 0;
|
||
|
sevIndex++;
|
||
|
$('body').on('click', '.addButton', function() {
|
||
|
|
||
|
var $template = $('#bookTemplate'),
|
||
|
$clone = $template
|
||
|
.clone(true)
|
||
|
.removeClass('hide')
|
||
|
.removeAttr('id')
|
||
|
.attr('data-book-index1', sevIndex)
|
||
|
.insertBefore($template);
|
||
|
|
||
|
// Update the name attributes sev_account
|
||
|
// Update the name attributes sev_account
|
||
|
$clone
|
||
|
.find('[id="benefits"]').attr('id', 'benefits_' + sevIndex ).end()
|
||
|
|
||
|
|
||
|
})
|
||
|
// Remove button click handler
|
||
|
.on('click', '.removeButton', function() {
|
||
|
var $row = $(this).parents('.form-group1'),
|
||
|
index = $row.attr('data-book-index1');
|
||
|
$row.remove();
|
||
|
|
||
|
});
|
||
|
</script>
|
||
|
<script>
|
||
|
sevIndexx = 0;
|
||
|
sevIndexx++;
|
||
|
$('body').on('click', '.addButton1', function() {
|
||
|
|
||
|
var $template = $('#bookTemplate1'),
|
||
|
$clone = $template
|
||
|
.clone(true)
|
||
|
.removeClass('hide')
|
||
|
.removeAttr('id')
|
||
|
.attr('data-book-index1', sevIndexx)
|
||
|
.insertBefore($template);
|
||
|
|
||
|
// Update the name attributes sev_account
|
||
|
// Update the name attributes sev_account
|
||
|
$clone
|
||
|
.find('[id="Specialization"]').attr('id', 'Specialization_' + sevIndexx ).end()
|
||
|
|
||
|
|
||
|
})
|
||
|
// Remove button click handler
|
||
|
.on('click', '.removeButton1', function() {
|
||
|
var $row = $(this).parents('.form-group1'),
|
||
|
index = $row.attr('data-book-index1');
|
||
|
$row.remove();
|
||
|
|
||
|
});
|
||
|
</script>
|
||
|
<script>
|
||
|
$('input[type="checkbox"]').click(function(){
|
||
|
if($(this).prop("checked") == true){
|
||
|
$("#topplan").val("1");
|
||
|
}
|
||
|
else if($(this).prop("checked") == false){
|
||
|
$("#topplan").val("0");
|
||
|
}
|
||
|
});
|
||
|
</script>
|
||
|
<script>
|
||
|
sevIndex = 0;
|
||
|
sevIndex++;
|
||
|
$('body').on('click', '.addButton2', function() {
|
||
|
|
||
|
var $template = $('#bookTemplate2'),
|
||
|
$clone = $template
|
||
|
.clone(true)
|
||
|
.removeClass('hide')
|
||
|
.removeAttr('id')
|
||
|
.attr('data-book-index1', sevIndex)
|
||
|
.insertBefore($template);
|
||
|
|
||
|
// Update the name attributes sev_account
|
||
|
// Update the name attributes sev_account
|
||
|
$clone
|
||
|
.find('[id="Compare"]').attr('id', 'Compare_' + sevIndex ).end()
|
||
|
.find('[id="cmp_detail"]').attr('id', 'cmp_detail_' + sevIndex ).end()
|
||
|
.find('[id="hiddenprimary"]').attr('id', 'hiddenprimary_' + sevIndex ).end()
|
||
|
|
||
|
|
||
|
})
|
||
|
// Remove button click handler
|
||
|
.on('click', '.removeButton2', function() {
|
||
|
var $row = $(this).parents('.form-group1'),
|
||
|
index = $row.attr('data-book-index1');
|
||
|
$row.remove();
|
||
|
|
||
|
});
|
||
|
</script><script>
|
||
|
var base_path=$('body').attr('data-path');
|
||
|
$("#category").on('change',function() {
|
||
|
|
||
|
var val = $(this).val();
|
||
|
var url22=base_path+"policy/get_compare_master";
|
||
|
$.post(url22,{val:val,csrf_test_name:$.cookie('csrf_cookie_name')},function(result){
|
||
|
|
||
|
$('.Compare').html(result);
|
||
|
})
|
||
|
|
||
|
});
|
||
|
|
||
|
</script>
|