浏览代码

refactor: 🚚 Rename Yearly -> Annually

IceToast 2 年之前
父节点
当前提交
34bd88a4f6

+ 2 - 2
app/Console/Commands/ChargeServers.php

@@ -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':

+ 2 - 2
app/Http/Controllers/Admin/ProductController.php

@@ -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'));

+ 35 - 27
resources/views/servers/index.blade.php

@@ -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') }}

+ 4 - 4
themes/default/views/admin/products/create.blade.php

@@ -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')

+ 4 - 4
themes/default/views/admin/products/edit.blade.php

@@ -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')