diff --git a/public/styles.css b/public/styles.css new file mode 100644 index 0000000..79de0b3 --- /dev/null +++ b/public/styles.css @@ -0,0 +1,20 @@ +/* Default styles - for mobile view */ +#wrapper { + width: 100%; + max-width: 375px; /* Mobile width ratio */ + margin: 0 auto; + padding: 10px; + box-sizing: border-box; + } + + /* Desktop view - simulate mobile ratio on desktop */ + @media (min-width: 1024px) { + #wrapper { + width: 100%; + max-width: 375px; /* Keep mobile width ratio on desktop */ + margin: 0 auto; + padding: 10px; + box-sizing: border-box; + } + } + \ No newline at end of file diff --git a/src/components/Modal.js b/src/components/Modal.js index 70af5b3..f7e5cfa 100644 --- a/src/components/Modal.js +++ b/src/components/Modal.js @@ -35,6 +35,7 @@ import CreateUserWithCoupon from "../pages/CreateUserWithCoupon"; const Modal = ({ user, shop, isOpen, onClose, modalContent, setModal, handleMoveToTransaction,welcomePageConfig, onModalCloseFunction }) => { const [shopImg, setShopImg] = useState(''); + const [updateKey, setUpdateKey] = useState(0); useEffect(() => { if (welcomePageConfig) { @@ -43,6 +44,10 @@ const Modal = ({ user, shop, isOpen, onClose, modalContent, setModal, handleMove } }, [welcomePageConfig]); + useEffect(() => { + setUpdateKey(updateKey+1); + }, [shop]); + if (!isOpen) return null; // Function to handle clicks on the overlay @@ -63,7 +68,7 @@ const Modal = ({ user, shop, isOpen, onClose, modalContent, setModal, handleMove }; if(modalContent == '') handleOverlayClick(); return ( -
+
{modalContent === "edit_account" && } diff --git a/src/components/TablesPage.js b/src/components/TablesPage.js index 43ed86d..fae3cc7 100644 --- a/src/components/TablesPage.js +++ b/src/components/TablesPage.js @@ -87,12 +87,16 @@ const SetPaymentQr = ({ shop }) => { fontsize, fontcolor, fontPosition: initialFontPos, + cafeIdentifyName: shop.cafeIdentifyName != cafeIdentifyNameUpdate ? cafeIdentifyNameUpdate : null }; // Call saveCafeDetails function with the updated details object saveCafeDetails(shop.cafeId, details) .then((response) => { console.log("Cafe details saved:", response); + if (shop.cafeIdentifyName != cafeIdentifyNameUpdate) { + window.location.href = `/${cafeIdentifyNameUpdate}?modal=edit_tables`; + } }) .catch((error) => { console.error("Error saving cafe details:", error); @@ -206,7 +210,7 @@ const SetPaymentQr = ({ shop }) => { const checkIfNameIsUsed = async (newIdentifyName) => { // Replace this with your actual API call try { - const response = await fetch(API_BASE_URL+`/cafe/check-identifyName/${newIdentifyName}`); + const response = await fetch(API_BASE_URL + `/cafe/check-identifyName/${newIdentifyName}`); console.log(response) if (response.ok) { setIsLoading(false); @@ -659,22 +663,39 @@ const SetPaymentQr = ({ shop }) => {

{cafeIdentifyNameUpdate == shop.cafeIdentifyName ? '-----------------' : !isLoading && identifyNameResponse == 200 ? - 'Alamat tersedia' - : - !isLoading && identifyNameResponse != 200 ? - 'Alamat terpakai' - : - < ColorRing - height="16" - width="16" style={{ marginTop: '5px' }} /> + 'Alamat tersedia' + : + !isLoading && identifyNameResponse != 200 ? + 'Alamat terpakai' + : + < ColorRing + height="16" + width="16" style={{ marginTop: '5px' }} /> }

+ {identifyNameResponse == 199 && +
+
+

+

Perubahan alamat bisnis akan menyebabkan seluruh QR kode identifikasi kedai atau meja yang telah dicetak sebelumnya menjadi tidak berlaku.

+
+
{ setIdentifyNameResponse(200); }} style={styles.changeButton}>Batal +
+
{ setIsConfigCafeIdentityName(false); setIdentifyNameResponse(200); }} style={styles.changeButton}>Terapkan +
+ +
+
+
+ }
-

{cafeIdentifyNameUpdate != shop.cafeIdentifyName && identifyNameResponse == 200 && !isLoading ? +

{cafeIdentifyNameUpdate != shop.cafeIdentifyName && identifyNameResponse == 200 && !isLoading ?

setIsConfigCafeIdentityName(false)} style={styles.changeButton2}>Terapkan + onClick={() => { setIdentifyNameResponse(199) }} style={styles.changeButton2}>Terapkan
: '----------'}

@@ -684,7 +705,7 @@ const SetPaymentQr = ({ shop }) => {
:
{ setIsConfigCafeIdentityName(true); cafeIdentifyNameRef.current && cafeIdentifyNameRef.current.focus(); }} style={styles.changeButton}>Ganti + onClick={() => { setIsConfigCafeIdentityName(true); cafeIdentifyNameRef.current && cafeIdentifyNameRef.current.focus(); }} style={styles.changeButton}>Ganti
}
@@ -698,6 +719,23 @@ const SetPaymentQr = ({ shop }) => {
*/} )} +
+
+
menu
+ +
+
+ <> +
+

Klik untuk ganti nama

+
+
+

-----------------

+
{ setIsConfigCafeIdentityName(true); cafeIdentifyNameRef.current && cafeIdentifyNameRef.current.focus(); }} style={styles.changeButton}>Ganti +
+
+
{ }
-