Merge branch 'master' of https://github.com/bagisto/bagisto into development

This commit is contained in:
Prashant Singh 2019-01-11 16:56:10 +05:30
commit 6d203fd8f6
32 changed files with 241 additions and 7708 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/js/admin.js": "/js/admin.js?id=c70dacdf945a32e04b77",
"/css/admin.css": "/css/admin.css?id=d40a640933cbcc121f1d"
"/css/admin.css": "/css/admin.css?id=3e790c2215bf5c60ac21"
}

View File

@ -159,6 +159,7 @@ class ShipmentController extends Controller
$inventory = $product->inventories()
->where('inventory_source_id', $data['shipment']['source'])
->where('vendor_id', 0)
->first();
if ($orderItem->qty_to_ship < $qty || $inventory->qty < $qty) {

View File

@ -575,6 +575,7 @@ return [
'country' => 'Country',
'male' => 'Male',
'female' => 'Female',
'phone' => 'Phone',
'created' => 'Customer created successfully.',
'updated' => 'Customer updated successfully.',
'deleted' => 'Customer deleted successfully.',

View File

@ -7,7 +7,7 @@
$qty = 0;
foreach ($product->inventories as $inventory) {
if($inventory->inventory_source_id == $inventorySource->id) {
if($inventory->inventory_source_id == $inventorySource->id && !$inventory->vendor_id) {
$qty = $inventory->qty;
break;
}

View File

@ -14,7 +14,7 @@
}
.table td.actions .icon.pencil-lg-icon {
margin-right: 10px;
}
}
</style>
@stop
@ -46,7 +46,7 @@
<div class="page-content">
<div class="form-container">
<div v-for='(attribute, index) in super_attributes' class="control-group" :class="[errors.has('add-variant-form.' + attribute.code) ? 'has-error' : '']">
<label :for="attribute.code" class="required">@{{ attribute.admin_name }}</label>
<select v-validate="'required'" v-model="variant[attribute.code]" class="control" :id="attribute.code" :name="attribute.code" :data-vv-as="'&quot;' + attribute.admin_name + '&quot;'">
@ -148,7 +148,7 @@
</td>
<td>
<div class="control-group" :class="[errors.has(variantInputName + '[price]') ? 'has-error' : '']">
<div class="control-group" :class="[errors.has(variantInputName + '[weight]') ? 'has-error' : '']">
<input type="text" v-validate="'required'" v-model="variant.weight" :name="[variantInputName + '[weight]']" class="control" data-vv-as="&quot;{{ __('admin::app.catalog.products.weight') }}&quot;"/>
<span class="control-error" v-if="errors.has(variantInputName + '[weight]')">@{{ errors.first(variantInputName + '[weight]') }}</span>
</div>
@ -232,7 +232,7 @@
weight: 0,
status: 1
}, this.variant));
this.resetModel();
this.$parent.closeModal();
@ -252,7 +252,7 @@
});
Vue.component('variant-list', {
template: '#variant-list-template',
inject: ['$validator'],
@ -325,13 +325,13 @@
sourceInventoryQty (inventorySourceId) {
var inventories = this.variant.inventories.filter(function(inventory) {
return inventorySourceId === inventory.inventory_source_id;
return inventorySourceId === inventory.inventory_source_id && !inventory.vendor_id;
})
if(inventories.length)
return inventories[0]['qty'];
return 0;
return 0;
},
updateTotalQty () {

View File

@ -62,7 +62,7 @@
@if (isset($field['repository']))
@foreach($value as $option)
<option value="{{ $option['name'] }}" {{ $option['name'] == $selectedOption ? 'selected' : ''}}
<option value="{{ $option['name'] }}" {{ $option['name'] == $selectedOption ? 'selected' : ''}}
{{ $option['name'] }}
</option>
@endforeach
@ -90,48 +90,41 @@
<select v-validate="'{{ $validations }}'" class="control" id="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}][]" data-vv-as="&quot;{{ $field['name'] }}&quot;" multiple>
@if (isset($field['repository']))
@foreach($value as $option)
<option value="{{ $option['name'] }}" {{ in_array($option['name'], explode(',', $selectedOption)) ? 'selected' : ''}}>
{{ $option['name'] }}
</option>
@endforeach
@else
@foreach($field['options'] as $option)
@foreach($field['options'] as $option)
<?php
if($option['value'] == false) {
$value = 0;
} else {
$value = $option['value'];
}
<?php
if($option['value'] == false) {
$value = 0;
} else {
$value = $option['value'];
}
$selectedOption = core()->getConfigData($name) ?? '';
?>
$selectedOption = core()->getConfigData($name) ?? '';
?>
<option value="{{ $value }}" {{ $value == $selectedOption ? 'selected' : ''}}>
{{ $option['title'] }}
</option>
<option value="{{ $value }}" {{ in_array($option['value'], explode(',', $selectedOption)) ? 'selected' : ''}}>
{{ $option['title'] }}
</option>
@endforeach
@endif
@endforeach
</select>
@elseif ($field['type'] == 'country')
<select type="text" v-validate="'required'" class="control" id="country" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" data-vv-as="&quot;{{ __('admin::app.customers.customers.country') }}&quot;" onchange="myFunction()">
<option value=""></option>
<?php
$countryCode = core()->getConfigData($name) ?? '';
?>
@foreach (core()->countries() as $country)
<country code = {{ $countryCode }}></country>
<option value="{{ $country->code }}">
{{ $country->name }}
</option>
@elseif ($field['type'] == 'state')
@endforeach
</select>
<?php
$stateCode = core()->getConfigData($name) ?? '';
?>
<state code = {{ $stateCode }}></state>
@endif
@ -140,30 +133,107 @@
</div>
@push('scripts')
<script type="text/x-template" id="country-template">
<div>
<select type="text" v-validate="'required'" class="control" id="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" v-model="country" data-vv-as="&quot;{{ __('admin::app.customers.customers.country') }}&quot;" @change="someHandler">
<option value=""></option>
@foreach (core()->countries() as $country)
<option value="{{ $country->code }}">{{ $country->name }}</option>
@endforeach
</select>
</div>
</script>
<script>
Vue.component('country', {
function myFunction() {
var countryId = document.getElementById("country").value;
var countryStates = <?php echo json_encode(core()->groupedStatesByCountries()) ;?>;
template: '#country-template',
for (var key in countryStates) {
if(key == countryId){
inject: ['$validator'],
props: ['code'],
for(state in countryStates[key]) {
console.log(state);
}
}
data: () => ({
country: "",
}),
mounted() {
this.country = this.code;
this.someHandler()
},
methods: {
someHandler() {
this.$root.$emit('sendCountryCode', this.country)
},
}
});
</script>
}
<script type="text/x-template" id="state-template">
<div>
<input type="text" v-validate="'required'" v-if="!haveStates()" class="control" v-model="state" id="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][state]" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][state]" data-vv-as="&quot;{{ __('admin::app.customers.customers.state') }}&quot;"/>
<select v-validate="'required'" v-if="haveStates()" class="control" v-model="state" id="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][state]" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][state]" data-vv-as="&quot;{{ __('admin::app.customers.customers.state') }}&quot;" >
<option value="">{{ __('admin::app.customers.customers.select-state') }}</option>
<option v-for='(state, index) in countryStates[country]' :value="state.code">
@{{ state.default_name }}
</option>
</select>
</div>
</script>
<script>
Vue.component('state', {
template: '#state-template',
inject: ['$validator'],
props: ['code'],
data: () => ({
state: "",
country: "",
countryStates: @json(core()->groupedStatesByCountries())
}),
mounted() {
this.state = this.code
},
methods: {
haveStates() {
this.$root.$on('sendCountryCode', (country) => {
this.country = country;
})
if(this.countryStates[this.country] && this.countryStates[this.country].length)
return true;
return false;
},
}
});
</script>
@endpush

View File

@ -67,7 +67,7 @@
haveStates() {
if(this.countryStates[this.country] && this.countryStates[this.country].length)
return true;
return false;
},
}

View File

@ -62,6 +62,12 @@
<span class="control-error" v-if="errors.has('date_of_birth')">@{{ errors.first('date_of_birth') }}</span>
</div>
<div class="control-group" :class="[errors.has('phone') ? 'has-error' : '']">
<label for="phone">{{ __('admin::app.customers.customers.phone') }}</label>
<input type="text" class="control" name="phone" v-validate="'numeric|max:10'" value="{{ old('phone') }}" data-vv-as="&quot;{{ __('admin::app.customers.customers.phone') }}&quot;">
<span class="control-error" v-if="errors.has('phone')">@{{ errors.first('phone') }}</span>
</div>
<div class="control-group">
<label for="customerGroup" >{{ __('admin::app.customers.customers.customer_group') }}</label>
<select class="control" name="customer_group_id">

View File

@ -34,19 +34,20 @@
<div class="control-group" :class="[errors.has('first_name') ? 'has-error' : '']">
<label for="first_name" class="required"> {{ __('admin::app.customers.customers.first_name') }}</label>
<input type="text" class="control" name="first_name" v-validate="'required'" value="{{$customer->first_name}}" data-vv-as="&quot;{{ __('shop::app.customers.customers.first_name') }}&quot;"/>
<input type="text" class="control" name="first_name" v-validate="'required'" value="{{$customer->first_name}}"
data-vv-as="&quot;{{ __('shop::app.customer.signup-form.firstname') }}&quot;"/>
<span class="control-error" v-if="errors.has('first_name')">@{{ errors.first('first_name') }}</span>
</div>
<div class="control-group" :class="[errors.has('last_name') ? 'has-error' : '']">
<label for="last_name" class="required"> {{ __('admin::app.customers.customers.last_name') }}</label>
<input type="text" class="control" name="last_name" v-validate="'required'" value="{{$customer->last_name}}" data-vv-as="&quot;{{ __('shop::app.customers.customers.last_name') }}&quot;"/>
<input type="text" class="control" name="last_name" v-validate="'required'" value="{{$customer->last_name}}" data-vv-as="&quot;{{ __('shop::app.customer.signup-form.lastname') }}&quot;">
<span class="control-error" v-if="errors.has('last_name')">@{{ errors.first('last_name') }}</span>
</div>
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
<label for="email" class="required"> {{ __('admin::app.customers.customers.email') }}</label>
<input type="email" class="control" name="email" v-validate="'required|email'" value="{{$customer->email}}" data-vv-as="&quot;{{ __('shop::app.customers.customers.email') }}&quot;"/>
<input type="email" class="control" name="email" v-validate="'required|email'" value="{{$customer->email}}" data-vv-as="&quot;{{ __('shop::app.customer.signup-form.email') }}&quot;">
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
</div>
@ -65,6 +66,12 @@
<span class="control-error" v-if="errors.has('date_of_birth')">@{{ errors.first('date_of_birth') }}</span>
</div>
<div class="control-group" :class="[errors.has('phone') ? 'has-error' : '']">
<label for="phone">{{ __('admin::app.customers.customers.phone') }}</label>
<input type="text" class="control" name="phone" v-validate="'numeric|max:10'" value="{{ $customer->phone }}" data-vv-as="&quot;{{ __('admin::app.customers.customers.phone') }}&quot;">
<span class="control-error" v-if="errors.has('phone')">@{{ errors.first('phone') }}</span>
</div>
<div class="control-group">
<label for="customerGroup" >{{ __('admin::app.customers.customers.customer_group') }}</label>

View File

@ -306,6 +306,19 @@
}
?>
<?php
$sourceQty = 0;
$product = $item->type == 'configurable' ? $item->child->product : $item->product;
foreach ($product->inventories as $inventory) {
if($inventory->inventory_source_id == $inventorySource->id && !$inventory->vendor_id) {
$sourceQty = $inventory->qty;
break;
}
}
?>
{{ $sourceQty }}
</td>

