mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-08-25 20:59:40 +00:00
Compare commits
1 Commits
f1cf8d88d3
...
SP-1852-fe
Author | SHA1 | Date | |
---|---|---|---|
9bfc0cea10 |
@ -39,7 +39,8 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
title: 'Sent Successfully',
|
title: 'Sent Successfully',
|
||||||
widgeta: Column(
|
widgeta: Column(
|
||||||
children: [
|
children: [
|
||||||
if (visitorBloc.passwordStatus!.failedOperations.isNotEmpty)
|
if (visitorBloc
|
||||||
|
.passwordStatus!.failedOperations.isNotEmpty)
|
||||||
Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
const Text('Failed Devices'),
|
const Text('Failed Devices'),
|
||||||
@ -54,18 +55,23 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return Container(
|
return Container(
|
||||||
margin: const EdgeInsets.all(5),
|
margin: const EdgeInsets.all(5),
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 10),
|
||||||
decoration: containerDecoration,
|
decoration: containerDecoration,
|
||||||
height: 45,
|
height: 45,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(visitorBloc.passwordStatus!
|
child: Text(visitorBloc
|
||||||
.failedOperations[index].deviceName)),
|
.passwordStatus!
|
||||||
|
.failedOperations[index]
|
||||||
|
.deviceName)),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (visitorBloc.passwordStatus!.successOperations.isNotEmpty)
|
if (visitorBloc
|
||||||
|
.passwordStatus!.successOperations.isNotEmpty)
|
||||||
Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
const Text('Success Devices'),
|
const Text('Success Devices'),
|
||||||
@ -80,11 +86,15 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return Container(
|
return Container(
|
||||||
margin: const EdgeInsets.all(5),
|
margin: const EdgeInsets.all(5),
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 10),
|
||||||
decoration: containerDecoration,
|
decoration: containerDecoration,
|
||||||
height: 45,
|
height: 45,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(visitorBloc.passwordStatus!
|
child: Text(visitorBloc
|
||||||
.successOperations[index].deviceName)),
|
.passwordStatus!
|
||||||
|
.successOperations[index]
|
||||||
|
.deviceName)),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -114,7 +124,9 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
title: Text(
|
title: Text(
|
||||||
'Create visitor password',
|
'Create visitor password',
|
||||||
style: Theme.of(context).textTheme.headlineLarge!.copyWith(
|
style: Theme.of(context).textTheme.headlineLarge!.copyWith(
|
||||||
fontWeight: FontWeight.w400, fontSize: 24, color: Colors.black),
|
fontWeight: FontWeight.w400,
|
||||||
|
fontSize: 24,
|
||||||
|
color: Colors.black),
|
||||||
),
|
),
|
||||||
content: state is LoadingInitialState
|
content: state is LoadingInitialState
|
||||||
? const Center(child: CircularProgressIndicator())
|
? const Center(child: CircularProgressIndicator())
|
||||||
@ -300,9 +312,11 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
visitorBloc.accessTypeSelected ==
|
visitorBloc.accessTypeSelected ==
|
||||||
'Offline Password') {
|
'Offline Password') {
|
||||||
visitorBloc.add(SelectTimeEvent(
|
visitorBloc.add(SelectTimeEvent(
|
||||||
context: context, isEffective: false));
|
context: context,
|
||||||
|
isEffective: false));
|
||||||
} else {
|
} else {
|
||||||
visitorBloc.add(SelectTimeVisitorPassword(
|
visitorBloc.add(
|
||||||
|
SelectTimeVisitorPassword(
|
||||||
context: context,
|
context: context,
|
||||||
isStart: false,
|
isStart: false,
|
||||||
isRepeat: false));
|
isRepeat: false));
|
||||||
@ -314,16 +328,18 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
visitorBloc.accessTypeSelected ==
|
visitorBloc.accessTypeSelected ==
|
||||||
'Offline Password') {
|
'Offline Password') {
|
||||||
visitorBloc.add(SelectTimeEvent(
|
visitorBloc.add(SelectTimeEvent(
|
||||||
context: context, isEffective: true));
|
context: context,
|
||||||
|
isEffective: true));
|
||||||
} else {
|
} else {
|
||||||
visitorBloc.add(SelectTimeVisitorPassword(
|
visitorBloc.add(
|
||||||
|
SelectTimeVisitorPassword(
|
||||||
context: context,
|
context: context,
|
||||||
isStart: true,
|
isStart: true,
|
||||||
isRepeat: false));
|
isRepeat: false));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
firstString:
|
firstString: (visitorBloc
|
||||||
(visitorBloc.usageFrequencySelected ==
|
.usageFrequencySelected ==
|
||||||
'Periodic' &&
|
'Periodic' &&
|
||||||
visitorBloc.accessTypeSelected ==
|
visitorBloc.accessTypeSelected ==
|
||||||
'Offline Password')
|
'Offline Password')
|
||||||
@ -395,7 +411,8 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
child: CupertinoSwitch(
|
child: CupertinoSwitch(
|
||||||
value: visitorBloc.repeat,
|
value: visitorBloc.repeat,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
visitorBloc.add(ToggleRepeatEvent());
|
visitorBloc
|
||||||
|
.add(ToggleRepeatEvent());
|
||||||
},
|
},
|
||||||
applyTheme: true,
|
applyTheme: true,
|
||||||
),
|
),
|
||||||
@ -426,7 +443,8 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
).then((listDevice) {
|
).then((listDevice) {
|
||||||
if (listDevice != null) {
|
if (listDevice != null) {
|
||||||
visitorBloc.selectedDevices = listDevice;
|
visitorBloc.selectedDevices =
|
||||||
|
listDevice;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -438,7 +456,8 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
.bodySmall!
|
.bodySmall!
|
||||||
.copyWith(
|
.copyWith(
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
color: ColorsManager.whiteColors,
|
color:
|
||||||
|
ColorsManager.whiteColors,
|
||||||
fontSize: 12),
|
fontSize: 12),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -477,19 +496,23 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (visitorBloc.forgetFormKey.currentState!.validate()) {
|
if (visitorBloc.forgetFormKey.currentState!.validate()) {
|
||||||
if (visitorBloc.selectedDevices.isNotEmpty) {
|
if (visitorBloc.selectedDevices.isNotEmpty) {
|
||||||
if (visitorBloc.usageFrequencySelected == 'One-Time' &&
|
if (visitorBloc.usageFrequencySelected ==
|
||||||
visitorBloc.accessTypeSelected == 'Offline Password') {
|
'One-Time' &&
|
||||||
|
visitorBloc.accessTypeSelected ==
|
||||||
|
'Offline Password') {
|
||||||
setPasswordFunction(context, size, visitorBloc);
|
setPasswordFunction(context, size, visitorBloc);
|
||||||
} else if (visitorBloc.usageFrequencySelected ==
|
} else if (visitorBloc.usageFrequencySelected ==
|
||||||
'Periodic' &&
|
'Periodic' &&
|
||||||
visitorBloc.accessTypeSelected == 'Offline Password') {
|
visitorBloc.accessTypeSelected ==
|
||||||
|
'Offline Password') {
|
||||||
if (visitorBloc.expirationTime != 'End Time' &&
|
if (visitorBloc.expirationTime != 'End Time' &&
|
||||||
visitorBloc.effectiveTime != 'Start Time') {
|
visitorBloc.effectiveTime != 'Start Time') {
|
||||||
setPasswordFunction(context, size, visitorBloc);
|
setPasswordFunction(context, size, visitorBloc);
|
||||||
} else {
|
} else {
|
||||||
visitorBloc.stateDialog(
|
visitorBloc.stateDialog(
|
||||||
context: context,
|
context: context,
|
||||||
message: 'Please select Access Period to continue',
|
message:
|
||||||
|
'Please select Access Period to continue',
|
||||||
title: 'Access Period');
|
title: 'Access Period');
|
||||||
}
|
}
|
||||||
} else if (visitorBloc.endTimeAccess != 'End Time' &&
|
} else if (visitorBloc.endTimeAccess != 'End Time' &&
|
||||||
@ -500,7 +523,8 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
if (visitorBloc.expirationTime != 'End Time' &&
|
if (visitorBloc.expirationTime != 'End Time' &&
|
||||||
visitorBloc.effectiveTime != 'Start Time' &&
|
visitorBloc.effectiveTime != 'Start Time' &&
|
||||||
visitorBloc.selectedDays.isNotEmpty) {
|
visitorBloc.selectedDays.isNotEmpty) {
|
||||||
setPasswordFunction(context, size, visitorBloc);
|
setPasswordFunction(
|
||||||
|
context, size, visitorBloc);
|
||||||
} else {
|
} else {
|
||||||
visitorBloc.stateDialog(
|
visitorBloc.stateDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@ -514,13 +538,15 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
} else {
|
} else {
|
||||||
visitorBloc.stateDialog(
|
visitorBloc.stateDialog(
|
||||||
context: context,
|
context: context,
|
||||||
message: 'Please select Access Period to continue',
|
message:
|
||||||
|
'Please select Access Period to continue',
|
||||||
title: 'Access Period');
|
title: 'Access Period');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
visitorBloc.stateDialog(
|
visitorBloc.stateDialog(
|
||||||
context: context,
|
context: context,
|
||||||
message: 'Please select Access Period to continue',
|
message:
|
||||||
|
'Please select Access Period to continue',
|
||||||
title: 'Access Period');
|
title: 'Access Period');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -567,7 +593,8 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
content: SizedBox(
|
content: SizedBox(
|
||||||
height: size.height * 0.25,
|
height: size.height * 0.25,
|
||||||
child: const Center(
|
child: const Center(
|
||||||
child: CircularProgressIndicator(), // Display a loading spinner
|
child:
|
||||||
|
CircularProgressIndicator(), // Display a loading spinner
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -640,7 +667,8 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
if (visitorBloc.usageFrequencySelected == 'One-Time' &&
|
if (visitorBloc.usageFrequencySelected == 'One-Time' &&
|
||||||
visitorBloc.accessTypeSelected == 'Online Password') {
|
visitorBloc.accessTypeSelected ==
|
||||||
|
'Online Password') {
|
||||||
visitorBloc.add(OnlineOneTimePasswordEvent(
|
visitorBloc.add(OnlineOneTimePasswordEvent(
|
||||||
context: context,
|
context: context,
|
||||||
passwordName: visitorBloc.userNameController.text,
|
passwordName: visitorBloc.userNameController.text,
|
||||||
@ -648,7 +676,8 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
));
|
));
|
||||||
} else if (visitorBloc.usageFrequencySelected ==
|
} else if (visitorBloc.usageFrequencySelected ==
|
||||||
'Periodic' &&
|
'Periodic' &&
|
||||||
visitorBloc.accessTypeSelected == 'Online Password') {
|
visitorBloc.accessTypeSelected ==
|
||||||
|
'Online Password') {
|
||||||
visitorBloc.add(OnlineMultipleTimePasswordEvent(
|
visitorBloc.add(OnlineMultipleTimePasswordEvent(
|
||||||
passwordName: visitorBloc.userNameController.text,
|
passwordName: visitorBloc.userNameController.text,
|
||||||
email: visitorBloc.emailController.text,
|
email: visitorBloc.emailController.text,
|
||||||
@ -659,7 +688,8 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
));
|
));
|
||||||
} else if (visitorBloc.usageFrequencySelected ==
|
} else if (visitorBloc.usageFrequencySelected ==
|
||||||
'One-Time' &&
|
'One-Time' &&
|
||||||
visitorBloc.accessTypeSelected == 'Offline Password') {
|
visitorBloc.accessTypeSelected ==
|
||||||
|
'Offline Password') {
|
||||||
visitorBloc.add(OfflineOneTimePasswordEvent(
|
visitorBloc.add(OfflineOneTimePasswordEvent(
|
||||||
context: context,
|
context: context,
|
||||||
passwordName: visitorBloc.userNameController.text,
|
passwordName: visitorBloc.userNameController.text,
|
||||||
@ -667,7 +697,8 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
));
|
));
|
||||||
} else if (visitorBloc.usageFrequencySelected ==
|
} else if (visitorBloc.usageFrequencySelected ==
|
||||||
'Periodic' &&
|
'Periodic' &&
|
||||||
visitorBloc.accessTypeSelected == 'Offline Password') {
|
visitorBloc.accessTypeSelected ==
|
||||||
|
'Offline Password') {
|
||||||
visitorBloc.add(OfflineMultipleTimePasswordEvent(
|
visitorBloc.add(OfflineMultipleTimePasswordEvent(
|
||||||
passwordName: visitorBloc.userNameController.text,
|
passwordName: visitorBloc.userNameController.text,
|
||||||
email: visitorBloc.emailController.text,
|
email: visitorBloc.emailController.text,
|
||||||
|
Reference in New Issue
Block a user