pre-booking minor fixes

This commit is contained in:
ragu 2024-05-08 12:42:17 +02:00
parent 1112b2c2b5
commit 934955117a
3 changed files with 22 additions and 19 deletions

View file

@ -1044,7 +1044,8 @@ sub booking_request(){
$pos_id = $dbt->insert_pos($dbh,$ctt->{c_id},$ct_bike,$ct_station,$auth,$ct_tariff,$request_para,$bike,$booking_state,$owner,$sig_book);
$bw->log("booking_request reserved insert_pos:",$pos_id,"");
$response_state = "OK, bike " . $bike . " succesfully reserved";
$response_text = "Erfolgreiche Buchung: $start_loc - $end_loc.";
#$response_text = "Erfolgreiche Buchung: $start_loc - $end_loc.";
$response_text = "Buchung erfolgreich.";
}
}else{
$response_state = "Failure 4260, reserv timerange";

View file

@ -103,8 +103,7 @@ div a:hover {
}
.content_title3 {
font-size:1.5em;
padding-top:1.0em;
font-size:1.3em;
color: #4f3f3f;
}

View file

@ -52,12 +52,13 @@ sub tpl {
$session = "?sessionid=$R::sessionid";
$session_and = "&sessionid=$R::sessionid";
}
my $select_station = $q->escapeHTML($R::select_station) || "LatLng(47.976634, 7.82549)";#defaults to Villaban
my $bike = $q->escapeHTML($R::bike) || "";
my $bgcolor1 = "009899";#sharee
$bgcolor1 = $dbt->{website}->{$varenv->{syshost}}->{bgcolor1} if($dbt->{website}->{$varenv->{syshost}}->{bgcolor1});
$bgcolor1 = $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{bgcolor1} if($dbt->{merchant_ids}->{$varenv->{merchant_id}}->{bgcolor1});
my $initMap = "48.741246, 11.210390";
my $map_zoom = 7;
my $initMap = "47.976634, 7.825490";#Freiburg
my $map_zoom = 10;
my $project = "all";
my $uri_server = $dbt->{primary}->{sharee_primary}->{primaryApp};
@ -123,9 +124,11 @@ sub tpl {
my $icon_blue = "Open_Blue.png";
$initMap =~ s/\s//g;
my ($lat,$lng) = split(/,/,$initMap);
if($R::select_station && $R::select_station =~ /LatLng\((\d+\.\d+),\s(\d+\.\d+)\)/){
if($select_station && $select_station =~ /LatLng\((\d+\.\d+),\s(\d+\.\d+)\)/){
$lat = $1;
$lng = $2;
}else{
}
print<<EOF
@ -172,7 +175,7 @@ print "<div style='margin:5px 0 15px; 0' id='map'></div>\n";
$gbfs_station{$station}{LatLng} = "LatLng($response_stations->{shareejson}->{stations}->{$station}->{gps}->{latitude}, $response_stations->{shareejson}->{stations}->{$station}->{gps}->{longitude})";
$gbfs_station{$station}{name} = Encode::encode('utf-8', Encode::decode('iso-8859-1',$response_stations->{shareejson}->{stations}->{$station}->{description}));
$gbfs_station{$station}{station_id} = $response_stations->{shareejson}->{stations}->{$station}->{station};
if($R::select_station && $R::select_station eq $gbfs_station{$station}{LatLng}){
if($select_station && $select_station eq $gbfs_station{$station}{LatLng}){
$selected_station{uri_operator} = $response_stations->{shareejson}->{stations}->{$station}->{uri_operator};
$selected_station{name} = $gbfs_station{$station}{name};
$selected_station{station_id} = $gbfs_station{$station}{station_id};
@ -272,7 +275,7 @@ function onLocationFound(e) {
function onLocationError(e) {
alert(e.message);
//alert(e.message);
}
function lastLocation() {
@ -287,7 +290,7 @@ function lastLocation() {
}
if("$R::select_station"){
if("$select_station"){
map.on('locationfound', lastLocation);
map.locate({setView: false, maxZoom: 16});
map.setView(L.latLng($lat, $lng), 11);
@ -339,12 +342,12 @@ EOF
}
if($R::sharee_edit =~ /calendar_bikes_available/ && $bike){
print $q->div({-style=>'margin:1em 0;text-align:center;clear:both;'},"<button type='submit' name='sharee_edit' value='calendar_bikes_available' class='btn btn-primary btn-lg btn-block' style='border:1px solid #$bgcolor1;background-color:#$bgcolor1;'>Fahrtzeit übernehmen</button>"),"\n";
print $q->div({-style=>'margin:1em 0;text-align:center;clear:both;'},"<button type='submit' name='sharee_edit' value='calendar_bikes_available' class='btn btn-primary btn-block' style='border:1px solid #$bgcolor1;'>Fahrtzeit übernehmen</button>"),"\n";
print $q->hidden(-name=>"bike",-override=>1,-value=>"$bike");
}
my $but_search = "Suchen";
$but_search = "Erneut suchen" if($R::sharee_edit =~ /calendar_bikes_available/);
print $q->div({-style=>'margin:1em 0;text-align:center;clear:both;'},"<button type='submit' name='sharee_edit' value='calendar_bikes_available_all' class='btn btn-primary btn-lg btn-block' style='border:1px solid #$bgcolor1;background-color:#$bgcolor1;'>$but_search</button>"),"\n";
print $q->div({-style=>'margin:1em 0;text-align:center;clear:both;'},"<button type='submit' name='sharee_edit' value='calendar_bikes_available_all' class='btn btn-primary btn-block' style='border:1px solid #$bgcolor1;'>$but_search</button>"),"\n";
print $q->div({-id=>'reserved_bikes'},""),"\n";#not used
@ -354,7 +357,7 @@ EOF
my $rest_bikes = "request=bikes_available&calreserv=1&reserv_starttime=$R::reserv_starttime&reserv_endtime=$R::reserv_endtime&authcookie=$coo&lang=de";
$rest_bikes .= "&station=$selected_station{station_id}" if($selected_station{station_id});
if($R::select_station && $R::select_station =~/LatLng\((\d+\.\d+), (\d+\.\d+)\)/){
if($select_station && $select_station =~/LatLng\((\d+\.\d+), (\d+\.\d+)\)/){
my $Lat = $1;
my $Lng = $2;
$rest_bikes .= "&Lat=$Lat&Lng=$Lng";
@ -389,8 +392,8 @@ EOF
my $start_loc = $dts->strftime("%d.%m.%Y %H:%M");
my $dte = $strp->parse_datetime($reserv_endtime);
my $end_loc = $dte->strftime("%d.%m.%Y %H:%M");
print $q->div({-style=>''},"Fahrtbeginn: $start_loc"),"\n";
print $q->div({-style=>''},"Fahrtende: $end_loc"),"\n";
print $q->div({-style=>''},"Beginn: $start_loc"),"\n";
print $q->div({-style=>''},"Ende:&nbsp;&nbsp;&nbsp; $end_loc"),"\n";
print $q->div({-id=>"return_state_$bike",-style=>'color:green;'},""),"\n";
@ -505,7 +508,7 @@ EOF
$se = $2;
}
if($ri =~ /^$rangeindex/ && $se == 1){
$href = "/app/Account/CalendarReserv?sharee_edit=calendar_bikes_available&select_station=$R::select_station&bike=$bike&calreserv=1&authcookie=$coo&lang=de";
$href = "/app/Account/CalendarReserv?sharee_edit=calendar_bikes_available&select_station=$select_station&bike=$bike&calreserv=1&authcookie=$coo&lang=de";
#print "$ri Von: $blockedhash{$ri}<br />\n";
my $dtx = $strp->parse_datetime($blockedhash{$ri});
my $start_loc = $dtx->strftime("%d.%m.%Y %H:%M");
@ -546,14 +549,14 @@ EOF
print $q->div({-style=>'color:red;'},"Im gewähltem Zeitfenster nicht verfügbar"),"\n";
}else{
#Mietrad buchen
print $q->div({-id=>"button_reserv_$bike",-style=>'clear:both;text-align:center;display:block;'},"<span class='btn btn-primary' style='border:1px solid #$bgcolor1;background-color:#$bgcolor1;margin:0.5em;width:300px;' onclick='rental_request(\"$response_bikes->{shareejson}->{bikes}->{$bike}->{uri_operator}/APIjsonserver?request=booking_request&bike=$response_bikes->{shareejson}->{bikes}->{$bike}->{bike}&calreserv=1&reserv_starttime=$reserv_starttime&reserv_endtime=$reserv_endtime&authcookie=$coo\",\"$bike\",\"\")'>Mietrad buchen</span>"),"\n";
print $q->div({-id=>"button_reserv_$bike",-style=>'clear:both;text-align:center;display:block;'},"<span class='btn btn-primary' style='margin:0.5em;width:300px;' onclick='rental_request(\"$response_bikes->{shareejson}->{bikes}->{$bike}->{uri_operator}/APIjsonserver?request=booking_request&bike=$response_bikes->{shareejson}->{bikes}->{$bike}->{bike}&calreserv=1&reserv_starttime=$reserv_starttime&reserv_endtime=$reserv_endtime&authcookie=$coo\",\"$bike\",\"\")'>Mietrad buchen</span>"),"\n";
#Buchung stornieren
print $q->div({-id=>"button_cancel_$bike",-style=>'clear:both;text-align:center;display:none;'},"<span class='btn btn-outline-primary' style='border:1px solid #$bgcolor1;color:#$bgcolor1;margin:0.5em;width:300px;' onclick='rental_request(\"$response_bikes->{shareejson}->{bikes}->{$bike}->{uri_operator}/APIjsonserver?request=booking_update&bike=$response_bikes->{shareejson}->{bikes}->{$bike}->{bike}&state=canceled&reserv_starttime=$reserv_starttime&reserv_endtime=$reserv_endtime&authcookie=$coo\",\"$bike\",\"\")'>Buchung stornieren</span>"),"\n";
print $q->div({-id=>"button_cancel_$bike",-style=>'clear:both;text-align:center;display:none;'},"<span class='btn btn-outline-primary' style='border:1px solid #$bgcolor1;color:#$bgcolor1;background-color:#fff;margin:0.5em;width:300px;' onclick='rental_request(\"$response_bikes->{shareejson}->{bikes}->{$bike}->{uri_operator}/APIjsonserver?request=booking_update&bike=$response_bikes->{shareejson}->{bikes}->{$bike}->{bike}&state=canceled&reserv_starttime=$reserv_starttime&reserv_endtime=$reserv_endtime&authcookie=$coo\",\"$bike\",\"\")'>Buchung stornieren</span>"),"\n";
}
#Weitere Verfügbarkeit anzeigen
print $q->div({-id=>"button_availablbility_$bike",-style=>'clear:both;text-align:center;display:block;'},"<span class='btn btn-outline-primary' style='border:1px solid #$bgcolor1;color:#$bgcolor1;margin:0.5em;width:300px;' data-bs-toggle='modal' data-bs-target='#$bike'>Weitere Verfügbarkeit anzeigen</span>"),"\n";
print $q->div({-id=>"button_availablbility_$bike",-style=>'clear:both;text-align:center;display:block;'},"<span class='btn btn-outline-primary' style='border:1px solid #$bgcolor1;color:#$bgcolor1;background-color:#fff;margin:0.5em;width:300px;' data-bs-toggle='modal' data-bs-target='#$bike'>Verfügbarkeitsanzeige</span>"),"\n";
#print Dumper($response_bikes->{shareejson}->{bikes}->{$bike}->{rental_description}->{tarif_elements});
@ -581,7 +584,7 @@ EOF
print $q->div({-style=>'padding:1em 0.5em;font-weight:bold;'},"Deine $oprefix Buchungen:"),"\n" if($i == 1);
#selector by $rid pos_id
print $q->div({-id=>"return_state_$rid"},""),"\n";
print $q->div({-id=>"button_cancel_$rid", -style=>'padding:0.2em 0.5em;color:green;display:block;'},"<span class='btn btn-outline-primary btn-sm' style='border:1px solid #$bgcolor1;color:#$bgcolor1;' onclick='rental_request(\"$response_bikes->{shareejson}->{bikes_occupied}->{$rid}->{uri_operator}/APIjsonserver?request=booking_update&bike=$bike&pos_id=$rid&state=canceled&authcookie=$coo\",\"\",\"$rid\")'>Buchung stornieren</span> $start_loc - $end_loc: $response_bikes->{shareejson}->{bikes_occupied}->{$rid}->{description} $bike an Station $response_bikes->{shareejson}->{bikes_occupied}->{$rid}->{station}"),"\n";
print $q->div({-id=>"button_cancel_$rid", -style=>'padding:0.2em 0.5em;color:green;display:block;'},"<span class='btn btn-outline-primary btn-sm' style='border:1px solid #$bgcolor1;color:#$bgcolor1;background-color:#fff;' onclick='rental_request(\"$response_bikes->{shareejson}->{bikes_occupied}->{$rid}->{uri_operator}/APIjsonserver?request=booking_update&bike=$bike&pos_id=$rid&state=canceled&authcookie=$coo\",\"\",\"$rid\")'>Buchung stornieren</span> $start_loc - $end_loc: $response_bikes->{shareejson}->{bikes_occupied}->{$rid}->{description} $bike an Station $response_bikes->{shareejson}->{bikes_occupied}->{$rid}->{station}"),"\n";
print $q->div({-id=>"button_reserv_$rid",-style=>'color:red;'},""),"\n";#dummy
}