<div class="content-wrapper">
    <div class="container-fluid">

		<div class="row">
        <div class="col-lg-12">
          <div class="card">
            <div class="card-header"><i class="fa fa-users"></i> <?= $pagetitle; ?></div>
            <div class="card-body">
				<?php $pagemsg = $this->session->flashdata('page_message'); 
					if($pagemsg){
						echo $pagemsg;
						$this->session->unset_userdata('page_message');
					}
				?>
				<div class="row">
					<table class="table table-bordered">
						<tr>
							<form action="#" method="post">
							<td>
								<select name="status"class="form-control">
									<option value='-1'>All</option>
									<option value='1' <?php if($status == '1'){echo 'selected';} ?>>Approved</option>
									<option value='0' <?php if($status == '0'){echo 'selected';} ?>>Disapproved</option>
								</select>
							</td>
							<td>
								<button type="submit" class="btn btn-sm btn-success">View</button>
							</td>
							</form>
							<td>
								
							</td>							
							<td align="right">
								<a class="btn btn-sm btn-primary" href="<?= $updatelink;?>">Add New</a>
							</td>
						</tr>
					</table>
				</div>
			</div>
			<div class="card-body">
              <div class="table-responsive">
              <table id="default-datatable" class="table table-bordered">
                <thead>
                    <tr>
                        <th class="nosort">Sr. No.</th>
                         <th>Action</th>
                        <th>Name</th>
                        <th>Type</th>
                        <th>Language</th>
                        <th width="20%">Template</th>
                        <th>Created On</th>
                        <th>Updated On</th>
                        <th>Status</th>
                       
                    </tr>
                </thead>
                <tbody>
					<?php $srno=1;
					for($i=0;$i<count($response);$i++){?>
						 <tr>
							<td><?= $srno; ?></td>
                            <td align="center">
								<a href="<?= $updatelink.'/'.$response[$i]->templateId;?>" class="btn btn-sm btn-warning mb-2"> <i class=" fa fa-pencil-square"></i> Edit</a>
								
								<br/>
								<a href="<?= $deletelink.'/'.$response[$i]->templateId;?>" class="btn btn-sm btn-danger mb-2"> <i class="fa fa-trash"></i> Delete</a>
							</td>
                            <td><?= $response[$i]->templatename; ?> <br/>(<b>Total Parameters:</b> <?= $response[$i]->parameters; ?>)</td>
                           	<td><?= $response[$i]->header_type; ?></td>
                            <td><?= $response[$i]->language; ?></td>
                            
                            <td width="100px">
                            <strong>Header:</strong> <?= $response[$i]->header_value; ?>
                            <br/><strong>Body:</strong> <?= $response[$i]->body; ?> 
                            <br/><strong>Footer:<strong> <?= $response[$i]->footer; ?>
                            </td>
                            <td><?= $response[$i]->submited_on; ?></td>
                            <td><?= $response[$i]->edited_on; ?></td>
							<td><?php if($response[$i]->status){ echo 'Approved';}else{ echo 'Disapproved';} ?></td>
							
						</tr>
					<?php $srno++; } ?>
                   
                </tbody>
            </table>
            </div>
            </div>
          </div>
        </div>
      </div><!-- End Row-->