Work on event survey

Removed the need to pass modal_id to each modal
Cleaned up the UI
This commit is contained in:
Dave 2016-04-06 00:27:23 +01:00 committed by Dave Earley
parent 1a19c2ccd4
commit 82da15cad4
31 changed files with 133 additions and 112 deletions

View File

@ -17,7 +17,6 @@ use DB;
use Excel;
use Mail;
use Response;
use Session;
use Validator;
class EventAttendeesController extends MyBaseController
@ -92,7 +91,6 @@ class EventAttendeesController extends MyBaseController
}
return view('ManageEvent.Modals.CreateAttendee', [
'modal_id' => $request->get('modal_id'),
'event' => $event,
'tickets' => $event->tickets()->lists('title', 'id'),
]);
@ -230,7 +228,6 @@ class EventAttendeesController extends MyBaseController
$data = [
'attendee' => $attendee,
'event' => $attendee->event,
'modal_id' => $request->get('modal_id'),
];
return view('ManageEvent.Modals.MessageAttendee', $data);
@ -302,7 +299,6 @@ class EventAttendeesController extends MyBaseController
{
$data = [
'event' => Event::scope()->find($event_id),
'modal_id' => $request->get('modal_id'),
'tickets' => Event::scope()->find($event_id)->tickets()->lists('title', 'id')->toArray(),
];
@ -359,8 +355,6 @@ class EventAttendeesController extends MyBaseController
public function showExportAttendees($event_id, $export_as = 'xls')
{
Excel::create('attendees-as-of-'.date('d-m-Y-g.i.a'), function ($excel) use ($event_id) {
$excel->setTitle('Attendees List');
@ -423,7 +417,6 @@ class EventAttendeesController extends MyBaseController
'attendee' => $attendee,
'event' => $attendee->event,
'tickets' => $attendee->event->tickets->lists('title', 'id'),
'modal_id' => $request->get('modal_id'),
];
return view('ManageEvent.Modals.EditAttendee', $data);
@ -487,7 +480,6 @@ class EventAttendeesController extends MyBaseController
'attendee' => $attendee,
'event' => $attendee->event,
'tickets' => $attendee->event->tickets->lists('title', 'id'),
'modal_id' => $request->get('modal_id'),
];
return view('ManageEvent.Modals.CancelAttendee', $data);
@ -553,7 +545,6 @@ class EventAttendeesController extends MyBaseController
$data = [
'attendee' => $attendee,
'event' => $attendee->event,
'modal_id' => $request->get('modal_id'),
];
return view('ManageEvent.Modals.ResendTicketToAttendee', $data);

View File

@ -79,7 +79,6 @@ class EventOrdersController extends MyBaseController
{
$data = [
'order' => Order::scope()->find($order_id),
'modal_id' => $request->get('modal_id'),
];
return view('ManageEvent.Modals.ManageOrder', $data);
@ -284,7 +283,6 @@ class EventOrdersController extends MyBaseController
$data = [
'order' => $order,
'event' => $order->event,
'modal_id' => $request->get('modal_id'),
];
return view('ManageEvent.Modals.MessageOrder', $data);

View File

@ -6,6 +6,7 @@ use App\Http\Requests\StoreEventQuestionRequest;
use App\Models\Event;
use App\Models\Attendee;
use App\Models\Question;
use App\Models\QuestionAnswer;
use App\Models\QuestionType;
use Illuminate\Http\Request;
@ -49,7 +50,6 @@ class EventSurveyController extends MyBaseController
return view('ManageEvent.Modals.CreateQuestion', [
'event' => $event,
'modal_id' => $request->get('modal_id'),
'question_types' => QuestionType::all(),
]);
}
@ -123,7 +123,6 @@ class EventSurveyController extends MyBaseController
'question' => $question,
'event' => $event,
'question_types' => QuestionType::all(),
'modal_id' => $request->get('modal_id'),
];
return view('ManageEvent.Modals.EditQuestion', $data);
@ -224,11 +223,17 @@ class EventSurveyController extends MyBaseController
public function showEventQuestionAnswers(Request $request, $event_id, $question_id)
{
$attendees = Attendee::scope()->where('event_id', $event_id)->get();
$answers = QuestionAnswer::scope()->where('question_id', $question_id)->get();
$question = Question::scope()->withTrashed()->find($question_id);
$attendees = Attendee::scope()
->has('answers')
->where('event_id', $event_id)
->get();
$data = [
'attendees' => $attendees,
'modal_id' => $request->get('modal_id'),
'answers' => $answers,
'question' => $question,
];
return view('ManageEvent.Modals.ViewAnswers', $data);

View File

@ -51,7 +51,6 @@ class EventTicketsController extends MyBaseController
$data = [
'event' => Event::scope()->find($event_id),
'ticket' => Ticket::scope()->find($ticket_id),
'modal_id' => Input::get('modal_id'),
];
return view('ManageEvent.Modals.EditTicket', $data);
@ -60,7 +59,6 @@ class EventTicketsController extends MyBaseController
public function showCreateTicket($event_id)
{
return View::make('ManageEvent.Modals.CreateTicket', [
'modal_id' => Input::get('modal_id'),
'event' => Event::find($event_id),
]);
}

View File

@ -20,7 +20,6 @@ class ManageAccountController extends MyBaseController
public function showEditAccount(Request $request)
{
$data = [
'modal_id' => $request->get('modal_id'),
'account' => Account::find(Auth::user()->account_id),
'timezones' => Timezone::lists('location', 'id'),
'currencies' => Currency::lists('title', 'id'),

View File

@ -55,13 +55,9 @@ class OrganiserController extends MyBaseController
public function showCreateOrganiser()
{
return View::make('ManageOrganiser.CreateOrganiser', [
'modal_id' => 'createOrganiser',
]);
return View::make('ManageOrganiser.CreateOrganiser');
return View::make('ManageEvents.Modals.CreateOrganiser', [
'modal_id' => Input::get('modal_id'),
]);
return View::make('ManageEvents.Modals.CreateOrganiser');
}
public function postCreateOrganiser()

View File

@ -34,4 +34,6 @@ class OrganiserEventsController extends MyBaseController
return View::make('ManageOrganiser.Events', $data);
}
}

View File

@ -78,7 +78,7 @@ class Attendee extends MyBaseModel
{
return $this->belongsTo('\App\Models\Event');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/

View File

@ -28,7 +28,15 @@ class QuestionAnswer extends MyBaseModel
*/
public function question()
{
return $this->belongsTo('\App\Models\Question');
return $this->belongsTo('\App\Models\Question')->withTrashed();
}
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function attendee()
{
return $this->belongsTo('\App\Models\Attendee');
}
}

View File

@ -146,23 +146,15 @@ $(function () {
$(document.body).on('click', '.loadModal, [data-invoke~=modal]', function (e) {
var loadUrl = $(this).data('href'),
modalId = $(this).data('modal-id'),
cacheResult = $(this).data('cache') === 'on';
cacheResult = $(this).data('cache') === 'on',
$button = $(this);
// $('#' + modalId).remove();
$('.modal').remove();
$('html').addClass('working');
/*
* Hopefully this message will rarely show
*/
setTimeout(function () {
//showMessage('One second...'); #far to annoying
}, 750);
$.ajax({
url: loadUrl,
data: {'modal_id': modalId},
data: {},
localCache: cacheResult,
dataType: 'html',
success: function (data) {
@ -170,7 +162,7 @@ $(function () {
$('body').append(data);
var $modal = $('#' + modalId);
var $modal = $('.modal');
$modal.modal({
'backdrop': 'static'

View File

@ -8800,23 +8800,15 @@ $(function () {
$(document.body).on('click', '.loadModal, [data-invoke~=modal]', function (e) {
var loadUrl = $(this).data('href'),
modalId = $(this).data('modal-id'),
cacheResult = $(this).data('cache') === 'on';
cacheResult = $(this).data('cache') === 'on',
$button = $(this);
// $('#' + modalId).remove();
$('.modal').remove();
$('html').addClass('working');
/*
* Hopefully this message will rarely show
*/
setTimeout(function () {
//showMessage('One second...'); #far to annoying
}, 750);
$.ajax({
url: loadUrl,
data: {'modal_id': modalId},
data: {},
localCache: cacheResult,
dataType: 'html',
success: function (data) {
@ -8824,7 +8816,7 @@ $(function () {
$('body').append(data);
var $modal = $('#' + modalId);
var $modal = $('.modal');
$modal.modal({
'backdrop': 'static'

View File

@ -1,4 +1,4 @@
<div role="dialog" id="{{$modal_id}}" class="modal fade" style="display: none;">
<div role="dialog" class="modal fade" style="display: none;">
<style>
.account_settings .modal-body {
border: 0;

View File

@ -108,7 +108,7 @@ Attendees
</td>
<td class="text-center">
<div class="btn-group">
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Action <span class="caret"></span></button>
<button type="button" class="btn btn-xs btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Action <span class="caret"></span></button>
<ul class="dropdown-menu">
@if($attendee->email)
<li><a

View File

@ -300,37 +300,37 @@
<label class="control-label">Share buttons to show.</label>
<br>
<div class="checkbox">
<div class="checkbox checkbox-inline">
<label>
{!! Form::checkbox('social_show_facebook', 1, $event->social_show_facebook, ['data-toggle' => 'toggle']) !!}
Facebook
</label>
</div>
<div class="checkbox">
<div class="checkbox checkbox-inline">
<label>
{!! Form::checkbox('social_show_twitter', 1, $event->social_show_twitter, ['data-toggle' => 'toggle']) !!}
Twitter
</label>
</div>
<div class="checkbox">
<div class="checkbox checkbox-inline">
<label>
{!! Form::checkbox('social_show_googleplus', 1, $event->social_show_googleplus, ['data-toggle' => 'toggle']) !!}
Google+
</label>
</div>
<div class="checkbox">
<div class="checkbox checkbox-inline">
<label>
{!! Form::checkbox('social_show_email', 1, $event->social_show_email, ['data-toggle' => 'toggle']) !!}
Email
</label>
</div>
<div class="checkbox">
<div class="checkbox checkbox-inline">
<label>
{!! Form::checkbox('social_show_linkedin', 1, $event->social_show_linkedin, ['data-toggle' => 'toggle']) !!}
LinkedIn
</label>
</div>
<div class="checkbox">
<div class="checkbox checkbox-inline">
<label>
{!! Form::checkbox('social_show_whatsapp', 1, $event->social_show_whatsapp, ['data-toggle' => 'toggle']) !!}
WhatsApp
@ -484,20 +484,6 @@
{!! Form::model($event, array('url' => route('postEditEventOrderPage', ['event_id' => $event->id]), 'class' => 'ajax ')) !!}
<h4>Order Page Settings</h4>
<div class="form-group">
<div class="checkbox">
<label>
{!! Form::checkbox('ask_for_all_attendees_info', 'on', $event->ask_for_all_attendees_info, ['data-toggle' => 'toggle']) !!}
Require details for each attendee?
</label>
</div>
<div class="help-block">
If checked, the buyer will be asked for details of each attendee; as opposed to just
themselves.
</div>
</div>
<div class="form-group">
{!! Form::label('pre_order_display_message', 'Message to display to attendees before they complete their order.', array('class'=>'control-label ')) !!}

View File

@ -1,4 +1,4 @@
<div role="dialog" id="{{$modal_id}}" class="modal fade " style="display: none;">
<div role="dialog" class="modal fade " style="display: none;">
{!! Form::model($attendee, array('url' => route('postCancelAttendee', array('event_id' => $event->id, 'attendee_id' => $attendee->id)), 'class' => 'ajax')) !!}
<div class="modal-dialog">
<div class="modal-content">

View File

@ -1,4 +1,4 @@
<div role="dialog" id="{{$modal_id}}" class="modal fade " style="display: none;">
<div role="dialog" class="modal fade " style="display: none;">
{!! Form::open(array('url' => route('postCancelOrder', array('order_id' => $order->id)), 'class' => 'closeModalAfter ajax')) !!}
<script>
$(function () {

View File

@ -1,4 +1,4 @@
<div role="dialog" id="{{$modal_id}}" class="modal fade " style="display: none;">
<div role="dialog" class="modal fade " style="display: none;">
{!! Form::open(array('url' => route('postCreateAttendee', array('event_id' => $event->id)), 'class' => 'ajax')) !!}
<div class="modal-dialog">
<div class="modal-content">

View File

@ -25,7 +25,7 @@
{!! Form::text('title', '', [
'id' => 'question-title',
'class' => 'form-control',
'placeholder' => 'e.g.: What is your name?',
'placeholder' => 'e.g. Please enter your full address?',
]) !!}
</div>
<div class="form-group">
@ -48,6 +48,7 @@
{!! Form::text('instructions', null, [
'id' => 'question-instructions',
'class' => 'form-control',
'placeholder' => 'e.g. Please enter your post code in the format XXX XX?'
]) !!}
</div>
<fieldset id="question-options" {!! empty($question->has_options) ? ' class="hide"' : '' !!}>

View File

@ -1,4 +1,4 @@
<div role="dialog" id="{{$modal_id}}" class="modal fade" style="display: none;">
<div role="dialog" class="modal fade" style="display: none;">
{!! Form::open(array('url' => route('postCreateTicket', array('event_id' => $event->id)), 'class' => 'ajax')) !!}
<div class="modal-dialog">
<div class="modal-content">

View File

@ -1,4 +1,4 @@
<div role="dialog" id="{{$modal_id}}" class="modal fade" style="display: none;">
<div role="dialog" class="modal fade" style="display: none;">
{!! Form::model($attendee, array('url' => route('postEditAttendee', array('event_id' => $event->id, 'attendee_id' => $attendee->id)), 'class' => 'ajax')) !!}
<div class="modal-dialog">
<div class="modal-content">

View File

@ -1,4 +1,4 @@
<div role="dialog" id="{{$modal_id}}" class="modal fade " style="display: none;">
<div role="dialog" class="modal fade " style="display: none;">
{!! Form::model($ticket, ['url' => route('postEditTicket', ['ticket_id' => $ticket->id, 'event_id' => $event->id]), 'class' => 'ajax']) !!}
<div class="modal-dialog">
<div class="modal-content">

View File

@ -1,4 +1,4 @@
<div role="dialog" id="{{$modal_id}}" class="modal fade " style="display: none;">
<div role="dialog" class="modal fade " style="display: none;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header text-center">

View File

@ -1,4 +1,4 @@
<div role="dialog" id="{{$modal_id}}" class="modal fade" style="display: none;">
<div role="dialog" class="modal fade" style="display: none;">
<style>
.well.nopad {
padding: 0px;

View File

@ -1,4 +1,4 @@
<div role="dialog" id="{{$modal_id}}" class="modal fade" style="display: none;">
<div role="dialog" class="modal fade" style="display: none;">
{!! Form::open(array('url' => route('postMessageAttendee', array('attendee_id' => $attendee->id)), 'class' => 'ajax reset closeModalAfter')) !!}
<div class="modal-dialog">
<div class="modal-content">
@ -31,7 +31,7 @@
</div>
<div class="form-group">
<div class="checkbox custom-checkbox">
<div class="checkbox">
<input type="checkbox" name="send_copy" id="send_copy" value="1">
<label for="send_copy">&nbsp;&nbsp;Send a copy to <b>{{$attendee->event->organiser->email}}</b></label>
</div>

View File

@ -1,4 +1,4 @@
<div role="dialog" id="{{$modal_id}}" class="modal fade " style="display: none;">
<div role="dialog" class="modal fade " style="display: none;">
{!! Form::open(array('url' => route('postMessageAttendees', array('event_id' => $event->id)), 'class' => 'reset ajax closeModalAfter')) !!}
<div class="modal-dialog">
<div class="modal-content">
@ -45,7 +45,7 @@
</div>
<div class="form-group">
<div class="checkbox custom-checkbox">
<div class="checkbox ">
<input type="checkbox" name="send_copy" id="send_copy" value="1">
<label for="send_copy">&nbsp;&nbsp;Send a copy to
<strong>{{$event->organiser->email}}</strong></label>

View File

@ -1,4 +1,4 @@
<div role="dialog" id="{{$modal_id}}" class="modal fade" style="display: none;">
<div role="dialog" class="modal fade" style="display: none;">
{!! Form::open(array('url' => route('postMessageOrder', array('attendee_id' => $order->id)), 'class' => 'ajax reset closeModalAfter')) !!}
<div class="modal-dialog">
<div class="modal-content">

View File

@ -1,4 +1,4 @@
<div role="dialog" id="{{$modal_id}}" class="modal fade" style="display: none;">
<div role="dialog" class="modal fade" style="display: none;">
{!! Form::open(array('url' => route('postResendTicketToAttendee', array('attendee_id' => $attendee->id)), 'class' => 'ajax reset closeModalAfter')) !!}
<div class="modal-dialog">
<div class="modal-content">

View File

@ -1,25 +1,52 @@
<div role="dialog" id="{{$modal_id}}" class="modal fade" style="display: none;">
<div role="dialog" class="modal fade" style="display: ;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header text-center">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h3 class="modal-title">
<i class="ico-question3"></i>
View Answers
Q: {{ $question->title }}
</h3>
</div>
<div class="modal-body">
@foreach($attendees as $attendee)
@if(count($attendee->answers))
{{ $attendee->first_name }} {{ $attendee->last_name }}<br>
@foreach($attendee->answers as $answer)
<b>{{ $answer->question->title }}</b><br>
{{ $answer->answer_text }}<br>
@endforeach
<hr>
@endif
@endforeach
</div> <!-- /end modal body-->
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>
Attendee Details
</th>
<th>
Ticket
</th>
<th>
Answer
</th>
</tr>
</thead>
<tbody>
@foreach($answers as $answer)
<tr>
<td>
{{ $answer->attendee->full_name }}<br>
<a href="javascript:void(0);">{{ $answer->attendee->email }}</a><br>
</td>
<td>
{{ $answer->attendee->ticket->title }}
</td>
<td>
{!! nl2br(e($answer->answer_text)) !!}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="modal-footer">
{!! Form::button('Close', ['class'=>"btn modal-close btn-danger",'data-dismiss'=>'modal']) !!}
</div>

View File

@ -15,7 +15,7 @@ Event Surveys
@stop
@section('page_title')
<i class='ico-cart mr5'></i>
<i class='ico-clipboard4 mr5'></i>
Event Surveys
@stop
@ -99,11 +99,37 @@ Event Surveys
<td>
{{implode(', ', array_column($question->tickets->toArray(), 'title'))}}
</td>
<td>
<a class="btn btn-xs btn-primary loadModal" data-modal-id="showEventQuestionAnswers" href="javascript:void(0);"
data-href="{{route('showEventQuestionAnswers', ['event_id' => $event->id, 'question_id' => $question->id])}}">
View Answers
</a>
<td class="text-center">
<div class="btn-group">
<button type="button" class="btn btn-xs btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Action <span class="caret"></span></button>
<ul class="dropdown-menu">
<li>
<a class="loadModal" data-modal-id="showEventQuestionAnswers" href="javascript:void(0);"
data-href="{{route('showEventQuestionAnswers', ['event_id' => $event->id, 'question_id' => $question->id])}}">
View Answers
</a>
</li>
<li>
<a class="loadModal" data-modal-id="showEventQuestionAnswers" href="javascript:void(0);"
data-href="{{route('showEventQuestionAnswers', ['event_id' => $event->id, 'question_id' => $question->id])}}">
Export as XLSX
</a>
</li>
<li>
<a class="loadModal" data-modal-id="showEventQuestionAnswers" href="javascript:void(0);"
data-href="{{route('showEventQuestionAnswers', ['event_id' => $event->id, 'question_id' => $question->id])}}">
Export as CSV
</a>
</li>
<li>
<a class="loadModal" data-modal-id="showEventQuestionAnswers" href="javascript:void(0);"
data-href="{{route('showEventQuestionAnswers', ['event_id' => $event->id, 'question_id' => $question->id])}}">
Export as HTML
</a>
</li>
</ul>
</div>
<a class="btn btn-xs btn-primary loadModal" data-modal-id="EditQuestion" href="javascript:void(0);"
data-href="{{route('showEditEventQuestion', ['event_id' => $event->id, 'question_id' => $question->id])}}">
Edit

View File

@ -1,4 +1,4 @@
<div role="dialog" id="{{$modal_id}}" class="modal fade" style="display: none;">
<div role="dialog" class="modal fade" style="display: none;">
@include('ManageOrganiser.Partials.EventCreateAndEditJS');

View File

@ -1,4 +1,4 @@
<div role="dialog" id="{{$modal_id}}" class="modal fade" style="display: none;">
<div role="dialog" class="modal fade" style="display: none;">
{!! Form::model($user, array('url' => route('postEditUser'), 'class' => 'ajax closeModalAfter')) !!}
<div class="modal-dialog account_settings">
<div class="modal-content">