<?php
if (empty($VehicleInfo)) { ?>
<div class="alert alert-danger" role="alert">
    <button class="close" data-dismiss="alert"></button>
    <strong>Danger: </strong>you can not edit this vehicle! 
    <br>
    This vehicle is not available.
</div>
<?php die(); }
if($permissions->hasPermission('EditVehicle')){
    include("Views/Garage/EditVehicle.php");
}
?>
<style>
    .b-r {
        border-left-width: 1px;
    }
    .bg-master-lighter {
        border:none;
        background-color:#fff;
        border-top:1px solid #ddd;  
    }
</style>
<div class="wrapper">
    <div class="panel invoice">
        <div class="panel-body">
            <input type="hidden" value="<?php echo !empty($_GET['modal']) ? 1 : 0 ;?>" id="is_modal_shown"/>
            <div class="row">
                <?php
                if($permissions->hasPermission('EditVehicle')){  ?>
                <a href="#" class="mainPageLinks" data-toggle="modal" data-target="#EditVehicle" ><button type='button' class='btn btn-bg-success-darker pull-right' ><i class='fa fa-pencil'></i> <?php print CommonLanguage::getMessage('Edit');?></button></a>
                <?php }?>
                <h3 class="semi-bold"><?php print CommonLanguage::getMessage('vehicle_info');?></h3>
                <div class="col-md-12 b-r b-dashed " id="MaterialDetails">
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('Code');?></label>
                            <div class="col-sm-4 "> <?php echo $VehicleInfo[0]["Vehicle_Code"] ; ?></div>
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('make_name');?></label>
                            <div class="col-sm-4 " ><?php echo $VehicleInfo[0]["Vehicle_Type_Name"] ; ?></div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('driver_name');?></label>
                            <div class="col-sm-4"> <?php echo $VehicleInfo[0]["driver_name"] ; ?></div>
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('driver_phone');?></label>
                            <div class="col-sm-4" ><?php echo $VehicleInfo[0]["driver_phone"] ; ?></div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('owner_name');?></label>
                            <div class="col-sm-4"> <?php echo $VehicleInfo[0]["owner_name"] ; ?></div>
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('note');?></label>
                            <div class="col-sm-4"><?php echo $VehicleInfo[0]["note"] ; ?></div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('insurance_next_date');?></label>
                            <div class="col-sm-4"> <?php echo $VehicleInfo[0]["insurance_date"] ; ?></div>
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('insurance_company');?></label>
                            <div class="col-sm-4"><?php echo $VehicleInfo[0]["insurance_company"] ; ?></div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('model');?></label>
                            <div class="col-sm-4 Vehicle_Model_ID" data-id="<?php echo $VehicleInfo[0]["Vehicle_Model_ID"] ; ?>" ><?php echo $VehicleInfo[0]["Model_Name"] ; ?></div>
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('color');?></label>
                            <div class="col-sm-4 Vehicle_Color_ID" data-id="<?php echo $VehicleInfo[0]["Vehicle_Color_ID"] ; ?>"><?php echo $VehicleInfo[0]["Color_Name"] ; ?></div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('reg_nb');?></label>
                            <div class="col-sm-4 Vehicle_Registration_Number"><?php echo $VehicleInfo[0]["Vehicle_Registration_Number"]; ?></div>
                            <label class="col-sm-2 control-label">Fuel Tank Volume<?php print CommonLanguage::getMessage('Edit');?></label>
                            <div class="col-sm-4 Vehicle_Fuel_Tank_Volume"><?php echo $VehicleInfo[0]["Vehicle_Fuel_Tank_Volume"].' '.CommonLanguage::getMessage('L') ; ?> </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('fuel_type');?></label>
                            <div class="col-sm-4 Vehicle_Fuel_Type_ID" data-id="<?php echo $VehicleInfo[0]["Vehicle_Fuel_Type_ID"] ; ?>"><?php echo $VehicleInfo[0]["Fuel_Type_Name"] ; ?></div>
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('vehicle_usage_type');?> </label>
                            <div class="col-sm-4 Vehicle_Usage_Type_ID" data-id="<?php echo $VehicleInfo[0]["Vehicle_Usage_Type_ID"] ; ?>"><?php echo $VehicleInfo[0]["Usage_Type_Name"]; ?></div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('maintenance_period');?></label>
                            <div class="col-sm-4 Vehicle_Maintenance_Period"><?php echo $VehicleInfo[0]["Vehicle_Maintenance_Period"].' '.CommonLanguage::getMessage('km') ; ?></div>
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('start_usage_date');?></label>
                            <div class="col-sm-4 Vehicle_Start_Usage_Date"><?php echo $VehicleInfo[0]["Vehicle_Start_Usage_Date"] ; ?></div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('tracking_nb');?></label>
                            <div class="col-sm-4 Vehicle_Tracking_Number"><?php echo $VehicleInfo[0]["Vehicle_Tracking_Number"] ; ?></div>
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('fuel_per_km');?></label>
                            <div class="col-sm-4 Vehicle_Fuel_Consumption"><?php echo $VehicleInfo[0]["Vehicle_Fuel_Consumption"].' '.CommonLanguage::getMessage('L') ; ?></div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('oil_exchange');?></label>
                            <div class="col-sm-4 Vehicle_Oil_Change"><?php echo $VehicleInfo[0]["Vehicle_Oil_Change"].' '.CommonLanguage::getMessage('km') ; ?></div>
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('mecanique');?></label>
                            <div class="col-sm-4 Vehicle_Oil_Change"><?php echo $VehicleInfo[0]["mecanique_month"] ; ?></div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('driver');?></label>
                            <div class="col-sm-4 driver_emp_id"><?php echo $VehicleInfo[0]["Employee_Name"] ; ?></div>
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('zone');?></label>
                            <div class="col-sm-4 zone_id"><?php echo $VehicleInfo[0]["Zone_Name"] ; ?></div>
                        </div>
                    </div>
                </div>
            </div>
            <br>
        </div>
    </div>
</div>
<script>
    $(function(){
        if($('#is_modal_shown').val() == 1)
            $('#EditVehicle').modal('show');
    });
</script>
