📦 NEW: Add business details fields, show/hide toggle functionality and translations

This commit is contained in:
Etienne Marais 2019-04-25 09:13:59 +02:00
parent e50a2962e5
commit 58d9f61656
No known key found for this signature in database
GPG Key ID: 5CE3285D17AE9F29
7 changed files with 7926 additions and 9 deletions

View File

@ -515,7 +515,6 @@ class EventCheckoutController extends Controller
$attendee_increment = 1;
$ticket_questions = isset($request_data['ticket_holder_questions']) ? $request_data['ticket_holder_questions'] : [];
/*
* Create the order
*/
@ -525,9 +524,9 @@ class EventCheckoutController extends Controller
if ($ticket_order['order_requires_payment'] && !isset($request_data['pay_offline'])) {
$order->payment_gateway_id = $ticket_order['payment_gateway']->id;
}
$order->first_name = strip_tags($request_data['order_first_name']);
$order->last_name = strip_tags($request_data['order_last_name']);
$order->email = $request_data['order_email'];
$order->first_name = sanitise($request_data['order_first_name']);
$order->last_name = sanitise($request_data['order_last_name']);
$order->email = sanitise($request_data['order_email']);
$order->order_status_id = isset($request_data['pay_offline']) ? config('attendize.order_awaiting_payment') : config('attendize.order_complete');
$order->amount = $ticket_order['order_total'];
$order->booking_fee = $ticket_order['booking_fee'];
@ -537,6 +536,17 @@ class EventCheckoutController extends Controller
$order->event_id = $ticket_order['event_id'];
$order->is_payment_received = isset($request_data['pay_offline']) ? 0 : 1;
// Business details is selected, we need to save the business details
if (isset($request_data['is_business']) && (bool)$request_data['is_business']) {
$order->is_business = $request_data['is_business'];
$order->business_name = sanitise($request_data['business_name']);
$order->business_tax_number = sanitise($request_data['business_tax_number']);
$order->business_address = collect($request_data['business_address'])
->map(function($addressEntry) {
return sanitise($addressEntry);
})->implode(', ');
}
// Calculating grand total including tax
$orderService = new OrderService($ticket_order['order_total'], $ticket_order['total_booking_fee'], $event);
$orderService->calculateFinalCosts();

View File

@ -32,6 +32,10 @@ class Order extends MyBaseModel
'order_email.email' => 'Please enter a valid email',
];
protected $casts = [
'is_business' => 'boolean',
];
/**
* The items associated with the order.
*

7850
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -203,7 +203,7 @@ $(function() {
});
});
$('#business_tax_registered').click(function(e) {
$('#is_business').click(function(e) {
var $isBusiness = $(this);
var isChecked = $isBusiness.hasClass('checked');

View File

@ -4771,7 +4771,7 @@ function log() {
});
});
$('#business_tax_registered').click(function(e) {
$('#is_business').click(function(e) {
var $isBusiness = $(this);
var isChecked = $isBusiness.hasClass('checked');

View File

@ -16,9 +16,15 @@ return [
'below_tickets' => 'Choose the number of tickets and click "register". On the next screen you\'ll pay for them.',
'booking_fee' => 'Booking Fee',
'booking_fees' => 'Booking Fees',
'is_business' => 'Are you a tax registered business?',
'business_name' => 'Business',
'business_tax_number' => 'Tax Number',
'business_address' => 'Business Address',
'business_address_line1' => 'Line 1',
'business_address_line2' => 'Line 2',
'business_address_state_province' => 'State/Province',
'business_address_city' => 'City',
'business_address_code' => 'Code',
'card_number' => 'Card number',
'checkout_submit' => 'Checkout',
'confirmation_email' => 'and a confirmation email have been sent to you.',

View File

@ -92,8 +92,8 @@
<div class="col-md-12">
<div class="form-group">
<div class="custom-checkbox">
{!! Form::checkbox('business_tax_registered', 1, null, ['data-toggle' => 'toggle', 'id' => 'business_tax_registered']) !!}
{!! Form::label('business_tax_registered', 'Are you a tax registered business?', ['class' => 'control-label']) !!}
{!! Form::checkbox('is_business', 1, null, ['data-toggle' => 'toggle', 'id' => 'is_business']) !!}
{!! Form::label('is_business', trans("Public_ViewEvent.is_business"), ['class' => 'control-label']) !!}
</div>
</div>
</div>
@ -102,7 +102,54 @@
<div class="row hidden" id="business_details">
<div class="col-md-12">
<div class="form-group">
Hello
<div class="row">
<div class="col-xs-6">
<div class="form-group">
{!! Form::label("business_name", trans("Public_ViewEvent.business_name")) !!}
{!! Form::text("business_name", null, ['required' => 'required', 'class' => 'form-control']) !!}
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
{!! Form::label("business_tax_number", trans("Public_ViewEvent.business_tax_number")) !!}
{!! Form::text("business_tax_number", null, ['required' => 'required', 'class' => 'form-control']) !!}
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
{!! Form::label("business_address", trans("Public_ViewEvent.business_address_line1")) !!}
{!! Form::text("business_address[]", null, ['required' => 'required', 'class' => 'form-control']) !!}
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
{!! Form::label("business_address", trans("Public_ViewEvent.business_address_line2")) !!}
{!! Form::text("business_address[]", null, ['required' => 'required', 'class' => 'form-control']) !!}
</div>
</div>
</div>
<div class="row">
<div class="col-xs-4">
<div class="form-group">
{!! Form::label("business_address", trans("Public_ViewEvent.business_address_state_province")) !!}
{!! Form::text("business_address[]", null, ['required' => 'required', 'class' => 'form-control']) !!}
</div>
</div>
<div class="col-xs-4">
<div class="form-group">
{!! Form::label("business_address", trans("Public_ViewEvent.business_address_city")) !!}
{!! Form::text("business_address[]", null, ['required' => 'required', 'class' => 'form-control']) !!}
</div>
</div>
<div class="col-xs-4">
<div class="form-group">
{!! Form::label("business_address", trans("Public_ViewEvent.business_address_code")) !!}
{!! Form::text("business_address[]", null, ['required' => 'required', 'class' => 'form-control']) !!}
</div>
</div>
</div>
</div>
</div>
</div>