@extends('backend.layouts.app') @section('title') {{ __($module_title) }} @endsection @section('content') {{ html()->form('PUT', route('backend.plans.update', $data->id))->attribute('data-toggle', 'validator')->attribute('id', 'form-submit')->class('requires-validation')->attribute('novalidate', 'novalidate')->open() }}
{{ html()->label(__('plan.lbl_name') . ' *', 'name')->class('form-label') }} {{ html()->text('name')->attribute('value', $data->name)->placeholder(__('placeholder.lbl_plan_name'))->class('form-control')->attribute('required', 'required') }} @error('name') {{ $message }} @enderror @unless($errors->has('name'))
{{ __('messages.name_required') }}
@endunless
{{ html()->label(__('plan.lbl_level') . '*', 'level')->class('form-label') }} {{ html()->select( 'level', isset($plan) && $plan > 0 ? collect(range(1, $plan + 1))->mapWithKeys(fn($i) => [$i => 'Level ' . $i])->prepend(__('Select Level'), '')->toArray() : ['1' => 'Level 1'], old('level', $data->level ?? ''), )->class('form-control select2')->id('level')->attribute('placeholder', __('placeholder.lbl_plan_level'))->attribute('required', 'required') }} @error('level') {{ $message }} @enderror @unless($errors->has('level'))
{{ __('messages.level_required') }}
@endunless
{{ html()->label(__('plan.lbl_duration') . '*', 'duration')->class('form-label') }} {{ html()->select( 'duration', [ '' => __('messages.lbl_select_duration'), 'month' => 'Month', 'year' => 'Year', ], $data->duration, )->class('form-control select2')->id('duration')->attribute('placeholder', __('placeholder.lbl_plan_duration_type'))->attribute('required', 'required') }} @error('duration') {{ $message }} @enderror @unless($errors->has('duration'))
{{ __('messages.duration_required') }}
@endunless
{{ html()->label(__('plan.lbl_duration_value') . '*', 'duration_value')->class('form-label') }} {{ html()->input('number', 'duration_value', $data->duration_value)->class('form-control')->id('duration_value')->attribute('placeholder', __('placeholder.lbl_plan_duration_value'))->attribute('oninput', 'this.value = Math.abs(this.value)')->attribute('required', 'required') }} @error('duration_value') {{ $message }} @enderror @unless($errors->has('duration_value'))
{{ __('messages.duration_value_required') }}
@endunless
{{ html()->label(__('plan.lbl_amount') . '*', 'price')->class('form-label') }} {{ html()->input('number', 'price', $data->price)->class('form-control')->attribute('step', '0.01')->id('price')->attribute('placeholder', __('placeholder.lbl_plan_price'))->attribute('required', 'required') }} @error('price') {{ $message }} @enderror @unless($errors->has('price'))
{{ __('messages.price_required') }}
@endunless
{{ html()->label(__('messages.discount'), 'discount')->class('form-label') }}
{{ html()->label(__('messages.active'), 'discount')->class('form-label mb-0 text-body') }}
{{ html()->hidden('discount', 0) }} {{ html()->checkbox('discount', old('discount', $data->discount))->class('form-check-input')->id('discount-toggle') }}
@error('discount') {{ $message }} @enderror
@if ($purchaseMethodEnabled)
{{ html()->label(__('messages.lbl_android_identifier') . '*', 'android_identifier')->class('form-label') }} {{ html()->text('android_identifier', old('android_identifier', $data->android_identifier ?? ''))->class('form-control')->id('android_identifier')->attribute('placeholder', __('messages.lbl_android_identifier'))->attribute('required', 'required') }} @error('android_identifier') {{ $message }} @enderror @unless($errors->has('android_identifier'))
{{ __('messages.android_identifier_required') }}
@endunless
{{ html()->label(__('messages.lbl_apple_identifier') . '*', 'apple_identifier')->class('form-label') }} {{ html()->text('apple_identifier', old('apple_identifier', $data->apple_identifier ?? ''))->class('form-control')->id('apple_identifier')->attribute('placeholder', __('messages.lbl_apple_identifier'))->attribute('required', 'required') }} @error('apple_identifier') {{ $message }} @enderror @unless($errors->has('apple_identifier'))
{{ __('messages.apple_identifier_required') }}
@endunless
@endif
{{ html()->label(__('plan.lbl_status'), 'status')->class('form-label') }}
{{ html()->label(__('messages.active'), 'status')->class('form-label mb-0 text-body') }}
{{ html()->hidden('status', 0) }} {{ html()->checkbox('status', $data->status)->class('form-check-input')->id('status') }}
@error('status') {{ $message }} @enderror
{{ html()->label(__('plan.lbl_discount_percentage') . '*', 'discount_percentage')->class('form-label') }} {{ html()->input('number', 'discount_percentage', old('discount_percentage', $data->discount_percentage ?? 0))->class('form-control')->id('discount_percentage')->attribute('step', '0.01')->attribute('min', '0')->attribute('max', '99')->attribute('placeholder', __('plan.enter_discount_percentage')) }} @error('discount_percentage') {{ $message }} @enderror @unless($errors->has('discount_percentage')) @endunless
{{ html()->label(__('plan.lbl_total_price'), 'total_price')->class('form-label') }} {{ html()->input('number', 'total_price', old('total_price', $data->total_price))->class('form-control')->id('total_price')->attribute('step', '0.01')->attribute('placeholder', __('plan.lbl_total_price'))->attribute('readonly', 'readonly') }} @error('total_price') {{ $message }} @enderror @unless($errors->has('total_price'))
{{ __('messages.total_price_required') }}
@endunless
{{ html()->label(__('plan.lbl_description') . '*', 'description')->class('form-label') }} {{ html()->textarea('description', $data->description)->placeholder(__('placeholder.lbl_plan_limit_description'))->class('form-control')->attribute('required', 'required') }} @error('description') {{ $message }} @enderror @unless($errors->has('description'))
{{ __('messages.description_required') }}
@endunless
@if (!empty($planLimits))
{{ __('plan.lbl_plan_limits') }}
@endif
@foreach ($planLimits as $planLimit)
id}.value", $planLimit->limitation_value) ? 'checked' : '' }} onchange="toggleQualitySection()">
@error("limits.{$planLimit->id}.value") {{ $message }} @enderror
@if ($planLimit->limitation_slug == 'device-limit')
{{ html()->label(__('plan.lbl_device_limit'), 'device_limit_value')->class('form-label') }} {{ html()->input('number', 'device_limit_value', old('device_limit_value', $planLimit->limit))->class('form-control')->id('device_limit_value')->attribute('placeholder', __('placeholder.lbl_device_limit'))->attribute('value', $planLimit->limit ?? '0') }} @error('device_limit_value') {{ $message }} @enderror
has('device_limit_value')) style="display:none" @endif>{{ __('messages.device_limit_required') }}
@endif @if ($planLimit->limitation_slug == 'download-status')
@php $downloadOptions = json_decode($planLimit->limit, true) ?? []; @endphp @foreach ($downloadoptions as $option)
value]) && $downloadOptions[$option->value] == '1' ? 'checked' : '' }}>
@endforeach
@endif @if ($planLimit->limitation_slug == 'profile-limit')
{{ html()->label(__('plan.lbl_profile_limit'), 'profile_limit_value')->class('form-label') }} {{ html()->input('number', 'profile_limit_value', old('profile_limit_value', $planLimit->limit))->class('form-control')->id('profile_limit_value')->attribute('placeholder', __('placeholder.lbl_device_limit'))->attribute('value', $planLimit->limit ?? '0') }} @error('profile_limit_value') {{ $message }} @enderror @unless($errors->has('profile_limit_value'))
{{ __('messages.profile_limit_required') }}
@endunless
@endif @if ($planLimit->limitation_slug == 'supported-device-type')
@foreach (['tablet', 'laptop', 'mobile', 'tv'] as $option)
@endforeach
@endif @endforeach
{{ html()->submit(trans('messages.save'))->class('btn btn-md btn-primary float-right')->id('submit-button') }}
{{ html()->form()->close() }} @endsection @push('after-scripts') @endpush