|
|
@@ -11,6 +11,9 @@ import StatusIndicator, { StatusType } from "../base/status_indicator";
|
|
|
import { MainColorType } from "@/context/themes/color";
|
|
|
import { IconNotification, IconNotificationOff } from "@/components/basic/Icons";
|
|
|
import ConsoleCell from "../components/console_cell";
|
|
|
+import Layout from "@/components/layout/layout";
|
|
|
+import { NaviBarTitleShowType, TemplateType } from "@/utils/types";
|
|
|
+import Card from "../components/card";
|
|
|
|
|
|
let useRoute;
|
|
|
let useNavigation;
|
|
|
@@ -131,74 +134,93 @@ export default function MoveSchedule() {
|
|
|
return <Text></Text>
|
|
|
}
|
|
|
|
|
|
- return <View style={{ display: 'flex', flexDirection: 'column' }}>
|
|
|
- <NewHeader type={NewHeaderType.left} title="Upcoming Check Ins" />
|
|
|
- {
|
|
|
- hours.length == 0 && <View style={{ display: 'flex', flex: 1, flexDirection: 'column', alignItems: 'center', marginTop: rpxToPx(110) }}>
|
|
|
- <Image src={require('@assets/_health/sleep2.png')} style={{ width: rpxToPx(64), height: rpxToPx(64) }} />
|
|
|
- <Text style={{ marginTop: rpxToPx(24), fontSize: rpxToPx(50), fontWeight: 'bold', color: '#B2B2B2' }}>睡个好觉</Text>
|
|
|
- </View>
|
|
|
- }
|
|
|
- {
|
|
|
- hours.map((item, index) => {
|
|
|
- var start = item.hour
|
|
|
- var open: any = start
|
|
|
- var end = start + 1
|
|
|
- start = (start + '').padStart(2, '0')
|
|
|
- end = (end + '').padStart(2, '0')
|
|
|
-
|
|
|
- open = (open + '').padStart(2, '0')
|
|
|
- if (item.status != 'WFS') return <View key={index} />
|
|
|
- return <ConsoleCell key={index}
|
|
|
- moveCell
|
|
|
- status={<StatusIndicator type={StatusType.normal}
|
|
|
- color={MainColorType.active}
|
|
|
- text={'WAKING HOUR ' + (index + 1)} />}
|
|
|
- title={`Check in at ${open}:50`}
|
|
|
- description={`${parseInt(start) < new Date().getHours() ? '' : ''}${start}:00-${end}:00`}
|
|
|
- subDesc={<Text className="schedule_item_time"> {firstTime(index)}</Text>}
|
|
|
- right={<View style={{
|
|
|
- display: 'flex',
|
|
|
- flexDirection: 'row',
|
|
|
- alignItems: 'center'
|
|
|
- }}>
|
|
|
- {
|
|
|
- item.reminder ? <IconNotification color={MainColorType.g03} width={rpxToPx(28)} /> : <IconNotificationOff color={MainColorType.g03} width={rpxToPx(28)} />
|
|
|
- }
|
|
|
- <View style={{ width: rpxToPx(12) }} />
|
|
|
- <Switch checked={item.reminder} color={getThemeColor('ACTIVE')} onChange={e => {
|
|
|
- console.log(item)
|
|
|
-
|
|
|
- createSchedule({
|
|
|
- schedules: [{
|
|
|
- id: item.schedule_id,
|
|
|
- reminder: e.detail.value
|
|
|
- }],
|
|
|
- }).then(res => {
|
|
|
- getData()
|
|
|
- if (global.refreshWindow) {
|
|
|
- global.refreshWindow()
|
|
|
- }
|
|
|
- if (global.refreshSchedules) {
|
|
|
- global.refreshSchedules()
|
|
|
- }
|
|
|
- if (global.updateMove) {
|
|
|
- global.updateMove()
|
|
|
- }
|
|
|
- })
|
|
|
- }} />
|
|
|
- </View>}
|
|
|
- disable={true}
|
|
|
- onClick={() => { }}
|
|
|
- showLine={true}
|
|
|
- fullLine={false}
|
|
|
-
|
|
|
- />
|
|
|
-
|
|
|
- })
|
|
|
- }
|
|
|
- <Text className="no_more" style={{ color: '#5C7099' }} onClick={() => {
|
|
|
- jumpPage('./move_setting_reminder')
|
|
|
- }}>Full schedules</Text>
|
|
|
- </View>
|
|
|
+ function detailContent() {
|
|
|
+
|
|
|
+
|
|
|
+ return <View style={{ display: 'flex', flexDirection: 'column' }}>
|
|
|
+ <NewHeader type={NewHeaderType.left} title="Upcoming Check Ins" />
|
|
|
+ {
|
|
|
+ hours.length == 0 && <View style={{ display: 'flex', flex: 1, flexDirection: 'column', alignItems: 'center', marginTop: rpxToPx(110) }}>
|
|
|
+ <Image src={require('@assets/_health/sleep2.png')} style={{ width: rpxToPx(64), height: rpxToPx(64) }} />
|
|
|
+ <Text style={{ marginTop: rpxToPx(24), fontSize: rpxToPx(50), fontWeight: 'bold', color: '#B2B2B2' }}>睡个好觉</Text>
|
|
|
+ </View>
|
|
|
+ }
|
|
|
+ <Card>
|
|
|
+ <View style={{ display: 'flex', flexDirection: 'column', width: rpxToPx(700) }}>
|
|
|
+ {
|
|
|
+ hours.map((item, index) => {
|
|
|
+ var start = item.hour
|
|
|
+ var open: any = start
|
|
|
+ var end = start + 1
|
|
|
+ start = (start + '').padStart(2, '0')
|
|
|
+ end = (end + '').padStart(2, '0')
|
|
|
+
|
|
|
+ open = (open + '').padStart(2, '0')
|
|
|
+ if (item.status != 'WFS') return <View key={index} />
|
|
|
+ return <ConsoleCell key={index}
|
|
|
+ moveCell
|
|
|
+ status={<StatusIndicator type={StatusType.normal}
|
|
|
+ color={MainColorType.active}
|
|
|
+ text={'WAKING HOUR ' + (index + 1)} />}
|
|
|
+ title={`Check in at ${open}:50`}
|
|
|
+ description={`${parseInt(start) < new Date().getHours() ? '' : ''}${start}:00-${end}:00`}
|
|
|
+ subDesc={<Text className="schedule_item_time"> {firstTime(index)}</Text>}
|
|
|
+ right={<View style={{
|
|
|
+ display: 'flex',
|
|
|
+ flexDirection: 'row',
|
|
|
+ alignItems: 'center'
|
|
|
+ }}>
|
|
|
+ {
|
|
|
+ item.reminder ? <IconNotification color={MainColorType.g03} width={rpxToPx(28)} /> : <IconNotificationOff color={MainColorType.g03} width={rpxToPx(28)} />
|
|
|
+ }
|
|
|
+ <View style={{ width: rpxToPx(12) }} />
|
|
|
+ <Switch checked={item.reminder} color={getThemeColor('ACTIVE')} onChange={e => {
|
|
|
+ console.log(item)
|
|
|
+
|
|
|
+ createSchedule({
|
|
|
+ schedules: [{
|
|
|
+ id: item.schedule_id,
|
|
|
+ reminder: e.detail.value
|
|
|
+ }],
|
|
|
+ }).then(res => {
|
|
|
+ getData()
|
|
|
+ if (global.refreshWindow) {
|
|
|
+ global.refreshWindow()
|
|
|
+ }
|
|
|
+ if (global.refreshSchedules) {
|
|
|
+ global.refreshSchedules()
|
|
|
+ }
|
|
|
+ if (global.updateMove) {
|
|
|
+ global.updateMove()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }} />
|
|
|
+ <View style={{marginRight:-rpxToPx(14)}}/>
|
|
|
+ </View>}
|
|
|
+ disable={true}
|
|
|
+ onClick={() => { }}
|
|
|
+ showLine={true}
|
|
|
+ fullLine={false}
|
|
|
+
|
|
|
+ />
|
|
|
+
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </View>
|
|
|
+ </Card>
|
|
|
+
|
|
|
+ <Text className="no_more" style={{ color: '#5C7099' }} onClick={() => {
|
|
|
+ jumpPage('./move_setting_reminder')
|
|
|
+ }}>Full schedules</Text>
|
|
|
+ </View>
|
|
|
+ }
|
|
|
+
|
|
|
+ return <Layout children={detailContent()}
|
|
|
+ // title={router.params.title}
|
|
|
+ header={null}
|
|
|
+ secondPage={true}
|
|
|
+ titleColor={'#fff'}
|
|
|
+ title={'Upcoming Check Ins'}
|
|
|
+ type={TemplateType.customHeader}
|
|
|
+ titleShowStyle={NaviBarTitleShowType.scrollToShow} />
|
|
|
}
|