Merge pull request #23 from bagisto/master
This commit is contained in:
commit
90b97e8c53
|
|
@ -11,7 +11,7 @@ use Webkul\Product\Models\Product;
|
|||
$factory->define(BookingProductEventTicket::class, function (Faker $faker, array $attributes) {
|
||||
return [
|
||||
'price' => $faker->randomFloat(4, 3, 900),
|
||||
'qty' => $faker->randomNumber(2),
|
||||
'qty' => $faker->numberBetween(1, 99),
|
||||
'booking_product_id' => static function () {
|
||||
return factory(BookingProduct::class)->create(['type' => 'event'])->id;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,14 @@ return [
|
|||
'channel_based' => true,
|
||||
'locale_based' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'order_number_generator-class',
|
||||
'title' => 'admin::app.admin.system.order-number-generator-class',
|
||||
'type' => 'text',
|
||||
'validation' => false,
|
||||
'channel_based' => true,
|
||||
'locale_based' => true,
|
||||
],
|
||||
]
|
||||
], [
|
||||
'key' => 'sales.orderSettings.invoice_slip_design',
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ use Illuminate\Support\Facades\Event;
|
|||
use Webkul\Core\Eloquent\Repository;
|
||||
use Webkul\Sales\Contracts\Order;
|
||||
use Webkul\Sales\Models\Order as OrderModel;
|
||||
use Webkul\Shop\Generators\Sequencer;
|
||||
use Webkul\Shop\Generators\OrderNumberIdSequencer;
|
||||
|
||||
class OrderRepository extends Repository
|
||||
{
|
||||
|
|
@ -185,25 +187,17 @@ class OrderRepository extends Repository
|
|||
*/
|
||||
public function generateIncrementId()
|
||||
{
|
||||
foreach ([ 'Prefix' => 'prefix',
|
||||
'Length' => 'length',
|
||||
'Suffix' => 'suffix', ] as
|
||||
$varSuffix => $confKey)
|
||||
{
|
||||
$var = "invoiceNumber{$varSuffix}";
|
||||
$$var = core()->getConfigData('sales.orderSettings.order_number.order_number_'.$confKey) ?: false;
|
||||
$generatorClass = core()->getConfigData('sales.orderSettings.order_number.order_number_generator-class') ?: false;
|
||||
|
||||
if ($generatorClass !== false
|
||||
&& class_exists($generatorClass)
|
||||
&& in_array(Sequencer::class, class_implements($generatorClass), true)
|
||||
) {
|
||||
/** @var $generatorClass Sequencer */
|
||||
return $generatorClass::generate();
|
||||
}
|
||||
|
||||
$lastOrder = $this->model->orderBy('id', 'desc')->limit(1)->first();
|
||||
$lastId = $lastOrder ? $lastOrder->id : 0;
|
||||
|
||||
if ($invoiceNumberLength && ($invoiceNumberPrefix || $invoiceNumberSuffix)) {
|
||||
$invoiceNumber = ($invoiceNumberPrefix) . sprintf("%0{$invoiceNumberLength}d", 0) . ($lastId + 1) . ($invoiceNumberSuffix);
|
||||
} else {
|
||||
$invoiceNumber = $lastId + 1;
|
||||
}
|
||||
|
||||
return $invoiceNumber;
|
||||
return OrderNumberIdSequencer::generate();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace Webkul\Shop\Generators;
|
||||
|
||||
|
||||
use Webkul\Sales\Models\Order;
|
||||
|
||||
class OrderNumberIdSequencer implements Sequencer
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function generate(): string
|
||||
{
|
||||
foreach ([
|
||||
'Prefix' => 'prefix',
|
||||
'Length' => 'length',
|
||||
'Suffix' => 'suffix',
|
||||
] as
|
||||
$varSuffix => $confKey) {
|
||||
$var = "invoiceNumber{$varSuffix}";
|
||||
$$var = core()->getConfigData('sales.orderSettings.order_number.order_number_' . $confKey) ?: false;
|
||||
}
|
||||
|
||||
$lastOrder = Order::query()->orderBy('id', 'desc')->limit(1)->first();
|
||||
$lastId = $lastOrder ? $lastOrder->id : 0;
|
||||
|
||||
if ($invoiceNumberLength && ($invoiceNumberPrefix || $invoiceNumberSuffix)) {
|
||||
$invoiceNumber = ($invoiceNumberPrefix) . sprintf("%0{$invoiceNumberLength}d",
|
||||
0) . ($lastId + 1) . ($invoiceNumberSuffix);
|
||||
} else {
|
||||
$invoiceNumber = $lastId + 1;
|
||||
}
|
||||
|
||||
return $invoiceNumber;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace Webkul\Shop\Generators;
|
||||
|
||||
|
||||
interface Sequencer
|
||||
{
|
||||
/**
|
||||
* create and return the next sequence number for e.g. an order
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function generate(): string;
|
||||
}
|
||||
|
|
@ -242,42 +242,70 @@
|
|||
|
||||
methods: {
|
||||
uploadImage: function() {
|
||||
var self = this;
|
||||
var imageInput = this.$refs.image_search_input;
|
||||
|
||||
self.$root.showLoader();
|
||||
if (imageInput.files && imageInput.files[0]) {
|
||||
if (imageInput.files[0].type.includes('image/')) {
|
||||
var self = this;
|
||||
|
||||
var formData = new FormData();
|
||||
self.$root.showLoader();
|
||||
|
||||
formData.append('image', this.$refs.image_search_input.files[0]);
|
||||
var formData = new FormData();
|
||||
|
||||
axios.post("{{ route('shop.image.search.upload') }}", formData, {headers: {'Content-Type': 'multipart/form-data'}})
|
||||
.then(function(response) {
|
||||
self.uploaded_image_url = response.data;
|
||||
formData.append('image', imageInput.files[0]);
|
||||
|
||||
var net;
|
||||
axios.post("{{ route('shop.image.search.upload') }}", formData, {headers: {'Content-Type': 'multipart/form-data'}})
|
||||
.then(function(response) {
|
||||
self.uploaded_image_url = response.data;
|
||||
|
||||
async function app() {
|
||||
var analysedResult = [];
|
||||
var net;
|
||||
|
||||
var queryString = '';
|
||||
async function app() {
|
||||
var analysedResult = [];
|
||||
|
||||
net = await mobilenet.load();
|
||||
var queryString = '';
|
||||
|
||||
const imgElement = document.getElementById('uploaded-image-url');
|
||||
net = await mobilenet.load();
|
||||
|
||||
try {
|
||||
const result = await net.classify(imgElement);
|
||||
const imgElement = document.getElementById('uploaded-image-url');
|
||||
|
||||
result.forEach(function(value) {
|
||||
queryString = value.className.split(',');
|
||||
try {
|
||||
const result = await net.classify(imgElement);
|
||||
|
||||
if (queryString.length > 1) {
|
||||
analysedResult = analysedResult.concat(queryString)
|
||||
} else {
|
||||
analysedResult.push(queryString[0])
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
result.forEach(function(value) {
|
||||
queryString = value.className.split(',');
|
||||
|
||||
if (queryString.length > 1) {
|
||||
analysedResult = analysedResult.concat(queryString)
|
||||
} else {
|
||||
analysedResult.push(queryString[0])
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
self.$root.hideLoader();
|
||||
|
||||
window.flashMessages = [
|
||||
{
|
||||
'type': 'alert-error',
|
||||
'message': "{{ __('shop::app.common.error') }}"
|
||||
}
|
||||
];
|
||||
|
||||
self.$root.addFlashMessages();
|
||||
};
|
||||
|
||||
localStorage.searched_image_url = self.uploaded_image_url;
|
||||
|
||||
queryString = localStorage.searched_terms = analysedResult.join('_');
|
||||
|
||||
self.$root.hideLoader();
|
||||
|
||||
window.location.href = "{{ route('shop.search.index') }}" + '?term=' + queryString + '&image-search=1';
|
||||
}
|
||||
|
||||
app();
|
||||
})
|
||||
.catch(function(error) {
|
||||
self.$root.hideLoader();
|
||||
|
||||
window.flashMessages = [
|
||||
|
|
@ -288,31 +316,13 @@
|
|||
];
|
||||
|
||||
self.$root.addFlashMessages();
|
||||
};
|
||||
});
|
||||
} else {
|
||||
imageInput.value = '';
|
||||
|
||||
localStorage.searched_image_url = self.uploaded_image_url;
|
||||
|
||||
queryString = localStorage.searched_terms = analysedResult.join('_');
|
||||
|
||||
self.$root.hideLoader();
|
||||
|
||||
window.location.href = "{{ route('shop.search.index') }}" + '?term=' + queryString + '&image-search=1';
|
||||
}
|
||||
|
||||
app();
|
||||
})
|
||||
.catch(function(error) {
|
||||
self.$root.hideLoader();
|
||||
|
||||
window.flashMessages = [
|
||||
{
|
||||
'type': 'alert-error',
|
||||
'message': "{{ __('shop::app.common.error') }}"
|
||||
}
|
||||
];
|
||||
|
||||
self.$root.addFlashMessages();
|
||||
});
|
||||
alert('Only images (.jpeg, .jpg, .png, ..) are allowed.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class ChangeEmailPasswordColumnsInCustomersTable extends Migration
|
|||
public function up()
|
||||
{
|
||||
Schema::table('customers', function (Blueprint $table) {
|
||||
$table->string('email')->unique()->nullable()->change();
|
||||
$table->string('email')->nullable()->change();
|
||||
$table->string('password')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ class ChangeEmailPasswordColumnsInCustomersTable extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('customers', function (Blueprint $table) {
|
||||
$table->string('email')->unique()->nullable(false)->change();
|
||||
$table->string('email')->nullable(false)->change();
|
||||
$table->string('password')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,13 @@ class LoginController extends Controller
|
|||
*/
|
||||
public function redirectToProvider($provider)
|
||||
{
|
||||
return Socialite::driver($provider)->redirect();
|
||||
try {
|
||||
return Socialite::driver($provider)->redirect();
|
||||
} catch (\Exception $e) {
|
||||
session()->flash('error', $e->getMessage());
|
||||
|
||||
return redirect()->route('customer.session.index');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class RemoveUniqueNameInTaxCategoriesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('tax_categories', function (Blueprint $table) {
|
||||
$table->dropUnique('tax_categories_name_unique');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('tax_categories', function (Blueprint $table) {
|
||||
$table->unique('name');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -31,7 +31,7 @@ return [
|
|||
'true' => 'Prawda / Aktywy',
|
||||
'false' => 'Fałsz / Nie aktywny',
|
||||
'between' => 'Jest pomiędzy',
|
||||
'apply' => Zastosuj',
|
||||
'apply' => 'Zastosuj',
|
||||
'items-per-page' => 'Przedmioty na stronę',
|
||||
'value-here' => 'Wartość tutaj',
|
||||
'numeric-value-here' => 'wartość liczbowa tutaj',
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"/js/velocity.js": "/js/velocity.js?id=226121407d7f6a559c67",
|
||||
"/css/velocity-admin.css": "/css/velocity-admin.css?id=612d35e452446366eef7",
|
||||
"/css/velocity.css": "/css/velocity.css?id=f2ce483a21b83460e74f"
|
||||
"/css/velocity.css": "/css/velocity.css?id=91aa43446b2111505847"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class VelocityMetaDataSeeder extends Seeder
|
|||
'code' => 'general.content.shop.compare_option',
|
||||
'value' => '1',
|
||||
'channel_code' => 'default',
|
||||
'locale_code' => 'ar',
|
||||
'locale_code' => 'en',
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
],
|
||||
|
|
|
|||
|
|
@ -449,6 +449,13 @@ body {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.velocity-divide-page {
|
||||
.left {
|
||||
right: 0;
|
||||
width: 200px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -361,75 +361,86 @@
|
|||
|
||||
methods: {
|
||||
uploadImage: function() {
|
||||
this.$root.showLoader();
|
||||
var formData = new FormData();
|
||||
var imageInput = this.$refs.image_search_input;
|
||||
|
||||
formData.append('image', this.$refs.image_search_input.files[0]);
|
||||
if (imageInput.files && imageInput.files[0]) {
|
||||
if (imageInput.files[0].type.includes('image/')) {
|
||||
this.$root.showLoader();
|
||||
|
||||
axios.post(
|
||||
"{{ route('shop.image.search.upload') }}",
|
||||
formData,
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
}
|
||||
).then(response => {
|
||||
var net;
|
||||
var self = this;
|
||||
this.uploadedImageUrl = response.data;
|
||||
var formData = new FormData();
|
||||
|
||||
formData.append('image', imageInput.files[0]);
|
||||
|
||||
async function app() {
|
||||
var analysedResult = [];
|
||||
|
||||
var queryString = '';
|
||||
|
||||
net = await mobilenet.load();
|
||||
|
||||
const imgElement = document.getElementById('uploaded-image-url');
|
||||
|
||||
try {
|
||||
const result = await net.classify(imgElement);
|
||||
|
||||
result.forEach(function(value) {
|
||||
queryString = value.className.split(',');
|
||||
|
||||
if (queryString.length > 1) {
|
||||
analysedResult = analysedResult.concat(queryString)
|
||||
} else {
|
||||
analysedResult.push(queryString[0])
|
||||
axios.post(
|
||||
"{{ route('shop.image.search.upload') }}",
|
||||
formData,
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
self.$root.hideLoader();
|
||||
}
|
||||
).then(response => {
|
||||
var net;
|
||||
var self = this;
|
||||
this.uploadedImageUrl = response.data;
|
||||
|
||||
|
||||
async function app() {
|
||||
var analysedResult = [];
|
||||
|
||||
var queryString = '';
|
||||
|
||||
net = await mobilenet.load();
|
||||
|
||||
const imgElement = document.getElementById('uploaded-image-url');
|
||||
|
||||
try {
|
||||
const result = await net.classify(imgElement);
|
||||
|
||||
result.forEach(function(value) {
|
||||
queryString = value.className.split(',');
|
||||
|
||||
if (queryString.length > 1) {
|
||||
analysedResult = analysedResult.concat(queryString)
|
||||
} else {
|
||||
analysedResult.push(queryString[0])
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
self.$root.hideLoader();
|
||||
|
||||
window.showAlert(
|
||||
`alert-danger`,
|
||||
this.__('shop.general.alert.error'),
|
||||
"{{ __('shop::app.common.error') }}"
|
||||
);
|
||||
}
|
||||
|
||||
localStorage.searchedImageUrl = self.uploadedImageUrl;
|
||||
|
||||
queryString = localStorage.searched_terms = analysedResult.join('_');
|
||||
|
||||
self.$root.hideLoader();
|
||||
|
||||
window.location.href = "{{ route('shop.search.index') }}" + '?term=' + queryString + '&image-search=1';
|
||||
}
|
||||
|
||||
app();
|
||||
}).catch(() => {
|
||||
this.$root.hideLoader();
|
||||
|
||||
window.showAlert(
|
||||
`alert-danger`,
|
||||
this.__('shop.general.alert.error'),
|
||||
"{{ __('shop::app.common.error') }}"
|
||||
);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
imageInput.value = '';
|
||||
|
||||
localStorage.searchedImageUrl = self.uploadedImageUrl;
|
||||
|
||||
queryString = localStorage.searched_terms = analysedResult.join('_');
|
||||
|
||||
self.$root.hideLoader();
|
||||
|
||||
window.location.href = "{{ route('shop.search.index') }}" + '?term=' + queryString + '&image-search=1';
|
||||
alert('Only images (.jpeg, .jpg, .png, ..) are allowed.');
|
||||
}
|
||||
|
||||
app();
|
||||
}).catch(() => {
|
||||
this.$root.hideLoader();
|
||||
|
||||
window.showAlert(
|
||||
`alert-danger`,
|
||||
this.__('shop.general.alert.error'),
|
||||
"{{ __('shop::app.common.error') }}"
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue