Merge pull request #5999 from jitendra-webkul/master

Issue #5976 fixed
This commit is contained in:
Jitendra Singh 2022-03-11 20:23:07 +05:30 committed by GitHub
commit c422b7ee9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 263 additions and 184 deletions

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 +1 @@
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[847],{4047:(e,t,n)=>{var o=n(538),i=n(9669),a=n.n(i);function r(){return document.querySelector('meta[name="base-url"]').content}function c(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i|/mobi/i.test(navigator.userAgent)}function s(e,t){var n=document.createElement("script");n.setAttribute("src",e),document.body.appendChild(n),n.addEventListener("load",t,!1)}function d(e){return e.replace(/\/$/,"")}o.default.prototype.$http=a(),window.Vue=o.default,window.eventBus=new o.default,window.axios=a(),window.jQuery=window.$=n(9755),window.BootstrapSass=n(3002),window.lazySize=n(7090),window.getBaseUrl=r,window.isMobile=c,window.loadDynamicScript=s,window.showAlert=function(e,t,n){if(e&&""!==n){var o=Math.floor(1e3*Math.random()),i='<div class="alert '.concat(e,' alert-dismissible" id="').concat(o,'">\n <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>\n <strong>').concat(t?t+"!":""," </strong> ").concat(n,".\n </div>");$("#alert-container").append(i).ready((function(){window.setTimeout((function(){$("#alert-container #".concat(o)).remove()}),5e3)}))}},$((function(){var e=r(),t="themes/velocity/assets/js/velocity.js";c()&&d(e)===d(window.location.href)?document.addEventListener("touchstart",(function n(){var o=this;window.scrollTo(0,0),document.body.style.overflow="hidden",s("".concat(e,"/").concat(t),(function(){window.scrollTo(0,0),document.body.style.overflow="",o.removeEventListener("touchstart",n)}))}),!1):s("".concat(e,"/").concat(t),(function(){}))}))}},e=>{e.O(0,[339],(()=>{return t=4047,e(e.s=t);var t}));e.O()}]);
(self.webpackChunk=self.webpackChunk||[]).push([[847],{4047:(o,t,n)=>{"use strict";var e=n(538),d=n(9669),r=n.n(d);function a(){return document.querySelector('meta[name="base-url"]').content}function i(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i|/mobi/i.test(navigator.userAgent)}function s(o,t){var n=document.createElement("script");n.setAttribute("src",o),document.body.appendChild(n),n.addEventListener("load",t,!1)}function l(o){return o.replace(/\/$/,"")}e.default.prototype.$http=r(),window.Vue=e.default,window.eventBus=new e.default,window.axios=r(),window.jQuery=window.$=n(9755),n(3353),window.BootstrapSass=n(3002),window.lazySize=n(7090),window.getBaseUrl=a,window.isMobile=i,window.loadDynamicScript=s,window.showAlert=function(o,t,n){if(o&&""!==n){var e=Math.floor(1e3*Math.random()),d='<div class="alert '.concat(o,' alert-dismissible" id="').concat(e,'">\n <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>\n <strong>').concat(t?t+"!":""," </strong> ").concat(n,".\n </div>");$("#alert-container").append(d).ready((function(){window.setTimeout((function(){$("#alert-container #".concat(e)).remove()}),5e3)}))}},$((function(){var o=a(),t="themes/velocity/assets/js/velocity.js";i()&&l(o)===l(window.location.href)?document.addEventListener("touchstart",(function n(){var e=this;window.scrollTo(0,0),document.body.style.overflow="hidden",s("".concat(o,"/").concat(t),(function(){window.scrollTo(0,0),document.body.style.overflow="",e.removeEventListener("touchstart",n)}))}),!1):s("".concat(o,"/").concat(t),(function(){}))}))},3353:()=>{$((function(){function o(){if(dropdown=$(".dropdown-open"),!dropdown.find(".dropdown-list").hasClass("top-left")&&!dropdown.find(".dropdown-list").hasClass("top-right")&&dropdown.length){dropdown=dropdown.find(".dropdown-list"),height=dropdown.height()+50;var o=dropdown.offset().top-70,t=$(window).height()-o-dropdown.height();t>o||height<t?(dropdown.removeClass("bottom"),dropdown.hasClass("top-right")?(dropdown.removeClass("top-right"),dropdown.addClass("bottom-right")):dropdown.hasClass("top-left")&&(dropdown.removeClass("top-left"),dropdown.addClass("bottom-left"))):dropdown.hasClass("bottom-right")?(dropdown.removeClass("bottom-right"),dropdown.addClass("top-right")):dropdown.hasClass("bottom-left")&&(dropdown.removeClass("bottom-left"),dropdown.addClass("top-left"))}}$(document).click((function(o){var t=o.target;(!$(t).parents(".dropdown-open").length||$(t).is("li")||$(t).is("a"))&&($(".dropdown-list").hide(),$(".dropdown-toggle").removeClass("active"))})),$("body").delegate(".dropdown-toggle","click",(function(t){t.stopImmediatePropagation(),function(t){var n=$(t.currentTarget);$(".dropdown-list").hide(),n.hasClass("active")?n.removeClass("active"):(n.addClass("active"),n.parent().find(".dropdown-list").fadeIn(100),n.parent().addClass("dropdown-open"),o())}(t)})),$("div").scroll((function(){o()}))}))}},o=>{o.O(0,[339],(()=>{return t=4047,o(o.s=t);var t}));o.O()}]);

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,10 @@
{
"/js/jquery-ez-plus.js": "/js/jquery-ez-plus.js?id=ba3c7cada62de152fd8fce211d0b1b70",
"/js/velocity-core.js": "/js/velocity-core.js?id=8010dfb021a49555afa74bf3bf25b33e",
"/js/velocity.js": "/js/velocity.js?id=df31908bee05eab66fcc3860ec83c3c5",
"/js/velocity-core.js": "/js/velocity-core.js?id=73cc7c3501570ebe9151c72d954bd97d",
"/js/velocity.js": "/js/velocity.js?id=55636a4712a92343ed0aae87a4b88dbb",
"/js/manifest.js": "/js/manifest.js?id=3cded37ef514b0fb89b10e7109801248",
"/js/components.js": "/js/components.js?id=7e5f4737e2e5faffbeaf2a2d78e64147",
"/css/velocity.css": "/css/velocity.css?id=3805fc802200a36aff3466b5fb9f67aa",
"/js/components.js": "/js/components.js?id=aa38c7c0c1db2c698155567aacf379d2",
"/css/velocity.css": "/css/velocity.css?id=c3f8667508711413ddd1d34b655de727",
"/css/velocity-admin.css": "/css/velocity-admin.css?id=b67a82956e53163b5e3ff45a44f9778f",
"/images/icon-calendar.svg": "/images/icon-calendar.svg?id=870d0f733a58377422766f3152e15486",
"/images/icon-camera.svg": "/images/icon-camera.svg?id=b2fd2f9e17e1ccee96e29f6c6cec91e8",

View File

@ -1,14 +1,21 @@
<template>
<div :class="`dropdown ${cartItems.length > 0 ? '' : 'disable-active'}`">
<mini-cart-button
:item-count="cartItems.length"
:cart-text="cartText"
></mini-cart-button>
<div class="dropdown-toggle btn btn-link" id="mini-cart" :class="{'cursor-not-allowed': ! cartItems.length}">
<div class="mini-cart-content">
<i class="material-icons-outlined text-down-3">shopping_cart</i>
<span class="badge" v-text="cartItems.length" v-if="cartItems.length != 0"></span>
<span class="fs18 fw6 cart-text" v-text="cartText"></span>
</div>
<div class="down-arrow-container">
<span class="rango-arrow-down"></span>
</div>
</div>
<div
id="cart-modal-content"
v-if="cartItems.length > 0"
class="modal-content sensitive-modal cart-modal-content hide"
class="modal-content dropdown-list sensitive-modal cart-modal-content"
:class="{hide: ! cartItems.length}"
>
<div class="mini-cart-container">
<div

View File

@ -32,6 +32,8 @@ window.axios = axios;
// TODO once every package is migrated to laravel-mix 6, this can be removed safely (jquery will be injected when needed)
window.jQuery = window.$ = require('jquery');
require('./dropdown.js');
window.BootstrapSass = require('bootstrap-sass');
window.lazySize = require('lazysizes');

View File

@ -377,16 +377,6 @@ $(function() {
hideLoader: function() {
this.loading = false;
},
togglePopup: function() {
let accountModal = $('#account-modal');
let modal = $('#cart-modal-content');
if (modal) modal.addClass('hide');
accountModal.toggleClass('hide');
},
}
});
});

