feature updates 21.05.2019

This commit is contained in:
Arno Kaimbacher 2019-05-21 18:28:18 +02:00
parent ec4ffbdcee
commit 178d0e7f6b
15 changed files with 271 additions and 53 deletions

View File

@ -39,10 +39,10 @@ class EditorController extends Controller
->where('server_state', 'released') ->where('server_state', 'released')
// ->whereIn('server_state', ['released']) // ->whereIn('server_state', ['released'])
->orWhere(function ($query) use ($user_id) { ->orWhere(function ($query) use ($user_id) {
$query->where('server_state', 'editor_accepted') $query->whereIn('server_state', ['editor_accepted', 'rejected_reviewer', 'reviewed'])
->where('editor_id', $user_id); ->where('editor_id', $user_id);
}) })
->orderBy('server_state') ->orderBy('server_date_modified', 'desc')
->get(); ->get();
return view('workflow.editor.index', compact('datasets')); return view('workflow.editor.index', compact('datasets'));
} }
@ -210,6 +210,7 @@ class EditorController extends Controller
$dataset = Dataset::findOrFail($id); $dataset = Dataset::findOrFail($id);
$input = $request->all(); $input = $request->all();
$input['server_state'] = 'approved'; $input['server_state'] = 'approved';
$input['reject_reviewer_note'] = '';
if ($dataset->update($input)) { if ($dataset->update($input)) {
// event(new PageUpdated($page)); // event(new PageUpdated($page));
@ -219,4 +220,37 @@ class EditorController extends Controller
} }
throw new GeneralException(trans('exceptions.publish.approve.update_error')); throw new GeneralException(trans('exceptions.publish.approve.update_error'));
} }
/**
* Reject dataset back to editor
*
* @param int $id
* @return \Illuminate\View\View
*/
public function reject($id): View
{
$dataset = Dataset::with('user:id,login')->findOrFail($id);
return view('workflow.editor.reject', [
'dataset' => $dataset,
]);
}
public function rejectUpdate(Request $request, $id)
{
$this->validate(request(), [
'reject_editor_note' => 'required|min:10|max:255',
'server_state' => 'required'
]);
$dataset = Dataset::findOrFail($id);
$input = $request->all();
//$input['server_state'] = 'rejected_editor';
if ($dataset->update($input)) {
// event(new PageUpdated($page));
return redirect()
->route('publish.workflow.editor.index')
->with('flash_message', 'You have successfully rejected one dataset! The submitter will be informed.');
}
throw new GeneralException(trans('exceptions.publish.review.update_error'));
}
} }

View File

@ -142,6 +142,25 @@ class ReviewController extends Controller
]); ]);
} }
public function rejectUpdate(Request $request, $id)
{
$this->validate(request(), [
'reject_reviewer_note' => 'required|min:10|max:255',
'server_state' => 'required'
]);
$dataset = Dataset::findOrFail($id);
$input = $request->all();
//$input['server_state'] = 'rejected_reviewer';
if ($dataset->update($input)) {
// event(new PageUpdated($page));
return redirect()
->route('publish.workflow.review.index')
->with('flash_message', 'You have successfully rejected one dataset! The editor will be informed.');
}
throw new GeneralException(trans('exceptions.publish.review.update_error'));
}
//snakeToCamel //snakeToCamel
private static function convertColumnToFieldname($columnname) private static function convertColumnToFieldname($columnname)
{ {

View File

@ -26,9 +26,10 @@ class SubmitController extends Controller
$builder = Dataset::query(); $builder = Dataset::query();
$myDatasets = $builder $myDatasets = $builder
->orderBy('server_state') ->orderBy('server_state')
->whereIn('server_state', ['inprogress', 'released', 'editor_accepted', 'approved', 'reviewed']) ->whereIn('server_state', ['inprogress', 'released', 'editor_accepted', 'approved', 'reviewed', 'rejected_editor', 'rejected_reviewer'])
->where('account_id', $user_id) ->where('account_id', $user_id)
->with('user:id,login') ->with('user:id,login')
->orderBy('server_date_modified', 'desc')
->get(); ->get();
return view('workflow.submitter.index', [ return view('workflow.submitter.index', [
'datasets' => $myDatasets, 'datasets' => $myDatasets,
@ -66,7 +67,7 @@ class SubmitController extends Controller
if ($dataset->update($input)) { if ($dataset->update($input)) {
// event(new PageUpdated($page)); // event(new PageUpdated($page));
return redirect() return redirect()
->route('publish.workflow.index') ->route('publish.workflow.submit.index')
->with('flash_message', 'You have released your dataset!'); ->with('flash_message', 'You have released your dataset!');
} }
throw new GeneralException(trans('exceptions.publish.release.update_error')); throw new GeneralException(trans('exceptions.publish.release.update_error'));
@ -81,7 +82,7 @@ class SubmitController extends Controller
public function delete($id): RedirectResponse public function delete($id): RedirectResponse
{ {
$dataset = Dataset::with('files')->findOrFail($id); $dataset = Dataset::with('files')->findOrFail($id);
if ($dataset->server_state != "inprogress") { if ($dataset->server_state != "inprogress" || $dataset->server_state != "rejected_editor") {
session()->flash( session()->flash(
'flash_message', 'flash_message',
'You cannot delete this datastet!' 'You cannot delete this datastet!'

View File

@ -39,7 +39,8 @@ class Dataset extends Model
'editor_id', 'editor_id',
'preferred_reviewer', 'preferred_reviewer',
'preferred_reviewer_email', 'preferred_reviewer_email',
'reviewer_id' 'reviewer_id',
'reject_reviewer_note'
]; ];
//protected $guarded = []; //protected $guarded = [];
/** /**

10
composer.lock generated
View File

@ -903,16 +903,16 @@
}, },
{ {
"name": "league/flysystem", "name": "league/flysystem",
"version": "1.0.51", "version": "1.0.52",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/flysystem.git", "url": "https://github.com/thephpleague/flysystem.git",
"reference": "755ba7bf3fb9031e6581d091db84d78275874396" "reference": "c5a5097156387970e6f0ccfcdf03f752856f3391"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/755ba7bf3fb9031e6581d091db84d78275874396", "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/c5a5097156387970e6f0ccfcdf03f752856f3391",
"reference": "755ba7bf3fb9031e6581d091db84d78275874396", "reference": "c5a5097156387970e6f0ccfcdf03f752856f3391",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -983,7 +983,7 @@
"sftp", "sftp",
"storage" "storage"
], ],
"time": "2019-03-30T13:22:34+00:00" "time": "2019-05-20T20:21:14+00:00"
}, },
{ {
"name": "mcamara/laravel-localization", "name": "mcamara/laravel-localization",

File diff suppressed because one or more lines are too long

View File

@ -979,6 +979,21 @@ textarea.large, input.large {
background-color: lightblue; background-color: lightblue;
color: gray; color: gray;
} }
.pure-table tr.rejected_reviewer {
padding: 0.8em;
background-color: orange;
color: gray;
}
.pure-table tr.rejected_editor {
padding: 0.8em;
background-color: orange;
color: gray;
}
.pure-table tr.reviewed {
padding: 0.8em;
background-color: yellow;
color: gray;
}
.pure-table tr.approved { .pure-table tr.approved {
padding: 0.8em; padding: 0.8em;
background-color: rgb(86, 86, 241); background-color: rgb(86, 86, 241);

View File

@ -13,9 +13,15 @@ const app = new Vue({
preferred_reviewer: '', preferred_reviewer: '',
preferred_reviewer_email: '' preferred_reviewer_email: ''
}, },
submitted: false submitted: false,
preferation: "no_preferation",
} }
}, },
computed: {
isPreferationRequired() {
return this.preferation === "yes_preferation";
},
},
methods: { methods: {
checkForm(e) { checkForm(e) {
// Log entire model to console // Log entire model to console

View File

@ -16,6 +16,13 @@
</div> </div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('reject_reviewer_note', 'reviewer note..') !!}
{{-- {!! Form::select('server_state', Config::get('enums.server_states'), null, ['id' => 'server_state', 'placeholder' => '-- select server state --']) !!} --}}
{!! Form::textarea('reject_reviewer_note', null, ['class'=>'pure-u-23-24','readonly']) !!}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div"> <div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('project_id', 'Project..') !!} {!! Form::label('project_id', 'Project..') !!}
<div class="select pure-u-23-24"> <div class="select pure-u-23-24">

View File

@ -15,7 +15,7 @@
<th>ID</th> <th>ID</th>
<th>Server State</th> <th>Server State</th>
<th>Editor</th> <th>Editor</th>
<th>Date of submission</th> <th>Date of last modification</th>
<th></th> <th></th>
</thead> </thead>
@ -26,7 +26,11 @@
// $lastid = $detail->payment->userid; // $lastid = $detail->payment->userid;
if ($dataset->server_state == 'editor_accepted') { if ($dataset->server_state == 'editor_accepted') {
$rowclass = 'editor_accepted'; $rowclass = 'editor_accepted';
} elseif ($dataset->server_state == 'released') { } elseif ($dataset->server_state == 'rejected_reviewer') {
$rowclass = 'rejected_reviewer';
} elseif ($dataset->server_state == 'reviewed') {
$rowclass = 'reviewed';
}elseif ($dataset->server_state == 'released') {
$rowclass = 'released'; $rowclass = 'released';
} }
@endphp @endphp
@ -47,13 +51,11 @@
@if ($dataset->server_state == "released") @if ($dataset->server_state == "released")
{{-- <td>Preferred reviewer: {{ optional($dataset->reviewer)->login }} </td> --}} {{-- <td>Preferred reviewer: {{ optional($dataset->reviewer)->login }} </td> --}}
<td>Preferred reviewer: {{ $dataset->preferred_reviewer }} </td> <td>Preferred reviewer: {{ $dataset->preferred_reviewer }} </td>
@elseif ($dataset->server_state == "editor_accepted") @elseif ($dataset->server_state == "editor_accepted" || $dataset->server_state == "rejected_reviewer")
<td>in approvement by {{ optional($dataset->editor)->login }} </td> <td>in approvement by {{ optional($dataset->editor)->login }} </td>
@endif @endif
<td> <td>
@if ($dataset->server_state == 'released')
{{ $dataset->server_date_modified }} {{ $dataset->server_date_modified }}
@endif
</td> </td>
<td> <td>
@if ($dataset->server_state == "released") @if ($dataset->server_state == "released")
@ -61,7 +63,7 @@
<i class="fa fa-check"></i> <i class="fa fa-check"></i>
<span>Receive editor task</span> <span>Receive editor task</span>
</a> </a>
@elseif ($dataset->server_state == "editor_accepted") @elseif ($dataset->server_state == "editor_accepted" || $dataset->server_state == "rejected_reviewer")
<a href="{{ URL::route('publish.workflow.editor.edit', $dataset->id) }}" class="pure-button"> <a href="{{ URL::route('publish.workflow.editor.edit', $dataset->id) }}" class="pure-button">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
<span>Edit</span> <span>Edit</span>
@ -70,6 +72,15 @@
<i class="fa fa-share"></i> <i class="fa fa-share"></i>
<span>Approve</span> <span>Approve</span>
</a> </a>
<a href="{{ URL::route('publish.workflow.editor.reject', $dataset->id) }}" class="pure-button">
<i class="fas fa-undo"></i>
<span>Reject</span>
</a>
@elseif ($dataset->server_state == "reviewed")
<a href="{{ URL::route('publish.workflow.publish.publishUpdate', $dataset->id) }}" class="pure-button">
<i class="fa fa-edit"></i>
<span>Publish</span>
</a>
@endif @endif
</td> </td>
{{-- <td> {{-- <td>

View File

@ -0,0 +1,74 @@
@extends('settings.layouts.app')
@section('content')
<div class="header">
<h3 class="header-title">
<i class="fa fa-share"></i> Reject submitted dataset
</h3>
</div>
@if (count($errors) > 0)
<div class="alert alert-danger">
<strong>Whoops!</strong> There were some problems with your input.<br><br>
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="pure-g box-content">
<div class="pure-u-1 pure-u-md-1">
<div>
<a href="{{ route('publish.workflow.review.index') }}" class="pure-button button-small">
<i class="fa fa-chevron-left"></i>
<span>BACK</span>
</a>
</div>
<div id="app1">
{!! Form::model($dataset, [ 'method' => 'POST', 'route' => ['publish.workflow.editor.rejectUpdate', $dataset->id], 'id' => 'rejectForm',
'class' => 'pure-form', 'enctype' => 'multipart/form-data', 'v-on:submit.prevent' => 'checkForm']) !!}
<fieldset id="fieldset-General">
<legend>General</legend>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-1 pure-div">
{!! Form::label('server_state', 'Status..') !!}
{!! Form::text('server_state', 'rejected_editor', ['class'=>'pure-u-23-24','readonly']) !!}
</div>
<div class="pure-u-1 pure-u-md-1-1 pure-div">
{!! Form::label('reject_editor_note', 'reject note:') !!}
{!! Form::textarea('reject_editor_note',null, ['id' => 'reject_editor_note', 'class'=>'pure-u-23-24',
'placeholder' => '-- reject note for submitter --', 'size' => '70x6',
'v-model' => 'dataset.reject_editor_note', "v-validate" => "'required|min:10|max:255'"]) !!}
<em>*</em>
<span class="help is-danger" v-if="errors.has('reject_editor_note')" v-text="errors.first('reject_editor_note')"></span>
</div>
</div>
</fieldset>
<br />
<div class="pure-controls">
<button type="submit" class="pure-button">
<i class="fas fa-undo"></i>
<span>Reject to submitter</span>
</button>
{{-- <span class="help is-danger">..to do: write code for setting state 'rejected_reviewer' in database</span> --}}
</div>
{!! Form::close() !!}
</div>
</div>
</div>
@stop
@section('after-scripts')
@stop

View File

@ -6,6 +6,17 @@
</h3> </h3>
</div> </div>
@if (count($errors) > 0)
<div class="alert alert-danger">
<strong>Whoops!</strong> There were some problems with your input.<br><br>
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="pure-g box-content"> <div class="pure-g box-content">
<div class="pure-u-1 pure-u-md-1"> <div class="pure-u-1 pure-u-md-1">
@ -24,13 +35,19 @@
<div class="pure-g"> <div class="pure-g">
<div class="pure-u-1 pure-u-md-1-1 pure-div"> <div class="pure-u-1 pure-u-md-1-1 pure-div">
{!! Form::label('owner', 'reject note:') !!} {!! Form::label('server_state', 'Status..') !!}
{!! Form::text('reject_reviewer_note', null, ['id' => 'reject_reviewer_note', 'class'=>'pure-u-23-24', {!! Form::text('server_state', 'rejected_reviewer', ['class'=>'pure-u-23-24','readonly']) !!}
'placeholder' => '-- reject note for editor --',
</div>
<div class="pure-u-1 pure-u-md-1-1 pure-div">
{!! Form::label('reject_reviewer_note', 'reject note:') !!}
{!! Form::textarea('reject_reviewer_note',null, ['id' => 'reject_reviewer_note', 'class'=>'pure-u-23-24',
'placeholder' => '-- reject note for editor --', 'size' => '70x6',
'v-model' => 'dataset.reject_reviewer_note', "v-validate" => "'required|min:10|max:255'"]) !!} 'v-model' => 'dataset.reject_reviewer_note', "v-validate" => "'required|min:10|max:255'"]) !!}
<em>*</em> <em>*</em>
<span class="help is-danger" v-if="errors.has('preferred_reviewer')" v-text="errors.first('preferred_reviewer')"></span> <span class="help is-danger" v-if="errors.has('reject_reviewer_note')" v-text="errors.first('reject_reviewer_note')"></span>
</div> </div>
</div> </div>
@ -38,11 +55,11 @@
<br /> <br />
<div class="pure-controls"> <div class="pure-controls">
{{-- <button type="submit" class="pure-button"> <button type="submit" class="pure-button">
<i class="fas fa-undo"></i> <i class="fas fa-undo"></i>
<span>Reject</span> <span>Reject to editor</span>
</button> --}} </button>
<span class="help is-danger">..to do: write code for setting state 'rejected_reviewer' in database</span> {{-- <span class="help is-danger">..to do: write code for setting state 'rejected_reviewer' in database</span> --}}
</div> </div>
{!! Form::close() !!} {!! Form::close() !!}

View File

@ -33,6 +33,8 @@
$rowclass = 'approved'; $rowclass = 'approved';
} elseif ($dataset->server_state == 'reviewed') { } elseif ($dataset->server_state == 'reviewed') {
$rowclass = 'reviewed'; $rowclass = 'reviewed';
} elseif ($dataset->server_state == 'rejected_editor') {
$rowclass = 'rejected_editor';
} }
@endphp @endphp
<tr class="{{ $rowclass }}"> <tr class="{{ $rowclass }}">
@ -54,7 +56,7 @@
</td> </td>
<td> <td>
@if ($dataset->server_state == "inprogress") @if ($dataset->server_state == "inprogress" || $dataset->server_state == "rejected_editor")
<a href="{{ URL::route('publish.workflow.submit.release', $dataset->id) }}" class="pure-button"> <a href="{{ URL::route('publish.workflow.submit.release', $dataset->id) }}" class="pure-button">
<i class="fa fa-share"></i> <i class="fa fa-share"></i>
<span>Release</span> <span>Release</span>

View File

@ -28,6 +28,21 @@
<legend>General</legend> <legend>General</legend>
<div class="pure-g"> <div class="pure-g">
<div class="pure-u-1 pure-u-md-1-1">
<div class="pure-u-1 pure-u-md-1">
<label for="preferred-option-one" class="pure-radio">
<input id="preferred-option-one" type="radio" v-model="preferation" value="yes_preferation">
preferred reviewer
</label>
<label for="elevation-option-two" class="pure-radio">
<input id="elevation-option-two" type="radio" v-model="preferation" value="no_preferation">
no preferred reviewer
</label>
</div>
<div v-show="preferation === 'yes_preferation'" class="pure-u-1 pure-u-md-1">
<div class="pure-u-1 pure-u-md-1-1 pure-div"> <div class="pure-u-1 pure-u-md-1-1 pure-div">
{!! Form::label('preferred_reviewer', 'name of preferred reviewer:') !!} {!! Form::label('preferred_reviewer', 'name of preferred reviewer:') !!}
@ -35,22 +50,30 @@
'dataset.editor_id', "v-validate" => "'required'"]) !!} --}} 'dataset.editor_id', "v-validate" => "'required'"]) !!} --}}
{!! Form::text('preferred_reviewer', null, ['id' => 'preferred_reviewer', 'class'=>'pure-u-23-24', {!! Form::text('preferred_reviewer', null, ['id' => 'preferred_reviewer', 'class'=>'pure-u-23-24',
'placeholder' => '-- enter name of preferred reviewer --', 'placeholder' => '-- enter name of preferred reviewer --',
'v-model' => 'dataset.preferred_reviewer', "v-validate" => "'required|min:3|max:20'"]) !!} 'v-model' => 'dataset.preferred_reviewer',
"v-validate" => "this.isPreferationRequired ? 'required|min:3|max:20' : ''"]) !!}
<em>*</em> <em>*</em>
<span class="help is-danger" v-if="errors.has('preferred_reviewer')" v-text="errors.first('preferred_reviewer')"></span> <span class="help is-danger" v-if="errors.has('preferred_reviewer')" v-text="errors.first('preferred_reviewer')"></span>
</div> </div>
<div class="pure-u-1 pure-u-md-1-1 pure-div"> <div class="pure-u-1 pure-u-md-1-1 pure-div">
{!! Form::label('preferred_reviewer_email', 'email of preferred reviewer:') !!} {!! Form::label('preferred_reviewer_email', 'email of preferred reviewer:') !!}
{!! Form::text('preferred_reviewer_email', null, array( {!! Form::text('preferred_reviewer_email', null, array(
'placeholder' => 'Email', 'id' => 'preferred_reviewer_email', 'class' => 'pure-u-23-24', 'placeholder' => 'Email', 'id' => 'preferred_reviewer_email', 'class' => 'pure-u-23-24',
'v-model' => 'dataset.preferred_reviewer_email', "v-validate" => "'required|email'" 'v-model' => 'dataset.preferred_reviewer_email',
)) !!} "v-validate" => "this.isPreferationRequired ? 'required|mail' : ''")) !!}
<em>*</em> <em>*</em>
<span class="help is-danger" v-if="errors.has('preferred_reviewer_email')" v-text="errors.first('preferred_reviewer_email')"></span> <span class="help is-danger" v-if="errors.has('preferred_reviewer_email')" v-text="errors.first('preferred_reviewer_email')"></span>
</div> </div>
</div>
</div>
</div> </div>
</fieldset> </fieldset>

View File

@ -101,6 +101,14 @@ Route::group(
'middleware' => ['permission:dataset-approve'], 'middleware' => ['permission:dataset-approve'],
'as' => 'workflow.editor.approveUpdate', 'uses' => 'EditorController@approveUpdate', 'as' => 'workflow.editor.approveUpdate', 'uses' => 'EditorController@approveUpdate',
]); ]);
Route::get('workflow/editor/reject/{id}', [
'middleware' => ['permission:dataset-editor-reject'],
'as' => 'workflow.editor.reject', 'uses' => 'EditorController@reject',
]);
Route::post('workflow/editor/reject/{id}', [
'middleware' => ['permission:dataset-editor-reject'],
'as' => 'workflow.editor.rejectUpdate', 'uses' => 'EditorController@rejectUpdate',
]);
//reviewer //reviewer
Route::get('workflow/review/index', [ Route::get('workflow/review/index', [