View File

@ -1,8 +1,8 @@
const { mix } = require("laravel-mix");
require("laravel-mix-merge-manifest");
// var publicPath = 'publishable/assets';
var publicPath = "../../../public/vendor/webkul/admin/assets";
var publicPath = 'publishable/assets';
// var publicPath = "../../../public/vendor/webkul/admin/assets";
mix.setPublicPath(publicPath).mergeManifest();
mix.disableNotifications();

View File

@ -695,7 +695,6 @@ class Core
foreach (config('core') as $coreData) {
if (isset($coreData['fields'])) {
foreach ($coreData['fields'] as $field) {
$name = $coreData['key'] . '.' . $field['name'];
if ($name == $fieldName ) {

View File

@ -99,6 +99,7 @@ class CustomerController extends Controller
'gender' => 'required',
'date_of_birth' => 'date|before:today',
'email' => 'email|unique:customers,email,'.$id,
'phone' => 'nullable|numeric|unique:customers,phone,'. $id,
'password' => 'confirmed'
]);

View File

@ -17,7 +17,7 @@ class Customer extends Authenticatable
protected $table = 'customers';
protected $fillable = ['first_name', 'channel_id', 'last_name', 'gender', 'date_of_birth', 'email', 'password', 'customer_group_id', 'subscribed_to_news_letter', 'is_verified', 'token'];
protected $fillable = ['first_name', 'channel_id', 'last_name', 'gender', 'date_of_birth', 'email', 'password', 'customer_group_id', 'subscribed_to_news_letter', 'is_verified', 'token', 'phone'];
protected $hidden = ['password', 'remember_token'];

View File

@ -35,9 +35,6 @@ return [
[
'title' => 'Pending',
'value' => 'pending'
], [
'title' => 'Approved',
'value' => 'Approved'
], [
'title' => 'Pending Payment',
'value' => 'pending_payment'
@ -86,9 +83,6 @@ return [
[
'title' => 'Pending',
'value' => 'pending'
], [
'title' => 'Approved',
'value' => 'Approved'
], [
'title' => 'Pending Payment',
'value' => 'pending_payment'
@ -137,9 +131,6 @@ return [
[
'title' => 'Pending',
'value' => 'pending'
], [
'title' => 'Approved',
'value' => 'Approved'
], [
'title' => 'Pending Payment',
'value' => 'pending_payment'

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddVendorIdColumnInProductInventoriesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('product_inventories', function (Blueprint $table) {
$table->integer('vendor_id')->default(0);
$table->unique(['product_id', 'inventory_source_id', 'vendor_id'], 'product_source_vendor_index_unique');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('product_inventories', function (Blueprint $table) {
//
});
}
}

View File

@ -163,10 +163,10 @@ class Product extends Model
*
* @return bool
*/
public function inventory_source_qty($inventorySource)
public function inventory_source_qty($inventorySourceId)
{
return $this->inventories()
->where('inventory_source_id', $inventorySource->id)
->where('inventory_source_id', $inventorySourceId)
->sum('qty');
}

View File

@ -9,7 +9,7 @@ class ProductInventory extends Model
{
public $timestamps = false;
protected $fillable = ['qty', 'product_id', 'inventory_source_id'];
protected $fillable = ['qty', 'product_id', 'inventory_source_id', 'vendor_id'];
/**
* Get the product attribute family that owns the product.

View File

@ -33,36 +33,32 @@ class ProductInventoryRepository extends Repository
if ($product->type == 'configurable')
return;
$inventorySourceIds = $product->inventory_sources->pluck('id');
if(isset($data['inventories'])) {
foreach($data['inventories'] as $inventorySourceId => $qty) {
if(is_null($qty))
continue;
if(is_null($qty)) {
$qty = 0;
}
$productInventory = $this->findOneWhere([
'product_id' => $product->id,
'inventory_source_id' => $inventorySourceId,
'vendor_id' => isset($data['vendor_id']) ? $data['vendor_id'] : 0
]);
if($productInventory) {
if(is_numeric($index = $inventorySourceIds->search($inventorySourceId))) {
$inventorySourceIds->forget($index);
}
$productInventory->qty = $qty;
$this->update(['qty' => $qty], $productInventory->id);
$productInventory->save();
} else {
$this->create([
'qty' => $qty,
'product_id' => $product->id,
'inventory_source_id' => $inventorySourceId,
'vendor_id' => isset($data['vendor_id']) ? $data['vendor_id'] : 0
]);
}
}
}
if($inventorySourceIds->count()) {
$product->inventory_sources()->detach($inventorySourceIds);
}
}
}

View File

@ -50,6 +50,7 @@ class ShipmentItemRepository extends Repository
}
$inventory = $data['product']->inventories()
->where('vendor_id', $data['vendor_id'])
->where('inventory_source_id', $data['shipment']->inventory_source_id)
->first();

View File

@ -134,7 +134,8 @@ class ShipmentRepository extends Repository
'shipment' => $shipment,
'shipmentItem' => $shipmentItem,
'product' => $product,
'qty' => $qty
'qty' => $qty,
'vendor_id' => isset($data['vendor_id']) ? $data['vendor_id'] : 0
]);
$this->orderItem->update(['qty_shipped' => $orderItem->qty_shipped + $qty], $orderItem->id);

View File

@ -1,27 +0,0 @@
<?php
namespace Webkul\Sales\Repositories;
use Illuminate\Container\Container as App;
use Webkul\Core\Eloquent\Repository;
/**
* ShipmentItem Reposotory
*
* @author Jitendra Singh <jitendra@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class ShipmentItemRepository extends Repository
{
/**
* Specify Model class name
*
* @return Mixed
*/
function model()
{
return 'Webkul\Sales\Contracts\ShipmentItem';
}
}

View File

@ -106,16 +106,21 @@ return [
'name' => 'Origin',
'sort' => 0,
'fields' => [
// [
// 'name' => 'country',
// 'title' => 'Country',
// 'type' => 'country_state',
// 'stateName' => 'state'
// 'validation' => 'required',
// 'channel_based' => true,
// 'locale_based' => true
// ],
[
'name' => 'country',
'title' => 'Country',
'type' => 'country',
'validation' => 'required',
'channel_based' => true,
'locale_based' => true
], [
'name' => 'state',
'title' => 'State',
'type' => 'state',
'validation' => 'required',
'channel_based' => true,
'locale_based' => true
], [
'name' => 'address1',
'title' => 'Address Line 1',
'type' => 'text',

View File

@ -63,6 +63,12 @@
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
</div>
<div class="control-group" :class="[errors.has('phone') ? 'has-error' : '']">
<label for="phone">{{ __('shop::app.customer.account.profile.phone') }}</label>
<input type="text" class="control" name="phone" v-validate="'numeric|max:10'" value="{{ old('phone') ?? $customer->phone }}" data-vv-as="&quot;{{ __('shop::app.customer.account.profile.phone') }}&quot;">
<span class="control-error" v-if="errors.has('phone')">@{{ errors.first('phone') }}</span>
</div>
<div class="control-group" :class="[errors.has('oldpassword') ? 'has-error' : '']">
<label for="password">{{ __('shop::app.customer.account.profile.opassword') }}</label>
<input type="password" class="control" name="oldpassword" data-vv-as="&quot;{{ __('shop::app.customer.account.profile.opassword') }}&quot;" v-validate="'min:6'">

View File

@ -55,6 +55,11 @@
<td>{{ $customer->email }}</td>
</tr>
<tr>
<td>{{ __('shop::app.customer.account.profile.phone') }}</td>
<td>{{ $customer->phone }}</td>
</tr>
{{-- @if($customer->subscribed_to_news_letter == 1)
<tr>
<td> {{ __('shop::app.footer.subscribe-newsletter') }}</td>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/js/ui.js": "/js/ui.js?id=c3ee60fd11e29aca2922",
"/css/ui.css": "/css/ui.css?id=0b2b51d90a970c9a4219"
}
"/css/ui.css": "/css/ui.css?id=1edd188de8c037f174a0"
}

View File

@ -15,7 +15,7 @@ $(function() {
var currentElement = $(e.currentTarget);
if(currentElement.attr('disabled') == "disabled")
return;
$('.dropdown-list').hide();
if(currentElement.hasClass('active')) {
currentElement.removeClass('active');
@ -59,7 +59,7 @@ $(function() {
height = dropdown.height() + 50;
var topOffset = dropdown.offset().top - 70;
var bottomOffset = $(window).height() - topOffset - dropdown.height();
if(bottomOffset > topOffset || height < bottomOffset) {
dropdown.removeClass("bottom");
if(dropdown.hasClass('top-right')) {

View File

@ -1,8 +1,9 @@
const { mix } = require("laravel-mix");
require("laravel-mix-merge-manifest");
// var publicPath = 'publishable/assets';
var publicPath = "../../../public/vendor/webkul/ui/assets";
var publicPath = 'publishable/assets';
// var publicPath = "../../../public/vendor/webkul/ui/assets";
mix.setPublicPath(publicPath).mergeManifest();
mix.disableNotifications();

View File

@ -1,2 +0,0 @@
*
!.gitignore