|
|
|
|
@ -3,6 +3,7 @@ import 'dart:developer';
|
|
|
|
|
|
|
|
|
|
import 'package:car_provider_app/views/branch_management/services/duplication/sheet/approved_branches_list_sheet.dart';
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_svg/svg.dart';
|
|
|
|
|
import 'package:mc_common_app/classes/consts.dart';
|
|
|
|
|
@ -80,6 +81,96 @@ class _ServicesListPageState extends State<ServicesListPage> {
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool isCategoryActive = true;
|
|
|
|
|
bool isEditDisabled = false;
|
|
|
|
|
|
|
|
|
|
Widget buildCategoryTileWidget() {
|
|
|
|
|
return Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.only(top: 5),
|
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
|
MyAssets.maintenanceIcon,
|
|
|
|
|
width: 14,
|
|
|
|
|
height: 14,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
8.width,
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 20,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
categoryData.categoryName.toString().toText(fontSize: 16),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
// 5.height,
|
|
|
|
|
if (categoryData.services != null) ...[
|
|
|
|
|
Container(
|
|
|
|
|
child: ("${LocaleKeys.totalNumberOfServices.tr()}: ${categoryData.services!.length}").toText(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
color: MyColors.lightTextColor,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
Container(
|
|
|
|
|
child: ("${LocaleKeys.branchName.tr()}: ${categoryData.branchName}").toText(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
color: MyColors.lightTextColor,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
// TODO: NEED TO CONFIRM CATEGORY DEACTIVATION FROM ZAHOOR
|
|
|
|
|
const Expanded(
|
|
|
|
|
flex: 4,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
// LocaleKeys.active.tr().toText(fontSize: 16),
|
|
|
|
|
// 8.width,
|
|
|
|
|
// Container(
|
|
|
|
|
// width: 50,
|
|
|
|
|
// height: 30,
|
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
|
// color: isCategoryActive ? MyColors.darkPrimaryColor : MyColors.white,
|
|
|
|
|
// borderRadius: BorderRadius.circular(25.0),
|
|
|
|
|
// border: Border.all(color: MyColors.lightTextColor, width: 1),
|
|
|
|
|
// ),
|
|
|
|
|
// child: Transform.scale(
|
|
|
|
|
// scale: 0.8,
|
|
|
|
|
// child: CupertinoSwitch(
|
|
|
|
|
// activeColor: MyColors.darkPrimaryColor,
|
|
|
|
|
// trackColor: MyColors.white,
|
|
|
|
|
// thumbColor: MyColors.greyACColor,
|
|
|
|
|
// value: isCategoryActive,
|
|
|
|
|
// onChanged: (value) async {
|
|
|
|
|
// if (isEditDisabled) return;
|
|
|
|
|
// isCategoryActive = value;
|
|
|
|
|
// // isCategoryActive = await updateServiceStatus(context, value);
|
|
|
|
|
// setState(() {});
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).toWhiteContainer(width: double.infinity, allPading: 12);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
categoryData = ModalRoute.of(context)!.settings.arguments as CategoryData;
|
|
|
|
|
@ -116,6 +207,7 @@ class _ServicesListPageState extends State<ServicesListPage> {
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
buildCategoryTileWidget().paddingOnly(left: 20, right: 20, top: 10),
|
|
|
|
|
20.height,
|
|
|
|
|
Consumer(
|
|
|
|
|
builder: (BuildContext context, ServiceVM serviceVM, Widget? child) {
|
|
|
|
|
@ -130,36 +222,6 @@ class _ServicesListPageState extends State<ServicesListPage> {
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
// Padding(
|
|
|
|
|
// padding: const EdgeInsets.only(left: 20, right: 20, top: 20),
|
|
|
|
|
// child: RoleTypeTab(
|
|
|
|
|
// selectedTab,
|
|
|
|
|
// [
|
|
|
|
|
// DropValue(0, 'Active', ''),
|
|
|
|
|
// DropValue(1, 'Requested', ''),
|
|
|
|
|
// DropValue(2, 'Deactivated', ''),
|
|
|
|
|
// ],
|
|
|
|
|
// width: (MediaQuery.of(context).size.width / 3) - 26,
|
|
|
|
|
// onSelect: (DropValue value) {
|
|
|
|
|
// setState(() {
|
|
|
|
|
// selectedTab = value.id;
|
|
|
|
|
//
|
|
|
|
|
// if (selectedTab == 0) {
|
|
|
|
|
// selectedService = ServiceStatusEnum.approvedOrActive;
|
|
|
|
|
// filteredServices = categoryData.services!.where((i) => i.serviceStatusEnum == ServiceStatusEnum.approvedOrActive).toList();
|
|
|
|
|
// } else if (selectedTab == 2) {
|
|
|
|
|
// selectedService = ServiceStatusEnum.deactivated;
|
|
|
|
|
// filteredServices = categoryData.services!.where((i) => i.serviceStatusEnum == ServiceStatusEnum.deactivated).toList();
|
|
|
|
|
// } else {
|
|
|
|
|
// selectedService = value.id.toServiceStatusEnum();
|
|
|
|
|
// filteredServices =
|
|
|
|
|
// categoryData.services!.where((i) => (i.serviceStatusEnum != ServiceStatusEnum.approvedOrActive && i.serviceStatusEnum != ServiceStatusEnum.deactivated)).toList();
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
const SizedBox(height: 10),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: RefreshIndicator(
|
|
|
|
|
|