diff --git a/app/Helpers/helpers.php b/app/Helpers/helpers.php
index 819919c0..a8f9d2c9 100644
--- a/app/Helpers/helpers.php
+++ b/app/Helpers/helpers.php
@@ -7,7 +7,7 @@
* @param string $dec_point
* @param string $thousands_sep
*
- * @return decimal
+ * @return string
*/
function money($amount, $currency_code = '', $decimals = 2, $dec_point = '.', $thousands_sep = ',')
{
diff --git a/app/Http/Controllers/EventCustomizeController.php b/app/Http/Controllers/EventCustomizeController.php
index c883fd1a..49de921f 100644
--- a/app/Http/Controllers/EventCustomizeController.php
+++ b/app/Http/Controllers/EventCustomizeController.php
@@ -71,7 +71,7 @@ class EventCustomizeController extends MyBaseController
* @param $event_id
* @return \Illuminate\Http\JsonResponse
*/
- public function postEditEventSocial(Request $request, $event_id)
+ public function postEditEventTicketSocial(Request $request, $event_id)
{
$event = Event::scope()->findOrFail($event_id);
diff --git a/app/Http/Controllers/EventTicketsController.php b/app/Http/Controllers/EventTicketsController.php
index d814fe34..0c9d7b36 100644
--- a/app/Http/Controllers/EventTicketsController.php
+++ b/app/Http/Controllers/EventTicketsController.php
@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App\Models\Event;
use App\Models\Ticket;
use Carbon\Carbon;
+use Illuminate\Http\Request;
use Input;
use Log;
use Response;
@@ -16,27 +17,33 @@ use View;
class EventTicketsController extends MyBaseController
{
- public function showTickets($event_id)
+ public function showTickets(Request $request, $event_id)
{
- $allowed_sorts = ['created_at', 'quantity_sold', 'sales_volume', 'title'];
-
- $searchQuery = Input::get('q');
- $sort_by = (in_array(Input::get('sort_by'), $allowed_sorts) ? Input::get('sort_by') : 'created_at');
-
- $event = Event::scope()->findOrFail($event_id);
-
- $tickets = $searchQuery
- ? $event->tickets()->where('title', 'like', '%'.$searchQuery.'%')->orderBy($sort_by, 'desc')->paginate(10)
- : $event->tickets()->orderBy($sort_by, 'desc')->paginate(10);
-
- $data = [
- 'event' => $event,
- 'tickets' => $tickets,
- 'sort_by' => $sort_by,
- 'q' => $searchQuery ? $searchQuery : '',
+ $allowed_sorts = [
+ 'created_at' => 'Creation date',
+ 'title' => 'Ticket title',
+ 'quantity_sold' => 'Quantity sold',
+ 'sales_volume' => 'Sales volume',
];
- return View::make('ManageEvent.Tickets', $data);
+ // Getting get parameters.
+ $q = $request->get('q', '');
+ $sort_by = $request->get('sort_by');
+ if (isset($allowed_sorts[$sort_by]) === false)
+ $sort_by = 'title';
+
+ // Find event or return 404 error.
+ $event = Event::scope()->find($event_id);
+ if ($event === null)
+ abort(404);
+
+ // Get tickets for event.
+ $tickets = empty($q) === false
+ ? $event->tickets()->where('title', 'like', '%'.$q.'%')->orderBy($sort_by, 'desc')->paginate()
+ : $event->tickets()->orderBy($sort_by, 'desc')->paginate();
+
+ // Return view.
+ return view('ManageEvent.Tickets', compact('event', 'tickets', 'sort_by', 'q', 'allowed_sorts'));
}
public function showEditTicket($event_id, $ticket_id)
@@ -47,7 +54,7 @@ class EventTicketsController extends MyBaseController
'modal_id' => Input::get('modal_id'),
];
- return View::make('ManageEvent.Modals.EditTicket', $data);
+ return view('ManageEvent.Modals.EditTicket', $data);
}
public function showCreateTicket($event_id)
diff --git a/app/Models/Ticket.php b/app/Models/Ticket.php
index 8d02d992..76e937d6 100644
--- a/app/Models/Ticket.php
+++ b/app/Models/Ticket.php
@@ -8,6 +8,8 @@ class Ticket extends MyBaseModel
{
use SoftDeletes;
+ protected $perPage = 10;
+
/**
* The rules to validate the model.
*
@@ -179,9 +181,9 @@ class Ticket extends MyBaseModel
*
* @return bool
*/
- public function isFree()
+ public function getIsFreeAttribute()
{
- return (int) ceil($this->price) === 0;
+ return ceil($this->price) === 0;
}
/**
@@ -191,36 +193,18 @@ class Ticket extends MyBaseModel
*/
public function getSaleStatusAttribute()
{
- if ($this->start_sale_date !== null) {
- if ($this->start_sale_date->isFuture()) {
- return config('attendize.ticket_status_before_sale_date');
- }
- }
+ if ($this->start_sale_date !== null && $this->start_sale_date->isFuture())
+ return config('attendize.ticket_status_before_sale_date');
- if ($this->end_sale_date !== null) {
- if ($this->end_sale_date->isPast()) {
- return config('attendize.ticket_status_after_sale_date');
- }
- }
+ if ($this->end_sale_date !== null && $this->end_sale_date->isPast())
+ return config('attendize.ticket_status_after_sale_date');
- if ((int) $this->quantity_available > 0) {
- if ((int) $this->quantity_remaining <= 0) {
- return config('attendize.ticket_status_sold_out');
- }
- }
+ if ((int) $this->quantity_available > 0 && (int) $this->quantity_remaining <= 0)
+ return config('attendize.ticket_status_sold_out');
- if ($this->event->start_date->lte(\Carbon::now())) {
+ if ($this->event->start_date->lte(\Carbon::now()))
return config('attendize.ticket_status_off_sale');
- }
return config('attendize.ticket_status_on_sale');
}
-
-// public function setQuantityAvailableAttribute($value) {
-// $this->attributes['quantity_available'] = trim($value) == '' ? -1 : $value;
-// }
-//
-// public function setMaxPerPersonAttribute($value) {
-// $this->attributes['max_per_person'] = trim($value) == '' ? -1 : $value;
-// }
}
diff --git a/public/assets/stylesheet/application.css b/public/assets/stylesheet/application.css
index 16e7dbbd..84fc6c97 100644
--- a/public/assets/stylesheet/application.css
+++ b/public/assets/stylesheet/application.css
@@ -149,4 +149,4 @@ body {
font-size: 9px;
font-weight: normal;
}
-.page-title .title .organiser_logo{position:absolute;height:45px;right:20px;top:5px;bottom:5px}.page-title .title .organiser_logo img{max-height:45px}.nav li.nav-button a span{padding:10px;background-color:#037c9c}.event.panel{margin-top:10px}.event .event-date{border:1px solid #fff;padding-bottom:9px;padding-top:7px;text-align:center;text-shadow:0 1px 1px rgba(0,0,0,0.1);width:46px;position:absolute;background-color:#fff;top:-13px;border-color:#0384a6;color:#666}.event .event-date .day{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:22px;font-weight:500;margin:-2px auto -6px auto}.event .event-date .month{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:10px;font-weight:500;margin:-2px auto 0 auto}.event .event-meta{margin:0;padding:0;margin-left:60px;height:55px;margin-top:10px;color:#fff}.event .event-meta li{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;list-style:none;font-size:12px}.event .event-meta li a{color:#fff}.event .event-meta li.event-title a{font-size:16px}.event .event-meta li.event-organiser a{font-weight:bold}.event .panel-title{height:60px;padding:10px}.event .panel-title a{margin:0;height:40px;display:table-cell;vertical-align:middle;text-indent:50px}.stat-box{padding:20px;background-color:#0398bf;color:#fff;text-align:center;margin-bottom:10px;border-bottom:4px solid rgba(0,0,0,0.2)}.stat-box h3{margin-bottom:5px;margin-top:0;font-weight:200}.stat-box span{text-transform:uppercase;font-weight:lighter;color:#d0f0fe}.stat-box:nth-child(odd){background-color:#0384a6}.top_of_page_alert{border:none;margin:0;text-align:center;border-bottom:5px solid}.v-align-text{text-align:center;position:relative;top:50%;-ms-transform:translateY(-50%);-wekbit-transform:translateY(-50%);transform:translateY(-50%)}@media (max-width:992px){.page-header>[class*=" col-"],.page-header>[class^="col-"]{margin-bottom:10px}}@media (max-width:480px){.btn-group-responsive{margin-bottom:-10px;float:none !important;display:block !important}.btn-group-responsive .btn{width:100%;padding-left:0;padding-right:0;margin-bottom:10px}.btn-group-responsive .pull-left,.btn-group-responsive .pull-right{float:none !important}}label.required::after{content:'*';color:red;padding-left:3px;font-size:9px}.hasDatepicker[disabled],.hasDatepicker[readonly],fieldset[disabled] .hasDatepicker{cursor:pointer !important;background-color:#fff !important;opacity:1}.more-options{display:none}.col-sort{color:#fff}.col-sort :hover{color:#fff}.pac-container{z-index:9999}.dtpicker-overlay{z-index:9999}.dtpicker-close{display:none}.dtpicker-header .dtpicker-title{color:#afafaf;text-align:center;font-size:18px;font-weight:normal}.dtpicker-header .dtpicker-value{padding:.8em .2em .2em .2em;color:#0384a6;text-align:center;font-size:1.4em}.dtpicker-buttonCont .dtpicker-button{background:#0384a6;border-radius:0}.dtpicker-content{border-radius:0}.sidebar-open-ltr body{overflow-x:hidden}.order_options{margin:10px 0;padding:5px 15px;margin-top:0}.order_options .event_count{font-weight:bold;color:#777;line-height:30px}.well{background-color:#f9f9f9;box-shadow:none}.input-group-btn select{width:115px !important;border-left:0;font-size:12px}.btn-file{position:relative;overflow:hidden}.btn-file input[type=file]{position:absolute;top:0;right:0;min-width:100%;min-height:100%;font-size:100px;text-align:right;filter:alpha(opacity=0);opacity:0;background:red;cursor:inherit;display:block}input[readonly]{background-color:white !important;cursor:text !important}html.working{cursor:progress}
\ No newline at end of file
+.page-title .title .organiser_logo{position:absolute;height:45px;right:20px;top:5px;bottom:5px}.page-title .title .organiser_logo img{max-height:45px}.nav li.nav-button a span{padding:10px;background-color:#037c9c}.event.panel{margin-top:10px}.event .event-date{border:1px solid #fff;padding-bottom:9px;padding-top:7px;text-align:center;text-shadow:0 1px 1px rgba(0,0,0,0.1);width:46px;position:absolute;background-color:#fff;top:-13px;border-color:#0384a6;color:#666}.event .event-date .day{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:22px;font-weight:500;margin:-2px auto -6px auto}.event .event-date .month{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:10px;font-weight:500;margin:-2px auto 0 auto}.event .event-meta{margin:0;padding:0;margin-left:60px;height:55px;margin-top:10px;color:#fff}.event .event-meta li{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;list-style:none;font-size:12px}.event .event-meta li a{color:#fff}.event .event-meta li.event-title a{font-size:16px}.event .event-meta li.event-organiser a{font-weight:bold}.event .panel-title{height:60px;padding:10px}.event .panel-title a{margin:0;height:40px;display:table-cell;vertical-align:middle;text-indent:50px}.stat-box{padding:20px;background-color:#0398bf;color:#fff;text-align:center;margin-bottom:10px;border-bottom:4px solid rgba(0,0,0,0.2)}.stat-box h3{margin-bottom:5px;margin-top:0;font-weight:200}.stat-box span{text-transform:uppercase;font-weight:lighter;color:#d0f0fe}.stat-box:nth-child(odd){background-color:#0384a6}.top_of_page_alert{border:none;margin:0;text-align:center;border-bottom:5px solid}.v-align-text{text-align:center;position:relative;top:50%;-ms-transform:translateY(-50%);-wekbit-transform:translateY(-50%);transform:translateY(-50%)}@media (max-width:992px){.page-header>[class*=" col-"],.page-header>[class^="col-"]{margin-bottom:10px}}@media (max-width:480px){.btn-group-responsive{margin-bottom:-10px;float:none !important;display:block !important}.btn-group-responsive .btn{width:100%;padding-left:0;padding-right:0;margin-bottom:10px}.btn-group-responsive .pull-left,.btn-group-responsive .pull-right{float:none !important}}label.required::after{content:'*';color:red;padding-left:3px;font-size:9px}.hasDatepicker[disabled],.hasDatepicker[readonly],fieldset[disabled] .hasDatepicker{cursor:pointer !important;background-color:#fff !important;opacity:1}.more-options{display:none}.col-sort{color:#fff}.col-sort :hover{color:#fff}.pac-container{z-index:9999}.dtpicker-overlay{z-index:9999}.dtpicker-close{display:none}.dtpicker-header .dtpicker-title{color:#afafaf;text-align:center;font-size:18px;font-weight:normal}.dtpicker-header .dtpicker-value{padding:.8em .2em .2em .2em;color:#0384a6;text-align:center;font-size:1.4em}.dtpicker-buttonCont .dtpicker-button{background:#0384a6;border-radius:0}.dtpicker-content{border-radius:0}.sidebar-open-ltr body{overflow-x:hidden}.order_options .event_count{font-weight:bold;color:#777;line-height:30px}.well{background-color:#f9f9f9;box-shadow:none}.input-group-btn select{width:115px !important;border-left:0;font-size:12px}.btn-file{position:relative;overflow:hidden}.btn-file input[type=file]{position:absolute;top:0;right:0;min-width:100%;min-height:100%;font-size:100px;text-align:right;filter:alpha(opacity=0);opacity:0;background:red;cursor:inherit;display:block}input[readonly]{background-color:white !important;cursor:text !important}html.working{cursor:progress}
\ No newline at end of file
diff --git a/public/assets/stylesheet/custom.less b/public/assets/stylesheet/custom.less
index 7457d543..3d17785d 100644
--- a/public/assets/stylesheet/custom.less
+++ b/public/assets/stylesheet/custom.less
@@ -298,12 +298,6 @@ label.required::after {
}
}
-.order_options {
- margin: 10px 0;
- padding: 5px 15px;
- margin-top: 0;
-}
-
.order_options .event_count {
font-weight: bold;
color: #777;
diff --git a/resources/views/ManageAccount/Modals/EditAccount.blade.php b/resources/views/ManageAccount/Modals/EditAccount.blade.php
index 5d32a51f..9ecd5557 100644
--- a/resources/views/ManageAccount/Modals/EditAccount.blade.php
+++ b/resources/views/ManageAccount/Modals/EditAccount.blade.php
@@ -112,7 +112,7 @@
account you can do so using the button below.
@endif
-
diff --git a/resources/views/ManageEvent/Customize.blade.php b/resources/views/ManageEvent/Customize.blade.php
index db35a72c..0f47e7c0 100644
--- a/resources/views/ManageEvent/Customize.blade.php
+++ b/resources/views/ManageEvent/Customize.blade.php
@@ -211,42 +211,22 @@
| - Affiliate Name - | -- Visits Generated - | -- Ticket Sales Generated - | -- Sales Volume Generated - | -- Last Referral - | +Affiliate Name | +Visits Generated | +Ticket Sales Generated | +Sales Volume Generated | +Last Referral |
|---|---|---|---|---|---|---|---|---|---|
| - {{{$affiliate->name}}} - | -- {{$affiliate->visits}} - | -- {{$affiliate->tickets_sold}} - | -- {{money($affiliate->sales_volume, $event->currency->code)}} - | -- {{{ $affiliate->updated_at->format('M dS H:i A') }}} - | +{{ $affiliate->name }} | +{{ $affiliate->visits }} | +{{ $affiliate->tickets_sold }} | +{{ money($affiliate->sales_volume, $event->currency->code) }} | +{{ $affiliate->updated_at->format('M dS H:i A') }} |