feat: Enhance product creation UI with radio buttons and switch, correct product VPS OS foreign key, remove transaction UUID migration, and refactor customer add/edit views.
This commit is contained in:
@@ -221,16 +221,21 @@
|
||||
</div>
|
||||
{{-- Product Type --}}
|
||||
<div class="form-group mb-3">
|
||||
<label for="product_type" class="mb-2">Product Type</label>
|
||||
<select class="form-control select2" name="product_type" id="product_type">
|
||||
<option value="">-- Select Type --</option>
|
||||
<label class="mb-2">Product Type</label>
|
||||
<div class="row">
|
||||
@foreach (\App\Enums\Product\ProductTypeEnums::cases() as $type)
|
||||
<option value="{{ $type->value }}"
|
||||
{{ old('product_type') == $type->value ? 'selected' : '' }}>
|
||||
{{ $type->label() }}
|
||||
</option>
|
||||
<div class="col-md-6 mb-2">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="product_type"
|
||||
id="product_type_{{ $type->value }}" value="{{ $type->value }}"
|
||||
{{ old('product_type') == $type->value ? 'checked' : '' }}>
|
||||
<label class="form-check-label" for="product_type_{{ $type->value }}">
|
||||
{{ $type->label() }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{{-- Operating System (for VPS) --}}
|
||||
<div class="form-group mb-3" id="os-section">
|
||||
@@ -289,14 +294,11 @@
|
||||
{{-- Status --}}
|
||||
<div class="form-group mb-3">
|
||||
<label for="is_active" class="mb-2">Status</label>
|
||||
<select class="form-control select2" name="is_active" id="is_active">
|
||||
@foreach (\App\Enums\Status::cases() as $status)
|
||||
<option value="{{ $status->value }}"
|
||||
{{ old('is_active', \App\Enums\Status::ACTIVE->value) == $status->value ? 'selected' : '' }}>
|
||||
{{ $status->label() }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="is_active"
|
||||
name="is_active" value="1" {{ old('is_active', true) ? 'checked' : '' }}>
|
||||
<label class="form-check-label" for="is_active">Active</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
@@ -350,13 +352,16 @@
|
||||
@endforeach
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Initialize Select2 FIRST
|
||||
if ($(".select2").length) {
|
||||
$(".select2").select2();
|
||||
$(".select2").select2({
|
||||
allowClear: true
|
||||
});
|
||||
}
|
||||
|
||||
// Toggle OS/Control Panel sections based on Product Type
|
||||
function toggleProductSections() {
|
||||
const productType = $('#product_type').val();
|
||||
const productType = $('input[name="product_type"]:checked').val();
|
||||
|
||||
if (productType === 'hosting') {
|
||||
$('#os-section').hide();
|
||||
@@ -394,7 +399,7 @@
|
||||
toggleProductSections();
|
||||
|
||||
// Toggle when product type changes
|
||||
$('#product_type').on('change', toggleProductSections);
|
||||
$('input[name="product_type"]').on('change', toggleProductSections);
|
||||
|
||||
// Trigger initial panel price display
|
||||
$('#control_panel_ids').trigger('change');
|
||||
|
||||
Reference in New Issue
Block a user