<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <?php
      $this->load->view('user/common_style');
    ?>
    <link rel="stylesheet" href="<?php echo base_url();?>styles/fonts/Socialico/stylesheet.css">
    <link rel="stylesheet" href="<?php echo base_url();?>styles/css/set1.css">

    <link href="<?php echo base_url();?>styles/css/table.css" type="text/css" rel="stylesheet" />
    <script src="<?php echo base_url();?>styles/js/modernizr.js"></script>
    <style>
      .contact_one .contact_left_content form input[type="text"]{border:0px;}

      .prfledit select {
          margin: 0;
      }
      .help-block {
          color: #eb5055;
          margin: 0em 0em 0em !important;
      }
      ul.prfledit  li {
        color: #444;
        display: inline-block;
        font-family: "Open Sans",sans-serif;
        font-size: 14px;
        font-weight: 600;
        line-height: 24px;
        margin-bottom: 10px;
        padding: 10px 0;
        width: 100%; 
      }

      .prfledit textarea {
          border: 1px solid #ededed;
          height: 200px;
          padding: 10px 20px;
          width: 100%;
      }
            
    </style>
    </head>

  <body>
      <?php
        $this->load->view('user/header');
        $this->load->view('user/login_header');
        $currency_info = defaultcurrency();
      ?>

      <div class="col-lg-9 col-md-9 col-sm-12 col-xs-12">
      <div class="table-list clearfix">
            <?php if($this->session->flashdata('success_message')) {?>

              <div class="row">
                  <div class="col-lg-12 ">
                      <p class="frgtpwd frgtpwd1">
                          <i class="fa fa-thumbs-up"></i><?php echo $this->session->flashdata('success_message');?>
                      </p>
                  </div>
              </div>

            <?php } elseif ($this->session->flashdata('error_message')) { ?>

              <div class="row">
                  <div class="col-lg-12">
                      <p class="frgtpwd frgtpwd1 frgtpwdred">
                          <i class="fa fa-thumbs-down"></i><?php echo $this->session->flashdata('error_message');?>
                      </p>
                  </div>
              </div>
          <?php } ?>

            <div class="col-lg-12">
              <div class="col-lg-8"> 
                <div class="gry clearfix">
                  <div class="profilesub">
                    <h4 class="other-title theme-color"><?php echo $this->lang->line('ticket_subject_lbl'); ?></h4>
                  </div>
                   <div class="col-lg-12" ><p class="text-gray"><?php echo $ticket_data->subject;?></p></div>
                   <br>
                    <div class="profilesub">
                      <h4 class="other-title theme-color"><?php echo $this->lang->line('ticket_message_lbl'); ?></h4>
                    </div>
                  <div class="col-lg-12" ><p class="text-gray"><?php echo $ticket_data->message;?></p></div>
                </div>
               </div> 
              <div class="col-lg-4"> 
                <div class="widget widget_download_link" style="margin:0">
                  <div class="widget_download_link_content">
                    <h4 class="other-title theme-color"> <?php echo $this->lang->line('ticket_lbl_ticdetails'); ?></h4>
                    <ul>
                        <li>
                          <a href="#" style="cursor:default"><i class="icon-gift "></i> <?php echo $this->lang->line('ticket_no_lbl'); ?> <span><?php echo $ticket_data->ticket_no;?></span></a>
                        </li>
                        <li>
                          <a href="#" style="cursor:default"><i class="icon-layers "></i></i> <?php echo $this->lang->line('ticket_createdon_lbl'); ?> <span><?php echo $ticket_data->post_date;?></span></a>
                        </li>
                        <li>
                          <a href="#" style="cursor:default"><i class="icon-layers "></i> </i> <?php echo $this->lang->line('ticket_lastreply_lbl'); ?><span><?php if($lat_date) { echo $lat_date->con_date; } else { echo "Nil"; } ?></span></a>
                        </li>
                        <li>
                          <a href="#" style="cursor:default"><i class="icon-layers "></i> </i> <?php echo $this->lang->line('lbl_status'); ?><span><?php echo $ticket_data->ticket_status;?></span></a>
                        </li>
                    </ul>
                  </div>
                </div>
              </div>
            </div>  

            <?php if($ticket_data->ticket_status != 'close') { ?>
              <div class="col-lg-12">
                    <h4 class="other-title theme-color"><?php echo $this->lang->line('ticket_posttic_lbl'); ?></h4>
                    <div class="profilesub clearfix profilesub2">
                    <form class="postticket" method="post" action="<?php echo base_url();?>user/tickets/ticketdetails">

                              <div class="col-lg-12 mt-10 <?php if(form_error('status')) echo "has-error";?>">
                                <label class="col-lg-3 other-title theme-color mt-15"><?php echo $this->lang->line('lbl_status'); ?> <label class="text-danger">*</label> </label>
                                  <div class="col-lg-9">
                                      <select name="status"  id="status" class="">
                                        <option value="" ><?php echo $this->lang->line('lbl_status'); ?></option>
                                        <option value="3" <?php if($ticket_data->status == '3') { echo "selected=selected"; } else { echo ""; } ?>><?php echo $this->lang->line('ticket_reopen_lbl'); ?></option>
                                        <option value="4" <?php if($ticket_data->status == '4') { echo "selected=selected"; } else { echo ""; } ?>><?php echo $this->lang->line('ticket_close_lbl'); ?></option>
                                      </select>
                                      <div class="messageContainer"></div>
                                      <?php echo form_error('status', '<span class="help-block">', '</span>'); ?>
                                  </div>
                               </div> 


                                <div class="col-lg-12 mt-10 <?php if(form_error('reply')) echo "has-error";?>">
                                <label class="col-lg-3 other-title theme-color mt-15"><?php echo $this->lang->line('ticket_reply_lbl'); ?> <label class="text-danger">*</label> </label>
                                  <div class="col-lg-9">
                                      <textarea name="reply" class="form-control"><?php echo set_value('reply');?></textarea> 
                                      <div class="messageContainer"></div>
                                      <?php echo form_error('reply', '<span class="help-block">', '</span>'); ?>
                                  </div>
                               </div>                                

                          <?php
                          $myencrypt = new MyEncrypt;

                          $ticket_id=$myencrypt->encode($ticket_data->ticket_no);
                          ?>
                          <input type="hidden" value="<?php echo $ticket_id;?>" name="tkt">

                          
                            <center> 
                            <div class="col-lg-12 mt-30">
                              <div class="cmmn">
                                <div class="contact_page_btn">
                                  <button class="yellow-btn" type="submit"><?php echo $this->lang->line('contact_submit'); ?></button>
                                </div>
                              </div>
                            </div>
                            </center>
                          </li>

                    </form>
                  </div>  
                    
                </div>
              
            <?php } ?>
                  
            <?php if($con_date) {?>
              <div class="col-lg-12">
            <?php
             foreach ($con_date as $row) {

              if($row->adminid == '0') {
                $name = 'Admin';

              } else {
                $condition = "uusersid = '".$this->session->userdata('uusersid')."'";
                $username = $this->common_model->GetRow('uusers',$condition);
                $name = $username->username;
              }
             ?>

              <div class="form-group mt-20"> 
                <div class="gry clearfix "> 
                  <div class="profilesub">
                    <h4 class="other-title theme-color"><?php echo $this->lang->line('ticket_conversation_lbl'); ?></h4>
                  </div>
              
                  <div class="col-sm-12">
                    <div class="profilesub">
                      <h4 class="other-title theme-color"><?php echo $name; ?></h4>
                    </div>

                    <p><?php echo $this->lang->line('lbl_status'); ?> :<span><?php echo $row->tkt_status; ?></span> </p>
                    <p><?php echo $this->lang->line('contact_message'); ?> :<span><?php echo $row->tkt_message; ?></span></p>
                    <p><?php echo $this->lang->line('trans_date'); ?> :<span><?php echo $row->con_date; ?></span></p>
                  </div>  
                  
                </div>
              </div>
                
          <?php   }?></div> <?}?>
                  
              </div>
              
              
          </div>    
        </div>
        </div>    
        </div>
        </div>
        <!-- </div>     -->
        <!-- </div> -->
      
    

      <?php
          $this->load->view('user/footer');
      ?>
    

    <script src="<?php echo base_url();?>styles/js/jquery-1.12.2.min.js"></script>

    <script src="<?php echo base_url();?>styles/js/jquery.meanmenu.js"></script>
    <script src="<?php echo base_url();?>styles/js/owl.carousel.min.js"></script>
    <script src="<?php echo base_url();?>styles/js/waypoints.min.js"></script>
    <script src="<?php echo base_url();?>styles/js/jquery.counterup.min.js"></script>
    <script src="<?php echo base_url();?>styles/js/jquery.mixitup.min.js"></script>

    <script src="<?php echo base_url();?>styles/js/instafeed.min.js"></script>
    <script src="<?php echo base_url();?>styles/js/bootstrap.min.js"></script>

    <script src="<?php echo base_url();?>styles/js/main.js"></script>
    <script type="text/javascript" src="<?php echo base_url();?>styles/js/owl.carousel.min.js"></script>
    <script type="text/javascript" src="<?php echo base_url();?>assets/js/formValidation.js"></script>
     <script type="text/javascript" src="<?php echo base_url();?>assets/js/bootstrap.js"></script>
 
    <script type="text/javascript">

    	$(document).ready(function($) {

         $('.postticket').formValidation({
                        framework: 'bootstrap',
                        excluded: [':disabled'],

                        err: {
                            container: function($field, validator) {
                                return $field.next('.messageContainer');
                            }
                        },
                        row: {
                            valid: 'has-success1',
                            invalid: 'has-error1'
                        },
                        fields: {
                            status: {
                                validators: {
                                    notEmpty: {
                                        message: '<?php echo $this->lang->line("ticket_err_status");?>'
                                    }
                                }
                            },
                            reply: {
                                validators: {
                                   notEmpty: {
                                    message: '<?php echo $this->lang->line("ticket_err_reply");?>'
                                },
                                stringLength: {
                                    min: 10,
                                    message: '<?php echo $this->lang->line("tick_reply_exceed");?>'
                                }
                                }
                            }
                           
                        }
                    })

      	$("#owl-example").owlCarousel({  
          nav:true,
          items : 8, 
          itemsCustom : false,
          itemsDesktop : [1199,8],
          itemsDesktopSmall : [980,5],
          itemsTablet: [768,5],
          itemsTabletSmall: [768,4],
          itemsMobile : [479,2],
          singleItem : false,
          itemsScaleUp : true,
          navigation : true,
          navigationText : ["",""],
          rewindNav : true,
          scrollPerPage : true,
      	});
    	});
    	
    </script>

    <script type="text/javascript" src="<?php echo base_url();?>styles/js/datatables.min.js"></script>

    
  <!-- Core JS files -->
  <script type="text/javascript" src="<?php echo base_url();?>assets/js/plugins/loaders/pace.min.js"></script>
  <script type="text/javascript" src="<?php echo base_url();?>assets/js/core/libraries/jquery.min.js"></script>
  <script type="text/javascript" src="<?php echo base_url();?>assets/js/core/libraries/bootstrap.min.js"></script>
  <script type="text/javascript" src="<?php echo base_url();?>assets/js/plugins/loaders/blockui.min.js"></script>
  <script type="text/javascript" src="<?php echo base_url();?>assets/js/plugins/ui/nicescroll.min.js"></script>
  <script type="text/javascript" src="<?php echo base_url();?>assets/js/plugins/ui/drilldown.js"></script>
  <!-- /core JS files -->

  <!-- Theme JS files -->
  <script type="text/javascript" src="<?php echo base_url();?>assets/js/plugins/notifications/bootbox.min.js"></script>
  <script type="text/javascript" src="<?php echo base_url();?>assets/js/plugins/notifications/sweet_alert.min.js"></script>
  <script type="text/javascript" src="<?php echo base_url();?>assets/js/core/app.js"></script>
  <!-- /theme JS files -->
    <script type="text/javascript">

  
      $(function() {

          'use strict';

     
      document.body.addEventListener('click', copy, true);


      function copy(e) {

        var
          t = e.target,
          c = t.dataset.copytarget,
          inp = (c ? document.querySelector(c) : null);

        if (inp && inp.select) {

       
          inp.select();

          try {

            document.execCommand('copy');
            inp.blur();
          }
          catch (err) {
             swal({
                title: "<?php echo $this->lang->line('referral_copy_lbl'); ?>",
                confirmButtonColor: "#f5ab35"
            });
          }

        }

      }


        $.extend( $.fn.dataTable.defaults, {
          autoWidth: false,
          pagingType: 'full_numbers',
          dom: '<"datatable-header"fl><"datatable-scroll"t><"datatable-footer"ip>',
          language: {
            search: '<span>Filter:</span> _INPUT_',
            lengthMenu: '<span>Show:</span> _MENU_',
            paginate: { 'first': 'First', 'last': 'Last', 'next': '>', 'previous': '<' }
          }
        });

        $('.datatable-pager table').dataTable({
          pagingType: 'simple',
          language: {
            paginate: { 'next': 'Next →', 'previous': '← Previous' }
          }
        });

        $('.datatable table').dataTable({
          "paginate": false,
          "filter": false,
          "Info": false
        });

      });

    </script>
 <?php echo $this->load->view('user/common_script');?>
</body>
</html>
