<form>
<div class="panel-heading">
    <h6 class="panel-title">Note: When you assigned a transporter. The transporter will still have to confirm or be confirmed for the transport to be ready for service delivery. </h6>                   
</div>
<div class="table-responsive">
    <table class="table text-stripped">
        <tbody>
            <tr>
                <td style="width: 120px">
                    <b>Assign Transporter :</b>
                </td>
                <td> 
                    <table class="table text-stripped">
                        <tr>
                            <td style="width: 20px;"><input type="radio" id="optradio1" name="optradio" value="recomended" onchange="return OptRadioChanged(this,1);"></td>
                            <td>
                               <?= $recomended_list ?>
                            </td>
                            <td style="width: 80px;">
                                <button type="button" name="buttonPendingFormAssignRecomended" class="btn btn-info btn-xs" onclick="return PendingFormAssignRecomended(this);">Assign</button>
                            </td>
                        </tr>

                        <tr>
                            <td > <input type="radio" name="optradio" value="search" onchange="return OptRadioChanged(this,2);"></td>
                            <td>
                                <?= $search_list ?>
                            </td>
                            <td>
                                <button type="button" name="buttonPendingFormAssignSearch" class="btn btn-info btn-xs" onclick="return PendingFormAssignSearch(this);">Assign</button>
                            </td>
                        </tr>
                        
                         <tr>
                            <td colspan="3"> 
                                Based on selection - the distance of transport to the origin will be computer dynamically - to be implemented later.
                            </td>
                        </tr>
                        
                    </table>
                </td>
            </tr>   

            <tr>
                <td >
                    <b>Translator :</b>
                </td>
                <td> 
                    Yes <b>Language :</b> French - THIS SECTION WILL BE IMPLENETED - STILL PENDING  
            </tr>  

   <tr>
                <td >
                    <b>Cancel Request :</b>
                </td>
                <td> 
                    <table class="table text-nowrap"><tr><td><?=$cancel_reason_combo?></td><td style="width: 100px;"><button type="button" class="btn btn-warning">Cancel</button> </td></tr>   </table> 
            </tr>  

            


        </tbody>
    </table>
</div>
</form>
<script type="text/javascript">
<!--
function OptRadioChanged(control,which) {
	//alert(control.checked+"/"+which);
	control.form.buttonPendingFormAssignRecomended.disabled = which==1 ? false : true;
	control.form.buttonPendingFormAssignSearch.disabled = which==1 ? true : false;
	control.form.recomended_list.disabled = which==1 ? false : true;
	control.form.search_list.disabled = which==1 ? true : false;	
	return true;
}
function PendingFormAssignRecomended(button) {
	var transport_id = '<?= $rect["id"] ?>';
  var transporter_id = button.form.recomended_list.value;
	if (transporter_id<1) {
		alert('Please select transporter');
		return false;
	}
	//$('#transp_detail').html('Processing...');
	button.disabled = true;
	$.ajax({
		url: "/transp/assignTranspoter?transport_id=" + transport_id + "&transporter_id=" + transporter_id
	}).done(function (data) {
		button.disabled = false;
		if (data=='0') {
			alert('Transporter was set');
			processPendTransp(transport_id);
		}
		//$('#transp_detail').html(data);         
	});
  return false;
}
function PendingFormAssignSearch(button) {
	var transport_id = '<?= $rect["id"] ?>';
  var transporter_id = button.form.search_list.value;
	if (transporter_id<1) {
		alert('Please select transporter');
		return false;
	}
	//$('#transp_detail').html('Processing...');
	button.disabled = true;
	$.ajax({
		url: "/transp/assignTranspoter?transport_id=" + transport_id + "&transporter_id=" + transporter_id
	}).done(function (data) {
		button.disabled = false;
		if (data=='0') {
			alert('Transporter was set');
			processPendTransp(transport_id);
		}
		//$('#transp_detail').html(data);         
	});

  return false;
}
var optradio = document.getElementById('optradio1');
optradio.checked = true;
OptRadioChanged(optradio,1);
// -->
</script>
<!--
vi:ts=2
-->
