mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-02-22 11:46:27 +01:00
pre-booking changed by post submit fix
This commit is contained in:
parent
991832f501
commit
6dcd411a53
1 changed files with 9 additions and 10 deletions
|
@ -33,7 +33,7 @@ sub new {
|
|||
|
||||
|
||||
#api workaround reserving bike by post request
|
||||
sub bike_reserv {
|
||||
sub bike_reservreq {
|
||||
my $self = shift;
|
||||
my $uri_server = shift;
|
||||
my $booking_request = shift;
|
||||
|
@ -75,7 +75,7 @@ sub tpl {
|
|||
$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 $bike = $q->escapeHTML($R::bike_reserv) || "";
|
||||
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});
|
||||
|
@ -367,14 +367,14 @@ EOF
|
|||
# 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 && $R::sharee_edit =~ /calendar_bikes_available|bike_reserv/);
|
||||
my $but_search = "Mieträder anzeigen";
|
||||
#$but_search = "Erneut suchen" if(($R::sharee_edit && $R::sharee_edit =~ /calendar_bikes_available/) || $R::bike_reserv);
|
||||
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
|
||||
|
||||
#$bikes_json
|
||||
if($R::sharee_edit && $R::sharee_edit =~ /calendar_bikes_available|bike_reserv/){
|
||||
if(($R::sharee_edit && $R::sharee_edit =~ /calendar_bikes_available/) || $R::bike_reserv){
|
||||
|
||||
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});
|
||||
|
@ -393,9 +393,9 @@ EOF
|
|||
|
||||
#api workaround reserving bike by post v3
|
||||
my $response_booking = {};
|
||||
if($R::sharee_edit =~ /bike_reserv/){
|
||||
if($R::bike_reserv){
|
||||
my $booking_request = "request=booking_request&bike=$bike&calreserv=1&reserv_starttime=$reserv_starttime&reserv_endtime=$reserv_endtime&authcookie=$coo";
|
||||
$response_booking = $self->bike_reserv($uri_server,$booking_request);
|
||||
$response_booking = $self->bike_reservreq($uri_server,$booking_request);
|
||||
}
|
||||
|
||||
my $bikes_json = $self->fetchserver_json($uri_server,$rest_bikes);
|
||||
|
@ -579,14 +579,13 @@ print <<EOF
|
|||
EOF
|
||||
;
|
||||
|
||||
if($R::sharee_edit ne "bike_reserv" && $reservbut){
|
||||
if(!$R::bike_reserv && $reservbut){
|
||||
print $q->div({-style=>'color:red;'},"Im gewählten Zeitraum nicht verfügbar."),"\n";
|
||||
}else{
|
||||
#if(1==1){
|
||||
#Mietrad buchen
|
||||
#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";
|
||||
print $q->div({-id=>"button_reserv_$bike",-style=>'clear:both;text-align:center;display:block;'},"<button type='submit' name='sharee_edit' value='bike_reserv' class='btn btn-primary btn-block' style='border:1px solid #$bgcolor1;margin:0.5em;width:300px;'>Mietrad buchen</button>"),"\n";
|
||||
print $q->hidden(-name=>"bike",-override=>1,-value=>"$response_bikes->{shareejson}->{bikes}->{$bike}->{bike}");
|
||||
print $q->div({-id=>"button_reserv_$bike",-style=>'clear:both;text-align:center;display:block;'},"<button type='submit' name='bike_reserv' value='$bike' class='btn btn-primary btn-block' style='border:1px solid #$bgcolor1;margin:0.5em;width:300px;'>Mietrad buchen</button>"),"\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;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";
|
||||
|
|
Loading…
Add table
Reference in a new issue