View File

@ -0,0 +1,67 @@
$(function() {
$(document).click(function(e) {
var target = e.target;
if (! $(target).parents('.dropdown-open').length || $(target).is('li') || $(target).is('a')) {
$('.dropdown-list').hide();
$('.dropdown-toggle').removeClass('active');
}
});
$('body').delegate('.dropdown-toggle', 'click', function(e) {
e.stopImmediatePropagation();
toggleDropdown(e);
});
function toggleDropdown(e) {
var currentElement = $(e.currentTarget);
$('.dropdown-list').hide();
if (currentElement.hasClass('active')) {
currentElement.removeClass('active');
} else {
currentElement.addClass('active');
currentElement.parent().find('.dropdown-list').fadeIn(100);
currentElement.parent().addClass('dropdown-open');
autoDropupDropdown();
}
}
function autoDropupDropdown() {
dropdown = $(".dropdown-open");
if (! dropdown.find('.dropdown-list').hasClass('top-left') && ! dropdown.find('.dropdown-list').hasClass('top-right') && dropdown.length) {
dropdown = dropdown.find('.dropdown-list');
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')) {
dropdown.removeClass('top-right')
dropdown.addClass('bottom-right')
} else if(dropdown.hasClass('top-left')) {
dropdown.removeClass('top-left')
dropdown.addClass('bottom-left')
}
} else {
if(dropdown.hasClass('bottom-right')) {
dropdown.removeClass('bottom-right')
dropdown.addClass('top-right')
} else if(dropdown.hasClass('bottom-left')) {
dropdown.removeClass('bottom-left')
dropdown.addClass('top-left')
}
}
}
}
$('div').scroll(function() {
autoDropupDropdown()
});
});

