Work on attendee questions backend design

This commit is contained in:
Dave 2016-04-02 16:20:22 +01:00 committed by Dave Earley
parent 456754a0ef
commit 637d8265ee
4 changed files with 67 additions and 22 deletions

View File

@ -7,9 +7,6 @@ use App\Models\Event;
use App\Models\Ticket;
use App\Models\Question;
use App\Models\QuestionType;
use File;
use Image;
use Validator;
use Illuminate\Http\Request;
class EventQuestionsController extends MyBaseController

View File

@ -30,9 +30,9 @@ class Question extends MyBaseModel
* @access public
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function question_types()
public function question_type()
{
return $this->hasOne('\App\Models\QuestionType');
return $this->belongsTo('\App\Models\QuestionType');
}
/**
@ -45,4 +45,8 @@ class Question extends MyBaseModel
{
return $this->hasMany('\App\Models\QuestionOption');
}
public function tickets() {
return $this->belongsToMany('\App\Models\Ticket');
}
}

View File

@ -195,6 +195,8 @@
<li data-route="{{route('showEventCustomizeTab', ['event_id' => $event->id, 'tab' => 'order_page'])}}"
class="{{$tab == 'order_page' ? 'active' : ''}}"><a href="#order_page" data-toggle="tab">Order
Form</a></li>
<li data-route="{{route('showEventCustomizeTab', ['event_id' => $event->id, 'tab' => 'questions'])}}"
class="{{$tab == 'questions' ? 'active' : ''}}"><a href="#questions" data-toggle="tab">Questions &amp; Answers</a></li>
<li data-route="{{route('showEventCustomizeTab', ['event_id' => $event->id, 'tab' => 'social'])}}"
class="{{$tab == 'social' ? 'active' : ''}}"><a href="#social" data-toggle="tab">Social</a></li>
<li data-route="{{route('showEventCustomizeTab', ['event_id' => $event->id, 'tab' => 'affiliates'])}}"
@ -524,24 +526,7 @@
</div>
</div>
<h4>Attendees questions</h4>
@if ($questions)
<table class="table">
<tbody>
@foreach ($questions as $question)
<tr>
<td>{{ $question->title }}</td>
</tr>
@endforeach
</tbody>
</table>
@endif
<div class="panel-footer mt15 text-right">
<button class="loadModal btn btn-success" type="button" data-modal-id="EditQuestion" href="javascript:void(0);"
data-href="{{route('event.question.create', ['event_id' => $event->id])}}">
<i class="ico-question"></i> Add question
</button>
{!! Form::submit('Save Changes', ['class'=>"btn btn-success"]) !!}
</div>
@ -549,6 +534,64 @@
</div>
<div class="tab-pane {{$tab == 'questions' ? 'active' : ''}}" id="questions">
<h4>Attendees questions</h4>
<div class="panel">
<div class="table-responsive">
@if ($questions)
<table class="table">
<thead>
<th>
Question Title
</th>
<th>
Question Type
</th>
<th>
Applies to tickets
</th>
<th>
</th>
</thead>
<tbody>
@foreach ($questions as $question)
<tr>
<td>
{{ $question->title }}
</td>
<td>
{{ $question->question_type->name }}
</td>
<td>
{{implode(', ', array_column($question->tickets->toArray(), 'title'))}}
</td>
<td>
<a href="#" class="btn btn-xs btn-primary loadModal">
Edit
</a>
<a href="#" class="btn btn-xs btn-danger loadModal">
Delete
</a>
</td>
</tr>
@endforeach
</tbody>
</table>
@endif
</div>
<div class="panel-footer mt15 text-right">
<button class="loadModal btn btn-success" type="button" data-modal-id="EditQuestion" href="javascript:void(0);"
data-href="{{route('event.question.create', ['event_id' => $event->id])}}">
<i class="ico-question"></i> Add question
</button>
</div>
</div>
</div>
<div class="tab-pane {{$tab == 'ticket_design' ? 'active' : ''}}" id="ticket_design">
{!! Form::model($event, array('url' => route('postEditEventTicketDesign', ['event_id' => $event->id]), 'class' => 'ajax ')) !!}
<h4>Ticket Design</h4>

View File

@ -119,6 +119,7 @@
</div>
@include('Public.ViewEvent.Partials.AttendeeQuestions', ['ticket' => $ticket['ticket'],'attendee_number' => $i])
</div>
</div>
</div>
@endfor