Began work on allowing users to manually sort tickets

This commit is contained in:
Dave Earley 2016-05-28 19:49:31 +01:00
parent 15de38ab91
commit 192dbee7a1
3 changed files with 69 additions and 2 deletions

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddSortOrderTicketsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('tickets', function (Blueprint $table) {
$table->integer('sort_order')->default(1);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('tickets', function (Blueprint $table) {
$table->dropColumn('sort_order');
});
}
}

View File

@ -64,6 +64,9 @@
<!--Start Questions table-->
<div class="row">
<script>
/*
@todo Move this into main JS file
*/
$(function () {

View File

@ -14,6 +14,39 @@
Event Tickets
@stop
@section('head')
<script>
$(function () {
$('.sortable').sortable({
handle: '.sortHanlde',
forcePlaceholderSize: true,
placeholderClass: 'col-md-4 col-sm-6 col-xs-12',
}).bind('sortupdate', function (e, ui) {
var data = $('.sortable tr').map(function () {
return $(this).data('question-id');
}).get();
$.ajax({
type: 'POST',
url: '',//Attendize.postUpdateTicketsOrderRoute,
dataType: 'json',
data: {question_ids: data},
success: function (data) {
showMessage(data.message)
},
error: function (data) {
console.log(data);
}
});
});
});
</script>
@stop
@section('menu')
@include('ManageEvent.Partials.Sidebar')
@stop
@ -75,7 +108,7 @@
</div>
@endif
<!--Start ticket table-->
<div class="row">
<div class="row sortable">
@if($tickets->count())
@foreach($tickets as $ticket)
@ -125,7 +158,7 @@
</li>
</ul>
</div>
<div class="panel-footer" style="height: 56px;">
<div class="panel-footer sortHandle" style="height: 56px;">
<ul class="nav nav-section nav-justified">
<li>
<a href="javascript:void(0);">