ok
This commit is contained in:
12
src/App.js
12
src/App.js
@@ -67,6 +67,7 @@ function App() {
|
|||||||
const [onModalCloseFunction, setOnModalCloseFunction] = useState(null);
|
const [onModalCloseFunction, setOnModalCloseFunction] = useState(null);
|
||||||
const [onModalYesFunction, setOnModalYesFunction] = useState(null);
|
const [onModalYesFunction, setOnModalYesFunction] = useState(null);
|
||||||
const transactionList = useRef(null);
|
const transactionList = useRef(null);
|
||||||
|
const [depth, setDepth] = useState(-1);
|
||||||
const [queue, setQueue] = useState([]);
|
const [queue, setQueue] = useState([]);
|
||||||
|
|
||||||
|
|
||||||
@@ -351,6 +352,13 @@ function App() {
|
|||||||
let transaction_info = searchParams.get("transactionId") || ''; // Get transactionId or set it to empty string
|
let transaction_info = searchParams.get("transactionId") || ''; // Get transactionId or set it to empty string
|
||||||
console.log(transaction_info); // Log the updated transaction_info
|
console.log(transaction_info); // Log the updated transaction_info
|
||||||
|
|
||||||
|
|
||||||
|
const depthh = transactionList.current.findIndex(
|
||||||
|
item => item.transactionId.toString() === transaction_info.toString()
|
||||||
|
);
|
||||||
|
|
||||||
|
setDepth(depthh);
|
||||||
|
|
||||||
// If transaction_info is an empty string, set the modal
|
// If transaction_info is an empty string, set the modal
|
||||||
if (transaction_info == '') return false;
|
if (transaction_info == '') return false;
|
||||||
else return true;
|
else return true;
|
||||||
@@ -415,11 +423,14 @@ function App() {
|
|||||||
// Determine the new transactionId based on the direction
|
// Determine the new transactionId based on the direction
|
||||||
let newTransactionId;
|
let newTransactionId;
|
||||||
if (direction === 'next') {
|
if (direction === 'next') {
|
||||||
|
|
||||||
// If we're not at the last transaction, get the next transactionId
|
// If we're not at the last transaction, get the next transactionId
|
||||||
newTransactionId = currentIndex < transactionList.current.length - 1
|
newTransactionId = currentIndex < transactionList.current.length - 1
|
||||||
? transactionList.current[currentIndex + 1].transactionId
|
? transactionList.current[currentIndex + 1].transactionId
|
||||||
: from; // If already at the end, stay on the current transactionId
|
: from; // If already at the end, stay on the current transactionId
|
||||||
} else if (direction === 'previous') {
|
} else if (direction === 'previous') {
|
||||||
|
|
||||||
|
setDepth(currentIndex -1);
|
||||||
// If we're not at the first transaction, get the previous transactionId
|
// If we're not at the first transaction, get the previous transactionId
|
||||||
newTransactionId = currentIndex > 0
|
newTransactionId = currentIndex > 0
|
||||||
? transactionList.current[currentIndex - 1].transactionId
|
? transactionList.current[currentIndex - 1].transactionId
|
||||||
@@ -741,6 +752,7 @@ function App() {
|
|||||||
isOpen={isModalOpen}
|
isOpen={isModalOpen}
|
||||||
modalContent={modalContent}
|
modalContent={modalContent}
|
||||||
handleMoveToTransaction={handleMoveToTransaction}
|
handleMoveToTransaction={handleMoveToTransaction}
|
||||||
|
depth={depth}
|
||||||
welcomePageConfig={shop.welcomePageConfig}
|
welcomePageConfig={shop.welcomePageConfig}
|
||||||
onClose={closeModal}
|
onClose={closeModal}
|
||||||
setModal={setModal}
|
setModal={setModal}
|
||||||
|
|||||||
@@ -333,7 +333,7 @@ const Header = ({
|
|||||||
</Title>
|
</Title>
|
||||||
<div style={{ visibility: showProfile ? "visible" : "hidden" }}>
|
<div style={{ visibility: showProfile ? "visible" : "hidden" }}>
|
||||||
<ProfileImage
|
<ProfileImage
|
||||||
src={user.username == undefined && shopImage && !shopImage.includes('undefined') ? shopImage || 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS-DjX_bGBax4NL14ULvkAdU4FP3FKoWXWu5w&s' : "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS-DjX_bGBax4NL14ULvkAdU4FP3FKoWXWu5w&s"}
|
src={shopImage && !shopImage.includes('undefined') ? shopImage || 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS-DjX_bGBax4NL14ULvkAdU4FP3FKoWXWu5w&s' : "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS-DjX_bGBax4NL14ULvkAdU4FP3FKoWXWu5w&s"}
|
||||||
alt="Profile"
|
alt="Profile"
|
||||||
onClick={user.username !== undefined ? handleImageClick : null}
|
onClick={user.username !== undefined ? handleImageClick : null}
|
||||||
animate={showRectangle && animate}
|
animate={showRectangle && animate}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import CreateCoupon from "../pages/CreateCoupon";
|
|||||||
import CheckCoupon from "../pages/CheckCoupon";
|
import CheckCoupon from "../pages/CheckCoupon";
|
||||||
import CreateUserWithCoupon from "../pages/CreateUserWithCoupon";
|
import CreateUserWithCoupon from "../pages/CreateUserWithCoupon";
|
||||||
|
|
||||||
const Modal = ({ user, shop, isOpen, onClose, modalContent, deviceType, setModal, handleMoveToTransaction,welcomePageConfig, onModalCloseFunction, onModalYesFunction }) => {
|
const Modal = ({ user, shop, isOpen, onClose, modalContent, deviceType, setModal, handleMoveToTransaction, depth,welcomePageConfig, onModalCloseFunction, onModalYesFunction }) => {
|
||||||
|
|
||||||
const [shopImg, setShopImg] = useState('');
|
const [shopImg, setShopImg] = useState('');
|
||||||
const [updateKey, setUpdateKey] = useState(0);
|
const [updateKey, setUpdateKey] = useState(0);
|
||||||
@@ -92,7 +92,7 @@ const Modal = ({ user, shop, isOpen, onClose, modalContent, deviceType, setModal
|
|||||||
{modalContent === "create_tenant" && <CreateTenant shopId={shop.cafeId} />}
|
{modalContent === "create_tenant" && <CreateTenant shopId={shop.cafeId} />}
|
||||||
{modalContent === "edit_tables" && <TablesPage shop={shop} />}
|
{modalContent === "edit_tables" && <TablesPage shop={shop} />}
|
||||||
{modalContent === "new_transaction" && (
|
{modalContent === "new_transaction" && (
|
||||||
<Transaction propsShopId={shop.cafeId} handleMoveToTransaction={handleMoveToTransaction} shopImg={shopImg} />
|
<Transaction propsShopId={shop.cafeId} handleMoveToTransaction={handleMoveToTransaction} depth={depth} shopImg={shopImg} />
|
||||||
)}
|
)}
|
||||||
{modalContent === "transaction_canceled" && (
|
{modalContent === "transaction_canceled" && (
|
||||||
<Transaction propsShopId={shop.cafeId} />
|
<Transaction propsShopId={shop.cafeId} />
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ export function MusicPlayer({ socket, shopId, user, shopOwnerId, isSpotifyNeedLo
|
|||||||
// setSubtitleColor("white");
|
// setSubtitleColor("white");
|
||||||
// setSubtitleBG("black");
|
// setSubtitleBG("black");
|
||||||
// }
|
// }
|
||||||
const proxiedUrl = `https://api.kedaimaster.com/image?url=${encodeURIComponent(modifyUrl(imageUrl))}`; // Use your proxy to fetch the image
|
const proxiedUrl = `https://dev.api.kedaimaster.com/image?url=${encodeURIComponent(modifyUrl(imageUrl))}`; // Use your proxy to fetch the image
|
||||||
|
|
||||||
setBackgroundImage(proxiedUrl);
|
setBackgroundImage(proxiedUrl);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// src/config.js
|
// src/config.js
|
||||||
|
|
||||||
const API_BASE_URL = 'https://api.kedaimaster.com';
|
const API_BASE_URL = 'https://dev.api.kedaimaster.com';
|
||||||
|
|
||||||
export default API_BASE_URL;
|
export default API_BASE_URL;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ const CreateCouponPage = () => {
|
|||||||
let encodedCouponCode = encodeURIComponent(encryptedCouponCode);
|
let encodedCouponCode = encodeURIComponent(encryptedCouponCode);
|
||||||
|
|
||||||
// Construct the URL with the encoded coupon code as a query parameter
|
// Construct the URL with the encoded coupon code as a query parameter
|
||||||
const urlWithCoupon = `https://coupon.kedaimaster.com/coupon?c=${encodedCouponCode}`;
|
const urlWithCoupon = `https://dev.coupon.kedaimaster.com/coupon?c=${encodedCouponCode}`;
|
||||||
|
|
||||||
// Optionally, set the URL to use with the coupon
|
// Optionally, set the URL to use with the coupon
|
||||||
setCouponUrl(urlWithCoupon);
|
setCouponUrl(urlWithCoupon);
|
||||||
|
|||||||
@@ -27,7 +27,11 @@ const RoundedRectangle = ({
|
|||||||
loading = false,
|
loading = false,
|
||||||
children, // Assuming this is a React component or JSX
|
children, // Assuming this is a React component or JSX
|
||||||
isChildren,
|
isChildren,
|
||||||
width = 'calc(100% / 2 - 10px)'
|
width = 'calc(100% / 2 - 10px)',
|
||||||
|
height,
|
||||||
|
marginBottom,
|
||||||
|
backgroundColor,
|
||||||
|
color
|
||||||
}) => {
|
}) => {
|
||||||
const containerStyle = {
|
const containerStyle = {
|
||||||
display: "flex",
|
display: "flex",
|
||||||
@@ -35,25 +39,26 @@ const RoundedRectangle = ({
|
|||||||
alignItems: "flex-start",
|
alignItems: "flex-start",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
width: width,
|
width: width,
|
||||||
height: "auto",
|
height: height != undefined ? height : "auto",
|
||||||
borderRadius: "15px",
|
borderRadius: "11px",
|
||||||
padding: "20px",
|
padding: "20px",
|
||||||
margin: "5px",
|
margin: "5px",
|
||||||
textAlign: "left",
|
textAlign: "left",
|
||||||
fontFamily: "Arial, sans-serif",
|
fontFamily: "Arial, sans-serif",
|
||||||
boxSizing: "border-box",
|
boxSizing: "border-box",
|
||||||
backgroundColor: loading ? "rgb(127 127 127)" : 'white',
|
backgroundColor: loading ? "rgb(127 127 127)" : backgroundColor,
|
||||||
border: '1px solid #b3b1b1'
|
border: '1px solid #b3b1b1',
|
||||||
|
fontSize: '15px'
|
||||||
};
|
};
|
||||||
|
|
||||||
const titleStyle = {
|
const titleStyle = {
|
||||||
fontWeight: "bold",
|
fontWeight: "bold",
|
||||||
marginBottom: "10px",
|
marginBottom: marginBottom,
|
||||||
width: "100%",
|
width: "100%",
|
||||||
backgroundColor: loading
|
backgroundColor: loading
|
||||||
? "rgb(85 85 85)"
|
? "rgb(85 85 85)"
|
||||||
: !isChildren && !children && "inherit",
|
: !isChildren && !children && backgroundColor,
|
||||||
color: loading ? "transparent" : "inherit",
|
color: loading ? "transparent" : color,
|
||||||
};
|
};
|
||||||
|
|
||||||
const valueAndPercentageContainerStyle = {
|
const valueAndPercentageContainerStyle = {
|
||||||
@@ -536,6 +541,9 @@ const App = ({ forCafe = true, cafeId = -1,
|
|||||||
percentage={roundToInteger(analytics?.growth?.incomeGrowth)}
|
percentage={roundToInteger(analytics?.growth?.incomeGrowth)}
|
||||||
invert={false}
|
invert={false}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
|
marginBottom={'10px'}
|
||||||
|
backgroundColor={'white'}
|
||||||
|
color={'black'}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<RoundedRectangle
|
<RoundedRectangle
|
||||||
@@ -545,6 +553,9 @@ const App = ({ forCafe = true, cafeId = -1,
|
|||||||
percentage={roundToInteger(analytics?.growth?.outcomeGrowth)}
|
percentage={roundToInteger(analytics?.growth?.outcomeGrowth)}
|
||||||
invert={true}
|
invert={true}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
|
marginBottom={'10px'}
|
||||||
|
backgroundColor={'white'}
|
||||||
|
color={'black'}
|
||||||
/>
|
/>
|
||||||
<RoundedRectangle
|
<RoundedRectangle
|
||||||
title="Transaksi"
|
title="Transaksi"
|
||||||
@@ -552,6 +563,9 @@ const App = ({ forCafe = true, cafeId = -1,
|
|||||||
percentage={roundToInteger(analytics?.growth?.transactionGrowth)}
|
percentage={roundToInteger(analytics?.growth?.transactionGrowth)}
|
||||||
invert={false}
|
invert={false}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
|
marginBottom={'10px'}
|
||||||
|
backgroundColor={'white'}
|
||||||
|
color={'black'}
|
||||||
/>
|
/>
|
||||||
{((analytics?.itemSales &&
|
{((analytics?.itemSales &&
|
||||||
analytics?.itemSales.length > 0) || (!analytics?.itemSales && segments.length > 0)) ? (
|
analytics?.itemSales.length > 0) || (!analytics?.itemSales && segments.length > 0)) ? (
|
||||||
@@ -560,6 +574,9 @@ const App = ({ forCafe = true, cafeId = -1,
|
|||||||
value={analytics?.itemSales?.length > 0 && analytics?.itemSales[0] != undefined ? analytics?.itemSales[0]?.itemName
|
value={analytics?.itemSales?.length > 0 && analytics?.itemSales[0] != undefined ? analytics?.itemSales[0]?.itemName
|
||||||
: segments[0].itemName}
|
: segments[0].itemName}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
|
marginBottom={'10px'}
|
||||||
|
backgroundColor={'white'}
|
||||||
|
color={'black'}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
@@ -568,24 +585,29 @@ const App = ({ forCafe = true, cafeId = -1,
|
|||||||
title={"Item favorit"}
|
title={"Item favorit"}
|
||||||
value={"-"}
|
value={"-"}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
|
marginBottom={'10px'}
|
||||||
|
backgroundColor={'white'}
|
||||||
|
color={'black'}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
{selectedCafeId != -1 && (
|
{/* {selectedCafeId != -1 && (
|
||||||
<RoundedRectangle
|
<RoundedRectangle
|
||||||
title={"Total promo"}
|
title={"Total promo"}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
value={'Rp'+analytics?.currentTotals?.totalPromoSpend}
|
value={'Rp'+analytics?.currentTotals?.totalPromoSpend}
|
||||||
width= {`calc(${!forCafe && selectedCafeId !== 0 ? '50%' : '100%'} - 10px)`}
|
width= {`calc(${!forCafe && selectedCafeId !== 0 ? '50%' : '100%'} - 10px)`}
|
||||||
/>
|
/>
|
||||||
)}
|
)} */}
|
||||||
{!forCafe && selectedCafeId != -1 && selectedCafeId != 0 && (
|
{!forCafe && selectedCafeId != -1 && selectedCafeId != 0 && (
|
||||||
<RoundedRectangle
|
<RoundedRectangle
|
||||||
title={"Kunjungi"}
|
title={"Kunjungi bisnis"}
|
||||||
value={"bisnis"}
|
width= {`calc(${'100%'} - 10px)`}
|
||||||
loading={loading}
|
height='10px'
|
||||||
width= {`calc(${selectedCafeId !== 0 ? '50%' : '100%'} - 10px)`}
|
|
||||||
onClick={() => window.location.href = window.location.origin + '/' + otherCafes.find(item => item.cafeId === selectedCafeId).cafeIdentifyName}
|
onClick={() => window.location.href = window.location.origin + '/' + otherCafes.find(item => item.cafeId === selectedCafeId).cafeIdentifyName}
|
||||||
|
marginBottom={'0px'}
|
||||||
|
backgroundColor={'#f4f0e6'}
|
||||||
|
color={'#b39969'}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { getTables } from "../helpers/tableHelper";
|
|||||||
import TableCanvas from "../components/TableCanvas";
|
import TableCanvas from "../components/TableCanvas";
|
||||||
import { useSearchParams } from "react-router-dom";
|
import { useSearchParams } from "react-router-dom";
|
||||||
|
|
||||||
export default function Transactions({ propsShopId, sendParam, deviceType, handleMoveToTransaction, shopImg }) {
|
export default function Transactions({ propsShopId, sendParam, deviceType, handleMoveToTransaction, depth, shopImg }) {
|
||||||
const { shopId, tableId } = useParams();
|
const { shopId, tableId } = useParams();
|
||||||
if (sendParam) sendParam({ shopId, tableId });
|
if (sendParam) sendParam({ shopId, tableId });
|
||||||
|
|
||||||
@@ -160,7 +160,9 @@ export default function Transactions({ propsShopId, sendParam, deviceType, handl
|
|||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.circle}>1</div>
|
{depth > 0 &&
|
||||||
|
<div className={styles.circle}>{depth}</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<div className={styles['line']} ></div>
|
<div className={styles['line']} ></div>
|
||||||
<div className={styles['circle-right']} onClick={() => handleMoveToTransaction('next', transaction.transactionId)}>
|
<div className={styles['circle-right']} onClick={() => handleMoveToTransaction('next', transaction.transactionId)}>
|
||||||
|
|||||||
Reference in New Issue
Block a user