Skip to content

Commit ef1335b

Browse files
committed
fix: Donation Staff views, make consistent, support HTML in SweetAlerts
1 parent b589453 commit ef1335b

File tree

7 files changed

+22
-15
lines changed

7 files changed

+22
-15
lines changed

resources/views/Staff/donation-gateway/edit.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<tr>
4242
<td>
4343
<input
44-
type="text"
44+
type="number"
4545
name="position"
4646
value="{{ $gateway->position }}"
4747
class="form__text"

resources/views/Staff/donation-gateway/index.blade.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ class="form__button form__button--text"
7474
@method('DELETE')
7575
<button
7676
x-on:click.prevent="confirmAction"
77-
data-b64-deletion-message="{{ base64_encode('Are you sure you want to delete this page: ' . $gateway->name . '?') }}"
77+
data-allow-html="true"
78+
data-b64-deletion-message="{{ base64_encode("Are you sure you want to delete this gateway:<br><br>#{$gateway->position} - <b>$gateway->name</b>") }}"
7879
class="form__button form__button--text"
7980
>
8081
{{ __('common.delete') }}

resources/views/Staff/donation-package/create.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<th>Position</th>
2929
<th>Name</th>
3030
<th>Description</th>
31-
<th>Cost</th>
31+
<th>Cost ({{ config('donation.currency') }})</th>
3232
<th>Upload (Bytes)</th>
3333
<th>Invite (#)</th>
3434
<th>Bonus (#)</th>

resources/views/Staff/donation-package/edit.blade.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
<th>Position</th>
3535
<th>Name</th>
3636
<th>Description</th>
37-
<th>Cost</th>
38-
<th>Upload (GiB)</th>
37+
<th>Cost ({{ config('donation.currency') }})</th>
38+
<th>Upload (Bytes)</th>
3939
<th>Invite (#)</th>
4040
<th>Bonus (#)</th>
4141
<th>Supporter (Days)</th>
@@ -47,7 +47,7 @@
4747
<tr>
4848
<td>
4949
<input
50-
type="text"
50+
type="number"
5151
name="position"
5252
value="{{ $package->position }}"
5353
class="form__text"
@@ -70,7 +70,7 @@ class="form__text"
7070
<td>
7171
<input
7272
type="number"
73-
step="0.01"
73+
step="1.00"
7474
name="cost"
7575
value="{{ $package->cost }}"
7676
class="form__text"

resources/views/Staff/donation-package/index.blade.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class="panel__action form__button form__button--text"
3030
<tr>
3131
<th>Position</th>
3232
<th>Name</th>
33-
<th>Cost</th>
33+
<th>Cost ({{ config('donation.currency') }})</th>
3434
<th>Upload (GiB)</th>
3535
<th>Invite (#)</th>
3636
<th>Bonus (#)</th>
@@ -50,7 +50,7 @@ class="panel__action form__button form__button--text"
5050
{{ $package->name }}
5151
</a>
5252
</td>
53-
<td>$ {{ $package->cost }}</td>
53+
<td>{{ $package->cost }}</td>
5454
<td>
5555
{{ App\Helpers\StringHelper::formatBytes($package->upload_value ?? 0) }}
5656
</td>
@@ -90,7 +90,8 @@ class="form__button form__button--text"
9090
@method('DELETE')
9191
<button
9292
x-on:click.prevent="confirmAction"
93-
data-b64-deletion-message="{{ base64_encode('Are you sure you want to delete this page: ' . $package->name . '?') }}"
93+
data-allow-html="true"
94+
data-b64-deletion-message="{{ base64_encode("Are you sure you want to delete this package:<br><br>#{$package->position} - <b>{$package->name}</b> - {$package->cost}") }}"
9495
class="form__button form__button--text"
9596
>
9697
{{ __('common.delete') }}

resources/views/Staff/donation/index.blade.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<th>Date</th>
3838
<th>User</th>
3939
<th>Transaction</th>
40-
<th>Cost</th>
40+
<th>Cost ({{ config('donation.currency') }})</th>
4141
<th>Upload #</th>
4242
<th>Invite #</th>
4343
<th>Bonus #</th>
@@ -60,7 +60,7 @@
6060
class="{{ $donation->package->trashed() ? 'text-danger' : '' }}"
6161
title="{{ $donation->package->trashed() ? 'Package has been deleted' : '' }}"
6262
>
63-
$ {{ $donation->package->cost }}
63+
{{ $donation->package->cost }}
6464
</td>
6565
<td
6666
class="{{ $donation->package->trashed() ? 'text-danger' : '' }}"
@@ -112,7 +112,8 @@ class="{{ $donation->package->trashed() ? 'text-danger' : '' }}"
112112
@csrf
113113
<button
114114
x-on:click.prevent="confirmAction"
115-
data-b64-deletion-message="{{ base64_encode('Are you sure you want to approve this donation: ' . $donation->id . '?') }}"
115+
data-allow-html="true"
116+
data-b64-deletion-message="{{ base64_encode("Are you sure you want to <b>approve</b> this donation:<br><br><b>{$donation->user->username}</b> - {$donation->created_at->diffForHumans()} - {$donation->package->cost}") }}"
116117
class="form__button form__button--filled"
117118
>
118119
Approve
@@ -129,7 +130,8 @@ class="form__button form__button--filled"
129130
@csrf
130131
<button
131132
x-on:click.prevent="confirmAction"
132-
data-b64-deletion-message="{{ base64_encode('Are you sure you want to reject this donation: ' . $donation->id . '?') }}"
133+
data-allow-html="true"
134+
data-b64-deletion-message="{{ base64_encode("Are you sure you want to <b>reject</b> this donation:<br><br><b>{$donation->user->username}</b> - {$donation->created_at->diffForHumans()} - {$donation->package->cost}") }}"
133135
class="form__button form__button--filled"
134136
>
135137
Reject

resources/views/layout/default.blade.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,12 @@ function timer() {
173173
document.addEventListener('alpine:init', () => {
174174
Alpine.data('confirmation', () => ({
175175
confirmAction() {
176+
const swalMessage = atob(this.$el.dataset.b64DeletionMessage);
177+
const allowHtml = this.$el.dataset.allowHtml === 'true';
178+
176179
Swal.fire({
177180
title: 'Are you sure?',
178-
text: atob(this.$el.dataset.b64DeletionMessage),
181+
...(allowHtml ? { html: swalMessage } : { text: swalMessage }),
179182
icon: 'warning',
180183
showConfirmButton: true,
181184
showCancelButton: true,

0 commit comments

Comments
 (0)