Commit 2c0d16b2 authored by Sai Srinivas's avatar Sai Srinivas
Browse files

23-06-2025 By Sai Srinivas

Prospect details - add/edit, edit order - order module
parent fd66d000
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="Transfer">
<g fill="none" fill-rule="evenodd">
<g fill="#42b9f4" transform="translate(3 2)" class="color4285f4 svgShape">
<path d="M11,3 L11,0.5 L18,5 L11,9.5 L11,7 L2.11497,7 C1.56269,7 1.11497,6.55228 1.11497,6 L1.11497,4 C1.11497,3.44772 1.56269,3 2.11497,3 L11,3 Z M7,10.5 L7,13 L15.8315,13 C16.3838,13 16.8315,13.4477 16.8315,14 L16.8315,16 C16.8315,16.5523 16.3838,17 15.8315,17 L7,17 L7,19.5 L0,15 L7,10.5 Z" fill="#023047" class="color000000 svgShape"></path>
</g>
</g>
</svg>
class crmProspectDetailsAddFollowUpAppointmentResponse {
String? redirectTo;
String? error;
String? message;
crmProspectDetailsAddFollowUpAppointmentResponse(
{this.redirectTo, this.error, this.message});
crmProspectDetailsAddFollowUpAppointmentResponse.fromJson(
Map<String, dynamic> json) {
redirectTo = json['redirect_to'];
error = json['error'];
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['redirect_to'] = this.redirectTo;
data['error'] = this.error;
data['message'] = this.message;
return data;
}
}
class crmProspectDetailsAddLeadsResponse {
List<Employees>? employees;
List<Products>? products;
List<String>? status;
String? error;
String? message;
crmProspectDetailsAddLeadsResponse(
{this.employees, this.products, this.status, this.error, this.message});
crmProspectDetailsAddLeadsResponse.fromJson(Map<String, dynamic> json) {
if (json['employees'] != null) {
employees = <Employees>[];
json['employees'].forEach((v) {
employees!.add(new Employees.fromJson(v));
});
}
if (json['products'] != null) {
products = <Products>[];
json['products'].forEach((v) {
products!.add(new Products.fromJson(v));
});
}
status = json['status'].cast<String>();
error = json['error'];
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.employees != null) {
data['employees'] = this.employees!.map((v) => v.toJson()).toList();
}
if (this.products != null) {
data['products'] = this.products!.map((v) => v.toJson()).toList();
}
data['status'] = this.status;
data['error'] = this.error;
data['message'] = this.message;
return data;
}
}
class Employees {
String? id;
String? name;
Employees({this.id, this.name});
Employees.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
return data;
}
}
class Products {
String? id;
String? name;
Products({this.id, this.name});
Products.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
return data;
}
}
class crmProspectDetailsEditAccountViewResponse {
List<String>? salutations;
List<States>? states;
String? error;
AccountDetails? accountDetails;
String? message;
crmProspectDetailsEditAccountViewResponse(
{this.salutations,
this.states,
this.error,
this.accountDetails,
this.message});
crmProspectDetailsEditAccountViewResponse.fromJson(
Map<String, dynamic> json) {
salutations = json['salutations'].cast<String>();
if (json['states'] != null) {
states = <States>[];
json['states'].forEach((v) {
states!.add(new States.fromJson(v));
});
}
error = json['error'];
accountDetails = json['account_details'] != null
? new AccountDetails.fromJson(json['account_details'])
: null;
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['salutations'] = this.salutations;
if (this.states != null) {
data['states'] = this.states!.map((v) => v.toJson()).toList();
}
data['error'] = this.error;
if (this.accountDetails != null) {
data['account_details'] = this.accountDetails!.toJson();
}
data['message'] = this.message;
return data;
}
}
class States {
String? id;
String? name;
States({this.id, this.name});
States.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
return data;
}
}
class AccountDetails {
String? id;
String? tempId;
String? ownerId;
String? accManagerId;
String? name;
String? salutationName;
String? subLocality;
String? district;
String? state;
String? pincode;
String? address;
String? date;
String? source;
String? reference;
String? segment;
String? team;
String? gstNumber;
String? isExists;
String? createdDatetime;
String? updatedDatetime;
AccountDetails(
{this.id,
this.tempId,
this.ownerId,
this.accManagerId,
this.name,
this.salutationName,
this.subLocality,
this.district,
this.state,
this.pincode,
this.address,
this.date,
this.source,
this.reference,
this.segment,
this.team,
this.gstNumber,
this.isExists,
this.createdDatetime,
this.updatedDatetime});
AccountDetails.fromJson(Map<String, dynamic> json) {
id = json['id'];
tempId = json['temp_id'];
ownerId = json['owner_id'];
accManagerId = json['acc_manager_id'];
name = json['name'];
salutationName = json['salutation_name'];
subLocality = json['sub_locality'];
district = json['district'];
state = json['state'];
pincode = json['pincode'];
address = json['address'];
date = json['date'];
source = json['source'];
reference = json['reference'];
segment = json['segment'];
team = json['team'];
gstNumber = json['gst_number'];
isExists = json['is_exists'];
createdDatetime = json['created_datetime'];
updatedDatetime = json['updated_datetime'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['temp_id'] = this.tempId;
data['owner_id'] = this.ownerId;
data['acc_manager_id'] = this.accManagerId;
data['name'] = this.name;
data['salutation_name'] = this.salutationName;
data['sub_locality'] = this.subLocality;
data['district'] = this.district;
data['state'] = this.state;
data['pincode'] = this.pincode;
data['address'] = this.address;
data['date'] = this.date;
data['source'] = this.source;
data['reference'] = this.reference;
data['segment'] = this.segment;
data['team'] = this.team;
data['gst_number'] = this.gstNumber;
data['is_exists'] = this.isExists;
data['created_datetime'] = this.createdDatetime;
data['updated_datetime'] = this.updatedDatetime;
return data;
}
}
class crmProspectDetailsResponse {
List<Leads>? leads;
List<Contacts>? contacts;
List<Orders>? orders;
List<Payments>? payments;
String? error;
AccountDetails? accountDetails;
String? message;
crmProspectDetailsResponse(
{this.leads,
this.contacts,
this.orders,
this.payments,
this.error,
this.accountDetails,
this.message});
crmProspectDetailsResponse.fromJson(Map<String, dynamic> json) {
if (json['leads'] != null) {
leads = <Leads>[];
json['leads'].forEach((v) {
leads!.add(new Leads.fromJson(v));
});
}
if (json['contacts'] != null) {
contacts = <Contacts>[];
json['contacts'].forEach((v) {
contacts!.add(new Contacts.fromJson(v));
});
}
if (json['orders'] != null) {
orders = <Orders>[];
json['orders'].forEach((v) {
orders!.add(new Orders.fromJson(v));
});
}
if (json['payments'] != null) {
payments = <Payments>[];
json['payments'].forEach((v) {
payments!.add(new Payments.fromJson(v));
});
}
error = json['error'];
accountDetails = json['account_details'] != null
? new AccountDetails.fromJson(json['account_details'])
: null;
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.leads != null) {
data['leads'] = this.leads!.map((v) => v.toJson()).toList();
}
if (this.contacts != null) {
data['contacts'] = this.contacts!.map((v) => v.toJson()).toList();
}
if (this.orders != null) {
data['orders'] = this.orders!.map((v) => v.toJson()).toList();
}
if (this.payments != null) {
data['payments'] = this.payments!.map((v) => v.toJson()).toList();
}
data['error'] = this.error;
if (this.accountDetails != null) {
data['account_details'] = this.accountDetails!.toJson();
}
data['message'] = this.message;
return data;
}
}
class Leads {
String? id;
String? ownerId;
String? accId;
String? accManagerId;
String? status;
String? openStatus;
String? date;
String? closeDate;
String? closereason;
String? competitor;
String? orderGainId;
String? loc;
String? isExists;
String? createdDatetime;
String? updatedDatetime;
Leads(
{this.id,
this.ownerId,
this.accId,
this.accManagerId,
this.status,
this.openStatus,
this.date,
this.closeDate,
this.closereason,
this.competitor,
this.orderGainId,
this.loc,
this.isExists,
this.createdDatetime,
this.updatedDatetime});
Leads.fromJson(Map<String, dynamic> json) {
id = json['id'];
ownerId = json['owner_id'];
accId = json['acc_id'];
accManagerId = json['acc_manager_id'];
status = json['status'];
openStatus = json['open_status'];
date = json['date'];
closeDate = json['close_date'];
closereason = json['closereason'];
competitor = json['competitor'];
orderGainId = json['order_gain_id'];
loc = json['loc'];
isExists = json['is_exists'];
createdDatetime = json['created_datetime'];
updatedDatetime = json['updated_datetime'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['owner_id'] = this.ownerId;
data['acc_id'] = this.accId;
data['acc_manager_id'] = this.accManagerId;
data['status'] = this.status;
data['open_status'] = this.openStatus;
data['date'] = this.date;
data['close_date'] = this.closeDate;
data['closereason'] = this.closereason;
data['competitor'] = this.competitor;
data['order_gain_id'] = this.orderGainId;
data['loc'] = this.loc;
data['is_exists'] = this.isExists;
data['created_datetime'] = this.createdDatetime;
data['updated_datetime'] = this.updatedDatetime;
return data;
}
}
class Contacts {
String? id;
String? accId;
String? name;
String? salutationName;
String? mob1;
String? mob2;
String? tel;
String? email;
String? type;
String? designation;
String? date;
String? isExists;
String? createdDatetime;
String? updatedDatetime;
Contacts(
{this.id,
this.accId,
this.name,
this.salutationName,
this.mob1,
this.mob2,
this.tel,
this.email,
this.type,
this.designation,
this.date,
this.isExists,
this.createdDatetime,
this.updatedDatetime});
Contacts.fromJson(Map<String, dynamic> json) {
id = json['id'];
accId = json['acc_id'];
name = json['name'];
salutationName = json['salutation_name'];
mob1 = json['mob1'];
mob2 = json['mob2'];
tel = json['tel'];
email = json['email'];
type = json['type'];
designation = json['designation'];
date = json['date'];
isExists = json['is_exists'];
createdDatetime = json['created_datetime'];
updatedDatetime = json['updated_datetime'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['acc_id'] = this.accId;
data['name'] = this.name;
data['salutation_name'] = this.salutationName;
data['mob1'] = this.mob1;
data['mob2'] = this.mob2;
data['tel'] = this.tel;
data['email'] = this.email;
data['type'] = this.type;
data['designation'] = this.designation;
data['date'] = this.date;
data['is_exists'] = this.isExists;
data['created_datetime'] = this.createdDatetime;
data['updated_datetime'] = this.updatedDatetime;
return data;
}
}
class Orders {
String? id;
String? orderNumber;
String? orderNumberHash;
String? accId;
String? refType;
String? refId;
String? salesPersonEmpId;
String? enteredEmpId;
String? dispatchStateId;
String? dispatchDistrictId;
String? dispatchSubLocationId;
String? dispatchPincode;
String? dispatchAddress;
String? basicAmount;
String? cgstAmount;
String? sgstAmount;
String? igstAmount;
String? paidAmount;
String? totalAmount;
String? status;
String? orderReceivedDate;
String? scheduledDispatchDate;
String? otp;
String? note;
String? poViewFileName;
String? poDirFilePath;
String? unloadingScope;
String? freightScope;
String? erectionScope;
String? saleOrderNumber;
String? invoiceNumber;
String? vehicleNumber;
String? driverName;
String? driverMobileNumber;
String? tpcApplicable;
String? requestedTpcAmount;
String? level1TpcApprovedAmount;
String? level2TpcApprovedAmount;
String? tpcPaymentMode;
String? tpcPaymentReferenceNo;
String? tpcPaymentAttachmentDirFilePath;
String? tpcPaymentAttachementViewFileName;
String? tpcStatus;
String? tpcAgentId;
String? isExist;
String? createdDatetime;
String? updatedDatetime;
Orders(
{this.id,
this.orderNumber,
this.orderNumberHash,
this.accId,
this.refType,
this.refId,
this.salesPersonEmpId,
this.enteredEmpId,
this.dispatchStateId,
this.dispatchDistrictId,
this.dispatchSubLocationId,
this.dispatchPincode,
this.dispatchAddress,
this.basicAmount,
this.cgstAmount,
this.sgstAmount,
this.igstAmount,
this.paidAmount,
this.totalAmount,
this.status,
this.orderReceivedDate,
this.scheduledDispatchDate,
this.otp,
this.note,
this.poViewFileName,
this.poDirFilePath,
this.unloadingScope,
this.freightScope,
this.erectionScope,
this.saleOrderNumber,
this.invoiceNumber,
this.vehicleNumber,
this.driverName,
this.driverMobileNumber,
this.tpcApplicable,
this.requestedTpcAmount,
this.level1TpcApprovedAmount,
this.level2TpcApprovedAmount,
this.tpcPaymentMode,
this.tpcPaymentReferenceNo,
this.tpcPaymentAttachmentDirFilePath,
this.tpcPaymentAttachementViewFileName,
this.tpcStatus,
this.tpcAgentId,
this.isExist,
this.createdDatetime,
this.updatedDatetime});
Orders.fromJson(Map<String, dynamic> json) {
id = json['id'];
orderNumber = json['order_number'];
orderNumberHash = json['order_number_hash'];
accId = json['acc_id'];
refType = json['ref_type'];
refId = json['ref_id'];
salesPersonEmpId = json['sales_person_emp_id'];
enteredEmpId = json['entered_emp_id'];
dispatchStateId = json['dispatch_state_id'];
dispatchDistrictId = json['dispatch_district_id'];
dispatchSubLocationId = json['dispatch_sub_location_id'];
dispatchPincode = json['dispatch_pincode'];
dispatchAddress = json['dispatch_address'];
basicAmount = json['basic_amount'];
cgstAmount = json['cgst_amount'];
sgstAmount = json['sgst_amount'];
igstAmount = json['igst_amount'];
paidAmount = json['paid_amount'];
totalAmount = json['total_amount'];
status = json['status'];
orderReceivedDate = json['order_received_date'];
scheduledDispatchDate = json['scheduled_dispatch_date'];
otp = json['otp'];
note = json['note'];
poViewFileName = json['po_view_file_name'];
poDirFilePath = json['po_dir_file_path'];
unloadingScope = json['unloading_scope'];
freightScope = json['freight_scope'];
erectionScope = json['erection_scope'];
saleOrderNumber = json['sale_order_number'];
invoiceNumber = json['invoice_number'];
vehicleNumber = json['vehicle_number'];
driverName = json['driver_name'];
driverMobileNumber = json['driver_mobile_number'];
tpcApplicable = json['tpc_applicable'];
requestedTpcAmount = json['requested_tpc_amount'];
level1TpcApprovedAmount = json['level1_tpc_approved_amount'];
level2TpcApprovedAmount = json['level2_tpc_approved_amount'];
tpcPaymentMode = json['tpc_payment_mode'];
tpcPaymentReferenceNo = json['tpc_payment_reference_no'];
tpcPaymentAttachmentDirFilePath =
json['tpc_payment_attachment_dir_file_path'];
tpcPaymentAttachementViewFileName =
json['tpc_payment_attachement_view_file_name'];
tpcStatus = json['tpc_status'];
tpcAgentId = json['tpc_agent_id'];
isExist = json['is_exist'];
createdDatetime = json['created_datetime'];
updatedDatetime = json['updated_datetime'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['order_number'] = this.orderNumber;
data['order_number_hash'] = this.orderNumberHash;
data['acc_id'] = this.accId;
data['ref_type'] = this.refType;
data['ref_id'] = this.refId;
data['sales_person_emp_id'] = this.salesPersonEmpId;
data['entered_emp_id'] = this.enteredEmpId;
data['dispatch_state_id'] = this.dispatchStateId;
data['dispatch_district_id'] = this.dispatchDistrictId;
data['dispatch_sub_location_id'] = this.dispatchSubLocationId;
data['dispatch_pincode'] = this.dispatchPincode;
data['dispatch_address'] = this.dispatchAddress;
data['basic_amount'] = this.basicAmount;
data['cgst_amount'] = this.cgstAmount;
data['sgst_amount'] = this.sgstAmount;
data['igst_amount'] = this.igstAmount;
data['paid_amount'] = this.paidAmount;
data['total_amount'] = this.totalAmount;
data['status'] = this.status;
data['order_received_date'] = this.orderReceivedDate;
data['scheduled_dispatch_date'] = this.scheduledDispatchDate;
data['otp'] = this.otp;
data['note'] = this.note;
data['po_view_file_name'] = this.poViewFileName;
data['po_dir_file_path'] = this.poDirFilePath;
data['unloading_scope'] = this.unloadingScope;
data['freight_scope'] = this.freightScope;
data['erection_scope'] = this.erectionScope;
data['sale_order_number'] = this.saleOrderNumber;
data['invoice_number'] = this.invoiceNumber;
data['vehicle_number'] = this.vehicleNumber;
data['driver_name'] = this.driverName;
data['driver_mobile_number'] = this.driverMobileNumber;
data['tpc_applicable'] = this.tpcApplicable;
data['requested_tpc_amount'] = this.requestedTpcAmount;
data['level1_tpc_approved_amount'] = this.level1TpcApprovedAmount;
data['level2_tpc_approved_amount'] = this.level2TpcApprovedAmount;
data['tpc_payment_mode'] = this.tpcPaymentMode;
data['tpc_payment_reference_no'] = this.tpcPaymentReferenceNo;
data['tpc_payment_attachment_dir_file_path'] =
this.tpcPaymentAttachmentDirFilePath;
data['tpc_payment_attachement_view_file_name'] =
this.tpcPaymentAttachementViewFileName;
data['tpc_status'] = this.tpcStatus;
data['tpc_agent_id'] = this.tpcAgentId;
data['is_exist'] = this.isExist;
data['created_datetime'] = this.createdDatetime;
data['updated_datetime'] = this.updatedDatetime;
return data;
}
}
class Payments {
String? id;
String? accId;
String? refType;
String? refId;
String? description;
String? amount;
String? paymentDate;
String? paymentType;
String? refNo;
String? empId;
String? otp;
String? attachment;
String? attachmentDirFilePath;
String? attachmentViewFileName;
String? approvalRemarks;
String? approvalStatus;
String? approvalEmpId;
String? approvalDatetime;
String? status;
String? isExist;
String? delEmpId;
String? delDatetime;
String? datetime;
String? employeeName;
Payments(
{this.id,
this.accId,
this.refType,
this.refId,
this.description,
this.amount,
this.paymentDate,
this.paymentType,
this.refNo,
this.empId,
this.otp,
this.attachment,
this.attachmentDirFilePath,
this.attachmentViewFileName,
this.approvalRemarks,
this.approvalStatus,
this.approvalEmpId,
this.approvalDatetime,
this.status,
this.isExist,
this.delEmpId,
this.delDatetime,
this.datetime,
this.employeeName});
Payments.fromJson(Map<String, dynamic> json) {
id = json['id'];
accId = json['acc_id'];
refType = json['ref_type'];
refId = json['ref_id'];
description = json['description'];
amount = json['amount'];
paymentDate = json['payment_date'];
paymentType = json['payment_type'];
refNo = json['ref_no'];
empId = json['emp_id'];
otp = json['otp'];
attachment = json['attachment'];
attachmentDirFilePath = json['attachment_dir_file_path'];
attachmentViewFileName = json['attachment_view_file_name'];
approvalRemarks = json['approval_remarks'];
approvalStatus = json['approval_status'];
approvalEmpId = json['approval_emp_id'];
approvalDatetime = json['approval_datetime'];
status = json['status'];
isExist = json['is_exist'];
delEmpId = json['del_emp_id'];
delDatetime = json['del_datetime'];
datetime = json['datetime'];
employeeName = json['employee_name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['acc_id'] = this.accId;
data['ref_type'] = this.refType;
data['ref_id'] = this.refId;
data['description'] = this.description;
data['amount'] = this.amount;
data['payment_date'] = this.paymentDate;
data['payment_type'] = this.paymentType;
data['ref_no'] = this.refNo;
data['emp_id'] = this.empId;
data['otp'] = this.otp;
data['attachment'] = this.attachment;
data['attachment_dir_file_path'] = this.attachmentDirFilePath;
data['attachment_view_file_name'] = this.attachmentViewFileName;
data['approval_remarks'] = this.approvalRemarks;
data['approval_status'] = this.approvalStatus;
data['approval_emp_id'] = this.approvalEmpId;
data['approval_datetime'] = this.approvalDatetime;
data['status'] = this.status;
data['is_exist'] = this.isExist;
data['del_emp_id'] = this.delEmpId;
data['del_datetime'] = this.delDatetime;
data['datetime'] = this.datetime;
data['employee_name'] = this.employeeName;
return data;
}
}
class AccountDetails {
String? id;
String? tempId;
String? ownerId;
String? accManagerId;
String? name;
String? salutationName;
String? subLocality;
String? district;
String? state;
String? pincode;
String? address;
String? date;
String? source;
String? reference;
String? segment;
String? team;
String? gstNumber;
String? isExists;
String? createdDatetime;
String? updatedDatetime;
String? aage;
String? accManager;
String? owner;
AccountDetails(
{this.id,
this.tempId,
this.ownerId,
this.accManagerId,
this.name,
this.salutationName,
this.subLocality,
this.district,
this.state,
this.pincode,
this.address,
this.date,
this.source,
this.reference,
this.segment,
this.team,
this.gstNumber,
this.isExists,
this.createdDatetime,
this.updatedDatetime,
this.aage,
this.accManager,
this.owner});
AccountDetails.fromJson(Map<String, dynamic> json) {
id = json['id'];
tempId = json['temp_id'];
ownerId = json['owner_id'];
accManagerId = json['acc_manager_id'];
name = json['name'];
salutationName = json['salutation_name'];
subLocality = json['sub_locality'];
district = json['district'];
state = json['state'];
pincode = json['pincode'];
address = json['address'];
date = json['date'];
source = json['source'];
reference = json['reference'];
segment = json['segment'];
team = json['team'];
gstNumber = json['gst_number'];
isExists = json['is_exists'];
createdDatetime = json['created_datetime'];
updatedDatetime = json['updated_datetime'];
aage = json['aage'];
accManager = json['acc_manager'];
owner = json['owner'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['temp_id'] = this.tempId;
data['owner_id'] = this.ownerId;
data['acc_manager_id'] = this.accManagerId;
data['name'] = this.name;
data['salutation_name'] = this.salutationName;
data['sub_locality'] = this.subLocality;
data['district'] = this.district;
data['state'] = this.state;
data['pincode'] = this.pincode;
data['address'] = this.address;
data['date'] = this.date;
data['source'] = this.source;
data['reference'] = this.reference;
data['segment'] = this.segment;
data['team'] = this.team;
data['gst_number'] = this.gstNumber;
data['is_exists'] = this.isExists;
data['created_datetime'] = this.createdDatetime;
data['updated_datetime'] = this.updatedDatetime;
data['aage'] = this.aage;
data['acc_manager'] = this.accManager;
data['owner'] = this.owner;
return data;
}
}
class ordersDetailsEditOrderViewResponse {
OrderDetails? orderDetails;
List<States>? states;
String? error;
String? message;
ordersDetailsEditOrderViewResponse(
{this.orderDetails, this.states, this.error, this.message});
ordersDetailsEditOrderViewResponse.fromJson(Map<String, dynamic> json) {
orderDetails = json['order_details'] != null
? new OrderDetails.fromJson(json['order_details'])
: null;
if (json['states'] != null) {
states = <States>[];
json['states'].forEach((v) {
states!.add(new States.fromJson(v));
});
}
error = json['error'];
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.orderDetails != null) {
data['order_details'] = this.orderDetails!.toJson();
}
if (this.states != null) {
data['states'] = this.states!.map((v) => v.toJson()).toList();
}
data['error'] = this.error;
data['message'] = this.message;
return data;
}
}
class OrderDetails {
String? id;
String? orderNumber;
String? orderNumberHash;
String? accId;
String? refType;
String? refId;
String? salesPersonEmpId;
String? enteredEmpId;
String? dispatchStateId;
String? dispatchDistrictId;
String? dispatchSubLocationId;
String? dispatchPincode;
String? dispatchAddress;
String? basicAmount;
String? cgstAmount;
String? sgstAmount;
String? igstAmount;
String? paidAmount;
String? totalAmount;
String? status;
String? orderReceivedDate;
String? scheduledDispatchDate;
String? otp;
String? note;
String? poViewFileName;
String? poDirFilePath;
String? unloadingScope;
String? freightScope;
String? erectionScope;
String? saleOrderNumber;
String? invoiceNumber;
String? vehicleNumber;
String? driverName;
String? driverMobileNumber;
String? tpcApplicable;
String? requestedTpcAmount;
String? level1TpcApprovedAmount;
String? level2TpcApprovedAmount;
String? tpcPaymentMode;
String? tpcPaymentReferenceNo;
String? tpcPaymentAttachmentDirFilePath;
String? tpcPaymentAttachementViewFileName;
String? tpcStatus;
String? tpcAgentId;
String? isExist;
String? createdDatetime;
String? updatedDatetime;
String? accountName;
String? gstNumber;
String? billingAddress;
String? district;
String? state;
String? subLocality;
String? billingPincode;
String? stateName;
String? balanceAmount;
String? districtName;
String? subLocationName;
String? adjustedAmount;
String? enteredEmpName;
String? salesPersonEmpName;
Null? tpcaAgentName;
OrderDetails(
{this.id,
this.orderNumber,
this.orderNumberHash,
this.accId,
this.refType,
this.refId,
this.salesPersonEmpId,
this.enteredEmpId,
this.dispatchStateId,
this.dispatchDistrictId,
this.dispatchSubLocationId,
this.dispatchPincode,
this.dispatchAddress,
this.basicAmount,
this.cgstAmount,
this.sgstAmount,
this.igstAmount,
this.paidAmount,
this.totalAmount,
this.status,
this.orderReceivedDate,
this.scheduledDispatchDate,
this.otp,
this.note,
this.poViewFileName,
this.poDirFilePath,
this.unloadingScope,
this.freightScope,
this.erectionScope,
this.saleOrderNumber,
this.invoiceNumber,
this.vehicleNumber,
this.driverName,
this.driverMobileNumber,
this.tpcApplicable,
this.requestedTpcAmount,
this.level1TpcApprovedAmount,
this.level2TpcApprovedAmount,
this.tpcPaymentMode,
this.tpcPaymentReferenceNo,
this.tpcPaymentAttachmentDirFilePath,
this.tpcPaymentAttachementViewFileName,
this.tpcStatus,
this.tpcAgentId,
this.isExist,
this.createdDatetime,
this.updatedDatetime,
this.accountName,
this.gstNumber,
this.billingAddress,
this.district,
this.state,
this.subLocality,
this.billingPincode,
this.stateName,
this.balanceAmount,
this.districtName,
this.subLocationName,
this.adjustedAmount,
this.enteredEmpName,
this.salesPersonEmpName,
this.tpcaAgentName});
OrderDetails.fromJson(Map<String, dynamic> json) {
id = json['id'];
orderNumber = json['order_number'];
orderNumberHash = json['order_number_hash'];
accId = json['acc_id'];
refType = json['ref_type'];
refId = json['ref_id'];
salesPersonEmpId = json['sales_person_emp_id'];
enteredEmpId = json['entered_emp_id'];
dispatchStateId = json['dispatch_state_id'];
dispatchDistrictId = json['dispatch_district_id'];
dispatchSubLocationId = json['dispatch_sub_location_id'];
dispatchPincode = json['dispatch_pincode'];
dispatchAddress = json['dispatch_address'];
basicAmount = json['basic_amount'];
cgstAmount = json['cgst_amount'];
sgstAmount = json['sgst_amount'];
igstAmount = json['igst_amount'];
paidAmount = json['paid_amount'];
totalAmount = json['total_amount'];
status = json['status'];
orderReceivedDate = json['order_received_date'];
scheduledDispatchDate = json['scheduled_dispatch_date'];
otp = json['otp'];
note = json['note'];
poViewFileName = json['po_view_file_name'];
poDirFilePath = json['po_dir_file_path'];
unloadingScope = json['unloading_scope'];
freightScope = json['freight_scope'];
erectionScope = json['erection_scope'];
saleOrderNumber = json['sale_order_number'];
invoiceNumber = json['invoice_number'];
vehicleNumber = json['vehicle_number'];
driverName = json['driver_name'];
driverMobileNumber = json['driver_mobile_number'];
tpcApplicable = json['tpc_applicable'];
requestedTpcAmount = json['requested_tpc_amount'];
level1TpcApprovedAmount = json['level1_tpc_approved_amount'];
level2TpcApprovedAmount = json['level2_tpc_approved_amount'];
tpcPaymentMode = json['tpc_payment_mode'];
tpcPaymentReferenceNo = json['tpc_payment_reference_no'];
tpcPaymentAttachmentDirFilePath =
json['tpc_payment_attachment_dir_file_path'];
tpcPaymentAttachementViewFileName =
json['tpc_payment_attachement_view_file_name'];
tpcStatus = json['tpc_status'];
tpcAgentId = json['tpc_agent_id'];
isExist = json['is_exist'];
createdDatetime = json['created_datetime'];
updatedDatetime = json['updated_datetime'];
accountName = json['account_name'];
gstNumber = json['gst_number'];
billingAddress = json['billing_address'];
district = json['district'];
state = json['state'];
subLocality = json['sub_locality'];
billingPincode = json['billing_pincode'];
stateName = json['state_name'];
balanceAmount = json['balance_amount'];
districtName = json['district_name'];
subLocationName = json['sub_location_name'];
adjustedAmount = json['adjusted_amount'];
enteredEmpName = json['entered_emp_name'];
salesPersonEmpName = json['sales_person_emp_name'];
tpcaAgentName = json['tpca_agent_name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['order_number'] = this.orderNumber;
data['order_number_hash'] = this.orderNumberHash;
data['acc_id'] = this.accId;
data['ref_type'] = this.refType;
data['ref_id'] = this.refId;
data['sales_person_emp_id'] = this.salesPersonEmpId;
data['entered_emp_id'] = this.enteredEmpId;
data['dispatch_state_id'] = this.dispatchStateId;
data['dispatch_district_id'] = this.dispatchDistrictId;
data['dispatch_sub_location_id'] = this.dispatchSubLocationId;
data['dispatch_pincode'] = this.dispatchPincode;
data['dispatch_address'] = this.dispatchAddress;
data['basic_amount'] = this.basicAmount;
data['cgst_amount'] = this.cgstAmount;
data['sgst_amount'] = this.sgstAmount;
data['igst_amount'] = this.igstAmount;
data['paid_amount'] = this.paidAmount;
data['total_amount'] = this.totalAmount;
data['status'] = this.status;
data['order_received_date'] = this.orderReceivedDate;
data['scheduled_dispatch_date'] = this.scheduledDispatchDate;
data['otp'] = this.otp;
data['note'] = this.note;
data['po_view_file_name'] = this.poViewFileName;
data['po_dir_file_path'] = this.poDirFilePath;
data['unloading_scope'] = this.unloadingScope;
data['freight_scope'] = this.freightScope;
data['erection_scope'] = this.erectionScope;
data['sale_order_number'] = this.saleOrderNumber;
data['invoice_number'] = this.invoiceNumber;
data['vehicle_number'] = this.vehicleNumber;
data['driver_name'] = this.driverName;
data['driver_mobile_number'] = this.driverMobileNumber;
data['tpc_applicable'] = this.tpcApplicable;
data['requested_tpc_amount'] = this.requestedTpcAmount;
data['level1_tpc_approved_amount'] = this.level1TpcApprovedAmount;
data['level2_tpc_approved_amount'] = this.level2TpcApprovedAmount;
data['tpc_payment_mode'] = this.tpcPaymentMode;
data['tpc_payment_reference_no'] = this.tpcPaymentReferenceNo;
data['tpc_payment_attachment_dir_file_path'] =
this.tpcPaymentAttachmentDirFilePath;
data['tpc_payment_attachement_view_file_name'] =
this.tpcPaymentAttachementViewFileName;
data['tpc_status'] = this.tpcStatus;
data['tpc_agent_id'] = this.tpcAgentId;
data['is_exist'] = this.isExist;
data['created_datetime'] = this.createdDatetime;
data['updated_datetime'] = this.updatedDatetime;
data['account_name'] = this.accountName;
data['gst_number'] = this.gstNumber;
data['billing_address'] = this.billingAddress;
data['district'] = this.district;
data['state'] = this.state;
data['sub_locality'] = this.subLocality;
data['billing_pincode'] = this.billingPincode;
data['state_name'] = this.stateName;
data['balance_amount'] = this.balanceAmount;
data['district_name'] = this.districtName;
data['sub_location_name'] = this.subLocationName;
data['adjusted_amount'] = this.adjustedAmount;
data['entered_emp_name'] = this.enteredEmpName;
data['sales_person_emp_name'] = this.salesPersonEmpName;
data['tpca_agent_name'] = this.tpcaAgentName;
return data;
}
}
class States {
String? id;
String? name;
States({this.id, this.name});
States.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
return data;
}
}
......@@ -578,35 +578,35 @@ class Leadlistprovider extends ChangeNotifier {
}
if (!_sourcesList.contains(_selectedSources) && _selectedSources != null) {
_selectedSourceId = null;
_selectedEmployeeValue = null;
_selectedSourceValue = null;
}
if (!_referencesList.contains(_selectedReferences) &&
_selectedReferences != null) {
_selectedReferenceId = null;
_selectedSourceValue = null;
_selectedReferenceValue = null;
}
if (!_segmentsList.contains(_selectedSegments) &&
_selectedSegments != null) {
_selectedTeamId = null;
_selectedReferenceValue = null;
_selectedTeamValue = null;
}
if (!_teamsList.contains(_selectedTeams) && _selectedTeams != null) {
_selectedSegmentId = null;
_selectedTeamValue = null;
_selectedSegmentValue = null;
}
if (!_districtsList.contains(_selectedDistricts) &&
_selectedDistricts != null) {
_selectedDistrictId = null;
_selectedSegmentValue = null;
_selectedDistrictValue = null;
}
if (!_statesList.contains(_selectedStates) && _selectedStates != null) {
_selectedStateId = null;
_selectedDistrictValue = null;
_selectedStateValue = null;
}
if (!_subLocationsList.contains(_selectedSubLocations) &&
_selectedSubLocations != null) {
_selectedSubLocationId = null;
_selectedStateValue = null;
_selectedSubLocationValue = null;
}
notifyListeners();
}
......
......@@ -9,6 +9,7 @@ import '../HomeScreenNotifier.dart';
class ProspectListProvider extends ChangeNotifier {
TextEditingController searchController = TextEditingController();
TextEditingController mobileNumberController = TextEditingController();
TextEditingController companyNameController = TextEditingController(
text: "a",
......@@ -148,6 +149,7 @@ class ProspectListProvider extends ChangeNotifier {
_isLoading = false;
mobileNumberController.clear();
companyNameController.clear();
searchController.clear();
companyNameController.text = "a";
_selectedEmployees = null;
......
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:generp/Models/crmModels/crmProspectDetailsAddLeadsResponse.dart';
import 'package:generp/Notifiers/HomeScreenNotifier.dart';
import 'package:generp/Utils/commonServices.dart';
import 'package:generp/services/api_calling.dart';
import 'package:provider/provider.dart';
class Addprospectleadsprovider extends ChangeNotifier {
TextEditingController searchController = TextEditingController();
List<Products> _leadProductsList = [];
List<Employees> _employeeList = [];
List<String> _statusList = [];
Employees? _selectedEmployees;
String? _selectedStatus;
String? _selectedEmployeeId;
String? _selectedEmployeeValue;
Products? _selectedProducts;
List<TextEditingController> editProductPriceControllers = [];
List<TextEditingController> editQuantityControllers = [];
List<TextEditingController> editTotalAmountControllers = [];
List<String?> _selectedProductIds = [];
List<String?> _selectedValues = [];
bool _submitLoading = false;
List<Products> get leadProductsList => _leadProductsList;
Products? get selectedProducts => _selectedProducts;
List<String?> get selectedProductIds => _selectedProductIds;
List<String?> get selectedValues => _selectedValues;
bool get submitLoading => _submitLoading;
List<Employees> get employeeList => _employeeList;
List<String> get statusList => _statusList;
Employees? get selectedEmployee => _selectedEmployees;
String? get selectedStatus => _selectedStatus;
String? get selectedEmployeeId => _selectedEmployeeId;
String? get selectedEmployeeValue => _selectedEmployeeValue;
set selectedEmployee(Employees? value){
_selectedEmployees = value;
_selectedEmployeeId = value!.id!;
_selectedEmployeeValue = value!.name!;
notifyListeners();
}
set selectedStatus(String? value){
_selectedStatus = value;
notifyListeners();
}
set selectedEmployeeId(String? value){
_selectedEmployeeId = value;
notifyListeners();
}
set selectedEmployeeValue(String? value){
_selectedEmployeeValue = value;
notifyListeners();
}
set selectedProducts(Products? value) {
_selectedProducts = value;
notifyListeners();
}
set submitLoading(bool value) {
_submitLoading = value;
notifyListeners();
}
void initializeForm(BuildContext context) {
// Clear existing controllers
editProductPriceControllers.clear();
editQuantityControllers.clear();
editTotalAmountControllers.clear();
_selectedProductIds.clear();
_selectedValues.clear();
// Add one empty row if the list is empty
if (_leadProductsList.isEmpty) {
editAddNewRow();
}
notifyListeners();
}
void editAddNewRow() {
editProductPriceControllers.add(TextEditingController());
editQuantityControllers.add(TextEditingController());
editTotalAmountControllers.add(TextEditingController());
_selectedProductIds.add(null);
_selectedValues.add(null);
notifyListeners();
}
void editRemoveRow(int index) {
editProductPriceControllers[index].dispose();
editQuantityControllers[index].dispose();
editTotalAmountControllers[index].dispose();
editProductPriceControllers.removeAt(index);
editQuantityControllers.removeAt(index);
editTotalAmountControllers.removeAt(index);
_selectedProductIds.removeAt(index);
_selectedValues.removeAt(index);
notifyListeners();
}
void updateSelectedProductIds(int index, Products value) {
_selectedProductIds[index] = value.id;
_selectedValues[index] = value.name;
notifyListeners();
}
void updateTotalAmount(int index) {
final price = double.tryParse(editProductPriceControllers[index].text) ?? 0;
final qty = int.tryParse(editQuantityControllers[index].text) ?? 0;
editTotalAmountControllers[index].text = (price * qty).toString();
notifyListeners();
}
List<Map<String, String>> getFormData() {
final List<Map<String, String>> insertData = [];
for (int i = 0; i < editProductPriceControllers.length; i++) {
if (_selectedProductIds[i] != null) {
final rowData = {
"product_id": _selectedProductIds[i]!,
"price": editProductPriceControllers[i].text,
"qty": editQuantityControllers[i].text,
"net_price":editTotalAmountControllers[i].text
};
insertData.add(rowData);
}
}
return insertData;
}
Future<void> crmProspectDetailsAddLeadsViewAPIFunction(BuildContext context, String mode) async {
try {
final prov = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmProspectDetailsAddLeadViewAPI(prov.empId, prov.session, mode);
if (data != null && data.error == "0") {
_leadProductsList = data.products!;
_employeeList = data.employees!;
_statusList = data.status!;
notifyListeners();
}
} catch (e, s) {
print("Error: $e, Stack: $s");
}
}
Future<void> crmProspectDetailsAddLeadsSubmitAPIFunction(BuildContext context,mode, account_id, acc_manager_id, products, lead_status) async {
try {
final prov = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmProspectDetailsAddLeadSubmitAPI(prov.empId, prov.session, mode, account_id, acc_manager_id, products, lead_status);
if (data != null && data.error == "0") {
resetForm();
Navigator.pop(context,true);
toast(context, data.message);
notifyListeners();
}
} catch (e, s) {
print("Error: $e, Stack: $s");
}
}
void submitForm(BuildContext context,mode,accId,empID,status) async {
submitLoading = true;
final insertedData = getFormData();
print("Form Data: $insertedData");
// crmProspectDetailsAddLeadsSubmitAPIFunction(context,mode,accId,empID,insertedData,status);
submitLoading = false;
}
void resetForm() {
searchController.clear();
editProductPriceControllers.clear();
editQuantityControllers.clear();
editTotalAmountControllers.clear();
_selectedProductIds.clear();
_selectedValues.clear();
_leadProductsList.clear();
_selectedStatus = null;
_selectedEmployeeId = null;
_selectedEmployeeValue = null;
checkDropDownReset();
notifyListeners();
}
checkDropDownReset(){
if(!_employeeList.contains(_selectedEmployees)&&_selectedEmployees!=null){
_selectedEmployeeId = null;
_selectedEmployeeValue = null;
}
notifyListeners();
}
}
\ No newline at end of file
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../Models/crmModels/GetDistrictOnStateResponse.dart';
import '../../Models/crmModels/GetSubLocOnDistrictResponse.dart';
import '../../Models/crmModels/LeadListViewResponse.dart' show Employees;
import '../../Models/crmModels/crmProspectDetailsEditAccountViewResponse.dart';
import '../../Utils/commonServices.dart';
import '../../services/api_calling.dart';
import '../HomeScreenNotifier.dart';
class Crmeditprospectaccountprovider extends ChangeNotifier {
TextEditingController editCompanyNameController = TextEditingController();
TextEditingController editSalutationNameController = TextEditingController();
TextEditingController pincodeController = TextEditingController();
TextEditingController addressController = TextEditingController();
TextEditingController searchController = TextEditingController();
String? salutationError;
String? companyNameError;
String? pincodeError;
String? addressError;
List<Employees> _employeesList = [];
List<Districts> _districtsList = [];
List<SubLocations> _subLocationsList = [];
List<String> _salutationsList = [];
List<States> _statesList = [];
AccountDetails _accountDetails = AccountDetails();
Employees? _selectedEmployees;
States? _selectedStates;
Districts? _selectedDistricts;
SubLocations? _selectedSubLocations;
String? _selectedSalutation;
String? _selectedEmployeeId;
String? _selectedEmployeeValue;
String? _selectedStateId;
String? _selectedStateValue;
String? _selectedDistrictId;
String? _selectedDistrictValue;
String? _selectedSubLocationId;
String? _selectedSubLocationValue;
bool _isLoading = false;
bool get isLoading => _isLoading;
List<Employees> get employeesList => _employeesList;
String? get selectedSalutation => _selectedSalutation;
String? get selectedEmployeeId => _selectedEmployeeId;
String? get selectedEmployeeValue => _selectedEmployeeValue;
List<String> get salutationList => _salutationsList;
List<States> get statesList => _statesList;
List<Districts> get districtsList => _districtsList;
List<SubLocations> get subLocationsList => _subLocationsList;
AccountDetails get accountDetails => _accountDetails;
Employees? get selectedEmployees => _selectedEmployees;
States? get selectedStates => _selectedStates;
Districts? get selectedDistricts => _selectedDistricts;
SubLocations? get selectedSubLocations => _selectedSubLocations;
String? get selectedStateId => _selectedStateId;
String? get selectedStateValue => _selectedStateValue;
String? get selectedDistrictId => _selectedDistrictId;
String? get selectedDistrictValue => _selectedDistrictValue;
String? get selectedSubLocationId => _selectedSubLocationId;
String? get selectedSubLocationValue => _selectedSubLocationValue;
set isLoading(bool value) {
_isLoading = value;
notifyListeners();
}
set selectedEmployees(Employees? value) {
_selectedEmployees = value;
_selectedEmployeeId = value!.id!;
_selectedEmployeeValue = value.name;
notifyListeners();
}
set selectedStates(States? value) {
_selectedStates = value;
_selectedStateId = value!.id!;
_selectedStateValue = value.name;
notifyListeners();
}
set selectedDistricts(Districts? value) {
_selectedDistricts = value;
_selectedDistrictId = value!.id!;
_selectedDistrictValue = value.district;
notifyListeners();
}
set selectedSubLocations(SubLocations? value) {
_selectedSubLocations = value;
_selectedSubLocationId = value!.id!;
_selectedSubLocationValue = value.subLocality;
notifyListeners();
}
set selectedSalutation(String? value) {
_selectedSalutation = value;
notifyListeners();
}
set selectedStateId(String? value) {
_selectedStateId = value;
notifyListeners();
}
set selectedStateValue(String? value) {
_selectedStateValue = value;
notifyListeners();
}
set selectedEmployeeId(String? value) {
_selectedEmployeeId = value;
notifyListeners();
}
set selectedEmployeeValue(String? value) {
_selectedEmployeeValue = value;
notifyListeners();
}
set selectedDistrictId(String? value) {
_selectedDistrictId = value;
notifyListeners();
}
set selectedDistrictValue(String? value) {
_selectedDistrictValue = value;
notifyListeners();
}
set selectedSubLocationId(String? value) {
_selectedSubLocationId = value;
notifyListeners();
}
set selectedSubLocationValue(String? value) {
_selectedSubLocationValue = value;
notifyListeners();
}
Future<void> crmLeadListViewAPIFunction(context, mode) async {
try {
var HomeProv = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmLeadListViewAPI(
HomeProv.empId,
HomeProv.session,
mode,
);
if (data != null) {
print(data.error);
if (data.error == "0") {
_employeesList = data.employees!;
notifyListeners();
}
}
} catch (e, s) {}
}
Future<void> crmProspectDetailsEditAccountViewAPIFunction(
context,
accID,
) async {
try {
var prov = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmProspectDetailsEditAccountViewAPI(
prov.empId,
prov.session,
accID,
);
_isLoading = true;
notifyListeners();
if (data != null) {
if (data.error == "0") {
_accountDetails = data.accountDetails!;
_statesList = data.states??[];
_salutationsList = data.salutations??[];
_isLoading = false;
notifyListeners();
} else {
_isLoading = false;
notifyListeners();
}
} else {
_isLoading = false;
notifyListeners();
}
} catch (e, s) {
_isLoading = false;
notifyListeners();
}
}
Future<void> crmProspectDetailsEditAccountSubmitAPIFunction(
context,
accID,
salutation,
stateID,
districtID,
subLocalityID,
) async {
try {
var prov = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmProspectDetailsEditAccountSubmitAPI(
prov.empId,
prov.session,
accID,
editCompanyNameController.text,
salutation,
stateID,
districtID,
subLocalityID,
pincodeController.text,
addressController.text,
);
_isLoading = true;
notifyListeners();
if (data != null) {
if (data.error == "0") {
_isLoading = false;
Navigator.pop(context, true);
toast(context, data.message);
resetAll();
_isLoading = false;
notifyListeners();
} else {
_isLoading = false;
notifyListeners();
}
} else {
_isLoading = false;
notifyListeners();
}
} catch (e, s) {
_isLoading = false;
notifyListeners();
}
}
Future<void> crmLeadListDistrictsOnStateAPIFunction(
context,
mode,
stateID,
) async {
try {
var prov = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmDistrictsOnStateAPI(
prov.empId,
prov.session,
stateID,
);
if (data != null) {
if (data.error == "0") {
_districtsList = data.districts!;
notifyListeners();
}
}
} catch (e, s) {}
}
Future<void> crmLeadListSubLocOnDistrictAPIFunction(
context,
mode,
districtID,
) async {
try {
var prov = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmSubLocOnDistrictAPI(
prov.empId,
prov.session,
districtID,
);
if (data != null) {
if (data.error == "0") {
_subLocationsList = data.subLocations!;
notifyListeners();
}
}
} catch (e, s) {}
}
Future<void> crmProspectDetailsTransferAccountAPIFunction(
context,
accID,
transferEmpID,
) async {
try {
var prov = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmProspectDetailsTransferAccountAPI(
prov.empId,
prov.session,
accID,
transferEmpID,
);
_isLoading = true;
notifyListeners();
if (data != null) {
if (data.error == "0") {
_isLoading = false;
Navigator.pop(context, true);
toast(context, data.message);
resetAll();
_isLoading = false;
notifyListeners();
} else {
_isLoading = false;
notifyListeners();
}
} else {
_isLoading = false;
notifyListeners();
}
} catch (e, s) {
_isLoading = false;
notifyListeners();
}
}
void onChangeSalutation(value){
salutationError = "";
notifyListeners();
}
void onChangeCompanyName(value){
companyNameError = "";
notifyListeners();
}
void onChangePincode(value){
pincodeError = "";
notifyListeners();
}
void onChangeAddress(value){
addressError = "";
notifyListeners();
}
void resetAll() {
editCompanyNameController.clear();
editSalutationNameController.clear();
pincodeController.clear();
addressController.clear();
searchController.clear();
salutationError = null;
companyNameError = null;
pincodeError = null;
addressError = null;
notifyListeners();
_selectedEmployees = null; _selectedEmployeeId = null;
_selectedEmployeeValue = null;
_selectedStates = null;
_selectedDistricts = null;
_selectedSubLocations = null;
_selectedStateId = null;
_selectedDistrictId = null;
_selectedSubLocationId = null;
_selectedDistrictValue = null;
_selectedStateValue = null;
_selectedSubLocationValue = null;
_selectedSalutation = null;
checkDropDownValues();
notifyListeners();
}
void checkDropDownValues() {
if (!_salutationsList.contains(_selectedSalutation) &&
_selectedSalutation != null) {
_selectedSalutation = null;
}
if (!_employeesList.contains(_selectedEmployees) &&
_selectedEmployees != null) {
_selectedEmployeeId = null;
_selectedEmployeeValue = null;
}
if (!_districtsList.contains(_selectedDistricts) &&
_selectedDistricts != null) {
_selectedDistrictId = null;
_selectedDistrictValue = null;
}
if (!_statesList.contains(_selectedStates) && _selectedStates != null) {
_selectedStateId = null;
_selectedStateValue = null;
}
if (!_subLocationsList.contains(_selectedSubLocations) &&
_selectedSubLocations != null) {
_selectedSubLocationId = null;
_selectedSubLocationValue = null;
}
notifyListeners();
}
}
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart';
import '../../Models/crmModels/crmProspectDetailsResponse.dart';
import '../../Utils/commonServices.dart';
import '../../services/api_calling.dart';
import '../HomeScreenNotifier.dart';
class crmProspectDetailsProvider extends ChangeNotifier {
List<Leads> _leadsList = [];
List<Contacts> _contactsList = [];
List<Orders> _ordersList = [];
List<Payments> _paymentsList = [];
AccountDetails _accountDetails = AccountDetails();
bool _isLoading = false;
TextEditingController nameController = TextEditingController();
TextEditingController designationController = TextEditingController();
TextEditingController mobileNumberController = TextEditingController();
TextEditingController alternativeMobileController = TextEditingController();
TextEditingController telephoneController = TextEditingController();
TextEditingController emailController = TextEditingController();
TextEditingController editNameController = TextEditingController();
TextEditingController editDesignationController = TextEditingController();
TextEditingController editMobileNumberController = TextEditingController();
TextEditingController editAlternativeMobileController = TextEditingController();
TextEditingController editTelephoneController = TextEditingController();
TextEditingController editEmailController = TextEditingController();
TextEditingController dateController = TextEditingController();
TextEditingController noteController = TextEditingController();
String? _nameError;
String? _designationError;
String? _mobileNumError;
String? _altMobError;
String? _teleError;
String? _emailError;
String? _noteError;
String? _editNameError;
String? _editDesignationError;
String? _editMobileNumError;
String? _editAltMobError;
String? _editTeleError;
String? _editEmailError;
String? _dateError;
List<String> _headings = [];
List<String> _subHeadings = [];
DateTime? _date;
String? _formattedDate;
List<Leads> get leadList => _leadsList;
List<Contacts> get contactList => _contactsList;
List<Orders> get ordersList => _ordersList;
List<Payments> get paymentsList => _paymentsList;
AccountDetails get accountDetails => _accountDetails;
String? get nameError => _nameError;
String? get designationError => _designationError;
String? get mobileNumError => _mobileNumError;
String? get altMobError => _altMobError;
String? get teleError => _teleError;
String? get emailError => _emailError;
String? get noteError => _noteError;
String? get editNameError => _editNameError;
String? get editDesignationError => _editDesignationError;
String? get editMobileNumError => _editMobileNumError;
String? get editAltMobError => _editAltMobError;
String? get editTeleError => _editTeleError;
String? get editEmailError => _editEmailError;
String? get dateError => _dateError;
bool get isLoading => _isLoading;
List<String> get Headings => _headings;
List<String> get subHeadings => _subHeadings;
String? get formattedDate => _formattedDate;
set nameError(String? value){
_nameError = value;
notifyListeners();
}
set designationError(String? value){
_designationError = value;
notifyListeners();
}
set mobileNumError(String? value){
_mobileNumError = value;
notifyListeners();
}
set altMobError(String? value){
_altMobError = value;
notifyListeners();
}
set teleError(String? value){
_teleError = value;
notifyListeners();
}
set emailError(String? value){
_emailError = value;
notifyListeners();
}
set noteError(String? value){
_noteError = value;
notifyListeners();
}
set editNameError(String? value){
_editNameError = value;
notifyListeners();
}
set editDesignationError(String? value){
_editDesignationError = value;
notifyListeners();
}
set editMobileNumError(String? value){
_editMobileNumError = value;
notifyListeners();
}
set editAltMobError(String? value){
_editAltMobError = value;
notifyListeners();
}
set editTeleError(String? value){
_editTeleError = value;
notifyListeners();
}
set editEmailError(String? value){
_editEmailError = value;
notifyListeners();
}
set isLoading(bool value){
_isLoading = value;
notifyListeners();
}
set formattedDate(String? value) {
_formattedDate = value;
dateController.text = _formattedDate!;
_dateError = null;
notifyListeners();
}
set dateError(value){
_dateError = value;
notifyListeners();
}
void setDate(DateTime newDate) {
_date = newDate;
_formattedDate = DateFormat('yyyy-MM-dd').format(newDate);
dateController.text = _formattedDate!;
_dateError = null;
notifyListeners();
}
Future<void> crmProspectDetailsAPIFunction(context, leadID) async {
try {
var HomeProv = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmProspectDetailsAPI(
HomeProv.empId,
HomeProv.session,
leadID,
);
_isLoading = true;
notifyListeners();
if (data != null) {
if (data.error == "0") {
_leadsList = data.leads!;
_accountDetails = data.accountDetails!;
_contactsList =data.contacts!;
_ordersList = data.orders!;
_paymentsList = data.payments!;
_headings = [
"Company Name",
"Address",
"Account Manager Name",
"Account Created By",
"State",
"District",
"Sub Locality",
"Pincode",
"Source",
"Reference",
"Team",
"Segment",
"Account Age",
];
_subHeadings = [
data.accountDetails!.name??"-",
data.accountDetails!.address??"-",
data.accountDetails!.accManager??"-",
data.accountDetails!.owner??"-",
data.accountDetails!.state??"-",
data.accountDetails!.district??"-",
data.accountDetails!.subLocality??"-",
data.accountDetails!.pincode??"-",
data.accountDetails!.source??"-",
data.accountDetails!.reference??"-",
data.accountDetails!.team??"-",
data.accountDetails!.segment??"-",
"${data.accountDetails!.aage ?? "-"} days old",
];
_isLoading = false;
notifyListeners();
}else{
_isLoading = false;
notifyListeners();
}
}else{
_isLoading = false;
notifyListeners();
}
} catch (e, s) {
_isLoading = false;
notifyListeners();
}
}
Future<void> crmProspectDetailsAddContactAPIFunction(context, accID) async {
try {
var prov = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmProspectDetailsAddAccountAPI(prov.empId, prov.session, accID,
nameController.text, mobileNumberController.text, designationController.text, alternativeMobileController.text, telephoneController.text, emailController.text);
_isLoading = true;
notifyListeners();
if (data != null) {
if (data.error == "0") {
Navigator.pop(context,true);
resetAll();
_isLoading = false;
notifyListeners();
}else{
_isLoading = false;
notifyListeners();
}
}else{
_isLoading = false;
notifyListeners();
}
} catch (e, s) {
_isLoading = false;
notifyListeners();
}
}
Future<void> crmProspectDetailsEditContactAPIFunction(context,contactID,accID) async {
try {
var prov = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmProspectDetailsEditContactAPI(prov.empId, prov.session, contactID,
nameController.text,accID, mobileNumberController.text, designationController.text, alternativeMobileController.text, telephoneController.text, emailController.text);
_isLoading = true;
notifyListeners();
if (data != null) {
if (data.error == "0") {
_isLoading = false;
Navigator.pop(context,true);
resetAll();
_isLoading = false;
notifyListeners();
}else{
_isLoading = false;
notifyListeners();
}
}else{
_isLoading = false;
notifyListeners();
}
} catch (e, s) {
_isLoading = false;
notifyListeners();
}
}
void showDatePickerDialog(BuildContext context) {
showCupertinoModalPopup<void>(
context: context,
builder:
(BuildContext context) => Container(
height: 216,
padding: const EdgeInsets.only(top: 6.0),
margin: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
),
color: CupertinoColors.systemBackground.resolveFrom(context),
child: SafeArea(
top: false,
child: Column(
children: [
Expanded(
flex: 1,
child: SizedBox(
height: 40,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
CupertinoButton(
child: Text(
'Cancel',
style: TextStyle(fontFamily: "JakartaMedium"),
),
onPressed: () {
Navigator.pop(context);
},
),
CupertinoButton(
child: Text(
'Done',
style: TextStyle(fontFamily: "JakartaMedium"),
),
onPressed: () {
Navigator.pop(context);
},
),
],
),
),
),
Expanded(
flex: 3,
child: CupertinoDatePicker(
initialDateTime: _date ?? DateTime.now(),
mode: CupertinoDatePickerMode.date,
use24hFormat: true,
showDayOfWeek: true,
onDateTimeChanged: (DateTime newDate) {
setDate(newDate);
},
),
),
],
),
),
),
);
}
void onChangeName(value){
_nameError = "";
notifyListeners();
}
void onChangeDesignation(value){
_designationError = "";
notifyListeners();
}
void onChangeMobile(value){
_mobileNumError = "";
notifyListeners();
}
void onChangeAltMobile(value){
_altMobError = "";
notifyListeners();
}
void onChangeTelephone(value){
_teleError = "";
notifyListeners();
}
void onChangeEmailId(value){
_emailError = "";
notifyListeners();
}
void onChangeEditName(value){
_editNameError = "";
notifyListeners();
}
void onChangeEditDesignation(value){
_editDesignationError = "";
notifyListeners();
}
void onChangeEditMobile(value){
_editMobileNumError = "";
notifyListeners();
}
void onChangeEditAltMobile(value){
_editAltMobError = "";
notifyListeners();
}
void onChangeEditTelephone(value){
_editTeleError = "";
notifyListeners();
}
void onChangeEditEmailId(value){
_editEmailError = "";
notifyListeners();
}
void onChangeNote(value){
_noteError = "";
notifyListeners();
}
void resetAll(){
nameController.clear();
designationController.clear();
mobileNumberController.clear();
alternativeMobileController.clear();
telephoneController.clear();
emailController.clear();
editNameController.clear();
editDesignationController.clear();
editMobileNumberController.clear();
editAlternativeMobileController.clear();
editTelephoneController.clear();
editEmailController.clear();
_nameError = "";
_designationError = "";
_mobileNumError = "";
_altMobError = "";
_teleError = "";
_emailError = "";
_editNameError = "";
_editDesignationError = "";
_editMobileNumError = "";
_editAltMobError = "";
_editTeleError = "";
_editEmailError = "";
notifyListeners();
}
}
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:generp/Models/ordersModels/ordersDetailsEditOrderViewResponse.dart';
import 'package:generp/Utils/commonServices.dart';
import 'package:image_picker/image_picker.dart';
import 'package:provider/provider.dart';
import '../../Models/commonModels/DistrictsResponse.dart';
import '../../Models/commonModels/SubLocationsResponse.dart';
import '../../services/api_calling.dart';
import '../HomeScreenNotifier.dart';
class Editorderprovider extends ChangeNotifier {
TextEditingController dispatchPincodeController = TextEditingController();
TextEditingController dispatchAddressController = TextEditingController();
TextEditingController noteController = TextEditingController();
String? dispatchAddressError;
String? dispatchPincodeError;
String? noteError;
List<States> _dispatchStates = [];
List<Districts> _dispatchDistricts = [];
List<SubLocations> _dispatchSubLocations = [];
List<String> _unloadingScope = [];
List<String> _freightScope = [];
List<String> _erectionScope = [];
OrderDetails _orderDetails = OrderDetails();
States? _selectedDispatchStates;
String? _selectedDispatchStateID;
String? _selectedDispatchStateName;
Districts? _selectedDispatchDistricts;
String? _selectedDispatchDistrictID;
String? _selectedDispatchDistrictValue;
SubLocations? _selectedDispatchSubLocations;
String? _selectedDispatchSubLocID;
String? _selectedDispatchSubLocValue;
String? _selectedUnloadingScope;
String? _selectedFreightScope;
String? _selectedErectionScope;
int image_picked = 0;
String? FileError;
String? dateError;
bool _isLoading = false;
int _imagePicked = 0;
File? _image;
File? _imageName;
final ImagePicker _picker = ImagePicker();
bool _submitClicked = false;
File? get imagePath => _imageName;
File? get imageFilePath => _image;
int get imagePicked => _imagePicked;
List<String> get unloadingScope => _unloadingScope;
List<String> get freightScope => _freightScope;
List<String> get erectionScope => _erectionScope;
String? get selectedUnloadingScope => _selectedUnloadingScope;
String? get selectedFreightScope => _selectedFreightScope;
String? get selectedErectionScope => _selectedErectionScope;
bool get submitClicked => _submitClicked;
List<States> get dispatchStates => _dispatchStates;
States? get selecetdDispatchStates => _selectedDispatchStates;
String? get selectedDispatchStateID => _selectedDispatchStateID;
String? get selectedDispatchStateName => _selectedDispatchStateName;
List<Districts> get dispatchDistricts => _dispatchDistricts;
List<SubLocations> get dispatchSubLocations => _dispatchSubLocations;
Districts? get selectedDispatchDistricts => _selectedDispatchDistricts;
String? get selectedDispatchDistrictId => _selectedDispatchDistrictID;
String? get selectedDispatchDistrictValue => _selectedDispatchDistrictValue;
SubLocations? get selectedDispatchSubLocations =>
_selectedDispatchSubLocations;
String? get selectedDispatchSubLocID => _selectedDispatchSubLocID;
String? get selectedDispatchSubLocValue => _selectedDispatchSubLocValue;
OrderDetails get orderDetails =>_orderDetails;
set imagePath(File? value) {
_imageName = value;
notifyListeners();
}
set imageFilePath(File? value) {
_image = value;
notifyListeners();
}
set imagePicked(value) {
_imagePicked = value;
notifyListeners();
}
set selecetdDispatchStates(States? value) {
_selectedDispatchStates = value;
_selectedDispatchStateID = value!.id;
_selectedDispatchStateName = value!.name!;
notifyListeners();
}
set selectedDispatchStateID(String? value) {
_selectedDispatchStateID = value;
notifyListeners();
}
set selectedDispatchStateName(String? value) {
_selectedDispatchStateName = value;
notifyListeners();
}
set selectedDispatchDistricts(Districts? value) {
_selectedDispatchDistricts = value;
_selectedDispatchDistrictID = value!.id;
_selectedDispatchDistrictValue = value!.district;
// districtError = null;
notifyListeners();
}
set selectedDispatchSubLocations(SubLocations? value) {
_selectedDispatchSubLocations = value;
_selectedDispatchSubLocID = value!.id;
_selectedDispatchSubLocValue = value!.subLocality!;
// localityError = null;
notifyListeners();
}
set selectedDispatchDistrictId(value) {
_selectedDispatchDistrictID = value;
notifyListeners();
}
set selectedDispatchDistrictValue(value) {
_selectedDispatchDistrictValue = value;
notifyListeners();
}
set selectedDispatchSubLocID(value) {
_selectedDispatchSubLocID = value;
notifyListeners();
}
set selectedDispatchSubLocValue(value) {
_selectedDispatchSubLocValue = value;
notifyListeners();
}
set submitClicked(bool value){
_submitClicked = value;
notifyListeners();
}
set selectedUnloadingScope(String? value) {
_selectedUnloadingScope = value;
notifyListeners();
}
set selectedFreightScope(String? value) {
_selectedFreightScope = value;
notifyListeners();
}
set selectedErectionScope(String? value) {
_selectedErectionScope = value;
notifyListeners();
}
Future<void> ordersEditOrderAPIViewFunction(context, orderID) async {
try {
final provider = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.ordersDetailsEditOrderViewAPI(
provider.empId,
provider.session,
orderID,
);
if (data != null) {
if (data.error == "0") {
_dispatchStates = data.states!;
_orderDetails = data.orderDetails!;
_erectionScope = ["Excluded","Included","Excluded"];
_unloadingScope = ["Excluded","Included","Excluded"];
_freightScope = ["Included","Included","Excluded"];
notifyListeners();
} else {}
} else {}
} catch (e, s) {}
}
Future<void> getDispatchDistrictAPI(context, stateID) async {
try {
var homeProv = Provider.of<HomescreenNotifier>(context, listen: false);
_dispatchDistricts.clear();
notifyListeners();
final data = await ApiCalling.commonAddAccountViewDistrictAPI(
homeProv.empId,
homeProv.session,
stateID,
);
if (data != null) {
if (data.error == "0") {
_dispatchDistricts = data.districts!;
notifyListeners();
}
}
} catch (e, s) {}
}
Future<void> getDispatchSubLocationAPI(context, districtID) async {
try {
var homeProv = Provider.of<HomescreenNotifier>(context, listen: false);
_dispatchSubLocations.clear();
notifyListeners();
final data = await ApiCalling.commonAddAccountViewSubLocationAPI(
homeProv.empId,
homeProv.session,
districtID,
);
if (data != null) {
if (data.error == "0") {
_dispatchSubLocations = data.subLocations!;
notifyListeners();
}
}
} catch (e, s) {}
}
Future<void> ordersEditOrderAPISubmitFunction(context, orderID, stateID, districtID, subLocID,unloading, freight, erection) async {
try {
_submitClicked = true;
notifyListeners();
final provider = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.ordersDetailsEditOrderSubmitAPI(provider.empId, provider.session, orderID, _image, stateID, districtID, subLocID,
dispatchPincodeController.text, dispatchAddressController.text, unloading, freight, erection, noteController.text);
if (data != null) {
if (data.error == "0") {
_submitClicked = false;
Navigator.pop(context,true);
toast(context, data.message);
notifyListeners();
} else {
_submitClicked = false;
notifyListeners();
}
} else {
_submitClicked = false;
notifyListeners();
}
} catch (e, s) {
_submitClicked = false;
notifyListeners();
}
}
imgFromCamera(context) async {
// Capture a photo
try {
final XFile? galleryImage = await _picker.pickImage(
source: ImageSource.camera,
imageQuality: 50,
);
debugPrint("added");
_image = File(galleryImage!.path);
_imageName = File(galleryImage!.name);
_imagePicked = 1;
FileError = null;
notifyListeners();
} catch (e) {
debugPrint("mmmm: ${e.toString()}");
}
}
imgFromGallery(context) async {
// Pick an image
try {
final XFile? galleryImage = await _picker.pickImage(
source: ImageSource.gallery,
);
final bytes = (await galleryImage?.readAsBytes())?.lengthInBytes;
final kb = bytes! / 1024;
final mb = kb / 1024;
debugPrint("Jenny: bytes:$bytes, kb:$kb, mb: $mb");
_image = File(galleryImage!.path);
_imageName = File(galleryImage!.name);
_imagePicked = 1;
FileError = null;
notifyListeners();
// var file = FlutterImageCompress.compressWithFile(galleryImage!.path);
} catch (e) {
debugPrint("mmmm: ${e.toString()}");
}
}
void onChangedDispatchAddress(value){
dispatchAddressError = "";
notifyListeners();
}
void onChangedDispatchPincode(value){
dispatchPincodeError = "";
notifyListeners();
}
void onChangedNote(value){
noteError = "";
notifyListeners();
}
void resetForm(){
}
}
......@@ -213,6 +213,9 @@ class MyApp extends StatelessWidget {
ChangeNotifierProvider(create: (_) => crmProspectDetailsProvider()),
ChangeNotifierProvider(create: (_) => crmNearbyOpenLeadsProvider()),
ChangeNotifierProvider(create: (_) => Crmgeneratequotationprovider()),
ChangeNotifierProvider(create: (_) => Crmeditprospectaccountprovider()),
ChangeNotifierProvider(create: (_) => Addprospectleadsprovider()),
ChangeNotifierProvider(create: (_) => Editorderprovider()),
],
child: Builder(
builder: (BuildContext context) {
......
import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart';
import 'package:generp/Notifiers/crmProvider/crmEditProspectAccountProvider.dart';
import 'package:generp/Notifiers/crmProvider/crmLeadDetailsProvider.dart';
import 'package:generp/Utils/dropdownTheme.dart';
import 'package:generp/screens/crm/prospectContactDetails.dart';
import 'package:generp/screens/crm/prospectLeadDetails.dart';
import 'package:generp/screens/crm/prospectOrderDetails.dart';
import 'package:generp/screens/crm/prospectPaymentDetails.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import '../../Models/crmModels/GetDistrictOnStateResponse.dart';
import '../../Models/crmModels/GetSubLocOnDistrictResponse.dart';
import '../../Models/crmModels/LeadListViewResponse.dart' show Employees;
import '../../Models/crmModels/crmProspectDetailsEditAccountViewResponse.dart';
import '../../Notifiers/crmProvider/crmProspectDetailsProvider.dart';
import '../../Utils/app_colors.dart';
import '../../Utils/commonWidgets.dart';
class ProspectDetailsByMode extends StatefulWidget {
final mode;
final pageTitleName;
final leadId;
const ProspectDetailsByMode({
super.key,
this.mode,
this.pageTitleName,
this.leadId,
});
@override
State<ProspectDetailsByMode> createState() => ProspectDetailsByModeState();
}
class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
Dropdowntheme ddtheme = Dropdowntheme();
@override
void initState() {
// TODO: implement initState
super.initState();
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
final provider = Provider.of<crmProspectDetailsProvider>(
context,
listen: false,
);
final editProvider = Provider.of<Crmeditprospectaccountprovider>(
context,
listen: false,
);
editProvider.crmLeadListViewAPIFunction(context, widget.mode);
editProvider.crmProspectDetailsEditAccountViewAPIFunction(
context,
widget.leadId,
);
provider.crmProspectDetailsAPIFunction(context, widget.leadId);
});
}
void prefill() async {
final editProvider = Provider.of<Crmeditprospectaccountprovider>(
context,
listen: false,
);
await editProvider.crmProspectDetailsEditAccountViewAPIFunction(
context,
widget.leadId,
);
editProvider.editCompanyNameController.text =
editProvider.accountDetails.name ?? "";
editProvider.addressController.text =
editProvider.accountDetails.address ?? "";
editProvider.pincodeController.text =
editProvider.accountDetails.pincode ?? "";
if (editProvider.salutationList.isNotEmpty &&
editProvider.accountDetails.salutationName != null) {
editProvider.selectedSalutation =
editProvider.salutationList.firstWhere(
(element) => element == editProvider.accountDetails.salutationName,
) ??
editProvider.salutationList.first;
}
// print("States:${editProvider.statesList.toList()}");
if (editProvider.statesList.isNotEmpty &&
editProvider.accountDetails.state != null) {
print(editProvider.accountDetails.state);
final selectedState = editProvider.statesList.firstWhere(
(element) =>
element.id!.trim() == editProvider.accountDetails.state!.trim(),
);
if (selectedState != null) {
editProvider.selectedStates = selectedState;
editProvider.selectedStateId = selectedState.id;
editProvider.selectedStateValue = selectedState.name;
await editProvider.crmLeadListDistrictsOnStateAPIFunction(
context,
widget.mode,
editProvider.selectedStateId,
);
}
}
// Prefill district
if (editProvider.districtsList.isNotEmpty &&
editProvider.accountDetails.district != null) {
final selectedDistrict = editProvider.districtsList.firstWhere(
(element) =>
element.id!.trim() == editProvider.accountDetails.district!.trim(),
);
if (selectedDistrict != null) {
editProvider.selectedDistricts = selectedDistrict;
editProvider.selectedDistrictId = selectedDistrict.id;
editProvider.selectedDistrictValue = selectedDistrict.district;
await editProvider.crmLeadListSubLocOnDistrictAPIFunction(
context,
widget.mode,
editProvider.selectedDistrictId,
);
}
}
if (editProvider.subLocationsList.isNotEmpty &&
editProvider.accountDetails.subLocality != null) {
final selectedSubLocation = editProvider.subLocationsList.firstWhere(
(element) => element.id == editProvider.accountDetails.subLocality,
);
if (selectedSubLocation != null) {
editProvider.selectedSubLocations = selectedSubLocation;
editProvider.selectedSubLocationId = selectedSubLocation.id;
editProvider.selectedSubLocationValue = selectedSubLocation.subLocality;
}
}
print("Company Name: ${editProvider.editCompanyNameController.text}");
print("Pincode: ${editProvider.pincodeController.text}");
print("Address: ${editProvider.addressController.text}");
print("Selected Salutation: ${editProvider.selectedSalutation}");
print("Selected State ID: ${editProvider.selectedStateId}");
print("Selected State Value: ${editProvider.selectedStateValue}");
print("Selected District ID: ${editProvider.selectedDistrictId}");
print("Selected District Value: ${editProvider.selectedDistrictValue}");
print("Selected Sub-Location ID: ${editProvider.selectedSubLocationId}");
print(
"Selected Sub-Location Value: ${editProvider.selectedSubLocationValue}",
);
}
@override
Widget build(BuildContext context) {
return Consumer2<
crmProspectDetailsProvider,
Crmeditprospectaccountprovider
>(
builder: (context, provider, editProvider, child) {
var leadDetails = provider.accountDetails;
return WillPopScope(
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar2(
context,
widget.pageTitleName,
provider.resetAll,
InkResponse(
onTap: () {
_showOptionsSheet(context);
},
child: SvgPicture.asset("assets/svg/ic_more.svg", height: 30),
),
),
backgroundColor: AppColors.scaffold_bg_color,
body: Container(
child: SingleChildScrollView(
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
margin: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
child: Column(
children: [
Row(
children: [
Expanded(
flex: 1,
child: Container(
height: 50,
width: 35,
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Color(0xFFE6F6FF),
borderRadius: BorderRadius.circular(8),
),
child: SvgPicture.asset(
"assets/svg/se_block_head.svg",
),
),
),
SizedBox(width: 10),
Expanded(
flex: 4,
child: SizedBox(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"${leadDetails.salutationName ?? "-"} ${leadDetails.name ?? "-"}",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
),
],
),
),
),
SizedBox(width: 5),
Expanded(
flex: 1,
child: InkResponse(
onTap: () async {
_showTransferAccountSheet(
context,
provider.accountDetails.id!,
);
},
child: Container(
height: 32,
width: 30,
padding: EdgeInsets.all(8.0),
child: SvgPicture.asset(
"assets/svg/crm_transfer_ic.svg",
),
),
),
),
SizedBox(width: 5),
Expanded(
flex: 1,
child: InkResponse(
onTap: () async {
editProvider.checkDropDownValues();
prefill();
await _showEditAccountSheet(
context,
provider.accountDetails.id!,
);
},
child: Container(
height: 32,
width: 30,
padding: EdgeInsets.all(8.0),
child: SvgPicture.asset(
"assets/svg/crm_contact_edit.svg",
),
),
),
),
],
),
Divider(thickness: 0.5, color: Color(0xFFD7D7D7)),
...List.generate(provider.subHeadings.length, (j) {
return Container(
padding: EdgeInsets.symmetric(vertical: 7),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
provider.Headings[j],
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
),
),
Expanded(
child: InkResponse(
child:
provider.Headings[j] == "Lead Age"
? Tooltip(
triggerMode: TooltipTriggerMode.tap,
message:
"${provider.accountDetails.createdDatetime}",
child: Text(
provider.subHeadings[j] == ""
? "-"
: provider.subHeadings[j],
style: TextStyle(
fontSize: 14,
color: Color(0xFF818181),
decorationColor:
AppColors.grey_semi,
decoration:
TextDecoration.underline,
),
),
)
: Text(
provider.subHeadings[j] == ""
? "-"
: provider.subHeadings[j],
style: TextStyle(
fontSize: 14,
color: Color(0xFF818181),
),
),
),
),
],
),
);
}),
],
),
),
),
),
),
onWillPop: () {
return onBackPressed(context);
},
);
},
);
}
Future<void> _showTransferAccountSheet(BuildContext context, accID) {
return showModalBottomSheet(
useSafeArea: true,
isDismissible: true,
isScrollControlled: true,
showDragHandle: true,
backgroundColor: Colors.white,
enableDrag: true,
context: context,
builder: (context) {
return StatefulBuilder(
builder: (context, setState) {
return SafeArea(
child: Consumer<Crmeditprospectaccountprovider>(
builder: (context, editProsProvider, child) {
return Container(
margin: EdgeInsets.only(
bottom: 15,
left: 15,
right: 15,
top: 10,
),
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Align(
alignment: Alignment.topLeft,
child: Text(
"Transfer Account",
style: TextStyle(
color: AppColors.app_blue,
fontSize: 16,
),
),
),
TextWidget(context, "Employee"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<Employees>(
hint: Text(
"Select Source",
style: TextStyle(fontSize: 14),
),
items:
editProsProvider.employeesList
.map(
(slist) =>
DropdownMenuItem<Employees>(
value: slist,
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14,
),
),
),
)
.toList(),
value:
editProsProvider.employeesList.contains(
editProsProvider
.selectedEmployees,
)
? editProsProvider.selectedEmployees
: null,
// value: provider.selectedEmployees,
onChanged: (Employees? value) {
if (value != null) {
if (editProsProvider
.employeesList
.isNotEmpty) {
editProsProvider.selectedEmployees =
value;
editProsProvider.selectedEmployeeId =
value!.id!;
editProsProvider
.selectedEmployeeValue =
value!.name!;
}
}
},
isExpanded: true,
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController:
editProsProvider.searchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(8),
child: TextFormField(
controller:
editProsProvider.searchController,
decoration: InputDecoration(
isDense: true,
contentPadding:
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText: 'Search account...',
border: OutlineInputBorder(
borderRadius:
BorderRadius.circular(8),
),
),
),
),
searchMatchFn: (item, searchValue) {
return item.value?.name
?.toLowerCase()
.contains(
searchValue.toLowerCase(),
) ??
false;
},
),
onMenuStateChange: (isOpen) {
if (!isOpen) {
editProsProvider.searchController
.clear();
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
),
),
InkWell(
onTap:
editProsProvider.isLoading
? null
: () {
editProsProvider.isLoading = true;
editProsProvider
.crmProspectDetailsTransferAccountAPIFunction(
context,
accID,
editProsProvider.selectedEmployeeId,
);
},
child: Container(
alignment: Alignment.center,
height: 45,
margin: EdgeInsets.only(
left: 5.0,
right: 5.0,
top: 5.0,
bottom: 5.0,
),
decoration: BoxDecoration(
color: AppColors.app_blue, //1487C9
borderRadius: BorderRadius.circular(14.0),
),
child: Center(
child:
editProsProvider.isLoading
? CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation(
AppColors.white,
),
)
: Text(
"Submit",
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
),
);
},
),
);
},
);
},
).whenComplete(() {});
}
Future<void> _showEditAccountSheet(BuildContext context, accID) {
return showModalBottomSheet(
useSafeArea: true,
isDismissible: true,
isScrollControlled: true,
showDragHandle: true,
backgroundColor: Colors.white,
enableDrag: true,
context: context,
builder: (context) {
return StatefulBuilder(
builder: (context, setState) {
return SafeArea(
child: Consumer2<Crmeditprospectaccountprovider,crmProspectDetailsProvider>(
builder: (context, provider,prosDetProvider, child) {
return Container(
margin: EdgeInsets.only(
bottom: 15,
left: 15,
right: 15,
top: 10,
),
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(height: 15),
Row(
children: [
Expanded(
child: Text(
"Edit Account Details",
style: TextStyle(
color: AppColors.app_blue,
fontSize: 14,
),
),
),
],
),
TextWidget(context, "Salutation"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<String>(
hint: Text(
"Select Salutation",
style: TextStyle(fontSize: 14),
),
items:
provider.salutationList
.map(
(slist) =>
DropdownMenuItem<String>(
value: slist,
child: Text(
slist,
style: TextStyle(
fontSize: 14,
),
),
),
)
.toList(),
value: provider.selectedSalutation,
onChanged: (String? value) {
if (value != null) {
if (provider
.salutationList
.isNotEmpty) {
provider.selectedSalutation = value;
}
}
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
),
),
errorWidget(context, provider.salutationError),
textControllerWidget(
context,
provider.editCompanyNameController,
"Enter Company Name",
provider.onChangeCompanyName,
TextInputType.text,
false,
null,
),
errorWidget(context, provider.companyNameError),
TextWidget(context, "State"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<States>(
hint: Text(
"Select State",
style: TextStyle(fontSize: 14),
),
items:
provider.statesList
.map(
(slist) =>
DropdownMenuItem<States>(
value: slist,
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14,
),
),
),
)
.toList(),
value:
provider.statesList.contains(
provider.selectedStates,
)
? provider.selectedStates
: null,
onChanged: (States? value) {
if (value != null) {
if (provider.statesList.isNotEmpty) {
provider.selectedStates = value;
provider.selectedStateId = value!.id!;
provider.selectedStateValue =
value!.name!;
if (provider
.districtsList
.isNotEmpty) {
provider.districtsList.clear();
provider.selectedDistricts = null;
provider.selectedDistrictId = null;
provider.selectedDistrictValue = "";
}
provider
.crmLeadListDistrictsOnStateAPIFunction(
context,
widget.mode,
provider.selectedStateId,
);
}
}
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
),
),
TextWidget(context, "District"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<Districts>(
hint: Text(
"Select District",
style: TextStyle(fontSize: 14),
),
items:
provider.districtsList
.map(
(slist) =>
DropdownMenuItem<Districts>(
value: slist,
child: Text(
slist.district!,
style: TextStyle(
fontSize: 14,
),
),
),
)
.toList(),
value:
provider.districtsList.contains(
provider.selectedDistricts,
)
? provider.selectedDistricts
: null,
// value: provider.selectedDistricts,
onChanged: (Districts? value) {
if (value != null) {
if (provider.districtsList.isNotEmpty) {
provider.selectedDistricts = value;
provider.selectedDistrictId =
value!.id!;
provider.selectedDistrictValue =
value!.district!;
if (provider
.subLocationsList
.isNotEmpty) {
provider.subLocationsList.clear();
provider.selectedSubLocations =
null;
provider.selectedSubLocationId =
null;
provider.selectedSubLocationValue =
"";
}
provider
.crmLeadListSubLocOnDistrictAPIFunction(
context,
widget.mode,
provider.selectedDistrictId,
);
prosDetProvider.crmProspectDetailsAPIFunction(context, widget.leadId);
}
}
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
),
),
TextWidget(context, "Sub Location"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<SubLocations>(
hint: Text(
"Select Sub Location",
style: TextStyle(fontSize: 14),
),
items:
provider.subLocationsList
.map(
(slist) => DropdownMenuItem<
SubLocations
>(
value: slist,
child: Text(
slist.subLocality!,
style: TextStyle(
fontSize: 14,
),
),
),
)
.toList(),
value:
provider.subLocationsList.contains(
provider.selectedSubLocations,
)
? provider.selectedSubLocations
: null,
// value: provider.selectedSubLocations,
onChanged: (SubLocations? value) {
if (value != null) {
if (provider
.subLocationsList
.isNotEmpty) {
provider.selectedSubLocations = value;
provider.selectedSubLocationId =
value!.id!;
provider.selectedSubLocationValue =
value!.subLocality!;
}
}
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
),
),
textControllerWidget(
context,
provider.pincodeController,
"Pincode",
provider.onChangePincode,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
),
errorWidget(context, provider.pincodeError),
textControllerWidget(
context,
provider.addressController,
"Enter Address",
provider.onChangeAddress,
TextInputType.text,
false,
null,
),
errorWidget(context, provider.addressError),
InkResponse(
onTap:
provider.isLoading
? null
: () {
provider.isLoading = true;
provider
.crmProspectDetailsEditAccountSubmitAPIFunction(
context,
accID,
provider.selectedSalutation,
provider.selectedStateId,
provider.selectedDistrictId,
provider.selectedSubLocationId,
);
Navigator.pop(context);
},
child: Container(
height: 45,
alignment: Alignment.center,
margin: EdgeInsets.symmetric(horizontal: 10),
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(15),
),
child:
provider.isLoading
? CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation(
AppColors.white,
),
)
: Text(
"Submit",
style: TextStyle(
fontSize: 15,
fontFamily: "JakartaMedium",
color: Colors.white,
),
),
),
),
],
),
),
);
},
),
);
},
);
},
);
}
Future<void> _showOptionsSheet(BuildContext context) {
return showModalBottomSheet(
useSafeArea: true,
isDismissible: true,
isScrollControlled: true,
showDragHandle: true,
backgroundColor: Colors.white,
enableDrag: true,
context: context,
builder: (context) {
return StatefulBuilder(
builder: (context, setState) {
return SafeArea(
child: Consumer<crmLeadDetailsProvider>(
builder: (context, provider, child) {
return Container(
margin: EdgeInsets.only(
bottom: 15,
left: 15,
right: 15,
top: 10,
),
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(height: 15),
...List.generate(4, (index) {
final assetnames = [
"crm_appoint_details",
"crm_cont_details",
"crm_follow_up_details",
"crm_prod_details",
];
final Headingnames = [
"Lead Details",
"Contact Details",
"Order Details",
"Payment Details",
];
return ListTile(
onTap: () {
switch (index) {
case 0:
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => ProspectLeadDetails(
leadID: widget.leadId,
mode: widget.mode,
),
),
);
break;
case 1:
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => ProspectContactDetails(
accountId:
provider.accountDetails.id,
),
),
);
break;
case 2:
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => ProspectOrderDetails(
leadID: widget.leadId,
),
),
);
break;
case 3:
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => ProspectPaymentDetails(
leadID: widget.leadId,
),
),
);
break;
default:
print("object");
}
},
leading: SvgPicture.asset(
"assets/svg/${assetnames[index]}.svg",
),
title: Text(
Headingnames[index],
style: TextStyle(fontFamily: "JakartaMedium"),
),
trailing: SvgPicture.asset(
"assets/svg/arrow_right_new.svg",
),
);
}),
],
),
),
);
},
),
);
},
);
},
);
}
}
......@@ -352,6 +352,44 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
}
},
isExpanded: true,
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController: provider.searchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(8),
child: TextFormField(
controller:
provider
.searchController,
decoration: InputDecoration(
isDense: true,
contentPadding:
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText: 'Search account...',
border: OutlineInputBorder(
borderRadius:
BorderRadius.circular(8),
),
),
),
),
searchMatchFn: (item, searchValue) {
return item.value?.name
?.toLowerCase()
.contains(
searchValue.toLowerCase(),
) ??
false;
},
),
onMenuStateChange: (isOpen) {
if (!isOpen) {
provider.searchController.clear();
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
......
import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:generp/Notifiers/crmProvider/addProspectLeadsProvider.dart';
import 'package:generp/Utils/dropdownTheme.dart';
import 'package:provider/provider.dart';
import '../../Models/crmModels/crmProspectDetailsAddLeadsResponse.dart';
import '../../Utils/app_colors.dart';
import '../../Utils/commonWidgets.dart';
class AddProspectLeads extends StatefulWidget {
final String leadID;
final String mode;
const AddProspectLeads({super.key, required this.leadID, required this.mode});
@override
State<AddProspectLeads> createState() => _AddProspectLeadsState();
}
class _AddProspectLeadsState extends State<AddProspectLeads> {
Dropdowntheme ddtheme = Dropdowntheme();
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) async {
final provider = Provider.of<Addprospectleadsprovider>(context, listen: false);
await provider.crmProspectDetailsAddLeadsViewAPIFunction(context, widget.mode);
// Initialize controllers and dropdowns after API call
provider.initializeForm(context);
});
}
@override
Widget build(BuildContext context) {
return Consumer<Addprospectleadsprovider>(
builder: (context, editProvider, child) {
return WillPopScope(
onWillPop: () async {
editProvider.resetForm();
return true;
},
child: Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: AppColors.white,
appBar: appbar2(
context,
"Add Lead",
editProvider.resetForm,
const SizedBox(width: 0),
),
body: Container(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(context, "Employee"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<Employees>(
hint: Text(
"Select Source",
style: TextStyle(fontSize: 14),
),
items:
editProvider.employeeList
.map(
(slist) =>
DropdownMenuItem<Employees>(
value: slist,
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14,
),
),
),
)
.toList(),
value:
editProvider.employeeList.contains(
editProvider
.selectedEmployee,
)
? editProvider.selectedEmployee
: null,
// value: provider.selectedEmployees,
onChanged: (Employees? value) {
if (value != null) {
if (editProvider
.employeeList
.isNotEmpty) {
editProvider.selectedEmployee =
value;
editProvider.selectedEmployeeId =
value!.id!;
editProvider
.selectedEmployeeValue =
value!.name!;
}
}
},
isExpanded: true,
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController:
editProvider.searchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(8),
child: TextFormField(
controller:
editProvider.searchController,
decoration: InputDecoration(
isDense: true,
contentPadding:
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText: 'Search account...',
border: OutlineInputBorder(
borderRadius:
BorderRadius.circular(8),
),
),
),
),
searchMatchFn: (item, searchValue) {
return item.value?.name
?.toLowerCase()
.contains(
searchValue.toLowerCase(),
) ??
false;
},
),
onMenuStateChange: (isOpen) {
if (!isOpen) {
editProvider.searchController
.clear();
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
),
),
InkResponse(
onTap: () {
editProvider.editAddNewRow();
},
child: Container(
margin: const EdgeInsets.symmetric(vertical: 10),
height: 45,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color: const Color(0xFFE6F6FF),
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: AppColors.app_blue,
width: 0.5,
),
),
child: Center(
child: Text(
"+ Add Product",
style: TextStyle(
fontFamily: "JakartaMedium",
color: AppColors.app_blue,
),
),
),
),
),
if (editProvider.leadProductsList.isNotEmpty ||
editProvider.editProductPriceControllers.isNotEmpty)...[
ListView.builder(
itemCount: editProvider.editProductPriceControllers.length,
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, j) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),
margin: const EdgeInsets.symmetric(vertical: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(context, "Product"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<Products>(
isExpanded: true,
hint: const Text(
'Select Product',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items: editProvider.leadProductsList
.map((ord) => DropdownMenuItem<Products>(
value: ord,
child: Text(
"(Product Name: ${ord.name})",
style: const TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
))
.toList(),
value: editProvider.selectedProductIds[j] != null
? editProvider.leadProductsList.firstWhere(
(ord) => ord.id == editProvider.selectedProductIds[j],
orElse: () => editProvider.leadProductsList[0],
)
: null,
onChanged: (Products? value) {
if (value != null) {
editProvider.updateSelectedProductIds(j, value);
editProvider.selectedProductIds[j] =
value.id?.toString() ?? '';
editProvider.updateTotalAmount(j);
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
),
),
],
),
),
const SizedBox(height: 10),
Row(
children: [
Expanded(
flex: 2,
child: textControllerWidget(
context,
editProvider.editProductPriceControllers[j],
"Enter Product Price",
(value) => editProvider.updateTotalAmount(j),
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
),
),
],
),
const SizedBox(height: 10),
Row(
children: [
Expanded(
flex: 2,
child: textControllerWidget(
context,
editProvider.editQuantityControllers[j],
"Enter Quantity",
(value) => editProvider.updateTotalAmount(j),
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
),
),
],
),
const SizedBox(height: 10),
Row(
children: [
Expanded(
flex: 2,
child: textControllerWidget(
context,
editProvider.editTotalAmountControllers[j],
"Total Amount",
(_) {},
TextInputType.number,
true,
FilteringTextInputFormatter.digitsOnly,
),
),
],
),
],
),
);
},
),
],
TextWidget(context, "Status"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<String>(
hint: Text(
"Select Salutation",
style: TextStyle(fontSize: 14),
),
items:
editProvider.statusList
.map(
(slist) =>
DropdownMenuItem<String>(
value: slist,
child: Text(
slist,
style: TextStyle(
fontSize: 14,
),
),
),
)
.toList(),
value: editProvider.selectedStatus,
onChanged: (String? value) {
if (value != null) {
if (editProvider
.statusList
.isNotEmpty) {
editProvider.selectedStatus = value;
}
}
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
),
),
],
),
),
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
bottomNavigationBar: InkResponse(
onTap: editProvider.submitLoading
? null
: () {
editProvider.submitForm(context,widget.mode,widget.leadID,editProvider.selectedEmployeeId,editProvider.selectedStatus);
// editProvider.crmProspectDetailsAddLeadsSubmitAPIFunction(context, mode, account_id, acc_manager_id, products, lead_status)
},
child: Container(
height: 45,
alignment: Alignment.center,
margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 15),
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(15),
),
child: editProvider.submitLoading
? CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation<Color>(AppColors.app_blue),
)
: const Text(
"Submit",
style: TextStyle(
fontSize: 15,
fontFamily: "JakartaMedium",
color: Colors.white,
),
),
),
),
),
);
},
);
}
}
\ No newline at end of file
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart';
import 'package:generp/Notifiers/crmProvider/crmProspectDetailsProvider.dart';
import 'package:provider/provider.dart';
import '../../Utils/app_colors.dart';
import '../../Utils/commonWidgets.dart';
class ProspectContactDetails extends StatefulWidget {
final accountId;
const ProspectContactDetails({super.key,required this.accountId});
@override
State<ProspectContactDetails> createState() => _ProspectContactDetailsState();
}
class _ProspectContactDetailsState extends State<ProspectContactDetails> {
@override
Widget build(BuildContext context) {
return Consumer<crmProspectDetailsProvider>(
builder: (context, provider, child) {
var customerDetails = provider.contactList;
return WillPopScope(
onWillPop: () => onBackPressed(context),
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar(context, "Contact Details"),
backgroundColor: AppColors.scaffold_bg_color,
body: SafeArea(
child: SizedBox(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(context, "Contact Details"),
ListView.builder(
itemCount: customerDetails.length,
shrinkWrap: true,
itemBuilder: (context, index) {
return Container(
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
padding: EdgeInsets.symmetric(
horizontal: 15,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Expanded(
flex: 1,
child: Container(
height: 50,
width: 35,
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Color(0xFFE6F6FF),
borderRadius: BorderRadius.circular(
8,
),
),
child: SvgPicture.asset(
"assets/svg/crm_contact_profile.svg",
),
),
),
SizedBox(width: 10),
Expanded(
flex: 4,
child: SizedBox(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
customerDetails[index].name ??
"-",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
),
],
),
),
),
SizedBox(width: 10),
Expanded(
flex: 1,
child: InkResponse(
onTap: () {
provider.editNameController.text = customerDetails[index].name??"";
provider.editDesignationController.text = customerDetails[index].designation??"";
provider.editMobileNumberController.text = customerDetails[index].mob1??"";
provider.editAlternativeMobileController.text = customerDetails[index].mob2??"";
provider.editTelephoneController.text = customerDetails[index].tel??"";
provider.editEmailController.text = customerDetails[index].email??"";
_showEditContactSheet(context, index,provider.accountDetails.id!);
},
child: Container(
height: 35,
width: 30,
padding: EdgeInsets.all(8.0),
child: SvgPicture.asset(
"assets/svg/crm_contact_edit.svg",
),
),
),
),
],
),
Divider(
thickness: 0.5,
color: Color(0xFFD7D7D7),
),
...List.generate(5, (j) {
final textheads = [
"Mobile",
"Alternate Mobile",
"Telephone Number",
"Email",
"Designation",
];
final textSubheads = [
customerDetails[index].mob1 ?? "-",
customerDetails[index].mob2 ?? "-",
customerDetails[index].tel ?? "-",
customerDetails[index].email ?? "-",
customerDetails[index].designation ?? "-",
];
return Container(
padding: EdgeInsets.symmetric(
vertical: 6,
horizontal: 0,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
textheads[j].toString(),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
Expanded(
child: Text(
textSubheads[j] == ""
? "-"
: textSubheads[j],
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFF818181),
),
),
),
],
),
);
}),
],
),
);
},
),
SizedBox(height: 75),
],
),
),
),
),
floatingActionButton: Align(
alignment: Alignment.bottomCenter,
child: InkWell(
onTap: () {
_showAddContactSheet(context,provider.accountDetails.id!);
},
child: Container(
alignment: Alignment.bottomCenter,
height: 45,
width: MediaQuery.of(context).size.width,
margin: EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(14.0),
),
child: Center(
child: Text(
"Add Contact",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontFamily: "JakartaMedium",
),
),
),
),
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation.centerFloat,
),
);
},
);
}
Future<void> _showAddContactSheet(BuildContext context,accID) {
return showModalBottomSheet(
useSafeArea: true,
isDismissible: true,
isScrollControlled: true,
showDragHandle: true,
backgroundColor: Colors.white,
enableDrag: true,
context: context,
builder: (context) {
return StatefulBuilder(
builder: (context, setState) {
return SafeArea(
child: Consumer<crmProspectDetailsProvider>(
builder: (context, provider, child) {
return Container(
margin: EdgeInsets.only(
bottom: 15,
left: 15,
right: 15,
top: 10,
),
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Align(
alignment: Alignment.topLeft,
child: Text(
"Add Contact",
style: TextStyle(
color: AppColors.app_blue,
fontSize: 16,
),
),
),
textControllerWidget(
context,
provider.nameController,
"Enter Name",
provider.onChangeName,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
),
errorWidget(context, provider.nameError),
textControllerWidget(
context,
provider.designationController,
"Enter Designation",
provider.onChangeDesignation,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
),
errorWidget(context, provider.designationError),
textControllerWidget(
context,
provider.mobileNumberController,
"Enter Mobile Number",
provider.onChangeMobile,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
),
errorWidget(context, provider.mobileNumError),
textControllerWidget(
context,
provider.alternativeMobileController,
"Enter Alternative Mobile Number",
provider.onChangeAltMobile,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
),
errorWidget(context, provider.altMobError),
textControllerWidget(
context,
provider.telephoneController,
"Enter Telephone Number",
provider.onChangeTelephone,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
),
errorWidget(context, provider.teleError),
textControllerWidget(
context,
provider.emailController,
"Enter EmailID",
provider.onChangeEmailId,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
),
errorWidget(context, provider.emailError),
InkWell(
onTap: provider.isLoading?null:(){
provider.isLoading = true;
provider.crmProspectDetailsAddContactAPIFunction(context, accID);
},
child: Container(
alignment: Alignment.center,
height: 45,
margin: EdgeInsets.only(
left: 5.0,
right: 5.0,
top: 5.0,
bottom: 5.0,
),
decoration: BoxDecoration(
color: AppColors.app_blue, //1487C9
borderRadius: BorderRadius.circular(14.0),
),
child: Center(
child: provider.isLoading?CircularProgressIndicator.adaptive(valueColor: AlwaysStoppedAnimation(AppColors.white),):Text(
"Submit",
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
),
);
},
),
);
},
);
},
);
}
Future<void> _showEditContactSheet(BuildContext context, index,accid) {
return showModalBottomSheet(
useSafeArea: true,
isDismissible: true,
isScrollControlled: true,
showDragHandle: true,
backgroundColor: Colors.white,
enableDrag: true,
context: context,
builder: (context) {
return StatefulBuilder(
builder: (context, setState) {
return SafeArea(
child: Consumer<crmProspectDetailsProvider>(
builder: (context, provider, child) {
return Container(
margin: EdgeInsets.only(
bottom: 15,
left: 15,
right: 15,
top: 10,
),
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Align(
alignment: Alignment.topLeft,
child: Text(
"Edit Contact",
style: TextStyle(
color: AppColors.app_blue,
fontSize: 16,
),
),
),
textControllerWidget(
context,
provider.editNameController,
"Enter Name",
provider.onChangeEditName,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
),
errorWidget(context, provider.editNameError),
textControllerWidget(
context,
provider.editDesignationController,
"Enter Designation",
provider.onChangeEditDesignation,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
),
errorWidget(context, provider.editDesignationError),
textControllerWidget(
context,
provider.editMobileNumberController,
"Enter Mobile Number",
provider.onChangeEditMobile,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
),
errorWidget(context, provider.editMobileNumError),
textControllerWidget(
context,
provider.editAlternativeMobileController,
"Enter Alternative Mobile Number",
provider.onChangeEditAltMobile,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
),
errorWidget(context, provider.editAltMobError),
textControllerWidget(
context,
provider.editTelephoneController,
"Enter Telephone Number",
provider.onChangeEditTelephone,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
),
errorWidget(context, provider.editTeleError),
textControllerWidget(
context,
provider.editEmailController,
"Enter EmailID",
provider.onChangeEditEmailId,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
),
errorWidget(context, provider.editEmailError),
InkWell(
onTap: provider.isLoading?null:(){
provider.isLoading = true;
provider.crmProspectDetailsEditContactAPIFunction(context, provider.contactList[index].id,accid);
},
child: Container(
alignment: Alignment.center,
height: 45,
margin: EdgeInsets.only(
left: 5.0,
right: 5.0,
top: 5.0,
bottom: 5.0,
),
decoration: BoxDecoration(
color: AppColors.app_blue, //1487C9
borderRadius: BorderRadius.circular(14.0),
),
child: Center(
child: provider.isLoading?CircularProgressIndicator.adaptive(valueColor: AlwaysStoppedAnimation(AppColors.white),):Text(
"Submit",
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
),
);
},
),
);
},
);
},
);
}
}
import 'package:flutter/material.dart';
import 'package:generp/Notifiers/crmProvider/crmProspectDetailsProvider.dart';
import 'package:generp/screens/crm/LeadDetailsByMode.dart';
import 'package:provider/provider.dart';
import '../../Utils/app_colors.dart';
import '../../Utils/commonWidgets.dart';
import 'addProspectLeads.dart';
class ProspectLeadDetails extends StatefulWidget {
final leadID;
final mode;
const ProspectLeadDetails({super.key,required this.leadID,required this.mode});
@override
State<ProspectLeadDetails> createState() => _ProspectLeadDetailsState();
}
class _ProspectLeadDetailsState extends State<ProspectLeadDetails> {
@override
void initState() {
// TODO: implement initState
super.initState();
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
final provider = Provider.of<crmProspectDetailsProvider>(
context,
listen: false,
);
});
}
@override
Widget build(BuildContext context) {
return Consumer<crmProspectDetailsProvider>(
builder: (context, provider, child) {
var customerDetails = provider.leadList;
return WillPopScope(
onWillPop: () => onBackPressed(context),
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar(context, "Lead Details"),
backgroundColor: AppColors.scaffold_bg_color,
body: SafeArea(
child: SizedBox(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(context, "Lead Details"),
ListView.builder(
itemCount: customerDetails.length,
shrinkWrap: true,
itemBuilder: (context, index) {
return Container(
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
padding: EdgeInsets.symmetric(
horizontal: 15,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: List.generate(5, (j) {
final textheads = [
"Lead Id", "Date Created", "Lead Status", "Lead Open / Close", "View Details"
];
final textSubheads = [
customerDetails[index].id ?? "-",
customerDetails[index].date ?? "-",
customerDetails[index].status ?? "-",
customerDetails[index].openStatus ?? "-",
"View",
];
return Container(
padding: EdgeInsets.symmetric(
vertical: 6,
horizontal: 0,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
flex: 2,
child: Text(
textheads[j].toString(),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
if(textSubheads[j]=="View")...[
Expanded(
flex: 3,
child: InkResponse(
onTap:()async{
var res = await Navigator.push(context, MaterialPageRoute(builder: (context) => LeadDetailsByMode(mode: "", pageTitleName: "Lead Details", leadId: widget.leadID),));
if(res==true){
provider.crmProspectDetailsAPIFunction(context, widget.leadID);
}
},
child: Text(
textSubheads[j]==""?"-":textSubheads[j],
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: AppColors.app_blue,
decorationColor: AppColors.app_blue,
decoration: TextDecoration.underline
),
),
),
),
]else...[
Expanded(
flex: 3,
child: Text(
textSubheads[j]==""?"-":textSubheads[j],
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFF818181),
),
),
),
]
],
),
);
}),
),
);
},
),
SizedBox(height: 75),
],
),
),
),
),
floatingActionButton: Align(
alignment: Alignment.bottomCenter,
child: InkWell(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => AddProspectLeads(leadID: widget.leadID,mode: widget.mode,),
),
);
if (res == true) {
provider.crmProspectDetailsAPIFunction(
context,
widget.leadID,
);
}
},
child: Container(
alignment: Alignment.bottomCenter,
height: 45,
width: MediaQuery.of(context).size.width,
margin: EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(14.0),
),
child: Center(
child: Text(
"Add Lead",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontFamily: "JakartaMedium",
),
),
),
),
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation.centerFloat,
),
);
},
);
}
}
import 'package:flutter/material.dart';
import 'package:generp/screens/order/ordersDetailsByModes.dart';
import 'package:provider/provider.dart';
import '../../Notifiers/crmProvider/crmProspectDetailsProvider.dart';
import '../../Utils/app_colors.dart';
import '../../Utils/commonWidgets.dart';
class ProspectOrderDetails extends StatefulWidget {
final leadID;
const ProspectOrderDetails({super.key,required this.leadID});
@override
State<ProspectOrderDetails> createState() => _ProspectOrderDetailsState();
}
class _ProspectOrderDetailsState extends State<ProspectOrderDetails> {
@override
void initState() {
// TODO: implement initState
super.initState();
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
final provider = Provider.of<crmProspectDetailsProvider>(
context,
listen: false,
);
});
}
@override
Widget build(BuildContext context) {
return Consumer<crmProspectDetailsProvider>(
builder: (context, provider, child) {
var customerDetails = provider.ordersList;
return WillPopScope(
onWillPop: () => onBackPressed(context),
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar(context, "Order Details"),
backgroundColor: AppColors.scaffold_bg_color,
body: SafeArea(
child: SizedBox(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(context, "Order Details"),
ListView.builder(
itemCount: customerDetails.length,
shrinkWrap: true,
itemBuilder: (context, index) {
return Container(
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
padding: EdgeInsets.symmetric(
horizontal: 15,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: List.generate(4, (j) {
final textheads = [
"Order Id",
"Date Created",
"Order Status",
"View Details",
];
final textSubheads = [
customerDetails[index].id ?? "-",
customerDetails[index].createdDatetime ?? "-",
customerDetails[index].status ?? "-",
"View",
];
return Container(
padding: EdgeInsets.symmetric(
vertical: 6,
horizontal: 0,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
flex: 2,
child: Text(
textheads[j].toString(),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
if (textSubheads[j] == "View") ...[
Expanded(
flex: 3,
child: InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
Ordersdetailsbymodes(
mode: "",
pageTitleName:
"Order Details",
orderId:
widget.leadID,
),
),
);
if (res == true) {
provider
.crmProspectDetailsAPIFunction(
context,
widget.leadID,
);
}
},
child: Text(
textSubheads[j] == ""
? "-"
: textSubheads[j],
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: AppColors.app_blue,
decorationColor:
AppColors.app_blue,
decoration:
TextDecoration.underline,
),
),
),
),
] else ...[
Expanded(
flex: 3,
child: Text(
textSubheads[j] == ""
? "-"
: textSubheads[j],
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFF818181),
),
),
),
],
],
),
);
}),
),
);
},
),
SizedBox(height: 75),
],
),
),
),
),
),
);
},
);
}
}
import 'package:flutter/material.dart';
import 'package:generp/screens/order/paymentDetailsByMode.dart';
import 'package:provider/provider.dart';
import '../../Notifiers/crmProvider/crmProspectDetailsProvider.dart';
import '../../Utils/app_colors.dart';
import '../../Utils/commonWidgets.dart';
class ProspectPaymentDetails extends StatefulWidget {
final leadID;
const ProspectPaymentDetails({super.key, required this.leadID});
@override
State<ProspectPaymentDetails> createState() => _ProspectPaymentDetailsState();
}
class _ProspectPaymentDetailsState extends State<ProspectPaymentDetails> {
@override
void initState() {
// TODO: implement initState
super.initState();
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
final provider = Provider.of<crmProspectDetailsProvider>(
context,
listen: false,
);
});
}
@override
Widget build(BuildContext context) {
return Consumer<crmProspectDetailsProvider>(
builder: (context, provider, child) {
var customerDetails = provider.paymentsList;
return WillPopScope(
onWillPop: () => onBackPressed(context),
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar(context, "Payment Details"),
backgroundColor: AppColors.scaffold_bg_color,
body: SafeArea(
child: SizedBox(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(context, "Payment Details"),
ListView.builder(
itemCount: customerDetails.length,
shrinkWrap: true,
itemBuilder: (context, index) {
return Container(
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
padding: EdgeInsets.symmetric(
horizontal: 15,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: List.generate(6, (j) {
final textheads = [
"Mode of Payment",
"Payment Reference",
"Amount",
"Entered By Employee",
"Payment Received Date",
"Action"
];
final textSubheads = [
customerDetails[index].paymentType ?? "-",
customerDetails[index].refNo ?? "-",
customerDetails[index].amount ?? "-",
customerDetails[index].employeeName ?? "-",
customerDetails[index].paymentDate ?? "-",
"View Details",
];
return Container(
padding: EdgeInsets.symmetric(
vertical: 6,
horizontal: 0,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
flex: 2,
child: Text(
textheads[j].toString(),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
if (textSubheads[j] == "View Details") ...[
Expanded(
flex: 3,
child: InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
Paymentdetailsbymode(
mode: "",
pageTitleName:
"Payment Details",
paymentId:
customerDetails[index]
.id,
),
),
);
if (res == true) {
provider
.crmProspectDetailsAPIFunction(
context,
widget.leadID,
);
}
},
child: Text(
textSubheads[j] == ""
? "-"
: textSubheads[j],
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: AppColors.app_blue,
decorationColor:
AppColors.app_blue,
decoration:
TextDecoration.underline,
),
),
),
),
] else
...[
Expanded(
flex: 3,
child: Text(
textSubheads[j] == ""
? "-"
: textSubheads[j],
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFF818181),
),
),
),
],
],
),
);
}),
),
);
},
),
SizedBox(height: 75),
],
),
),
),
),
),
);
},
);
}
}
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