Explorar o código

feat: ✨ Added Quartely billing period

IceToast %!s(int64=2) %!d(string=hai) anos
pai
achega
e254b2acfe

+ 3 - 0
app/Console/Commands/ChargeServers.php

@@ -67,6 +67,9 @@ class ChargeServers extends Command
                     case 'half-annually':
                         $newBillingDate = Carbon::parse($server->last_billed)->addMonths(6);
                         break;
+                    case 'quarterly':
+                        $newBillingDate = Carbon::parse($server->last_billed)->addMonths(3);
+                        break;
                     case 'monthly':
                         $newBillingDate = Carbon::parse($server->last_billed)->addMonth();
                         break;

+ 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-annually,annually",
+            "billing_period" => "required|in:hourly,daily,weekly,monthly,quarterly,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-annually,annually",
+            "billing_period" => "required|in:hourly,daily,weekly,monthly,quarterly,half-annually,annually",
         ]);
 
         $disabled = ! is_null($request->input('disabled'));

+ 2 - 0
app/Models/Product.php

@@ -51,6 +51,8 @@ class Product extends Model
                 return $this->price / 24 / 7;
             case 'monthly':
                 return $this->price / 24 / 30;
+            case 'quarterly':
+                return $this->price / 24 / 30 / 3;
             case 'half-annually':
                 return $this->price / 24 / 30 / 6;
             case 'annually':

+ 1 - 0
lang/de.json

@@ -464,6 +464,7 @@
     "yearly": "Jährlich",
     "daily": "Täglich",
     "weekly": "Wöchentlich",
+    "quarterly": "Vierteljährlich",
     "half-annually": "Halbjährlich",
     "annually": "Jährlich",
     "Suspended": "Gesperrt",

+ 1 - 0
lang/sh.json

@@ -447,6 +447,7 @@
     "yearly": "Yearly",
     "daily": "Daily",
     "weekly": "Weekly",
+    "quarterly": "Quarterly",
     "half-annually": "Half-annually",
     "annually": "Annually",
     "Suspended": "Suspended",

+ 5 - 0
resources/views/servers/index.blade.php

@@ -145,6 +145,9 @@
                                                 @case('hourly')
                                                     {{ \Carbon\Carbon::parse($server->last_billed)->addHour()->toDayDateTimeString(); }}
                                                     @break
+                                                @case('quarterly')
+                                                    {{ \Carbon\Carbon::parse($server->last_billed)->addMonths(3)->toDayDateTimeString(); }}
+                                                    @break
                                                 @case('half-annually')
                                                     {{ \Carbon\Carbon::parse($server->last_billed)->addMonths(6)->toDayDateTimeString(); }}
                                                     @break
@@ -172,6 +175,8 @@
                                             {{ __('per Month') }}
                                         @elseif($server->product->billing_period == 'half-annually')
                                             {{ __('per 6 Months') }}
+                                        @elseif($server->product->billing_period == 'quarterly')
+                                            {{ __('per 3 Months') }}
                                         @elseif($server->product->billing_period == 'annually')
                                             {{ __('per Year') }}
                                         @elseif($server->product->billing_period == 'weekly')

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

@@ -183,6 +183,9 @@
                                                      <option value="monthly">
                                                         {{__('Monthly')}}
                                                     </option>
+                                                    <option value="quarterly">
+                                                        {{__('Quarterly')}}
+                                                    </option>
                                                     <option value="half-annually">
                                                         {{__('Half Annually')}}
                                                     </option>

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

@@ -190,6 +190,10 @@
                                                      @endif>
                                                         {{__('Monthly')}}
                                                     </option>
+                                                    <option value="quarterly" @if ($product->billing_period  == 'quarterly') selected
+                                                    @endif>
+                                                        {{__('Quarterly')}}
+                                                    </option>
                                                     <option value="half-annually" @if ($product->billing_period  == 'half-annually') selected
                                                     @endif>
                                                         {{__('Half Annually')}}