View File

@ -221,42 +221,9 @@ body {
}
}
+ .account-modal {
.dropdown-list {
top: 40px;
right: 10px;
z-index: 101;
height: max-content;
width: 290px !important;
position: absolute !important;
.theme-btn {
padding: 0.5rem 0.9rem;
}
.modal-footer {
justify-content: unset;
}
.modal-content {
top: 0;
padding: 0;
ul {
li {
&:hover {
background-color: $border-light;
}
a {
padding: 10px 20px;
}
&:last-child {
margin-bottom: 5px;
}
}
}
}
}
}
@ -505,6 +472,7 @@ header {
height: 50px;
padding: 5px 17px;
display: inline-block;
cursor: pointer;
#mini-cart {
.mini-cart-content {

View File

@ -1,25 +1,6 @@
@import '../main/mixins';
@import '../main/_variables';
.dropdown-toggle {
position: relative;
}
.dropdown-toggle::after {
position: absolute;
right: 10px;
top: 16px;
}
.rtl {
.dropdown-toggle::after {
position: absolute;
left: 22px;
top: 16px;
right: unset;
}
}
.table {
width: 100%;
@ -224,39 +205,104 @@
}
}
.dropdown-toggle::after {
display: none;
}
.dropdown-list {
width: 200px;
margin-bottom: 20px;
box-shadow: 0 2px 4px 0 rgb(0 0 0 / 16%), 0 0 9px 0 rgb(0 0 0 / 16%);
border-radius: 3px;
background-color: #ffffff;
@include box-shadow(
0 2px 4px 0 rgba(0, 0, 0, 0.16),
0 0 9px 0 rgba(0, 0, 0, 0.16)
);
@include border-radius(3px);
background-color: $white-color;
position: absolute;
display: none;
z-index: 10;
z-index: 1000;
text-align: left;
&.dropdown-container {
padding: 15px;
&.bottom-left {
top: 42px;
left: 0px;
}
&.bottom-right {
top: 42px;
right: 0px;
}
&.top-left {
bottom: 0px;
left: 42px;
}
&.top-right {
bottom: 0px;
right: 42px;
}
.dropdown-label {
padding: 8px 12px;
display: block;
cursor: default;
color: #a2a2a2;
font-size: 18px;
border-bottom: 1px solid #C1C2C3;
}
.dropdown-container {
overflow-y: auto;
label {
font-size: 15px;
display: inline-block;
text-transform: uppercase;
color: #9e9e9e;
font-weight: 700;
padding-bottom: 5px;
}
ul {
list-style: none;
margin: 0px;
padding: 0px;
list-style-type: none;
li {
list-style: none !important;
&:last-child {
margin-bottom: 5px;
}
.control-group {
margin-bottom: 15px;
display: block;
a {
padding: 8px 12px;
.control {
margin-bottom: 15px;
&:link,
&:active,
&:visited,
&:focus {
color: $font-color;
display: block;
}
&:hover {
background-color: $border-light;
}
}
.control-group label {
color: $font-color;
font-size: 15px;
font-weight: 500;
text-transform: capitalize;
width: 100%;
}
}
}
.apply-filter {
padding: 10px;
.btn {
width: 100%;
margin-top: 10px;
}
}
}

View File

@ -1,99 +1,98 @@
{!! view_render_event('bagisto.shop.layout.header.account-item.before') !!}
<div class="dropdown">
<div id="account">
<div class="d-inline-block welcome-content" @click="togglePopup">
<i class="material-icons align-vertical-top">perm_identity</i>
<div id="account">
<div class="d-inline-block welcome-content dropdown-toggle">
<i class="material-icons align-vertical-top">perm_identity</i>
<span class="text-center">
@guest('customer')
{{ __('velocity::app.header.welcome-message', ['customer_name' => trans('velocity::app.header.guest')]) }}!
@endguest
<span class="text-center">
{{ __('velocity::app.header.welcome-message', [
'customer_name' => auth()->guard('customer')->user()
? auth()->guard('customer')->user()->first_name
: trans('velocity::app.header.guest')
]
)
}}
</span>
@auth('customer')
{{ __('velocity::app.header.welcome-message', ['customer_name' => auth()->guard('customer')->user()->first_name]) }}
@endauth
</span>
<span class="select-icon rango-arrow-down"></span>
</div>
</div>
<div id="account-modal" class="account-modal sensitive-modal hide mt5">
@guest('customer')
<div class="modal-content">
<div class="modal-header no-border pb0">
<label class="fs18 grey">{{ __('shop::app.header.title') }}</label>
<button type="button" class="close disable-box-shadow" data-dismiss="modal" aria-label="Close" @click="togglePopup">
<span aria-hidden="true" class="white-text fs20">×</span>
</button>
</div>
<div class="pl10 fs14">
<p>{{ __('shop::app.header.dropdown-text') }}</p>
</div>
<div class="modal-footer">
<div>
<a href="{{ route('customer.session.index') }}">
<button
type="button"
class="theme-btn fs14 fw6">
{{ __('shop::app.header.sign-in') }}
</button>
</a>
</div>
<div>
<a href="{{ route('customer.register.index') }}">
<button
type="button"
class="theme-btn fs14 fw6">
{{ __('shop::app.header.sign-up') }}
</button>
</a>
</div>
</div>
</div>
@endguest
@auth('customer')
<div class="modal-content customer-options">
<div class="customer-session">
<label class="">
{{ auth()->guard('customer')->user()->first_name }}
</label>
</div>
<ul type="none">
<li>
<a href="{{ route('customer.profile.index') }}" class="unset">{{ __('shop::app.header.profile') }}</a>
</li>
<li>
<a href="{{ route('customer.orders.index') }}" class="unset">{{ __('velocity::app.shop.general.orders') }}</a>
</li>
<li>
<form id="customerLogout" action="{{ route('customer.session.destroy') }}" method="POST">
@csrf
@method('DELETE')
</form>
<a
class="unset"
href="{{ route('customer.session.destroy') }}"
onclick="event.preventDefault(); document.getElementById('customerLogout').submit();">
{{ __('shop::app.header.logout') }}
</a>
</li>
</ul>
</div>
@endauth
</div>
<span class="rango-arrow-down"></span>
</div>
@guest('customer')
<div class="dropdown-list" style="width: 290px">
<div class="modal-content dropdown-container">
<div class="modal-header no-border pb0">
<label class="fs18 grey">{{ __('shop::app.header.title') }}</label>
</div>
<div class="pl10 fs14">
<p>{{ __('shop::app.header.dropdown-text') }}</p>
</div>
<div class="modal-footer">
<a href="{{ route('customer.session.index') }}" class="theme-btn fs14 fw6">
{{ __('shop::app.header.sign-in') }}
</a>
<a href="{{ route('customer.register.index') }}" class="theme-btn fs14 fw6">
{{ __('shop::app.header.sign-up') }}
</a>
</div>
</div>
</div>
@endguest
@auth('customer')
<div class="dropdown-list">
<div class="dropdown-label">
{{ auth()->guard('customer')->user()->first_name }}
</div>
<div class="dropdown-container">
<ul type="none">
<li>
<a href="{{ route('customer.profile.index') }}" class="unset">{{ __('shop::app.header.profile') }}</a>
</li>
<li>
<a href="{{ route('customer.orders.index') }}" class="unset">{{ __('velocity::app.shop.general.orders') }}</a>
</li>
@php
$showCompare = core()->getConfigData('general.content.shop.compare_option') == "1" ? true : false;
$showWishlist = core()->getConfigData('general.content.shop.wishlist_option') == "1" ? true : false;
@endphp
@if ($showWishlist)
<li>
<a href="{{ route('customer.wishlist.index') }}" class="unset">{{ __('shop::app.header.wishlist') }}</a>
</li>
@endif
@if ($showCompare)
<li>
<a href="{{ route('velocity.customer.product.compare') }}" class="unset">{{ __('velocity::app.customer.compare.text') }}</a>
</li>
@endif
<li>
<form id="customerLogout" action="{{ route('customer.session.destroy') }}" method="POST">
@csrf
@method('DELETE')
</form>
<a
class="unset"
href="{{ route('customer.session.destroy') }}"
onclick="event.preventDefault(); document.getElementById('customerLogout').submit();">
{{ __('shop::app.header.logout') }}
</a>
</li>
</ul>
</div>
</div>
@endauth
</div>
{!! view_render_event('bagisto.shop.layout.header.account-item.after') !!}