|
|
|
|
@ -1,4 +1,3 @@
|
|
|
|
|
|
|
|
|
|
import 'package:car_provider_app/generated/locale_keys.g.dart';
|
|
|
|
|
import 'package:car_provider_app/view_models/service_view_model.dart';
|
|
|
|
|
import 'package:car_provider_app/views/settings/services/services_list_page.dart';
|
|
|
|
|
@ -29,20 +28,26 @@ class CreateServicesPage3 extends StatelessWidget {
|
|
|
|
|
String chargersPerKm = "0";
|
|
|
|
|
int? categoryId;
|
|
|
|
|
int? serviceId = -1;
|
|
|
|
|
DropValue? category;
|
|
|
|
|
DropValue? service;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
ServiceVM serviceVM = context.read<ServiceVM>();
|
|
|
|
|
if (branchModel!.categoryId == null) {
|
|
|
|
|
serviceVM.fetchBranchCategory(EasyLocalization.of(context)?.currentLocale?.countryCode ?? "SA");
|
|
|
|
|
serviceVM.fetchBranchCategory(
|
|
|
|
|
EasyLocalization.of(context)?.currentLocale?.countryCode ?? "SA");
|
|
|
|
|
} else {
|
|
|
|
|
isAppointmentAvailable = branchModel?.serviceProviderService?.isAllowAppointment ?? false;
|
|
|
|
|
isAppointmentAvailable =
|
|
|
|
|
branchModel?.serviceProviderService?.isAllowAppointment ?? false;
|
|
|
|
|
// isHomeAppointmentAvailable=branchModel.serviceProviderService.
|
|
|
|
|
serviceRage = branchModel?.serviceProviderService?.customerLocationRange ?? 0;
|
|
|
|
|
serviceRage =
|
|
|
|
|
branchModel?.serviceProviderService?.customerLocationRange ?? 0;
|
|
|
|
|
if (serviceRage > 0) {
|
|
|
|
|
isHomeAppointmentAvailable = true;
|
|
|
|
|
}
|
|
|
|
|
chargersPerKm = branchModel?.serviceProviderService?.rangePricePerKm ?? "0";
|
|
|
|
|
chargersPerKm =
|
|
|
|
|
branchModel?.serviceProviderService?.rangePricePerKm ?? "0";
|
|
|
|
|
serviceId = branchModel?.serviceProviderService?.serviceId ?? -1;
|
|
|
|
|
}
|
|
|
|
|
return Scaffold(
|
|
|
|
|
@ -67,7 +72,8 @@ class CreateServicesPage3 extends StatelessWidget {
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
).toContainer(
|
|
|
|
|
padding: const EdgeInsets.only(left: 8, right: 8, bottom: 12, top: 12),
|
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
|
left: 8, right: 8, bottom: 12, top: 12),
|
|
|
|
|
backgroundColor: MyColors.textFieldColor,
|
|
|
|
|
borderRadius: 0,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
@ -81,34 +87,44 @@ class CreateServicesPage3 extends StatelessWidget {
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
).toContainer(
|
|
|
|
|
padding: const EdgeInsets.only(left: 8, right: 8, bottom: 12, top: 12),
|
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
|
left: 8, right: 8, bottom: 12, top: 12),
|
|
|
|
|
backgroundColor: MyColors.textFieldColor,
|
|
|
|
|
borderRadius: 0,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
)
|
|
|
|
|
: (branchModel!.categoryId == null && model.categoryDropList.isNotEmpty)
|
|
|
|
|
: (branchModel!.categoryId == null &&
|
|
|
|
|
model.categoryDropList.isNotEmpty)
|
|
|
|
|
? DropdownField(
|
|
|
|
|
(DropValue value) async {
|
|
|
|
|
categoryId = value.id;
|
|
|
|
|
category = value;
|
|
|
|
|
service = null;
|
|
|
|
|
serviceId = -1;
|
|
|
|
|
isAppointmentAvailable = false;
|
|
|
|
|
isHomeAppointmentAvailable = false;
|
|
|
|
|
model.fetchServicesByCategoryId(value.id.toString());
|
|
|
|
|
model.fetchServicesByCategoryId(
|
|
|
|
|
value.id.toString());
|
|
|
|
|
},
|
|
|
|
|
dropdownValue: category,
|
|
|
|
|
list: model.categoryDropList,
|
|
|
|
|
hint: LocaleKeys.selectServiceCategory.tr(),
|
|
|
|
|
hint:
|
|
|
|
|
LocaleKeys.selectServiceCategory.tr(),
|
|
|
|
|
)
|
|
|
|
|
: const CircularProgressIndicator(),
|
|
|
|
|
12.height,
|
|
|
|
|
branchModel!.serviceProviderService != null
|
|
|
|
|
? Text(
|
|
|
|
|
branchModel!.serviceProviderService!.serviceDescription ?? "N/A",
|
|
|
|
|
branchModel!.serviceProviderService!
|
|
|
|
|
.serviceDescription ??
|
|
|
|
|
"N/A",
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
).toContainer(
|
|
|
|
|
padding: const EdgeInsets.only(left: 8, right: 8, bottom: 12, top: 12),
|
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
|
left: 8, right: 8, bottom: 12, top: 12),
|
|
|
|
|
backgroundColor: MyColors.textFieldColor,
|
|
|
|
|
borderRadius: 0,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
@ -117,10 +133,12 @@ class CreateServicesPage3 extends StatelessWidget {
|
|
|
|
|
? DropdownField(
|
|
|
|
|
(DropValue value) {
|
|
|
|
|
serviceId = value.id;
|
|
|
|
|
service = value;
|
|
|
|
|
isAppointmentAvailable = false;
|
|
|
|
|
isHomeAppointmentAvailable = false;
|
|
|
|
|
model.setState(ViewState.idle);
|
|
|
|
|
},
|
|
|
|
|
dropdownValue: service,
|
|
|
|
|
list: model.servicesDropList,
|
|
|
|
|
hint: LocaleKeys.defineServices.tr(),
|
|
|
|
|
)
|
|
|
|
|
@ -135,7 +153,8 @@ class CreateServicesPage3 extends StatelessWidget {
|
|
|
|
|
CheckBoxWithTitleDescription(
|
|
|
|
|
isSelected: isAppointmentAvailable,
|
|
|
|
|
title: 'Available for appointment',
|
|
|
|
|
description: 'This option will allow customer to book appointment for these services',
|
|
|
|
|
description:
|
|
|
|
|
'This option will allow customer to book appointment for these services',
|
|
|
|
|
onSelection: (bool v) {
|
|
|
|
|
isAppointmentAvailable = v;
|
|
|
|
|
model.setState(ViewState.idle);
|
|
|
|
|
@ -145,7 +164,8 @@ class CreateServicesPage3 extends StatelessWidget {
|
|
|
|
|
CheckBoxWithTitleDescription(
|
|
|
|
|
isSelected: isHomeAppointmentAvailable,
|
|
|
|
|
title: 'Allow home services',
|
|
|
|
|
description: 'This option will allow customer to book appointment at their desired location',
|
|
|
|
|
description:
|
|
|
|
|
'This option will allow customer to book appointment at their desired location',
|
|
|
|
|
onSelection: (bool v) {
|
|
|
|
|
isHomeAppointmentAvailable = v;
|
|
|
|
|
model.setState(ViewState.idle);
|
|
|
|
|
@ -158,13 +178,18 @@ class CreateServicesPage3 extends StatelessWidget {
|
|
|
|
|
TxtField(
|
|
|
|
|
hint: "Home Services Range",
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
value: serviceRage == 0 ? null : serviceRage.toString(),
|
|
|
|
|
value: serviceRage == 0
|
|
|
|
|
? null
|
|
|
|
|
: serviceRage.toString(),
|
|
|
|
|
postfixWidget: Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.center,
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
"KM".toText(color: MyColors.lightTextColor),
|
|
|
|
|
"KM".toText(
|
|
|
|
|
color: MyColors.lightTextColor),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
onChanged: (v) {
|
|
|
|
|
@ -179,7 +204,9 @@ class CreateServicesPage3 extends StatelessWidget {
|
|
|
|
|
TxtField(
|
|
|
|
|
hint: "Charges per Kilometer",
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
value: chargersPerKm == "0.0" ? null : chargersPerKm,
|
|
|
|
|
value: chargersPerKm == "0.0"
|
|
|
|
|
? null
|
|
|
|
|
: chargersPerKm,
|
|
|
|
|
onChanged: (v) {
|
|
|
|
|
if (v.isNotEmpty) {
|
|
|
|
|
chargersPerKm = v;
|
|
|
|
|
|