feat(editorial): separate cluster analysis approval and publication in QA
This commit is contained in:
@@ -19,7 +19,7 @@ final class ClusterCompetitivenessController extends Controller
|
||||
$data = $request->validate(['expected_version' => 'required|integer|min:0',
|
||||
'draft' => $action === 'saved' ? 'required|array:version,clusterId,sector,region,forces' : 'prohibited',
|
||||
'revision' => $action === 'restored' ? 'required|integer|min:1' : 'prohibited',
|
||||
'reason' => in_array($action, ['approved', 'withdrawn'], true) ? 'required|string|min:10|max:3000' : 'nullable|string|max:3000']);
|
||||
'reason' => in_array($action, ['saved', 'restored'], true) ? 'nullable|string|max:3000' : 'required|string|min:10|max:3000']);
|
||||
|
||||
return response()->json($service->change($cluster, $request->user()->id, (int) $data['expected_version'], $action, $data))
|
||||
->header('Cache-Control', 'private, no-store');
|
||||
|
||||
@@ -31,8 +31,17 @@ class InvestmentStructureController extends Controller
|
||||
});
|
||||
}
|
||||
|
||||
return Inertia::render('structures/index', ['structure' => $structure, 'filters' => $filters,
|
||||
'records' => $query->orderBy('name')->orderBy('id')->paginate(20)->withQueryString()]);
|
||||
$records = $query->orderBy('name')->orderBy('id')->paginate(20)->withQueryString();
|
||||
if ($structure === 'clusters' && app(ClusterCompetitiveness::class)->editorialEnabled()) {
|
||||
$records->through(function ($record) {
|
||||
$analysis = app(ClusterCompetitiveness::class)->current($record->id);
|
||||
$record->setAttribute('editorial_state', $analysis['workflow']['state'] ?? ($analysis['approved'] ? 'legacy_published' : 'not_started'));
|
||||
|
||||
return $record;
|
||||
});
|
||||
}
|
||||
|
||||
return Inertia::render('structures/index', ['structure' => $structure, 'filters' => $filters, 'records' => $records]);
|
||||
}
|
||||
|
||||
public function edit(Request $request, string $structure, ?string $id = null): Response
|
||||
|
||||
@@ -39,8 +39,8 @@ final class PortalEditorialWorkflowController extends Controller
|
||||
$query->whereRaw(self::KIND.' = ?', [$filters['kind']]);
|
||||
}
|
||||
$items = $query->orderByDesc('e.updated_at')->paginate(25, ['r.id', DB::raw("e.payload->'resource'->>'title' AS title"), 'r.document_type', 'r.published', 'e.id as edition_id', 'e.revision_no', 'e.state', 'e.legal_required', 'u.name as responsible'])->withQueryString();
|
||||
$opportunities = app(ContentManagement::class)->access($actor)['opportunities'] ?? null;
|
||||
$data = ['items' => $items, 'filters' => $filters, 'notices' => $workflow->notices($actor), 'resourceAccess' => $access->full($actor) || $access->editorial($actor), 'opportunitiesUrl' => $opportunities['index'] ?? null, 'opportunityPending' => $workflow->opportunityPending($actor)];
|
||||
$destinations = app(ContentManagement::class)->access($actor);
|
||||
$data = ['items' => $items, 'filters' => $filters, 'notices' => $workflow->notices($actor), 'resourceAccess' => $access->full($actor) || $access->editorial($actor), 'opportunitiesUrl' => $destinations['opportunities']['index'] ?? null, 'opportunityPending' => $workflow->opportunityPending($actor), 'clustersUrl' => $destinations['clusters']['index'] ?? null];
|
||||
|
||||
return $this->screen($request, 'management/editorial-workflow', $data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user