travel policy
This commit is contained in:
parent
b630ac35b7
commit
93f69128b5
@ -116,7 +116,7 @@ class _LoginWidgetState extends State<LoginWidget> {
|
||||
if (userRole == "Travel Agent") {
|
||||
context.go('/listTravelAgentPlan');
|
||||
} else if (userRole == "Org Admin" || userRole == "Travel Admin") {
|
||||
context.go('/listAllPlan');
|
||||
context.go('/StatusDashboard');
|
||||
} else {
|
||||
context.go('/listPlan');
|
||||
}
|
||||
|
||||
@ -346,7 +346,9 @@ class ForexDataState extends State<ForexData> {
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
(forexDataId != null) ? 'Edit Perdiem Amount' : 'Create Perdiem Amount',
|
||||
(forexDataId != null)
|
||||
? 'Update Perdiem Amount'
|
||||
: 'Create Perdiem Amount',
|
||||
style: GoogleFonts.poppins(fontSize: 15, color: Colors.black),
|
||||
),
|
||||
const Spacer(),
|
||||
|
||||
@ -39,9 +39,34 @@ class Template extends StatefulWidget {
|
||||
|
||||
class TemplateState extends State<Template> {
|
||||
final ApiService apiService = ApiService();
|
||||
|
||||
final QuillController _controller = () {
|
||||
return QuillController.basic(
|
||||
config: QuillControllerConfig(
|
||||
clipboardConfig: QuillClipboardConfig(
|
||||
enableExternalRichPaste: true,
|
||||
onImagePaste: (imageBytes) async {
|
||||
if (kIsWeb) {
|
||||
// Dart IO is unsupported on the web.
|
||||
return null;
|
||||
}
|
||||
// Save the image somewhere and return the image URL that will be
|
||||
// stored in the Quill Delta JSON (the document).
|
||||
final newFileName =
|
||||
'image-file-${DateTime.now().toIso8601String()}.png';
|
||||
final newPath = path.join(
|
||||
io.Directory.systemTemp.path,
|
||||
newFileName,
|
||||
);
|
||||
final file = await io.File(
|
||||
newPath,
|
||||
).writeAsBytes(imageBytes, flush: true);
|
||||
return file.path;
|
||||
},
|
||||
),
|
||||
));
|
||||
}();
|
||||
final FocusNode _editorFocusNode = FocusNode();
|
||||
// final ScrollController _editorScrollController = ScrollController();
|
||||
final ScrollController _editorScrollController = ScrollController();
|
||||
// final QuillController _controller = QuillController.basic();
|
||||
Color layoutColor = Colors.redAccent;
|
||||
Color bodyColor = Colors.white;
|
||||
@ -77,7 +102,10 @@ class TemplateState extends State<Template> {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_editorFocusNode.requestFocus(); // ✅ Ensure focus is requested
|
||||
});
|
||||
_controller.document = Document.fromJson(kQuillDefaultSample);
|
||||
// _controller.document = Document.fromJson(kQuillDefaultSample);
|
||||
// _controller.document = Document.fromJson();
|
||||
// _controller.document.toPlainText();
|
||||
// _controller.readOnly = false;
|
||||
updateData();
|
||||
|
||||
@ -85,9 +113,16 @@ class TemplateState extends State<Template> {
|
||||
}
|
||||
|
||||
@override
|
||||
// void dispose() {
|
||||
// // controllers.dispose();
|
||||
// // _editorScrollController.dispose();
|
||||
// _editorFocusNode.dispose();
|
||||
// super.dispose();
|
||||
// }
|
||||
|
||||
void dispose() {
|
||||
// controllers.dispose();
|
||||
// _editorScrollController.dispose();
|
||||
_controller.dispose();
|
||||
_editorScrollController.dispose();
|
||||
_editorFocusNode.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
@ -177,6 +212,16 @@ class TemplateState extends State<Template> {
|
||||
height: 20,
|
||||
),
|
||||
buildTempalteSubject(isDesktop),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.output),
|
||||
tooltip: 'Print Delta JSON to log',
|
||||
onPressed: () {
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||
content: Text(
|
||||
'The JSON Delta has been printed to the console.')));
|
||||
debugPrint(jsonEncode(_controller.document.toDelta().toJson()));
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
@ -238,77 +283,15 @@ class TemplateState extends State<Template> {
|
||||
|
||||
const SizedBox(height: 10),
|
||||
|
||||
// ✅ Modern toolbar
|
||||
// QuillSimpleToolbar(
|
||||
// controller: _controller,
|
||||
// config: QuillSimpleToolbarConfig(
|
||||
// embedButtons: FlutterQuillEmbeds.toolbarButtons(),
|
||||
// showClipboardPaste: true,
|
||||
// customButtons: [
|
||||
// QuillToolbarCustomButtonOptions(
|
||||
// icon: const Icon(Icons.add_alarm_rounded),
|
||||
// onPressed: () {
|
||||
// _controller.document.insert(
|
||||
// _controller.selection.extentOffset,
|
||||
// TimeStampEmbed(
|
||||
// DateTime.now().toString(),
|
||||
// ),
|
||||
// );
|
||||
// Expanded(
|
||||
//
|
||||
// _controller.updateSelection(
|
||||
// TextSelection.collapsed(
|
||||
// offset: _controller.selection.extentOffset + 1,
|
||||
// ),
|
||||
// ChangeSource.local,
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// buttonOptions: QuillSimpleToolbarButtonOptions(
|
||||
// base: QuillToolbarBaseButtonOptions(
|
||||
// afterButtonPressed: () {
|
||||
// final isDesktop = {
|
||||
// TargetPlatform.linux,
|
||||
// TargetPlatform.windows,
|
||||
// TargetPlatform.macOS
|
||||
// }.contains(defaultTargetPlatform);
|
||||
// if (isDesktop) {
|
||||
// _editorFocusNode.requestFocus();
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// linkStyle: QuillToolbarLinkStyleButtonOptions(
|
||||
// validateLink: (link) {
|
||||
// // Treats all links as valid. When launching the URL,
|
||||
// // `https://` is prefixed if the link is incomplete (e.g., `google.com` → `https://google.com`)
|
||||
// // however this happens only within the editor.
|
||||
// return true;
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(height: 10),
|
||||
//
|
||||
// // ✅ Modern editor
|
||||
// Container(
|
||||
// height: 300,
|
||||
// decoration: BoxDecoration(
|
||||
// border: Border.all(color: Colors.grey),
|
||||
// borderRadius: BorderRadius.circular(8),
|
||||
// ),
|
||||
// child: QuillEditor.basic(
|
||||
// child: QuillEditor(
|
||||
// focusNode: _editorFocusNode,
|
||||
// scrollController: _editorScrollController,
|
||||
// controller: _controller,
|
||||
// // readOnly: true,
|
||||
// config: QuillEditorConfig(
|
||||
// requestKeyboardFocusOnCheckListChanged: false,
|
||||
// // readOnlyMouseCursor: SystemMouseCursors.text,
|
||||
// enableScribble: true,
|
||||
//
|
||||
// padding: const EdgeInsets.all(8),
|
||||
// placeholder: 'Type something...',
|
||||
// placeholder: 'Start writing your notes...',
|
||||
// padding: const EdgeInsets.all(16),
|
||||
// embedBuilders: [
|
||||
// ...FlutterQuillEmbeds.editorBuilders(
|
||||
// imageEmbedConfig: QuillEditorImageEmbedConfig(
|
||||
@ -332,6 +315,131 @@ class TemplateState extends State<Template> {
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
|
||||
// ✅ Modern toolbar
|
||||
QuillSimpleToolbar(
|
||||
controller: _controller,
|
||||
config: QuillSimpleToolbarConfig(
|
||||
embedButtons: FlutterQuillEmbeds.toolbarButtons(),
|
||||
showClipboardPaste: true,
|
||||
customButtons: [
|
||||
QuillToolbarCustomButtonOptions(
|
||||
icon: const Icon(Icons.add_alarm_rounded),
|
||||
onPressed: () {
|
||||
_controller.document.insert(
|
||||
_controller.selection.extentOffset,
|
||||
TimeStampEmbed(
|
||||
DateTime.now().toString(),
|
||||
),
|
||||
);
|
||||
_controller.readOnly = true;
|
||||
_controller.updateSelection(
|
||||
TextSelection.collapsed(
|
||||
offset: _controller.selection.extentOffset + 1,
|
||||
),
|
||||
ChangeSource.local,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
buttonOptions: QuillSimpleToolbarButtonOptions(
|
||||
base: QuillToolbarBaseButtonOptions(
|
||||
afterButtonPressed: () {
|
||||
final isDesktop = {
|
||||
TargetPlatform.linux,
|
||||
TargetPlatform.windows,
|
||||
TargetPlatform.macOS
|
||||
}.contains(defaultTargetPlatform);
|
||||
if (isDesktop) {
|
||||
_editorFocusNode.requestFocus();
|
||||
}
|
||||
},
|
||||
),
|
||||
linkStyle: QuillToolbarLinkStyleButtonOptions(
|
||||
validateLink: (link) {
|
||||
// Treats all links as valid. When launching the URL,
|
||||
// `https://` is prefixed if the link is incomplete (e.g., `google.com` → `https://google.com`)
|
||||
// however this happens only within the editor.
|
||||
return true;
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
|
||||
// // ✅ Modern editor
|
||||
Container(
|
||||
height: 200,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: QuillEditor(
|
||||
focusNode: _editorFocusNode,
|
||||
scrollController: _editorScrollController,
|
||||
controller: _controller,
|
||||
config: QuillEditorConfig(
|
||||
placeholder: 'Start writing your notes...',
|
||||
padding: const EdgeInsets.all(16),
|
||||
embedBuilders: [
|
||||
...FlutterQuillEmbeds.editorBuilders(
|
||||
imageEmbedConfig: QuillEditorImageEmbedConfig(
|
||||
imageProviderBuilder: (context, imageUrl) {
|
||||
// https://pub.dev/packages/flutter_quill_extensions#-image-assets
|
||||
if (imageUrl.startsWith('assets/')) {
|
||||
return AssetImage(imageUrl);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
videoEmbedConfig: QuillEditorVideoEmbedConfig(
|
||||
customVideoBuilder: (videoUrl, readOnly) {
|
||||
// To load YouTube videos https://github.com/singerdmx/flutter-quill/releases/tag/v10.8.0
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
TimeStampEmbedBuilder(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// child: QuillEditor.basic(
|
||||
// focusNode: _editorFocusNode,
|
||||
// scrollController: _editorScrollController,
|
||||
// controller: _controller,
|
||||
// // readOnly: true,
|
||||
// config: QuillEditorConfig(
|
||||
// requestKeyboardFocusOnCheckListChanged: false,
|
||||
// // readOnlyMouseCursor: SystemMouseCursors.text,
|
||||
// enableScribble: true,
|
||||
// // readOnly: false,
|
||||
// padding: const EdgeInsets.all(8),
|
||||
// placeholder: 'Type something...',
|
||||
// embedBuilders: [
|
||||
// ...FlutterQuillEmbeds.editorBuilders(
|
||||
// imageEmbedConfig: QuillEditorImageEmbedConfig(
|
||||
// imageProviderBuilder: (context, imageUrl) {
|
||||
// // https://pub.dev/packages/flutter_quill_extensions#-image-assets
|
||||
// if (imageUrl.startsWith('assets/')) {
|
||||
// return AssetImage(imageUrl);
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// ),
|
||||
// videoEmbedConfig: QuillEditorVideoEmbedConfig(
|
||||
// customVideoBuilder: (videoUrl, readOnly) {
|
||||
// // To load YouTube videos https://github.com/singerdmx/flutter-quill/releases/tag/v10.8.0
|
||||
// return null;
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// TimeStampEmbedBuilder(),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@ -8,6 +8,8 @@ import 'dart:typed_data';
|
||||
import 'dart:html' as html;
|
||||
import 'dart:ui' as web;
|
||||
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:reorderables/reorderables.dart';
|
||||
import 'package:web/web.dart' as web;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
@ -42,6 +44,9 @@ class _PolicyState extends State<Policy> {
|
||||
|
||||
final ApiService apiService = ApiService();
|
||||
|
||||
// List<String> services = [];
|
||||
List<Map<String, dynamic>> services = [];
|
||||
String? servicesJson;
|
||||
Color? layoutColor;
|
||||
Color? bodyColor;
|
||||
late String policyType = "domestic";
|
||||
@ -94,6 +99,7 @@ class _PolicyState extends State<Policy> {
|
||||
"name": _policyController.text,
|
||||
"domestic": SelectedDomestic,
|
||||
"international": SelectedInternational,
|
||||
"services_ids": services,
|
||||
"is_active": "1",
|
||||
"org_id": orgId,
|
||||
"created_by": userId,
|
||||
@ -201,7 +207,9 @@ class _PolicyState extends State<Policy> {
|
||||
final details =
|
||||
List<Map<String, dynamic>>.from(widget.policy!['policy_details']);
|
||||
|
||||
print("Filtered Selected Services - $details");
|
||||
print(
|
||||
"UUFiltered Selected Services - ${widget.policy!['services_ids']} ");
|
||||
// pr int("UUFiltered Selected Services - $details");
|
||||
|
||||
final filtered = selectedAllServices!
|
||||
.where((service) =>
|
||||
@ -212,13 +220,33 @@ class _PolicyState extends State<Policy> {
|
||||
ServicesChoosed = filtered;
|
||||
});
|
||||
|
||||
print("Filtered Selected Services Chooesed1: $ServicesChoosed");
|
||||
print("Filtered Selected Services ChooesedIpfa1: $ServicesChoosed");
|
||||
|
||||
if (ServicesChoosed!.isNotEmpty) {
|
||||
String firstServiceName = ServicesChoosed?.first['name'];
|
||||
print("✅ First service name selected for filter: $firstServiceName");
|
||||
selectedService = firstServiceName;
|
||||
// services = ServicesChoosed!
|
||||
// .map((service) => service['name'].toString())
|
||||
// .toList();
|
||||
}
|
||||
|
||||
if (widget.policy != null && widget.policy!['services_ids'] != null) {
|
||||
final decoded = jsonDecode(widget.policy!['services_ids']);
|
||||
|
||||
setState(() {
|
||||
services = List<Map<String, dynamic>>.from(decoded)
|
||||
.map((service) => {
|
||||
'service_id': service['service_id'].toString(),
|
||||
'name': service['name'].toString(),
|
||||
'order': service['order'].toString(),
|
||||
})
|
||||
.toList();
|
||||
});
|
||||
|
||||
print("✅ Loaded services from policy (decoded): $services");
|
||||
}
|
||||
|
||||
print("Filtered Selected Services Added to Policy: $ServicesChoosed");
|
||||
} else {
|
||||
final filtered = selectedAllServices!
|
||||
@ -226,8 +254,23 @@ class _PolicyState extends State<Policy> {
|
||||
selectedIds.contains(service['service_id'].toString()))
|
||||
.toList();
|
||||
|
||||
print("ServicesChoosedYY: $ServicesChoosed");
|
||||
setState(() {
|
||||
ServicesChoosed = filtered;
|
||||
// services = ServicesChoosed!
|
||||
// .map((service) => service['name'].toString())
|
||||
// .toList();
|
||||
|
||||
// ServicesChoosed = filtered;
|
||||
|
||||
services = ServicesChoosed!
|
||||
.map((service) => {
|
||||
'service_id': service['service_id'].toString(),
|
||||
'name':
|
||||
service['name'].toString(), // ✅ no space before 'name'
|
||||
'order': service['order'].toString(),
|
||||
})
|
||||
.toList();
|
||||
});
|
||||
|
||||
print("Filtered Selected Services Chooesed1: $ServicesChoosed");
|
||||
@ -264,6 +307,7 @@ class _PolicyState extends State<Policy> {
|
||||
}
|
||||
|
||||
void handleSubmit() async {
|
||||
print("Services - $services");
|
||||
print("USR Detail Submit - $policyData");
|
||||
|
||||
policyCriteriaKey.currentState?.saveCurrentPolicy();
|
||||
@ -534,10 +578,10 @@ class _PolicyState extends State<Policy> {
|
||||
children: [
|
||||
Text(
|
||||
"Choose Policy Type",
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
color: Colors.black,
|
||||
),
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF575A74)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -570,7 +614,7 @@ class _PolicyState extends State<Policy> {
|
||||
height: 10,
|
||||
),
|
||||
Divider(
|
||||
thickness: 0.2,
|
||||
thickness: 0.1,
|
||||
color: Colors.grey,
|
||||
),
|
||||
if (errorMessages["policy_details"] != null) ...[
|
||||
@ -580,6 +624,31 @@ class _PolicyState extends State<Policy> {
|
||||
style: TextStyle(color: Colors.red, fontSize: 12),
|
||||
),
|
||||
],
|
||||
isDesktop
|
||||
? Padding(
|
||||
padding: const EdgeInsets.only(left: 30.0, right: 98.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"Approval Criteria",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF575A74)),
|
||||
),
|
||||
Text(
|
||||
"Service Priority",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF575A74)),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
: SizedBox.shrink(),
|
||||
|
||||
isDesktop
|
||||
? Container(
|
||||
// color: Colors.yellow.shade50,
|
||||
@ -606,11 +675,17 @@ class _PolicyState extends State<Policy> {
|
||||
),
|
||||
)
|
||||
: Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
// _buildPolicyOrdering(isDesktop),
|
||||
_buildPolicyCategory(isDesktop),
|
||||
],
|
||||
child: Container(
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
child: Column(
|
||||
children: [
|
||||
_buildPolicyCategoryList(isDesktop),
|
||||
_buildPolicyOrdering(isDesktop),
|
||||
_buildPolicyCategory(isDesktop),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// isDesktop
|
||||
@ -644,10 +719,10 @@ class _PolicyState extends State<Policy> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Policy Name",
|
||||
style: TextStyle(
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w200,
|
||||
color: Colors.black)),
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF575A74))),
|
||||
SizedBox(height: 5),
|
||||
CustomTextFieldUserWrapper(
|
||||
isFocused: false,
|
||||
@ -655,12 +730,13 @@ class _PolicyState extends State<Policy> {
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: TextField(
|
||||
style: TextStyle(fontSize: 12),
|
||||
style: GoogleFonts.poppins(fontSize: 12),
|
||||
controller: _policyController,
|
||||
onChanged: (value) => _clearError("name"),
|
||||
decoration: InputDecoration(
|
||||
labelText: "Policy Name",
|
||||
labelStyle: TextStyle(fontSize: 12, color: Colors.grey),
|
||||
labelStyle:
|
||||
GoogleFonts.poppins(fontSize: 12, color: Colors.grey),
|
||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 16),
|
||||
@ -682,10 +758,10 @@ class _PolicyState extends State<Policy> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Policy Type",
|
||||
style: TextStyle(
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w200,
|
||||
color: Colors.black)),
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF575A74))),
|
||||
SizedBox(height: 5),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
@ -702,24 +778,180 @@ class _PolicyState extends State<Policy> {
|
||||
|
||||
Widget _buildPolicyCategoryList(bool isDesktop) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(top: 8.0),
|
||||
// color: Colors.white,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
height: isDesktop ? MediaQuery.of(context).size.height * 0.55 : null,
|
||||
// color: Colors.blueGrey.shade200,
|
||||
width: isDesktop ? MediaQuery.of(context).size.width * 0.15 : null,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.blueGrey.shade100, width: 0.35)),
|
||||
child: isDesktop
|
||||
? Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [_buildPolicySubCategoryList(isDesktop)],
|
||||
? Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [_buildPolicySubCategoryList(isDesktop)],
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
// color: Colors.amber,
|
||||
child: Expanded(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [_buildPolicySubCategoryList(isDesktop)],
|
||||
: Column(
|
||||
children: [
|
||||
Container(
|
||||
// color: Colors.amber,
|
||||
child: _buildPolicySubCategoryList(isDesktop),
|
||||
// child: Text("FAta"),
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// children: [_buildPolicySubCategoryList(isDesktop)],
|
||||
// ),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPolicySubCategoryList(bool isDesktop) {
|
||||
if (services.isEmpty) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
|
||||
if (isDesktop) {
|
||||
// 🖥 Desktop (vertical ReorderableListView)
|
||||
return Expanded(
|
||||
child: ReorderableListView(
|
||||
onReorder: (oldIndex, newIndex) {
|
||||
setState(() {
|
||||
if (newIndex > oldIndex) newIndex -= 1;
|
||||
final item = services.removeAt(oldIndex);
|
||||
services.insert(newIndex, item);
|
||||
});
|
||||
},
|
||||
children: List.generate(services.length, (i) {
|
||||
return SizedBox(
|
||||
key: ValueKey(services[i]['service_id']),
|
||||
width: 185,
|
||||
height: 35,
|
||||
// height: MediaQuery.of(context).size.height * 0.025,
|
||||
child: _buildServiceTile(services[i], i.toString()),
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
// 📱 Mobile (horizontal ReorderableWrap)
|
||||
return Container(
|
||||
// color: Colors.red,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Service Ordering"),
|
||||
SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: ReorderableWrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
direction: Axis.horizontal,
|
||||
needsLongPressDraggable: true,
|
||||
onReorder: (oldIndex, newIndex) {
|
||||
setState(() {
|
||||
final item = services.removeAt(oldIndex);
|
||||
services.insert(newIndex, item);
|
||||
});
|
||||
},
|
||||
children: List.generate(services.length, (i) {
|
||||
return SizedBox(
|
||||
key: ValueKey(services[i]),
|
||||
height: isDesktop ? 10 : 45,
|
||||
// child: _buildServiceTile(services[i]['service_id'], i.toString()),
|
||||
child: _buildServiceTile(services[i], i.toString()),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildServiceTile(Map<String, dynamic> service, String index) {
|
||||
bool isSelected = selectedServiceIndex.value == index;
|
||||
String name = service['name']; // or 'service_id', as needed
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
selectedServiceIndex.value = index;
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
// color: Colors.yellow.shade50,
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: Colors.white),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.3),
|
||||
blurRadius: 2,
|
||||
offset: const Offset(0, 1),
|
||||
)
|
||||
],
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
name,
|
||||
style: GoogleFonts.poppins(
|
||||
color: Colors.black,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildServiceTile1(Map<String, dynamic> service, String index) {
|
||||
// bool isSelected = selectedServiceIndex.value == index;
|
||||
// bool isSelected = selectedServiceIndex.value == index;
|
||||
// String name = service['service_id']
|
||||
bool isSelected = selectedServiceIndex.value == index;
|
||||
String name = service['name'];
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
selectedServiceIndex.value = index;
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
height: 5,
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 1, vertical: 2),
|
||||
margin: const EdgeInsets.all(1),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
// color: isSelected ? const Color(0xFF114D8B) : Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: Colors.white),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.3),
|
||||
blurRadius: 2,
|
||||
offset: const Offset(0, 1),
|
||||
)
|
||||
],
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
name,
|
||||
style: GoogleFonts.poppins(
|
||||
color: Colors.black,
|
||||
// color: isSelected ? Colors.white : Colors.black87,
|
||||
fontSize: 12,
|
||||
// fontWeight: FontWeight.w100,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -727,8 +959,8 @@ class _PolicyState extends State<Policy> {
|
||||
return Container(
|
||||
// height: 50,
|
||||
// color: Colors.white,
|
||||
// color: Colors.blueGrey.shade200,
|
||||
padding: isDesktop ? const EdgeInsets.only(left: 35) : null,
|
||||
// color: Colors.yellow.shade200,
|
||||
padding: isDesktop ? const EdgeInsets.only(left: 30, top: 8) : null,
|
||||
width: isDesktop ? MediaQuery.of(context).size.width * 0.62 : null,
|
||||
// width: isDesktop ? MediaQuery.of(context).size.width * 0.75 : null,
|
||||
child: isDesktop
|
||||
@ -736,18 +968,16 @@ class _PolicyState extends State<Policy> {
|
||||
// color: Colors.amber,
|
||||
child: Expanded(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [_buildPolicyServiceOrdering(isDesktop)],
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
// color: Colors.amber,
|
||||
child: Expanded(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [_buildPolicyServiceOrdering(isDesktop)],
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [_buildPolicyServiceOrdering(isDesktop)],
|
||||
),
|
||||
),
|
||||
);
|
||||
@ -776,7 +1006,7 @@ class _PolicyState extends State<Policy> {
|
||||
bool isSelected = selectedServiceIndex.value == index.toString();
|
||||
|
||||
return SizedBox(
|
||||
// width: isDesktop ? 140 : null,
|
||||
// width: isDesktop ? 40 : null,
|
||||
height: isDesktop
|
||||
? max((MediaQuery.of(context).size.height * 0.075), 10)
|
||||
: 45,
|
||||
@ -816,13 +1046,13 @@ class _PolicyState extends State<Policy> {
|
||||
children: [
|
||||
Text(
|
||||
service,
|
||||
style: TextStyle(
|
||||
style: GoogleFonts.poppins(
|
||||
color: isSelected
|
||||
? const Color(0xFF114D8B)
|
||||
: Colors.black87,
|
||||
fontSize: 13,
|
||||
fontWeight:
|
||||
isSelected ? FontWeight.bold : FontWeight.w100,
|
||||
isSelected ? FontWeight.bold : FontWeight.w500,
|
||||
decoration: TextDecoration
|
||||
.none, // remove built-in underline
|
||||
),
|
||||
@ -846,7 +1076,7 @@ class _PolicyState extends State<Policy> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPolicySubCategoryList(bool isDesktop) {
|
||||
Widget _buildPolicySubCategoryList1(bool isDesktop) {
|
||||
// List<String> services = [
|
||||
// "Flight",
|
||||
// "Train",
|
||||
@ -887,7 +1117,7 @@ class _PolicyState extends State<Policy> {
|
||||
onTap: () {
|
||||
print("Selected Services - $service - $index");
|
||||
setState(() {
|
||||
selectedServiceIndex.value = index.toString();
|
||||
// selectedServiceIndex.value = index.toString();
|
||||
// selectedService = service;
|
||||
//
|
||||
// if (selectedService == "Flight" ||
|
||||
@ -931,7 +1161,7 @@ class _PolicyState extends State<Policy> {
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
service,
|
||||
style: TextStyle(
|
||||
style: GoogleFonts.poppins(
|
||||
color: isSelected ? Colors.white : Colors.black87,
|
||||
fontSize: 13,
|
||||
fontWeight:
|
||||
@ -947,7 +1177,7 @@ class _PolicyState extends State<Policy> {
|
||||
|
||||
Widget _buildPolicyCategory(bool isDesktop) {
|
||||
return Container(
|
||||
margin: EdgeInsets.all(10),
|
||||
margin: isDesktop ? EdgeInsets.all(5) : null,
|
||||
// color: Colors.brown.shade100,
|
||||
// child: Text("data"),
|
||||
// color: Colors.white60,
|
||||
@ -988,7 +1218,7 @@ class _PolicyState extends State<Policy> {
|
||||
children: [
|
||||
Text(
|
||||
"Domestic",
|
||||
style: TextStyle(
|
||||
style: GoogleFonts.poppins(
|
||||
color: _selectedTripType == "1" ? Colors.white : Colors.black,
|
||||
fontWeight: _selectedTripType == "1" ? FontWeight.w600 : null,
|
||||
fontSize: 13),
|
||||
@ -1042,7 +1272,7 @@ class _PolicyState extends State<Policy> {
|
||||
children: [
|
||||
Text(
|
||||
"International",
|
||||
style: TextStyle(
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 13,
|
||||
color: _selectedTripType == "2" ? Colors.white : Colors.black,
|
||||
fontWeight: _selectedTripType == "2" ? FontWeight.w600 : null,
|
||||
@ -1115,7 +1345,10 @@ class _PolicyState extends State<Policy> {
|
||||
onPressed: () {
|
||||
context.go('/PolicyList');
|
||||
},
|
||||
child: Text("Cancel")),
|
||||
child: Text(
|
||||
"Cancel",
|
||||
style: GoogleFonts.poppins(fontSize: 10),
|
||||
)),
|
||||
SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
@ -1140,7 +1373,10 @@ class _PolicyState extends State<Policy> {
|
||||
),
|
||||
onPressed:
|
||||
isViewMode ? null : handleSubmit, // Disable when in view mode
|
||||
child: Text("Submit"),
|
||||
child: Text(
|
||||
"Submit",
|
||||
style: GoogleFonts.poppins(fontSize: 10),
|
||||
),
|
||||
),
|
||||
)
|
||||
];
|
||||
@ -1163,7 +1399,10 @@ class _PolicyState extends State<Policy> {
|
||||
contentPadding: EdgeInsets.zero,
|
||||
visualDensity: VisualDensity.compact,
|
||||
dense: true,
|
||||
title: Text("Domestic"),
|
||||
title: Text(
|
||||
"Domestic",
|
||||
style: GoogleFonts.poppins(fontSize: 12),
|
||||
),
|
||||
value: "1",
|
||||
groupValue: _selectedTripType,
|
||||
onChanged: (value) {
|
||||
|
||||
@ -2,6 +2,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:dropdown_search/dropdown_search.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../config/apiUrl.dart';
|
||||
@ -100,6 +101,7 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
||||
|
||||
void saveCurrentPolicy() {
|
||||
if (ServiceId != null) {
|
||||
print("Saving curremt Add or Update");
|
||||
addOrUpdatePolicy(ServiceId!);
|
||||
}
|
||||
}
|
||||
@ -154,7 +156,7 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
||||
"service_id": serviceId,
|
||||
"cost": costController[serviceId]?.text,
|
||||
// "class": classController[serviceId]?.text,
|
||||
"class": classAction[serviceId],
|
||||
"class": classAction[serviceId] ?? "",
|
||||
"a1_action": FirstApproverAction[serviceId],
|
||||
"a2_action": SecondApproverAction[serviceId],
|
||||
"a3_action": ThirdApproverAction[serviceId],
|
||||
@ -184,6 +186,8 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
||||
if (hasValue && allActionsNull) {
|
||||
validationErrors[serviceId] = "Please select all actions.";
|
||||
return;
|
||||
} else {
|
||||
print("HAS VAlue");
|
||||
}
|
||||
|
||||
validationErrors.remove(serviceId);
|
||||
@ -319,38 +323,42 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// widget.isDesktop ? SizedBox(height: 10) : SizedBox(height: 5),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 28.0),
|
||||
child: Text(
|
||||
" Policy Criteria For ${widget.selectedService} ",
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFF9E9DBD),
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
// Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// children: [
|
||||
// Padding(
|
||||
// padding: widget.isDesktop
|
||||
// ? const EdgeInsets.only(left: 28.0)
|
||||
// : const EdgeInsets.only(left: 0),
|
||||
// child: Text(
|
||||
// " Policy Criteria For ${widget.selectedService} ",
|
||||
// style: GoogleFonts.poppins(
|
||||
// fontSize: 13,
|
||||
// color: Color(0xFF9E9DBD),
|
||||
// fontWeight: FontWeight.bold),
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
if (widget.isClass!)
|
||||
widget.isDesktop ? SizedBox(height: 5) : SizedBox(height: 5),
|
||||
widget.isDesktop ? SizedBox(height: 1) : SizedBox(height: 1),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 28.0),
|
||||
padding: widget.isDesktop
|
||||
? const EdgeInsets.only(left: 0.0)
|
||||
: const EdgeInsets.only(left: 0),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
// color: Colors.grey,
|
||||
padding:
|
||||
const EdgeInsets.only(top: 5, bottom: 5, left: 5, right: 5),
|
||||
const EdgeInsets.only(top: 2, bottom: 2, left: 5, right: 5),
|
||||
child: widget.isDesktop
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
if (widget.isClass)
|
||||
buildClassWidget(widget.isDesktop),
|
||||
SizedBox(width: 30),
|
||||
SizedBox(width: 45),
|
||||
if (widget.isCost!) buildCostWidget(widget.isDesktop),
|
||||
],
|
||||
)
|
||||
@ -367,7 +375,7 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
||||
],
|
||||
),
|
||||
),
|
||||
if (widget.isCost!) SizedBox(height: 15),
|
||||
if (widget.isCost!) SizedBox(height: 5),
|
||||
if (validationErrors[ServiceId] != null)
|
||||
Row(
|
||||
children: [
|
||||
@ -378,7 +386,7 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
||||
fontWeight: FontWeight.bold))
|
||||
],
|
||||
),
|
||||
if (validationErrors[ServiceId] != null) SizedBox(height: 15),
|
||||
if (validationErrors[ServiceId] != null) SizedBox(height: 5),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: null,
|
||||
@ -397,6 +405,9 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
||||
width: widget.isDesktop
|
||||
? MediaQuery.of(context).size.width * 0.56
|
||||
: 600,
|
||||
height: widget.isDesktop
|
||||
? MediaQuery.of(context).size.height * 0.56
|
||||
: null,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
@ -408,7 +419,7 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
||||
// ),
|
||||
),
|
||||
padding: const EdgeInsets.only(
|
||||
top: 10, bottom: 10, left: 35, right: 35),
|
||||
top: 10, bottom: 0, left: 0, right: 35),
|
||||
child: Row(
|
||||
mainAxisAlignment: widget.isDesktop
|
||||
? MainAxisAlignment.spaceAround
|
||||
@ -418,7 +429,7 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
||||
flex: 2,
|
||||
child: Text(
|
||||
"Approver",
|
||||
style: TextStyle(
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF9E9DBD),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12),
|
||||
@ -428,7 +439,7 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
||||
flex: 2,
|
||||
child: Text(
|
||||
"Actions",
|
||||
style: TextStyle(
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF9E9DBD),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12),
|
||||
@ -436,7 +447,7 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
||||
),
|
||||
Text(
|
||||
"Parallel Action",
|
||||
style: TextStyle(
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF9E9DBD),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12),
|
||||
@ -449,402 +460,402 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
||||
color: Colors.grey,
|
||||
),
|
||||
SizedBox(
|
||||
height: 180,
|
||||
child: SingleChildScrollView(
|
||||
// scrollDirection: Axis.vertical,
|
||||
child: Container(
|
||||
// color: Colors.grey,
|
||||
margin:
|
||||
const EdgeInsets.only(right: 20, left: 20),
|
||||
// color: Colors.grey.shade100,
|
||||
child: Column(children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text("Approver 1"),
|
||||
Spacer(),
|
||||
CustomTextFieldUserWrapper(
|
||||
isFocused: false,
|
||||
isDesktop: widget.isDesktop,
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: DropdownSearch<String>(
|
||||
selectedItem:
|
||||
FirstApproverAction[ServiceId],
|
||||
// enabled: !isViewMode,
|
||||
popupProps: PopupProps.menu(
|
||||
// showSearchBox: true,
|
||||
fit: FlexFit
|
||||
.loose, // Allows flexible height
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: 250),
|
||||
itemBuilder:
|
||||
(context, item, isSelected) =>
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(
|
||||
horizontal: 16.0,
|
||||
vertical: 8.0),
|
||||
child: Text(
|
||||
item,
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
12, // 👈 Smaller text size here
|
||||
color: Colors
|
||||
.black, // You can customize this
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
items: [
|
||||
"Approval",
|
||||
"Notification",
|
||||
"None"
|
||||
],
|
||||
dropdownDecoratorProps:
|
||||
DropDownDecoratorProps(
|
||||
dropdownSearchDecoration:
|
||||
InputDecoration(
|
||||
border: InputBorder.none,
|
||||
contentPadding:
|
||||
EdgeInsets.symmetric(
|
||||
horizontal: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
dropdownBuilder:
|
||||
(context, selectedItem) =>
|
||||
Align(
|
||||
// Center-align selected item
|
||||
alignment: Alignment.centerLeft,
|
||||
// height: 180,
|
||||
|
||||
// scrollDirection: Axis.vertical,
|
||||
child: Container(
|
||||
// height: MediaQuery.of(context).size.height * 3,
|
||||
// color: Colors.grey,
|
||||
margin: const EdgeInsets.only(right: 20, left: 0),
|
||||
// color: Colors.grey.shade100,
|
||||
child: Column(children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
"Approver 1",
|
||||
style: GoogleFonts.poppins(fontSize: 13),
|
||||
),
|
||||
Spacer(),
|
||||
CustomTextFieldUserWrapper(
|
||||
isFocused: false,
|
||||
isDesktop: widget.isDesktop,
|
||||
child: SizedBox(
|
||||
height: 35,
|
||||
child: DropdownSearch<String>(
|
||||
selectedItem:
|
||||
FirstApproverAction[ServiceId],
|
||||
// enabled: !isViewMode,
|
||||
popupProps: PopupProps.menu(
|
||||
// showSearchBox: true,
|
||||
fit: FlexFit
|
||||
.loose, // Allows flexible height
|
||||
constraints:
|
||||
BoxConstraints(maxHeight: 250),
|
||||
itemBuilder:
|
||||
(context, item, isSelected) =>
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(
|
||||
horizontal: 16.0,
|
||||
vertical: 8.0),
|
||||
child: Text(
|
||||
selectedItem ?? "Select",
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF114D8B)),
|
||||
item,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize:
|
||||
12, // 👈 Smaller text size here
|
||||
color: Colors
|
||||
.black, // You can customize this
|
||||
),
|
||||
),
|
||||
),
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
// Find the country_code based on selected country_name
|
||||
FirstApproverAction[
|
||||
ServiceId!] = newValue;
|
||||
|
||||
// print("selectedUserType - $selectedUserType");
|
||||
|
||||
// if (selectedCountry!.isNotEmpty) {
|
||||
// errorMessages.remove("country_code");
|
||||
// }
|
||||
});
|
||||
},
|
||||
),
|
||||
items: [
|
||||
"Approval",
|
||||
"Notification",
|
||||
"None"
|
||||
],
|
||||
dropdownDecoratorProps:
|
||||
DropDownDecoratorProps(
|
||||
dropdownSearchDecoration:
|
||||
InputDecoration(
|
||||
border: InputBorder.none,
|
||||
contentPadding:
|
||||
EdgeInsets.symmetric(
|
||||
horizontal: 1,
|
||||
vertical: 5),
|
||||
),
|
||||
),
|
||||
dropdownBuilder:
|
||||
(context, selectedItem) => Text(
|
||||
selectedItem ?? "Select",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF114D8B)),
|
||||
),
|
||||
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
// Find the country_code based on selected country_name
|
||||
FirstApproverAction[ServiceId!] =
|
||||
newValue;
|
||||
|
||||
// print("selectedUserType - $selectedUserType");
|
||||
|
||||
// if (selectedCountry!.isNotEmpty) {
|
||||
// errorMessages.remove("country_code");
|
||||
// }
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
SelectedParallelProcess[
|
||||
ServiceId!] = "1";
|
||||
});
|
||||
),
|
||||
Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
SelectedParallelProcess[ServiceId!] =
|
||||
"1";
|
||||
});
|
||||
|
||||
print(
|
||||
"SelectedParallelProcess - $SelectedParallelProcess");
|
||||
},
|
||||
child: Container(
|
||||
height: 25,
|
||||
width: 25,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color:
|
||||
(SelectedParallelProcess[
|
||||
ServiceId] ==
|
||||
"1")
|
||||
? Colors.green
|
||||
: Colors.grey,
|
||||
width: 2),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.check_circle,
|
||||
size: 20,
|
||||
color: (SelectedParallelProcess[
|
||||
ServiceId] ==
|
||||
"1")
|
||||
? Colors.green
|
||||
: Colors.grey,
|
||||
// color: Colors.grey,
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text("Approver 2"),
|
||||
Spacer(),
|
||||
CustomTextFieldUserWrapper(
|
||||
isFocused: false,
|
||||
isDesktop: widget.isDesktop,
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: DropdownSearch<String>(
|
||||
selectedItem:
|
||||
SecondApproverAction[ServiceId],
|
||||
// enabled: !isViewMode,
|
||||
popupProps: PopupProps.menu(
|
||||
// showSearchBox: true,
|
||||
fit: FlexFit
|
||||
.loose, // Allows flexible height
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: 250),
|
||||
itemBuilder:
|
||||
(context, item, isSelected) =>
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(
|
||||
horizontal: 16.0,
|
||||
vertical: 8.0),
|
||||
child: Text(
|
||||
item,
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
12, // 👈 Smaller text size here
|
||||
color: Colors
|
||||
.black, // You can customize this
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
items: [
|
||||
"Approval",
|
||||
"Notification",
|
||||
"None"
|
||||
],
|
||||
dropdownDecoratorProps:
|
||||
DropDownDecoratorProps(
|
||||
dropdownSearchDecoration:
|
||||
InputDecoration(
|
||||
border: InputBorder.none,
|
||||
contentPadding:
|
||||
EdgeInsets.symmetric(
|
||||
horizontal: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
dropdownBuilder:
|
||||
(context, selectedItem) =>
|
||||
Align(
|
||||
// Center-align selected item
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
selectedItem ?? "Select",
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF114D8B)),
|
||||
),
|
||||
),
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
// Find the country_code based on selected country_name
|
||||
SecondApproverAction[
|
||||
ServiceId!] = newValue;
|
||||
|
||||
// print("selectedUserType - $selectedUserType");
|
||||
|
||||
// if (selectedCountry!.isNotEmpty) {
|
||||
// errorMessages.remove("country_code");
|
||||
// }
|
||||
});
|
||||
},
|
||||
print(
|
||||
"SelectedParallelProcess - $SelectedParallelProcess");
|
||||
},
|
||||
child: Container(
|
||||
height: 25,
|
||||
width: 25,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color: (SelectedParallelProcess[
|
||||
ServiceId] ==
|
||||
"1")
|
||||
? Colors.green
|
||||
: Colors.grey,
|
||||
width: 2),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.check_circle,
|
||||
size: 20,
|
||||
color: (SelectedParallelProcess[
|
||||
ServiceId] ==
|
||||
"1")
|
||||
? Colors.green
|
||||
: Colors.grey,
|
||||
// color: Colors.grey,
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
"Approver 2",
|
||||
style: GoogleFonts.poppins(fontSize: 13),
|
||||
),
|
||||
Spacer(),
|
||||
CustomTextFieldUserWrapper(
|
||||
isFocused: false,
|
||||
isDesktop: widget.isDesktop,
|
||||
child: SizedBox(
|
||||
height: 35,
|
||||
child: DropdownSearch<String>(
|
||||
selectedItem:
|
||||
SecondApproverAction[ServiceId],
|
||||
// enabled: !isViewMode,
|
||||
popupProps: PopupProps.menu(
|
||||
// showSearchBox: true,
|
||||
fit: FlexFit
|
||||
.loose, // Allows flexible height
|
||||
constraints:
|
||||
BoxConstraints(maxHeight: 250),
|
||||
itemBuilder:
|
||||
(context, item, isSelected) =>
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(
|
||||
horizontal: 16.0,
|
||||
vertical: 8.0),
|
||||
child: Text(
|
||||
item,
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
12, // 👈 Smaller text size here
|
||||
color: Colors
|
||||
.black, // You can customize this
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
items: [
|
||||
"Approval",
|
||||
"Notification",
|
||||
"None"
|
||||
],
|
||||
dropdownDecoratorProps:
|
||||
DropDownDecoratorProps(
|
||||
dropdownSearchDecoration:
|
||||
InputDecoration(
|
||||
border: InputBorder.none,
|
||||
contentPadding:
|
||||
EdgeInsets.symmetric(
|
||||
horizontal: 1,
|
||||
vertical: 5),
|
||||
),
|
||||
),
|
||||
dropdownBuilder:
|
||||
(context, selectedItem) => Text(
|
||||
selectedItem ?? "Select",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF114D8B)),
|
||||
),
|
||||
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
// Find the country_code based on selected country_name
|
||||
SecondApproverAction[ServiceId!] =
|
||||
newValue;
|
||||
|
||||
// print("selectedUserType - $selectedUserType");
|
||||
|
||||
// if (selectedCountry!.isNotEmpty) {
|
||||
// errorMessages.remove("country_code");
|
||||
// }
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
SelectedParallelProcess[
|
||||
ServiceId!] = "2";
|
||||
});
|
||||
),
|
||||
Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
SelectedParallelProcess[ServiceId!] =
|
||||
"2";
|
||||
});
|
||||
|
||||
print(
|
||||
"SelectedParallelProcess - $SelectedParallelProcess");
|
||||
},
|
||||
child: Container(
|
||||
height: 25,
|
||||
width: 25,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color: ((SelectedParallelProcess[
|
||||
ServiceId] ==
|
||||
"1") ||
|
||||
(SelectedParallelProcess[
|
||||
ServiceId] ==
|
||||
"2"))
|
||||
? Colors.green
|
||||
: Colors.grey,
|
||||
width: 2),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.check_circle,
|
||||
size: 20,
|
||||
color: ((SelectedParallelProcess[
|
||||
ServiceId] ==
|
||||
"1") ||
|
||||
(SelectedParallelProcess[
|
||||
ServiceId] ==
|
||||
"2"))
|
||||
? Colors.green
|
||||
: Colors.grey,
|
||||
// color: Colors.grey,
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text("Approver 3"),
|
||||
Spacer(),
|
||||
CustomTextFieldUserWrapper(
|
||||
isFocused: false,
|
||||
isDesktop: widget.isDesktop,
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: DropdownSearch<String>(
|
||||
selectedItem:
|
||||
ThirdApproverAction[ServiceId],
|
||||
// enabled: !isViewMode,
|
||||
popupProps: PopupProps.menu(
|
||||
// showSearchBox: true,
|
||||
fit: FlexFit
|
||||
.loose, // Allows flexible height
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: 250),
|
||||
itemBuilder:
|
||||
(context, item, isSelected) =>
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(
|
||||
horizontal: 16.0,
|
||||
vertical: 8.0),
|
||||
child: Text(
|
||||
item,
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
12, // 👈 Smaller text size here
|
||||
color: Colors
|
||||
.black, // You can customize this
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
items: [
|
||||
"Approval",
|
||||
"Notification",
|
||||
"None"
|
||||
],
|
||||
dropdownDecoratorProps:
|
||||
DropDownDecoratorProps(
|
||||
dropdownSearchDecoration:
|
||||
InputDecoration(
|
||||
border: InputBorder.none,
|
||||
contentPadding:
|
||||
EdgeInsets.symmetric(
|
||||
horizontal: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
dropdownBuilder:
|
||||
(context, selectedItem) =>
|
||||
Align(
|
||||
// Center-align selected item
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
selectedItem ?? "Select",
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF114D8B)),
|
||||
),
|
||||
),
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
// Find the country_code based on selected country_name
|
||||
ThirdApproverAction[
|
||||
ServiceId!] = newValue;
|
||||
|
||||
// print("selectedUserType - $selectedUserType");
|
||||
|
||||
// if (selectedCountry!.isNotEmpty) {
|
||||
// errorMessages.remove("country_code");
|
||||
// }
|
||||
});
|
||||
},
|
||||
print(
|
||||
"SelectedParallelProcess - $SelectedParallelProcess");
|
||||
},
|
||||
child: Container(
|
||||
height: 25,
|
||||
width: 25,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color: ((SelectedParallelProcess[
|
||||
ServiceId] ==
|
||||
"1") ||
|
||||
(SelectedParallelProcess[
|
||||
ServiceId] ==
|
||||
"2"))
|
||||
? Colors.green
|
||||
: Colors.grey,
|
||||
width: 2),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.check_circle,
|
||||
size: 20,
|
||||
color: ((SelectedParallelProcess[
|
||||
ServiceId] ==
|
||||
"1") ||
|
||||
(SelectedParallelProcess[
|
||||
ServiceId] ==
|
||||
"2"))
|
||||
? Colors.green
|
||||
: Colors.grey,
|
||||
// color: Colors.grey,
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
"Approver 3",
|
||||
style: GoogleFonts.poppins(fontSize: 13),
|
||||
),
|
||||
Spacer(),
|
||||
CustomTextFieldUserWrapper(
|
||||
isFocused: false,
|
||||
isDesktop: widget.isDesktop,
|
||||
child: SizedBox(
|
||||
height: 35,
|
||||
child: DropdownSearch<String>(
|
||||
selectedItem:
|
||||
ThirdApproverAction[ServiceId],
|
||||
// enabled: !isViewMode,
|
||||
popupProps: PopupProps.menu(
|
||||
// showSearchBox: true,
|
||||
fit: FlexFit
|
||||
.loose, // Allows flexible height
|
||||
constraints:
|
||||
BoxConstraints(maxHeight: 250),
|
||||
itemBuilder:
|
||||
(context, item, isSelected) =>
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(
|
||||
horizontal: 16.0,
|
||||
vertical: 8.0),
|
||||
child: Text(
|
||||
item,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize:
|
||||
12, // 👈 Smaller text size here
|
||||
color: Colors
|
||||
.black, // You can customize this
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
items: [
|
||||
"Approval",
|
||||
"Notification",
|
||||
"None"
|
||||
],
|
||||
dropdownDecoratorProps:
|
||||
DropDownDecoratorProps(
|
||||
dropdownSearchDecoration:
|
||||
InputDecoration(
|
||||
border: InputBorder.none,
|
||||
contentPadding:
|
||||
EdgeInsets.symmetric(
|
||||
horizontal: 1,
|
||||
vertical: 5),
|
||||
),
|
||||
),
|
||||
dropdownBuilder:
|
||||
(context, selectedItem) =>
|
||||
// Center-align selected item
|
||||
Text(
|
||||
selectedItem ?? "Select",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF114D8B)),
|
||||
),
|
||||
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
// Find the country_code based on selected country_name
|
||||
ThirdApproverAction[ServiceId!] =
|
||||
newValue;
|
||||
|
||||
// print("selectedUserType - $selectedUserType");
|
||||
|
||||
// if (selectedCountry!.isNotEmpty) {
|
||||
// errorMessages.remove("country_code");
|
||||
// }
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
SelectedParallelProcess[
|
||||
ServiceId!] = "3";
|
||||
});
|
||||
print(
|
||||
"SelectedParallelProcess - $SelectedParallelProcess[ServiceId]");
|
||||
},
|
||||
child: Container(
|
||||
height: 25,
|
||||
width: 25,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color: ((SelectedParallelProcess[ServiceId] == "1") ||
|
||||
(SelectedParallelProcess[
|
||||
ServiceId] ==
|
||||
"2") ||
|
||||
(SelectedParallelProcess[
|
||||
ServiceId] ==
|
||||
"3"))
|
||||
? Colors.green
|
||||
: Colors.grey,
|
||||
width: 2),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.check_circle,
|
||||
size: 20,
|
||||
color:
|
||||
((SelectedParallelProcess[
|
||||
ServiceId] ==
|
||||
"1") ||
|
||||
(SelectedParallelProcess[
|
||||
ServiceId] ==
|
||||
"2") ||
|
||||
(SelectedParallelProcess[
|
||||
ServiceId] ==
|
||||
"3"))
|
||||
? Colors.green
|
||||
: Colors.grey,
|
||||
// color: Colors.grey,
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
SelectedParallelProcess[ServiceId!] =
|
||||
"3";
|
||||
});
|
||||
print(
|
||||
"SelectedParallelProcess - $SelectedParallelProcess[ServiceId]");
|
||||
},
|
||||
child: Container(
|
||||
height: 25,
|
||||
width: 25,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color:
|
||||
((SelectedParallelProcess[
|
||||
ServiceId] ==
|
||||
"1") ||
|
||||
(SelectedParallelProcess[
|
||||
ServiceId] ==
|
||||
"2") ||
|
||||
(SelectedParallelProcess[
|
||||
ServiceId] ==
|
||||
"3"))
|
||||
? Colors.green
|
||||
: Colors.grey,
|
||||
width: 2),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.check_circle,
|
||||
size: 20,
|
||||
color:
|
||||
((SelectedParallelProcess[
|
||||
ServiceId] ==
|
||||
"1") ||
|
||||
(SelectedParallelProcess[
|
||||
ServiceId] ==
|
||||
"2") ||
|
||||
(SelectedParallelProcess[
|
||||
ServiceId] ==
|
||||
"3"))
|
||||
? Colors.green
|
||||
: Colors.grey,
|
||||
// color: Colors.grey,
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
]),
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
)),
|
||||
],
|
||||
@ -879,7 +890,7 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
||||
DropdownMenuItem<String>(
|
||||
value: null,
|
||||
child: Text("No options available",
|
||||
style: TextStyle(color: Colors.grey)),
|
||||
style: GoogleFonts.poppins(color: Colors.grey)),
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -914,9 +925,9 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Class",
|
||||
style: TextStyle(
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w200,
|
||||
// fontWeight: FontWeight.w200,
|
||||
color: Colors.black)),
|
||||
SizedBox(height: 5),
|
||||
CustomTextFieldUserWrapper(
|
||||
@ -948,7 +959,7 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
||||
// controller: _hotelNameController,
|
||||
value: classAction[ServiceId],
|
||||
|
||||
style: TextStyle(fontSize: 12),
|
||||
style: GoogleFonts.poppins(fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
@ -979,9 +990,9 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Cost",
|
||||
style: TextStyle(
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w200,
|
||||
// fontWeight: FontWeight.w200,
|
||||
color: Colors.black)),
|
||||
SizedBox(height: 5),
|
||||
CustomTextFieldUserWrapper(
|
||||
@ -990,7 +1001,7 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: TextField(
|
||||
style: TextStyle(fontSize: 12),
|
||||
style: GoogleFonts.poppins(fontSize: 12),
|
||||
controller: costController[ServiceId],
|
||||
// enabled: !isViewMode,
|
||||
onChanged: (value) {
|
||||
@ -998,7 +1009,8 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
labelText: "Cost",
|
||||
labelStyle: TextStyle(fontSize: 12, color: Colors.grey),
|
||||
labelStyle:
|
||||
GoogleFonts.poppins(fontSize: 12, color: Colors.grey),
|
||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 16),
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:frontend/Screens/group/group.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:responsive_builder/responsive_builder.dart';
|
||||
|
||||
@ -218,9 +219,14 @@ class _PolicyListState extends State<PolicyList> {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Text('Policy List',
|
||||
style:
|
||||
TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
Text(
|
||||
'Policy List',
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: isDesktop ? 16 : 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.keyboard_arrow_down),
|
||||
onPressed: () {},
|
||||
@ -243,7 +249,8 @@ class _PolicyListState extends State<PolicyList> {
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Text('New Policy'),
|
||||
Text('New Policy',
|
||||
style: GoogleFonts.poppins(fontSize: 12)),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
@ -315,16 +322,39 @@ class _PolicyListState extends State<PolicyList> {
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text("Policy Name: ${policy['name']}",
|
||||
style: TextStyle(
|
||||
fontSize: 13, fontWeight: FontWeight.bold)),
|
||||
flex: 1,
|
||||
child: Text("Policy Name",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 11.5, fontWeight: FontWeight.w400)),
|
||||
),
|
||||
Expanded(flex: 1, child: Text(" ${policy['created_on']}")),
|
||||
Expanded(flex: 1, child: Text("${policy['created_by']}")),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text("Policy Type",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 11.5, fontWeight: FontWeight.w400))),
|
||||
// Expanded(flex: 1, child: Text("${policy['created_by']}")),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text("${policy['name']}",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 13, fontWeight: FontWeight.w600)),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text(
|
||||
policy['domestic'] == "1"
|
||||
? "Domestic"
|
||||
: "International",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 13, fontWeight: FontWeight.w600))),
|
||||
// Expanded(flex: 1, child: Text("${policy['created_by']}")),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
|
||||
@ -1162,9 +1162,9 @@ class PersonalDetailsState extends State<PersonalDetails> {
|
||||
items: apiRoleData?.map<DropdownMenuItem<String>>((item) {
|
||||
return DropdownMenuItem(
|
||||
value: item['dropdown_key'], // ID as value
|
||||
child: Text(item['dropdown_value'] ?? "Select"));
|
||||
child: Text(item['dropdown_value'] ?? "Select Role"));
|
||||
}).toList(),
|
||||
hint: Text("Select"),
|
||||
hint: Text("Select Role"),
|
||||
disabledHint: Text(
|
||||
selectedRole ?? "Select Role",
|
||||
style: GoogleFonts.poppins(fontSize: 12, color: Colors.black),
|
||||
|
||||
@ -6,7 +6,13 @@ import 'package:shared_preferences/shared_preferences.dart'; // don't forget
|
||||
import '../services/apiService.dart';
|
||||
import '../utils/auth_utils.dart';
|
||||
|
||||
enum TabSelection { allTrips, myTrips, myApprovals, allMenu, dashboard }
|
||||
enum TabSelection {
|
||||
dashboard,
|
||||
allTrips,
|
||||
myTrips,
|
||||
myApprovals,
|
||||
allMenu,
|
||||
}
|
||||
|
||||
class CustomAppBar extends StatefulWidget implements PreferredSizeWidget {
|
||||
final bool isDesktop;
|
||||
@ -188,7 +194,9 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
||||
print("location - $location");
|
||||
|
||||
setState(() {
|
||||
if (location.contains('/listAllPlan') ||
|
||||
if (location.contains('/StatusDashboard')) {
|
||||
selectedTab = TabSelection.dashboard;
|
||||
} else if (location.contains('/listAllPlan') ||
|
||||
location.contains('/allTrips/trips')) {
|
||||
selectedTab = TabSelection.allTrips;
|
||||
} else if (location.contains('/listPlan') ||
|
||||
@ -197,8 +205,6 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
||||
selectedTab = TabSelection.myTrips;
|
||||
} else if (location.contains('/ApprovalList')) {
|
||||
selectedTab = TabSelection.myApprovals;
|
||||
} else if (location.contains('/StatusDashboard')) {
|
||||
selectedTab = TabSelection.dashboard;
|
||||
} else {
|
||||
selectedTab = TabSelection.allMenu;
|
||||
}
|
||||
|
||||
@ -1048,4 +1048,49 @@ class ApiService {
|
||||
throw Exception('Failed to load CostCenter details');
|
||||
}
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> getHotelsDetailsFind(int id) async {
|
||||
final String apiUrldata = '$apiUrl/api/findHotels?hotel_id=$id';
|
||||
|
||||
final token = await getToken();
|
||||
|
||||
if (token == null) {
|
||||
throw Exception('Token not found. Please log in.');
|
||||
}
|
||||
|
||||
final response = await http.get(
|
||||
Uri.parse(apiUrldata),
|
||||
headers: {
|
||||
'Authorization': 'Bearer $token',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
try {
|
||||
final data = json.decode(response.body);
|
||||
// print('findout the result');
|
||||
// print(data.runtimeType);
|
||||
// print(data);
|
||||
|
||||
if (!data.containsKey('data') || data['data'] is! List) {
|
||||
throw Exception(
|
||||
"Invalid response format: 'data' field is missing or not a List");
|
||||
}
|
||||
|
||||
final List<Map<String, dynamic>> listData =
|
||||
List<Map<String, dynamic>>.from(data['data']);
|
||||
|
||||
if (listData.isEmpty) {
|
||||
throw Exception("No Hotel data found with ID $id");
|
||||
}
|
||||
|
||||
return listData[0];
|
||||
} catch (e) {
|
||||
throw Exception('Error parsing response: $e');
|
||||
}
|
||||
} else {
|
||||
throw Exception('Failed to load Hotel details');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -701,6 +701,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.2.2"
|
||||
reorderables:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: reorderables
|
||||
sha256: "004a886e4878df1ee27321831c838bc1c976311f4ca6a74ce7d561e506540a77"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.6.0"
|
||||
responsive_builder:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
||||
@ -53,6 +53,7 @@ dependencies:
|
||||
flutter_quill: ^11.4.1
|
||||
flutter_quill_extensions: ^11.0.0
|
||||
flutter_localization: ^0.3.2
|
||||
reorderables: ^0.6.0
|
||||
|
||||
|
||||
dev_dependencies:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user