refactor: 🚚 Rename Yearly -> Annually

This commit is contained in:
IceToast 2022-07-22 04:09:34 +02:00 committed by IceToast
parent 759ba59988
commit 34bd88a4f6
No known key found for this signature in database
GPG key ID: 1464353E063A5B97
5 changed files with 47 additions and 39 deletions

View file

@ -61,10 +61,10 @@ class ChargeServers extends Command
// check if server is due to be charged by comparing its last_billed date with the current date and the billing period
$newBillingDate = null;
switch($billing_period) {
case 'yearly':
case 'annually':
$newBillingDate = Carbon::parse($server->last_billed)->addYear();
break;
case 'half-yearly':
case 'half-annually':
$newBillingDate = Carbon::parse($server->last_billed)->addMonths(6);
break;
case 'monthly':

View file

@ -72,7 +72,7 @@ class ProductController extends Controller
"nodes.*" => "required|exists:nodes,id",
"eggs.*" => "required|exists:eggs,id",
"disabled" => "nullable",
"billing_period" => "required|in:hourly,daily,weekly,monthly,half-yearly,yearly",
"billing_period" => "required|in:hourly,daily,weekly,monthly,half-annually,annually",
]);
$disabled = ! is_null($request->input('disabled'));
@ -139,7 +139,7 @@ class ProductController extends Controller
"nodes.*" => "required|exists:nodes,id",
"eggs.*" => "required|exists:eggs,id",
"disabled" => "nullable",
"billing_period" => "required|in:hourly,daily,weekly,monthly,half-yearly,yearly",
"billing_period" => "required|in:hourly,daily,weekly,monthly,half-annually,annually",
]);
$disabled = ! is_null($request->input('disabled'));

View file

@ -72,9 +72,13 @@
<div class="row mb-3">
<div class="col my-auto">{{ __('Status') }}:</div>
<div class="col-7 my-auto">
<i
class="fas {{ $server->isSuspended() ? 'text-danger' : 'text-success' }} fa-circle mr-2"></i>
{{ $server->isSuspended() ? 'Suspended' : 'Active' }}
@if($server->suspennded)
<span class="badge badge-danger">{{ __('Suspended') }}</span>
@elseif($server->cancelled)
<span class="badge badge-warning">{{ __('Cancelled') }}</span>
@else
<span class="badge badge-success">{{ __('Active') }}</span>
@endif
</div>
</div>
<div class="row mb-2">
@ -125,28 +129,32 @@
</div>
<div class="col-7 d-flex text-wrap align-items-center">
<span>
@switch($server->product->billing_period)
@case('monthly')
{{ \Carbon\Carbon::parse($server->last_billed)->addMonth()->toDayDateTimeString(); }}
@break
@case('weekly')
{{ \Carbon\Carbon::parse($server->last_billed)->addWeek()->toDayDateTimeString(); }}
@break
@case('daily')
{{ \Carbon\Carbon::parse($server->last_billed)->addDay()->toDayDateTimeString(); }}
@break
@case('hourly')
{{ \Carbon\Carbon::parse($server->last_billed)->addHour()->toDayDateTimeString(); }}
@break
@case('half-yearly')
{{ \Carbon\Carbon::parse($server->last_billed)->addMonths(6)->toDayDateTimeString(); }}
@break
@case('yearly')
{{ \Carbon\Carbon::parse($server->last_billed)->addYear()->toDayDateTimeString(); }}
@break
@default
{{ \Carbon\Carbon::parse($server->last_billed)->addHour()->toDayDateTimeString(); }}
@endswitch
@if ($server->cancelled)
-
@else
@switch($server->product->billing_period)
@case('monthly')
{{ \Carbon\Carbon::parse($server->last_billed)->addMonth()->toDayDateTimeString(); }}
@break
@case('weekly')
{{ \Carbon\Carbon::parse($server->last_billed)->addWeek()->toDayDateTimeString(); }}
@break
@case('daily')
{{ \Carbon\Carbon::parse($server->last_billed)->addDay()->toDayDateTimeString(); }}
@break
@case('hourly')
{{ \Carbon\Carbon::parse($server->last_billed)->addHour()->toDayDateTimeString(); }}
@break
@case('half-annually')
{{ \Carbon\Carbon::parse($server->last_billed)->addMonths(6)->toDayDateTimeString(); }}
@break
@case('annually')
{{ \Carbon\Carbon::parse($server->last_billed)->addYear()->toDayDateTimeString(); }}
@break
@default
{{ __('Unknown') }}
@endswitch
@endif
</span>
</div>
</div>
@ -162,9 +170,9 @@
<div class="text-muted">
@if($server->product->billing_period == 'monthly')
{{ __('per Month') }}
@elseif($server->product->billing_period == 'half-yearly')
@elseif($server->product->billing_period == 'half-annually')
{{ __('per 6 Months') }}
@elseif($server->product->billing_period == 'yearly')
@elseif($server->product->billing_period == 'annually')
{{ __('per Year') }}
@elseif($server->product->billing_period == 'weekly')
{{ __('per Week') }}

View file

@ -183,11 +183,11 @@
<option value="monthly">
{{__('Monthly')}}
</option>
<option value="half-yearly">
{{__('Half Yearly')}}
<option value="half-annually">
{{__('Half Annually')}}
</option>
<option value="yearly">
{{__('Yearly')}}
<option value="annually">
{{__('Annually')}}
</option>
</select>
@error('billing_period')

View file

@ -190,13 +190,13 @@
@endif>
{{__('Monthly')}}
</option>
<option value="half-yearly" @if ($product->billing_period == 'half-yearly') selected
<option value="half-annually" @if ($product->billing_period == 'half-annually') selected
@endif>
{{__('Half Yearly')}}
{{__('Half Annually')}}
</option>
<option value="yearly" @if ($product->billing_period == 'yearly') selected
<option value="annually" @if ($product->billing_period == 'annually') selected
@endif>
{{__('Yearly')}}
{{__('Annually')}}
</option>
</select>
@error('billing_period')