Skip to content

Commit

Permalink
Added features
Browse files Browse the repository at this point in the history
* Templates for form and user bookings shortcodes
* Ability to book for third-party
* Better validation
  • Loading branch information
gnikolopoulos committed Jun 2, 2016
1 parent d75acf3 commit e57110e
Show file tree
Hide file tree
Showing 8 changed files with 504 additions and 221 deletions.
1 change: 1 addition & 0 deletions css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
}

#booking-client-meta .rwmb-input input,
#booking-lead-meta .rwmb-input input,
#booking-payment-meta .rwmb-input input,
#driver-meta-general .rwmb-input input {
width: 100%;
Expand Down
4 changes: 4 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@
width: 23%;
}

#bookingForm .four_col input[type="number"] {
width: 24.5%;
}

/* Map options */
#bookingForm #map-canvas {
width: 500px;
Expand Down
23 changes: 23 additions & 0 deletions include/form_handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ function ajax_create_booking() {
$full_name = $_POST['full_name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$lead = $_POST['lead'];
if( $lead != 'self' ) {
$lead_full_name = $_POST['lead_full_name'];
$lead_email = $_POST['lead_email'];
$lead_phone = $_POST['lead_phone'];
}
$adults = $_POST['adults'];
$kids = $_POST['kids'];
$luggage = $_POST['luggage'];
$handbags = $_POST['hand'];
$notes = $_POST['notes'];
$payment = $_POST['payment'];

Expand Down Expand Up @@ -109,6 +119,19 @@ function ajax_create_booking() {
update_post_meta($post, "vbs_full_name", $full_name);
update_post_meta($post, 'vbs_email', $email);
update_post_meta($post, 'vbs_phone', $phone);

// Lead passenger details
if( $lead != 'self' ) {
update_post_meta($post, "vbs_lead_full_name", $lead_full_name );
update_post_meta($post, "vbs_lead_email", $lead_email);
update_post_meta($post, "vbs_lead_phone", $lead_phone);
}

update_post_meta($post, "vbs_adults", $adults );
update_post_meta($post, "vbs_kids", $kids);
update_post_meta($post, "vbs_luggage", $luggage);
update_post_meta($post, "vbs_handbags", $handbags);

update_post_meta($post, 'vbs_payment', $payment);
update_post_meta($post, 'vbs_cost', $cost);

Expand Down
101 changes: 93 additions & 8 deletions include/meta-boxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function vbs_register_meta_boxes( $meta_boxes )

// Car Pricing Meta Box
$meta_boxes[] = array(
'id' => 'price-meta',
'id' => 'price-meta',
'title' => __('Pricing Table', 'vbs'),
'pages' => array( 'cars' ),
'fields' => array(
Expand All @@ -73,7 +73,7 @@ function vbs_register_meta_boxes( $meta_boxes )
'type' => 'text_list',
'clone' => true,
'options' => array(
'0' => __( 'Distance from', 'vbs' ),
'0' => __( 'Distance from', 'vbs' ),
'50' => __( 'Distance to', 'vbs' ),
'10' => __( 'Cost', 'vbs' )
),
Expand All @@ -83,10 +83,24 @@ function vbs_register_meta_boxes( $meta_boxes )

// Locations Meta Box
$meta_boxes[] = array(
'id' => 'loc-meta',
'id' => 'loc-meta',
'title' => __('Location Details', 'vbs'),
'pages' => array( 'locations' ),
'fields' => array(
array(
'name' => __( 'Location type', 'vbs' ),
'id' => $prefix . 'location_type',
'type' => 'select',
'options' => array(
'airport' => __( 'Airport', 'vbs' ),
'train' => __( 'Train Station', 'vbs' ),
'bus' => __( 'Bus Station', 'vbs' ),
'port' => __( 'Ship Port', 'vbs' ),
'other' => __( 'Other', 'vbs' )
),
'std' => '',
'placeholder' => __( 'Select location type', 'vbs' ),
),
array(
'id' => $prefix . 'address',
'name' => __( 'Address', 'vbs' ),
Expand All @@ -105,7 +119,7 @@ function vbs_register_meta_boxes( $meta_boxes )
'id' => $prefix . 'location_sur_type',
'type' => 'select',
'options' => array(
'fixed' => __( 'Fixed Amount', 'vbs' ),
'fixed' => __( 'Fixed Amount', 'vbs' ),
'percent' => __( 'Percentage', 'vbs' ),
),
'std' => 'paypal',
Expand All @@ -124,7 +138,7 @@ function vbs_register_meta_boxes( $meta_boxes )

// Bookings Meta Box
$meta_boxes[] = array(
'id' => 'book-meta',
'id' => 'book-meta',
'title' => __('Booking Details', 'vbs'),
'pages' => array( 'bookings' ),
'fields' => array(
Expand Down Expand Up @@ -275,6 +289,42 @@ function vbs_register_meta_boxes( $meta_boxes )
'name' => 'Get Cost', // Empty name will "align" the button to all field inputs
),

// Adults
array(
'name' => __('No. of Adults', 'vbs'),
'id' => $prefix . 'adults',
'type' => 'number',
'step' => 'any',
'min' => 1,
),

// Kids
array(
'name' => __('No. of Children', 'vbs'),
'id' => $prefix . 'kids',
'type' => 'number',
'step' => 'any',
'min' => 0,
),

// Luggage
array(
'name' => __('No. of Luggage', 'vbs'),
'id' => $prefix . 'luggage',
'type' => 'number',
'step' => 'any',
'min' => 0,
),

// Kids
array(
'name' => __('No. of Handbags', 'vbs'),
'id' => $prefix . 'handbags',
'type' => 'number',
'step' => 'any',
'min' => 0,
),

// Notes
array(
'name' => __( 'Notes', 'vbs' ),
Expand All @@ -291,7 +341,7 @@ function vbs_register_meta_boxes( $meta_boxes )

// Booking client Data Meta Box
$meta_boxes[] = array(
'id' => 'booking-client-meta',
'id' => 'booking-client-meta',
'title' => __('Customer Details', 'vbs'),
'pages' => array( 'bookings' ),
'context' => 'side',
Expand Down Expand Up @@ -361,9 +411,44 @@ function vbs_register_meta_boxes( $meta_boxes )
)
);

// Booking client Data Meta Box
// Booking Lead Paggenter Data Meta Box
$meta_boxes[] = array(
'id' => 'booking-lead-meta',
'title' => __('Lead Passenger Details', 'vbs'),
'pages' => array( 'bookings' ),
'context' => 'side',
'fields' => array(

// Full Name
array(
'id' => $prefix . 'lead_full_name',
'name' => __( 'Full Name', 'vbs' ),
'type' => 'text',
'std' => '',
),

// Email
array(
'id' => $prefix . 'lead_email',
'name' => __( 'Email', 'vbs' ),
'type' => 'text',
'std' => '',
),

// Phone
array(
'id' => $prefix . 'lead_phone',
'name' => __( 'Phone', 'vbs' ),
'type' => 'text',
'std' => '',
),

)
);

// Booking Payment Data Meta Box
$meta_boxes[] = array(
'id' => 'booking-payment-meta',
'id' => 'booking-payment-meta',
'title' => __('Payment Details', 'vbs'),
'pages' => array( 'bookings' ),
'context' => 'side',
Expand Down
Loading

0 comments on commit e57110e

Please sign in to comment.