HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.52.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 15 06:39:08 EDT 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: /home/barbeatleanalyti/public_html/barisnew.beatleanalytics.com/site/backup/template/tickets.php
<script>
	$(document).ready(function(){
		$("#FromDate").datepicker({format:'dd-mm-yyyy'});
		$("#ToDate").datepicker({format:'dd-mm-yyyy'});
	});

		function validateDate(){
			
			var D1 = document.getElementById("ToDate");
			var D2 = document.getElementById("FromDate");
			
			if(D1.value.trim() == ""){
				D1.style.border = "1px solid red";
				return false;
			}
			
			if(D2.value.trim() == ""){
				D2.style.border = "1px solid red";
				return false;
			}
		}	
	
	</script>





<?php
	// Declare new object

	$objUsers = object;
	
	// Assing object 
	$objUsers = $objDB->objController;
	
	// Assign all variable's value
	$pg 			= $objUsers->pg;
	$acn 			= $objUsers->acn;
	$v 				= $objUsers->v;
	$State 			= $objUsers->State;
	$ReligionName 	= $objUsers->ReligionName;
	$sort			= $objUsers->sort;
	$ReligionID		= $objUsers->ReligionID;
	$field			= $objUsers->field;
	$error 			= $objUsers->error;
	$msg 			= $objUsers->msg;
	$perpage 		= $objUsers->perpage;
	$start	 		= $objUsers->start;
	$limit	 		= $objUsers->limit;
	$SearchValue	= $objUsers->SearchValue;
	$s				= $objUsers->s;	
	$status_search				= $objUsers->status_search;	
	

	$OrgID	= $objUsers->OrgID;
	$BranchID	= $objUsers->BranchID;
	$IndustryID	= $objUsers->IndustryID;
	
	$tktid	= $objUsers->tid;
	

	$statusArr = array('hold'=>'Hold','close'=>'Close','resolve'=>'Resolve');
	if($_SESSION['UserInfo']['UType'] != 'owner')
	$statusArr['forward'] = 'Forward';
	
	if($_SESSION['UserInfo']['UType'] == 'owner')
	$statusArr['dissolve'] = 'Dissolve';

	
	$rsAllTicketsData = $objUsers->FetchAllTicketsData("All");
	
	if($start == 1)
		$limit = 0;
	else if($start == 2)
		$limit = $perpage;
	else
		$limit = ($start-1) * $perpage;
	
	$objUsers->limit = $limit;
	
	$nume = count($rsAllTicketsData);
	
	$totalpage = @ceil(count($rsAllTicketsData)/$perpage);	

	$rsAllTicketsData = $objUsers->FetchAllTicketsData();
	
	
	if($sort == '0'){
		$sort = '1';
	}
	else{	
		$sort = '0';
		}
	

	$link = "";
	if( $start != "" && $start != 0 ){
		$link .= "&start={$start}";
	}
	if( $perpage != "" && $perpage != 0 ){
		$link .= "&perpage={$perpage}";
	}
	if(trim($s) != ""){
		$link .= "&s={$s}";
	}
		
	
	$Dash = "";
	if($_SESSION['UserInfo']['UType'] == 'MasterAdmin'){
	
	$Dash = "dashboardma";
	
	}else if($_SESSION['UserInfo']['UType'] == 'Admin'){
	
	$Dash = "dashboardadmin";
	}

  

?>

<div class="content-wrapper">

