Add one step job order process form #270
This commit is contained in:
parent
a21d0509fd
commit
51850d0230
11 changed files with 1681 additions and 44 deletions
|
|
@ -242,6 +242,8 @@ access_keys:
|
||||||
label: Edit
|
label: Edit
|
||||||
- id: joborder.cancel
|
- id: joborder.cancel
|
||||||
label: Cancel
|
label: Cancel
|
||||||
|
- id: jo_onestep.form
|
||||||
|
label: One-step Process
|
||||||
|
|
||||||
- id: support
|
- id: support
|
||||||
label: Customer Support Access
|
label: Customer Support Access
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,10 @@ main_menu:
|
||||||
acl: joborder.menu
|
acl: joborder.menu
|
||||||
label: Job Order
|
label: Job Order
|
||||||
icon: flaticon-calendar-3
|
icon: flaticon-calendar-3
|
||||||
|
- id: jo_onestep_form
|
||||||
|
acl: jo_onestep.form
|
||||||
|
label: One-step Process
|
||||||
|
parent: joborder
|
||||||
- id: jo_in
|
- id: jo_in
|
||||||
acl: jo_in.list
|
acl: jo_in.list
|
||||||
label: Incoming
|
label: Incoming
|
||||||
|
|
|
||||||
|
|
@ -34,3 +34,7 @@ hub_delete:
|
||||||
controller: App\Controller\HubController::destroy
|
controller: App\Controller\HubController::destroy
|
||||||
methods: [DELETE]
|
methods: [DELETE]
|
||||||
|
|
||||||
|
hub_nearest:
|
||||||
|
path: /ajax/nearest_hubs
|
||||||
|
controller: App\Controller\HubController::nearest
|
||||||
|
methods: [GET]
|
||||||
|
|
|
||||||
|
|
@ -175,3 +175,13 @@ jo_reject_hub:
|
||||||
path: /job-order/{id}/reject-hub
|
path: /job-order/{id}/reject-hub
|
||||||
controller: App\Controller\JobOrderController::rejectHubSubmit
|
controller: App\Controller\JobOrderController::rejectHubSubmit
|
||||||
methods: [POST]
|
methods: [POST]
|
||||||
|
|
||||||
|
jo_onestep_form:
|
||||||
|
path: /job-order/onestep
|
||||||
|
controller: App\Controller\JobOrderController::oneStepForm
|
||||||
|
methods: [GET]
|
||||||
|
|
||||||
|
jo_onestep_submit:
|
||||||
|
path: /job-order/onestep
|
||||||
|
controller: App\Controller\JobOrderController::oneStepSubmit
|
||||||
|
methods: [POST]
|
||||||
|
|
|
||||||
|
|
@ -295,3 +295,40 @@ span.has-danger,
|
||||||
.btn-icon {
|
.btn-icon {
|
||||||
margin-right: .5em;
|
margin-right: .5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.marker-pin {
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
border-radius: 50% 50% 50% 0;
|
||||||
|
background: #c30b82;
|
||||||
|
position: absolute;
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
margin: -15px 0 0 -15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.marker-pin::after {
|
||||||
|
content: '';
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
margin: 3px 0 0 3px;
|
||||||
|
background: #fff;
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.map-div-icon i {
|
||||||
|
position: absolute;
|
||||||
|
width: 22px;
|
||||||
|
font-size: 22px;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
margin: 10px auto;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.map-div-icon i.awesome {
|
||||||
|
margin: 12px auto;
|
||||||
|
font-size: 17px;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@ use DateTime;
|
||||||
|
|
||||||
use Catalyst\MenuBundle\Annotation\Menu;
|
use Catalyst\MenuBundle\Annotation\Menu;
|
||||||
|
|
||||||
|
use App\Service\MapTools;
|
||||||
|
|
||||||
class HubController extends Controller
|
class HubController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
@ -287,4 +289,35 @@ class HubController extends Controller
|
||||||
$response->setStatusCode(Response::HTTP_OK);
|
$response->setStatusCode(Response::HTTP_OK);
|
||||||
$response->send();
|
$response->send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function nearest(MapTools $map_tools, Request $req)
|
||||||
|
{
|
||||||
|
// get lat / long
|
||||||
|
$lat = $req->query->get('lat');
|
||||||
|
$long = $req->query->get('long');
|
||||||
|
|
||||||
|
// get nearest hubs according to position
|
||||||
|
$point = new Point($long, $lat);
|
||||||
|
$result = $map_tools->getClosestHubs($point, 10, date("H:i:s"));
|
||||||
|
|
||||||
|
$hubs = [];
|
||||||
|
foreach ($result as $hub_res)
|
||||||
|
{
|
||||||
|
$hub = $hub_res['hub'];
|
||||||
|
$coords = $hub->getCoordinates();
|
||||||
|
$hubs[] = [
|
||||||
|
'id' => $hub->getID(),
|
||||||
|
'long' => $coords->getLongitude(),
|
||||||
|
'lat' => $coords->getLatitude(),
|
||||||
|
'label' => $hub->getFullName(),
|
||||||
|
'name' => $hub->getName(),
|
||||||
|
'branch' => $hub->getBranch(),
|
||||||
|
'cnum' => $hub->getContactNumbers(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->json([
|
||||||
|
'hubs' => $hubs,
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,8 +66,7 @@ class JobOrderController extends Controller
|
||||||
/**
|
/**
|
||||||
* @Menu(selected="jo_in")
|
* @Menu(selected="jo_in")
|
||||||
*/
|
*/
|
||||||
public function openEditForm($id, JobOrderHandlerInterface $jo_handler,
|
public function openEditForm($id, JobOrderHandlerInterface $jo_handler, GISManagerInterface $gis)
|
||||||
GISManagerInterface $gis)
|
|
||||||
{
|
{
|
||||||
$this->denyAccessUnlessGranted('jo_open.edit', null, 'No access.');
|
$this->denyAccessUnlessGranted('jo_open.edit', null, 'No access.');
|
||||||
|
|
||||||
|
|
@ -287,8 +286,7 @@ class JobOrderController extends Controller
|
||||||
/**
|
/**
|
||||||
* @Menu(selected="jo_proc")
|
* @Menu(selected="jo_proc")
|
||||||
*/
|
*/
|
||||||
public function processingForm(MapTools $map_tools, $id, JobOrderHandlerInterface $jo_handler,
|
public function processingForm(MapTools $map_tools, $id, JobOrderHandlerInterface $jo_handler, GISManagerInterface $gis)
|
||||||
GISManagerInterface $gis)
|
|
||||||
{
|
{
|
||||||
$this->denyAccessUnlessGranted('jo_proc.list', null, 'No access.');
|
$this->denyAccessUnlessGranted('jo_proc.list', null, 'No access.');
|
||||||
|
|
||||||
|
|
@ -822,4 +820,22 @@ class JobOrderController extends Controller
|
||||||
'request' => $req->request->all()
|
'request' => $req->request->all()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Menu(selected="jo_onestep_form")
|
||||||
|
*/
|
||||||
|
public function oneStepForm(JobOrderHandlerInterface $jo_handler, GISManagerInterface $gis)
|
||||||
|
{
|
||||||
|
$this->denyAccessUnlessGranted('jo_onestep.form', null, 'No access.');
|
||||||
|
|
||||||
|
$params = $jo_handler->initializeOneStepForm();
|
||||||
|
$params['submit_url'] = $this->generateUrl('jo_onestep_submit');
|
||||||
|
$params['return_url'] = $this->generateUrl('jo_onestep_form');
|
||||||
|
$params['map_js_file'] = $gis->getJSJOFile();
|
||||||
|
|
||||||
|
$template = $params['template'];
|
||||||
|
|
||||||
|
// response
|
||||||
|
return $this->render($template, $params);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1103,6 +1103,21 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
return $params;
|
return $params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function initializeOneStepForm()
|
||||||
|
{
|
||||||
|
$params['obj'] = new JobOrder();
|
||||||
|
$params['mode'] = 'onestep';
|
||||||
|
|
||||||
|
$this->fillDropdownParameters($params);
|
||||||
|
$this->fillFormTags($params);
|
||||||
|
|
||||||
|
// get template to display
|
||||||
|
$params['template'] = $this->getTwigTemplate('jo_onestep');
|
||||||
|
|
||||||
|
// return params
|
||||||
|
return $params;
|
||||||
|
}
|
||||||
|
|
||||||
// initialize open edit job order form
|
// initialize open edit job order form
|
||||||
public function initializeOpenEditForm($id)
|
public function initializeOpenEditForm($id)
|
||||||
{
|
{
|
||||||
|
|
@ -2022,6 +2037,10 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
$this->template_hash = [];
|
$this->template_hash = [];
|
||||||
|
|
||||||
// add all twig templates for job order to hash
|
// add all twig templates for job order to hash
|
||||||
|
// TODO: put this in an array declaration
|
||||||
|
// $this->template_hash = [
|
||||||
|
// 'blah' => 'blah',
|
||||||
|
// ];
|
||||||
$this->template_hash['jo_incoming_form'] = 'job-order/form.html.twig';
|
$this->template_hash['jo_incoming_form'] = 'job-order/form.html.twig';
|
||||||
$this->template_hash['jo_open_edit_form'] = 'job-order/form.html.twig';
|
$this->template_hash['jo_open_edit_form'] = 'job-order/form.html.twig';
|
||||||
$this->template_hash['jo_incoming_vehicle_form'] = 'job-order/form.html.twig';
|
$this->template_hash['jo_incoming_vehicle_form'] = 'job-order/form.html.twig';
|
||||||
|
|
@ -2036,6 +2055,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
$this->template_hash['jo_list_fulfillment'] = 'job-order/list.fulfillment.html.twig';
|
$this->template_hash['jo_list_fulfillment'] = 'job-order/list.fulfillment.html.twig';
|
||||||
$this->template_hash['jo_list_open'] = 'job-order/list.open.html.twig';
|
$this->template_hash['jo_list_open'] = 'job-order/list.open.html.twig';
|
||||||
$this->template_hash['jo_list_all'] = 'job-order/list.all.html.twig';
|
$this->template_hash['jo_list_all'] = 'job-order/list.all.html.twig';
|
||||||
|
$this->template_hash['jo_onestep'] = 'job-order/form.onestep.html.twig';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function checkTier($tier)
|
protected function checkTier($tier)
|
||||||
|
|
|
||||||
|
|
@ -2,43 +2,6 @@
|
||||||
|
|
||||||
{% block stylesheets %}
|
{% block stylesheets %}
|
||||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" crossorigin=""/>
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" crossorigin=""/>
|
||||||
<style type="text/css">
|
|
||||||
.marker-pin {
|
|
||||||
width: 30px;
|
|
||||||
height: 30px;
|
|
||||||
border-radius: 50% 50% 50% 0;
|
|
||||||
background: #c30b82;
|
|
||||||
position: absolute;
|
|
||||||
transform: rotate(-45deg);
|
|
||||||
left: 50%;
|
|
||||||
top: 50%;
|
|
||||||
margin: -15px 0 0 -15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.marker-pin::after {
|
|
||||||
content: '';
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
margin: 3px 0 0 3px;
|
|
||||||
background: #fff;
|
|
||||||
position: absolute;
|
|
||||||
border-radius: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-div-icon i {
|
|
||||||
position: absolute;
|
|
||||||
width: 22px;
|
|
||||||
font-size: 22px;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
margin: 10px auto;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-div-icon i.awesome {
|
|
||||||
margin: 12px auto;
|
|
||||||
font-size: 17px;
|
|
||||||
</style>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
|
|
|
||||||
1548
templates/job-order/form.onestep.html.twig
Normal file
1548
templates/job-order/form.onestep.html.twig
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -33,19 +33,19 @@ function mapCreate(div_id, center_lat, center_lng, map_type, zoom) {
|
||||||
|
|
||||||
// create icons
|
// create icons
|
||||||
var icon_rider_active_jo = L.divIcon({
|
var icon_rider_active_jo = L.divIcon({
|
||||||
className: 'custom-div-icon',
|
className: 'map-div-icon',
|
||||||
html: "<div style='background-color:#FF0000;' class='marker-pin'></div><i class='fa fa-bolt awesome'>",
|
html: "<div style='background-color:#FF0000;' class='marker-pin'></div><i class='fa fa-bolt awesome'>",
|
||||||
iconSize: [39, 42],
|
iconSize: [39, 42],
|
||||||
iconAnchor: [15, 42]
|
iconAnchor: [15, 42]
|
||||||
});
|
});
|
||||||
var icon_rider_available = L.divIcon({
|
var icon_rider_available = L.divIcon({
|
||||||
className: 'custom-div-icon',
|
className: 'map-div-icon',
|
||||||
html: "<div style='background-color:#00FF00;' class='marker-pin'></div><i class='fa fa-bolt awesome'>",
|
html: "<div style='background-color:#00FF00;' class='marker-pin'></div><i class='fa fa-bolt awesome'>",
|
||||||
iconSize: [39, 42],
|
iconSize: [39, 42],
|
||||||
iconAnchor: [15, 42]
|
iconAnchor: [15, 42]
|
||||||
});
|
});
|
||||||
var icon_customer = L.divIcon({
|
var icon_customer = L.divIcon({
|
||||||
className: 'custom-div-icon',
|
className: 'map-div-icon',
|
||||||
html: "<div style='background-color:#0055FF;' class='marker-pin'></div><i class='fa fa-user awesome'>",
|
html: "<div style='background-color:#0055FF;' class='marker-pin'></div><i class='fa fa-user awesome'>",
|
||||||
iconSize: [39, 42],
|
iconSize: [39, 42],
|
||||||
iconAnchor: [15, 42]
|
iconAnchor: [15, 42]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue