Skip to content

Commit e57110e

Browse files
committed
Added features
* Templates for form and user bookings shortcodes * Ability to book for third-party * Better validation
1 parent d75acf3 commit e57110e

File tree

8 files changed

+504
-221
lines changed

8 files changed

+504
-221
lines changed

css/admin.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
}
44

55
#booking-client-meta .rwmb-input input,
6+
#booking-lead-meta .rwmb-input input,
67
#booking-payment-meta .rwmb-input input,
78
#driver-meta-general .rwmb-input input {
89
width: 100%;

css/style.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@
113113
width: 23%;
114114
}
115115

116+
#bookingForm .four_col input[type="number"] {
117+
width: 24.5%;
118+
}
119+
116120
/* Map options */
117121
#bookingForm #map-canvas {
118122
width: 500px;

include/form_handler.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@ function ajax_create_booking() {
7575
$full_name = $_POST['full_name'];
7676
$phone = $_POST['phone'];
7777
$email = $_POST['email'];
78+
$lead = $_POST['lead'];
79+
if( $lead != 'self' ) {
80+
$lead_full_name = $_POST['lead_full_name'];
81+
$lead_email = $_POST['lead_email'];
82+
$lead_phone = $_POST['lead_phone'];
83+
}
84+
$adults = $_POST['adults'];
85+
$kids = $_POST['kids'];
86+
$luggage = $_POST['luggage'];
87+
$handbags = $_POST['hand'];
7888
$notes = $_POST['notes'];
7989
$payment = $_POST['payment'];
8090

@@ -109,6 +119,19 @@ function ajax_create_booking() {
109119
update_post_meta($post, "vbs_full_name", $full_name);
110120
update_post_meta($post, 'vbs_email', $email);
111121
update_post_meta($post, 'vbs_phone', $phone);
122+
123+
// Lead passenger details
124+
if( $lead != 'self' ) {
125+
update_post_meta($post, "vbs_lead_full_name", $lead_full_name );
126+
update_post_meta($post, "vbs_lead_email", $lead_email);
127+
update_post_meta($post, "vbs_lead_phone", $lead_phone);
128+
}
129+
130+
update_post_meta($post, "vbs_adults", $adults );
131+
update_post_meta($post, "vbs_kids", $kids);
132+
update_post_meta($post, "vbs_luggage", $luggage);
133+
update_post_meta($post, "vbs_handbags", $handbags);
134+
112135
update_post_meta($post, 'vbs_payment', $payment);
113136
update_post_meta($post, 'vbs_cost', $cost);
114137

include/meta-boxes.php

Lines changed: 93 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function vbs_register_meta_boxes( $meta_boxes )
6363

6464
// Car Pricing Meta Box
6565
$meta_boxes[] = array(
66-
'id' => 'price-meta',
66+
'id' => 'price-meta',
6767
'title' => __('Pricing Table', 'vbs'),
6868
'pages' => array( 'cars' ),
6969
'fields' => array(
@@ -73,7 +73,7 @@ function vbs_register_meta_boxes( $meta_boxes )
7373
'type' => 'text_list',
7474
'clone' => true,
7575
'options' => array(
76-
'0' => __( 'Distance from', 'vbs' ),
76+
'0' => __( 'Distance from', 'vbs' ),
7777
'50' => __( 'Distance to', 'vbs' ),
7878
'10' => __( 'Cost', 'vbs' )
7979
),
@@ -83,10 +83,24 @@ function vbs_register_meta_boxes( $meta_boxes )
8383

8484
// Locations Meta Box
8585
$meta_boxes[] = array(
86-
'id' => 'loc-meta',
86+
'id' => 'loc-meta',
8787
'title' => __('Location Details', 'vbs'),
8888
'pages' => array( 'locations' ),
8989
'fields' => array(
90+
array(
91+
'name' => __( 'Location type', 'vbs' ),
92+
'id' => $prefix . 'location_type',
93+
'type' => 'select',
94+
'options' => array(
95+
'airport' => __( 'Airport', 'vbs' ),
96+
'train' => __( 'Train Station', 'vbs' ),
97+
'bus' => __( 'Bus Station', 'vbs' ),
98+
'port' => __( 'Ship Port', 'vbs' ),
99+
'other' => __( 'Other', 'vbs' )
100+
),
101+
'std' => '',
102+
'placeholder' => __( 'Select location type', 'vbs' ),
103+
),
90104
array(
91105
'id' => $prefix . 'address',
92106
'name' => __( 'Address', 'vbs' ),
@@ -105,7 +119,7 @@ function vbs_register_meta_boxes( $meta_boxes )
105119
'id' => $prefix . 'location_sur_type',
106120
'type' => 'select',
107121
'options' => array(
108-
'fixed' => __( 'Fixed Amount', 'vbs' ),
122+
'fixed' => __( 'Fixed Amount', 'vbs' ),
109123
'percent' => __( 'Percentage', 'vbs' ),
110124
),
111125
'std' => 'paypal',
@@ -124,7 +138,7 @@ function vbs_register_meta_boxes( $meta_boxes )
124138

125139
// Bookings Meta Box
126140
$meta_boxes[] = array(
127-
'id' => 'book-meta',
141+
'id' => 'book-meta',
128142
'title' => __('Booking Details', 'vbs'),
129143
'pages' => array( 'bookings' ),
130144
'fields' => array(
@@ -275,6 +289,42 @@ function vbs_register_meta_boxes( $meta_boxes )
275289
'name' => 'Get Cost', // Empty name will "align" the button to all field inputs
276290
),
277291

292+
// Adults
293+
array(
294+
'name' => __('No. of Adults', 'vbs'),
295+
'id' => $prefix . 'adults',
296+
'type' => 'number',
297+
'step' => 'any',
298+
'min' => 1,
299+
),
300+
301+
// Kids
302+
array(
303+
'name' => __('No. of Children', 'vbs'),
304+
'id' => $prefix . 'kids',
305+
'type' => 'number',
306+
'step' => 'any',
307+
'min' => 0,
308+
),
309+
310+
// Luggage
311+
array(
312+
'name' => __('No. of Luggage', 'vbs'),
313+
'id' => $prefix . 'luggage',
314+
'type' => 'number',
315+
'step' => 'any',
316+
'min' => 0,
317+
),
318+
319+
// Kids
320+
array(
321+
'name' => __('No. of Handbags', 'vbs'),
322+
'id' => $prefix . 'handbags',
323+
'type' => 'number',
324+
'step' => 'any',
325+
'min' => 0,
326+
),
327+
278328
// Notes
279329
array(
280330
'name' => __( 'Notes', 'vbs' ),
@@ -291,7 +341,7 @@ function vbs_register_meta_boxes( $meta_boxes )
291341

292342
// Booking client Data Meta Box
293343
$meta_boxes[] = array(
294-
'id' => 'booking-client-meta',
344+
'id' => 'booking-client-meta',
295345
'title' => __('Customer Details', 'vbs'),
296346
'pages' => array( 'bookings' ),
297347
'context' => 'side',
@@ -361,9 +411,44 @@ function vbs_register_meta_boxes( $meta_boxes )
361411
)
362412
);
363413

364-
// Booking client Data Meta Box
414+
// Booking Lead Paggenter Data Meta Box
415+
$meta_boxes[] = array(
416+
'id' => 'booking-lead-meta',
417+
'title' => __('Lead Passenger Details', 'vbs'),
418+
'pages' => array( 'bookings' ),
419+
'context' => 'side',
420+
'fields' => array(
421+
422+
// Full Name
423+
array(
424+
'id' => $prefix . 'lead_full_name',
425+
'name' => __( 'Full Name', 'vbs' ),
426+
'type' => 'text',
427+
'std' => '',
428+
),
429+
430+
// Email
431+
array(
432+
'id' => $prefix . 'lead_email',
433+
'name' => __( 'Email', 'vbs' ),
434+
'type' => 'text',
435+
'std' => '',
436+
),
437+
438+
// Phone
439+
array(
440+
'id' => $prefix . 'lead_phone',
441+
'name' => __( 'Phone', 'vbs' ),
442+
'type' => 'text',
443+
'std' => '',
444+
),
445+
446+
)
447+
);
448+
449+
// Booking Payment Data Meta Box
365450
$meta_boxes[] = array(
366-
'id' => 'booking-payment-meta',
451+
'id' => 'booking-payment-meta',
367452
'title' => __('Payment Details', 'vbs'),
368453
'pages' => array( 'bookings' ),
369454
'context' => 'side',

0 commit comments

Comments
 (0)