<?php
		
		if( strtolower($v)=='add'|| strtolower($v)=='edit')
		{} 
			  
	else if($v=='list' || $v=='view'){  ?>
	
    <?php if($v =='list') {?>
    <section class="content-header">
	<h1>&nbsp;List of tickets </h1>
    <ol class="breadcrumb">
    <li><a href="index.html"><i class="fa fa-home"></i> Home</a></li>
    <li><a href="tickets.html?v=list"><i class="fa users"></i>Users</a></li>
    <li class="active">Users List</li>
  </ol>
 </section>
 	<?php }else if($v =='view'){?>
    <section class="content-header">
	<h1>&nbsp;Manage tickets </h1>
    <ol class="breadcrumb">
    <li><a href="index.html"><i class="fa fa-home"></i> Home</a></li>
    <li><a href="index.html"><i class="fa fa-key"></i> List tickets</a></li>
    <li class="active">Manage tickets</li>
  </ol>
 </section>
 	<?php } ?>
 <?php
	// Error or success message display
	$objDB->NotificaitonForResult($msg,$error)
 ?>
 <section class="content">
     <div class="row">
        <div class="col-md-12">
          <div class="box box-primary" style="min-height:760px;">
            <div class="box-header">
               <div class="col-md-12 col-xs-12 no-padding">  	
                    <?php if($v =='list') {?>
                    <form method="post" action="tickets.html" name="frmSearch" id="frmSearch">
								<input type="hidden" name="start" id="start" value="<?php echo $start?>" />
								<input type="hidden" name="perpage" id="perpage" value="<?php echo $perpage?>" />


    						     <div class="row">
                                 <div class="col-md-12">
                                
                           
								  <div class="col-md-1 col-xs-3 col-sm-2 pull-left form-group no-padding ">
                                    <a class="btn btn-info btn-sm" href="dashboardma.html"> <i class="fa fa-long-arrow-left"></i> Back </a>
                                    </div>
									
									
                                
                           
								  
                                    
                                  <div class="col-md-2 col-xs-12 form-group">
                                  <?php $rsOrganization = $objUsers->fetchOrganization(); ?>
                                    <!--<span id="span_select" style="width:120px; height:35px; float:right;">-->
                                        <select class="form-control input-md" id="org_list" onchange="javascript: getBranchData(this.value)" name="Organization">
                                           <option value="0">Select Organization</option> 
										   <?php if(count($rsOrganization) > 0) { ?>
                                           <option style="font-weight:bold;" <?php if(!empty($OrgID)) echo 'selected="selected"'; ?>  value="<?php echo $rsOrganization[0]['OrgId']?>"><?php echo $rsOrganization[0]['db_Orgname']?></option>
                                           <?php  }else{ ?>
											   <option value="0">No any org. found</option>
											<?php  } ?>
										</select>
                                    <!--</span>-->
                                  </div>
                                  
                                  <script>
								  	function getBranchData(orgid){
										
										  var xhttp = new XMLHttpRequest();
										  xhttp.onreadystatechange = function() {
											if (xhttp.readyState == 4 && xhttp.status == 200) {
													document.getElementById("branch_list").innerHTML = xhttp.responseText;
												}
										  };
										  xhttp.open("GET", "runajax.php?acn=FetchBranchDetails&orgid="+orgid, true);
										  xhttp.send();
									}
									
									function FetchIndustryDetails(branchid){
										
										  var xhttpI = new XMLHttpRequest();
										  xhttpI.onreadystatechange = function() {
											if (xhttpI.readyState == 4 && xhttpI.status == 200) {
													document.getElementById("industry_list").innerHTML = xhttpI.responseText;
												}
										  };
										  xhttpI.open("GET", "runajax.php?acn=FetchIndustryDetails&branchid="+branchid, true);
										  xhttpI.send();
									}
									
									
                                  </script>
                                  
                                  
                                  
                                  <div class="col-md-2 col-xs-12 form-group" id="branch_list" >
                                  
                                  <?php $rsBranches = $objUsers->fetchBranches();  ?>
                                    <!--<span id="span_select" style="width:120px; height:35px; float:right;">-->
                                        <select class="form-control input-md" name="Branches">
                                            <option value="0"> Select Branch </option> 
                                            <?php if(count($rsBranches) > 0) { for($b=0; $b<count($rsBranches); $b++) { ?>
                                            <option <?php if($BranchID === $rsBranches[$b]['branchId']) echo 'selected="selected"'; ?> value="<?php echo $rsBranches[$b]['branchId']?>"><?php echo $rsBranches[$b]['db_branchName']?></option>
                                            
                                            <?php }
											
											}else{ ?>
                                            <option value="0">No any branch found</option>
                                            <?php } ?>
                                            
										</select>
                                    <!--</span>-->
                                  </div>
                                  
                                  <div class="col-md-2 col-xs-12 form-group" id="industry_list">
                                    <!--<span id="span_select" style="width:120px; height:35px; float:right;">-->
                                    <?php $rsIndustrys = $objUsers->fetchIndustrys($OrgID,$BranchID,$IndustryID);  ?>
                                  <select class="form-control input-md" id="state_list" name="Industrys">
                                            <option value="0"> Select Industry </option> 
                                            <?php if(count($rsIndustrys) > 0) { for($b=0; $b<count($rsIndustrys); $b++) { ?>
                                            <option <?php if($IndustryID === $rsIndustrys[$b]['IndId']) echo 'selected="selected"'; ?> value="<?php echo $rsIndustrys[$b]['IndId']?>"><?php echo $rsIndustrys[$b]['db_industry']?></option>
                                            
                                            <?php }
											
											}else{ ?>
                                            <option value="0">No any ind. found</option>
                                            <?php } ?>
                                            
										</select>
                                                                
                                    <!--</span>-->
                                  </div>
                                  
                                  <div class="col-md-2 col-xs-12 form-group" id="industry_list">
                                    <!--<span id="span_select" style="width:120px; height:35px; float:right;">-->
                                            <select name="status_search" id="status_search" class="form-control input-md">
                                            	<option <?php if($status_search == 'All') echo 'selected="selected"'; ?> >All</option>
                                                <?php foreach($statusArr as $key => $val)  {?>
                                                <option <?php if($status_search == $val) echo 'selected="selected"'; ?> value="<?php echo $key;?>"><?php echo $val; ?></option>
                                                <?php } ?>
                                            </select>
                                                                
                                    <!--</span>-->
                                  </div>
                                  
                                  
                                    
                                  
                                    
								  	
                                
                               
                                  
                                  <div class="col-md-1 col-xs-6  pull-right text-right form-group no-padding">
                                    <a class="btn btn-sm btn-danger"  href="tickets.html"> <i class="fa fa-refresh"></i> Reset  </a> </div>
                                  <div class="col-md-1 col-xs-6 pull-right">
                  
                   
                   
                   <div class="input-group input-group-sm">
                    <!--<input type="text" id="s" name="s" placeholder="Search content here .." class="form-control" value=""> -->                      
                    <span class="input-group-btn">
                             <button class="btn btn-block btn-success btn-md" type="submit"><i class="fa fa-search" aria-hidden="true"></i> Search!</button>
                    </span>
                  </div>        
                  
                   
                </div>
                                    
                                  
                                    
								  	
                                
                                </div>
                                 </div>
                                 
                                
                                 
                                 </form>
    				
    
               	
                    <div class="row">
			         <?php
						if(count($rsAllTicketsData) > 0 ) { 
						//echo   pagination_log($s,$perpage,$start,$nume,$totalpage,$pg,$v);  
						}
                    ?>
					
					
					
					
			<div class="row col-md-12">
                <div class="col-md-2 col-xs-6 form-group">
                        <input type="text" readonly="readonly" id="FromDate" name="FromDate" placeholder="Start date.." class="form-control input-md" value="<?php echo $FromDate;?>">
                   </div>
                                  
                                  <div class="col-md-2 col-xs-6 form-group">
                                      <input type="text" readonly="readonly" id="ToDate" name="ToDate" placeholder="End date.." class="form-control input-md" value="<?php echo $ToDate;?>">
                                  </div>
                </div>
					
        
                    <div class="col-md-12">
                    <div class="table-responsive">
                    
                		 <table class="table table-striped table-bordered">
								  <tbody>
								  <tr>
								  <th class="text-center">Sr.No.</th>
                                  <th class="text-center">User ID</th>
                                  <th class="text-center">Ticket ID</th>
                                  <th class="text-center">Organization</th>
                                  <th class="text-center">Branch</th>
                                  <th class="text-center">Industry</th>
                                  <th class="text-center">Date</th>
                                  <th class="text-center">Status</th>
                                  <th class="text-center">View</th>
                                  
								  </tr>
								<?php 
								
			//echo "<pre>";
			//print_r($rsAllTicketsData);
			//echo "</pre>";								
								
								if(count($rsAllTicketsData)>0){
								for ($i=0;$i< count($rsAllTicketsData);$i++)
								{
									   if($i%2)
												$bgclass='altrow';
											else
												$bgclass='oddrow';
								
								?>
									<tr class="<?php echo $bgclass;?>" >
                                        <td class="text-center"><label name="No"><?php echo $i+1; ?></label></td>
                                        <td class="text-center"><label name="User ID"><?php echo $objUsers->fetchUserPhone($rsAllTicketsData[$i]['userid']);  ?></label></td>
                                        <td class="text-center"><label name="User ID">
										<?php 
										if($rsAllTicketsData[$i]['status'] == 'new') {
											echo $rsAllTicketsData[$i]['ticketuid'];
										}else{ 
											echo $rsAllTicketsData[$i]['ticketuid'];
											//echo $objUsers->fetchticketUid($rsAllTicketsData[$i]['parentid']);
										}
										$tktRootid = $objUsers->findRootTicketID($rsAllTicketsData[$i]['ticketid']) 
										?>
                                        
                                        </label>
                                        
                                        </td>
                                        <td class="text-center"><label name="Organization Name"><?php echo $objUsers->FetchOrganizationName($rsAllTicketsData[$i]['orgid']);  ?></label></td>
                                        <td class="text-center"><label name="Branch Name"><?php echo  $objUsers->FetchBranchName($rsAllTicketsData[$i]['branchid']); ?></label></td>
                                        <td class="text-center"><label name="Industry Name"><?php echo $objUsers->FetchIndustryName($rsAllTicketsData[$i]['indid']); ?></label></td>
                                         <td class="text-center"><label name="Date"><?php echo date("d-m-Y H:i A",strtotime($rsAllTicketsData[$i]['created_date'])); ?></label></td>
                                        <td class="text-center"><label name="User name"><?php echo $objUsers->fetchCurrentStatus($tktRootid);?></label></td>
                                        <td class="text-center">
                                        <label name="User type">
                                           <!--<button type="button" class="btn btn-success" data-toggle="modal" data-target="#model-<?php echo $i?>">View</button> -->
                                           <?php
										   	
											?>
                                           <a class="btn btn-success" href="tickets.html?v=view&tid=<?php echo $tktRootid;?>">View</a>
                                        </label>
                                        </td>
									</tr>
                                    
									<?php }
									}else{
									 ?>
										<tr class="altrow" > <td colspan="9" align="center"> </td> </tr>
										<tr class="oddrow"> <td colspan="9" align="center"> No any record found. </td> </tr>
										<tr class="altrow" > <td colspan="9" align="center"> </td> </tr>

									<?php } ?>
								 </tbody>
                                 </table>
                                 
					</div>
                    </div>
                    
                    <?php
						if(count($rsAllTicketsData) > 0 ) {
				?>
				<?php  // echo pagination_log($s,$perpage,$start,$nume,$totalpage,$pg,$v); ?>
				
				<?php
				}
				?>
                    </div>
                    
                    <?php } 
					else if($v =='view') {?>
                    
                    	<div class="row">
                                 <div class="col-md-12">
                                
                           
								  <div class="col-md-1 col-xs-3 col-sm-2 pull-left form-group no-padding ">
                                    <a class="btn btn-info btn-sm" href="tickets.html"> <i class="fa fa-long-arrow-left"></i> Back </a>
                                    </div>
                                    
                                  
                                  <div class="col-md-1 col-xs-6  pull-right text-right form-group no-padding">
                                    <a class="btn btn-sm btn-danger"  href="tickets.html?v=view&tid=<?php echo $tktid;?>"> <i class="fa fa-refresh"></i> Reset  </a> </div>
                                  <div class="col-md-1 col-xs-6 pull-right">
                </div>
                                    
                                  
                                    
								  	
                                
                                </div>
                                 </div>
                    	
                        <div class="row">
                        	<div class="col-md-12">
                            	<?php
									$rsMainTicketData = $objUsers->fetchTicketCreatedByData($tktid);
                                ?>
                                <div class="col-md-5" style="border-right:1px solid #ccc; min-height:500px;">
                                	
									<div class="manage-tickets">
									<fieldset>
												<legend>Current Ticket Details </legend>
                                   
                                      <div class="ticket-info">
                                        <p><strong>Ticket ID : </strong>  #<?php echo $rsMainTicketData[0]['ticketuid']; ?></p>
                                        <p><strong>Created Date : </strong>  <?php echo date("d-m-Y H:i A",strtotime($rsMainTicketData[0]['created_date'])); ?></p>
                                        <p><strong>Created By : </strong>  <?php echo $rsMainTicketData[0]['db_phone']; ?></p>
                                        <p><strong>Message : </strong>  <?php echo $rsMainTicketData[0]['message']; ?></p>
                                        <p><strong>For : </strong>  <?php echo $objUsers->fetchTicketForData($tktid); ?></p>
                                        <p><strong>Current status : </strong>  <?php echo $rsMainTicketData[0]['status']; ?></p>
                                   </div>
									</fieldset>
									</div>
                                    
                                    <div class="row">
            						<div class="col-md-12">&nbsp;</div>
                                    </div>
                                   <?php
									$rsEnableDisabled = $objUsers->checkEnableDisabled($tktid);
									if(count($rsEnableDisabled) > 0) {
                               	   ?>
                                                                       
                                    <form name="frmStatus" id="frmStatus" action="manage.php?pg=tickets&acn=updateTicket&tid=<?php echo $tktid?>" method="post">
                                    <input type="hidden" name="tid" value="<?php echo $tktid;?>" />
									
									<div class="manage-tickets">
									<fieldset>
										 <legend> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  </legend>
                                   
									
                                    <div class="manage-tickets-massage">
                                    
                                    <div class="row">
            						<div class="col-md-12">
                                        <div class="col-md-4"><strong>Select Status : </strong></div>
                                        <div class="col-md-8">
                                        <!--<input class="form-control input-md" type="text" maxlength="10" name="contact_number" id="contact_number" value="<?php echo $rsAllTicketsData[0]['db_phone']; ?>" > -->
                                        <select name="status" id="status" class="form-control">
                                        <?php foreach($statusArr as $key => $val)  {?>
                                        
                                        		<option <?php echo $key;?>><?php echo $val; ?></option>
                                            <?php } ?>
                                        </select>
                                            
                                        </div>
                					</div>
                                    </div>
                                    
                                    <div class="row">
            						<div class="col-md-12">&nbsp;</div>
                                    </div>
                                    
                                    <div class="row" style="height:120px" >
            						<div class="col-md-12">
                                        <div class="col-md-4"><strong>Reply Message : </strong></div>
                                        <div class="col-md-8">
                                        <!--<input class="form-control input-md" type="text" maxlength="10" name="contact_number" id="contact_number" value="<?php echo $rsAllTicketsData[0]['db_phone']; ?>" > -->
                                        <textarea name="message" id="txtarea-data" style="height:100px;" class="form-control input-md"></textarea>
                                        </div>
                					</div>
                                    </div>
                                    
                                    <div class="row">
                                        <div class="col-md-12">
                                            <button type="submit" onclick="javascript: return validateSubmit()" class="btn btn-primary pull-right">Save Now</button>
                                        </div>
                                    </div>
                                    
                                    
                                    </div>
                                </fieldset>
</div>

								 </form>
                                    <?php } ?>
                                    
                                    
                                </div>
                                <?php
									$rsMainTicketData = $objUsers->fetchTicketConversationData($tktid);
                                ?>
                                
                                
							<div class="col-md-7">
							
							
							
							
							<div class="manage-tickets">
									<fieldset>
												<legend>Conversation Details  </legend>
												
												
                               
                                
                                <?php
								if(count($rsMainTicketData) > 0){ 
								
								for($c=0; $c<count($rsMainTicketData); $c++) {
								?>
                                
                                <div class="row">
                                    <div class="col-md-12">
                                        <p><strong>Message on <?php echo $rsMainTicketData[$c]['status']?> : </strong>  <?php echo $rsMainTicketData[$c]['message']; ?></p>
                                        <p><strong>Message By : </strong>  <?php echo $objUsers->FetchUserDetailsAll($rsMainTicketData[$c]['userid'],"");  ?></p>
                                        <p><strong>Date : </strong>  <?php  echo date("d-m-Y H:i A",strtotime($rsMainTicketData[$c]['created_date'])); ?></p>
                                        <p><strong>Status : </strong>  <?php echo $rsMainTicketData[$c]['status']; ?></p>
                                        
                                        <hr />
                                    </div>
                                </div>
                                
										
								<?php } // end for
								
								}else{ ?>
										<div class="row">
                                            <div class="col-md-12 conversation-details" style=" min-height:522px;">
                                            No any conversation data found.
											   
                                            </div>
                                        </div>
								<?php }
                                ?>
								
								</fieldset>
                                </div>
                                </div>
							
                            
                            </div>
							
							
							
                        </div>
                    
                    
                    <?php } ?>
                    
				
				</div>
   			 </div>
  	  		</div>
    	</div>
    </div>
       
    </section>

<? } ?>  
</div>

<script>
	function validateSubmit(){
		var txt = document.getElementById('txtarea-data');
		if(txt.value.trim() == ""){
			txt.style.border = "2px solid red";
			txt.focus();
			return false;
		}
		
		if(!confirm('Are you sure to submit ticket ?'))
		return false;
		
	}
</script>