diff --git a/app/Helpers/helpers.php b/app/Helpers/helpers.php
index 57cace3a..b9149f4f 100644
--- a/app/Helpers/helpers.php
+++ b/app/Helpers/helpers.php
@@ -62,3 +62,30 @@ if(!function_exists('organisers')){
return \Illuminate\Support\Facades\Auth::user()->account->organisers;
}
}
+if ( ! function_exists('sanitise')) {
+ /**
+ * @param string $input
+ * @return string
+ */
+ function sanitise($input)
+ {
+ $clear = clean($input); // Package to remove code "mews/purifier"
+ $clear = strip_tags($clear);
+ $clear = html_entity_decode($clear);
+ $clear = urldecode($clear);
+ $clear = preg_replace('~[\r\n\t]+~', ' ', trim($clear));
+ $clear = preg_replace('/ +/', ' ', $clear);
+ return $clear;
+ }
+
+ /**
+ * @param string $input
+ * @return string
+ */
+ function clean_whitespace($input)
+ {
+ $clear = preg_replace('~[\r\n\t]+~', ' ', trim($input));
+ $clear = preg_replace('/ +/', ' ', $clear);
+ return $clear;
+ }
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/EventCheckoutController.php b/app/Http/Controllers/EventCheckoutController.php
index eccc0594..4c85da0d 100644
--- a/app/Http/Controllers/EventCheckoutController.php
+++ b/app/Http/Controllers/EventCheckoutController.php
@@ -280,8 +280,8 @@ class EventCheckoutController extends Controller
return view('Public.ViewEvent.Embedded.EventPageCheckout', $data); // <--- todo check this out
}
- return view('Public.ViewEvent.EventPageCheckout', $data);
-// return view('Bilettm.ViewEvent.EventPageCheckout', $data);
+// return view('Public.ViewEvent.EventPageCheckout', $data);
+ return view('Bilettm.ViewEvent.CheckoutPage', $data);
}
/**
@@ -381,7 +381,7 @@ class EventCheckoutController extends Controller
$orderService->calculateFinalCosts();
$secondsToExpire = Carbon::now()->diffInSeconds($order_session['expires']);
$transaction_data += [
- 'amount' => $orderService->getGrandTotal()*100,//todo multiply by 100
+ 'amount' => $orderService->getGrandTotal()*1,//todo multiply by 100
'currency' => 934,
'sessionTimeoutSecs' => $secondsToExpire,
'description' => 'Order for customer: ' . $request->get('order_email'),
@@ -584,17 +584,17 @@ class EventCheckoutController extends Controller
$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_line_one = sanitise($request_data['business_address_line1']);
- $order->business_address_line_two = sanitise($request_data['business_address_line2']);
- $order->business_address_state_province = sanitise($request_data['business_address_state']);
- $order->business_address_city = sanitise($request_data['business_address_city']);
- $order->business_address_code = sanitise($request_data['business_address_code']);
-
- }
+// 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_line_one = sanitise($request_data['business_address_line1']);
+// $order->business_address_line_two = sanitise($request_data['business_address_line2']);
+// $order->business_address_state_province = sanitise($request_data['business_address_state']);
+// $order->business_address_city = sanitise($request_data['business_address_city']);
+// $order->business_address_code = sanitise($request_data['business_address_code']);
+//
+// }
// Calculating grand total including tax
$orderService = new OrderService($ticket_order['order_total'], $ticket_order['total_booking_fee'], $event);
@@ -790,7 +790,7 @@ class EventCheckoutController extends Controller
return view('Public.ViewEvent.Embedded.EventPageViewOrder', $data);
}
- return view('Public.ViewEvent.EventPageViewOrder', $data);
+ return view('Bilettm.ViewEvent.ViewOrderPage', $data);
}
/**
diff --git a/app/Http/Controllers/PublicController.php b/app/Http/Controllers/PublicController.php
index 2fa3d7dd..5becf13b 100644
--- a/app/Http/Controllers/PublicController.php
+++ b/app/Http/Controllers/PublicController.php
@@ -75,7 +75,7 @@ class PublicController extends Controller
$e_query->whereDate('start_date','>=',Carbon::parse($date));
}
- $events = $e_query->paginate(10);
+ $events = $e_query->with('images')->paginate(1);
$navigation = $nav_query->get();
// dd($events);
return view('Bilettm.Public.EventsPage')->with([
@@ -88,7 +88,7 @@ class PublicController extends Controller
public function search(SearchRequest $request){
//todo implement with elastick search and scout
$query = $request->get('q');
- $events = Event::where('title','like',"%{$query}%")->get();
+ $events = Event::where('title','like',"%{$query}%")->paginate(10);
return view('Bilettm.Public.SearchResults')
->with([
diff --git a/app/Http/api_routes.php b/app/Http/api_routes.php
index 8192b956..4b608727 100644
--- a/app/Http/api_routes.php
+++ b/app/Http/api_routes.php
@@ -1,19 +1,23 @@
'api', 'middleware' => 'auth:api'], function () {
+Route::group(['prefix' => 'api'], function () {
- /*
- * ---------------
- * Organisers
- * ---------------
- */
+ Route::get('category/{parent_id?}','API\PublicController@getCategories');
+ Route::get('events/{cat_id?}','API\PublicController@getEvents');
+
+ Route::group(['prefix' =>'admin', 'middleware' => 'auth:api'], function (){
+ /*
+ * ---------------
+ * Organisers
+ * ---------------
+ */
- /*
- * ---------------
- * Events
- * ---------------
- */
+ /*
+ * ---------------
+ * Events
+ * ---------------
+ */
Route::resource('events', 'API\EventsApiController');
@@ -44,11 +48,11 @@ Route::group(['prefix' => 'api', 'middleware' => 'auth:api'], function () {
*/
- Route::get('/', function () {
- return response()->json([
- 'Hello' => Auth::guard('api')->user()->full_name . '!'
- ]);
+ // Route::get('/', function () {
+ // return response()->json([
+ // 'Hello' => Auth::guard('api')->user()->full_name . '!'
+ // ]);
+ // });
});
-
});
\ No newline at end of file
diff --git a/app/Http/routes.php b/app/Http/routes.php
index fa2487ef..60da8244 100644
--- a/app/Http/routes.php
+++ b/app/Http/routes.php
@@ -41,16 +41,6 @@ Route::group(
'as' => 'logout',
]);
-
- Route::get('/terms_and_conditions', [
- 'as' => 'termsAndConditions',
- function () {
- return 'TODO: add terms and cond';
- }
- ]);
-
-
-
Route::group(['middleware' => ['installed']], function () {
/*
@@ -344,28 +334,11 @@ Route::group(
]
);
- Route::get('{event_id}', function ($event_id) {
- return Redirect::route('showEventDashboard', [
- 'event_id' => $event_id,
- ]);
- });
+ Route::get('{event_id}', 'EventDashboardController@showDashboard');
- /*
- * @todo Move to a controller
- */
Route::get('{event_id}/go_live', [
'as' => 'MakeEventLive',
- function ($event_id) {
- $event = \App\Models\Event::scope()->findOrFail($event_id);
- $event->is_live = 1;
- $event->save();
- \Session::flash('message',
- 'Event Successfully Made Live! You can undo this action in event settings page.');
-
- return Redirect::route('showEventDashboard', [
- 'event_id' => $event_id,
- ]);
- }
+ 'uses'=>'EventController@makeEventLive'
]);
/*
@@ -748,16 +721,13 @@ Route::group(
'uses' =>'PublicController@subscribe'
]);
- Route::get('/terms_and_conditions', [
- 'as' => 'termsAndConditions',
- function () {
- return 'TODO: add terms and cond';
- }
- ]);
+// Route::get('/terms_and_conditions', [
+// 'as' => 'termsAndConditions',
+// function () {
+// return 'TODO: add terms and cond';
+// }
+// ]);
- Route::get('/itemlist', function (){
- return view('Bilettm.Partials.ItemsList');
- });
});
diff --git a/app/Jobs/GenerateTicket.php b/app/Jobs/GenerateTicket.php
index 2464275f..f922020a 100644
--- a/app/Jobs/GenerateTicket.php
+++ b/app/Jobs/GenerateTicket.php
@@ -80,7 +80,7 @@ class GenerateTicket extends Job implements ShouldQueue
Log::info("Ticket generated!");
} catch(\Exception $e) {
Log::error("Error generating ticket. This can be due to permissions on vendor/nitmedia/wkhtml2pdf/src/Nitmedia/Wkhtml2pdf/lib. This folder requires write and execute permissions for the web user");
- Log::error("Error message. " . $e->getMessage());
+ Log::error("Error message. " . $e->getMessage()); //Path must be absolute ("/tmp/")
Log::error("Error stack trace" . $e->getTraceAsString());
$this->fail($e);
}
diff --git a/app/Jobs/SendOrderNotification.php b/app/Jobs/SendOrderNotification.php
index 9c23a7c2..fe5dfc28 100644
--- a/app/Jobs/SendOrderNotification.php
+++ b/app/Jobs/SendOrderNotification.php
@@ -7,6 +7,7 @@ use App\Models\Order;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
+use Illuminate\Support\Facades\Log;
class SendOrderNotification extends Job implements ShouldQueue
{
diff --git a/app/Models/Category.php b/app/Models/Category.php
index c099b787..71eda756 100644
--- a/app/Models/Category.php
+++ b/app/Models/Category.php
@@ -65,8 +65,8 @@ class Category extends \Illuminate\Database\Eloquent\Model{
return $query->where('depth',2)->orderBy('lft','asc');
}
- public function getChildren($parent_id){
- return $this->where('parent_id',$parent_id)->orderBy('lft','asc');
+ public function scopeChildren($query,$parent_id){
+ return $query->where('parent_id',$parent_id)->orderBy('lft','asc');
}
public function parent(){
diff --git a/app/Models/Event.php b/app/Models/Event.php
index d2e61d5c..fc11d761 100644
--- a/app/Models/Event.php
+++ b/app/Models/Event.php
@@ -288,7 +288,7 @@ class Event extends MyBaseModel
*/
public function getCurrencySymbolAttribute()
{
- return $this->currency->symbol_left;
+ return $this->currency->symbol_left ?? '';
}
/**
@@ -451,6 +451,9 @@ ICSTemplate;
return $icsTemplate;
}
+ public function getSeansCount(){
+ return $this->tickets()->distinct()->orderBy('ticket_date')->count();
+ }
/**
* @param integer $accessCodeId
* @return bool
@@ -475,6 +478,6 @@ ICSTemplate;
public function scopeOnLive($query){
$query->whereDate('end_date','>',Carbon::now('Asia/Ashgabat'));
- return $query->where('is_live',1);
+ return $query->where('is_live',1)->with('images');
}
}
diff --git a/resources/lang/en/Event.php b/resources/lang/en/Event.php
index 71f6c8ad..b798c5af 100644
--- a/resources/lang/en/Event.php
+++ b/resources/lang/en/Event.php
@@ -26,6 +26,7 @@ return array (
'event_title' => 'Event Title',
'event_title_placeholder' => 'E.g: :name\'s Interational Conference',
'event_visibility' => 'Event Visibility',
+ 'go_live' => 'Event Successfully Made Live! You can undo this action in event settings page.',
'n_attendees_for_event' => ':num Attendee(s) for event: :name (:date)',
'no_events_yet' => 'No Event Yet!',
'no_events_yet_text' => 'Looks like you have yet to create an event. You can create one by clicking the button below.',
diff --git a/resources/views/Bilettm/Layouts/BilettmLayout.blade.php b/resources/views/Bilettm/Layouts/BilettmLayout.blade.php
index 19bb33bc..969e40f8 100644
--- a/resources/views/Bilettm/Layouts/BilettmLayout.blade.php
+++ b/resources/views/Bilettm/Layouts/BilettmLayout.blade.php
@@ -44,13 +44,19 @@
@yield('after_scripts')
@stack('after_scripts')
-{!!HTML::script(config('attendize.cdn_url_static_assets').'/assets/javascript/frontend.js')!!}
@if(session()->get('message'))
diff --git a/resources/views/Bilettm/Partials/EventItem.blade.php b/resources/views/Bilettm/Partials/EventItem.blade.php
index 3f3da50f..253aa5fc 100644
--- a/resources/views/Bilettm/Partials/EventItem.blade.php
+++ b/resources/views/Bilettm/Partials/EventItem.blade.php
@@ -6,10 +6,9 @@
-
{{$event->start_date->format('d.m.Y')}}
- {{$event->end_date->format('d.m.Y')}}
+ {{$event->getSeansCount()}} seansa
diff --git a/resources/views/Bilettm/Partials/PublicHeader.blade.php b/resources/views/Bilettm/Partials/PublicHeader.blade.php
index 75783d6b..cd580ddd 100644
--- a/resources/views/Bilettm/Partials/PublicHeader.blade.php
+++ b/resources/views/Bilettm/Partials/PublicHeader.blade.php
@@ -39,8 +39,6 @@
@endforeach
-
-
{{--
diff --git a/resources/views/Bilettm/ViewEvent/CheckoutPage.blade.php b/resources/views/Bilettm/ViewEvent/CheckoutPage.blade.php
new file mode 100644
index 00000000..e5d456a4
--- /dev/null
+++ b/resources/views/Bilettm/ViewEvent/CheckoutPage.blade.php
@@ -0,0 +1,53 @@
+@extends('Bilettm.Layouts.BilettmLayout')
+@section('content')
+ @include('Bilettm.ViewEvent.Partials.HeaderSection')
+
+ @include('Bilettm.ViewEvent.Partials.CreateOrderSection')
+
+ @include('Bilettm.ViewEvent.Partials.FooterSection')
+@endsection
+@section('after_scripts')
+ @include("Shared.Partials.LangScript")
+ {!!HTML::script(config('attendize.cdn_url_static_assets').'/assets/javascript/frontend.js')!!}
+
+ @if(isset($secondsToExpire))
+
+ @endif
+@endsection
\ No newline at end of file
diff --git a/resources/views/Bilettm/ViewEvent/EventPage.blade.php b/resources/views/Bilettm/ViewEvent/EventPage.blade.php
index 577de7ef..3d4c7dc2 100644
--- a/resources/views/Bilettm/ViewEvent/EventPage.blade.php
+++ b/resources/views/Bilettm/ViewEvent/EventPage.blade.php
@@ -1,6 +1,6 @@
@extends('Bilettm.Layouts.BilettmLayout')
@section('content')
- {{\DaveJamesMiller\Breadcrumbs\Facades\Breadcrumbs::render('home')}}
+ {{\DaveJamesMiller\Breadcrumbs\Facades\Breadcrumbs::render('event',$event)}}
@@ -56,8 +56,4 @@
@section('after_scripts')
@include("Shared.Partials.LangScript")
{!!HTML::script(config('attendize.cdn_url_static_assets').'/assets/javascript/frontend.js')!!}
-
- @if(isset($secondsToExpire))
-
- @endif
@endsection
\ No newline at end of file
diff --git a/resources/views/Bilettm/ViewEvent/EventPageCheckout.blade.php b/resources/views/Bilettm/ViewEvent/EventPageCheckout.blade.php
deleted file mode 100644
index 9ff4134a..00000000
--- a/resources/views/Bilettm/ViewEvent/EventPageCheckout.blade.php
+++ /dev/null
@@ -1,8 +0,0 @@
-@extends('Bilettm.Layouts.BilettmLayout')
-@section('content')
- @include('Bilettm.ViewEvent.Partials.CheckoutHeader')
-
- @include('Bilettm.ViewEvent.Partials.CreateOrderSection')
-
- @include('Bilettm.ViewEvent.Partials.CheckoutFooter')
-@endsection
\ No newline at end of file
diff --git a/resources/views/Bilettm/ViewEvent/EventPageViewOrder.blade.php b/resources/views/Bilettm/ViewEvent/EventPageViewOrder.blade.php
deleted file mode 100644
index e1e772b5..00000000
--- a/resources/views/Bilettm/ViewEvent/EventPageViewOrder.blade.php
+++ /dev/null
@@ -1,10 +0,0 @@
-@extends('Bilettm.Layouts.BilettmLayout')
-
-@section('content')
-
- @include('Public.ViewEvent.Partials.EventHeaderSection')
- @include('Public.ViewEvent.Partials.EventShareSection')
- @include('Public.ViewEvent.Partials.EventViewOrderSection')
- @include('Public.ViewEvent.Partials.EventFooterSection')
-
-@stop
diff --git a/resources/views/Bilettm/ViewEvent/Partials/CheckoutFooter.blade.php b/resources/views/Bilettm/ViewEvent/Partials/CheckoutFooter.blade.php
deleted file mode 100644
index 4ddf55c4..00000000
--- a/resources/views/Bilettm/ViewEvent/Partials/CheckoutFooter.blade.php
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
+
+
@lang("Public_ViewEvent.order_details")
-
- @lang("Public_ViewEvent.below_order_details_header")
-
-
-
-
-
-
- @lang("Public_ViewEvent.order_summary")
-
-
-
-
-
- @foreach($tickets as $ticket)
-
- | {{{$ticket['ticket']['title']}}} X {{$ticket['qty']}} |
-
- @if((int)ceil($ticket['full_price']) === 0)
- @lang("Public_ViewEvent.free")
- @else
- {{ money($ticket['full_price'], $event->currency) }}
- @endif
- |
-
- @endforeach
-
-
- @if($order_total > 0)
-
- @endif
-
-
-
- {!! @trans("Public_ViewEvent.time", ["time"=>""]) !!}
-
-
-