calendar not connected

master
alex 2024-01-20 00:35:22 +01:00
parent f1725f0e21
commit ce9fecef3d
5 changed files with 54 additions and 38 deletions

View File

@ -161,6 +161,11 @@
}, },
"cardStoreCalendarSettings": { "cardStoreCalendarSettings": {
"title": "Geschäftskalendereinstellungen" "title": "Geschäftskalendereinstellungen"
},
"googleCalendarNotConnected": {
"title": "Google Kalender nicht verbunden",
"subTitle": "Klicken Sie auf die Schaltfläche unten, um Ihren Google Kalender zu verbinden.",
"button": "Jetzt verbinden"
} }
}, },
"storeSettings": { "storeSettings": {

View File

@ -164,6 +164,11 @@
}, },
"cardStoreCalendarSettings": { "cardStoreCalendarSettings": {
"title": "Store calendar settings" "title": "Store calendar settings"
},
"googleCalendarNotConnected": {
"title": "Google Calendar not connected",
"subTitle": "Click on the button below to connect your Google Calendar.",
"button": "Connect now"
} }
}, },
"storeSettings": { "storeSettings": {

View File

@ -7,7 +7,7 @@ export default function MyCenteredContainer({ children }) {
justifyContent: "center", justifyContent: "center",
alignContent: "center", alignContent: "center",
alignItems: "center", alignItems: "center",
height: "98.3vh", height: "85.3vh",
}} }}
> >
{children} {children}

View File

@ -1,4 +1,4 @@
import { Button, Card, Col, Form, Row, Spin, Switch, Typography } from "antd"; import { Button, Card, Col, Form, Result, Row, Spin, Switch } from "antd";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { import {
Constants, Constants,
@ -7,7 +7,6 @@ import {
} from "../../../utils"; } from "../../../utils";
import { useEffect, useRef, useState } from "react"; import { useEffect, useRef, useState } from "react";
import MyCenteredContainer from "../../../Components/MyContainer"; import MyCenteredContainer from "../../../Components/MyContainer";
import { CheckOutlined } from "@ant-design/icons";
import { import {
MyCalendarMaxFutureBookingDaysFormInput, MyCalendarMaxFutureBookingDaysFormInput,
MyCalendarMinEarliestBookingTimeFormInput, MyCalendarMinEarliestBookingTimeFormInput,
@ -47,17 +46,29 @@ export default function StoreCalendar() {
return ( return (
<> <>
<h1>{t("calendar.pageTitle")}</h1> {calendarSettings.connected === false ? (
<MyCenteredContainer>
<Result
status="warning"
title={t("calendar.googleCalendarNotConnected.title")}
subTitle={t("calendar.googleCalendarNotConnected.subTitle")}
extra={
<Button <Button
type="primary"
onClick={() => { onClick={() => {
document.cookie = `session=${getUserSessionFromLocalStorage()}; path=/;`; document.cookie = `session=${getUserSessionFromLocalStorage()}; path=/;`;
window.location.href = `${Constants.API_ADDRESS}/calendar/auth/google`; window.location.href = `${Constants.API_ADDRESS}/calendar/auth/google`;
}} }}
> >
LOGIN with GOOGLE {t("calendar.googleCalendarNotConnected.button")}
</Button> </Button>
}
/>
</MyCenteredContainer>
) : (
<>
<h1>{t("calendar.pageTitle")}</h1>
<Row gutter={[16, 16]}> <Row gutter={[16, 16]}>
<Col xs={24} md={12}> <Col xs={24} md={12}>
@ -74,6 +85,8 @@ export default function StoreCalendar() {
</Col> </Col>
</Row> </Row>
</> </>
)}
</>
); );
} }
@ -175,7 +188,7 @@ function CardStoreCalendarSettings({ settings }) {
}, []); }, []);
useEffect(() => { useEffect(() => {
// undefined on first render+ // undefined on first render
// null when input is empty // null when input is empty
if ( if (
calendarMaxFutureBookingDays === undefined || calendarMaxFutureBookingDays === undefined ||

View File

@ -1,12 +1,5 @@
import { PlusOutlined } from "@ant-design/icons"; import { PlusOutlined } from "@ant-design/icons";
import { import { Button, Checkbox, Form, Grid, Popconfirm, Space } from "antd";
Button,
Checkbox,
Form,
Grid,
Popconfirm,
Space,
} from "antd";
import MyModal, { import MyModal, {
MyModalCloseCreateButtonFooter, MyModalCloseCreateButtonFooter,
MyModalCloseSaveButtonFooter, MyModalCloseSaveButtonFooter,
@ -57,12 +50,12 @@ export default function StoreEmployees() {
key: "username", key: "username",
}, },
{ {
title: t("common.maxFutureBookingDays"), title: t("common.calendarMaxFutureBookingDays"),
dataIndex: "calendarMaxFutureBookingDays", dataIndex: "calendarMaxFutureBookingDays",
key: "calendarMaxFutureBookingDays", key: "calendarMaxFutureBookingDays",
}, },
{ {
title: t("common.minEarliestBookingTime"), title: t("common.calendarMinEarliestBookingTime"),
dataIndex: "calendarMinEarliestBookingTime", dataIndex: "calendarMinEarliestBookingTime",
key: "calendarMinEarliestBookingTime", key: "calendarMinEarliestBookingTime",
}, },