diff --git a/assets/icons/schedule_Inching_icon.svg b/assets/icons/schedule_Inching_icon.svg
new file mode 100644
index 0000000..d68c04b
--- /dev/null
+++ b/assets/icons/schedule_Inching_icon.svg
@@ -0,0 +1,10 @@
+
diff --git a/assets/icons/schedule_celender_icon.svg b/assets/icons/schedule_celender_icon.svg
new file mode 100644
index 0000000..8c00844
--- /dev/null
+++ b/assets/icons/schedule_celender_icon.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/icons/schedule_circulate_icon.svg b/assets/icons/schedule_circulate_icon.svg
new file mode 100644
index 0000000..d5a3fdc
--- /dev/null
+++ b/assets/icons/schedule_circulate_icon.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/icons/schedule_time_icon.svg b/assets/icons/schedule_time_icon.svg
new file mode 100644
index 0000000..7cfd4b7
--- /dev/null
+++ b/assets/icons/schedule_time_icon.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/icons/water_heater_off.svg b/assets/icons/water_heater_off.svg
new file mode 100644
index 0000000..40ab6fb
--- /dev/null
+++ b/assets/icons/water_heater_off.svg
@@ -0,0 +1,29 @@
+
diff --git a/assets/icons/water_heater_on.svg b/assets/icons/water_heater_on.svg
new file mode 100644
index 0000000..f26cb36
--- /dev/null
+++ b/assets/icons/water_heater_on.svg
@@ -0,0 +1,29 @@
+
diff --git a/lib/features/devices/bloc/water_heater_bloc/water_heater_bloc.dart b/lib/features/devices/bloc/water_heater_bloc/water_heater_bloc.dart
new file mode 100644
index 0000000..3ff1747
--- /dev/null
+++ b/lib/features/devices/bloc/water_heater_bloc/water_heater_bloc.dart
@@ -0,0 +1,311 @@
+import 'dart:async';
+import 'package:dio/dio.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
+import 'package:syncrow_app/features/devices/bloc/water_heater_bloc/water_heater_event.dart';
+import 'package:syncrow_app/features/devices/bloc/water_heater_bloc/water_heater_state.dart';
+import 'package:syncrow_app/features/devices/model/device_control_model.dart';
+import 'package:syncrow_app/features/devices/model/device_model.dart';
+import 'package:syncrow_app/features/devices/model/schedule_model.dart';
+import 'package:syncrow_app/features/devices/model/status_model.dart';
+import 'package:syncrow_app/features/devices/model/water_heater.dart';
+import 'package:syncrow_app/services/api/devices_api.dart';
+import 'package:syncrow_app/utils/helpers/snack_bar.dart';
+
+class WaterHeaterBloc extends Bloc {
+ final String whId;
+ final String switchCode;
+ WHModel deviceStatus = WHModel(
+ firstSwitch: false,firstCountDown: 0
+ );
+ List deviceStatusList = [];
+ List devicesList = [];
+ bool allAcsPage = false;
+ bool allAcsOn = true;
+ bool allTempSame = true;
+ int globalTemp = 25;
+ Timer? _timer;
+
+
+ bool toggleSchedule = true;
+ List selectedDays = [];
+ bool createSchedule = false;
+ bool createCirculate = false;
+ List listSchedule = [];
+ DateTime? selectedTime=DateTime.now();
+
+ WaterHeaterBloc({required this.whId,required this.switchCode}) : super(WHInitialState()) {
+ on(_fetchWaterHeaterStatus);
+ on(_changeFirstSwitch);
+
+ on(_setCounterValue);
+ on(_getCounterValue);
+
+ on(toggleDaySelection);
+ on(saveSchedule);
+ on(getSchedule);
+ on(toggleChange);
+ on(deleteSchedule);
+ on(_onTickTimer);
+ on(_onClose);
+ }
+
+ void _fetchWaterHeaterStatus(WaterHeaterInitial event, Emitter emit) async {
+ emit(WHLoadingState());
+ try {
+ var response = await DevicesAPI.getDeviceStatus(whId);
+ List statusModelList = [];
+ for (var status in response['status']) {
+ statusModelList.add(StatusModel.fromJson(status));
+ }
+ deviceStatus = WHModel.fromJson(statusModelList, );
+ emit(UpdateState(whModel: deviceStatus));
+ Future.delayed(const Duration(milliseconds: 500));
+ // _listenToChanges();
+ } catch (e) {
+ emit(WHFailedState(errorMessage: e.toString()));
+ return;
+ }
+ }
+
+
+ void _changeFirstSwitch(WaterHeaterSwitch event, Emitter emit) async {
+ emit(LoadingNewSate(whModel: deviceStatus));
+ try {
+ deviceStatus.firstSwitch = !event.whSwitch;
+ emit(UpdateState(whModel: deviceStatus));
+ if (_timer != null) {
+ _timer!.cancel();
+ }
+ _timer = Timer(const Duration(milliseconds: 500), () async {
+ final response = await DevicesAPI.controlDevice(
+ DeviceControlModel(
+ deviceId: whId,
+ code: 'switch_1',
+ value: deviceStatus.firstSwitch ),
+ whId);
+
+ if (!response['success']) {
+ // add(InitialEvent(groupScreen: oneGangGroup));
+ }
+ });
+ } catch (_) {
+ emit(WHFailedState(errorMessage: _.toString()));
+ }
+ }
+
+
+
+
+
+ //=====================---------- timer ----------------------------------------
+
+ void _setCounterValue(SetCounterValue event, Emitter emit) async {
+ emit(LoadingNewSate(whModel: deviceStatus));
+ int seconds = 0;
+ try {
+ seconds = event.duration.inSeconds;
+ final response = await DevicesAPI.controlDevice(
+ DeviceControlModel(deviceId: whId, code: event.deviceCode, value: seconds),
+ whId);
+
+ if (response['success'] ?? false) {
+ if (event.deviceCode == 'countdown_1') {
+ deviceStatus.firstCountDown = seconds;
+ }
+ } else {
+ emit(const WHFailedState(errorMessage: 'Something went wrong'));
+ return;
+ }
+ } catch (e) {
+ emit(const WHFailedState(errorMessage: 'Something went wrong'));
+ return;
+ }
+ if (seconds > 0) {
+ _onStartTimer(seconds);
+ } else {
+ _timer?.cancel();
+ emit(TimerRunComplete());
+ }
+ }
+
+ void _getCounterValue(GetCounterEvent event, Emitter emit) async {
+ emit(WHLoadingState());
+ try {
+ var response = await DevicesAPI.getDeviceStatus(whId);
+ List statusModelList = [];
+ for (var status in response['status']) {
+ statusModelList.add(StatusModel.fromJson(status));
+ }
+ deviceStatus = WHModel.fromJson(statusModelList);
+
+ if (event.deviceCode == 'countdown_1') {
+ deviceStatus.firstCountDown > 0
+ ? _onStartTimer(deviceStatus.firstCountDown)
+ : emit(UpdateTimerState(seconds: deviceStatus.firstCountDown));
+ }
+ } catch (e) {
+ WHFailedState(errorMessage: e.toString());
+ return;
+ }
+ }
+
+ void _onClose(OnClose event, Emitter emit) {
+ _timer?.cancel();
+ }
+
+ void _onStartTimer(int seconds) {
+ _timer?.cancel();
+ _timer = Timer.periodic(const Duration(seconds: 1), (timer) {
+ add(TickTimer(seconds - timer.tick));
+ });
+ }
+
+ void _onTickTimer(TickTimer event, Emitter emit) {
+ if (event.remainingTime > 0) {
+ emit(TimerRunInProgress(event.remainingTime));
+ } else {
+ _timer?.cancel();
+ emit(TimerRunComplete());
+ }
+ }
+
+
+
+
+ //=====================---------- Schedule ----------------------------------------
+
+
+
+ List