Allow users to update their auto_hold status
This commit is contained in:
parent
a3719b9186
commit
b1560015ae
@ -488,10 +488,16 @@ class SystemController extends Controller
|
|||||||
public function api_autohold_toggle(Request $request,string $state): array
|
public function api_autohold_toggle(Request $request,string $state): array
|
||||||
{
|
{
|
||||||
$o = System::findOrFail($request->id);
|
$o = System::findOrFail($request->id);
|
||||||
$o->autohold = $state === 'off' ? FALSE : TRUE;
|
|
||||||
$o->save();
|
|
||||||
|
|
||||||
Log::debug(sprintf('%s:- Autohold set to [%s]',self::LOGKEY,$o->autohold ? 'ON' : 'OFF'));
|
if ($request->user()->can('update_nn',$o)) {
|
||||||
|
$o->autohold = !($state === 'off');
|
||||||
|
$o->save();
|
||||||
|
|
||||||
|
Log::debug(sprintf('%s:- Autohold set to [%s]',self::LOGKEY,$o->autohold ? 'ON' : 'OFF'));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
return ['autohold'=>$o->autohold];
|
return ['autohold'=>$o->autohold];
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,7 @@ use App\Models\{Mailer,User};
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="row p-0">
|
<div class="row p-0">
|
||||||
@can('admin',$o)
|
@can('update_nn',$o)
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<label for="autohold" class="form-label">Auto Hold</label>
|
<label for="autohold" class="form-label">Auto Hold</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
|
Loading…
Reference in New Issue
Block a user