Commit de06e196 authored by Sai Srinivas's avatar Sai Srinivas
Browse files

Help screnn added

parent c5c56ca4
<svg width="42" height="42" viewBox="0 0 42 42" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M26.8984 21.0021L16.8208 21.0021" stroke="#1E1E1E" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M20.1799 15.9634L15.1411 21.0022L20.1799 26.041" stroke="#1E1E1E" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M34.4565 31.0797C36.556 28.2748 37.8157 24.7812 37.8157 21.0021C37.8157 11.7307 30.2911 4.2061 21.0197 4.20609C11.7483 4.20609 4.22368 11.7307 4.22368 21.0021C4.22367 30.2735 11.7483 37.7981 21.0197 37.7981C23.4215 37.7981 25.7226 37.2942 27.7885 36.3704" stroke="#1E1E1E" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<svg width="38" height="38" viewBox="0 0 38 38" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M18.9809 37.9618C29.4637 37.9618 37.9618 29.4637 37.9618 18.9809C37.9618 8.49803 29.4637 0 18.9809 0C8.49803 0 0 8.49803 0 18.9809C0 29.4637 8.49803 37.9618 18.9809 37.9618Z" fill="url(#paint0_linear_383_1201)"/>
<path d="M18.8177 32.4369C17.2122 32.4369 15.8743 31.1325 15.8743 29.5271C15.8743 27.9216 17.2122 26.6172 18.8177 26.6172C20.4231 26.6172 21.761 27.9216 21.761 29.5271C21.761 31.1325 20.4231 32.4369 18.8177 32.4369Z" fill="white"/>
<path d="M20.7245 22.1017V24.6105H16.0086L15.2058 18.6567C19.186 18.6567 21.9954 17.7872 21.9954 15.2451C21.9954 13.6061 20.7915 12.3018 18.7178 12.3018C17.38 12.3018 15.6404 12.9037 14.102 13.9072L13.4663 9.15762C14.8712 8.18757 17.0789 7.48535 19.1525 7.48535C23.8349 7.48535 27.347 10.6628 27.347 14.8438C27.347 18.8908 24.0024 21.6671 20.7245 22.1017Z" fill="white"/>
<defs>
<linearGradient id="paint0_linear_383_1201" x1="25.4745" y1="36.8219" x2="12.4873" y2="1.13985" gradientUnits="userSpaceOnUse">
<stop offset="0.2486" stop-color="#948BF7"/>
<stop offset="0.9279" stop-color="#C7CBFF"/>
</linearGradient>
</defs>
</svg>
<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_383_1601)">
<path d="M4.00647 4.47004C4.00647 6.93496 6.0116 8.94009 8.47651 8.94009C10.9414 8.94009 12.9466 6.93496 12.9466 4.47004C12.9466 2.00513 10.9414 0 8.47651 0C6.0116 0 4.00647 2.00513 4.00647 4.47004Z" fill="#45C1F1"/>
<path d="M12.9466 4.47004C12.9466 2.00513 10.9415 0 8.47656 0V8.94009C10.9415 8.94009 12.9466 6.93496 12.9466 4.47004Z" fill="#44A4EC"/>
<path d="M1.02649 16.4565C1.02649 16.7311 1.24863 16.9532 1.52316 16.9532H15.43C15.7045 16.9532 15.9266 16.7311 15.9266 16.4565C15.9266 12.8964 13.03 9.93359 9.4699 9.93359H7.48322C3.92308 9.93359 1.02649 12.8964 1.02649 16.4565Z" fill="#45C1F1"/>
<path d="M9.46991 9.93359H8.47656V16.9532H15.43C15.7045 16.9532 15.9266 16.7311 15.9266 16.4565C15.9266 12.8964 13.03 9.93359 9.46991 9.93359Z" fill="#44A4EC"/>
</g>
<defs>
<clipPath id="clip0_383_1601">
<rect width="16.9531" height="16.9531" fill="white"/>
</clipPath>
</defs>
</svg>
class ComplaintListResponse {
String? error;
List<ComplaintList>? complaintList;
String? message;
ComplaintListResponse({this.error, this.complaintList, this.message});
ComplaintListResponse.fromJson(Map<String, dynamic> json) {
error = json['error'];
if (json['complaint_list'] != null) {
complaintList = <ComplaintList>[];
json['complaint_list'].forEach((v) {
complaintList!.add(new ComplaintList.fromJson(v));
});
}
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['error'] = this.error;
if (this.complaintList != null) {
data['complaint_list'] =
this.complaintList!.map((v) => v.toJson()).toList();
}
data['message'] = this.message;
return data;
}
}
class ComplaintList {
String? id;
String? openStatus;
String? modelName;
String? registredDate;
String? hashId;
String? productName;
String? complaintName;
ComplaintList(
{this.id,
this.openStatus,
this.modelName,
this.registredDate,
this.hashId,
this.productName,
this.complaintName});
ComplaintList.fromJson(Map<String, dynamic> json) {
id = json['id'];
openStatus = json['open_status'];
modelName = json['model_name'];
registredDate = json['registred_date'];
hashId = json['hash_id'];
productName = json['product_name'];
complaintName = json['complaint_name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['open_status'] = this.openStatus;
data['model_name'] = this.modelName;
data['registred_date'] = this.registredDate;
data['hash_id'] = this.hashId;
data['product_name'] = this.productName;
data['complaint_name'] = this.complaintName;
return data;
}
}
class GeneratorListResponse {
String? error;
List<Orders>? orders;
String? message;
GeneratorListResponse({this.error, this.orders, this.message});
GeneratorListResponse.fromJson(Map<String, dynamic> json) {
error = json['error'];
if (json['orders'] != null) {
orders = <Orders>[];
json['orders'].forEach((v) {
orders!.add(new Orders.fromJson(v));
});
}
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['error'] = this.error;
if (this.orders != null) {
data['orders'] = this.orders!.map((v) => v.toJson()).toList();
}
data['message'] = this.message;
return data;
}
}
class Orders {
String? id;
String? hashId;
String? engine;
String? prodName;
String? amc;
String? warranty;
String? productImage;
List<String>? schedule;
Orders(
{this.id,
this.hashId,
this.engine,
this.prodName,
this.amc,
this.warranty,
this.productImage,
this.schedule});
Orders.fromJson(Map<String, dynamic> json) {
id = json['id'];
hashId = json['hash_id'];
engine = json['engine'];
prodName = json['prod_name'];
amc = json['amc'];
warranty = json['warranty'];
productImage = json['productImage'];
schedule = json['schedule'].cast<String>();
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['hash_id'] = this.hashId;
data['engine'] = this.engine;
data['prod_name'] = this.prodName;
data['amc'] = this.amc;
data['warranty'] = this.warranty;
data['productImage'] = this.productImage;
data['schedule'] = this.schedule;
return data;
}
}
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:gen_service/Services/api_calling.dart';
import '../Models/CommonResponse.dart';
import '../Models/HelpAndComplaintModels/ComplaintListResponse.dart';
import '../Models/HelpAndComplaintModels/GeneratorListResponse.dart';
import '../Screens/HelpAndComplaintScreens/DropDownsListResponse.dart';
class HelpAndComplaintProvider extends ChangeNotifier {
bool _isLoading = false;
String? _errorMessage;
ComplaintListResponse? _complaintListResponse;
bool get isLoading => _isLoading;
String? get errorMessage => _errorMessage;
ComplaintListResponse? get complaintListResponse => _complaintListResponse;
GeneratorListResponse? _generatorListResponse;
GeneratorListResponse? get generatorListResponse => _generatorListResponse;
DropDownsListResponse? _dropDownsListResponse;
DropDownsListResponse? get dropDownsListResponse => _dropDownsListResponse;
///----------------------------------------------
/// Fetch Complaints List
///----------------------------------------------
Future<void> fetchComplaintsList({
required String accId,
required String sessionId,
}) async {
_setLoading(true);
try {
final response = await ApiCalling.fetchComplaintsListApi(accId, sessionId);
if (response != null && response.error == "0") {
_complaintListResponse = response;
_errorMessage = null;
} else {
_errorMessage = response?.message ?? "Failed to fetch complaints";
}
} catch (e) {
_errorMessage = "Error fetching complaints: $e";
debugPrint(_errorMessage);
} finally {
_setLoading(false);
}
}
///----------------------------------------------
/// Add Complaint
///----------------------------------------------
Future<CommonResponse?> addComplaint({
required String accId,
required String sessionId,
required String genId,
required String categoryId,
required String descriptionId,
required String note,
required String typeId,
}) async {
_setLoading(true);
try {
final response = await ApiCalling.addComplaintApi(
accId,
sessionId,
genId,
categoryId,
descriptionId,
note,
typeId,
);
if (response != null && response.error == "0") {
// Optionally refresh list after successful submission
await fetchComplaintsList(accId: accId, sessionId: sessionId);
return response;
} else {
_errorMessage = response?.message ?? "Failed to add complaint";
return response;
}
} catch (e) {
_errorMessage = "Error adding complaint: $e";
debugPrint(_errorMessage);
return null;
} finally {
_setLoading(false);
}
}
// NEW FUNCTION: Fetch Generator List for Help Screen
Future<void> fetchGeneratorList({
required String accId,
required String sessionId,
}) async {
_setLoading(true);
try {
final response = await ApiCalling.addGeneratorListApi(accId, sessionId);
if (response != null && response.error == "0") {
_generatorListResponse = response;
_errorMessage = null;
} else {
_errorMessage = response?.message ?? "Failed to fetch generator list";
}
} catch (e) {
_errorMessage = "Error fetching generator list: $e";
debugPrint(_errorMessage);
} finally {
_setLoading(false);
}
}
///----------------------------------------------
/// Fetch Complaint Dropdowns List
///----------------------------------------------
Future<void> fetchComplaintDropdowns({
required String accId,
required String sessionId,
required String genId,
}) async {
_setLoading(true);
try {
final response = await ApiCalling.dropdownsListApi(accId, sessionId, genId);
if (response != null && response.error == "0") {
_dropDownsListResponse = response;
_errorMessage = null;
} else {
_errorMessage = response?.message ?? "Failed to fetch dropdown data";
}
} catch (e) {
_errorMessage = "Error fetching dropdown list: $e";
debugPrint(_errorMessage);
} finally {
_setLoading(false);
}
}
///----------------------------------------------
/// Private Helpers
///----------------------------------------------
void _setLoading(bool value) {
_isLoading = value;
notifyListeners();
}
void clearData() {
_complaintListResponse = null;
_errorMessage = null;
notifyListeners();
}
}
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:gen_service/Notifiers/HelpAndComplaintProvider.dart';
import 'package:gen_service/Utility/CustomSnackbar.dart';
import 'package:provider/provider.dart';
import '../../Utility/AppColors.dart';
import 'package:dropdown_button2/dropdown_button2.dart';
class AddComplaintScreen extends StatefulWidget {
final String accId;
final String sessionId;
final String product;
final String hashId;
final String modolNo;
const AddComplaintScreen({
Key? key,
required this.accId,
required this.sessionId,
required this.product,
required this.hashId,
required this.modolNo,
}) : super(key: key);
@override
State<AddComplaintScreen> createState() => _AddComplaintScreenState();
}
class _AddComplaintScreenState extends State<AddComplaintScreen> {
bool _stretch = true;
@override
void initState() {
super.initState();
Future.microtask(() {
final provider =
Provider.of<HelpAndComplaintProvider>(context, listen: false);
provider.fetchComplaintDropdowns(
accId: widget.accId,
sessionId: widget.sessionId,
genId: widget.hashId
);
});
}
@override
Widget build(BuildContext context) {
final provider = Provider.of<HelpAndComplaintProvider>(context);
final isLoading = provider.isLoading;
final error = provider.errorMessage;
// if (isLoading) {
// return const Scaffold(
// backgroundColor: AppColors.backgroundRegular,
// body: Center(
// child: CircularProgressIndicator(color: AppColors.buttonColor),
// ),
// );
// }
// if (error != null) {
// return Scaffold(
// backgroundColor: AppColors.backgroundRegular,
// body: Center(
// child: Text(
// error,
// style: const TextStyle(color: Colors.red, fontSize: 16),
// ),
// ),
// );
// }
return Scaffold(
backgroundColor: Colors.white,
body: CustomScrollView(
physics: const ClampingScrollPhysics(),
slivers: <Widget>[
/// App bar section
SliverAppBar(
leading: Container(),
stretch: _stretch,
backgroundColor: const Color(0xFF4076FF),
onStretchTrigger: () async {},
stretchTriggerOffset: 300.0,
flexibleSpace: FlexibleSpaceBar(
stretchModes: const [
StretchMode.zoomBackground,
StretchMode.blurBackground,
],
background: Container(
decoration: const BoxDecoration(color: AppColors.primary),
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
InkResponse(
onTap: () => Navigator.pop(context, true),
child: SvgPicture.asset(
"assets/svg/continue_left_ic.svg",
height: 30,
color: Colors.white,
),
),
const SizedBox(width: 10),
const Text(
"Help?",
style: TextStyle(
fontSize: 16,
fontFamily: "Poppins",
fontWeight: FontWeight.w400,
color: Colors.white,
),
),
],
),
),
),
),
),
/// Main content
SliverToBoxAdapter(
child: Container(
color: AppColors.primary,
child: Container(
padding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 20),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
topRight: Radius.circular(30),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Padding(
padding: EdgeInsets.all(10.0),
child: Text(
"Raise Complaint",
style: TextStyle(
fontSize: 16,
fontFamily: "PoppinsMedium",
fontWeight: FontWeight.w500,
color: Colors.black87,
),
),
),
const SizedBox(height: 2),
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
flex: 6,
child: Text(
widget.product,
maxLines: 2,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
color: AppColors.amountText,
),
),
),
const SizedBox(width: 2),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 18, vertical: 8),
decoration: BoxDecoration(
color: AppColors.stripSky,
borderRadius: BorderRadius.circular(12),
),
child: Text(
"#${widget.hashId} | ${widget.modolNo}",
style: const TextStyle(
fontSize: 13,
fontWeight: FontWeight.w400,
color: Colors.black87,
),
),
),
],
),
const Divider()
],
),
),
const SizedBox(height: 10),
_ComplaintForm(
accId: widget.accId,
sessionId: widget.sessionId,
genId: widget.hashId,
),
],
),
),
),
),
],
),
);
}
}
class _ComplaintForm extends StatefulWidget {
final String accId;
final String sessionId;
final String genId;
const _ComplaintForm({
Key? key,
required this.accId,
required this.sessionId,
required this.genId,
}) : super(key: key);
@override
State<_ComplaintForm> createState() => _ComplaintFormState();
}
class _ComplaintFormState extends State<_ComplaintForm> {
String? _selectedCategory;
String? _selectedDescription;
final TextEditingController _noteController = TextEditingController();
String? _categoryError;
String? _descriptionError;
String? _noteError;
@override
void initState() {
super.initState();
_noteController.addListener(() {
if (_noteController.text.isNotEmpty && _noteError != null) {
setState(() => _noteError = null);
}
});
}
@override
Widget build(BuildContext context) {
final provider = Provider.of<HelpAndComplaintProvider>(context);
final dropdownData = provider.dropDownsListResponse;
final categories = dropdownData?.categories ?? [];
final descriptions = dropdownData?.descriptions ?? [];
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
"Category",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
color: Colors.black87,
),
),
const SizedBox(height: 6),
Container(
decoration: BoxDecoration(
color: AppColors.fieldsGrey,
borderRadius: BorderRadius.circular(8),
),
child: DropdownButtonHideUnderline(
child: DropdownButton2<String>(
isExpanded: true,
value: _selectedCategory,
hint: const Padding(
padding: EdgeInsets.symmetric(horizontal: 12),
child: Text(
"Select Complaint Category",
style: TextStyle(
fontSize: 14,
color: Colors.grey,
),
),
),
items: categories
.map((cat) => DropdownMenuItem<String>(
value: cat.id,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Text(
cat.name ?? "",
style: TextStyle(fontSize: 14, color: AppColors.normalText,),
overflow: TextOverflow.ellipsis,
),
),
))
.toList(),
onChanged: (value) {
setState(() {
_selectedCategory = value;
_categoryError = null;
});
},
buttonStyleData: ButtonStyleData(
height: 48,
width: double.infinity,
padding: const EdgeInsets.symmetric(horizontal: 12),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: AppColors.fieldsGrey,
),
),
dropdownStyleData: DropdownStyleData(
maxHeight: 200,
width: MediaQuery.of(context).size.width - 40, // Match field width
padding: const EdgeInsets.symmetric(vertical: 8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.1),
blurRadius: 8,
offset: const Offset(0, 4),
),
],
),
elevation: 8,
offset: const Offset(0, -8),
),
menuItemStyleData: const MenuItemStyleData(
height: 40,
padding: EdgeInsets.symmetric(horizontal: 12),
),
iconStyleData: const IconStyleData(
icon: Icon(Icons.arrow_drop_down),
iconSize: 24,
),
),
),
),
if (_categoryError != null) ...[
const SizedBox(height: 4),
Text(
_categoryError!,
style: const TextStyle(
color: Colors.red,
fontSize: 12,
),
),
],
const SizedBox(height: 16),
const Text(
"Description",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
color: Colors.black87,
),
),
const SizedBox(height: 6),
Container(
decoration: BoxDecoration(
color: AppColors.fieldsGrey,
borderRadius: BorderRadius.circular(8),
),
child: DropdownButtonHideUnderline(
child: DropdownButton2<String>(
isExpanded: true,
value: _selectedDescription,
hint: const Padding(
padding: EdgeInsets.symmetric(horizontal: 12),
child: Text(
"Select Complaint Description",
style: TextStyle(
fontSize: 14,
color: Colors.grey,
),
),
),
items: descriptions
.map((desc) => DropdownMenuItem<String>(
value: desc.id,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Text(
desc.name ?? "",
style: TextStyle(fontSize: 14, color: AppColors.normalText,),
overflow: TextOverflow.ellipsis,
),
),
))
.toList(),
onChanged: (value) {
setState(() {
_selectedDescription = value;
_descriptionError = null;
});
},
buttonStyleData: ButtonStyleData(
height: 48,
width: double.infinity,
padding: const EdgeInsets.symmetric(horizontal: 12),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: AppColors.fieldsGrey,
),
),
dropdownStyleData: DropdownStyleData(
maxHeight: 200,
width: MediaQuery.of(context).size.width - 40, // Match field width
padding: const EdgeInsets.symmetric(vertical: 8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.1),
blurRadius: 8,
offset: const Offset(0, 4),
),
],
),
elevation: 8,
offset: const Offset(0, -8),
),
menuItemStyleData: const MenuItemStyleData(
height: 40,
padding: EdgeInsets.symmetric(horizontal: 12),
),
iconStyleData: const IconStyleData(
icon: Icon(Icons.arrow_drop_down),
iconSize: 24,
),
),
),
),
if (_descriptionError != null) ...[
const SizedBox(height: 4),
Text(
_descriptionError!,
style: const TextStyle(
color: Colors.red,
fontSize: 12,
),
),
],
const SizedBox(height: 16),
const Text(
"Note",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
color: Colors.black87,
),
),
const SizedBox(height: 6),
TextFormField(
controller: _noteController,
maxLines: 5,
style: TextStyle(fontSize: 14, color: AppColors.normalText,),
decoration: InputDecoration(
hintText: "Write a note...",
filled: true,
fillColor: AppColors.fieldsGrey,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
borderSide: BorderSide.none,
),
errorText: _noteError,
hintStyle: TextStyle(fontSize: 14, color: Colors.grey,),
contentPadding:
const EdgeInsets.symmetric(horizontal: 12, vertical: 14),
),
),
const SizedBox(height: 30),
SizedBox(
width: double.infinity,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.buttonColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
padding: const EdgeInsets.symmetric(vertical: 14),
),
onPressed: () async {
_validateAndSubmit(context);
},
child: const Text(
"Raise Complaint",
style: TextStyle(
fontFamily: "PoppinsMedium",
color: Colors.white,
fontSize: 14,
),
),
),
),
],
);
}
Future<void> _validateAndSubmit(BuildContext context) async {
setState(() {
_categoryError = _selectedCategory == null ? "Please select a category" : null;
_descriptionError = _selectedDescription == null ? "Please select a description" : null;
_noteError = _noteController.text.trim().isEmpty ? "Please enter a note" : null;
});
if (_categoryError != null || _descriptionError != null || _noteError != null) {
return;
}
try {
final provider = Provider.of<HelpAndComplaintProvider>(context, listen: false);
final res = await provider.addComplaint(
accId: widget.accId,
sessionId: widget.sessionId,
genId: widget.genId,
categoryId: _selectedCategory!,
descriptionId: _selectedDescription!,
note: _noteController.text.trim(),
typeId: provider.dropDownsListResponse?.typeId ?? "2",
);
if (!mounted) return;
// Fixed comparison to handle both String and int
if (res != null && (res.error == "0" || res.error == 0)) {
_showSuccessDialog(context);
} else {
CustomSnackBar.showError(
context: context,
message: res?.message ?? "Failed to raise complaint",
);
}
} catch (e) {
debugPrint("❌ Exception during complaint submission: $e");
if (mounted) {
CustomSnackBar.showError(
context: context,
message: "An error occurred while submitting complaint",
);
}
}
}
// success_gif.gif
void _showSuccessDialog(BuildContext context) {
// Check if context is still valid and mounted
if (!mounted) return;
showDialog(
context: context,
barrierDismissible: false,
builder: (ctx) => Dialog(
backgroundColor: Colors.transparent,
child: Container(
width: MediaQuery.of(context).size.width * 0.8,
padding: const EdgeInsets.all(24),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: double.infinity,
height: 140,
color: Colors.white,
child: Image.asset(
'assets/images/success_gif.gif',
height: 80,
width: 80,
),
),
const Text(
"Submitted",
style: TextStyle(
fontSize: 18,
fontFamily: "Poppins",
fontWeight: FontWeight.w600,
color: Colors.black,
),
),
const SizedBox(height: 16),
Text(
"Thanks for reaching out!",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12,
fontFamily: "Poppins",
fontWeight: FontWeight.w400,
color: AppColors.subtitleText,
),
),
const Text(
"Our team will reach out to you shortly.",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,
fontFamily: "Poppins",
fontWeight: FontWeight.w400,
color: Colors.black87,
),
),
const SizedBox(height: 24),
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: () {
Navigator.pop(ctx); // Close dialog
if (mounted) {
Navigator.pop(context, true); // Close form screen
}
},
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.buttonColor,
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 12),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(28),
),
),
child: const Text(
"Close",
style: TextStyle(
fontFamily: "Poppins",
fontSize: 15,
fontWeight: FontWeight.w400,
),
),
),
),
],
),
),
),
);
}
}
\ No newline at end of file
class DropDownsListResponse {
String? error;
GenDetails? genDetails;
String? typeId;
List<Categories>? categories;
List<Descriptions>? descriptions;
String? message;
DropDownsListResponse({
this.error,
this.genDetails,
this.typeId,
this.categories,
this.descriptions,
this.message,
});
DropDownsListResponse.fromJson(Map<String, dynamic> json) {
error = json['error']?.toString();
genDetails = json['gen_details'] != null
? GenDetails.fromJson(json['gen_details'])
: null;
typeId = json['type_id']?.toString();
if (json['categories'] != null) {
categories = List<Categories>.from(
json['categories'].map((v) => Categories.fromJson(v)));
}
if (json['descriptions'] != null) {
descriptions = List<Descriptions>.from(
json['descriptions'].map((v) => Descriptions.fromJson(v)));
}
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = {};
data['error'] = error;
if (genDetails != null) {
data['gen_details'] = genDetails!.toJson();
}
data['type_id'] = typeId;
if (categories != null) {
data['categories'] = categories!.map((v) => v.toJson()).toList();
}
if (descriptions != null) {
data['descriptions'] = descriptions!.map((v) => v.toJson()).toList();
}
data['message'] = message;
return data;
}
}
class GenDetails {
String? id;
String? hashId;
String? prodName;
String? modelName;
String? amc;
String? warranty;
GenDetails({
this.id,
this.hashId,
this.prodName,
this.modelName,
this.amc,
this.warranty,
});
GenDetails.fromJson(Map<String, dynamic> json) {
id = json['id']?.toString();
hashId = json['hash_id']?.toString();
prodName = json['prod_name'];
modelName = json['model_name'];
amc = json['amc']?.toString();
warranty = json['warranty']?.toString();
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = {};
data['id'] = id;
data['hash_id'] = hashId;
data['prod_name'] = prodName;
data['model_name'] = modelName;
data['amc'] = amc;
data['warranty'] = warranty;
return data;
}
}
class Categories {
String? id;
String? name;
Categories({this.id, this.name});
Categories.fromJson(Map<String, dynamic> json) {
id = json['id']?.toString();
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = {};
data['id'] = id;
data['name'] = name;
return data;
}
}
class Descriptions {
String? id;
String? name;
Descriptions({this.id, this.name});
Descriptions.fromJson(Map<String, dynamic> json) {
id = json['id']?.toString();
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = {};
data['id'] = id;
data['name'] = name;
return data;
}
}
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:gen_service/Notifiers/HelpAndComplaintProvider.dart';
import 'package:gen_service/Screens/HelpAndComplaintScreens/AddComplaintScreen.dart';
import 'package:provider/provider.dart';
import '../../Utility/AppColors.dart';
class SelectOrderHelpScreen extends StatefulWidget {
final String accId;
final String sessionId;
const SelectOrderHelpScreen({
Key? key,
required this.accId,
required this.sessionId,
}) : super(key: key);
@override
State<SelectOrderHelpScreen> createState() => _SelectOrderHelpScreenState();
}
class _SelectOrderHelpScreenState extends State<SelectOrderHelpScreen> {
bool _stretch = true;
@override
void initState() {
super.initState();
Future.microtask(() {
final provider = Provider.of<HelpAndComplaintProvider>(context, listen: false);
provider.fetchGeneratorList(
accId: widget.accId,
sessionId: widget.sessionId,
);
});
}
@override
Widget build(BuildContext context) {
final provider = Provider.of<HelpAndComplaintProvider>(context);
final isLoading = provider.isLoading;
final error = provider.errorMessage;
final generatorData = provider.generatorListResponse;
if (isLoading) {
return const Scaffold(
backgroundColor: AppColors.backgroundRegular,
body: Center(
child: CircularProgressIndicator(color: AppColors.buttonColor),
),
);
}
if (error != null) {
return Scaffold(
backgroundColor: AppColors.backgroundRegular,
body: Center(
child: Text(
error,
style: const TextStyle(color: Colors.red, fontSize: 16),
),
),
);
}
if (generatorData == null || generatorData.orders == null || generatorData.orders!.isEmpty) {
return const Scaffold(
backgroundColor: AppColors.backgroundRegular,
body: Center(
child: Text("No Generators Found."),
),
);
}
final genList = generatorData.orders!;
return RefreshIndicator.adaptive(
color: AppColors.amountText,
onRefresh: () async {
await provider.fetchGeneratorList(
accId: widget.accId,
sessionId: widget.sessionId,
);
},
child: Scaffold(
backgroundColor: AppColors.backgroundRegular,
body: CustomScrollView(
physics: const ClampingScrollPhysics(),
slivers: <Widget>[
/// App bar section
SliverAppBar(
leading: Container(),
stretch: _stretch,
backgroundColor: const Color(0xFF4076FF),
onStretchTrigger: () async {
await provider.fetchGeneratorList(
accId: widget.accId,
sessionId: widget.sessionId,
);
},
stretchTriggerOffset: 300.0,
flexibleSpace: FlexibleSpaceBar(
stretchModes: const [
StretchMode.zoomBackground,
StretchMode.blurBackground,
],
background: Container(
decoration: const BoxDecoration(color: AppColors.primary),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
InkResponse(
onTap: () => Navigator.pop(context, true),
child: SvgPicture.asset(
"assets/svg/continue_left_ic.svg",
height: 30,
color: Colors.white,
),
),
const SizedBox(width: 10),
const Text(
"Help?",
style: TextStyle(
fontSize: 16,
fontFamily: "Poppins",
fontWeight: FontWeight.w400,
color: Colors.white,
),
),
],
),
),
),
),
),
/// Main content
SliverToBoxAdapter(
child: Container(
color: AppColors.primary,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 20),
decoration: const BoxDecoration(
color: AppColors.backgroundRegular,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
topRight: Radius.circular(30),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(10.0),
child: const Text(
"Select the Generator you are\n having issues with",
style: TextStyle(
fontSize: 16,
fontFamily: "PoppinsMedium",
fontWeight: FontWeight.w500,
color: Colors.black87,
),
),
),
const SizedBox(height: 16),
/// 🧾 Generator List from Provider
...genList.map((order) {
return Column(
children: [
InkResponse(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => AddComplaintScreen(
accId: widget.accId,
sessionId: widget.sessionId,
product: order.prodName.toString(),
hashId: order.hashId.toString(),
modolNo: order.engine.toString())
)
).then((_) async {
await provider.fetchGeneratorList(
accId: widget.accId,
sessionId: widget.sessionId,
);
});
},
child: _buildOrderItem(
assetId: "#${order.hashId ?? ''} | Engine : ${order.engine ?? ''}",
description: order.prodName ?? '',
amc: order.amc ?? '',
warranty: order.warranty ?? '',
pImage: order.productImage ?? '',
date: order.schedule?.isNotEmpty == true
? order.schedule!.first
: null,
serviceText: order.schedule?.isNotEmpty == true
? 'Upcoming Service Scheduled'
: null,
),
),
const SizedBox(height: 12),
],
);
}).toList(),
],
),
),
),
),
],
),
),
);
}
/// 🔹 Reusable generator list tile
Widget _buildOrderItem({
required String assetId,
required String description,
required String amc,
required String warranty,
required String pImage,
String? date,
String? serviceText,
}) {
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
/// Row with details and image
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
/// Text Info
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
assetId,
style: const TextStyle(
fontSize: 12,
fontWeight: FontWeight.w400,
color: AppColors.amountText,
),
),
const SizedBox(height: 4),
Text(
description,
style: const TextStyle(
fontSize: 14,
color: AppColors.normalText,
height: 1.4,
),
),
const SizedBox(height: 8),
/// AMC & Warranty tags
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
if (amc == "1" || amc == "2")
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
gradient: amc == "1"
? AppColors.greenStripGradient
: AppColors.fadeGradient,
borderRadius: BorderRadius.circular(12),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
SvgPicture.asset(
"assets/svg/tick_ic.svg",
height: 14,
color: amc == "1"
? AppColors.greenICBg
: AppColors.subtitleText,
),
const SizedBox(width: 4),
Text(
"AMC Protected",
style: TextStyle(
fontSize: 11,
fontFamily: "PoppinsBold",
fontStyle: FontStyle.italic,
fontWeight: FontWeight.w700,
color: amc == "1"
? AppColors.greenICBg
: AppColors.subtitleText,
),
),
],
),
),
if (warranty == "1" || warranty == "2")
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
gradient: warranty == "1"
? AppColors.yellowStripGradient
: AppColors.fadeGradient,
borderRadius: BorderRadius.circular(12),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
SvgPicture.asset(
"assets/svg/tick2_ic.svg",
height: 14,
color: warranty == "1"
? AppColors.warning
: AppColors.subtitleText,
),
const SizedBox(width: 4),
Text(
"Warranty",
style: TextStyle(
fontSize: 11,
fontFamily: "PoppinsBold",
fontStyle: FontStyle.italic,
fontWeight: FontWeight.w700,
color: warranty == "1"
? AppColors.normalText
: AppColors.subtitleText,
),
),
],
),
),
],
),
],
),
),
/// Product Image
const SizedBox(width: 12),
Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: const Color(0xffF2F2F2),
borderRadius: BorderRadius.circular(12),
),
child: Image.network(
pImage.isNotEmpty
? pImage
: "https://erp.gengroup.in/assets/upload/inventory_add_genesis_product_pic/_1761047459_6425.png",
height: 50,
width: 50,
fit: BoxFit.contain,
errorBuilder: (context, error, stack) => Image.asset(
'assets/images/dashboard_gen.png',
height: 40,
width: 40,
),
),
),
],
),
/// Service info (optional)
if (date != null && serviceText != null) ...[
const SizedBox(height: 12),
Container(
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
decoration: BoxDecoration(
color: const Color(0xffF2F2F2),
borderRadius: BorderRadius.circular(16),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SvgPicture.asset(
"assets/svg/checked_ic.svg",
height: 30,
fit: BoxFit.contain,
),
const SizedBox(width: 10),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
date,
style: const TextStyle(
fontSize: 12,
color: AppColors.normalText,
fontWeight: FontWeight.w500,
),
),
Text(
serviceText,
style: const TextStyle(
fontSize: 12,
color: AppColors.subtitleText,
fontWeight: FontWeight.w500,
),
),
],
),
],
),
),
],
],
),
);
}
}
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:gen_service/Screens/HelpAndComplaintScreens/SelectOrderHelpScreen.dart';
import 'package:gen_service/Screens/ProfileScreen.dart'; import 'package:gen_service/Screens/ProfileScreen.dart';
import 'package:gen_service/Screens/TransactionListScreen.dart'; import 'package:gen_service/Screens/TransactionListScreen.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
...@@ -95,7 +96,7 @@ class _HomeScreenState extends State<HomeScreen> { ...@@ -95,7 +96,7 @@ class _HomeScreenState extends State<HomeScreen> {
dashboardProvider.fetchDashboard(widget.accId, widget.sessionId); dashboardProvider.fetchDashboard(widget.accId, widget.sessionId);
}, },
stretchTriggerOffset: 300.0, stretchTriggerOffset: 300.0,
expandedHeight: 270.0, expandedHeight: 232.0,
flexibleSpace: LayoutBuilder( flexibleSpace: LayoutBuilder(
builder: (context, constraints) { builder: (context, constraints) {
final top = constraints.biggest.height; final top = constraints.biggest.height;
...@@ -122,7 +123,7 @@ class _HomeScreenState extends State<HomeScreen> { ...@@ -122,7 +123,7 @@ class _HomeScreenState extends State<HomeScreen> {
child: SafeArea( child: SafeArea(
bottom: false, bottom: false,
child: Padding( child: Padding(
padding: const EdgeInsets.only(top: 60, bottom: 60, left: 20, right: 20), padding: const EdgeInsets.only(top: 10, bottom: 12, left: 20, right: 20),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
...@@ -141,8 +142,15 @@ class _HomeScreenState extends State<HomeScreen> { ...@@ -141,8 +142,15 @@ class _HomeScreenState extends State<HomeScreen> {
data.userProfile.toString(), data.userProfile.toString(),
fit: BoxFit.cover, fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) => errorBuilder: (context, error, stackTrace) =>
const Icon(Icons.person, CircleAvatar(
color: Color(0xFF2d2d2d), size: 40), radius: 40,
backgroundColor: const Color(0xFFE0F4FF),
child: SvgPicture.asset(
height: 40,
"assets/svg/person_ic.svg",
fit: BoxFit.contain,
),
),
) )
: CircleAvatar( : CircleAvatar(
radius: 40, radius: 40,
...@@ -223,38 +231,46 @@ class _HomeScreenState extends State<HomeScreen> { ...@@ -223,38 +231,46 @@ class _HomeScreenState extends State<HomeScreen> {
const SizedBox(height: 20), const SizedBox(height: 20),
Padding( InkResponse(
padding: const EdgeInsets.symmetric(horizontal: 14), onTap: () {
child: Container( Navigator.push(
padding: const EdgeInsets.all(20), context,
decoration: BoxDecoration( MaterialPageRoute(builder: (context) => SelectOrderHelpScreen(accId: widget.accId, sessionId: widget.sessionId))
color: const Color(0xFFD7F0FF), );
borderRadius: BorderRadius.circular(16), },
border: Border.all(width: 1.5, color: AppColors.buttonColor), child: Padding(
), padding: const EdgeInsets.symmetric(horizontal: 14),
child: Row( child: Container(
mainAxisAlignment: MainAxisAlignment.spaceBetween, padding: const EdgeInsets.all(20),
children: [ decoration: BoxDecoration(
Column( color: const Color(0xFFD7F0FF),
crossAxisAlignment: CrossAxisAlignment.start, borderRadius: BorderRadius.circular(16),
children: const [ border: Border.all(width: 1.5, color: AppColors.buttonColor),
Text('Facing Issues?', ),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
Text('Facing Issues?',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: AppColors.amountText)),
Text(
'Raise a ticket to resolve your issues.',
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 12,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w400,
color: AppColors.amountText)), color: AppColors.subtitleText),
Text( ),
'Raise a ticket to resolve your issues.', ],
style: TextStyle( ),
fontSize: 12, SvgPicture.asset("assets/svg/requirements.svg",
fontWeight: FontWeight.w400, height: 32, width: 32),
color: AppColors.subtitleText), ],
), ),
],
),
SvgPicture.asset("assets/svg/requirements.svg",
height: 32, width: 32),
],
), ),
), ),
), ),
...@@ -749,12 +765,19 @@ class _HomeScreenState extends State<HomeScreen> { ...@@ -749,12 +765,19 @@ class _HomeScreenState extends State<HomeScreen> {
color: Colors.black87, color: Colors.black87,
), ),
), ),
Text( InkResponse(
'See All', onTap: () {
style: TextStyle( Navigator.push(
fontSize: 14, context, MaterialPageRoute(builder: (context) => ComplaintListScreen(accId: widget.accId, sessionId: widget.sessionId))
fontWeight: FontWeight.w500, );
color: AppColors.amountText, },
child: const Text(
'See All',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: AppColors.amountText,
),
), ),
), ),
], ],
...@@ -837,12 +860,15 @@ class _HomeScreenState extends State<HomeScreen> { ...@@ -837,12 +860,15 @@ class _HomeScreenState extends State<HomeScreen> {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
// Product details // Product details
Text( Expanded(
c.productName ?? "Unknown Product", flex: 5,
style: const TextStyle( child: Text(
fontSize: 14, c.productName ?? "Unknown Product",
fontWeight: FontWeight.w500, style: const TextStyle(
color: AppColors.normalText, fontSize: 14,
fontWeight: FontWeight.w500,
color: AppColors.normalText,
),
), ),
), ),
// Product ID // Product ID
......
...@@ -13,6 +13,13 @@ const dashboardUrl = "${baseUrl}dashboard"; ...@@ -13,6 +13,13 @@ const dashboardUrl = "${baseUrl}dashboard";
const logoutUrl = "${baseUrl2}Rental_Auth/logout"; const logoutUrl = "${baseUrl2}Rental_Auth/logout";
const profileDetailsUrl = "${baseUrl2}Rental_Home/profile_details"; const profileDetailsUrl = "${baseUrl2}Rental_Home/profile_details";
/// transaction and payments
const transactionsUrl = "${baseUrl}all_transactions"; const transactionsUrl = "${baseUrl}all_transactions";
const paymentDetailUrl = "${baseUrl}payment_details"; const paymentDetailUrl = "${baseUrl}payment_details";
const billDetailUrl = "${baseUrl}bill_details"; const billDetailUrl = "${baseUrl}bill_details";
\ No newline at end of file
/// Help and complaints
const complaintListUrl = "${baseUrl}all_complaint_list";
const addComplaintUrl = "${baseUrl}add_complaint";
const generatorListUrl = "${baseUrl}generator_list";
const complaintDropdownsUrl = "${baseUrl}complaint_dropdowns";
\ No newline at end of file
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gen_service/Models/HelpAndComplaintModels/ComplaintListResponse.dart';
import 'package:gen_service/Models/TransactionModels/BillDetailResponse.dart'; import 'package:gen_service/Models/TransactionModels/BillDetailResponse.dart';
import 'package:gen_service/Models/TransactionModels/PaymentDetailResponse.dart'; import 'package:gen_service/Models/TransactionModels/PaymentDetailResponse.dart';
import '../Models/AuthResponse.dart'; import '../Models/AuthResponse.dart';
import '../Models/CommonResponse.dart'; import '../Models/CommonResponse.dart';
import '../Models/DashboardResponse.dart'; import '../Models/DashboardResponse.dart';
import '../Models/HelpAndComplaintModels/GeneratorListResponse.dart';
import '../Models/TransactionModels/TransactionListResponse.dart'; import '../Models/TransactionModels/TransactionListResponse.dart';
import '../Screens/HelpAndComplaintScreens/DropDownsListResponse.dart';
import 'api_URLs.dart'; import 'api_URLs.dart';
import 'api_post_request.dart'; import 'api_post_request.dart';
import 'package:http/http.dart' as http show MultipartFile; import 'package:http/http.dart' as http show MultipartFile;
...@@ -111,8 +114,8 @@ class ApiCalling { ...@@ -111,8 +114,8 @@ class ApiCalling {
} }
} }
//___________________________________Transaction and payments
/// fetch Dashboard Api /// fetch Transaction Api
static Future<TransactionListResponse?> fetchTransactionListApi( static Future<TransactionListResponse?> fetchTransactionListApi(
String accId, String accId,
String sessionId, String sessionId,
...@@ -198,6 +201,121 @@ class ApiCalling { ...@@ -198,6 +201,121 @@ class ApiCalling {
} }
} }
//___________________________________Help and Complaints
/// fetch Bill Details Api
static Future<ComplaintListResponse?> fetchComplaintsListApi(
String accId,
String sessionId,
) async {
debugPrint("###############################Transaction Api calling ");
try {
Map<String, String> data = {
"acc_id": accId,
"session_id": sessionId,
};
final res = await post(data, complaintListUrl, {});
debugPrint("Transaction response: ${res?.body}");
if (res != null) {
return ComplaintListResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
return null;
}
} catch (e) {
debugPrint("❌ Complaint list API Error: $e");
return null;
}
}
/// add Complaints Api
static Future<CommonResponse?> addComplaintApi(
String accId,
String sessionId,
String genId,
String categoryId,
String descriptionId,
String note,
String typeId,
) async {
debugPrint("############################### Api calling ");
try {
Map<String, String> data = {
"acc_id": accId,
"session_id": sessionId,
"gen_id": genId,
"category_id": categoryId,
"description_id": descriptionId,
"note": note,
"type_id": typeId,
};
final res = await post(data, addComplaintUrl, {});
if (res != null) {
return CommonResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
return null;
}
} catch (e) {
debugPrint("❌ Add Complaint API Error: $e");
return null;
}
}
/// Generator list help Api calling
static Future<GeneratorListResponse?> addGeneratorListApi(
String accId,
String sessionId,
) async {
debugPrint("############################### Api calling ");
try {
Map<String, String> data = {
"acc_id": accId,
"session_id": sessionId,
};
final res = await post(data, generatorListUrl, {});
if (res != null) {
return GeneratorListResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
return null;
}
} catch (e) {
debugPrint("❌ Generator list API Error: $e");
return null;
}
}
/// Add complain dropdowns list
static Future<DropDownsListResponse?> dropdownsListApi(
String accId,
String sessionId,
String genId,
) async {
debugPrint("############################### Api calling ");
try {
Map<String, String> data = {
"acc_id": accId,
"session_id": sessionId,
"gen_id": genId,
};
final res = await post(data, complaintDropdownsUrl, {});
if (res != null) {
return DropDownsListResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
return null;
}
} catch (e) {
debugPrint("❌ Complaint dropdown list API Error: $e");
return null;
}
}
// //
// /// pay_amount // /// pay_amount
// static Future<PayAmountResponse?> payAmountApi( // static Future<PayAmountResponse?> payAmountApi(
......
...@@ -5,7 +5,7 @@ import 'package:flutter/cupertino.dart'; ...@@ -5,7 +5,7 @@ import 'package:flutter/cupertino.dart';
class AppColors { class AppColors {
// Primary colors from genrentals.in // Primary colors from genrentals.in
static const Color primary = Color(0xFF008CDE); static const Color primary = Color(0xFF00BBDB);
static const Color secondary = Color(0xFFF3F4F6); static const Color secondary = Color(0xFFF3F4F6);
static const Color accent = Color(0xFFF59E0B); static const Color accent = Color(0xFFF59E0B);
...@@ -28,11 +28,13 @@ class AppColors { ...@@ -28,11 +28,13 @@ class AppColors {
// Status background colors // Status background colors
static const Color successBG = Color(0xFFDCFCE7); static const Color successBG = Color(0xFFDCFCE7);
static const Color greenICBg = Color(0xFF4CAF50); static const Color greenICBg = Color(0xFF4CAF50);
static const Color yellowBG = Color(0xFFFFF8D2);
static const Color warningBg = Color(0xFFFF8940); static const Color warningBg = Color(0xFFFF8940);
static const Color warningBg2 = Color(0xFFFFE5E5); static const Color warningBg2 = Color(0xFFFFE5E5);
static const Color errorBg = Color(0xFFDB0000); static const Color errorBg = Color(0xFFDB0000);
static const Color stripSky = Color(0xFFD9F1FF); static const Color stripSky = Color(0xFFD9F1FF);
static const Color stripGrey = Color(0xFFE0E0E0); static const Color stripGrey = Color(0xFFE0E0E0);
static const Color fieldsGrey = Color(0xFFF6F6F8);
// Neutral colors // Neutral colors
static const Color dark = Color(0xFF1F2937); static const Color dark = Color(0xFF1F2937);
......
...@@ -4,6 +4,7 @@ import 'package:gen_service/Notifiers/TransactionsProvider.dart'; ...@@ -4,6 +4,7 @@ import 'package:gen_service/Notifiers/TransactionsProvider.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'Notifiers/DashboardProvider.dart'; import 'Notifiers/DashboardProvider.dart';
import 'Notifiers/HelpAndComplaintProvider.dart';
import 'Notifiers/theme_provider.dart'; import 'Notifiers/theme_provider.dart';
import 'Screens/AuthScreen/LoginScreen.dart'; import 'Screens/AuthScreen/LoginScreen.dart';
import 'Screens/SplashScreen.dart'; import 'Screens/SplashScreen.dart';
...@@ -23,6 +24,7 @@ class MyApp extends StatelessWidget { ...@@ -23,6 +24,7 @@ class MyApp extends StatelessWidget {
ChangeNotifierProvider<ThemeProvider>(create: (_) => ThemeProvider(),), ChangeNotifierProvider<ThemeProvider>(create: (_) => ThemeProvider(),),
ChangeNotifierProvider(create: (_) => DashboardProvider()), ChangeNotifierProvider(create: (_) => DashboardProvider()),
ChangeNotifierProvider(create: (_) => TransactionsProvider()), ChangeNotifierProvider(create: (_) => TransactionsProvider()),
ChangeNotifierProvider(create: (_) => HelpAndComplaintProvider()),
], ],
child: Consumer<ThemeProvider>( child: Consumer<ThemeProvider>(
......
...@@ -113,6 +113,14 @@ packages: ...@@ -113,6 +113,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "7.0.3" version: "7.0.3"
dropdown_button2:
dependency: "direct main"
description:
name: dropdown_button2
sha256: b0fe8d49a030315e9eef6c7ac84ca964250155a6224d491c1365061bc974a9e1
url: "https://pub.dev"
source: hosted
version: "2.3.9"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
......
...@@ -44,6 +44,7 @@ dependencies: ...@@ -44,6 +44,7 @@ dependencies:
photo_view: ^0.15.0 photo_view: ^0.15.0
android_id: ^0.4.0 android_id: ^0.4.0
device_info_plus: ^12.2.0 device_info_plus: ^12.2.0
dropdown_button2: ^2.3.9
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment