publication workflow: accept status
This commit is contained in:
parent
246577b0b0
commit
19fc0fa872
|
@ -29,8 +29,8 @@ class WorkflowController extends Controller
|
|||
|
||||
$builder = Dataset::query();
|
||||
$myDatasets = $builder
|
||||
->whereIn('server_state', ['inprogress', 'released'])
|
||||
// ->where('account_id', $user_id)
|
||||
->whereIn('server_state', ['inprogress', 'released', 'editor_accepted'])
|
||||
->where('account_id', $user_id)
|
||||
->with('user:id,login')
|
||||
->get();
|
||||
return view('workflow.index', [
|
||||
|
@ -120,7 +120,7 @@ class WorkflowController extends Controller
|
|||
$builder = Dataset::query();
|
||||
$datasets = $builder
|
||||
//->where('server_state', 'inprogress')
|
||||
->whereIn('server_state', ['released'])
|
||||
->whereIn('server_state', ['released', 'editor_accepted'])
|
||||
->get();
|
||||
return view('workflow.editor_index', compact('datasets'));
|
||||
}
|
||||
|
@ -152,6 +152,17 @@ class WorkflowController extends Controller
|
|||
public function acceptUpdate(Request $request, $id)
|
||||
{
|
||||
$dataset = Dataset::findOrFail($id);
|
||||
|
||||
try {
|
||||
$dataset->setServerState("editor_accepted");
|
||||
$user = Auth::user();
|
||||
$dataset->editor()->associate($user)->save();
|
||||
$dataset->save();
|
||||
return redirect()->back();
|
||||
//return redirect()->route('settings.review.index');
|
||||
} catch (Exception $e) {
|
||||
throw new GeneralException(trans('exceptions.publish.accept.update_error'));
|
||||
}
|
||||
}
|
||||
|
||||
// public function release()
|
||||
|
@ -190,7 +201,7 @@ class WorkflowController extends Controller
|
|||
session()->flash('flash_message', 'You have puplished 1 dataset!');
|
||||
}
|
||||
$dataset->save();
|
||||
return redirect()->back();
|
||||
//return redirect()->back();
|
||||
//return redirect()->route('settings.review.index');
|
||||
} catch (Exception $e) {
|
||||
//return $this->_redirectTo('index', array('failure' => $e->getMessage()), 'documents', 'admin');
|
||||
|
|
5
public/backend/style.css
vendored
5
public/backend/style.css
vendored
|
@ -943,6 +943,11 @@ textarea.large, input.large {
|
|||
.pure-table tr.released {
|
||||
background-color: greenyellow;
|
||||
}
|
||||
.pure-table tr.editor_accepted {
|
||||
padding: 0.8em;
|
||||
background-color: lightblue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -16,6 +16,9 @@ return [
|
|||
'release' => [
|
||||
'update_error' => 'There was a problem rleasing this dataset. Please try again.',
|
||||
],
|
||||
'accept' => [
|
||||
'update_error' => 'There was a problem accepting this dataset. Please try again.',
|
||||
],
|
||||
],
|
||||
|
||||
'backend' => [
|
||||
|
|
|
@ -92,15 +92,21 @@
|
|||
<li class="treeview">
|
||||
<h2 class="pure-menu-heading">Publish</h2>
|
||||
<ul class="pure-menu-list">
|
||||
@permission('dataset-create')
|
||||
<li class="pure-menu-item {{ Route::is('publish.dataset.create') ? 'active' : '' }}">
|
||||
<a class="pure-menu-link" href="{{ URL::route('publish.dataset.create') }}"><i class="fa fa-upload"></i> Create</a>
|
||||
</li>
|
||||
@endpermission
|
||||
@permission('dataset-list')
|
||||
<li class="pure-menu-item {{ Route::is('publish.workflow.index') ? 'active' : '' }}">
|
||||
<a class="pure-menu-link" href="{{ URL::route('publish.workflow.index') }}"><i class="fa fa-upload"></i> All my datasets</a>
|
||||
</li>
|
||||
@endpermission
|
||||
@permission('dataset-editor-list')
|
||||
<li class="pure-menu-item {{ Route::is('publish.workflow.editorIndex') ? 'active' : '' }}">
|
||||
<a class="pure-menu-link" href="{{ URL::route('publish.workflow.editorIndex') }}"><i class="fa fa-upload"></i> EDITOR PAGE: Released datasets</a>
|
||||
</li>
|
||||
@endpermission
|
||||
{{-- <li class="pure-menu-item {{ Route::is('publish.workflow.release') ? 'active' : '' }}">
|
||||
<a class="pure-menu-link" href="{{ URL::route('publish.workflow.release') }}"><i class="fa fa-upload"></i> Release pending datasets</a>
|
||||
</li>
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
}
|
||||
@endphp
|
||||
|
||||
{!! Form::model($dataset, [ 'method' => 'POST', 'id' => 'acceptForm',
|
||||
{!! Form::model($dataset, [ 'method' => 'POST', 'route' => ['publish.workflow.acceptUpdate', $dataset->id], 'id' => 'acceptForm',
|
||||
'class' => 'pure-form', 'enctype' => 'multipart/form-data', 'v-on:submit.prevent' => 'checkForm']) !!}
|
||||
<fieldset id="fieldset-General">
|
||||
<legend>General</legend>
|
||||
|
@ -65,7 +65,7 @@
|
|||
|
||||
<br />
|
||||
<div class="pure-controls">
|
||||
<button :disabled="errors.any()" type="submit" class="pure-button">
|
||||
<button type="submit" class="pure-button">
|
||||
<i class="fa fa-share"></i>
|
||||
<span>Accept</span>
|
||||
</button>
|
||||
|
@ -79,11 +79,5 @@
|
|||
|
||||
@stop
|
||||
|
||||
@section('after-scripts') {{--
|
||||
<script type="text/javascript" src="{{ asset('js/lib.js') }}"></script> --}} {{--
|
||||
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue"></script>--}} {{--
|
||||
<script type="text/javascript" src="{{ resource_path('assets\js\datasetPublish.js') }}"></script> --}}
|
||||
<script type="text/javascript" src="{{ asset('backend/publish/releaseDataset.js') }}"></script>
|
||||
|
||||
@section('after-scripts')
|
||||
@stop
|
|
@ -13,14 +13,23 @@
|
|||
<thead>
|
||||
<th>Dataset Title</th>
|
||||
<th>ID</th>
|
||||
<th>Server State</th>
|
||||
<th>Preferred Editor</th>
|
||||
<th>Server State</th>
|
||||
<th>Editor</th>
|
||||
<th></th>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach($datasets as $dataset)
|
||||
<tr>
|
||||
@foreach($datasets as $dataset)
|
||||
@php
|
||||
//if userid changed from last iteration, store new userid and change color
|
||||
// $lastid = $detail->payment->userid;
|
||||
if ($dataset->server_state == 'editor_accepted') {
|
||||
$rowclass = 'editor_accepted';
|
||||
} elseif ($dataset->server_state == 'released') {
|
||||
$rowclass = 'released';
|
||||
}
|
||||
@endphp
|
||||
<tr class="{{ $rowclass }}">
|
||||
<td>
|
||||
@if ($dataset->titles()->first())
|
||||
{{ $dataset->titles()->first()->value }}
|
||||
|
@ -34,7 +43,12 @@
|
|||
<td>
|
||||
{{ $dataset->server_state }}
|
||||
</td>
|
||||
<td> {{ optional($dataset->editor)->login }} </td>
|
||||
@if ($dataset->server_state == "released")
|
||||
<td>Preferred editor: {{ optional($dataset->editor)->login }} </td>
|
||||
@elseif ($dataset->server_state == "editor_accepted")
|
||||
<td>in approvement by {{ optional($dataset->editor)->login }} </td>
|
||||
@endif
|
||||
|
||||
<td>
|
||||
@if ($dataset->server_state == "released")
|
||||
<a href="{{ URL::route('publish.workflow.accept', $dataset->id) }}" class="pure-button">
|
||||
|
|
|
@ -26,7 +26,10 @@
|
|||
$rowclass = 'inprogress';
|
||||
} elseif ($dataset->server_state == 'released') {
|
||||
$rowclass = 'released';
|
||||
}
|
||||
}
|
||||
elseif ($dataset->server_state == 'editor_accepted') {
|
||||
$rowclass = 'editor_accepted';
|
||||
}
|
||||
@endphp
|
||||
<tr class="{{ $rowclass }}">
|
||||
<td>
|
||||
|
|
|
@ -76,7 +76,7 @@ Route::group(
|
|||
// ]);
|
||||
|
||||
Route::get('workflow/editor_index', [
|
||||
'middleware' => ['permission:dataset-released-list'],
|
||||
'middleware' => ['permission:dataset-editor-list'],
|
||||
'as' => 'workflow.editorIndex', 'uses' => 'WorkflowController@editorIndex',
|
||||
]);
|
||||
Route::get('workflow/accept/{id}', [
|
||||
|
|
Loading…
Reference in New Issue
Block a user