Neumožnění výběru jídla kliknutím do minulosti
This commit is contained in:
parent
54e5be6b6a
commit
7cf9179a87
@ -204,7 +204,7 @@ function App() {
|
|||||||
|
|
||||||
const doAddClickFoodChoice = async (location: LunchChoice, foodIndex?: number) => {
|
const doAddClickFoodChoice = async (location: LunchChoice, foodIndex?: number) => {
|
||||||
if (document.getSelection()?.type !== 'Range') { // pouze pokud se nejedná o výběr textu
|
if (document.getSelection()?.type !== 'Range') { // pouze pokud se nejedná o výběr textu
|
||||||
if (auth?.login) {
|
if (canChangeChoice && auth?.login) {
|
||||||
await addChoice({ body: { locationKey: location, foodIndex, dayIndex } });
|
await addChoice({ body: { locationKey: location, foodIndex, dayIndex } });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -212,7 +212,7 @@ function App() {
|
|||||||
|
|
||||||
const doAddChoice = async (event: React.ChangeEvent<HTMLSelectElement>) => {
|
const doAddChoice = async (event: React.ChangeEvent<HTMLSelectElement>) => {
|
||||||
const locationKey = event.target.value as LunchChoice;
|
const locationKey = event.target.value as LunchChoice;
|
||||||
if (auth?.login) {
|
if (canChangeChoice && auth?.login) {
|
||||||
await addChoice({ body: { locationKey, dayIndex } });
|
await addChoice({ body: { locationKey, dayIndex } });
|
||||||
if (foodChoiceRef.current?.value) {
|
if (foodChoiceRef.current?.value) {
|
||||||
foodChoiceRef.current.value = "";
|
foodChoiceRef.current.value = "";
|
||||||
@ -348,7 +348,7 @@ function App() {
|
|||||||
} else if (menu?.food?.length && menu.food.length > 0) {
|
} else if (menu?.food?.length && menu.food.length > 0) {
|
||||||
const hideSoups = settings?.hideSoups;
|
const hideSoups = settings?.hideSoups;
|
||||||
content = <Table striped bordered hover>
|
content = <Table striped bordered hover>
|
||||||
<tbody style={{ cursor: 'pointer' }}>
|
<tbody style={{ cursor: canChangeChoice ? 'pointer' : 'default' }}>
|
||||||
{menu.food.map((f: Food, index: number) =>
|
{menu.food.map((f: Food, index: number) =>
|
||||||
(!hideSoups || !f.isSoup) &&
|
(!hideSoups || !f.isSoup) &&
|
||||||
<tr key={f.name} onClick={() => doAddClickFoodChoice(location, index)}>
|
<tr key={f.name} onClick={() => doAddClickFoodChoice(location, index)}>
|
||||||
@ -376,7 +376,7 @@ function App() {
|
|||||||
content = <h3>Chyba načtení dat</h3>
|
content = <h3>Chyba načtení dat</h3>
|
||||||
}
|
}
|
||||||
return <Col md={12} lg={3} className='mt-3'>
|
return <Col md={12} lg={3} className='mt-3'>
|
||||||
<h3 style={{ cursor: 'pointer' }} onClick={() => doAddClickFoodChoice(location)}>{getLunchChoiceName(location)}</h3>
|
<h3 style={{ cursor: canChangeChoice ? 'pointer' : 'default' }} onClick={() => doAddClickFoodChoice(location)}>{getLunchChoiceName(location)}</h3>
|
||||||
{menu?.lastUpdate && <small>Poslední aktualizace: {getHumanDateTime(new Date(menu.lastUpdate))}</small>}
|
{menu?.lastUpdate && <small>Poslední aktualizace: {getHumanDateTime(new Date(menu.lastUpdate))}</small>}
|
||||||
{content}
|
{content}
|
||||||
</Col>
|
</Col>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user