<?php
	include(__DIR__.'/../includes/sysinit.php');
	$html	= "";
	if ($_POST['input_id'])
	{					
		$concat 	= '"[", spares_part_no, "] ", spares_name ';
		$sql		= '	select spares_id as VAL, concat('.$concat.') as DESCR 
						from spares ';
		$sql		.=' where (spares_name like "%'.$_POST['input_id'].'%") or (spares_part_no like "%'.$_POST['input_id'].'%")
						order by spares_name';			
		$rows = $sableDB->getRows($sql);
		foreach($rows as $row) 
		{
			$html .= '<option value="'.$row['VAL'].'">'.$row['DESCR'].'</option>';
		}
	}
	$data['output_list'] = $html;
	SableSystem::ajaxFillField($html, $_POST['field_id']);