ok
This commit is contained in:
@@ -22,6 +22,7 @@ import { ThreeDots } from "react-loader-spinner";
|
||||
import { getLocalStorage, updateLocalStorage, removeLocalStorage } from "../helpers/localStorageHelpers";
|
||||
import { unsubscribeUser } from "../helpers/subscribeHelpers.js";
|
||||
import WelcomePage from "./WelcomePage.js";
|
||||
import { useNavigationHelpers } from "../helpers/navigationHelpers";
|
||||
|
||||
function CafePage({
|
||||
shopId,
|
||||
@@ -40,14 +41,22 @@ function CafePage({
|
||||
removeConnectedGuestSides,
|
||||
setModal,
|
||||
loading,
|
||||
queue
|
||||
queue,
|
||||
cartItemsLength,
|
||||
totalPrice
|
||||
}) {
|
||||
|
||||
|
||||
const {
|
||||
goToCart
|
||||
} = useNavigationHelpers(shopId, table.tableCode);
|
||||
|
||||
const location = useLocation();
|
||||
const [searchParams] = useSearchParams();
|
||||
const token = searchParams.get("token");
|
||||
const { shopIdentifier, tableCode } = useParams();
|
||||
sendParam({ shopIdentifier, tableCode });
|
||||
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [screenMessage, setScreenMessage] = useState("");
|
||||
@@ -140,10 +149,10 @@ function CafePage({
|
||||
|
||||
const moveItemTypeHandler = async (itemTypeId, direction, index) => {
|
||||
const previousItems = [...shopItems];
|
||||
|
||||
|
||||
// Update local state immediately
|
||||
const newItems = [...shopItems];
|
||||
|
||||
|
||||
let targetIndex;
|
||||
if (direction === 'up' && index > 0) {
|
||||
targetIndex = index - 1;
|
||||
@@ -157,9 +166,9 @@ function CafePage({
|
||||
[newItems[index], newItems[targetIndex]] = [newItems[targetIndex], newItems[index]];
|
||||
newItems[index].order = targetIndex;
|
||||
newItems[targetIndex].order = index;
|
||||
|
||||
|
||||
setShopItems(newItems);
|
||||
|
||||
|
||||
// Call the API to move the item type
|
||||
try {
|
||||
await moveItemType(itemTypeId, previousItems[targetIndex].itemTypeId, index, targetIndex);
|
||||
@@ -170,7 +179,7 @@ function CafePage({
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
if (loading)
|
||||
return (
|
||||
<div className="Loader">
|
||||
@@ -235,54 +244,74 @@ function CafePage({
|
||||
beingEditedType={beingEditedType}
|
||||
setBeingEditedType={setBeingEditedType}
|
||||
/>
|
||||
|
||||
{/* <div style={{ marginTop: "15px" }}></div> */}
|
||||
{shopItems
|
||||
.filter(
|
||||
(itemType) =>
|
||||
filterId == 0 || itemType.itemTypeId === filterId
|
||||
)
|
||||
.map((itemType, index) => (
|
||||
<ItemLister
|
||||
index={index}
|
||||
indexTotal={shopItems.length}
|
||||
shopId={shopId}
|
||||
shopOwnerId={shopOwnerId}
|
||||
user={user}
|
||||
key={itemType.itemTypeId}
|
||||
itemTypeId={itemType.itemTypeId}
|
||||
typeName={itemType.name}
|
||||
typeImage={itemType.image}
|
||||
setShopItems={setShopItems}
|
||||
itemList={itemType.itemList}
|
||||
typeVisibility={itemType.visibility}
|
||||
moveItemTypeUp={(e)=>moveItemTypeHandler(e,'up', index)}
|
||||
moveItemTypeDown={(e)=>moveItemTypeHandler(e, 'down', index)}
|
||||
isEditMode={isEditMode}
|
||||
beingEditedType={beingEditedType}
|
||||
setBeingEditedType={setBeingEditedType}
|
||||
raw={isEditMode || filterId == 0 ? false : true}
|
||||
handleCreateItem={(
|
||||
itemTypeID,
|
||||
name,
|
||||
price,
|
||||
selectedImage,
|
||||
description
|
||||
) =>
|
||||
createItem(
|
||||
shopId,
|
||||
<div>
|
||||
{shopItems
|
||||
.filter(
|
||||
(itemType) =>
|
||||
filterId == 0 || itemType.itemTypeId === filterId
|
||||
)
|
||||
.map((itemType, index) => (
|
||||
<ItemLister
|
||||
index={index}
|
||||
indexTotal={shopItems.length}
|
||||
shopId={shopId}
|
||||
shopOwnerId={shopOwnerId}
|
||||
user={user}
|
||||
key={itemType.itemTypeId}
|
||||
itemTypeId={itemType.itemTypeId}
|
||||
typeName={itemType.name}
|
||||
typeImage={itemType.image}
|
||||
setShopItems={setShopItems}
|
||||
itemList={itemType.itemList}
|
||||
typeVisibility={itemType.visibility}
|
||||
moveItemTypeUp={(e) => moveItemTypeHandler(e, 'up', index)}
|
||||
moveItemTypeDown={(e) => moveItemTypeHandler(e, 'down', index)}
|
||||
isEditMode={isEditMode}
|
||||
beingEditedType={beingEditedType}
|
||||
setBeingEditedType={setBeingEditedType}
|
||||
raw={isEditMode || filterId == 0 ? false : true}
|
||||
handleCreateItem={(
|
||||
itemTypeID,
|
||||
name,
|
||||
price,
|
||||
selectedImage,
|
||||
itemTypeID,
|
||||
description
|
||||
)
|
||||
}
|
||||
handleUpdateItem={(itemId, name, price, selectedImage, description, promoPrice) =>
|
||||
updateItem(itemId, name, price, selectedImage, description, promoPrice)
|
||||
}
|
||||
/>
|
||||
))}
|
||||
) =>
|
||||
createItem(
|
||||
shopId,
|
||||
name,
|
||||
price,
|
||||
selectedImage,
|
||||
itemTypeID,
|
||||
description
|
||||
)
|
||||
}
|
||||
handleUpdateItem={(itemId, name, price, selectedImage, description, promoPrice) =>
|
||||
updateItem(itemId, name, price, selectedImage, description, promoPrice)
|
||||
}
|
||||
/>
|
||||
))}
|
||||
{ }
|
||||
{cartItemsLength > 0 &&
|
||||
<div style={{ marginTop: '10px', height: '40px', position: 'sticky', bottom: '40px', display: 'flex', justifyContent: 'center', alignItems: 'center', textAlign: 'center' }}>
|
||||
|
||||
<div onClick={goToCart} style={{ backgroundColor: 'rgb(142, 199, 129)', width: '70vw', height: '40px', borderRadius: '30px', display: 'flex', justifyContent: 'space-between', padding: '0 20px' }}>
|
||||
<div style={{ display: 'flex', flexWrap: 'wrap', alignContent: 'center' }}>{cartItemsLength} item</div>
|
||||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'flex-end', width: '130px' }}>
|
||||
<span style={{ whiteSpace: 'nowrap' }}>Rp{totalPrice}</span>
|
||||
<div style={{ display: 'flex', alignItems: 'center', marginLeft: '5px', width: '30px' }}>
|
||||
<svg viewBox="0 0 34 34" style={{ fill: 'white', marginTop: '4px' }}>
|
||||
<path d="M9.79175 24.75C8.09591 24.75 6.72383 26.1375 6.72383 27.8333C6.72383 29.5292 8.09591 30.9167 9.79175 30.9167C11.4876 30.9167 12.8751 29.5292 12.8751 27.8333C12.8751 26.1375 11.4876 24.75 9.79175 24.75ZM0.541748 0.0833435V3.16668H3.62508L9.17508 14.8679L7.09383 18.645C6.84717 19.0767 6.70842 19.5854 6.70842 20.125C6.70842 21.8208 8.09591 23.2083 9.79175 23.2083H28.2917V20.125H10.4392C10.2234 20.125 10.0538 19.9554 10.0538 19.7396L10.1001 19.5546L11.4876 17.0417H22.973C24.1292 17.0417 25.1467 16.4096 25.6709 15.4538L31.1901 5.44834C31.3134 5.23251 31.3751 4.97043 31.3751 4.70834C31.3751 3.86043 30.6813 3.16668 29.8334 3.16668H7.03217L5.583 0.0833435H0.541748ZM25.2084 24.75C23.5126 24.75 22.1405 26.1375 22.1405 27.8333C22.1405 29.5292 23.5126 30.9167 25.2084 30.9167C26.9042 30.9167 28.2917 29.5292 28.2917 27.8333C28.2917 26.1375 26.9042 24.75 25.2084 24.75Z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div style={{ marginTop: '30px', height: '68px', backgroundColor: 'rgb(222 237 100)', fontWeight: 700, fontSize: '25px', lineHeight: '2.25rem', letterSpacing: '-1px', color: 'rgb(37, 79, 26)', padding: '10px' }}><div>KEDAIMASTER</div></div>
|
||||
</body>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
background-color: rgb(210, 232, 35);
|
||||
background-color: rgb(222 237 100);
|
||||
}
|
||||
|
||||
.nonCenteredLinktreePage {
|
||||
@@ -26,7 +26,7 @@
|
||||
}
|
||||
|
||||
.dashboardContainer {
|
||||
background-color: rgb(210, 232, 35);
|
||||
background-color: inherit;
|
||||
z-index: 6;
|
||||
padding: 0 1rem;
|
||||
padding-top: 40px;
|
||||
|
||||
Reference in New Issue
Block a user