<?php
    include('include_self.php');
    
    $row = $mecanik->getHistoryByStatus(1);
 	if(count($row)>0)
 	{
 		foreach($row as $row)
 		{
 		
 			$row1=$mecanik->getDriverById($row["d_id"]);
			foreach($row1 as $row1){
			 	$driver = $row1["d_name"];
			}
			
			$row1=$mecanik->getCarById($row["c_id"]);
			foreach($row1 as $row1){
			 	$car = $row1["car_marca"]." / ".$row1["car_color"]." / ".$row1["car_placa"];
			}
			
			$row1=$mecanik->getCarIssuebyId($row["ci_id"]);
			foreach($row1 as $row1){
			 	$issue_name = $row1["ci_name"];
			 	$issue_image = $row1["ci_image"];
			}
			
			$detail = "Servicio: ".$issue_name." Detalles de ubicacion: ".$row['dh_desc'];
			
			$message = "Conductor: ".$driver." Vehiculo:".$car." Problema:".$detail;
			
			$row1 = $mecanik->getGarageActive();
			if(count($row1)>0)
			{
			    foreach($row1 as $row1)
			    {
			        $tokens[] = $row1['g_token'];
			        $tokens[] = $row1['g_token2'];
			    }
			}
			
			if(count($tokens)>0)
			{
			    $obj->send_notification($tokens, $obj->getParamById(3), $message);
			}
			
			
 		}
 		
 	}
?>