Przeglądaj źródła

feat: ✨ Added billing period to edit, create and show of products

IceToast 3 lat temu
rodzic
commit
7dab9d3c7e

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

@@ -116,6 +116,20 @@
                                             @enderror
                                         </div>
 
+                                        <div class="form-group">
+                                            <label for="allocations">{{__('Allocations')}}</label>
+                                            <input value="{{$product->allocations ?? old('allocations') ?? 0}}"
+                                                   id="allocations" name="allocations"
+                                                   type="number"
+                                                   class="form-control @error('allocations') is-invalid @enderror"
+                                                   required="required">
+                                            @error('allocations')
+                                            <div class="invalid-feedback">
+                                                {{ $message }}
+                                            </div>
+                                            @enderror
+                                        </div>
+
                                         <div class="form-group">
                                             <label for="description">{{__('Description')}} <i data-toggle="popover"
                                                                                               data-trigger="hover"
@@ -148,6 +162,34 @@
                                             @enderror
                                         </div>
 
+                                        <div class="form-group">
+                                            <label for="billing_period">{{__('Billing Period')}} <i
+                                                    data-toggle="popover" data-trigger="hover"
+                                                    data-content="{{__('Period when the user will be charged for the given price')}}"
+                                                    class="fas fa-info-circle"></i></label>
+
+                                            <select id="billing_period" style="width:100%" class="custom-select" name="billing_period" required
+                                                autocomplete="off" @error('billing_period') is-invalid @enderror>
+                                                    <option value="hourly" @if ($product->billing_period == 'hourly') selected
+                                                    @endif>
+                                                        {{__('Hourly')}}
+                                                    </option>
+                                                    <option value="daily" @if ($product->billing_period  == 'daily') selected
+                                                    @endif>
+                                                        {{__('Daily')}}
+                                                    </option>
+                                                     <option value="monthly" @if ($product->billing_period  == 'monthly') selected
+                                                     @endif>
+                                                        {{__('Monthly')}}
+                                                    </option>
+                                            </select>
+                                            @error('billing_period')
+                                            <div class="invalid-feedback">
+                                                {{ $message }}
+                                            </div>
+                                            @enderror
+                                        </div>
+
                                         <div class="form-group">
                                             <label for="minimum_credits">{{__('Minimum')}} {{ CREDITS_DISPLAY_NAME }} <i
                                                     data-toggle="popover" data-trigger="hover"
@@ -205,19 +247,6 @@
                                             </div>
                                             @enderror
                                         </div>
-                                        <div class="form-group">
-                                            <label for="allocations">{{__('Allocations')}}</label>
-                                            <input value="{{$product->allocations ?? old('allocations') ?? 0}}"
-                                                   id="allocations" name="allocations"
-                                                   type="number"
-                                                   class="form-control @error('allocations') is-invalid @enderror"
-                                                   required="required">
-                                            @error('allocations')
-                                            <div class="invalid-feedback">
-                                                {{ $message }}
-                                            </div>
-                                            @enderror
-                                        </div>
                                     </div>
                                 </div>
 

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

@@ -122,7 +122,18 @@
                                             </div>
                                             @enderror
                                         </div>
-
+                                        <div class="form-group">
+                                            <label for="allocations">{{__('Allocations')}}</label>
+                                            <input value="{{ $product->allocations }}" id="allocations"
+                                                   name="allocations" type="number"
+                                                   class="form-control @error('allocations') is-invalid @enderror"
+                                                   required="required">
+                                            @error('allocations')
+                                            <div class="invalid-feedback">
+                                                {{ $message }}
+                                            </div>
+                                            @enderror
+                                        </div>
                                         <div class="form-group">
                                             <label for="description">{{__('Description')}} <i data-toggle="popover"
                                                                                               data-trigger="hover"
@@ -152,6 +163,35 @@
                                             </div>
                                             @enderror
                                         </div>
+
+                                        <div class="form-group">
+                                            <label for="billing_period">{{__('Billing Period')}} <i
+                                                    data-toggle="popover" data-trigger="hover"
+                                                    data-content="{{__('Period when the user will be charged for the given price')}}"
+                                                    class="fas fa-info-circle"></i></label>
+
+                                            <select id="billing_period" style="width:100%" class="custom-select" name="billing_period" required
+                                                autocomplete="off" @error('billing_period') is-invalid @enderror>
+                                                    <option value="hourly" @if ($product->billing_period == 'hourly') selected
+                                                    @endif>
+                                                        {{__('Hourly')}}
+                                                    </option>
+                                                    <option value="daily" @if ($product->billing_period  == 'daily') selected
+                                                    @endif>
+                                                        {{__('Daily')}}
+                                                    </option>
+                                                     <option value="monthly" @if ($product->billing_period  == 'monthly') selected
+                                                     @endif>
+                                                        {{__('Monthly')}}
+                                                    </option>
+                                            </select>
+                                            @error('billing_period')
+                                            <div class="invalid-feedback">
+                                                {{ $message }}
+                                            </div>
+                                            @enderror
+                                        </div>
+
                                         <div class="form-group">
                                             <label for="minimum_credits">{{__('Minimum')}} {{ CREDITS_DISPLAY_NAME }} <i
                                                     data-toggle="popover" data-trigger="hover"
@@ -202,18 +242,6 @@
                                             </div>
                                             @enderror
                                         </div>
-                                        <div class="form-group">
-                                            <label for="allocations">{{__('Allocations')}}</label>
-                                            <input value="{{ $product->allocations }}" id="allocations"
-                                                   name="allocations" type="number"
-                                                   class="form-control @error('allocations') is-invalid @enderror"
-                                                   required="required">
-                                            @error('allocations')
-                                            <div class="invalid-feedback">
-                                                {{ $message }}
-                                            </div>
-                                            @enderror
-                                        </div>
                                     </div>
                                 </div>
 

+ 2 - 0
themes/default/views/admin/products/index.blade.php

@@ -44,6 +44,7 @@
                             <th>{{__('Active')}}</th>
                             <th>{{__('Name')}}</th>
                             <th>{{__('Price')}}</th>
+                            <th>{{__('Billing period')}}</th>
                             <th>{{__('Memory')}}</th>
                             <th>{{__('Cpu')}}</th>
                             <th>{{__('Swap')}}</th>
@@ -92,6 +93,7 @@
                     {data: "disabled"},
                     {data: "name"},
                     {data: "price"},
+                    {data: "billing_period"},
                     {data: "memory"},
                     {data: "cpu"},
                     {data: "swap"},