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

 Conflicts:
	public/installer/Seeder.php
This commit is contained in:
merdan 2022-04-06 11:03:21 +05:00
commit 3b1b4e0c04
31 changed files with 472 additions and 114 deletions

View File

@ -66,7 +66,7 @@ jobs:
run: set -e && php artisan db:seed --env=testing
- name: Vendor Publish
run: set -e && php artisan vendor:publish --all --force --env=testing
run: set -e && php artisan bagisto:publish --force --env=testing
- name: Execute Unit Tests
run: set -e && vendor/bin/codecept run unit

View File

@ -0,0 +1,114 @@
<?php
namespace Webkul\Core\Console\Commands;
use Illuminate\Console\Command;
class BagistoPublish extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'bagisto:publish { --force : Overwrite any existing files }';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Publish the available assets';
/**
* List of providers.
*
* @var array
*/
protected $providers = [
/**
* Package providers.
*/
[
'name' => 'DB Blade Compiler',
'provider' => \Flynsarmy\DbBladeCompiler\DbBladeCompilerServiceProvider::class,
],
/**
* Bagisto providers.
*/
[
'name' => 'Admin',
'provider' => \Webkul\Admin\Providers\AdminServiceProvider::class,
],
[
'name' => 'UI',
'provider' => \Webkul\Ui\Providers\UiServiceProvider::class,
],
[
'name' => 'Core',
'provider' => \Webkul\Core\Providers\CoreServiceProvider::class,
],
[
'name' => 'Shop',
'provider' => \Webkul\Shop\Providers\ShopServiceProvider::class,
],
[
'name' => 'Product',
'provider' => \Webkul\Product\Providers\ProductServiceProvider::class,
],
[
'name' => 'Velocity',
'provider' => \Webkul\Velocity\Providers\VelocityServiceProvider::class,
],
[
'name' => 'Booking Product',
'provider' => \Webkul\BookingProduct\Providers\BookingProductServiceProvider::class,
],
[
'name' => 'Social',
'provider' => \Webkul\SocialLogin\Providers\SocialLoginServiceProvider::class,
],
];
/**
* Execute the console command.
*
* @return void
*/
public function handle()
{
$this->publishAllPackages();
}
/**
* Publish all packages.
*
* @return void
*/
public function publishAllPackages(): void
{
collect($this->providers)->each(function ($provider) {
$this->publishPackage($provider);
});
}
/**
* Publish package.
*
* @param array $provider
* @return void
*/
public function publishPackage(array $provider): void
{
$this->line('');
$this->line('-----------------------------------------');
$this->info('Publishing ' . $provider['name']);
$this->line('-----------------------------------------');
$this->call('vendor:publish', [
'--provider' => $provider['provider'],
'--force' => $this->option('force'),
]);
}
}

View File

@ -53,9 +53,9 @@ class Install extends Command
$result = $this->call('db:seed');
$this->info($result);
// running `php artisan vendor:publish --all`
// running `php artisan bagisto:publish --force`
$this->warn('Step: Publishing assets and configurations...');
$result = $this->call('vendor:publish', ['--all' => true, '--force' => true]);
$result = $this->call('bagisto:publish', ['--force' => true]);
$this->info($result);
// running `php artisan storage:link`

View File

@ -103,6 +103,7 @@ class CoreServiceProvider extends ServiceProvider
{
if ($this->app->runningInConsole()) {
$this->commands([
\Webkul\Core\Console\Commands\BagistoPublish::class,
\Webkul\Core\Console\Commands\BagistoVersion::class,
\Webkul\Core\Console\Commands\Install::class,
\Webkul\Core\Console\Commands\ExchangeRateUpdate::class,

View File

@ -125,13 +125,14 @@ class WishlistController extends Controller
$updateCounts = $this->currentCustomer->wishlist_items()->update(['shared' => $data['shared']]);
if ($updateCounts && $updateCounts > 0) {
session()->flash('success', __('shop::app.customer.account.wishlist.update-message'));
return redirect()->back();
return response()->json([
'isWishlistShared' => $this->currentCustomer->isWishlistShared(),
'wishlistSharedLink' => $this->currentCustomer->getWishlistSharedLink()
]);
}
}
return redirect()->back();
return response()->json([], 400);
}
/**

View File

@ -373,6 +373,7 @@ return [
'share-wishlist' => 'Share Wishlist',
'wishlist-sharing' => 'Wishlist Sharing',
'shared-link' => 'Shared Link',
'copy' => 'Copy',
'visibility' => 'Visibility',
'public' => 'Public',
'private' => 'Private',

View File

@ -376,6 +376,7 @@ return [
'share-wishlist' => 'ইচ্ছা তালিকা ভাগ করুন',
'wishlist-sharing' => 'ইচ্ছা তালিকা শেয়ারিং',
'shared-link' => 'শেয়ারড লিংক',
'copy' => 'Copy',
'visibility' => 'দৃশ্যমানতা',
'public' => 'পাবলিক',
'private' => 'ব্যক্তিগত',

View File

@ -371,6 +371,7 @@ return [
'share-wishlist' => 'Share Wishlist',
'wishlist-sharing' => 'Wishlist Sharing',
'shared-link' => 'Shared Link',
'copy' => 'Copy',
'visibility' => 'Visibility',
'public' => 'Public',
'private' => 'Private',

View File

@ -376,6 +376,7 @@ return [
'share-wishlist' => 'Share Wishlist',
'wishlist-sharing' => 'Wishlist Sharing',
'shared-link' => 'Shared Link',
'copy' => 'Copy',
'visibility' => 'Visibility',
'public' => 'Public',
'private' => 'Private',

View File

@ -374,6 +374,7 @@ return [
'share-wishlist' => 'Share Wishlist',
'wishlist-sharing' => 'Wishlist Sharing',
'shared-link' => 'Shared Link',
'copy' => 'Copy',
'visibility' => 'Visibility',
'public' => 'Public',
'private' => 'Private',

View File

@ -370,6 +370,7 @@ return [
'share-wishlist' => 'Share Wishlist',
'wishlist-sharing' => 'Wishlist Sharing',
'shared-link' => 'Shared Link',
'copy' => 'Copy',
'visibility' => 'Visibility',
'public' => 'Public',
'private' => 'Private',

View File

@ -372,6 +372,7 @@ return [
'share-wishlist' => 'Share Wishlist',
'wishlist-sharing' => 'Wishlist Sharing',
'shared-link' => 'Shared Link',
'copy' => 'Copy',
'visibility' => 'Visibility',
'public' => 'Public',
'private' => 'Private',

View File

@ -375,6 +375,7 @@ return [
'share-wishlist' => 'שתף משאלות',
'wishlist-sharing' => 'שיתוף רשימת המשאלות',
'shared-link' => 'קישור משותף',
'copy' => 'Copy',
'visibility' => 'רְאוּת',
'public' => 'פּוּמְבֵּי',
'private' => 'פְּרָטִי',

View File

@ -375,6 +375,7 @@ return [
'share-wishlist' => 'शेयर विशलिस्ट',
'wishlist-sharing' => 'विशलिस्ट शेयरिंग',
'shared-link' => 'साझा लिंक',
'copy' => 'Copy',
'visibility' => 'दृश्यता',
'public' => 'जनता',
'private' => 'निजी',

View File

@ -372,6 +372,7 @@ return [
'share-wishlist' => 'Share Wishlist',
'wishlist-sharing' => 'Wishlist Sharing',
'shared-link' => 'Shared Link',
'copy' => 'Copy',
'visibility' => 'Visibility',
'public' => 'Public',
'private' => 'Private',

View File

@ -352,6 +352,7 @@ return [
'share-wishlist' => 'Share Wishlist',
'wishlist-sharing' => 'Wishlist Sharing',
'shared-link' => 'Shared Link',
'copy' => 'Copy',
'visibility' => 'Visibility',
'public' => 'Public',
'private' => 'Private',

View File

@ -378,6 +378,7 @@ return [
'share-wishlist' => 'Share Wishlist',
'wishlist-sharing' => 'Wishlist Sharing',
'shared-link' => 'Shared Link',
'copy' => 'Copy',
'visibility' => 'Visibility',
'public' => 'Public',
'private' => 'Private',

View File

@ -372,6 +372,7 @@ return [
'share-wishlist' => 'Share Wishlist',
'wishlist-sharing' => 'Wishlist Sharing',
'shared-link' => 'Shared Link',
'copy' => 'Copy',
'visibility' => 'Visibility',
'public' => 'Public',
'private' => 'Private',

View File

@ -366,6 +366,7 @@ return [
'share-wishlist' => 'Share Wishlist',
'wishlist-sharing' => 'Wishlist Sharing',
'shared-link' => 'Shared Link',
'copy' => 'Copy',
'visibility' => 'Visibility',
'public' => 'Public',
'private' => 'Private',

View File

@ -376,6 +376,7 @@ return [
'share-wishlist' => '«Поделиться списком желаний»',
'wishlist-sharing' => '«Обмен списком желаний»',
'shared-link' => '«Общая ссылка»',
'copy' => 'Copy',
'visibility' => '«Видимость»',
'public' => '«Общественный»',
'private' => 'Частный',

View File

@ -376,6 +376,7 @@ return [
'share-wishlist' => 'පැතුම් ලැයිස්තුව බෙදාගන්න',
'wishlist-sharing' => 'පැතුම් ලැයිස්තු බෙදාගැනීම',
'shared-link' => 'බෙදාගත් සබැඳිය',
'copy' => 'Copy',
'visibility' => 'දෘෂ්‍යතාව',
'public' => 'මහජන',
'private' => 'පුද්ගලික',

View File

@ -371,6 +371,7 @@ return [
'share-wishlist' => 'Share Wishlist',
'wishlist-sharing' => 'Wishlist Sharing',
'shared-link' => 'Shared Link',
'copy' => 'Copy',
'visibility' => 'Visibility',
'public' => 'Public',
'private' => 'Private',

View File

@ -375,6 +375,7 @@ return [
'share-wishlist' => '分享愿望清单',
'wishlist-sharing' => '愿望清单分享',
'shared-link' => '已共享链接',
'copy' => 'Copy',
'visibility' => '可见度',
'public' => '公开的',
'private' => '私有的',

View File

@ -66,51 +66,8 @@
{{ __('shop::app.customer.account.wishlist.share-wishlist') }}
</h3>
<i class="rango-close"></i>
<div slot="body">
<form method="POST" action="{{ route('customer.wishlist.share') }}">
@csrf
<div class="control-group">
<label for="shared" class="required">{{ __('shop::app.customer.account.wishlist.wishlist-sharing') }}</label>
<select name="shared" class="control">
<option value="0" {{ $isWishlistShared ? '' : 'selected="selected"' }}>{{ __('shop::app.customer.account.wishlist.disable') }}</option>
<option value="1" {{ $isWishlistShared ? 'selected="selected"' : '' }}>{{ __('shop::app.customer.account.wishlist.enable') }}</option>
</select>
</div>
<div class="control-group">
<label class="required">{{ __('shop::app.customer.account.wishlist.visibility') }}</label>
<div class="mt-5">
@if ($isWishlistShared)
<span class="badge badge-sm badge-success">{{ __('shop::app.customer.account.wishlist.public') }}</span>
@else
<span class="badge badge-sm badge-danger">{{ __('shop::app.customer.account.wishlist.private') }}</span>
@endif
</div>
</div>
<div class="control-group">
<label class="required">{{ __('shop::app.customer.account.wishlist.shared-link') }}</label>
<div>
@if ($isWishlistShared)
<a href="{{ $wishlistSharedLink ?? 'javascript:void(0);' }}" target="_blank">{{ $wishlistSharedLink }}</a>
@else
<p>{{ __('shop::app.customer.account.wishlist.enable-wishlist-info') }}</p>
@endif
</div>
</div>
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary mt-10 pull-right">
{{ __('shop::app.customer.account.wishlist.save') }}
</button>
</div>
</form>
<share-component></share-component>
</div>
</modal>
</div>
@ -122,6 +79,65 @@
@push('scripts')
@if ($isSharingEnabled)
<script type="text/x-template" id="share-component-template">
<form method="POST">
@csrf
<div class="control-group">
<label for="shared" class="required">{{ __('shop::app.customer.account.wishlist.wishlist-sharing') }}</label>
<select name="shared" class="control" @change="shareWishlist($event.target.value)">
<option value="0" :selected="! isWishlistShared">{{ __('shop::app.customer.account.wishlist.disable') }}</option>
<option value="1" :selected="isWishlistShared">{{ __('shop::app.customer.account.wishlist.enable') }}</option>
</select>
</div>
<div class="control-group">
<label class="required">{{ __('shop::app.customer.account.wishlist.visibility') }}</label>
<div style="margin-top: 10px; margin-bottom: 5px;">
<span class="badge badge-sm badge-success" v-if="isWishlistShared">
{{ __('shop::app.customer.account.wishlist.public') }}
</span>
<span class="badge badge-sm badge-danger" v-else>
{{ __('shop::app.customer.account.wishlist.private') }}
</span>
</div>
</div>
<div class="control-group">
<label class="required">{{ __('shop::app.customer.account.wishlist.shared-link') }}</label>
<div style="margin-top: 10px; margin-bottom: 5px;">
<div class="input-group" v-if="isWishlistShared">
<input
type="text"
class="control"
v-model="wishlistSharedLink"
v-on:focus="$event.target.select()"
ref="sharedLink"
/>
<div class="input-group-append">
<button
class="btn btn-primary btn-md"
type="button"
@click="copyToClipboard"
>
{{ __('shop::app.customer.account.wishlist.copy') }}
</button>
</div>
</div>
<p class="alert alert-danger" v-else>
{{ __('shop::app.customer.account.wishlist.enable-wishlist-info') }}
</p>
</div>
</div>
</form>
</script>
<script>
/**
* Show share wishlist modal.
@ -131,6 +147,50 @@
window.app.showModal('shareWishlist');
}
Vue.component('share-component', {
template: '#share-component-template',
inject: ['$validator'],
data: function () {
return {
isWishlistShared: parseInt("{{ $isWishlistShared }}"),
wishlistSharedLink: "{{ $wishlistSharedLink }}",
}
},
methods: {
shareWishlist: function(val) {
var self = this;
this.$root.showLoader();
this.$http.post("{{ route('customer.wishlist.share') }}", {
shared: val
})
.then(function(response) {
self.$root.hideLoader();
self.isWishlistShared = response.data.isWishlistShared;
self.wishlistSharedLink = response.data.wishlistSharedLink;
})
.catch(function (error) {
self.$root.hideLoader();
window.location.reload();
})
},
copyToClipboard: function() {
this.$refs.sharedLink.focus();
document.execCommand('copy');
}
}
});
</script>
@endif

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=4dc59bc61e8f3eff9489",
"/css/ui.css": "/css/ui.css?id=c8a7ade09358a1d61a4a"
"/js/ui.js": "/js/ui.js?id=a13fbc5b58c0a7b9c6ee",
"/css/ui.css": "/css/ui.css?id=73b0d27c55027b8c1e81"
}

View File

@ -21,9 +21,9 @@
var body = document.querySelector("body");
if (this.isOpen) {
body.classList.add("modal-open");
body.classList.add("loader-open");
} else {
body.classList.remove("modal-open");
body.classList.remove("loader-open");
}
}
}

View File

@ -865,6 +865,68 @@ h5 {
display: inline-block;
}
}
&.input-group {
margin-bottom: 0;
}
.input-group {
position: relative;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-align: stretch;
-ms-flex-align: stretch;
align-items: stretch;
width: 100%;
.input-group-append,
.input-group-prepend {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
> .control {
margin: 0;
position: relative;
-webkit-box-flex: 1;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
width: 1% !important;
&:not(:first-child) {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
&:not(:last-child) {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
}
.input-group-prepend {
margin-right: -1px;
.control,
.btn {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
}
.input-group-append {
margin-left: -1px;
.control,
.btn {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
}
}
}
.table {
@ -1203,6 +1265,10 @@ modal {
overflow: hidden;
}
.loader-open {
overflow: hidden;
}
.modal-overlay {
display: none;
overflow-y: auto;
@ -1220,6 +1286,10 @@ modal {
display: block;
}
.loader-open .loader-overlay {
display: block;
}
.modal-container {
background: $white-color;
top: 100px;
@ -1425,7 +1495,7 @@ modal {
.overlay-loader {
position: fixed;
z-index: 11;
z-index: 10000;
top: 50%;
left: 50%;
margin-top: -24px;

View File

@ -70,62 +70,7 @@
<i class="rango-close"></i>
<div slot="body">
<form method="POST" action="{{ route('customer.wishlist.share') }}">
@csrf
<div class="row">
<div class="col-12">
<label class="mandatory">
{{ __('shop::app.customer.account.wishlist.wishlist-sharing') }}
</label>
<select name="shared" class="form-control">
<option value="0" {{ $isWishlistShared ? '' : 'selected="selected"' }}>{{ __('shop::app.customer.account.wishlist.disable') }}</option>
<option value="1" {{ $isWishlistShared ? 'selected="selected"' : '' }}>{{ __('shop::app.customer.account.wishlist.enable') }}</option>
</select>
</div>
</div>
<div class="row mt-2">
<div class="col-12">
<label class="mandatory">
{{ __('shop::app.customer.account.wishlist.visibility') }}
</label>
<div>
@if ($isWishlistShared)
<span class="badge badge-success">{{ __('shop::app.customer.account.wishlist.public') }}</span>
@else
<span class="badge badge-danger">{{ __('shop::app.customer.account.wishlist.private') }}</span>
@endif
</div>
</div>
</div>
<div class="row mt-2">
<div class="col-12">
<label class="mandatory">
{{ __('shop::app.customer.account.wishlist.shared-link') }}
</label>
<div>
@if ($isWishlistShared)
<a href="{{ $wishlistSharedLink ?? 'javascript:void(0);' }}" target="_blank">{{ $wishlistSharedLink }}</a>
@else
<p class="alert alert-danger">{{ __('shop::app.customer.account.wishlist.enable-wishlist-info') }}</p>
@endif
</div>
</div>
</div>
<div class="row mt-2">
<div class="col-12">
<button type="submit" class="theme-btn float-right">
{{ __('shop::app.customer.account.wishlist.save') }}
</button>
</div>
</div>
</form>
<share-component></share-component>
</div>
</modal>
</div>
@ -136,6 +81,70 @@
@push('scripts')
@if($isSharingEnabled)
<script type="text/x-template" id="share-component-template">
<form method="POST">
@csrf
<div class="form-group">
<label class="label-style mandatory">
{{ __('shop::app.customer.account.wishlist.wishlist-sharing') }}
</label>
<select name="shared" class="form-control" @change="shareWishlist($event.target.value)">
<option value="0" :selected="! isWishlistShared">{{ __('shop::app.customer.account.wishlist.disable') }}</option>
<option value="1" :selected="isWishlistShared">{{ __('shop::app.customer.account.wishlist.enable') }}</option>
</select>
</div>
<div class="form-group">
<label class="label-style mandatory">
{{ __('shop::app.customer.account.wishlist.visibility') }}
</label>
<div>
<span class="badge badge-success" v-if="isWishlistShared">
{{ __('shop::app.customer.account.wishlist.public') }}
</span>
<span class="badge badge-danger" v-else>
{{ __('shop::app.customer.account.wishlist.private') }}
</span>
</div>
</div>
<div class="form-group">
<label class="label-style mandatory">
{{ __('shop::app.customer.account.wishlist.shared-link') }}
</label>
<div class="input-group" v-if="isWishlistShared">
<input
type="text"
class="form-control"
v-model="wishlistSharedLink"
v-on:focus="$event.target.select()"
ref="sharedLink"
/>
<div class="input-group-append">
<button
class="btn btn-outline-secondary theme-btn"
style="padding: 6px 20px"
type="button"
@click="copyToClipboard"
>
{{ __('shop::app.customer.account.wishlist.copy') }}
</button>
</div>
</div>
<p class="alert alert-danger" v-else>
{{ __('shop::app.customer.account.wishlist.enable-wishlist-info') }}
</p>
</div>
</form>
</script>
<script>
/**
* Show share wishlist modal.
@ -145,6 +154,50 @@
window.app.showModal('shareWishlist');
}
Vue.component('share-component', {
template: '#share-component-template',
inject: ['$validator'],
data: function () {
return {
isWishlistShared: parseInt("{{ $isWishlistShared }}"),
wishlistSharedLink: "{{ $wishlistSharedLink }}",
}
},
methods: {
shareWishlist: function(val) {
var self = this;
this.$root.showLoader();
this.$http.post("{{ route('customer.wishlist.share') }}", {
shared: val
})
.then(function(response) {
self.$root.hideLoader();
self.isWishlistShared = response.data.isWishlistShared;
self.wishlistSharedLink = response.data.wishlistSharedLink;
})
.catch(function (error) {
self.$root.hideLoader();
window.location.reload();
})
},
copyToClipboard: function() {
this.$refs.sharedLink.focus();
document.execCommand('copy');
}
}
});
</script>
@endif

41
public/installer/Seeder.php Executable file
View File

@ -0,0 +1,41 @@
<?php
/* max execution time limit */
ini_set('max_execution_time', 900);
/* php bin path */
$phpbin = PHP_BINDIR . '/php';
/* commands sequence */
$commands = [
'seeder' => [
'key' => 'seeder_results',
'command' => 'cd ../.. && '. $phpbin .' artisan db:seed 2>&1'
],
'publish' => [
'key' => 'publish_results',
'command' => 'cd ../.. && '. $phpbin .' artisan bagisto:publish --force 2>&1'
],
'storage_link' => [
'key' => 'storage_link_results',
'command' => 'cd ../.. && '. $phpbin .' artisan storage:link 2>&1'
],
'key' => [
'key' => 'key_results',
'command' => 'cd ../.. && '. $phpbin .' artisan key:generate 2>&1'
],
'optimize' => [
'key' => 'optimize_results',
'command' => 'cd ../.. && '. $phpbin .' artisan optimize 2>&1'
],
];
// run command on terminal
$data = [];
foreach ($commands as $key => $value) {
exec($value['command'], $data[$key], $data[$value['key']]);
}
// return a response
// return all our data to an AJAX call
echo json_encode($data);