Skip to content

Commit

Permalink
Added gag/silence/mute selectable options
Browse files Browse the repository at this point in the history
  • Loading branch information
hobsRKM committed May 4, 2024
1 parent e22f8c6 commit b09ebae
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
6 changes: 5 additions & 1 deletion app/Http/Controllers/MutesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public function store(Request $request)
'duration' => 'required_without:permanent',
'server_ids' => 'required|array',
'server_ids.*' => 'exists:sa_servers,id',
'type' => 'required'
]);

try {
Expand Down Expand Up @@ -175,6 +176,7 @@ public function store(Request $request)
$samute->server_id = $serverId;
$samute->admin_name = auth()->user()->name;
$samute->admin_steamid = auth()->user()->steam_id;
$samute->type = $validatedData['type'];
$samute->ends = !empty($minutesDifference) ? CommonHelper::formatDate($validatedData['duration']): Carbon::now();
$samute->save();
$mutesAdded = true;
Expand Down Expand Up @@ -204,7 +206,8 @@ public function update(Request $request, $id)
$validatedData = $request->validate([
'player_steam_id' => 'required|numeric|digits:17',
'reason' => 'required',
'duration' => 'required_without:permanent'
'duration' => 'required_without:permanent',
'type' => 'required'
]);

try {
Expand All @@ -220,6 +223,7 @@ public function update(Request $request, $id)
$mute->ends = CommonHelper::formatDate(Carbon::parse($validatedData['duration']));
}
$mute->status = 'ACTIVE';
$mute->type = $validatedData['type'];
$mute->save();
return redirect()->route('list.mutes')->with('success', 'Mute updated successfully');
} catch(\Exception $e) {
Expand Down
15 changes: 11 additions & 4 deletions resources/views/admin/mutes/add.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,17 @@
<input type="number" class="form-control" id="player_steam_id" name="player_steam_id" required/>
<label class="form-label" for="player_steam_id">Player Steam ID</label>
</div>

<div data-mdb-input-init class="form-outline mb-3">
<textarea type="text" class="form-control" id="reason" name="reason" required></textarea>
<label class="form-label" for="type">Type</label>
<select class="form-select" id="type" name="type">
<option value="GAG">GAG</option>
<option value="MUTE">MUTE</option>
<option value="SILENCE">SILENCE</option>
</select>
</div>
<div data-mdb-input-init class="mb-3">
<label class="form-label" for="reason">Reason</label>
<textarea type="text" class="form-control" id="reason" name="reason" required></textarea>
</div>

<div class="mb-3">
Expand All @@ -42,9 +49,9 @@
</div>
</div>

<div data-mdb-input-init class="form-outline mb-3">
<input type="datetime-local" min="{{ date('Y-m-d\TH:i') }}" class="form-control active" id="duration" name="duration" required/>
<div data-mdb-input-init class="mb-3">
<label class="form-label" for="duration">Duration</label>
<input type="datetime-local" min="{{ date('Y-m-d\TH:i') }}" class="form-control active" id="duration" name="duration" required/>
</div>

<div data-mdb-input-init class="form-outline mb-3">
Expand Down
11 changes: 9 additions & 2 deletions resources/views/admin/mutes/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,17 @@
<input type="number" class="form-control" id="player_steam_id" name="player_steam_id" value="{{ $mute->player_steamid }}" required/>
<label class="form-label" for="player_steam_id">Player Steam ID</label>
</div>

<div data-mdb-input-init class="form-outline mb-3">
<textarea type="text" class="form-control" id="reason" name="reason" required>{{ $mute->reason }}</textarea>
<label class="form-label" for="type">Type</label>
<select class="form-select" id="type" name="type">
<option {{($mute->type == 'GAG') ?'selected' : ''}} value="GAG">GAG</option>
<option {{($mute->type == 'MUTE') ?'selected' : ''}} value="MUTE">MUTE</option>
<option {{($mute->type == 'SILENCE') ?'selected' : ''}} value="SILENCE">SILENCE</option>
</select>
</div>
<div data-mdb-input-init class="mb-3">
<label class="form-label" for="reason">Reason</label>
<textarea type="text" class="form-control" id="reason" name="reason" required>{{ $mute->reason }}</textarea>
</div>

<div class="mb-3 form-check">
Expand Down

0 comments on commit b09ebae

Please sign in to comment.