diff --git a/apps/storefront/src/main.css b/apps/storefront/src/main.css
index e0474c1d..7eba28aa 100644
--- a/apps/storefront/src/main.css
+++ b/apps/storefront/src/main.css
@@ -116,7 +116,7 @@ input[type=number]::-webkit-outer-spin-button
}
#shoppingListBtn {
- padding: 10px 15px;
+ padding: 9px 15px;
display: inline-block;
cursor: pointer;
background-color: transparent;
@@ -126,3 +126,8 @@ input[type=number]::-webkit-outer-spin-button
border-radius: 4px;
border: 1px solid #a18568;
}
+
+#add-to-cart-wrapper .form-action {
+ display: flex;
+ align-items: self-start;
+}
diff --git a/apps/storefront/src/pages/orderDetail/components/CreateShoppingList.tsx b/apps/storefront/src/pages/orderDetail/components/CreateShoppingList.tsx
index 5126b29a..3954534b 100644
--- a/apps/storefront/src/pages/orderDetail/components/CreateShoppingList.tsx
+++ b/apps/storefront/src/pages/orderDetail/components/CreateShoppingList.tsx
@@ -97,6 +97,12 @@ const CreateShoppingList = ({
const handleConfirm = () => {
handleSubmit(async (data) => {
setLoading(true)
+ const {
+ description,
+ } = data
+ if (description.indexOf('\n') > -1) {
+ data.description = description.split('\n').join('\\n')
+ }
const createShoppingData = {
...data,
status: 0,
diff --git a/apps/storefront/src/pages/shoppingLists/ShoppingListsCard.tsx b/apps/storefront/src/pages/shoppingLists/ShoppingListsCard.tsx
index 1d975a20..6ff6bd97 100644
--- a/apps/storefront/src/pages/shoppingLists/ShoppingListsCard.tsx
+++ b/apps/storefront/src/pages/shoppingLists/ShoppingListsCard.tsx
@@ -63,8 +63,17 @@ const ShoppingListsCard = (props: OrderItemCardProps) => {
role,
} = props
- const getPermissions = (status: number) => {
- if (role === 2) {
+ const getEditPermissions = (status: number) => {
+ if (+role === 2) {
+ if (status === 30 || status === 0) return false
+ return true
+ }
+
+ return false
+ }
+
+ const getDeletePermissions = (status: number) => {
+ if (+role === 2) {
if (status === 20 || status === 30) return false
return true
}
@@ -106,11 +115,16 @@ const ShoppingListsCard = (props: OrderItemCardProps) => {
>
-
+
{
shoppingList.description
}
-
+
@@ -151,7 +165,7 @@ const ShoppingListsCard = (props: OrderItemCardProps) => {
}}
>
{
- !getPermissions(shoppingList.status) && (
+ !getEditPermissions(shoppingList.status) && (
{
{
- !getPermissions(shoppingList.status) && (
+ !getDeletePermissions(shoppingList.status) && (
{
+const removeElement = (_element: CustomFieldItems) => {
const _parentElement = _element.parentNode
if (_parentElement) {
_parentElement.removeChild(_element)
@@ -12,11 +12,12 @@ const removeElement = (_element: any) => {
export const useB3PDPOpen = (el: string, cd: () => void, isB2BUser: boolean, role: string | number) => {
useEffect(() => {
const addToCartAll = document.querySelectorAll(el)
- let shoppingBtnDom: any = null
+ const wishlistSdd = document.querySelector('form[data-wishlist-add]')
+ let shoppingBtnDom: CustomFieldItems | null = null
if (!addToCartAll.length) return
if (document.querySelectorAll('#shoppingListBtn').length) return
if (isB2BUser && (+role === 0 || +role === 1)) {
- addToCartAll.forEach((node: any) => {
+ addToCartAll.forEach((node: CustomFieldItems) => {
shoppingBtnDom = document.createElement('div')
shoppingBtnDom.setAttribute('id', 'shoppingListBtn')
shoppingBtnDom.innerHTML = 'Add to Shopping List'
@@ -25,11 +26,13 @@ export const useB3PDPOpen = (el: string, cd: () => void, isB2BUser: boolean, rol
capture: true,
})
})
+ if (wishlistSdd) (wishlistSdd as CustomFieldItems).style.display = 'none'
} else {
const shoppingListBtn = document.querySelectorAll('#shoppingListBtn')
shoppingListBtn.forEach((item: any) => {
removeElement(item)
})
+ if (wishlistSdd) (wishlistSdd as CustomFieldItems).style.display = 'block'
}
return () => {