Merge branch '463-resq-message-prompt-for-non-serviceable-area' into '465-resq-august-13-release'
Resolve "Resq - message prompt for non-serviceable area" See merge request jankstudio/resq!542
This commit is contained in:
commit
71b70d0c5a
3 changed files with 39 additions and 0 deletions
|
|
@ -262,3 +262,8 @@ jo_cancel_reasons:
|
|||
path: /ajax/jo_cancel_reasons
|
||||
controller: App\Controller\JobOrderController::cancelReasons
|
||||
methods: [GET]
|
||||
|
||||
jo_geofence:
|
||||
path: /ajax/job-order/geofence
|
||||
controller: App\Controller\JobOrderController::checkGeofence
|
||||
methods: [GET]
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ use App\Service\MapTools;
|
|||
use App\Service\MQTTClient;
|
||||
use App\Service\APNSClient;
|
||||
use App\Service\InventoryManager;
|
||||
use App\Service\GeofenceTracker;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
|
@ -1186,6 +1187,19 @@ class JobOrderController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
// ajax call
|
||||
public function checkGeofence(Request $req, GeofenceTracker $geo)
|
||||
{
|
||||
$lat = $req->query->get('lat');
|
||||
$lng = $req->query->get('lng');
|
||||
|
||||
$is_covered = $geo->isCovered($lng, $lat);
|
||||
|
||||
return $this->json([
|
||||
'is_covered' => $is_covered
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="jo_autoassign")
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1012,6 +1012,26 @@ $(function() {
|
|||
|
||||
function selectPoint(lat, lng)
|
||||
{
|
||||
// check if point is in coverage area
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: "{{ url('jo_geofence') }}",
|
||||
data: {
|
||||
'lat': lat,
|
||||
'lng': lng
|
||||
}
|
||||
}).done(function(response) {
|
||||
if (response.is_covered === false)
|
||||
{
|
||||
console.log('Not in coverage area');
|
||||
swal({
|
||||
title: 'Warning!',
|
||||
text: 'Our service is limited to some areas in Metro Manila, Laguna, and Baguio only. We will update you as soon as we are able to cover your area',
|
||||
type: 'warning',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// clear markers
|
||||
markerLayerGroup.clearLayers();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue