<!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');
  ?>



<style type="text/css">
.dataTables_filter > label
{
  display: block;
  color: rgb(239, 239, 239);
  background: rgb(239, 239, 239);
}

.dataTables_filter label > input[type=search]::after {
    font-family: 'FontAwesome';
    /*color:red;*/
    position: relative;
    left: -5px;
    content: "\f007";
}

</style>      

    <link rel="stylesheet" href="<?php echo base_url();?>styles/css/table.css">

    <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($user_post_ticket != 'on'){ ?>

              <div class="row">
                <div class="col-lg-12">
                  <p class="frgtpwd frgtpwd1 frgtpwdred">
                    <i class="fa fa-thumbs-down"></i><?php echo 'You can\'t raise a tickets';?>
                  </p>
                </div>
              </div>

            <?php } ?>
            <?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 id="exTab3" class="">  
                <ul  class="nav nav-pills">
                  <?php if($user_post_ticket == 'on'){ ?>
                  <li class="active"><a href="#2b" data-toggle="tab"><?php echo $this->lang->line('ticket_lbl_raisenewtic');?> <span><?php echo $this->lang->line('ticket_lbl_newview');?></span></a></li>
                  <li><a  href="#1b" data-toggle="tab"><?php echo $this->lang->line('view_profile_title');?> <span><?php echo $this->lang->line('ticket_lbl_view');?></span></a></li>
                  <?php } else {  ?>
                  <li ><a href="#1b" data-toggle="tab"><?php echo $this->lang->line('ticket_lbl_raisenewtic');?> <span><?php echo $this->lang->line('ticket_lbl_newview');?></span></a></li>
                  <li class="active"><a  href="#1b" data-toggle="tab"><?php echo $this->lang->line('view_profile_title');?> <span><?php echo $this->lang->line('ticket_lbl_view');?></span></a></li>
                  <?php } ?>
                </ul>

                <div class="tab-content clearfix">
                <?php if($user_post_ticket == 'on'){ ?>
                  <div class="tab-pane" id="1b">
                  <?php } else { ?>
                  <div class="tab-pane active" id="1b">
                  <?php } ?>
                    <div class="col-lg-12">
                      <h4 class="other-title theme-color"><?php echo $this->lang->line('ticket_lbl_ticdetails');?></h4>
                      <div class="table-responsive  main-table">
                        <table>
                        <thead>
                          <tr>
                            <th><?php echo $this->lang->line('exp_report_sno'); ?></th>
                            <th><?php echo $this->lang->line('ticket_no_lbl');?></th>
                            <th><?php echo $this->lang->line('lbl_mail_subject');?></th>
                            <th><?php echo $this->lang->line('lbl_mail_message');?></th>
                            <th><?php echo $this->lang->line('ticket_contact_mail');?></th>
                            <th><?php echo $this->lang->line('lbl_status');?></th>
                            <th><?php echo $this->lang->line('lbl_date');?></th>
                          </tr>
                          </thead>
                          <tbody>
                          <?php 
                              if($listticket) {
                                $this->load->library('MyEncrypt');
                                $myencrypt = new MyEncrypt;
                                $i=1;
                                foreach ($listticket as $row) {
                            ?>
                                <tr>
                                  <td><?php echo $i; ?></td>
                                  <td><a href="<?php echo base_url().'user/tickets/ticketdetails/'.$myencrypt->encode($row->ticket_no);?>"><?php echo $row->ticket_no;?></a></td>
                                  <td><?php echo $row->subject;?></td>
                                  <td><?php echo substr($row->message,0,15);?></td>
                                  <td><?php if($row->contact_mail) { echo $row->contact_mail; } else { echo "Nil"; } ?></td>
                                  <td><?php echo $row->ticket_status;?></td>
                                  <td><?php echo $row->post_date;?></td>
                                </tr>
                          <?php
                               $i++; }

                              } else { 
                          ?>
                                <tr>
                                  <td colspan="7" style='text-align:center !important;'><?php echo $this->lang->line('lbl_no_records');?></td>
                                </tr>
                          <?php } ?>
                          </tbody>
                        </table>
                      </div>
                    </div>
                  </div>
                  <?php if($user_post_ticket == 'on'){ ?>
                  <div class="tab-pane active" id="2b">
                  <?php } else { ?>
                  <div class="tab-pane" id="2b">
                  <?php } ?>
                    
                      <form class="postticket" method="post" action="<?php echo base_url();?>tickets">

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

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


                               <div class="col-lg-12 mt-10 form-group <?php if(form_error('contact_mail')) echo "has-error";?>">
                                <label class="col-lg-3 other-title theme-color mt-15"><?php echo $this->lang->line('ticket_contact_mail'); ?>  </label>
                                  <div class="col-lg-9">
                                      <input type="text" name="contact_mail" value="<?php echo set_value('contact_mail');?>">
                                      <div class="messageContainer"></div>
                                      <?php echo form_error('contact_mail', '<span class="help-block">', '</span>'); ?>
                                  </div>
                              </div>                                                               

                               <div class="col-lg-12 mt-10 form-group <?php if(form_error('contact_no')) echo "has-error";?>">
                                <label class="col-lg-3 other-title theme-color mt-15"><?php echo $this->lang->line('admin_contactnum_lbl'); ?>  </label>
                                  <div class="col-lg-9">
                                      <input type="text" name="contact_no" value="<?php echo set_value('contact_no');?>">
                                      <div class="messageContainer"></div>
                                      <?php echo form_error('contact_no', '<span class="help-block">', '</span>'); ?>
                                  </div>
                              </div>                                                                                           
<!-- 0.00001000 -->

                              <div class="col-lg-12 form-group">
                                <center> 
                                <div class="">
                                  <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>
                              </div>
                          </div>
                        </ul>
                      </form>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        </div>
        </div>
    <script src="<?php echo base_url();?>styles/js/jquery-1.12.2.min.js"></script>   
    <script src="<?php echo base_url();?>styles/js/bootstrap.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" src="<?php echo base_url();?>styles/js/datatables.min.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: {
                  subject: {
                      validators: {
                          notEmpty: {
                              message: '<?php echo $this->lang->line("contact_subject_required");?>'
                          }
                      }
                  },
                  message: {
                      validators: {
                         notEmpty: {
                          message: '<?php echo $this->lang->line("contact_message_required");?>'
                      },
                      stringLength: {
                          min: 10,
                          message: '<?php echo $this->lang->line("contact_message_exceed");?>'
                      }
                      }
                  },
                  contact_mail: {
                      validators: {
                         regexp: {
                          regexp: /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/,
                          message: '<?php echo $this->lang->line("contact_email_valid"); ?>'
                          }

                      }
                  },
                  contact_no: {
                      validators: {
                          digits: {
                          message: '<?php echo $this->lang->line("user_phone_num");?>'
                      },
                      stringLength: {
                      max: 15,
                      message: '<?php echo $this->lang->line("user_phone_max_limit");?>'
                      }

                      }
                  },
                  math_captcha: {
                      validators: {
                         notEmpty: {
                              message: '<?php echo $this->lang->line("err_captcha");?>'
                          },
                          digits: {
                              message: '<?php echo $this->lang->line("err_digits_captcha");?>'
                          },
                          remote: {
                              url: function(validator, $field, value) {
                                  
                                  return '<?php echo base_url();?>user/tickets/check_math_captcha/'+$('#math_Captcha').val();
                              },
                              type: 'POST',
                              delay: 1000
                          } 

                      }
                  }
                 
              }
        })

    	});
    	
    </script>
        
   
    

    <script type="text/javascript">

      $(document).ready(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"
                });
              }
            }
        }

        $("#refresh").on('click', function(e) {
          $.ajax({
            type: 'post',
            url : '<?php echo base_url()."user/tickets/refersh"; ?>',
            data : { },
            success : function(msg)
            {
              
              $("#capt").attr('src',msg);
             
            }
          });
        });

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

