75 lines
1.8 KiB
Dart
75 lines
1.8 KiB
Dart
// lib/app/modules/schedule/controllers/schedule_controller.dart
|
|
import 'package:get/get.dart';
|
|
|
|
class PatientSchedule {
|
|
final String id;
|
|
final String name;
|
|
final String room;
|
|
final String deviceId;
|
|
final String medicineType;
|
|
final String fluidType;
|
|
final String medicineTime;
|
|
final String fluidTime;
|
|
|
|
PatientSchedule({
|
|
required this.id,
|
|
required this.name,
|
|
required this.room,
|
|
required this.deviceId,
|
|
required this.medicineType,
|
|
required this.fluidType,
|
|
required this.medicineTime,
|
|
required this.fluidTime,
|
|
});
|
|
}
|
|
|
|
class ScheduleController extends GetxController {
|
|
final selectedTab = 0.obs;
|
|
final selectedDate = DateTime.now().obs;
|
|
|
|
final schedules = <PatientSchedule>[
|
|
PatientSchedule(
|
|
id: '1',
|
|
name: 'Mrs. Shinta',
|
|
room: 'Ruang Mawar 002',
|
|
deviceId: 'SI001',
|
|
medicineType: 'Obat & Dosis',
|
|
fluidType: 'Cairan & Tetes',
|
|
medicineTime: 'Amoxicillin 3 ml',
|
|
fluidTime: 'Mnt 30 tetes /jam',
|
|
),
|
|
PatientSchedule(
|
|
id: '2',
|
|
name: 'Mr. Parjo',
|
|
room: 'Ruang Melati 001',
|
|
deviceId: 'SI001',
|
|
medicineType: 'Obat & Dosis',
|
|
fluidType: 'Cairan & Tetes',
|
|
medicineTime: 'Amoxicillin 3 ml',
|
|
fluidTime: 'Mnt 30 tetes /jam',
|
|
),
|
|
].obs;
|
|
|
|
void changeTab(int index) {
|
|
selectedTab.value = index;
|
|
}
|
|
|
|
void selectDate(DateTime date) {
|
|
selectedDate.value = date;
|
|
}
|
|
|
|
void addSchedule(PatientSchedule schedule) {
|
|
schedules.add(schedule);
|
|
}
|
|
|
|
void updateSchedule(String id, PatientSchedule updatedSchedule) {
|
|
final index = schedules.indexWhere((s) => s.id == id);
|
|
if (index != -1) {
|
|
schedules[index] = updatedSchedule;
|
|
}
|
|
}
|
|
|
|
void deleteSchedule(String id) {
|
|
schedules.removeWhere((s) => s.id == id);
|
|
}
|
|
} |