policybot/application/views/front/category_compare_details.php
2021-11-30 16:26:55 +05:30

126 lines
3.7 KiB
PHP

<?php $this->load->view('front/includes/header'); ?>
<style>
table.entries {width: 100%;border-spacing: 0px;margin:0;}
table.entries thead.fixed {position:fixed;top:60px;background-color:#f3f3f3}
</style>
<section>
<div class="content-wrap">
<div class="container" id="maintable">
<table class="table table-hover table-comparison mb-0 entries " id="entriestable" style="border: 1px solid #ddd;" >
<thead class="fixed">
<tr style="background-color:#cccaca">
<th>Comparison Fields</th>
<?php if(isset($compared)&& $compared->num_rows()>0)
{
foreach($compared->result() as $ps)
{
$logo=$ps->logo;
$life_cover=$ps->life_cover;
$max_cover_age=$ps->max_cover_age;?>
<th>
<div class="row ">
<div class="col-md-12">
<a href="javascript:;" style="cursor:text"><img src="<?=base_url();?><?=$logo;?>" style="width:60px;height:50px" alt="Image"></a>
</div>
<div class="col-md-12">
<span style="font-size:12px">Max Limit : <?=$max_cover_age;?> Yrs</span><br>
<span style="font-size:12px">Life Cover : <?=$life_cover;?> </span>
</div>
</div>
</th>
<?php } } ?>
</tr>
</thead>
<tbody>
<?php
if(isset($compared_mas)&& $compared_mas->num_rows()>0)
{
foreach($compared_mas->result() as $cm)
{
$cate=$this->uri->segment(2);
$CI=&get_instance();
$CI->load->model("Frontend_model");
$compare=$cm->compare;
$compare_name=$cm->compare_name;
?>
<tr>
<td><?=$compare_name;?></td>
<?php foreach($compared->result() as $ps)
{
$policy=$ps->id;
$det=$this->Frontend_model->get_compare_details($compare,$policy,$cate);
if(isset($det)&& $det->num_rows()>0)
{
$d=$det->row();
$comparedetail=$d->comparedetail;
}else { $comparedetail="-"; }
?>
<td><?=nl2br($comparedetail);?></td>
<?php } ?>
</tr>
<?php } } ?>
</tbody>
</table>
<table id="bottom_anchor"></table>
</div>
</div>
</section>
<?php $this->load->view('front/includes/footer'); ?>
<script>
TableThing = function(params) {
settings = {
table: $('#entriestable'),
thead: []
};
this.fixThead = function() {
// empty our array to begin with
settings.thead = [];
// loop over the first row of td's in &lt;tbody> and get the widths of individual &lt;td>'s
$('tbody tr:eq(1) td', settings.table).each( function(i,v){
settings.thead.push($(v).width());
});
// now loop over our array setting the widths we've got to the &lt;th>'s
for(i=0;i<settings.thead.length;i++) {
$('thead th:eq('+i+')', settings.table).width(settings.thead[i]);
}
// here we attach to the scroll, adding the class 'fixed' to the &lt;thead>
$(window).scroll(function() {
var windowTop = $(window).scrollTop();
if (windowTop > settings.table.offset().top) {
$("thead", settings.table).addClass("fixed");
}
else {
$("thead", settings.table).removeClass("fixed");
}
});
}
}
$(function(){
var table = new TableThing();
table.fixThead();
$(window).resize(function(){
table.fixThead();
});
});
</script>