<? global $vis_language;

if($total_twilio_msg<=0){   
	include(VIS_PATH_TEMPLATE.'no_record_yet.php'); 
} else { ?>
<script> $("#view_action").show(); $("#total_cnt").html("(<?php echo count($twilio_msg_list->messages); ?>)"); $("#vis_<?php echo $operation['vis_operation']; ?>_form .panel-footer").show(); $("#vis_domain_list").show(); </script>
<?php
	if($twilio_msg_list->previous_page_uri!=''){
		echo '<input  type="hidden" name="vis_prev_page_no" id="vis_prev_page_no" value="'.($twilio_msg_list->page - 1).'" />';
	}
	if($twilio_msg_list->next_page_uri!=''){
		echo '<input  type="hidden" name="vis_next_page_no" id="vis_next_page_no" value="'.($twilio_msg_list->page + 1).'" />';
	}?>
<table class="table table-hover b-t b-light m-b-none" data-ride="datatables">
   <thead class="table_head">
      <tr>
        <th class="txt_nowrap"><? echo $vis_language['TXTFROM']; ?></th>
        <th class="txt_nowrap"><? echo $vis_language['TXTTO']; ?></th>
        <th class="txt_nowrap"><? echo $vis_language['TXTMESSAGE']; ?></th>
        <th class="txt_nowrap"><? echo $vis_language['TXTENDDATE']; ?></th>
        <th class="txt_nowrap"><? echo $vis_language['TXTSTATUS']; ?></th>
      </tr>
   </thead>
   <tbody>
      <?
        foreach($twilio_msg_list->messages as $msg_list){
			?>
				<tr style="cursor:pointer;" onclick="$('#vis_workpanel_div').visExecution('load_module','<?php echo $vis_language["TXTCALLDETAILS"];?>',{'vis_module':'voip','vis_operation':'twilio_message_details','vis_msg_id':'<?php echo $msg_list->sid;?>','vis_chk_domain':'<?php echo $vis_domain;?>'});">
			<?php
			 echo '<td>'.$msg_list->from.'</td>';
             echo '<td>'.$msg_list->to.'</td>';
             echo '<td>'.$msg_list->body.'</td>';
             echo '<td>'.format_datetime(strtotime($msg_list->date_created)).'</td>';
             echo '<td>'.$msg_list->status.'</td>';
            echo "</tr>";
        } ?>
   </tbody>
</table>
<script>
<? if($twilio_msg_list->previous_page_uri==''){?>$(".btn_prev_page").css("display", "none");<? }else {?>$(".btn_prev_page").css("display", "block");<? }?>
<? if($twilio_msg_list->next_page_uri==''){?>$(".btn_next_page").css("display", "none");<? }else {?>$(".btn_next_page").css("display", "block");<? }?>
</script>
<? } ?>
