Skip to content

Commit

Permalink
Merge pull request #9 from itinerare/Submissions-Exp
Browse files Browse the repository at this point in the history
Submissions-Exp
  • Loading branch information
corowne authored May 23, 2020
2 parents 73b8525 + 3949b27 commit 0ac6a0f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ Homestead.yaml
npm-debug.log
yarn-error.log
/composer.lock
*.env
2 changes: 1 addition & 1 deletion app/Http/Controllers/Admin/SubmissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function getClaim($id)
*/
public function postSubmission(Request $request, SubmissionManager $service, $id, $action)
{
$data = $request->only(['slug', 'character_quantity', 'character_currency_id', 'rewardable_type', 'rewardable_id', 'quantity' ]);
$data = $request->only(['slug', 'character_quantity', 'character_currency_id', 'rewardable_type', 'rewardable_id', 'quantity', 'staff_comments' ]);
if($action == 'reject' && $service->rejectSubmission($request->only(['staff_comments']) + ['id' => $id], Auth::user())) {
flash('Submission rejected successfully.')->success();
}
Expand Down
8 changes: 5 additions & 3 deletions app/Services/SubmissionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,12 @@ public function approveSubmission($data, $user)
}

// Finally, set:
// 1. staff ID
// 2. status
// 3. final rewards
// 1. staff comments
// 2. staff ID
// 3. status
// 4. final rewards
$submission->update([
'staff_comments' => $data['staff_comments'],
'staff_id' => $user->id,
'status' => 'Approved',
'data' => json_encode(getDataReadyAssets($rewards))
Expand Down
12 changes: 6 additions & 6 deletions resources/views/admin/submissions/submission.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
</div>
<div class="text-right mb-3">
<a href="#" class="btn btn-outline-info" id="addCharacter">Add Character</a>
</div>
<div class="form-group">
{!! Form::label('staff_comments', 'Staff Comments') !!}
{!! Form::textarea('', null, ['class' => 'form-control', 'id' => 'modalStaffComments']) !!}
</div>
{!! Form::hidden('staff_comments', null, ['id' => 'staffComments']) !!}
<div class="text-right">
Expand Down Expand Up @@ -145,11 +149,7 @@
<button type="button" class="close" data-dismiss="modal">&times;</button>
</div>
<div class="modal-body">
<p>This will reject the {{ $submission->prompt_id ? 'submission' : 'claim' }}. Enter an optional comment below to explain why the {{ $submission->prompt_id ? 'submission' : 'claim' }} was rejected.</p>
<div class="form-group">
{!! Form::label('staff_comments', 'Staff Comments') !!}
{!! Form::textarea('', null, ['class' => 'form-control', 'id' => 'modalStaffComments']) !!}
</div>
<p>This will reject the {{ $submission->prompt_id ? 'submission' : 'claim' }}.</p>
<div class="text-right">
<a href="#" id="rejectionSubmit" class="btn btn-danger">Reject</a>
</div>
Expand Down Expand Up @@ -202,7 +202,7 @@
$approvalSubmit.on('click', function(e) {
e.preventDefault();
$staffComments.val('');
$staffComments.val($modalStaffComments.val());
$submissionForm.attr('action', '{{ url()->current() }}/approve');
$submissionForm.submit();
});
Expand Down
4 changes: 2 additions & 2 deletions resources/views/home/_submission_content.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
<h2>Comments</h2>
<div class="card mb-3"><div class="card-body">{!! nl2br(htmlentities($submission->comments)) !!}</div></div>
@if(Auth::check() && $submission->staff_comments && ($submission->user_id == Auth::user()->id || Auth::user()->hasPower('manage_submissions')))
<h5 class="text-danger">Staff Comments</h5>
<div class="card border-danger mb-3"><div class="card-body">{!! nl2br(htmlentities($submission->staff_comments)) !!}</div></div>
<h2>Staff Comments</h2>
<div class="card mb-3"><div class="card-body">{!! nl2br(htmlentities($submission->staff_comments)) !!}</div></div>
@endif

<h2>Rewards</h2>
Expand Down

0 comments on commit 0ac6a0f

Please sign in to comment.