Refactor schedule components and update imports for garage door and w… (#271)

…ater heater modules

<!--
  Thanks for contributing!

Provide a description of your changes below and a general summary in the
title

Please look at the following checklist to ensure that your PR can be
accepted quickly:
-->

## Jira Ticket
[SP-1620](https://syncrow.atlassian.net/browse/SP-1620)

## Description

<!--- Describe your changes in detail -->
Refactor schedule components and make this fetcher as a reusable and fix
bugs related to it

## Type of Change

<!--- Put an `x` in all the boxes that apply: -->

- [ x]  New feature (non-breaking change which adds functionality)
- [x] 🛠️ Bug fix (non-breaking change which fixes an issue)
- [ ]  Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] 🧹 Code refactor
- [ ]  Build configuration change
- [ ] 📝 Documentation
- [ ] 🗑️ Chore 


[SP-1620]:
https://syncrow.atlassian.net/browse/SP-1620?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
This commit is contained in:
mohammadnemer1
2025-06-22 12:27:03 +03:00
committed by GitHub
41 changed files with 2303 additions and 1005 deletions

View File

@ -1,3 +1,4 @@
import 'dart:convert';
import 'dart:core';
import 'package:flutter/material.dart';
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_reports.dart';
@ -386,4 +387,34 @@ class DevicesManagementApi {
);
return response;
}
Future<bool> postSchedule({
required String category,
required String deviceId,
required String time,
required String code,
required bool value,
required List<String> days,
}) async {
final response = await HTTPService().post(
path: ApiEndpoints.saveSchedule.replaceAll('{deviceUuid}', deviceId),
showServerMessage: false,
body: jsonEncode(
{
'category': category,
'time': time,
'function': {
'code': code,
'value': value,
},
'days': days
},
),
expectedResponseModel: (json) {
return json['success'] ?? false;
},
);
return response;
}
}