Merge branch 'faiz_kiosk'
commit
106e3a15e7
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 30 KiB |
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||||
|
<svg width="100px" height="100px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M3 15H21M3 19H15M3 7H11M3 11H11M19.4 11H16.6C16.0399 11 15.7599 11 15.546 10.891C15.3578 10.7951 15.2049 10.6422 15.109 10.454C15 10.2401 15 9.96005 15 9.4V6.6C15 6.03995 15 5.75992 15.109 5.54601C15.2049 5.35785 15.3578 5.20487 15.546 5.10899C15.7599 5 16.0399 5 16.6 5H19.4C19.9601 5 20.2401 5 20.454 5.10899C20.6422 5.20487 20.7951 5.35785 20.891 5.54601C21 5.75992 21 6.03995 21 6.6V9.4C21 9.96005 21 10.2401 20.891 10.454C20.7951 10.6422 20.6422 10.7951 20.454 10.891C20.2401 11 19.9601 11 19.4 11Z" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 824 B |
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||||
|
<svg width="100px" height="100px" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 0H6V2H10V4H8.86807C8.57073 5.66996 7.78574 7.17117 6.6656 8.35112C7.46567 8.73941 8.35737 8.96842 9.29948 8.99697L10.2735 6H12.7265L15.9765 16H13.8735L13.2235 14H9.77647L9.12647 16H7.0235L8.66176 10.9592C7.32639 10.8285 6.08165 10.3888 4.99999 9.71246C3.69496 10.5284 2.15255 11 0.5 11H0V9H0.5C1.5161 9 2.47775 8.76685 3.33437 8.35112C2.68381 7.66582 2.14629 6.87215 1.75171 6H4.02179C4.30023 6.43491 4.62904 6.83446 4.99999 7.19044C5.88743 6.33881 6.53369 5.23777 6.82607 4H0V2H4V0ZM12.5735 12L11.5 8.69688L10.4265 12H12.5735Z" fill="#000000"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 825 B |
@ -1,15 +1,18 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:hmg_qline/views/main_queue_screen/main_queue_screen.dart';
|
import 'package:hmg_qline/views/main_queue_screen/main_queue_screen.dart';
|
||||||
import 'package:hmg_qline/views/splash_screen/splash_screen.dart';
|
import 'package:hmg_qline/views/splash_screen/splash_screen.dart';
|
||||||
|
import 'package:hmg_qline/views/kiosk_screens/kiosk_main_screen.dart';
|
||||||
|
|
||||||
class AppRoutes {
|
class AppRoutes {
|
||||||
//User
|
//User
|
||||||
static const String splash = "/splash";
|
static const String splash = "/splash";
|
||||||
static const String mainQueueScreen = "/mainQueueScreen";
|
static const String mainQueueScreen = "/mainQueueScreen";
|
||||||
|
static const String kioskMainScreen = "/kioskMainScreen";
|
||||||
static const String initialRoute = splash;
|
static const String initialRoute = splash;
|
||||||
|
|
||||||
static final Map<String, WidgetBuilder> routes = {
|
static final Map<String, WidgetBuilder> routes = {
|
||||||
splash: (context) => const SplashScreen(),
|
splash: (context) => const SplashScreen(),
|
||||||
|
kioskMainScreen: (context) => const KioskMainScreen(),
|
||||||
mainQueueScreen: (context) => const MainQueueScreen(),
|
mainQueueScreen: (context) => const MainQueueScreen(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,56 @@
|
|||||||
|
class KioskQueueModel {
|
||||||
|
int? id;
|
||||||
|
int? projectID;
|
||||||
|
String? projectName;
|
||||||
|
String? projectNameN;
|
||||||
|
int? queueID;
|
||||||
|
String? queueName;
|
||||||
|
String? queueNameN;
|
||||||
|
int? kioskID;
|
||||||
|
String? kioskName;
|
||||||
|
String? kioskNameN;
|
||||||
|
String? ipAddress;
|
||||||
|
bool? isActive;
|
||||||
|
int? createdBy;
|
||||||
|
String? createdOn;
|
||||||
|
dynamic editedBy;
|
||||||
|
dynamic editedOn;
|
||||||
|
|
||||||
|
KioskQueueModel({
|
||||||
|
this.id,
|
||||||
|
this.projectID,
|
||||||
|
this.projectName,
|
||||||
|
this.projectNameN,
|
||||||
|
this.queueID,
|
||||||
|
this.queueName,
|
||||||
|
this.queueNameN,
|
||||||
|
this.kioskID,
|
||||||
|
this.kioskName,
|
||||||
|
this.kioskNameN,
|
||||||
|
this.ipAddress,
|
||||||
|
this.isActive,
|
||||||
|
this.createdBy,
|
||||||
|
this.createdOn,
|
||||||
|
this.editedBy,
|
||||||
|
this.editedOn,
|
||||||
|
});
|
||||||
|
|
||||||
|
KioskQueueModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
id = json['id'];
|
||||||
|
projectID = json['projectID'];
|
||||||
|
projectName = json['projectName'];
|
||||||
|
projectNameN = json['projectNameN'];
|
||||||
|
queueID = json['queueID'];
|
||||||
|
queueName = json['queueName'];
|
||||||
|
queueNameN = json['queueNameN'];
|
||||||
|
kioskID = json['kioskID'];
|
||||||
|
kioskName = json['kioskName'];
|
||||||
|
kioskNameN = json['kioskNameN'];
|
||||||
|
ipAddress = json['ipAddress'];
|
||||||
|
isActive = json['isActive'];
|
||||||
|
createdBy = json['createdBy'];
|
||||||
|
createdOn = json['createdOn'];
|
||||||
|
editedBy = json['editedBy'];
|
||||||
|
editedOn = json['editedOn'];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
class KioskPatientTicket {
|
||||||
|
String? patientCallNo;
|
||||||
|
int? projectID;
|
||||||
|
int? ticketQueueID;
|
||||||
|
int? result;
|
||||||
|
|
||||||
|
KioskPatientTicket({
|
||||||
|
this.patientCallNo,
|
||||||
|
this.projectID,
|
||||||
|
this.ticketQueueID,
|
||||||
|
this.result,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory KioskPatientTicket.fromJson(Map<String, dynamic> json) {
|
||||||
|
return KioskPatientTicket(
|
||||||
|
patientCallNo: json['patientCallNo'],
|
||||||
|
projectID: json['projectID'],
|
||||||
|
ticketQueueID: json['ticketQueueID'],
|
||||||
|
result: json['result'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,191 @@
|
|||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
import 'package:hmg_qline/constants/app_constants.dart';
|
||||||
|
import 'package:hmg_qline/utilities/enums.dart';
|
||||||
|
import 'package:hmg_qline/view_models/screen_config_view_model.dart';
|
||||||
|
import 'package:hmg_qline/views/common_widgets/app_texts_widget.dart';
|
||||||
|
import 'package:hmg_qline/views/view_helpers/size_config.dart';
|
||||||
|
|
||||||
|
Widget getWeatherWidget(ScreenConfigViewModel screenConfigViewModel) {
|
||||||
|
if (screenConfigViewModel.weathersWidgetModel.maxTemp == null || screenConfigViewModel.weathersWidgetModel.minTemp == null || screenConfigViewModel.weathersWidgetModel.iconPhrase == null) {
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
return Container(
|
||||||
|
height: (screenConfigViewModel.globalConfigurationsModel.orientationTypeEnum == ScreenOrientationEnum.portraitUp ||
|
||||||
|
screenConfigViewModel.globalConfigurationsModel.orientationTypeEnum == ScreenOrientationEnum.portraitDown)
|
||||||
|
? SizeConfig.getHeightMultiplier() * 2
|
||||||
|
: SizeConfig.getHeightMultiplier() * 0.9,
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
|
||||||
|
margin: const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
|
||||||
|
decoration: AppColors.configWidgetDecoration,
|
||||||
|
child: Directionality(
|
||||||
|
textDirection: screenConfigViewModel.globalConfigurationsModel.textDirection,
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
AppText(
|
||||||
|
screenConfigViewModel.globalConfigurationsModel.weatherText,
|
||||||
|
color: Colors.grey,
|
||||||
|
fontSize: SizeConfig.getWidthMultiplier() * 2,
|
||||||
|
fontFamily: screenConfigViewModel.globalConfigurationsModel.screenLanguageEnum == LanguageEnum.arabic ? AppStrings.fontNameCairo : AppStrings.fontNamePoppins,
|
||||||
|
),
|
||||||
|
AppText(
|
||||||
|
"${screenConfigViewModel.globalConfigurationsModel.maxText}: ${screenConfigViewModel.weathersWidgetModel.maxTemp}°C , ${screenConfigViewModel.globalConfigurationsModel.minText}: ${screenConfigViewModel.weathersWidgetModel.minTemp}°C",
|
||||||
|
fontSize: SizeConfig.getWidthMultiplier() * 3,
|
||||||
|
fontHeight: 1,
|
||||||
|
fontFamily: screenConfigViewModel.globalConfigurationsModel.screenLanguageEnum == LanguageEnum.arabic ? AppStrings.fontNameCairo : AppStrings.fontNamePoppins,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(width: 15),
|
||||||
|
SvgPicture.asset(
|
||||||
|
screenConfigViewModel.weathersWidgetModel.weatherIconPath ?? AppAssets.weatherIcon,
|
||||||
|
height: SizeConfig.getHeightMultiplier() * 0.5,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget getPrayerWidget(ScreenConfigViewModel screenConfigViewModel) {
|
||||||
|
if (screenConfigViewModel.nextPrayerToShowWithTime.isEmpty) {
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
return SizedBox(
|
||||||
|
child: Container(
|
||||||
|
height: (screenConfigViewModel.globalConfigurationsModel.orientationTypeEnum == ScreenOrientationEnum.portraitUp ||
|
||||||
|
screenConfigViewModel.globalConfigurationsModel.orientationTypeEnum == ScreenOrientationEnum.portraitDown)
|
||||||
|
? SizeConfig.getHeightMultiplier() * 2
|
||||||
|
: SizeConfig.getHeightMultiplier() * 0.9,
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
|
||||||
|
margin: const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
|
||||||
|
decoration: AppColors.configWidgetDecoration,
|
||||||
|
child: Directionality(
|
||||||
|
textDirection: screenConfigViewModel.globalConfigurationsModel.textDirection,
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
AppText(
|
||||||
|
screenConfigViewModel.globalConfigurationsModel.nextPrayerText,
|
||||||
|
color: Colors.grey,
|
||||||
|
fontSize: SizeConfig.getWidthMultiplier() * 1.5,
|
||||||
|
fontFamily: screenConfigViewModel.globalConfigurationsModel.screenLanguageEnum == LanguageEnum.arabic ? AppStrings.fontNameCairo : AppStrings.fontNamePoppins,
|
||||||
|
),
|
||||||
|
AppText(
|
||||||
|
screenConfigViewModel.nextPrayerToShowWithTime,
|
||||||
|
fontSize: SizeConfig.getWidthMultiplier() * 3,
|
||||||
|
fontHeight: 1,
|
||||||
|
fontFamily: screenConfigViewModel.globalConfigurationsModel.screenLanguageEnum == LanguageEnum.arabic ? AppStrings.fontNameCairo : AppStrings.fontNamePoppins,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(width: 15),
|
||||||
|
SvgPicture.asset(
|
||||||
|
AppAssets.mosqueIcon,
|
||||||
|
height: SizeConfig.getWidthMultiplier() * 7,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
int getFlexForScreenTypes(ScreenConfigViewModel screenConfigVM) {
|
||||||
|
int flex = 1;
|
||||||
|
if (screenConfigVM.currentScreenTypeEnum == ScreenTypeEnum.roomLevelScreen) {
|
||||||
|
if (screenConfigVM.globalConfigurationsModel.orientationTypeEnum == ScreenOrientationEnum.portraitUp ||
|
||||||
|
screenConfigVM.globalConfigurationsModel.orientationTypeEnum == ScreenOrientationEnum.portraitDown) {
|
||||||
|
flex = 2;
|
||||||
|
} else {
|
||||||
|
flex = 3;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (screenConfigVM.globalConfigurationsModel.orientationTypeEnum == ScreenOrientationEnum.portraitUp ||
|
||||||
|
screenConfigVM.globalConfigurationsModel.orientationTypeEnum == ScreenOrientationEnum.portraitDown) {
|
||||||
|
flex = 2;
|
||||||
|
} else {
|
||||||
|
flex = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget counterNoText({required int counterNo, required bool isRoomNoRequired, required String roomText}) {
|
||||||
|
return AppText(
|
||||||
|
"$roomText $counterNo",
|
||||||
|
fontFamily: AppStrings.fontNamePoppins,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: isRoomNoRequired ? Colors.black : Colors.transparent,
|
||||||
|
fontSize: SizeConfig.getWidthMultiplier() * 8,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget noPatientInQueue({required String text, required String fontName, required String roomText, required bool isRoomNoRequired, required bool isForRoomLevel, required int counterNo}) {
|
||||||
|
Widget noPatientText = Center(
|
||||||
|
child: AppText(
|
||||||
|
text,
|
||||||
|
fontFamily: fontName,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: SizeConfig.getWidthMultiplier() * 9,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (isForRoomLevel) {
|
||||||
|
return Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
counterNoText(
|
||||||
|
counterNo: counterNo,
|
||||||
|
roomText: roomText,
|
||||||
|
isRoomNoRequired: isRoomNoRequired,
|
||||||
|
),
|
||||||
|
noPatientText,
|
||||||
|
const SizedBox.shrink()
|
||||||
|
],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return noPatientText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget commonSelectionCardKiosk({required ScreenConfigViewModel screenConfigViewModel, required String title, required String icon, required VoidCallback onTap}) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: onTap,
|
||||||
|
child: SizedBox(
|
||||||
|
child: Container(
|
||||||
|
constraints: BoxConstraints(minWidth: SizeConfig.getWidthMultiplier() * 40),
|
||||||
|
padding: const EdgeInsets.all(30),
|
||||||
|
margin: const EdgeInsets.all(10),
|
||||||
|
decoration: AppColors.configWidgetDecoration,
|
||||||
|
child: Directionality(
|
||||||
|
textDirection: screenConfigViewModel.globalConfigurationsModel.textDirection,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
SvgPicture.asset(icon, height: SizeConfig.getWidthMultiplier() * 12),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
AppText(
|
||||||
|
title,
|
||||||
|
fontSize: SizeConfig.getWidthMultiplier() * 6,
|
||||||
|
fontHeight: 1,
|
||||||
|
fontFamily: screenConfigViewModel.globalConfigurationsModel.screenLanguageEnum == LanguageEnum.arabic ? AppStrings.fontNameCairo : AppStrings.fontNamePoppins,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -0,0 +1,227 @@
|
|||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hmg_qline/constants/app_constants.dart';
|
||||||
|
import 'package:hmg_qline/models/generic_response_model.dart';
|
||||||
|
import 'package:hmg_qline/models/kiosk_queue_model.dart';
|
||||||
|
import 'package:hmg_qline/models/kiosk_ticket_model.dart';
|
||||||
|
import 'package:hmg_qline/utilities/enums.dart';
|
||||||
|
import 'package:hmg_qline/utilities/extensions.dart';
|
||||||
|
import 'package:hmg_qline/view_models/screen_config_view_model.dart';
|
||||||
|
import 'package:hmg_qline/views/common_widgets/app_footer.dart';
|
||||||
|
import 'package:hmg_qline/views/common_widgets/app_general_widgets.dart';
|
||||||
|
import 'package:hmg_qline/views/common_widgets/app_header.dart';
|
||||||
|
import 'package:hmg_qline/views/common_widgets/app_scaffold.dart';
|
||||||
|
import 'package:hmg_qline/views/common_widgets/app_texts_widget.dart';
|
||||||
|
import 'package:hmg_qline/views/view_helpers/size_config.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class KioskMainScreen extends StatelessWidget {
|
||||||
|
const KioskMainScreen({super.key});
|
||||||
|
|
||||||
|
Widget getBody({required BuildContext context}) {
|
||||||
|
return Consumer<ScreenConfigViewModel>(
|
||||||
|
builder: (BuildContext context, ScreenConfigViewModel screenConfigVM, Widget? child) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
if (screenConfigVM.globalConfigurationsModel.screenTypeEnum != ScreenTypeEnum.roomLevelScreen) ...[
|
||||||
|
Expanded(
|
||||||
|
flex: getFlexForScreenTypes(screenConfigVM),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
if (screenConfigVM.globalConfigurationsModel.isWeatherReq) ...[
|
||||||
|
getWeatherWidget(screenConfigVM),
|
||||||
|
],
|
||||||
|
const SizedBox(width: 20),
|
||||||
|
if (screenConfigVM.globalConfigurationsModel.isPrayerTimeReq) ...[
|
||||||
|
getPrayerWidget(screenConfigVM),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
Expanded(flex: 10, child: dataContentKiosk(context: context)),
|
||||||
|
if (!screenConfigVM.globalConfigurationsModel.isWeatherReq && !screenConfigVM.globalConfigurationsModel.isPrayerTimeReq) ...[
|
||||||
|
const SizedBox(height: 100),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget kioskLanguageStateWidget(ScreenConfigViewModel screenConfigViewModel) {
|
||||||
|
return GridView.builder(
|
||||||
|
itemCount: 2,
|
||||||
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2),
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(20),
|
||||||
|
child: commonSelectionCardKiosk(
|
||||||
|
screenConfigViewModel: screenConfigViewModel,
|
||||||
|
title: index == 0 ? "English" : "عربي",
|
||||||
|
icon: AppAssets.languageIcon,
|
||||||
|
onTap: () async {
|
||||||
|
if (index == 0) {
|
||||||
|
if (screenConfigViewModel.globalConfigurationsModel.kioskQueueList != null && screenConfigViewModel.globalConfigurationsModel.kioskQueueList!.length == 1) {
|
||||||
|
await generateTicketForQueue(
|
||||||
|
screenConfigViewModel: screenConfigViewModel,
|
||||||
|
kioskQueueModel: screenConfigViewModel.globalConfigurationsModel.kioskQueueList![0],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
screenConfigViewModel.updateCurrentSelectedKioskLanguage(LanguageEnum.english);
|
||||||
|
screenConfigViewModel.updateKioskScreenState(KioskScreenStateEnums.queueSelectionState);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (screenConfigViewModel.globalConfigurationsModel.kioskQueueList != null && screenConfigViewModel.globalConfigurationsModel.kioskQueueList!.length == 1) {
|
||||||
|
await generateTicketForQueue(
|
||||||
|
screenConfigViewModel: screenConfigViewModel,
|
||||||
|
kioskQueueModel: screenConfigViewModel.globalConfigurationsModel.kioskQueueList![0],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
screenConfigViewModel.updateCurrentSelectedKioskLanguage(LanguageEnum.arabic);
|
||||||
|
screenConfigViewModel.updateKioskScreenState(KioskScreenStateEnums.queueSelectionState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget kioskQueueSelectionStateWidget(ScreenConfigViewModel screenConfigViewModel) {
|
||||||
|
bool isEnglish = screenConfigViewModel.currentSelectedKioskLanguage == LanguageEnum.english;
|
||||||
|
|
||||||
|
return Directionality(
|
||||||
|
textDirection: isEnglish ? TextDirection.ltr : TextDirection.rtl,
|
||||||
|
child: GridView.builder(
|
||||||
|
itemCount: screenConfigViewModel.globalConfigurationsModel.kioskQueueList!.length,
|
||||||
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
crossAxisCount: (screenConfigViewModel.globalConfigurationsModel.orientationTypeEnum == ScreenOrientationEnum.portraitUp ||
|
||||||
|
screenConfigViewModel.globalConfigurationsModel.orientationTypeEnum == ScreenOrientationEnum.portraitDown)
|
||||||
|
? 2
|
||||||
|
: 3,
|
||||||
|
),
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
KioskQueueModel kioskQueueModel = screenConfigViewModel.globalConfigurationsModel.kioskQueueList![index];
|
||||||
|
return Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
commonSelectionCardKiosk(
|
||||||
|
screenConfigViewModel: screenConfigViewModel,
|
||||||
|
title: screenConfigViewModel.currentSelectedKioskLanguage == LanguageEnum.english ? "${kioskQueueModel.queueName}" : "${kioskQueueModel.queueNameN}",
|
||||||
|
icon: AppAssets.kioskQueueIcon,
|
||||||
|
onTap: () async {
|
||||||
|
await generateTicketForQueue(screenConfigViewModel: screenConfigViewModel, kioskQueueModel: kioskQueueModel);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget kioskTicketNumberStateWidget(ScreenConfigViewModel screenConfigViewModel) {
|
||||||
|
bool isEnglish = screenConfigViewModel.currentSelectedKioskLanguage == LanguageEnum.english;
|
||||||
|
return Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
AppText(
|
||||||
|
isEnglish ? "Your Ticket Number is: " : "رقم تذكرتك هو:",
|
||||||
|
fontSize: SizeConfig.getWidthMultiplier() * 6,
|
||||||
|
textDirection: isEnglish ? TextDirection.ltr : TextDirection.rtl,
|
||||||
|
fontHeight: 1,
|
||||||
|
fontFamily: isEnglish ? AppStrings.fontNameCairo : AppStrings.fontNamePoppins,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
AppText(
|
||||||
|
screenConfigViewModel.kioskPatientTicket!.patientCallNo ?? "",
|
||||||
|
fontSize: SizeConfig.getWidthMultiplier() * 10,
|
||||||
|
fontHeight: 1,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
textDirection: isEnglish ? TextDirection.ltr : TextDirection.rtl,
|
||||||
|
fontFamily: isEnglish ? AppStrings.fontNameCairo : AppStrings.fontNamePoppins,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
AppText(
|
||||||
|
isEnglish ? "Please take the receipt and wait for your turn. \nThank you 😊" : "يرجى أخذ الإيصال وانتظار دورك.\n شكرًا لك 😊",
|
||||||
|
fontSize: SizeConfig.getWidthMultiplier() * 3,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
textDirection: isEnglish ? TextDirection.ltr : TextDirection.rtl,
|
||||||
|
fontHeight: 1,
|
||||||
|
fontFamily: isEnglish ? AppStrings.fontNameCairo : AppStrings.fontNamePoppins,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 100),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
screenConfigViewModel.updateKioskScreenState(KioskScreenStateEnums.languageState);
|
||||||
|
},
|
||||||
|
child: AppText(
|
||||||
|
isEnglish ? "Go to Main Page" : "اذهب إلى الصفحة الرئيسية",
|
||||||
|
fontSize: SizeConfig.getWidthMultiplier() * 3,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
textDecoration: TextDecoration.underline,
|
||||||
|
textDirection: isEnglish ? TextDirection.ltr : TextDirection.rtl,
|
||||||
|
fontHeight: 1,
|
||||||
|
fontFamily: isEnglish ? AppStrings.fontNameCairo : AppStrings.fontNamePoppins,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> generateTicketForQueue({
|
||||||
|
required ScreenConfigViewModel screenConfigViewModel,
|
||||||
|
required KioskQueueModel kioskQueueModel,
|
||||||
|
}) async {
|
||||||
|
screenConfigViewModel.updateKioskScreenState(KioskScreenStateEnums.busyState);
|
||||||
|
KioskPatientTicket? kioskPatientTicket = await screenConfigViewModel.createTicketFromKiosk(
|
||||||
|
projectId: kioskQueueModel.projectID ?? 0,
|
||||||
|
queueId: kioskQueueModel.queueID ?? 0,
|
||||||
|
);
|
||||||
|
if (kioskPatientTicket == null) {
|
||||||
|
screenConfigViewModel.updateKioskScreenState(KioskScreenStateEnums.languageState);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
screenConfigViewModel.updateTicketGeneratedFromKiosk(kioskPatientTicket);
|
||||||
|
screenConfigViewModel.updateKioskScreenState(KioskScreenStateEnums.ticketNoState);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget dataContentKiosk({required BuildContext context}) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(10),
|
||||||
|
child: Consumer(
|
||||||
|
builder: (BuildContext context, ScreenConfigViewModel screenConfigViewModel, Widget? child) {
|
||||||
|
return switch (screenConfigViewModel.kioskScreenStateEnum) {
|
||||||
|
KioskScreenStateEnums.languageState => kioskLanguageStateWidget(screenConfigViewModel),
|
||||||
|
KioskScreenStateEnums.queueSelectionState => kioskQueueSelectionStateWidget(screenConfigViewModel),
|
||||||
|
KioskScreenStateEnums.ticketNoState => kioskTicketNumberStateWidget(screenConfigViewModel),
|
||||||
|
KioskScreenStateEnums.busyState => const Center(child: CircularProgressIndicator()),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Selector<ScreenConfigViewModel, ScreenOrientationEnum>(
|
||||||
|
selector: (context, screenConfigViewModel) => screenConfigViewModel.globalConfigurationsModel.orientationTypeEnum,
|
||||||
|
builder: (BuildContext context, ScreenOrientationEnum screenOrientationEnum, Widget? child) {
|
||||||
|
return RotatedBox(
|
||||||
|
quarterTurns: screenOrientationEnum.getTurnsByOrientation(),
|
||||||
|
child: AppScaffold(
|
||||||
|
appBar: const AppHeader(),
|
||||||
|
body: getBody(context: context),
|
||||||
|
bottomNavigationBar: const AppFooter(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue