Merge branch 'master' of https://github.com/bagisto/bagisto into prashant
Countries and States list component to be devised for system wide usage.
This commit is contained in:
commit
b33d7c1aa1
|
|
@ -18,7 +18,6 @@
|
|||
"laravel/framework": "5.6.*",
|
||||
"laravel/tinker": "^1.0",
|
||||
"nwidart/laravel-modules": "^3.2",
|
||||
"pragmarx/countries": "^0.5.9",
|
||||
"prettus/l5-repository": "^2.6",
|
||||
"propaganistas/laravel-intl": "^2.0"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -284,20 +284,6 @@ Route::group(['middleware' => ['web']], function () {
|
|||
])->name('admin.locales.store');
|
||||
|
||||
|
||||
// Country Routes
|
||||
Route::get('/countries', 'Webkul\Core\Http\Controllers\CountryController@index')->defaults('_config', [
|
||||
'view' => 'admin::settings.countries.index'
|
||||
])->name('admin.countries.index');
|
||||
|
||||
Route::get('/countries/create', 'Webkul\Core\Http\Controllers\CountryController@create')->defaults('_config', [
|
||||
'view' => 'admin::settings.countries.create'
|
||||
])->name('admin.countries.create');
|
||||
|
||||
Route::post('/countries/create', 'Webkul\Core\Http\Controllers\CountryController@store')->defaults('_config', [
|
||||
'redirect' => 'admin.countries.index'
|
||||
])->name('admin.countries.store');
|
||||
|
||||
|
||||
// Currency Routes
|
||||
Route::get('/currencies', 'Webkul\Core\Http\Controllers\CurrencyController@index')->defaults('_config', [
|
||||
'view' => 'admin::settings.currencies.index'
|
||||
|
|
@ -400,54 +386,52 @@ Route::group(['middleware' => ['web']], function () {
|
|||
'redirect' => 'admin::sliders.index'
|
||||
])->name('admin.sliders.store');
|
||||
|
||||
|
||||
//tax routes
|
||||
Route::prefix('tax')->group(function () {
|
||||
Route::get('/tax-categories', 'Webkul\Tax\Http\Controllers\TaxController@index')->defaults('_config', [
|
||||
'view' => 'admin::tax.tax-categories.index'
|
||||
])->name('admin.tax-categories.index');
|
||||
|
||||
Route::get('taxrule', 'Webkul\Tax\Http\Controllers\TaxController@index')->defaults('_config', [
|
||||
'view' => 'admin::tax.taxrule.index'
|
||||
])->name('admin.taxrule.index');
|
||||
// tax rule routes
|
||||
Route::get('/tax-categories/create', 'Webkul\Tax\Http\Controllers\TaxCategoryController@show')->defaults('_config', [
|
||||
'view' => 'admin::tax.tax-categories.create'
|
||||
])->name('admin.tax-categories.show');
|
||||
|
||||
// tax rule routes
|
||||
Route::get('taxrule/create', 'Webkul\Tax\Http\Controllers\TaxCategoryController@show')->defaults('_config', [
|
||||
'view' => 'admin::tax.taxrule.create.create'
|
||||
])->name('admin.taxrule.show');
|
||||
Route::post('/tax-categories/create', 'Webkul\Tax\Http\Controllers\TaxCategoryController@create')->defaults('_config', [
|
||||
'redirect' => 'admin.tax-categories.index'
|
||||
])->name('admin.tax-categories.create');
|
||||
|
||||
Route::post('taxrule/create', 'Webkul\Tax\Http\Controllers\TaxCategoryController@create')->defaults('_config', [
|
||||
'redirect' => 'admin.taxrule.index'
|
||||
])->name('admin.taxrule.create');
|
||||
Route::get('/tax-categories/edit/{id}', 'Webkul\Tax\Http\Controllers\TaxCategoryController@edit')->defaults('_config', [
|
||||
'view' => 'admin::tax.tax-categories.edit'
|
||||
])->name('admin.tax-categories.edit');
|
||||
|
||||
Route::get('/taxrule/edit/{id}', 'Webkul\Tax\Http\Controllers\TaxCategoryController@edit')->defaults('_config', [
|
||||
'view' => 'admin::tax.taxrule.edit.edit'
|
||||
])->name('admin.taxrule.edit');
|
||||
Route::put('/tax-categories/edit/{id}', 'Webkul\Tax\Http\Controllers\TaxCategoryController@update')->defaults('_config', [
|
||||
'redirect' => 'admin.tax-categories.index'
|
||||
])->name('admin.tax-categories.update');
|
||||
|
||||
Route::put('/taxrule/edit/{id}', 'Webkul\Tax\Http\Controllers\TaxCategoryController@update')->defaults('_config', [
|
||||
'redirect' => 'admin.taxrule.index'
|
||||
])->name('admin.taxrule.update');
|
||||
//tax rule ends
|
||||
|
||||
//tax rule ends
|
||||
|
||||
//tax rate
|
||||
//tax rate
|
||||
Route::get('tax-rates', 'Webkul\Tax\Http\Controllers\TaxRateController@index')->defaults('_config', [
|
||||
'view' => 'admin::tax.tax-rates.index'
|
||||
])->name('admin.tax-rates.index');
|
||||
|
||||
Route::get('taxrate', 'Webkul\Tax\Http\Controllers\TaxRateController@index')->defaults('_config', [
|
||||
'view' => 'admin::tax.taxrate.index'
|
||||
])->name('admin.taxrate.index');
|
||||
Route::get('tax-rates/create', 'Webkul\Tax\Http\Controllers\TaxRateController@show')->defaults('_config', [
|
||||
'view' => 'admin::tax.tax-rates.create'
|
||||
])->name('admin.tax-rates.show');
|
||||
|
||||
Route::get('taxrate/create', 'Webkul\Tax\Http\Controllers\TaxRateController@show')->defaults('_config', [
|
||||
'view' => 'admin::tax.taxrate.create.taxrate'
|
||||
])->name('admin.taxrate.show');
|
||||
Route::post('tax-rates/create', 'Webkul\Tax\Http\Controllers\TaxRateController@create')->defaults('_config', [
|
||||
'redirect' => 'admin.tax-rates.index'
|
||||
])->name('admin.tax-rates.create');
|
||||
|
||||
Route::post('taxrate/create', 'Webkul\Tax\Http\Controllers\TaxRateController@create')->defaults('_config', [
|
||||
'redirect' => 'admin.taxrate.index'
|
||||
])->name('admin.taxrate.create');
|
||||
Route::get('tax-rates/edit/{id}', 'Webkul\Tax\Http\Controllers\TaxRateController@edit')->defaults('_config', [
|
||||
'view' => 'admin::tax.tax-rates.edit'
|
||||
])->name('admin.tax-rates.store');
|
||||
|
||||
Route::get('taxrate/edit/{id}', 'Webkul\Tax\Http\Controllers\TaxRateController@edit')->defaults('_config', [
|
||||
'view' => 'admin::tax.taxrate.edit.edit'
|
||||
])->name('admin.taxrate.store');
|
||||
|
||||
Route::put('taxrate/update/{id}', 'Webkul\Tax\Http\Controllers\TaxRateController@update')->defaults('_config', [
|
||||
'redirect' => 'admin.taxrate.index'
|
||||
])->name('admin.taxrate.update');
|
||||
});
|
||||
Route::put('tax-rates/update/{id}', 'Webkul\Tax\Http\Controllers\TaxRateController@update')->defaults('_config', [
|
||||
'redirect' => 'admin.tax-rates.index'
|
||||
])->name('admin.tax-rates.update');
|
||||
//tax rate ends
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -68,21 +68,19 @@ class EventServiceProvider extends ServiceProvider
|
|||
|
||||
$menu->add('configuration.account', 'My Account', 'admin.account.edit', 1);
|
||||
|
||||
$menu->add('settings', 'Settings', 'admin.countries.index', 6, 'settings-icon');
|
||||
$menu->add('settings', 'Settings', 'admin.locales.index', 6, 'settings-icon');
|
||||
|
||||
$menu->add('settings.countries', 'Countries', 'admin.countries.index', 1, '');
|
||||
$menu->add('settings.locales', 'Locales', 'admin.locales.index', 1, '');
|
||||
|
||||
$menu->add('settings.locales', 'Locales', 'admin.locales.index', 2, '');
|
||||
$menu->add('settings.currencies', 'Currencies', 'admin.currencies.index', 2, '');
|
||||
|
||||
$menu->add('settings.currencies', 'Currencies', 'admin.currencies.index', 3, '');
|
||||
$menu->add('settings.exchange_rates', 'Exchange Rates', 'admin.exchange_rates.index', 3, '');
|
||||
|
||||
$menu->add('settings.exchange_rates', 'Exchange Rates', 'admin.exchange_rates.index', 4, '');
|
||||
|
||||
$menu->add('settings.inventory_sources', 'Inventory Sources', 'admin.inventory_sources.index', 5, '');
|
||||
$menu->add('settings.inventory_sources', 'Inventory Sources', 'admin.inventory_sources.index', 4, '');
|
||||
|
||||
$menu->add('settings.channels', 'Channels', 'admin.channels.index', 5, '');
|
||||
|
||||
$menu->add('settings.users', 'Users', 'admin.users.index', 7, '');
|
||||
$menu->add('settings.users', 'Users', 'admin.users.index', 6, '');
|
||||
|
||||
$menu->add('settings.users.users', 'Users', 'admin.users.index', 1, '');
|
||||
|
||||
|
|
@ -90,11 +88,11 @@ class EventServiceProvider extends ServiceProvider
|
|||
|
||||
$menu->add('settings.sliders', 'Create Sliders', 'admin.sliders.index', 8, '');
|
||||
|
||||
$menu->add('settings.tax', 'Taxes', 'admin.taxrule.index', 9, '');
|
||||
$menu->add('settings.tax', 'Taxes', 'admin.tax-categories.index', 9, '');
|
||||
|
||||
$menu->add('settings.tax.taxrule', 'Add Tax Category', 'admin.taxrule.index', 1, '');
|
||||
$menu->add('settings.tax.tax-categories', 'Add Tax Category', 'admin.tax-categories.index', 1, '');
|
||||
|
||||
$menu->add('settings.tax.taxrate', 'Add Tax Rates', 'admin.taxrate.index', 2, '');
|
||||
$menu->add('settings.tax.tax-rates', 'Add Tax Rates', 'admin.tax-rates.index', 2, '');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
return [
|
||||
'common' => [
|
||||
'no-result-found' => 'We couldn\'t find any records.'
|
||||
'no-result-found' => 'We couldn\'t find any records.',
|
||||
'country' => 'Country',
|
||||
'state' => 'State'
|
||||
],
|
||||
'account' => [
|
||||
'header-title' => 'My Account',
|
||||
|
|
@ -260,7 +262,7 @@ return [
|
|||
'add-title' => 'Add Tax Category'
|
||||
],
|
||||
|
||||
'taxrule' => [
|
||||
'tax-categories' => [
|
||||
'title' => 'Add Tax Category',
|
||||
'create' => 'Create Tax Category',
|
||||
'general' => 'Tax Category',
|
||||
|
|
@ -275,7 +277,7 @@ return [
|
|||
]
|
||||
],
|
||||
|
||||
'taxrate' => [
|
||||
'tax-rates' => [
|
||||
'title' => 'Add Tax Rate',
|
||||
'general' => 'Tax Rate',
|
||||
'identifier' => 'Identifier',
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
<div class="control-group">
|
||||
<label for="country">{{ __('admin::app.common.country') }}</label>
|
||||
<select class="control" id="country" name="country">
|
||||
|
||||
@foreach(core()->countries() as $country)
|
||||
|
||||
<option value="{{ $country->code }}" {{ old('country') == $country->code ? 'selected' : '' }}>
|
||||
{{ $country->name }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="state">{{ __('admin::app.common.state') }}</label>
|
||||
<input class="control" id="state" name="state" value="{{ old('state') }}"/>
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
|
||||
|
||||
|
||||
@endpush
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<div class="control-group">
|
||||
<?php $selectedCountry = old('country') ?: $model->country ?>
|
||||
|
||||
<label for="country">{{ __('admin::app.common.country') }}</label>
|
||||
|
||||
<select class="control" id="country" name="country">
|
||||
|
||||
@foreach(core()->countries() as $country)
|
||||
|
||||
<option value="{{ $country->code }}" {{ $selectedCountry == $country->code ? 'selected' : '' }}>
|
||||
{{ $country->name }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="state">{{ __('admin::app.common.state') }}</label>
|
||||
<input class="control" id="state" name="state" value="{{ old('state') ?: $model->state }}"/>
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
|
||||
|
||||
|
||||
@endpush
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
|
||||
<form method="POST" action="{{ route('admin.countries.store') }}" @submit.prevent="onSubmit">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.settings.countries.add-title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.settings.countries.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
<div class="form-container">
|
||||
@csrf()
|
||||
|
||||
<accordian :title="'{{ __('admin::app.settings.countries.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
|
||||
<label for="code" class="required">{{ __('admin::app.settings.countries.code') }}</label>
|
||||
<input v-validate="'required'" class="control" id="code" name="code" v-code/>
|
||||
<span class="control-error" v-if="errors.has('code')">@{{ errors.first('code') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
||||
<label for="name" class="required">{{ __('admin::app.settings.countries.name') }}</label>
|
||||
<input v-validate="'required'" class="control" id="name" name="name"/>
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.settings.countries.title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<a href="{{ route('admin.countries.create') }}" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.settings.countries.add-title') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
@inject('countries','Webkul\Admin\DataGrids\CountryDataGrid')
|
||||
{!! $countries->render() !!}
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -100,16 +100,7 @@
|
|||
<accordian :title="'{{ __('admin::app.settings.inventory_sources.address') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<div class="control-group">
|
||||
<label for="country">{{ __('admin::app.settings.inventory_sources.country') }}</label>
|
||||
<select class="control" id="country" name="country">
|
||||
@foreach(core()->countries() as $countryCoode => $countryName)
|
||||
<option value="{{ $countryCoode }}" {{ old('country') == $countryCoode ? 'selected' : '' }}>
|
||||
{{ $countryName }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@include ('admin::common.create-country-state')
|
||||
|
||||
<div class="control-group">
|
||||
<label for="state">{{ __('admin::app.settings.inventory_sources.state') }}</label>
|
||||
|
|
|
|||
|
|
@ -101,22 +101,7 @@
|
|||
<accordian :title="'{{ __('admin::app.settings.inventory_sources.address') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<div class="control-group">
|
||||
<?php $selectedCountry = old('country') ?: $inventorySource->country ?>
|
||||
<label for="country">{{ __('admin::app.settings.inventory_sources.country') }}</label>
|
||||
<select class="control" id="country" name="country">
|
||||
@foreach(core()->countries() as $countryCoode => $countryName)
|
||||
<option value="{{ $countryCoode }}" {{ $selectedCountry == $countryCoode ? 'selected' : '' }}>
|
||||
{{ $countryName }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="state">{{ __('admin::app.settings.inventory_sources.state') }}</label>
|
||||
<input class="control" id="state" name="state" value="{{ old('state') ?: $inventorySource->state }}"/>
|
||||
</div>
|
||||
@include ('admin::common.edit-country-state', ['model' => $inventorySource])
|
||||
|
||||
<div class="control-group">
|
||||
<label for="city">{{ __('admin::app.settings.inventory_sources.city') }}</label>
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.configuration.taxrule.title') }}
|
||||
{{ __('admin::app.configuration.tax-categories.title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<form method="POST" action="{{ route('admin.taxrule.create') }}" @submit.prevent="onSubmit">
|
||||
<form method="POST" action="{{ route('admin.tax-categories.create') }}" @submit.prevent="onSubmit">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.configuration.taxrule.title') }}</h1>
|
||||
<h1>{{ __('admin::app.configuration.tax-categories.title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.configuration.taxrule.create') }}
|
||||
{{ __('admin::app.configuration.tax-categories.create') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
<div class="form-container">
|
||||
@csrf()
|
||||
<div class="control-group" :class="[errors.has('channel') ? 'has-error' : '']">
|
||||
<label for="channel" class="required">{{ __('admin::app.configuration.taxrule.select-channel') }}</label>
|
||||
<label for="channel" class="required">{{ __('admin::app.configuration.tax-categories.select-channel') }}</label>
|
||||
|
||||
<select class="control" name="channel_id">
|
||||
@foreach(core()->getAllChannels() as $channelModel)
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
|
||||
<label for="code" class="required">{{ __('admin::app.configuration.taxrule.code') }}</label>
|
||||
<label for="code" class="required">{{ __('admin::app.configuration.tax-categories.code') }}</label>
|
||||
|
||||
<input v-validate="'required'" class="control" id="code" name="code" value="{{ old('code') }}"/>
|
||||
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
||||
<label for="name" class="required">{{ __('admin::app.configuration.taxrule.name') }}</label>
|
||||
<label for="name" class="required">{{ __('admin::app.configuration.tax-categories.name') }}</label>
|
||||
|
||||
<input v-validate="'required'" class="control" id="name" name="name" value="{{ old('name') }}"/>
|
||||
|
||||
|
|
@ -54,7 +54,7 @@
|
|||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('description') ? 'has-error' : '']">
|
||||
<label for="description" class="required">{{ __('admin::app.configuration.taxrule.description') }}</label>
|
||||
<label for="description" class="required">{{ __('admin::app.configuration.tax-categories.description') }}</label>
|
||||
|
||||
<textarea v-validate="'required'" class="control" id="description" name="description" value="{{ old('description') }}"></textarea>
|
||||
|
||||
|
|
@ -62,7 +62,7 @@
|
|||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('taxrates') ? 'has-error' : '']">
|
||||
<label for="taxrates" class="required">{{ __('admin::app.configuration.taxrule.select-taxrates') }}</label>
|
||||
<label for="taxrates" class="required">{{ __('admin::app.configuration.tax-categories.select-taxrates') }}</label>
|
||||
|
||||
<select multiple="multiple" v-validate="'required'" class="control" id="taxrates" name="taxrates[]" value="{{ old('taxrates') }}">
|
||||
@foreach($taxRates as $taxRate)
|
||||
|
|
@ -1,20 +1,20 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.configuration.taxrate.title') }}
|
||||
{{ __('admin::app.configuration.tax-categories.title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<form method="POST" action="{{ route('admin.taxrule.update', $data[0][0]['id']) }}" @submit.prevent="onSubmit">
|
||||
<form method="POST" action="{{ route('admin.tax-categories.update', $data[0][0]['id']) }}" @submit.prevent="onSubmit">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.configuration.taxrule.edit.title') }}</h1>
|
||||
<h1>{{ __('admin::app.configuration.tax-categories.edit.title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.configuration.taxrule.edit.edit-button-title') }}
|
||||
{{ __('admin::app.configuration.tax-categories.edit.edit-button-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -23,11 +23,11 @@
|
|||
<div class="form-container">
|
||||
@csrf()
|
||||
@method('PUT')
|
||||
<accordian :title="'{{ __('admin::app.configuration.taxrule.general') }}'" :active="true">
|
||||
<accordian :title="'{{ __('admin::app.configuration.tax-categories.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<div class="control-group" :class="[errors.has('channel') ? 'has-error' : '']">
|
||||
<label for="channel" class="required">{{ __('admin::app.configuration.taxrule.select-channel') }}</label>
|
||||
<label for="channel" class="required">{{ __('admin::app.configuration.tax-categories.select-channel') }}</label>
|
||||
|
||||
<select class="control" name="channel">
|
||||
@foreach(core()->getAllChannels() as $channelModel)
|
||||
|
|
@ -43,7 +43,7 @@
|
|||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
|
||||
<label for="code" class="required">{{ __('admin::app.configuration.taxrule.code') }}</label>
|
||||
<label for="code" class="required">{{ __('admin::app.configuration.tax-categories.code') }}</label>
|
||||
|
||||
<input v-validate="'required'" class="control" id="code" name="code" value="{{ $data[0][0]['code'] }}"/>
|
||||
|
||||
|
|
@ -51,7 +51,7 @@
|
|||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
||||
<label for="name" class="required">{{ __('admin::app.configuration.taxrule.name') }}</label>
|
||||
<label for="name" class="required">{{ __('admin::app.configuration.tax-categories.name') }}</label>
|
||||
|
||||
<input v-validate="'required'" class="control" id="name" name="name" value="{{ $data[0][0]['name'] }}"/>
|
||||
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('description') ? 'has-error' : '']">
|
||||
<label for="description" class="required">{{ __('admin::app.configuration.taxrule.description') }}</label>
|
||||
<label for="description" class="required">{{ __('admin::app.configuration.tax-categories.description') }}</label>
|
||||
|
||||
<textarea v-validate="'required'" class="control" id="description" name="description">{{ $data[0][0]['description'] }}</textarea>
|
||||
|
||||
|
|
@ -67,7 +67,7 @@
|
|||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('taxrates') ? 'has-error' : '']">
|
||||
<label for="taxrates" class="required">{{ __('admin::app.configuration.taxrule.select-taxrates') }}</label>
|
||||
<label for="taxrates" class="required">{{ __('admin::app.configuration.tax-categories.select-taxrates') }}</label>
|
||||
|
||||
@inject('taxRates', 'Webkul\Core\Repositories\TaxRatesRepository')
|
||||
|
||||
|
|
@ -8,15 +8,15 @@
|
|||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<a href="{{ route('admin.taxrule.show') }}" class="btn btn-lg btn-primary">
|
||||
<a href="{{ route('admin.tax-categories.show') }}" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.configuration.tax.add-title') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
@inject('taxrule','Webkul\Admin\DataGrids\TaxRuleDataGrid')
|
||||
{!! $taxrule->render() !!}
|
||||
@inject('taxCategories','Webkul\Admin\DataGrids\TaxRuleDataGrid')
|
||||
{!! $taxCategories->render() !!}
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.configuration.tax-rates.title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<form method="POST" action="{{ route('admin.tax-rates.create') }}" @submit.prevent="onSubmit">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.configuration.tax-rates.title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.configuration.tax-categories.create') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
<div class="form-container">
|
||||
@csrf()
|
||||
|
||||
<div class="control-group" :class="[errors.has('identifier') ? 'has-error' : '']">
|
||||
<label for="identifier" class="required">{{ __('admin::app.configuration.tax-rates.identifier') }}</label>
|
||||
|
||||
<input v-validate="'required'" class="control" id="identifier" name="identifier" value="{{ old('identifier') }}"/>
|
||||
|
||||
<span class="control-error" v-if="errors.has('identifier')">@{{ errors.first('identifier') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('state') ? 'has-error' : '']">
|
||||
<label for="state" class="required">{{ __('admin::app.configuration.tax-rates.state') }}</label>
|
||||
|
||||
<input v-validate="'required'" class="control" id="state" name="state" value="{{ old('state') }}"/>
|
||||
|
||||
<span class="control-error" v-if="errors.has('state')">@{{ errors.first('state') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('country') ? 'has-error' : '']">
|
||||
<label for="country" class="required">{{ __('admin::app.configuration.tax-rates.country') }}</label>
|
||||
|
||||
<input v-validate="'required'" class="control" id="country" name="country" value="{{ old('country') }}"/>
|
||||
|
||||
<span class="control-error" v-if="errors.has('country')">@{{ errors.first('country') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<span class="checkbox">
|
||||
|
||||
<input type="checkbox" id="is_zip" name="is_zip" onclick="myFunction()">
|
||||
|
||||
<label class="checkbox-view" for="is_zip"></label>
|
||||
Enable Zip Range
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('zip_code') ? 'has-error' : '']" id="zip_code">
|
||||
<label for="zip_code">{{ __('admin::app.configuration.tax-rates.zip_code') }}</label>
|
||||
|
||||
<input class="control" id="zip_code" name="zip_code" value="{{ old('zip_code') }}"/>
|
||||
|
||||
<span class="control-error" v-if="errors.has('zip_code')">@{{ errors.first('zip_code') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('zip_from') ? 'has-error' : '']" id="zip_from">
|
||||
<label for="zip_from">{{ __('admin::app.configuration.tax-rates.zip_from') }}</label>
|
||||
|
||||
<input v-validate="'numeric'" class="control" name="zip_from" value="{{ old('zip_from') }}"/>
|
||||
|
||||
<span class="control-error" v-if="errors.has('zip_from')">@{{ errors.first('zip_from') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('zip_to') ? 'has-error' : '']" id="zip_to">
|
||||
<label for="zip_to">{{ __('admin::app.configuration.tax-rates.zip_to') }}</label>
|
||||
|
||||
<input v-validate="'numeric'" class="control" name="zip_to" value="{{ old('zip_to') }}"/>
|
||||
|
||||
<span class="control-error" v-if="errors.has('zip_to')">@{{ errors.first('zip_to') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('tax_rate') ? 'has-error' : '']">
|
||||
<label for="tax_rate" class="required">{{ __('admin::app.configuration.tax-rates.tax_rate') }}</label>
|
||||
|
||||
<input v-validate="'required'" class="control" id="tax_rate" name="tax_rate" value="{{ old('tax_rate') }}"/>
|
||||
|
||||
<span class="control-error" v-if="errors.has('tax_rate')">@{{ errors.first('tax_rate') }}</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@push('scripts')
|
||||
<script>
|
||||
|
||||
window.onload = function () {
|
||||
document.getElementById("zip_from").style.display = "none";
|
||||
|
||||
document.getElementById("zip_to").style.display = "none";
|
||||
};
|
||||
|
||||
function myFunction() {
|
||||
value = document.getElementById('is_zip').checked;
|
||||
|
||||
// console.log(value);
|
||||
|
||||
if(value) {
|
||||
document.getElementById("zip_from").style.display = "";
|
||||
|
||||
document.getElementById("zip_to").style.display = "";
|
||||
|
||||
document.getElementById("zip_code").style.display = "none";
|
||||
} else {
|
||||
document.getElementById("zip_from").style.display = "none";
|
||||
|
||||
document.getElementById("zip_to").style.display = "none";
|
||||
|
||||
document.getElementById("zip_code").style.display = "";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@stop
|
||||
|
|
@ -1,20 +1,20 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.configuration.taxrate.title') }}
|
||||
{{ __('admin::app.configuration.tax-rates.title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<form method="POST" action="{{ route('admin.taxrate.update', $data['id']) }}" @submit.prevent="onSubmit">
|
||||
<form method="POST" action="{{ route('admin.tax-rates.update', $data['id']) }}" @submit.prevent="onSubmit">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.configuration.taxrate.edit.title') }}</h1>
|
||||
<h1>{{ __('admin::app.configuration.tax-rates.edit.title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.configuration.taxrate.edit.edit-button-title') }}
|
||||
{{ __('admin::app.configuration.tax-rates.edit.edit-button-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -23,11 +23,11 @@
|
|||
<div class="form-container">
|
||||
@method('PUT')
|
||||
@csrf()
|
||||
<accordian :title="'{{ __('admin::app.configuration.taxrate.general') }}'" :active="true">
|
||||
<accordian :title="'{{ __('admin::app.configuration.tax-rates.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<div class="control-group" :class="[errors.has('identifier') ? 'has-error' : '']">
|
||||
<label for="identifier" class="required">{{ __('admin::app.configuration.taxrate.identifier') }}</label>
|
||||
<label for="identifier" class="required">{{ __('admin::app.configuration.tax-rates.identifier') }}</label>
|
||||
|
||||
<input v-validate="'required'" class="control" id="identifier" name="identifier" value="{{ $data['identifier'] }}"/>
|
||||
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('zip_from') ? 'has-error' : '']">
|
||||
<label for="zip_from" class="required">{{ __('admin::app.configuration.taxrate.zip_from') }}</label>
|
||||
<label for="zip_from" class="required">{{ __('admin::app.configuration.tax-rates.zip_from') }}</label>
|
||||
|
||||
<input v-validate="'numeric'" class="control" id="zip_from" name="zip_from" value="{{ $data['zip_from'] }}" />
|
||||
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('zip_to') ? 'has-error' : '']">
|
||||
<label for="zip_to" class="required">{{ __('admin::app.configuration.taxrate.zip_to') }}</label>
|
||||
<label for="zip_to" class="required">{{ __('admin::app.configuration.tax-rates.zip_to') }}</label>
|
||||
|
||||
<input v-validate="'numeric'" class="control" id="zip_to" name="zip_to" value="{{ $data['zip_to'] }}" />
|
||||
|
||||
|
|
@ -61,7 +61,7 @@
|
|||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('state') ? 'has-error' : '']">
|
||||
<label for="state" class="required">{{ __('admin::app.configuration.taxrate.state') }}</label>
|
||||
<label for="state" class="required">{{ __('admin::app.configuration.tax-rates.state') }}</label>
|
||||
|
||||
<input v-validate="'required'" class="control" id="state" name="state" value="{{ $data['state'] }}" />
|
||||
|
||||
|
|
@ -69,7 +69,7 @@
|
|||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('country') ? 'has-error' : '']">
|
||||
<label for="country" class="required">{{ __('admin::app.configuration.taxrate.country') }}</label>
|
||||
<label for="country" class="required">{{ __('admin::app.configuration.tax-rates.country') }}</label>
|
||||
|
||||
<input v-validate="'required'" class="control" id="country" name="country" value="{{ $data['country'] }}" />
|
||||
|
||||
|
|
@ -77,7 +77,7 @@
|
|||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('tax_rate') ? 'has-error' : '']">
|
||||
<label for="tax_rate" class="required">{{ __('admin::app.configuration.taxrate.tax_rate') }}</label>
|
||||
<label for="tax_rate" class="required">{{ __('admin::app.configuration.tax-rates.tax_rate') }}</label>
|
||||
|
||||
<input v-validate="'required'" class="control" id="tax_rate" name="tax_rate" value="{{ $data['tax_rate'] }}" />
|
||||
|
||||
|
|
@ -1,19 +1,19 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.configuration.taxrate.title') }}
|
||||
{{ __('admin::app.configuration.tax-rates.title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.configuration.taxrate.title') }}</h1>
|
||||
<h1>{{ __('admin::app.configuration.tax-rates.title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<a href="{{ route('admin.taxrate.show') }}" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.configuration.taxrate.title') }}
|
||||
<a href="{{ route('admin.tax-rates.show') }}" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.configuration.tax-rates.title') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,126 +0,0 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.configuration.taxrate.title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<form method="POST" action="{{ route('admin.taxrate.create') }}" @submit.prevent="onSubmit">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.configuration.taxrate.title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.configuration.taxrule.create') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
<div class="form-container">
|
||||
@csrf()
|
||||
|
||||
<div class="control-group" :class="[errors.has('identifier') ? 'has-error' : '']">
|
||||
<label for="identifier" class="required">{{ __('admin::app.configuration.taxrate.identifier') }}</label>
|
||||
|
||||
<input v-validate="'required'" class="control" id="identifier" name="identifier" value="{{ old('identifier') }}"/>
|
||||
|
||||
<span class="control-error" v-if="errors.has('identifier')">@{{ errors.first('identifier') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('state') ? 'has-error' : '']">
|
||||
<label for="state" class="required">{{ __('admin::app.configuration.taxrate.state') }}</label>
|
||||
|
||||
<input v-validate="'required'" class="control" id="state" name="state" value="{{ old('state') }}"/>
|
||||
|
||||
<span class="control-error" v-if="errors.has('state')">@{{ errors.first('state') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('country') ? 'has-error' : '']">
|
||||
<label for="country" class="required">{{ __('admin::app.configuration.taxrate.country') }}</label>
|
||||
|
||||
<input v-validate="'required'" class="control" id="country" name="country" value="{{ old('country') }}"/>
|
||||
|
||||
<span class="control-error" v-if="errors.has('country')">@{{ errors.first('country') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<span class="checkbox">
|
||||
|
||||
<input type="checkbox" id="is_zip" name="is_zip" onclick="myFunction()">
|
||||
|
||||
<label class="checkbox-view" for="is_zip"></label>
|
||||
Enable Zip Range
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('zip_code') ? 'has-error' : '']" id="zip_code">
|
||||
<label for="zip_code">{{ __('admin::app.configuration.taxrate.zip_code') }}</label>
|
||||
|
||||
<input class="control" id="zip_code" name="zip_code" value="{{ old('zip_code') }}"/>
|
||||
|
||||
<span class="control-error" v-if="errors.has('zip_code')">@{{ errors.first('zip_code') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('zip_from') ? 'has-error' : '']" id="zip_from">
|
||||
<label for="zip_from">{{ __('admin::app.configuration.taxrate.zip_from') }}</label>
|
||||
|
||||
<input v-validate="'numeric'" class="control" name="zip_from" value="{{ old('zip_from') }}"/>
|
||||
|
||||
<span class="control-error" v-if="errors.has('zip_from')">@{{ errors.first('zip_from') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('zip_to') ? 'has-error' : '']" id="zip_to">
|
||||
<label for="zip_to">{{ __('admin::app.configuration.taxrate.zip_to') }}</label>
|
||||
|
||||
<input v-validate="'numeric'" class="control" name="zip_to" value="{{ old('zip_to') }}"/>
|
||||
|
||||
<span class="control-error" v-if="errors.has('zip_to')">@{{ errors.first('zip_to') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('tax_rate') ? 'has-error' : '']">
|
||||
<label for="tax_rate" class="required">{{ __('admin::app.configuration.taxrate.tax_rate') }}</label>
|
||||
|
||||
<input v-validate="'required'" class="control" id="tax_rate" name="tax_rate" value="{{ old('tax_rate') }}"/>
|
||||
|
||||
<span class="control-error" v-if="errors.has('tax_rate')">@{{ errors.first('tax_rate') }}</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@push('scripts')
|
||||
<script>
|
||||
|
||||
window.onload = function () {
|
||||
document.getElementById("zip_from").style.display = "none";
|
||||
|
||||
document.getElementById("zip_to").style.display = "none";
|
||||
};
|
||||
|
||||
function myFunction() {
|
||||
value = document.getElementById('is_zip').checked;
|
||||
|
||||
// console.log(value);
|
||||
|
||||
if(value) {
|
||||
document.getElementById("zip_from").style.display = "";
|
||||
|
||||
document.getElementById("zip_to").style.display = "";
|
||||
|
||||
document.getElementById("zip_code").style.display = "none";
|
||||
} else {
|
||||
document.getElementById("zip_from").style.display = "none";
|
||||
|
||||
document.getElementById("zip_to").style.display = "none";
|
||||
|
||||
document.getElementById("zip_code").style.display = "";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@stop
|
||||
|
|
@ -153,7 +153,7 @@ class Cart {
|
|||
|
||||
$itemData = $this->prepareItemData($id, $data);
|
||||
|
||||
if($itemData == false) {
|
||||
if(!$itemData) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,9 @@ use Webkul\Core\Models\TaxCategory as TaxCategory;
|
|||
use Webkul\Core\Models\TaxRate as TaxRate;
|
||||
use Webkul\Core\Repositories\CurrencyRepository;
|
||||
use Webkul\Core\Repositories\ExchangeRateRepository;
|
||||
use Webkul\Core\Repositories\CountryRepository;
|
||||
use Webkul\Core\Repositories\CountryStateRepository;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use PragmaRX\Countries\Package\Countries;
|
||||
|
||||
class Core
|
||||
{
|
||||
|
|
@ -29,21 +30,43 @@ class Core
|
|||
*/
|
||||
protected $exchangeRateRepository;
|
||||
|
||||
/**
|
||||
* CountryRepository model
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $countryRepository;
|
||||
|
||||
/**
|
||||
* CountryStateRepository model
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $countryStateRepository;
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
*
|
||||
* @param Webkul\Core\Repositories\CurrencyRepository $currencyRepository
|
||||
* @param Webkul\Core\Repositories\ExchangeRateRepository $exchangeRateRepository
|
||||
* @param Webkul\Core\Repositories\CountryRepository $countryRepository
|
||||
* @param Webkul\Core\Repositories\CountryStateRepository $countryStateRepository
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
CurrencyRepository $currencyRepository,
|
||||
ExchangeRateRepository $exchangeRateRepository
|
||||
ExchangeRateRepository $exchangeRateRepository,
|
||||
CountryRepository $countryRepository,
|
||||
CountryStateRepository $countryStateRepository
|
||||
)
|
||||
{
|
||||
$this->currencyRepository = $currencyRepository;
|
||||
|
||||
$this->exchangeRateRepository = $exchangeRateRepository;
|
||||
|
||||
$this->countryRepository = $countryRepository;
|
||||
|
||||
$this->countryStateRepository = $countryStateRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -451,9 +474,7 @@ class Core
|
|||
*/
|
||||
public function countries()
|
||||
{
|
||||
$countries = new Countries;
|
||||
|
||||
return $countries->all()->pluck('name.common', 'cca2');
|
||||
return $this->countryRepository->all();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -463,14 +484,7 @@ class Core
|
|||
*/
|
||||
public function states($countryCode)
|
||||
{
|
||||
$countries = new Countries;
|
||||
|
||||
return $countries->where('cca2', $countryCode)
|
||||
->first()
|
||||
->hydrateStates()
|
||||
->states
|
||||
->sortBy('name')
|
||||
->pluck('name', 'postal');
|
||||
return $this->countryStateRepository->findByField('country_code', $countryCode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -482,8 +496,8 @@ class Core
|
|||
{
|
||||
$collection = [];
|
||||
|
||||
foreach ($this->countries() as $countryCode => $countryName) {
|
||||
$collection[$countryCode] = $this->states($countryCode)->toArray();
|
||||
foreach ($this->countries() as $country) {
|
||||
$collection[$country->code] = $this->states($country->code)->toArray();
|
||||
}
|
||||
|
||||
return $collection;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -17,8 +17,6 @@ class CreateCountriesTable extends Migration
|
|||
$table->increments('id');
|
||||
$table->string('code');
|
||||
$table->string('name');
|
||||
$table->boolean('status')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCountryTranslationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('country_translations', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('locale');
|
||||
$table->text('name')->nullable();
|
||||
|
||||
$table->integer('country_id')->unsigned();
|
||||
$table->foreign('country_id')->references('id')->on('countries')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('country_translations');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCountryStatesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('country_states', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('country_code')->nullable();
|
||||
$table->string('code')->nullable();
|
||||
$table->string('default_name')->nullable();
|
||||
|
||||
$table->integer('country_id')->nullable()->unsigned();
|
||||
$table->foreign('country_id')->references('id')->on('countries')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('country_states');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCountryStateTranslationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('country_state_translations', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('locale');
|
||||
$table->text('name')->nullable();
|
||||
|
||||
$table->integer('country_state_id')->unsigned();
|
||||
$table->foreign('country_state_id')->references('id')->on('country_states')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('country_state_translations');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use DB;
|
||||
|
||||
class CountriesTableSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
DB::table('countries')->delete();
|
||||
|
||||
$countries = json_decode(file_get_contents(__DIR__ . '/../../Data/countries.json'), true);
|
||||
|
||||
DB::table('countries')->insert($countries);
|
||||
}
|
||||
}
|
||||
|
|
@ -3,16 +3,18 @@
|
|||
namespace Webkul\Core\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Webkul\Core\Models\Currency;
|
||||
use DB;
|
||||
|
||||
class CurrencyTableSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$currency = new Currency();
|
||||
$locale->code = 'USD';
|
||||
$locale->name = 'US Dollar';
|
||||
$locale->symbol = '$';
|
||||
$locale->save();
|
||||
DB::table('currencies')->delete();
|
||||
|
||||
DB::table('currencies')->insert([
|
||||
'code' => 'USD',
|
||||
'name' => 'US Dollar',
|
||||
'symbol' => '$',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -14,5 +14,8 @@ class DatabaseSeeder extends Seeder
|
|||
public function run()
|
||||
{
|
||||
$this->call(LocalesTableSeeder::class);
|
||||
$this->call(LocalesTableSeeder::class);
|
||||
$this->call(CountriesTableSeeder::class);
|
||||
$this->call(StatesTableSeeder::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,22 +3,20 @@
|
|||
namespace Webkul\Core\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Webkul\Core\Models\Locale;
|
||||
use DB;
|
||||
|
||||
class LocalesTableSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
\Illuminate\Database\Eloquent\Model::reguard();
|
||||
|
||||
$locale = new Locale();
|
||||
$locale->code = 'en';
|
||||
$locale->name = 'English';
|
||||
$locale->save();
|
||||
DB::table('locales')->delete();
|
||||
|
||||
$locale = new Locale();
|
||||
$locale->code = 'fr';
|
||||
$locale->name = 'French';
|
||||
$locale->save();
|
||||
DB::table('locales')->insert([
|
||||
'code' => 'en',
|
||||
'name' => 'English',
|
||||
], [
|
||||
'code' => 'fr',
|
||||
'name' => 'French',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use DB;
|
||||
|
||||
class StatesTableSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
DB::table('country_states')->delete();
|
||||
|
||||
$states = json_decode(file_get_contents(__DIR__ . '/../../Data/states.json'), true);
|
||||
|
||||
DB::table('country_states')->insert($states);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Webkul\Core\Repositories\CountryRepository as Country;
|
||||
|
||||
/**
|
||||
* Country controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CountryController extends Controller
|
||||
{
|
||||
/**
|
||||
* Contains route related configuration
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* CountryRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $country;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param Webkul\Core\Repositories\CountryRepository $country
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Country $country)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
$this->country = $country;
|
||||
|
||||
$this->_config = request('_config');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'code' => 'required|unique:countries,code',
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
$this->country->create(request()->all());
|
||||
|
||||
session()->flash('success', 'Country created successfully.');
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
@ -6,12 +6,5 @@ use Illuminate\Database\Eloquent\Model;
|
|||
|
||||
class Country extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'code', 'name'
|
||||
];
|
||||
public $timestamps = false;
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CountryState extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Repositories;
|
||||
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
|
||||
/**
|
||||
* CountryState Reposotory
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CountryStateRepository extends Repository
|
||||
{
|
||||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function model()
|
||||
{
|
||||
return 'Webkul\Core\Models\CountryState';
|
||||
}
|
||||
}
|
||||
|
|
@ -6,7 +6,6 @@ use Illuminate\Http\Request;
|
|||
use Illuminate\Http\Response;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Webkul\Core\Repositories\SliderRepository as Sliders;
|
||||
use Webkul\Channel\Channel as Channel;
|
||||
|
||||
/**
|
||||
* Home page controller
|
||||
|
|
@ -28,7 +27,6 @@ use Webkul\Channel\Channel as Channel;
|
|||
|
||||
}
|
||||
public function index() {
|
||||
|
||||
$current_channel = core()->getCurrentChannel();
|
||||
|
||||
$all_sliders = $this->sliders->findWhere(['channel_id'=>$current_channel['id']]);
|
||||
|
|
|
|||
|
|
@ -187,6 +187,7 @@ return [
|
|||
'address2' => 'Address 2',
|
||||
'city' => 'City',
|
||||
'state' => 'State',
|
||||
'select-state' => 'Select a region, state or province.',
|
||||
'postcode' => 'Zip/Postcode',
|
||||
'phone' => 'Telephone',
|
||||
'country' => 'Country',
|
||||
|
|
|
|||
|
|
@ -142,6 +142,8 @@
|
|||
selected_payment_method: '',
|
||||
|
||||
disable_button: false,
|
||||
|
||||
countryStates: @json(core()->groupedStatesByCountries())
|
||||
}),
|
||||
|
||||
methods: {
|
||||
|
|
@ -152,6 +154,13 @@
|
|||
}
|
||||
},
|
||||
|
||||
haveStates(addressType) {
|
||||
if(this.countryStates[this.address[addressType].country] && this.countryStates[this.address[addressType].country].length)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
validateForm: function (scope) {
|
||||
this.$validator.validateAll(scope).then((result) => {
|
||||
if(result) {
|
||||
|
|
|
|||
|
|
@ -85,7 +85,18 @@
|
|||
{{ __('shop::app.checkout.onepage.state') }}
|
||||
</label>
|
||||
|
||||
<input type="text" v-validate="'required'" class="control" id="billing[state]" name="billing[state]" v-model="address.billing.state"/>
|
||||
|
||||
<input type="text" v-validate="'required'" class="control" id="billing[state]" name="billing[state]" v-model="address.billing.state" v-if="!haveStates('billing')"/>
|
||||
|
||||
<select v-validate="'required'" class="control" id="billing[state]" name="billing[state]" v-model="address.billing.state" v-if="haveStates('billing')">
|
||||
|
||||
<option value="">{{ __('shop::app.checkout.onepage.select-state') }}</option>
|
||||
|
||||
<option v-for='(state, index) in countryStates[address.billing.country]' value="state.code">
|
||||
@{{ state.default_name }}
|
||||
</option>
|
||||
|
||||
</select>
|
||||
|
||||
<span class="control-error" v-if="errors.has('address-form.billing[state]')">
|
||||
@{{ errors.first('address-form.billing[state]') }}
|
||||
|
|
@ -104,6 +115,26 @@
|
|||
</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('address-form.billing[country]') ? 'has-error' : '']">
|
||||
<label for="billing[country]" class="required">
|
||||
{{ __('shop::app.checkout.onepage.country') }}
|
||||
</label>
|
||||
|
||||
<select type="text" v-validate="'required'" class="control" id="billing[country]" name="billing[country]" v-model="address.billing.country">
|
||||
<option value=""></option>
|
||||
|
||||
@foreach (core()->countries() as $country)
|
||||
|
||||
<option value="{{ $country->code }}">{{ $country->name }}</option>
|
||||
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
<span class="control-error" v-if="errors.has('address-form.billing[country]')">
|
||||
@{{ errors.first('address-form.billing[country]') }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('address-form.billing[phone]') ? 'has-error' : '']">
|
||||
<label for="billing[phone]" class="required">
|
||||
{{ __('shop::app.checkout.onepage.phone') }}
|
||||
|
|
@ -116,26 +147,6 @@
|
|||
</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('address-form.billing[country]') ? 'has-error' : '']">
|
||||
<label for="billing[country]" class="required">
|
||||
{{ __('shop::app.checkout.onepage.country') }}
|
||||
</label>
|
||||
|
||||
<select type="text" v-validate="'required'" class="control" id="billing[country]" name="billing[country]" v-model="address.billing.country">
|
||||
<option value=""></option>
|
||||
|
||||
@foreach (core()->countries() as $code => $country)
|
||||
|
||||
<option value="{{ $code }}">{{ $country }}</option>
|
||||
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
<span class="control-error" v-if="errors.has('address-form.billing[country]')">
|
||||
@{{ errors.first('address-form.billing[country]') }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<span class="checkbox">
|
||||
<input type="checkbox" id="billing[use_for_shipping]" name="billing[use_for_shipping]" v-model="address.billing.use_for_shipping"/>
|
||||
|
|
@ -225,7 +236,18 @@
|
|||
{{ __('shop::app.checkout.onepage.state') }}
|
||||
</label>
|
||||
|
||||
<input type="text" v-validate="'required'" class="control" id="shipping[state]" name="shipping[state]" v-model="address.shipping.state"/>
|
||||
|
||||
<input type="text" v-validate="'required'" class="control" id="shipping[state]" name="shipping[state]" v-model="address.shipping.state" v-if="!haveStates('shipping')"/>
|
||||
|
||||
<select v-validate="'required'" class="control" id="shipping[state]" name="shipping[state]" v-model="address.shipping.state" v-if="haveStates('shipping')">
|
||||
|
||||
<option value="">{{ __('shop::app.checkout.onepage.select-state') }}</option>
|
||||
|
||||
<option v-for='(state, index) in countryStates[address.shipping.country]' value="state.code">
|
||||
@{{ state.default_name }}
|
||||
</option>
|
||||
|
||||
</select>
|
||||
|
||||
<span class="control-error" v-if="errors.has('address-form.shipping[state]')">
|
||||
@{{ errors.first('address-form.shipping[state]') }}
|
||||
|
|
@ -244,6 +266,26 @@
|
|||
</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('address-form.shipping[country]') ? 'has-error' : '']">
|
||||
<label for="shipping[country]" class="required">
|
||||
{{ __('shop::app.checkout.onepage.country') }}
|
||||
</label>
|
||||
|
||||
<select type="text" v-validate="'required'" class="control" id="shipping[country]" name="shipping[country]" v-model="address.shipping.country">
|
||||
<option value=""></option>
|
||||
|
||||
@foreach (core()->countries() as $country)
|
||||
|
||||
<option value="{{ $country->code }}">{{ $country->name }}</option>
|
||||
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
<span class="control-error" v-if="errors.has('address-form.shipping[country]')">
|
||||
@{{ errors.first('address-form.shipping[country]') }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('address-form.shipping[phone]') ? 'has-error' : '']">
|
||||
<label for="shipping[phone]" class="required">
|
||||
{{ __('shop::app.checkout.onepage.phone') }}
|
||||
|
|
@ -255,26 +297,6 @@
|
|||
@{{ errors.first('address-form.shipping[phone]') }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('address-form.shipping[country]') ? 'has-error' : '']">
|
||||
<label for="shipping[country]" class="required">
|
||||
{{ __('shop::app.checkout.onepage.country') }}
|
||||
</label>
|
||||
|
||||
<select type="text" v-validate="'required'" class="control" id="shipping[country]" name="shipping[country]" v-model="address.shipping.country">
|
||||
<option value=""></option>
|
||||
|
||||
@foreach (core()->countries() as $code => $country)
|
||||
|
||||
<option value="{{ $code }}">{{ $country }}</option>
|
||||
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
<span class="control-error" v-if="errors.has('address-form.shipping[country]')">
|
||||
@{{ errors.first('address-form.shipping[country]') }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
|
@ -15,15 +15,6 @@ class TaxServiceProvider extends ServiceProvider
|
|||
public function boot(Router $router)
|
||||
{
|
||||
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
|
||||
|
||||
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'core');
|
||||
|
||||
$router->aliasMiddleware('locale', Locale::class);
|
||||
|
||||
$router->aliasMiddleware('admin', RedirectIfNotAdmin::class);
|
||||
|
||||
$router->aliasMiddleware('customer', RedirectIfNotCustomer::class);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -34,18 +25,4 @@ class TaxServiceProvider extends ServiceProvider
|
|||
public function register()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* Register Bouncer as a singleton.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerFacades()
|
||||
{
|
||||
// $loader = AliasLoader::getInstance();
|
||||
// $loader->alias('core', CoreFacade::class);
|
||||
|
||||
// $this->app->singleton('core', function () {
|
||||
// return app()->make(Core::class);
|
||||
// });
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue