ok
This commit is contained in:
@@ -108,7 +108,7 @@ const ProfileImage = styled.img`
|
|||||||
width: 60px;
|
width: 60px;
|
||||||
height: 60px;
|
height: 60px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
object-fit: contain;
|
object-fit: cover;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
z-index: 199;
|
z-index: 199;
|
||||||
animation: ${(props) => {
|
animation: ${(props) => {
|
||||||
|
|||||||
@@ -13,10 +13,6 @@ import MultiSwitch from "react-multi-switch-toggle";
|
|||||||
import DailyCharts from '../components/DailyCharts.js';
|
import DailyCharts from '../components/DailyCharts.js';
|
||||||
import PeriodCharts from '../components/PeriodCharts.js';
|
import PeriodCharts from '../components/PeriodCharts.js';
|
||||||
|
|
||||||
import Coupon from "../components/Coupon.js";
|
|
||||||
|
|
||||||
import CreateCouponPage from "./CreateCoupon.js";
|
|
||||||
|
|
||||||
const RoundedRectangle = ({
|
const RoundedRectangle = ({
|
||||||
onClick,
|
onClick,
|
||||||
title,
|
title,
|
||||||
@@ -312,7 +308,7 @@ const App = ({ forCafe = true, cafeId = -1,
|
|||||||
filterTexts[["yesterday", "weekly", "monthly", "yearly"].indexOf(filter)];
|
filterTexts[["yesterday", "weekly", "monthly", "yearly"].indexOf(filter)];
|
||||||
|
|
||||||
const [resetKey, setResetKey] = useState(0); // A key to force re-render
|
const [resetKey, setResetKey] = useState(0); // A key to force re-render
|
||||||
const [texts, setTexts] = useState(['Buat bisnis']); // initially show only first 3 texts
|
const [texts, setTexts] = useState([]); // initially show only first 3 texts
|
||||||
const [fullTexts, setFullTexts] = useState(null); // initially show only first 3 texts
|
const [fullTexts, setFullTexts] = useState(null); // initially show only first 3 texts
|
||||||
const [fullTextsVisible, setFullTextsVisible] = useState(null); // initially show only first 3 texts
|
const [fullTextsVisible, setFullTextsVisible] = useState(null); // initially show only first 3 texts
|
||||||
|
|
||||||
@@ -322,13 +318,13 @@ const App = ({ forCafe = true, cafeId = -1,
|
|||||||
let updatedFullTexts;
|
let updatedFullTexts;
|
||||||
if (otherCafes.length === 0) {
|
if (otherCafes.length === 0) {
|
||||||
// Only include the role-specific option if user.roleId is 1
|
// Only include the role-specific option if user.roleId is 1
|
||||||
updatedFullTexts = user.roleId == 1 ? [["Buat Bisnis", 0]] : [];
|
updatedFullTexts = user.roleId == 1 ? [[0]] : [];
|
||||||
setSelectedCafeId(-1);
|
setSelectedCafeId(-1);
|
||||||
} else if (otherCafes.length === 1) {
|
} else if (otherCafes.length === 1) {
|
||||||
updatedFullTexts = [
|
updatedFullTexts = [
|
||||||
[otherCafes[0].cafeIdentifyName || otherCafes[0].username, otherCafes[0].cafeId || otherCafes[0].user_id],
|
[otherCafes[0].cafeIdentifyName || otherCafes[0].username, otherCafes[0].cafeId || otherCafes[0].user_id],
|
||||||
// Only add the "Buat Bisnis" option for user.roleId == 1
|
|
||||||
...(user.roleId == 1 ? [["Buat Bisnis", -1]] : [])
|
...(user.roleId == 1 ? [[-1]] : [])
|
||||||
];
|
];
|
||||||
|
|
||||||
setSelectedCafeId(otherCafes[0].cafeId); // Get the cafeId (second part of the pair)
|
setSelectedCafeId(otherCafes[0].cafeId); // Get the cafeId (second part of the pair)
|
||||||
@@ -336,8 +332,8 @@ const App = ({ forCafe = true, cafeId = -1,
|
|||||||
updatedFullTexts = [
|
updatedFullTexts = [
|
||||||
["semua", 0], // First entry is "semua"
|
["semua", 0], // First entry is "semua"
|
||||||
...otherCafes.map(item => [item.cafeIdentifyName || item.username, item.cafeId || item.user_id]), // Map over cafes to get name and cafeId pairs
|
...otherCafes.map(item => [item.cafeIdentifyName || item.username, item.cafeId || item.user_id]), // Map over cafes to get name and cafeId pairs
|
||||||
// Only add "Buat Bisnis +" option for user.roleId == 1
|
|
||||||
...(user.roleId == 1 ? [["Buat Bisnis +", -1]] : [])
|
...(user.roleId == 1 ? [] : [])
|
||||||
];
|
];
|
||||||
|
|
||||||
setSelectedCafeId(0);
|
setSelectedCafeId(0);
|
||||||
@@ -412,7 +408,7 @@ const App = ({ forCafe = true, cafeId = -1,
|
|||||||
console.log(analytics)
|
console.log(analytics)
|
||||||
if (user && user.roleId === 0 && analytics) {
|
if (user && user.roleId === 0 && analytics) {
|
||||||
// Filter the analytics items based on user_id
|
// Filter the analytics items based on user_id
|
||||||
if(selectedItem[1] != 0 && selectedItem[1] != -1){
|
if (selectedItem[1] != 0 && selectedItem[1] != -1) {
|
||||||
const filteredData = analytics.items.filter(
|
const filteredData = analytics.items.filter(
|
||||||
(data) => data.user_id === nextSelectedId
|
(data) => data.user_id === nextSelectedId
|
||||||
);
|
);
|
||||||
@@ -602,7 +598,7 @@ const App = ({ forCafe = true, cafeId = -1,
|
|||||||
{!forCafe && selectedCafeId != -1 && selectedCafeId != 0 && (
|
{!forCafe && selectedCafeId != -1 && selectedCafeId != 0 && (
|
||||||
<RoundedRectangle
|
<RoundedRectangle
|
||||||
title={"Kunjungi bisnis"}
|
title={"Kunjungi bisnis"}
|
||||||
width= {`calc(${'100%'} - 10px)`}
|
width={`calc(${'100%'} - 10px)`}
|
||||||
height='10px'
|
height='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'}
|
marginBottom={'0px'}
|
||||||
@@ -719,77 +715,6 @@ const App = ({ forCafe = true, cafeId = -1,
|
|||||||
<PeriodCharts type={filter} graphFilter={graphFilter} aggregatedCurrentReports={analytics?.aggregatedCurrentReports} aggregatedPreviousReports={analytics?.aggregatedPreviousReports} colors={colors} />
|
<PeriodCharts type={filter} graphFilter={graphFilter} aggregatedCurrentReports={analytics?.aggregatedCurrentReports} aggregatedPreviousReports={analytics?.aggregatedPreviousReports} colors={colors} />
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
|
||||||
{!forCafe && selectedCafeId == -1 && user.roleId == 1 &&
|
|
||||||
<div style={{
|
|
||||||
textAlign: "center",
|
|
||||||
}}>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
display: "flex",
|
|
||||||
flexWrap: "wrap",
|
|
||||||
justifyContent: "center",
|
|
||||||
padding: "20px",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
|
|
||||||
<RoundedRectangle
|
|
||||||
title={"Masukkan nama bisnis"}
|
|
||||||
width="calc(100% - 10px)"
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
value={itemName}
|
|
||||||
onChange={(e) => setItemName(e.target.value)}
|
|
||||||
style={{
|
|
||||||
width: '70%',
|
|
||||||
fontSize: '25px',
|
|
||||||
borderRadius: '7px',
|
|
||||||
border: '1px solid black'
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</RoundedRectangle>
|
|
||||||
|
|
||||||
|
|
||||||
<RoundedRectangle
|
|
||||||
title={"Buat Bisnis"}
|
|
||||||
width="calc(100% - 10px)"
|
|
||||||
onClick={handleClick}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
{!forCafe &&
|
|
||||||
<>
|
|
||||||
<div className={`${styles.couponContainer}`}>
|
|
||||||
<div>
|
|
||||||
{!forCafe &&
|
|
||||||
<div className={styles.dateSelectorWrapper} style={{ fontSize: '13px' }}>
|
|
||||||
<div
|
|
||||||
className={`${styles.dateSelector} ${styles.dateSelectorActive}`} style={{ position: 'relative', width: 'calc(32vw - 30px)' }}
|
|
||||||
>
|
|
||||||
<div style={{ position: 'absolute', bottom: 0, left: '10%', right: '10%', borderBottom: `1px solid green` }}></div>
|
|
||||||
<div
|
|
||||||
style={{ color: 'black' }}>
|
|
||||||
Voucher
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style={{ padding: '25px', paddingTop: '0', paddingBottom: '0' }}>
|
|
||||||
{/* <h1>{couponList.length}</h1> */}
|
|
||||||
{couponList && couponList.map((coupon) => {
|
|
||||||
return <Coupon
|
|
||||||
code={coupon?.code || null}
|
|
||||||
value={coupon?.discountValue}
|
|
||||||
period={coupon?.discountPeriods}
|
|
||||||
expiration={coupon?.discountEndDate}
|
|
||||||
/>
|
|
||||||
})}
|
|
||||||
<button className={`${styles.addCoupon}`} onClick={() => setModal('claim-coupon')}>Tambahkan Voucher</button>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user