mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-05-03 08:50:22 -05:00
Merge pull request #4450 from Roardom/fix-bon-earning-dashboard
(Fix) Various staff dashboard issues with new bon system
This commit is contained in:
@@ -50,7 +50,7 @@ class BonEarningController extends Controller
|
||||
{
|
||||
$bonEarning = BonEarning::create($request->validated('bon_earning'));
|
||||
|
||||
$bonEarning->conditions()->upsert($request->validated('conditions'), ['id']);
|
||||
$bonEarning->conditions()->upsert($request->validated('conditions', []), ['id']);
|
||||
|
||||
return to_route('staff.bon_earnings.index')
|
||||
->with('success', 'Bon Exchange Successfully Added');
|
||||
@@ -77,7 +77,7 @@ class BonEarningController extends Controller
|
||||
->whereNotIn('id', Arr::flatten($request->validated('conditions.*.id')))
|
||||
->delete();
|
||||
|
||||
$bonEarning->conditions()->upsert($request->validated('conditions'), ['id']);
|
||||
$bonEarning->conditions()->upsert($request->validated('conditions', []), ['id']);
|
||||
|
||||
return to_route('staff.bon_earnings.index')
|
||||
->with('success', 'Bon Exchange Successfully Modified');
|
||||
|
||||
@@ -32,6 +32,7 @@ class StoreBonEarningRequest extends FormRequest
|
||||
'bon_earning.position' => [
|
||||
'required',
|
||||
'numeric',
|
||||
'unique:bon_earnings,position',
|
||||
],
|
||||
'bon_earning.name' => [
|
||||
'required',
|
||||
@@ -55,6 +56,7 @@ class StoreBonEarningRequest extends FormRequest
|
||||
'seedtime',
|
||||
'personal_release',
|
||||
'internal',
|
||||
'connectable',
|
||||
]),
|
||||
],
|
||||
'bon_earning.multiplier' => [
|
||||
@@ -86,6 +88,7 @@ class StoreBonEarningRequest extends FormRequest
|
||||
'personal_release',
|
||||
'seedtime',
|
||||
'type_id',
|
||||
'connectable',
|
||||
]),
|
||||
],
|
||||
'conditions.*.operator' => [
|
||||
|
||||
@@ -33,6 +33,16 @@ class UpdateBonEarningRequest extends FormRequest
|
||||
'required',
|
||||
'numeric',
|
||||
],
|
||||
'bon_earning.name' => [
|
||||
'required',
|
||||
'string',
|
||||
'max:255',
|
||||
],
|
||||
'bon_earning.description' => [
|
||||
'required',
|
||||
'string',
|
||||
'max:255',
|
||||
],
|
||||
'bon_earning.variable' => [
|
||||
'required',
|
||||
Rule::in([
|
||||
@@ -45,6 +55,7 @@ class UpdateBonEarningRequest extends FormRequest
|
||||
'seedtime',
|
||||
'personal_release',
|
||||
'internal',
|
||||
'connectable',
|
||||
]),
|
||||
],
|
||||
'bon_earning.multiplier' => [
|
||||
@@ -76,6 +87,7 @@ class UpdateBonEarningRequest extends FormRequest
|
||||
'personal_release',
|
||||
'seedtime',
|
||||
'type_id',
|
||||
'connectable',
|
||||
]),
|
||||
],
|
||||
'conditions.*.operator' => [
|
||||
|
||||
@@ -115,10 +115,10 @@
|
||||
</p>
|
||||
<p class="form__group">
|
||||
<input
|
||||
id="bon_earning[multiplier]"
|
||||
id="multiplier"
|
||||
class="form__text"
|
||||
inputmode="numeric"
|
||||
name="multiplier"
|
||||
name="bon_earning[multiplier]"
|
||||
pattern="[0-9.]*"
|
||||
required
|
||||
type="text"
|
||||
|
||||
@@ -48,9 +48,9 @@
|
||||
</p>
|
||||
<p class="form__group">
|
||||
<input
|
||||
id="bon_earning[description]"
|
||||
id="description"
|
||||
class="form__text"
|
||||
name="description"
|
||||
name="bon_earning[description]"
|
||||
required
|
||||
type="text"
|
||||
maxlength="255"
|
||||
@@ -157,7 +157,7 @@
|
||||
pattern="[0-9.]*"
|
||||
required
|
||||
type="text"
|
||||
value="{{ rtrim($bonEarning->multiplier, '.0') }}"
|
||||
value="{{ preg_replace('/(\.\d+?)0+$/', '$1', $bonEarning->multiplier) }}"
|
||||
/>
|
||||
<label class="form__label form__label--floating" for="multiplier">
|
||||
Multiplier
|
||||
@@ -357,7 +357,7 @@
|
||||
x-bind:name="'conditions[' + i + '][operand2]'"
|
||||
required
|
||||
type="text"
|
||||
x-bind:value="condition['operand2'].replace(/[.0]*$/, '')"
|
||||
x-bind:value="condition['operand2'].replace(/(\.\d+?)0+$/, '$1')"
|
||||
/>
|
||||
<label
|
||||
class="form__label form__label--floating"
|
||||
|
||||
@@ -110,7 +110,9 @@
|
||||
{{ __('common.unknown') }}
|
||||
@endswitch
|
||||
</td>
|
||||
<td>{{ rtrim($bonEarning->multiplier, '.0') }}</td>
|
||||
<td>
|
||||
{{ preg_replace('/(\.\d+?)0+$/', '$1', $bonEarning->multiplier) }}
|
||||
</td>
|
||||
<td>
|
||||
<ul>
|
||||
@forelse ($bonEarning->conditions as $condition)
|
||||
@@ -122,7 +124,7 @@
|
||||
'size' => \App\Helpers\StringHelper::formatBytes($condition->operand2),
|
||||
'seedtime' => \App\Helpers\StringHelper::timeElapsed($condition->operand2),
|
||||
'type_id' => \App\Models\Type::find($condition->operand2)?->name ?? __('common.unknown'),
|
||||
default => rtrim($condition->operand2, '.0'),
|
||||
default => preg_replace('/(\.\d+?)0+$/', '$1', $condition->operand2),
|
||||
}
|
||||
}}
|
||||
</li>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
@endif
|
||||
|
||||
{{ $bonEarning->variable }} ×
|
||||
{{ rtrim($bonEarning->multiplier, '.0') }}
|
||||
{{ preg_replace('/(\.\d+?)0+$/', '$1', $bonEarning->multiplier) }}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@@ -259,16 +259,16 @@
|
||||
{{ \App\Helpers\StringHelper::timeElapsed($torrent->age) }}
|
||||
</td>
|
||||
<td class="user-earnings__hourly">
|
||||
{{ rtrim($torrent->hourly_earnings, '.0') }}
|
||||
{{ preg_replace('/(\.\d+?)0+$/', '$1', $bonEarning->multiplier) }}
|
||||
</td>
|
||||
<td class="user-earnings__daily" x-cloak x-show="isToggledOn">
|
||||
{{ rtrim($torrent->hourly_earnings, '.0') * 24 }}
|
||||
{{ preg_replace('/(\.\d+?)0+$/', '$1', $bonEarning->multiplier) * 24 }}
|
||||
</td>
|
||||
<td class="user-earnings__weekly" x-cloak x-show="isToggledOn">
|
||||
{{ rtrim($torrent->hourly_earnings, '.0') * 24 * 7 }}
|
||||
{{ preg_replace('/(\.\d+?)0+$/', '$1', $bonEarning->multiplier) * 24 * 7 }}
|
||||
</td>
|
||||
<td class="user-earnings__monthly" x-cloak x-show="isToggledOn">
|
||||
{{ rtrim($torrent->hourly_earnings, '.0') * 24 * 30 }}
|
||||
{{ preg_replace('/(\.\d+?)0+$/', '$1', $bonEarning->multiplier) * 24 * 30 }}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
Reference in New Issue
Block a user