Skip to content
This repository has been archived by the owner on Apr 3, 2021. It is now read-only.

Commit

Permalink
fix(Map): Removed Tfuel exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelantoniosantos committed Aug 14, 2019
1 parent 7898498 commit 2514d0c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 29 deletions.
26 changes: 2 additions & 24 deletions app/Http/Controllers/APIController.php
Expand Up @@ -60,28 +60,6 @@ public function fetch(Request $request)
'district' => $station->district,
];
}
if ($ext_auth->brand == 'Tfuel') {
$stations = FuelStation::where('id', '=', 972)->orWhere('id', '=', 1549)->get();
foreach ($stations as $station) {
$output[] = [
'id' => $station->id,
'name' => $station->name,
'brand' => $station->brand,
'sell_gasoline' => $station->sell_gasoline,
'sell_diesel' => $station->sell_diesel,
'sell_lpg' => $station->sell_lpg,
'has_gasoline' => $station->has_gasoline,
'has_diesel' => $station->has_diesel,
'has_lpg' => $station->has_lpg,
'lat' => $station->long,
'long' => $station->lat,
'repa' => $station->repa,
'county' => $station->county,
'district' => $station->district,
];
}
}

return response()->json($output);
}
}
Expand All @@ -98,7 +76,7 @@ public function push(Request $request)
$fuel_station = FuelStation::where('id', '=', $request->input('id'));
if ($fuel_station->count() > 0) {
$fuel_station = $fuel_station->first();
if (($fuel_station->brand == $ext_auth->brand) || ($fuel_station->brand_management == $ext_auth->brand) || ($ext_auth->brand == 'WRITEREAD') || ($fuel_station->id == 972 && $ext_auth->brand == 'Tfuel') || ($fuel_station->id == 1549 && $ext_auth->brand == 'Tfuel')) {
if (($fuel_station->brand == $ext_auth->brand) || ($fuel_station->brand_management == $ext_auth->brand) || ($ext_auth->brand == 'WRITEREAD')) {
$has_gasoline = \intval($request->input('has_gasoline'));
$has_diesel = \intval($request->input('has_diesel'));
$has_lpg = \intval($request->input('has_lpg'));
Expand Down Expand Up @@ -217,7 +195,7 @@ public function change(Request $request)
$fuel_station = FuelStation::where('id', '=', $request->input('id'));
if ($fuel_station->count() > 0) {
$fuel_station = $fuel_station->first();
if (($fuel_station->brand == $ext_auth->brand) || ($fuel_station->brand_management == $ext_auth->brand) || ($ext_auth->brand == 'WRITEREAD') || ($fuel_station->id == 972 && $ext_auth->brand == 'Tfuel') || ($fuel_station->id == 1549 && $ext_auth->brand == 'Tfuel')) {
if (($fuel_station->brand == $ext_auth->brand) || ($fuel_station->brand_management == $ext_auth->brand) || ($ext_auth->brand == 'WRITEREAD')) {
$brand = $request->input('brand');
$management_brand = '';
if ($brand != $ext_auth->brand && $ext_auth->brand != 'WRITEREAD') {
Expand Down
10 changes: 5 additions & 5 deletions resources/js/map.js
Expand Up @@ -332,26 +332,26 @@ function addLayersFunctionality(layerID) {
fuelIcons +
'</div>' +
'<img src="/img/map/separation.png" style="width: calc(100% + 1.6em); margin-left:-0.8em;" />';
if (e.features[0].properties.brand == "Prio") {
if (e.features[0].properties.brand == "Prio" || e.features[0].properties.brand_management == "Prio") {
description += '<div class="row"><div class="col-md"><b>AS DISPONIBILIDADES DAS BOMBAS DA PRIO</b></div></div>' +
'<div class="row"><div class="col-md"><b>LISTADAS NESTE SITE ESTÃO A SER GERIDAS</b></div></div>' +
'<div class="row"><div class="col-md"><b><a target="_blank" rel="noopener noreferrer" href="https://www.prio.pt/pt/">PELA PRÓPRIA PRIO</a></b></div></div>';
}
else if (e.features[0].properties.brand == "OZ Energia") {
else if (e.features[0].properties.brand == "OZ Energia" || e.features[0].properties.brand_management == "OZ Energia") {
description += '<div class="row"><div class="col-md"><b>AS DISPONIBILIDADES DAS BOMBAS DA OZ ENERGIA</b></div></div>' +
'<div class="row"><div class="col-md"><b>LISTADAS NESTE SITE ESTÃO A SER GERIDAS</b></div></div>' +
'<div class="row"><div class="col-md"><b><a target="_blank" rel="noopener noreferrer" href="https://www.ozenergia.pt/">PELA PRÓPRIA OZ ENERGIA</a></b></div></div>';
}
else if (e.features[0].properties.brand == "Ecobrent") {
else if (e.features[0].properties.brand == "Ecobrent" || e.features[0].properties.brand_management == "Ecobrent") {
description += '<div class="row"><div class="col-md"><b>AS DISPONIBILIDADES DAS BOMBAS DA ECOBRENT</b></div></div>' +
'<div class="row"><div class="col-md"><b>LISTADAS NESTE SITE ESTÃO A SER GERIDAS</b></div></div>' +
'<div class="row"><div class="col-md"><b><a target="_blank" rel="noopener noreferrer" href="https://www.ecobrent.pt/">PELA PRÓPRIA ECOBRENT</a></b></div></div>';
} else if (e.features[0].properties.brand == "Bxpress") {
} else if (e.features[0].properties.brand == "Bxpress" || e.features[0].properties.brand_management == "Bxpress") {
description += '<div class="row"><div class="col-md"><b>AS DISPONIBILIDADES DAS BOMBAS DA BXPRESS</b></div></div>' +
'<div class="row"><div class="col-md"><b>LISTADAS NESTE SITE ESTÃO A SER GERIDAS</b></div></div>' +
'<div class="row"><div class="col-md"><b><a target="_blank" rel="noopener noreferrer" href="https://www.bongasenergias.pt/">PELA PRÓPRIA BXPRESS</a></b></div></div>';
}
else if (e.features[0].properties.brand == "TFuel" || e.features[0].properties.id == 972 || e.features[0].properties.id == 1549) {
else if (e.features[0].properties.brand == "Tfuel" || e.features[0].properties.brand_management == "Tfuel") {
description += '<div class="row"><div class="col-md"><b>AS DISPONIBILIDADES DAS BOMBAS DA TFUEL</b></div></div>' +
'<div class="row"><div class="col-md"><b>LISTADAS NESTE SITE ESTÃO A SER GERIDAS</b></div></div>' +
'<div class="row"><div class="col-md"><b><a target="_blank" rel="noopener noreferrer" href="https://www.bongasenergias.pt/">PELA PRÓPRIA TFUEL</a></b></div></div>';
Expand Down

0 comments on commit 2514d0c

Please sign in to comment.