Started work on exporting survey answers
This commit is contained in:
parent
d256fecaf8
commit
dccdd9c276
|
|
@ -237,4 +237,36 @@ class EventSurveyController extends MyBaseController
|
|||
return view('ManageEvent.Modals.ViewAnswers', $data);
|
||||
}
|
||||
|
||||
|
||||
public function showExportAnswers(Request $request, $event_id, $export_as = 'xlsx') {
|
||||
|
||||
Excel::create('answers-as-of-'.date('d-m-Y-g.i.a'), function ($excel) use ($event_id) {
|
||||
|
||||
$excel->setTitle('Survey Answers');
|
||||
|
||||
// Chain the setters
|
||||
$excel->setCreator(config('attendize.app_name'))
|
||||
->setCompany(config('attendize.app_name'));
|
||||
|
||||
$excel->sheet('survey_answers_sheet_!', function ($sheet) use ($event_id) {
|
||||
|
||||
$event = Event::scope()->findOrFail($event_id);
|
||||
|
||||
/*
|
||||
* @todo Build array of question and all its answers
|
||||
*/
|
||||
|
||||
$sheet->fromArray([]);
|
||||
|
||||
// Set gray background on first row
|
||||
$sheet->row(1, function ($row) {
|
||||
$row->setBackground('#f5f5f5');
|
||||
});
|
||||
});
|
||||
})->export($export_as);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -594,6 +594,11 @@ Route::group(['middleware' => ['auth', 'first.run']], function () {
|
|||
'uses' => 'EventSurveyController@showEventQuestionAnswers',
|
||||
]);
|
||||
|
||||
Route::get('{event_id}/answers/export/{export_as?}', [
|
||||
'as' => 'showExportAnswers',
|
||||
'uses' => 'EventSurveyController@showExportAnswers',
|
||||
]);
|
||||
|
||||
|
||||
/*
|
||||
* -------
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ return [
|
|||
'event_pdf_tickets_path' => 'user_content/pdf_tickets',
|
||||
'event_bg_images' => 'assets/images/public/EventPage/backgrounds',
|
||||
|
||||
'fallback_organiser_logo_url' => '/assets/images/logo-dark.png',
|
||||
'fallback_organiser_logo_url' => '/assets/images/logo-100x100-lightBg.png',
|
||||
'cdn_url' => '',
|
||||
|
||||
'checkout_timeout_after' => env('CHECKOUT_TIMEOUT_AFTER', 30), #minutes
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@
|
|||
</span>
|
||||
</div>
|
||||
<span class="help-block">
|
||||
Added users will receive instructions complete their registration.
|
||||
Added users will receive further instruction via email.
|
||||
</span>
|
||||
</td>
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
@else
|
||||
<div class="modal-body">
|
||||
<div class="alert alert-info">
|
||||
Sorry, there's no answers to this question yet.
|
||||
Sorry, there are no answers to this question yet.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -40,10 +40,10 @@ Event Surveys
|
|||
<i class="ico-users"></i> Export Answers <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="{{route('showExportOrders', ['event_id'=>$event->id,'export_as'=>'xlsx'])}}">Excel (XLSX)</a></li>
|
||||
<li><a href="{{route('showExportOrders', ['event_id'=>$event->id,'export_as'=>'xls'])}}">Excel (XLS)</a></li>
|
||||
<li><a href="{{route('showExportOrders', ['event_id'=>$event->id,'export_as'=>'csv'])}}">CSV</a></li>
|
||||
<li><a href="{{route('showExportOrders', ['event_id'=>$event->id,'export_as'=>'html'])}}">HTML</a></li>
|
||||
<li><a href="{{route('showExportAnswers', ['event_id'=>$event->id,'export_as'=>'xlsx'])}}">Excel (XLSX)</a></li>
|
||||
<li><a href="{{route('showExportAnswers', ['event_id'=>$event->id,'export_as'=>'xls'])}}">Excel (XLS)</a></li>
|
||||
<li><a href="{{route('showExportAnswers', ['event_id'=>$event->id,'export_as'=>'csv'])}}">CSV</a></li>
|
||||
<li><a href="{{route('showExportAnswers', ['event_id'=>$event->id,'export_as'=>'html'])}}">HTML</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue