172 lines
5.9 KiB
PHP
172 lines
5.9 KiB
PHP
<!-- Main content -->
|
|
<div class="content-wrapper">
|
|
<!-- Dashboard content -->
|
|
<div class="row">
|
|
<div class="col-lg-6">
|
|
<!-- Daily sales -->
|
|
<div class="panel panel-flat">
|
|
<div class="panel-heading">
|
|
<div class="text-right">
|
|
<button type="button" class="btn btn-info btn-xs" onclick="addNewDriver(0,<?= $_SESSION['agent_id'] ?>);" >Add New Driver</button>
|
|
</div>
|
|
</div>
|
|
<div class="table-responsive">
|
|
<table class="table text-nowrap">
|
|
<thead>
|
|
<tr>
|
|
<th>My Transport Drivers</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
|
|
<?
|
|
foreach ($result_list as $rect) {
|
|
?>
|
|
<tr>
|
|
<td>
|
|
<div class="media-body">
|
|
<div class="heading">
|
|
<b><?= $rect['firstname'] ?> <?= $rect['lastname'] ?></b>,<br> <?= $rect['street'] ?>,<br><?= $rect['city'] ?>,<?= $rect['state'] ?> <?= $rect['zipcode'] ?>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<td style="width:60px;">
|
|
|
|
<div class="btn-group btn-group-xs" role="group">
|
|
<button type="button" class="btn btn-info" onclick="editDriver(<?= $rect['driver_id'] ?>,<?= $rect['agent_id'] ?>);" >Edit</button>
|
|
</div>
|
|
|
|
</td>
|
|
</tr>
|
|
<?
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
<!-- /daily sales -->
|
|
|
|
</div>
|
|
|
|
<div class="col-lg-6">
|
|
<!-- Daily sales -->
|
|
<div class="panel panel-flat">
|
|
<div class="panel-heading">
|
|
<h6 class="panel-title">Manage Drivers</h6>
|
|
<div class="heading-elements">
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="panel-body">
|
|
<div id="action_panel_driver" style="display:none;"></div>
|
|
<div id="action_panel">
|
|
<?= $message ?>
|
|
<form class="form-horizontal form-validate-jquery" method="post" action="?">
|
|
<? include 'extra/driver_form.php'; ?>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- /daily sales -->
|
|
|
|
</div>
|
|
</div>
|
|
<!-- /dashboard content -->
|
|
</div>
|
|
<!-- /main content -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
<!--
|
|
var driver_saved = false;
|
|
|
|
function addNewDriver() {
|
|
if (driver_saved) {
|
|
$('#action_panel').html($('#action_panel_driver').html());
|
|
driver_saved = false;
|
|
$('#action_panel_driver').html('Error');
|
|
}
|
|
$('#driver_name').html('Add New Driver');
|
|
$('#lic_number').val('');
|
|
$('#lic_state').val('GA');
|
|
$('#driver_id').val('0');
|
|
$('#expr_month').val('');
|
|
$('#expr_year').val('');
|
|
$('#firstname').val('');
|
|
$('#lastname').val('');
|
|
$('#phone').val('');
|
|
$('#street').val('');
|
|
$('#city').val('');
|
|
$('#state').val('GA');
|
|
$('#zipcode').val('');
|
|
$('#email').val('');
|
|
return false;
|
|
}
|
|
|
|
function editDriver(driver_id, agent) {
|
|
if (confirm("Continue editing the selected driver?")) {
|
|
// do something
|
|
if (driver_saved) {
|
|
$('#action_panel').html($('#action_panel_driver').html());
|
|
driver_saved = false;
|
|
$('#action_panel_driver').html('Error');
|
|
}
|
|
$.ajax({
|
|
url: "/transp/drivers_load?driver_id=" + driver_id + "&agent_id=" + agent
|
|
}).done(function (data) {
|
|
loc = JSON.parse(data)
|
|
if (loc.status == "OK") {
|
|
var driver = loc.result_list[0];
|
|
$('#driver_name').html('EDIT: ' + driver.lic_number + ' = ' + driver.driver_id);
|
|
$('#driver_id').val(driver.driver_id);
|
|
$('#lic_number').val(driver.lic_number);
|
|
$('#lic_state').val(driver.lic_state);
|
|
$('#expr_month').val(driver.expr_month);
|
|
$('#expr_year').val(driver.expr_year);
|
|
$('#firstname').val(driver.firstname);
|
|
$('#lastname').val(driver.lastname);
|
|
$('#phone').val(driver.phone);
|
|
$('#street').val(driver.street);
|
|
$('#city').val(driver.city);
|
|
$('#state').val(driver.state);
|
|
$('#zipcode').val(driver.zipcode);
|
|
$('#email').val(driver.email);
|
|
} else {
|
|
alert('Failed to load driver!');
|
|
addNewDriver();
|
|
}
|
|
});
|
|
}
|
|
return false;
|
|
}
|
|
function configureLocation(line_id, agent) {
|
|
if (confirm("Are you sure you want continue configure ?")) {
|
|
// do something
|
|
} else {
|
|
return false;
|
|
}
|
|
|
|
$('#accs' + line_id).prop('disabled', true);
|
|
$.ajax({
|
|
url: "/transp/cfglocation?proc=DETAIL&tranlator_id=" + line_id + "&agent_id" + agent
|
|
}).done(function (data) {
|
|
$('#action_panel').html(data);
|
|
$('#accs' + line_id).prop('disabled', false);
|
|
});
|
|
|
|
|
|
|
|
return false;
|
|
}
|
|
|
|
// -->
|
|
</script>
|