<?php
require(DIR_WS_CLASSES.'awb_numbers.php');
$lang_file = sprintf('%slang/%s/admin/awb_numbers.php',DIR_FS_CATALOG,$_SESSION['language']);
require($lang_file);
$id = xtc_db_input($_GET['id']);
$awb_numbers = new awb_numbers();
$awb_number = $awb_numbers->get_awb_number($id);

switch($_GET['action']){
	case 'delete_confirm':
		$smarty->assign('BOX_TITLE', $awb_number->data->awb_number );
		$contents = array();
		$contents[] = array('align'=>'center','text' => DELETE_ENTRY );
		$contents[] = array('align'=>'center','text' => yes_draw_href_button(IMAGE_DELETE,xtc_href_link(FILENAME_AWB_NUMBERS,xtc_get_all_get_params(array('action')).'action=delete'),$access='func_awb_numbers_delete','width:100px;').'&nbsp;'.yes_draw_href_button(IMAGE_CANCEL,"javascript:ajax_box_action('".$id."','');",$access='awb_numbers','width:100px;') );

		break;
	case 'edit':
		$smarty->assign('BOX_TITLE', $awb_number->data->awb_number );
        $contents = array('form' => xtc_draw_form('edit_awb', FILENAME_AWB_NUMBERS, xtc_get_all_get_params(array('action')).'action=update', 'post'));
        $contents[] = array('text' => AWB_EDIT_INTRO);

        $contents[] = array('text' => '<br />' . TEXT_EDIT_BOOKING_HINT . '<br />' .
			xtc_draw_input_field('booking_hint', $awb_number->data->booking_hint, 'size="24" maxlength="255"'));
		$contents[] = array('align' => 'center', 'text' => yes_draw_href_button(IMAGE_UPDATE,'','func_awb_numbers_delete','width:100px;','submit').
			'&nbsp;'.yes_draw_href_button(IMAGE_CANCEL,xtc_href_link(FILENAME_AWB_NUMBERS,xtc_get_all_get_params(array('action','aID')).'aID='.$awb_number->data->airlines_id),'func_awb_numbers_delete','width:100px;')
		);

		break;
	default:
		$smarty->assign('BOX_TITLE', $awb_number->data->awb_number );
		$contents = array();
		$contents[] = array('align'=>'center','text' => yes_draw_href_button(IMAGE_EDIT,"javascript:ajax_box_action('".$id."','edit');",$access='awb_numbers_edit','width:180px;') );
		$contents[] = array('align'=>'center','text' => yes_draw_href_button(IMAGE_DELETE,"javascript:ajax_box_action('".$id."','delete_confirm');",$access='func_awb_numbers_delete','width:180px;') );
		if(!empty($awb_number->data->booking_hint)){
			$contents[] = array('text' => '<br />'.$awb_number->data->booking_hint );
		}
		break;
}

$box = new box;
$smarty->assign('BOX_CONTENT', $box->infoBox($contents) );

