Merge pull request #362 from jitendra-webkul/jitendra
Issues #353, #354
This commit is contained in:
commit
9ebeb6e50b
|
|
@ -92,7 +92,7 @@
|
|||
{{ $attribute->admin_name }}
|
||||
|
||||
@if ($attribute->type == 'price')
|
||||
<span class="currency-code">({{ currency()->symbol(core()->getBaseCurrencyCode()) }})</span>
|
||||
<span class="currency-code">({{ core()->currencySymbol(core()->getBaseCurrencyCode()) }})</span>
|
||||
@endif
|
||||
|
||||
<?php
|
||||
|
|
|
|||
|
|
@ -74,7 +74,8 @@ class CategoryController extends Controller
|
|||
{
|
||||
$this->validate(request(), [
|
||||
'slug' => ['required', 'unique:category_translations,slug', new \Webkul\Core\Contracts\Validations\Slug],
|
||||
'name' => 'required'
|
||||
'name' => 'required',
|
||||
'image.*' => 'mimes:jpeg,jpg,bmp,png'
|
||||
]);
|
||||
|
||||
$this->category->create(request()->all());
|
||||
|
|
@ -116,6 +117,7 @@ class CategoryController extends Controller
|
|||
}
|
||||
}],
|
||||
$locale . '.name' => 'required',
|
||||
'image.*' => 'mimes:jpeg,jpg,bmp,png'
|
||||
]);
|
||||
|
||||
$this->category->update(request()->all(), $id);
|
||||
|
|
|
|||
|
|
@ -358,6 +358,21 @@ class Core
|
|||
return currency($this->convertPrice($amount), $currencyCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return currency symbol from currency code
|
||||
*
|
||||
* @param float $price
|
||||
* @return string
|
||||
*/
|
||||
public function currencySymbol($code)
|
||||
{
|
||||
try {
|
||||
return currency()->symbol($code);
|
||||
} catch (\Exception $e) {
|
||||
return $code;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format and convert price with currency symbol
|
||||
*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AlterChannelsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('channels', function (Blueprint $table) {
|
||||
$table->dropForeign('channels_default_locale_id_foreign');
|
||||
$table->dropForeign('channels_base_currency_id_foreign');
|
||||
$table->foreign('default_locale_id')->references('id')->on('locales');
|
||||
$table->foreign('base_currency_id')->references('id')->on('currencies');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
@ -77,7 +77,9 @@ class ChannelController extends Controller
|
|||
'locales' => 'required|array|min:1',
|
||||
'default_locale_id' => 'required',
|
||||
'currencies' => 'required|array|min:1',
|
||||
'base_currency_id' => 'required'
|
||||
'base_currency_id' => 'required',
|
||||
'logo.*' => 'mimes:jpeg,jpg,bmp,png',
|
||||
'favicon.*' => 'mimes:jpeg,jpg,bmp,png'
|
||||
]);
|
||||
|
||||
$this->channel->create(request()->all());
|
||||
|
|
@ -115,7 +117,9 @@ class ChannelController extends Controller
|
|||
'locales' => 'required|array|min:1',
|
||||
'default_locale_id' => 'required',
|
||||
'currencies' => 'required|array|min:1',
|
||||
'base_currency_id' => 'required'
|
||||
'base_currency_id' => 'required',
|
||||
'logo.*' => 'mimes:jpeg,jpg,bmp,png',
|
||||
'favicon.*' => 'mimes:jpeg,jpg,bmp,png'
|
||||
]);
|
||||
|
||||
$this->channel->update(request()->all(), $id);
|
||||
|
|
|
|||
|
|
@ -125,12 +125,16 @@ class CurrencyController extends Controller
|
|||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$result = $this->currency->delete($id);
|
||||
try {
|
||||
$result = $this->currency->delete($id);
|
||||
|
||||
if($result)
|
||||
session()->flash('success', 'Currency deleted successfully.');
|
||||
else
|
||||
session()->flash('error', 'At least one currency is required.');
|
||||
if($result)
|
||||
session()->flash('success', 'Currency deleted successfully.');
|
||||
else
|
||||
session()->flash('error', 'At least one currency is required.');
|
||||
} catch (\Exception $e) {
|
||||
session()->flash('error', $e->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<label class="image-item" :for="_uid" v-bind:class="{ 'has-image': imageData.length > 0 }">
|
||||
<input type="hidden" :name="finalInputName"/>
|
||||
|
||||
<input type="file" accept="image/*" :name="finalInputName" ref="imageInput" :id="_uid" @change="addImageView($event)"/>
|
||||
<input type="file" v-validate="'mimes:image/*'" accept="image/*" :name="finalInputName" ref="imageInput" :id="_uid" @change="addImageView($event)"/>
|
||||
|
||||
<img class="preview" :src="imageData" v-if="imageData.length > 0">
|
||||
|
||||
|
|
@ -53,13 +53,18 @@
|
|||
var imageInput = this.$refs.imageInput;
|
||||
|
||||
if (imageInput.files && imageInput.files[0]) {
|
||||
var reader = new FileReader();
|
||||
if(imageInput.files[0].type.includes('image/')) {
|
||||
var reader = new FileReader();
|
||||
|
||||
reader.onload = (e) => {
|
||||
this.imageData = e.target.result;
|
||||
reader.onload = (e) => {
|
||||
this.imageData = e.target.result;
|
||||
}
|
||||
|
||||
reader.readAsDataURL(imageInput.files[0]);
|
||||
} else {
|
||||
imageInput.value = "";
|
||||
alert('Only images (.jpeg, .jpg, .png, ..) are allowed.');
|
||||
}
|
||||
|
||||
reader.readAsDataURL(imageInput.files[0]);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -60,16 +60,22 @@
|
|||
var this_this = this;
|
||||
|
||||
if(this.multiple) {
|
||||
this.images.forEach(function(image) {
|
||||
this_this.items.push(image)
|
||||
if(this.images.length) {
|
||||
this.images.forEach(function(image) {
|
||||
this_this.items.push(image)
|
||||
|
||||
this_this.imageCount++;
|
||||
});
|
||||
this_this.imageCount++;
|
||||
});
|
||||
} else {
|
||||
this.createFileType();
|
||||
}
|
||||
} else {
|
||||
if(this.images && this.images != '') {
|
||||
this.items.push({'id': 'image_' + this.imageCount, 'url': this.images})
|
||||
|
||||
this.imageCount++;
|
||||
} else {
|
||||
this.createFileType();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue