<div class="wrapper">
    <div class="container">
        <div class="row">
            <div class="col-sm-12 col-xm-12"></div>
        </div>        
        <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="card-box">
                    <!-- Title -->
                    <div class="row">
                        <div class="col-md-12">
                            <h2>Select the Relevent Consent Form:</h2>
                        </div>
                        <?php if($this->session->userdata('role')=='admin' || $this->session->userdata('role')=='Super User'){?>
                            <a href="<?php echo base_url('createformjson');?>" target="concentform" class="btn btn-sm btn-success">Add Category</a>
                            <a href="<?php echo base_url('createformjson');?>" target="concentform" class="btn btn-sm btn-success">Add New Form</a>
                        <?php } ?>
                    </div>
                    <divc class="row">
                        <div class="col-md-12" style="font-size:14px !important; line-height:48px;">
                            <ul style="list-style: none;" >
                            <?php $x=0; $lastcategory=0; foreach($concentforms as $cf){?> 
                                <?php if($lastcategory != $cf['id_concent_category']){?>
                                    <?php if($x>0){?>
                                    </ul>
                                    <?php } ?>
                                    <li>
                                        <span style="font-weight: 700; font-size:23px;">
                                            <?php echo $cf['concent_category'];?>
                                        </span>
                                        <?php if($this->session->userdata('role')=='admin' || $this->session->userdata('role')=='Super User'){?>
                                                <a href="<?php echo base_url('createformjson/'.$cf['id_concent_forms'].'/');?>" target="concentform" class="btn btn-sm btn-warning"><i class="fa fa-pencil"></i></a>
                                        <?php } ?>
                                    </li>
                                    <ul style="list-style: none;">
                                    <li>
                                        <a href="<?php echo base_url('concentform/'.$cf['id_concent_forms'].'/'.$visit_id);?>" target="concentform" class="btn btn-md btn-primary">
                                        <?php echo $cf['concent_form'];?>
                                        </a>
                                        <?php if($this->session->userdata('role')=='admin' || $this->session->userdata('role')=='Super User'){?>
                                                <a href="<?php echo base_url('createformjson/'.$cf['id_concent_forms'].'/');?>" target="concentform" class="btn btn-sm btn-warning"><i class="fa fa-pencil"></i></a>
                                        <?php } ?>
                                    </li>    
                                <?php } else {?>
                                    <li>
                                        <a href="<?php echo base_url('concentform/'.$cf['id_concent_forms'].'/'.$visit_id);?>" target="concentform"  class="btn btn-md btn-primary">
                                            <?php echo $cf['concent_form'];?>
                                        </a>
                                        <?php if($this->session->userdata('role')=='admin' || $this->session->userdata('role')=='Super User'){?>
                                                <a href="<?php echo base_url('createformjson/'.$cf['id_concent_forms']);?>" target="concentform" class="btn btn-sm btn-warning"><i class="fa fa-pencil"></i></a>
                                        <?php } ?>
                                    </li>    
                                <?php } ?>
                                <?php $lastcategory=$cf['id_concent_category']; $x++; ?>
                            <?php } ?>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>