mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-11 15:47:44 +00:00
Compare commits
10 Commits
SP-1660-fe
...
fix-occupa
Author | SHA1 | Date | |
---|---|---|---|
cdc76c2c8e | |||
dfb120e7cf | |||
4d51321675 | |||
b5e7776ccb | |||
32938404dd | |||
0cfd58d820 | |||
d4625a8f04 | |||
9f24606613 | |||
e87dffd76b | |||
0c220a1f34 |
@ -39,8 +39,12 @@ class AnalyticsDevice {
|
|||||||
? ProductDevice.fromJson(json['productDevice'] as Map<String, dynamic>)
|
? ProductDevice.fromJson(json['productDevice'] as Map<String, dynamic>)
|
||||||
: null,
|
: null,
|
||||||
spaceUuid: json['spaceUuid'] as String?,
|
spaceUuid: json['spaceUuid'] as String?,
|
||||||
latitude: json['lat'] != null ? double.parse(json['lat'] as String? ?? '0.0') : null,
|
latitude: json['lat'] != null && json['lat'] != ''
|
||||||
longitude: json['lon'] != null ? double.parse(json['lon'] as String? ?? '0.0') : null,
|
? double.tryParse(json['lat']?.toString() ?? '0.0')
|
||||||
|
: null,
|
||||||
|
longitude: json['lon'] != null && json['lon'] != ''
|
||||||
|
? double.tryParse(json['lon']?.toString() ?? '0.0')
|
||||||
|
: null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,16 @@ class Status {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Status copyWith({
|
||||||
|
String? code,
|
||||||
|
dynamic value,
|
||||||
|
}) {
|
||||||
|
return Status(
|
||||||
|
code: code ?? this.code,
|
||||||
|
value: value ?? this.value,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
factory Status.fromJson(String source) => Status.fromMap(json.decode(source));
|
factory Status.fromJson(String source) => Status.fromMap(json.decode(source));
|
||||||
|
|
||||||
String toJson() => json.encode(toMap());
|
String toJson() => json.encode(toMap());
|
||||||
|
@ -286,11 +286,20 @@ class ScheduleBloc extends Bloc<ScheduleEvent, ScheduleState> {
|
|||||||
try {
|
try {
|
||||||
if (state is ScheduleLoaded) {
|
if (state is ScheduleLoaded) {
|
||||||
final dateTime = DateTime.parse(event.time);
|
final dateTime = DateTime.parse(event.time);
|
||||||
|
Status status = Status(code: '', value: '');
|
||||||
|
if (event.category == 'CUR_2') {
|
||||||
|
status = status.copyWith(
|
||||||
|
code: 'control',
|
||||||
|
value: event.functionOn == true ? 'open' : 'close');
|
||||||
|
} else {
|
||||||
|
status =
|
||||||
|
status.copyWith(code: event.category, value: event.functionOn);
|
||||||
|
}
|
||||||
final updatedSchedule = ScheduleEntry(
|
final updatedSchedule = ScheduleEntry(
|
||||||
scheduleId: event.scheduleId,
|
scheduleId: event.scheduleId,
|
||||||
category: event.category,
|
category: event.category,
|
||||||
time: getTimeStampWithoutSeconds(dateTime).toString(),
|
time: getTimeStampWithoutSeconds(dateTime).toString(),
|
||||||
function: Status(code: event.category, value: event.functionOn),
|
function: status,
|
||||||
days: event.selectedDays,
|
days: event.selectedDays,
|
||||||
);
|
);
|
||||||
final success = await DevicesManagementApi().editScheduleRecord(
|
final success = await DevicesManagementApi().editScheduleRecord(
|
||||||
|
@ -52,9 +52,12 @@ class BuildScheduleView extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
const ScheduleHeader(),
|
const ScheduleHeader(),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
ScheduleModeSelector(
|
if (category == 'CUR_2')
|
||||||
currentMode: state.scheduleMode,
|
const SizedBox()
|
||||||
),
|
else
|
||||||
|
ScheduleModeSelector(
|
||||||
|
currentMode: state.scheduleMode,
|
||||||
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
if (state.scheduleMode == ScheduleModes.schedule)
|
if (state.scheduleMode == ScheduleModes.schedule)
|
||||||
ScheduleManagementUI(
|
ScheduleManagementUI(
|
||||||
|
@ -212,12 +212,20 @@ class _ScheduleTableView extends StatelessWidget {
|
|||||||
isEdit: true,
|
isEdit: true,
|
||||||
).then((updatedSchedule) {
|
).then((updatedSchedule) {
|
||||||
if (updatedSchedule != null) {
|
if (updatedSchedule != null) {
|
||||||
|
bool temp;
|
||||||
|
if (schedule.category == 'CUR_2') {
|
||||||
|
updatedSchedule.function.value == 'open'
|
||||||
|
? temp = true
|
||||||
|
: temp = false;
|
||||||
|
} else {
|
||||||
|
temp = updatedSchedule.function.value;
|
||||||
|
}
|
||||||
context.read<ScheduleBloc>().add(
|
context.read<ScheduleBloc>().add(
|
||||||
ScheduleEditEvent(
|
ScheduleEditEvent(
|
||||||
scheduleId: schedule.scheduleId,
|
scheduleId: schedule.scheduleId,
|
||||||
category: schedule.category,
|
category: schedule.category,
|
||||||
time: updatedSchedule.time,
|
time: updatedSchedule.time,
|
||||||
functionOn: updatedSchedule.function.value,
|
functionOn: temp,
|
||||||
selectedDays: updatedSchedule.days),
|
selectedDays: updatedSchedule.days),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -58,11 +58,14 @@ class ProductModel {
|
|||||||
'3G': Assets.Gang3SwitchIcon,
|
'3G': Assets.Gang3SwitchIcon,
|
||||||
'3GT': Assets.threeTouchSwitch,
|
'3GT': Assets.threeTouchSwitch,
|
||||||
'CUR': Assets.curtain,
|
'CUR': Assets.curtain,
|
||||||
|
'CUR_2': Assets.curtain,
|
||||||
'GD': Assets.garageDoor,
|
'GD': Assets.garageDoor,
|
||||||
'GW': Assets.SmartGatewayIcon,
|
'GW': Assets.SmartGatewayIcon,
|
||||||
'DL': Assets.DoorLockIcon,
|
'DL': Assets.DoorLockIcon,
|
||||||
'WL': Assets.waterLeakSensor,
|
'WL': Assets.waterLeakSensor,
|
||||||
'WH': Assets.waterHeater,
|
'WH': Assets.waterHeater,
|
||||||
|
'WM': Assets.waterLeakSensor,
|
||||||
|
'SOS': Assets.sos,
|
||||||
'AC': Assets.ac,
|
'AC': Assets.ac,
|
||||||
'CPS': Assets.presenceSensor,
|
'CPS': Assets.presenceSensor,
|
||||||
'PC': Assets.powerClamp,
|
'PC': Assets.powerClamp,
|
||||||
|
Reference in New Issue
Block a user