first upload all files
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
@extends('admin::layout')
|
||||
|
||||
@component('admin::components.page.header')
|
||||
@slot('title', trans('admin::resource.create', ['resource' => trans('option::options.option')]))
|
||||
|
||||
<li><a href="{{ route('admin.options.index') }}">{{ trans('option::options.options') }}</a></li>
|
||||
<li class="active">{{ trans('admin::resource.create', ['resource' => trans('option::options.option')]) }}</li>
|
||||
@endcomponent
|
||||
|
||||
@section('content')
|
||||
<form method="POST" action="{{ route('admin.options.store') }}" class="form-horizontal" id="option-create-form" novalidate>
|
||||
{{ csrf_field() }}
|
||||
|
||||
{!! $tabs->render(compact('option')) !!}
|
||||
</form>
|
||||
@endsection
|
||||
|
||||
@include('option::admin.options.partials.scripts')
|
||||
20
Modules/Option/Resources/views/admin/options/edit.blade.php
Normal file
20
Modules/Option/Resources/views/admin/options/edit.blade.php
Normal file
@@ -0,0 +1,20 @@
|
||||
@extends('admin::layout')
|
||||
|
||||
@component('admin::components.page.header')
|
||||
@slot('title', trans('admin::resource.edit', ['resource' => trans('option::options.option')]))
|
||||
@slot('subtitle', $option->name)
|
||||
|
||||
<li><a href="{{ route('admin.options.index') }}">{{ trans('option::options.options') }}</a></li>
|
||||
<li class="active">{{ trans('admin::resource.edit', ['resource' => trans('option::options.option')]) }}</li>
|
||||
@endcomponent
|
||||
|
||||
@section('content')
|
||||
<form method="POST" action="{{ route('admin.options.update', $option) }}" class="form-horizontal" id="option-edit-form" novalidate>
|
||||
{{ csrf_field() }}
|
||||
{{ method_field('put') }}
|
||||
|
||||
{!! $tabs->render(compact('option')) !!}
|
||||
</form>
|
||||
@endsection
|
||||
|
||||
@include('option::admin.options.partials.scripts')
|
||||
38
Modules/Option/Resources/views/admin/options/index.blade.php
Normal file
38
Modules/Option/Resources/views/admin/options/index.blade.php
Normal file
@@ -0,0 +1,38 @@
|
||||
@extends('admin::layout')
|
||||
|
||||
@component('admin::components.page.header')
|
||||
@slot('title', trans('option::options.options'))
|
||||
|
||||
<li class="active">{{ trans('option::options.options') }}</li>
|
||||
@endcomponent
|
||||
|
||||
@component('admin::components.page.index_table')
|
||||
@slot('buttons', ['create'])
|
||||
@slot('resource', 'options')
|
||||
@slot('name', trans('option::options.option'))
|
||||
|
||||
@slot('thead')
|
||||
<tr>
|
||||
@include('admin::partials.table.select_all')
|
||||
|
||||
<th>{{ trans('admin::admin.table.id') }}</th>
|
||||
<th>{{ trans('option::options.table.name') }}</th>
|
||||
<th>{{ trans('option::options.table.type') }}</th>
|
||||
<th data-sort>{{ trans('admin::admin.table.created') }}</th>
|
||||
</tr>
|
||||
@endslot
|
||||
@endcomponent
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
new DataTable('#options-table .table', {
|
||||
columns: [
|
||||
{ data: 'checkbox', orderable: false, searchable: false, width: '3%' },
|
||||
{ data: 'id', width: '5%' },
|
||||
{ data: 'name', name: 'translations.name', orderable: false, defaultContent: '' },
|
||||
{ data: 'type', name: 'type' },
|
||||
{ data: 'created', name: 'created_at' },
|
||||
],
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,21 @@
|
||||
@push('globals')
|
||||
<script>
|
||||
FleetCart.data['option.values'] = {!! old_json('values', $option->values) !!};
|
||||
FleetCart.errors['option.values'] = @json($errors->get('values.*'), JSON_FORCE_OBJECT);
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@push('shortcuts')
|
||||
<dl class="dl-horizontal">
|
||||
<dt><code>b</code></dt>
|
||||
<dd>{{ trans('admin::admin.shortcuts.back_to_index', ['name' => trans('option::options.option')]) }}</dd>
|
||||
</dl>
|
||||
@endpush
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
keypressAction([
|
||||
{ key: 'b', route: "{{ route('admin.options.index') }}" },
|
||||
]);
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,73 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::text('name', trans('option::attributes.name'), $errors, $option, ['required' => true]) }}
|
||||
|
||||
<div class="form-group required">
|
||||
<label for="type" class="col-md-3 control-label text-left">
|
||||
{{ trans('option::attributes.type') }}<span class="m-l-5 text-red">*</span>
|
||||
</label>
|
||||
|
||||
<div class="col-md-9">
|
||||
<select name="type" class="form-control custom-select-black" id="type">
|
||||
<option value="" {{ is_null(old('type', $option->type)) ? 'selected' : '' }}>
|
||||
{{ trans('option::options.form.option_types.please_select') }}
|
||||
</option>
|
||||
|
||||
<optgroup label="{{ trans('option::options.form.option_types.text') }}">
|
||||
<option value="field" {{ old('type', $option->type) === 'field' ? 'selected' : '' }}>
|
||||
{{ trans('option::options.form.option_types.field') }}
|
||||
</option>
|
||||
|
||||
<option value="textarea" {{ old('type', $option->type) === 'textarea' ? 'selected' : '' }}>
|
||||
{{ trans('option::options.form.option_types.textarea') }}
|
||||
</option>
|
||||
</optgroup>
|
||||
|
||||
<optgroup label="{{ trans('option::options.form.option_types.select') }}">
|
||||
<option value="dropdown" {{ old('type', $option->type) === 'dropdown' ? 'selected' : '' }}>
|
||||
{{ trans('option::options.form.option_types.dropdown') }}
|
||||
</option>
|
||||
|
||||
<option value="checkbox" {{ old('type', $option->type) === 'checkbox' ? 'selected' : '' }}>
|
||||
{{ trans('option::options.form.option_types.checkbox') }}
|
||||
</option>
|
||||
|
||||
<option value="checkbox_custom" {{ old('type', $option->type) === 'checkbox_custom' ? 'selected' : '' }}>
|
||||
{{ trans('option::options.form.option_types.checkbox_custom') }}
|
||||
</option>
|
||||
|
||||
<option value="radio" {{ old('type', $option->type) === 'radio' ? 'selected' : '' }}>
|
||||
{{ trans('option::options.form.option_types.radio') }}
|
||||
</option>
|
||||
|
||||
<option value="radio_custom" {{ old('type', $option->type) === 'radio_custom' ? 'selected' : '' }}>
|
||||
{{ trans('option::options.form.option_types.radio_custom') }}
|
||||
</option>
|
||||
|
||||
<option value="multiple_select" {{ old('type', $option->type) === 'multiple_select' ? 'selected' : '' }}>
|
||||
{{ trans('option::options.form.option_types.multiple_select') }}
|
||||
</option>
|
||||
</optgroup>
|
||||
|
||||
<optgroup label="{{ trans('option::options.form.option_types.date') }}">
|
||||
<option value="date" {{ old('type', $option->type) === 'date' ? 'selected' : '' }}>
|
||||
{{ trans('option::options.form.option_types.date') }}
|
||||
</option>
|
||||
|
||||
<option value="date_time" {{ old('type', $option->type) === 'date_time' ? 'selected' : '' }}>
|
||||
{{ trans('option::options.form.option_types.date_time') }}
|
||||
</option>
|
||||
|
||||
<option value="time" {{ old('type', $option->type) === 'time' ? 'selected' : '' }}>
|
||||
{{ trans('option::options.form.option_types.time') }}
|
||||
</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
|
||||
{!! $errors->first('type', '<span class="help-block text-red">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ Form::checkbox('is_required', trans('option::attributes.is_required'), trans('option::options.form.this_option_is_required'), $errors, $option) }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,9 @@
|
||||
<div class="option-values clearfix" id="option-values">
|
||||
<div class="alert alert-info" id="option-values-info">
|
||||
{{ trans('option::options.please_select_a_option_type') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('option::admin.options.templates.option.text')
|
||||
@include('option::admin.options.templates.option.select')
|
||||
@include('option::admin.options.templates.option.select_values')
|
||||
@@ -0,0 +1,39 @@
|
||||
<script type="text/html" id="option-select-template">
|
||||
<div class="option-select <% if (optionId === undefined) { %> m-b-15 <% } %>">
|
||||
<div class="table-responsive">
|
||||
<table class="options table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>{{ trans('option::attributes.label') }}</th>
|
||||
<th>{{ trans('option::attributes.price') }}</th>
|
||||
<th>{{ trans('option::attributes.price_type') }}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody
|
||||
<% if (optionId === undefined) { %>
|
||||
id="select-values"
|
||||
<% } else { %>
|
||||
id="option-<%- optionId %>-select-values"
|
||||
<% } %>
|
||||
>
|
||||
{{-- Custom option dropdown rows will be added here dynamically using JS --}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-default"
|
||||
<% if (optionId === undefined) { %>
|
||||
id="add-new-row"
|
||||
<% } else { %>
|
||||
id="option-<%- optionId %>-add-new-row"
|
||||
<% } %>
|
||||
>
|
||||
{{ trans('option::options.form.add_new_row') }}
|
||||
</button>
|
||||
</div>
|
||||
</script>
|
||||
@@ -0,0 +1,83 @@
|
||||
<script type="text/html" id="option-select-values-template">
|
||||
<tr class="option-row">
|
||||
<td class="text-center">
|
||||
<span class="drag-icon">
|
||||
<i class="fa"></i>
|
||||
<i class="fa"></i>
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<input
|
||||
type="hidden"
|
||||
<% if (optionId === undefined) { %>
|
||||
name="values[<%- valueId %>][id]"
|
||||
id="values-<%- valueId %>-id"
|
||||
<% } else { %>
|
||||
name="options[<%- optionId %>][values][<%- valueId %>][id]"
|
||||
id="option-<%- optionId %>-values-<%- valueId %>-id"
|
||||
<% } %>
|
||||
|
||||
value="<%- value.id %>"
|
||||
>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
<% if (optionId === undefined) { %>
|
||||
name="values[<%- valueId %>][label]"
|
||||
id="values-<%- valueId %>-label"
|
||||
<% } else { %>
|
||||
name="options[<%- optionId %>][values][<%- valueId %>][label]"
|
||||
id="option-<%- optionId %>-values-<%- valueId %>-label"
|
||||
<% } %>
|
||||
|
||||
class="form-control"
|
||||
value="<%- value.label %>"
|
||||
>
|
||||
</td>
|
||||
<td>
|
||||
<input
|
||||
type="number"
|
||||
<% if (optionId === undefined) { %>
|
||||
name="values[<%- valueId %>][price]"
|
||||
id="values-<%- valueId %>-price"
|
||||
<% } else { %>
|
||||
name="options[<%- optionId %>][values][<%- valueId %>][price]"
|
||||
id="option-<%- optionId %>-values-<%- valueId %>-price"
|
||||
<% } %>
|
||||
class="form-control"
|
||||
value="<%- _.isObject(value.price) ? value.price.amount : value.price %>"
|
||||
step="0.01"
|
||||
min="0"
|
||||
>
|
||||
</td>
|
||||
<td>
|
||||
<select
|
||||
<% if (optionId === undefined) { %>
|
||||
name="values[<%- valueId %>][price_type]"
|
||||
id="values-<%- valueId %>-price_type"
|
||||
<% } else { %>
|
||||
name="options[<%- optionId %>][values][<%- valueId %>][price_type]"
|
||||
id="option-<%- optionId %>-values-<%- valueId %>-price_type"
|
||||
<% } %>
|
||||
class="form-control custom-select-black"
|
||||
>
|
||||
<option value="fixed"
|
||||
<%= value.price_type === 'fixed' ? 'selected' : '' %>
|
||||
>
|
||||
{{ trans('option::options.form.price_types.fixed') }}
|
||||
</option>
|
||||
|
||||
<option value="percent"
|
||||
<%= value.price_type === 'percent' ? 'selected' : '' %>
|
||||
>
|
||||
{{ trans('option::options.form.price_types.percent') }}
|
||||
</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<button type="button" class="btn btn-default delete-row" data-toggle="tooltip" title="{{ trans('option::options.form.delete_row') }}">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>
|
||||
</td>
|
||||
</td>
|
||||
</script>
|
||||
@@ -0,0 +1,54 @@
|
||||
<script type="text/html" id="option-text-template">
|
||||
<div class="table-responsive option-text">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ trans('option::attributes.price') }}</th>
|
||||
<th>{{ trans('option::attributes.price_type') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<input
|
||||
type="number"
|
||||
<% if (optionId === undefined) { %>
|
||||
name="values[0][price]"
|
||||
id="values-0-price"
|
||||
<% } else { %>
|
||||
name="options[<%- optionId %>][values][0][price]"
|
||||
id="option-<%- optionId %>-values-0-price"
|
||||
<% } %>
|
||||
class="form-control"
|
||||
value="<%- _.isObject(value.price) ? value.price.amount : value.price %>"
|
||||
>
|
||||
</td>
|
||||
<td>
|
||||
<select
|
||||
<% if (optionId === undefined) { %>
|
||||
name="values[0][price_type]"
|
||||
id="values-0-price-type"
|
||||
<% } else { %>
|
||||
name="options[<%- optionId %>][values][0][price_type]"
|
||||
id="option-<%- optionId %>-values-0-price-type"
|
||||
<% } %>
|
||||
class="form-control custom-select-black"
|
||||
>
|
||||
<option value="fixed"
|
||||
<%= value.price_type === 'fixed' ? 'selected' : '' %>
|
||||
>
|
||||
{{ trans('option::options.form.price_types.fixed') }}
|
||||
</option>
|
||||
|
||||
<option value="percent"
|
||||
<%= value.price_type === 'percent' ? 'selected' : '' %>
|
||||
>
|
||||
{{ trans('option::options.form.price_types.percent') }}
|
||||
</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</script>
|
||||
@@ -0,0 +1,147 @@
|
||||
<script type="text/html" id="option-template">
|
||||
<div class="content-accordion panel-group options-group-wrapper" id="option-<%- optionId %>">
|
||||
<div class="panel panel-default option">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<a data-toggle="collapse" data-parent="#option-<%- optionId %>" href="#custom-collapse-<%- optionId %>">
|
||||
<span class="drag-icon pull-left">
|
||||
<i class="fa"></i>
|
||||
<i class="fa"></i>
|
||||
</span>
|
||||
|
||||
<span id="option-name" class="pull-left">{{ trans('option::options.form.new_option') }}</span>
|
||||
</a>
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<div id="custom-collapse-<%- optionId %>" class="panel-collapse collapse in">
|
||||
<div class="panel-body">
|
||||
<div class="new-option clearfix">
|
||||
<input type="hidden" name="options[<%- optionId %>][id]" value="<%- option.id %>">
|
||||
|
||||
<div class="col-lg-6 col-md-12 p-l-0">
|
||||
<div class="form-group">
|
||||
<label for="option-<%- optionId %>-name">{{ trans('option::attributes.name') }}</label>
|
||||
<input type="text" name="options[<%- optionId %>][name]" class="form-control option-name-field" id="option-<%- optionId %>-name" value="<%- option.name %>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3 col-md-12 p-l-0">
|
||||
<div class="form-group">
|
||||
<label for="option-<%- optionId %>-type">{{ trans('option::attributes.type') }}</label>
|
||||
|
||||
<select name="options[<%- optionId %>][type]" class="form-control custom-select-black" id="option-<%- optionId %>-type">
|
||||
<option value=""
|
||||
<%= option.type === null ? 'selected' : '' %>
|
||||
>
|
||||
{{ trans('option::options.form.option_types.please_select') }}
|
||||
</option>
|
||||
|
||||
<optgroup label="{{ trans('option::options.form.option_types.text') }}">
|
||||
<option value="field"
|
||||
<%= option.type === 'field' ? 'selected' : '' %>
|
||||
>
|
||||
{{ trans('option::options.form.option_types.field') }}
|
||||
</option>
|
||||
|
||||
<option value="textarea"
|
||||
<%= option.type === 'textarea' ? 'selected' : '' %>
|
||||
>
|
||||
{{ trans('option::options.form.option_types.textarea') }}
|
||||
</option>
|
||||
</optgroup>
|
||||
|
||||
<optgroup label="{{ trans('option::options.form.option_types.select') }}">
|
||||
<option value="dropdown"
|
||||
<%= option.type === 'dropdown' ? 'selected' : '' %>
|
||||
>
|
||||
{{ trans('option::options.form.option_types.dropdown') }}
|
||||
</option>
|
||||
|
||||
<option value="checkbox"
|
||||
<%= option.type === 'checkbox' ? 'selected' : '' %>
|
||||
>
|
||||
{{ trans('option::options.form.option_types.checkbox') }}
|
||||
</option>
|
||||
|
||||
<option value="checkbox_custom"
|
||||
<%= option.type === 'checkbox_custom' ? 'selected' : '' %>
|
||||
>
|
||||
{{ trans('option::options.form.option_types.checkbox_custom') }}
|
||||
</option>
|
||||
|
||||
<option value="radio"
|
||||
<%= option.type === 'radio' ? 'selected' : '' %>
|
||||
>
|
||||
{{ trans('option::options.form.option_types.radio') }}
|
||||
</option>
|
||||
|
||||
<option value="radio_custom"
|
||||
<%= option.type === 'radio_custom' ? 'selected' : '' %>
|
||||
>
|
||||
{{ trans('option::options.form.option_types.radio_custom') }}
|
||||
</option>
|
||||
|
||||
<option value="multiple_select"
|
||||
<%= option.type === 'multiple_select' ? 'selected' : '' %>
|
||||
>
|
||||
{{ trans('option::options.form.option_types.multiple_select') }}
|
||||
</option>
|
||||
</optgroup>
|
||||
|
||||
<optgroup label="{{ trans('option::options.form.option_types.date') }}">
|
||||
<option value="date"
|
||||
<%= option.type === 'date' ? 'selected' : '' %>
|
||||
>
|
||||
{{ trans('option::options.form.option_types.date') }}
|
||||
</option>
|
||||
|
||||
<option value="date_time"
|
||||
<%= option.type === 'date_time' ? 'selected' : '' %>
|
||||
>
|
||||
{{ trans('option::options.form.option_types.date_time') }}
|
||||
</option>
|
||||
|
||||
<option value="time"
|
||||
<%= option.type === 'time' ? 'selected' : '' %>
|
||||
>
|
||||
{{ trans('option::options.form.option_types.time') }}
|
||||
</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="checkbox">
|
||||
<input type="hidden" name="options[<%- optionId %>][is_required]" value="0">
|
||||
|
||||
<input type="checkbox"
|
||||
name="options[<%- optionId %>][is_required]"
|
||||
class="form-control"
|
||||
id="option-<%- optionId %>-is-required"
|
||||
value="1"
|
||||
<%= option.is_required ? 'checked' : '' %>
|
||||
>
|
||||
|
||||
<label for="option-<%- optionId %>-is-required">{{ trans('option::attributes.is_required') }}</label>
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-default delete-option pull-right" data-toggle="tooltip" title="{{ trans('option::options.form.delete_option') }}">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<div class="option-values clearfix" id="option-<%- optionId %>-values">
|
||||
{{-- Custom option values will be added here dynamically using JS --}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
@include('option::admin.options.templates.option.text')
|
||||
@include('option::admin.options.templates.option.select')
|
||||
@include('option::admin.options.templates.option.select_values')
|
||||
@@ -0,0 +1,42 @@
|
||||
<div id="options-group">
|
||||
{{-- Options will be added here dynamically using JS --}}
|
||||
</div>
|
||||
|
||||
<div class="box-footer no-border p-t-0">
|
||||
<div class="form-group pull-left">
|
||||
<div class="col-md-10">
|
||||
<button type="button" class="btn btn-default m-r-10" id="add-new-option">
|
||||
{{ trans('option::options.form.add_new_option') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@hasAccess('admin.options.index')
|
||||
@if ($globalOptions->isNotEmpty())
|
||||
<div class="add-global-option clearfix pull-right">
|
||||
<div class="form-group pull-left">
|
||||
<select class="form-control custom-select-black" id="global-option">
|
||||
<option value="">{{ trans('option::options.select_global_option') }}</option>
|
||||
|
||||
@foreach ($globalOptions as $globalOption)
|
||||
<option value="{{ $globalOption->id }}">{{ $globalOption->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-default" id="add-global-option" data-loading>
|
||||
{{ trans('option::options.form.add_global_option') }}
|
||||
</button>
|
||||
</div>
|
||||
@endif
|
||||
@endHasAccess
|
||||
</div>
|
||||
|
||||
@push('globals')
|
||||
<script>
|
||||
FleetCart.data['product.options'] = {!! old_json('options', $product->options) !!};
|
||||
FleetCart.errors['product.options'] = @json($errors->get('options.*'), JSON_FORCE_OBJECT);
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@include('option::admin.options.templates.product_option')
|
||||
Reference in New Issue
Block a user