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

This commit is contained in:
IceToast 2022-06-16 12:27:53 +02:00
parent 87bca5c52b
commit 4581b018b0
3 changed files with 85 additions and 26 deletions

View file

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

View file

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

View file

@ -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>
@ -91,6 +92,7 @@
{data: "disabled"},
{data: "name"},
{data: "price"},
{data: "billing_period"},
{data: "memory"},
{data: "cpu"},
{data: "swap"},