pagi
This commit is contained in:
@@ -28,6 +28,12 @@ export default function Footer({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleHapusMeja = (event) => {
|
||||||
|
event.stopPropagation(); // Ensure click event doesn't propagate
|
||||||
|
goToNonTable();
|
||||||
|
setIsStretched(false);
|
||||||
|
};
|
||||||
|
|
||||||
const handleClickOutside = (event) => {
|
const handleClickOutside = (event) => {
|
||||||
if (scanMejaRef.current && !scanMejaRef.current.contains(event.target)) {
|
if (scanMejaRef.current && !scanMejaRef.current.contains(event.target)) {
|
||||||
setIsStretched(false);
|
setIsStretched(false);
|
||||||
@@ -111,7 +117,7 @@ export default function Footer({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{tableId && isStretched && (
|
{tableId && isStretched && (
|
||||||
<button onClick={goToNonTable} className={styles.hapusMejaBtn}>
|
<button onClick={handleHapusMeja} className={styles.hapusMejaBtn}>
|
||||||
Hapus Meja
|
Hapus Meja
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -26,9 +26,7 @@ const Searchinput = styled.input`
|
|||||||
outline: none;
|
outline: none;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
transition:
|
transition: background-color 0.3s ease, border-color 0.3s ease;
|
||||||
background-color 0.3s ease,
|
|
||||||
border-color 0.3s ease;
|
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
background-color: lightgray;
|
background-color: lightgray;
|
||||||
@@ -44,7 +42,12 @@ const SearchIcon = styled.svg`
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export default function SearchInput({ shopId, autofocus, onSearchChange }) {
|
export default function SearchInput({
|
||||||
|
shopId,
|
||||||
|
tableId,
|
||||||
|
autofocus,
|
||||||
|
onSearchChange,
|
||||||
|
}) {
|
||||||
const [songName, setSongName] = useState("");
|
const [songName, setSongName] = useState("");
|
||||||
const [debouncedSongName, setDebouncedSongName] = useState("");
|
const [debouncedSongName, setDebouncedSongName] = useState("");
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -68,14 +71,18 @@ export default function SearchInput({ shopId, autofocus, onSearchChange }) {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (siteLoaded) {
|
if (siteLoaded) {
|
||||||
//Start the timer
|
//Start the timer
|
||||||
if (autofocus)
|
let url = "";
|
||||||
navigate(`/${shopId}/search?query=${encodeURIComponent(songName)}`);
|
if (autofocus || songName != "") {
|
||||||
else if (songName != "")
|
url = tableId
|
||||||
navigate(`/${shopId}/search?query=${encodeURIComponent(songName)}`);
|
? `/${shopId}/${tableId}/search?query=${encodeURIComponent(songName)}`
|
||||||
|
: `/${shopId}/search?query=${encodeURIComponent(songName)}`;
|
||||||
|
navigate(url);
|
||||||
|
}
|
||||||
|
|
||||||
if (autofocus) {
|
if (autofocus) {
|
||||||
if (songName == "") {
|
if (songName == "") {
|
||||||
navigate(`/${shopId}`);
|
if (tableId) navigate(`/${shopId}/${tableId}`);
|
||||||
|
else navigate(`/${shopId}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (onSearchChange) onSearchChange(songName);
|
if (onSearchChange) onSearchChange(songName);
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ const TableCanvas = ({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (
|
||||||
|
!tables ||
|
||||||
tables.length === 0 ||
|
tables.length === 0 ||
|
||||||
canvasSize.width === 0 ||
|
canvasSize.width === 0 ||
|
||||||
canvasSize.height === 0
|
canvasSize.height === 0
|
||||||
|
|||||||
@@ -365,7 +365,8 @@ const TableCanvas = ({ shopId }) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ul style={{ listStyleType: "none", padding: 0, margin: 0 }}>
|
<ul style={{ listStyleType: "none", padding: 0, margin: 0 }}>
|
||||||
{tables.map((table) => (
|
{tables &&
|
||||||
|
tables.map((table) => (
|
||||||
<li
|
<li
|
||||||
key={table.tableId}
|
key={table.tableId}
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -26,8 +26,17 @@ export const useNavigationHelpers = (shopId, tableId) => {
|
|||||||
navigate(url);
|
navigate(url);
|
||||||
};
|
};
|
||||||
const goToScan = () => {
|
const goToScan = () => {
|
||||||
// Construct the base URL for the shop
|
// Construct the base URL
|
||||||
let url = `/scan`;
|
let url = "/scan";
|
||||||
|
|
||||||
|
// Append query parameters conditionally
|
||||||
|
const queryParams = new URLSearchParams();
|
||||||
|
if (shopId) queryParams.append("next", shopId);
|
||||||
|
|
||||||
|
// Set the URL with query parameters
|
||||||
|
if (queryParams.toString()) {
|
||||||
|
url += `?${queryParams.toString()}`;
|
||||||
|
}
|
||||||
|
|
||||||
// Perform the navigation
|
// Perform the navigation
|
||||||
navigate(url);
|
navigate(url);
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ function CafePage({
|
|||||||
removeConnectedGuestSides={removeConnectedGuestSides}
|
removeConnectedGuestSides={removeConnectedGuestSides}
|
||||||
/>
|
/>
|
||||||
<div style={{ marginTop: "5px" }}></div>
|
<div style={{ marginTop: "5px" }}></div>
|
||||||
<SearchInput shopId={shopId} />
|
<SearchInput shopId={shopId} tableId={tableId} />
|
||||||
<div style={{ marginTop: "15px" }}></div>
|
<div style={{ marginTop: "15px" }}></div>
|
||||||
<ItemTypeLister
|
<ItemTypeLister
|
||||||
user={user}
|
user={user}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ function SearchResult({ user, shopItems, sendParam }) {
|
|||||||
sendParam({ shopId, tableId });
|
sendParam({ shopId, tableId });
|
||||||
|
|
||||||
const [searchValue, setSearchValue] = useState(
|
const [searchValue, setSearchValue] = useState(
|
||||||
"dwadawa vvwqd21qb13 4kfawfdwa dhawldhawr dliawbdjawndlks",
|
"dwadawa vvwqd21qb13 4kfawfdwa dhawldhawr dliawbdjawndlks"
|
||||||
);
|
);
|
||||||
|
|
||||||
// Function to handle search input change
|
// Function to handle search input change
|
||||||
@@ -28,7 +28,7 @@ function SearchResult({ user, shopItems, sendParam }) {
|
|||||||
.map((itemType) => {
|
.map((itemType) => {
|
||||||
// Filter items in the itemList based on searchValue
|
// Filter items in the itemList based on searchValue
|
||||||
const filteredItemList = itemType.itemList.filter((item) =>
|
const filteredItemList = itemType.itemList.filter((item) =>
|
||||||
item.name.toLowerCase().includes(searchValue.toLowerCase()),
|
item.name.toLowerCase().includes(searchValue.toLowerCase())
|
||||||
);
|
);
|
||||||
|
|
||||||
// Return itemType with only filtered items
|
// Return itemType with only filtered items
|
||||||
@@ -47,6 +47,7 @@ function SearchResult({ user, shopItems, sendParam }) {
|
|||||||
<div style={{ marginTop: "5px" }}></div>
|
<div style={{ marginTop: "5px" }}></div>
|
||||||
<SearchInput
|
<SearchInput
|
||||||
shopId={shopId}
|
shopId={shopId}
|
||||||
|
tableId={tableId}
|
||||||
autofocus={true}
|
autofocus={true}
|
||||||
onSearchChange={handleSearchChange}
|
onSearchChange={handleSearchChange}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -73,7 +73,8 @@ export default function Transactions({ propsShopId, sendParam, deviceType }) {
|
|||||||
<div style={{ marginTop: "30px" }}></div>
|
<div style={{ marginTop: "30px" }}></div>
|
||||||
<TableCanvas tables={tables} selectedTable={selectedTable} />
|
<TableCanvas tables={tables} selectedTable={selectedTable} />
|
||||||
<div className={styles.TransactionListContainer}>
|
<div className={styles.TransactionListContainer}>
|
||||||
{transactions.map((transaction) => (
|
{transactions &&
|
||||||
|
transactions.map((transaction) => (
|
||||||
<div
|
<div
|
||||||
key={transaction.transactionId}
|
key={transaction.transactionId}
|
||||||
className={styles.RoundedRectangle}
|
className={styles.RoundedRectangle}
|
||||||
|
|||||||
Reference in New Issue
Block a user