ui fixes
This commit is contained in:
parent
92f0b2dc73
commit
9f3b22200f
@ -126,7 +126,7 @@ class claimListState extends ConsumerState<claimList> {
|
||||
return (item['reg_no'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['insurer_name'] ?? '-').toLowerCase().contains(
|
||||
(item['insurer_short_name'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['policy_no'] ?? '-').toLowerCase().contains(
|
||||
@ -289,7 +289,7 @@ class claimListState extends ConsumerState<claimList> {
|
||||
keys: [
|
||||
"sno", // handled internally as i + 1
|
||||
"reg_no",
|
||||
"insurer_name",
|
||||
"insurer_short_name",
|
||||
"policy_no",
|
||||
"policy_end_date",
|
||||
"claim_number",
|
||||
@ -398,7 +398,7 @@ class claimListState extends ConsumerState<claimList> {
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
flex: 1,
|
||||
child: Text('S.No.', style: _headerStyle),
|
||||
),
|
||||
Expanded(
|
||||
@ -410,7 +410,7 @@ class claimListState extends ConsumerState<claimList> {
|
||||
child: Text('Insurer', style: _headerStyle),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
flex: 3,
|
||||
child: Text('Policy No.', style: _headerStyle),
|
||||
),
|
||||
Expanded(
|
||||
@ -524,7 +524,7 @@ class claimListState extends ConsumerState<claimList> {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(flex: 2, child: Text('$sno' ?? '-', style: _dataBold)),
|
||||
Expanded(flex: 1, child: Text('$sno' ?? '-', style: _dataBold)),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
@ -535,12 +535,12 @@ class claimListState extends ConsumerState<claimList> {
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
item['insurer_name'] ?? '-', // fallback
|
||||
item['insurer_short_name'] ?? '-', // fallback
|
||||
style: _dataBold,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
flex: 3,
|
||||
child: Text(item['policy_no'] ?? '-', style: _dataBold),
|
||||
),
|
||||
Expanded(
|
||||
|
||||
@ -128,7 +128,7 @@ class endosementState extends ConsumerState<endosement> {
|
||||
return (item['reg_no'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['insurer_name'] ?? '-').toLowerCase().contains(
|
||||
(item['insurer_short_name'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['policy_number'] ?? '-').toLowerCase().contains(
|
||||
@ -285,7 +285,7 @@ class endosementState extends ConsumerState<endosement> {
|
||||
keys: [
|
||||
"sno", // handled internally as i + 1
|
||||
"reg_no",
|
||||
"insurer_name",
|
||||
"insurer_short_name",
|
||||
"policy_number",
|
||||
"endorsement_type_value",
|
||||
"endorsement_no",
|
||||
@ -397,7 +397,7 @@ class endosementState extends ConsumerState<endosement> {
|
||||
child: Text('Vehicle.No.', style: _headerStyle),
|
||||
),
|
||||
Expanded(
|
||||
flex: 4,
|
||||
flex: 2,
|
||||
child: Text('Insurer', style: _headerStyle),
|
||||
),
|
||||
Expanded(
|
||||
@ -523,9 +523,9 @@ class endosementState extends ConsumerState<endosement> {
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 4,
|
||||
flex: 2,
|
||||
child: Text(
|
||||
item['insurer_name'] ?? '-', // fallback
|
||||
item['insurer_short_name'] ?? '-', // fallback
|
||||
style: _dataBold,
|
||||
),
|
||||
),
|
||||
|
||||
@ -278,8 +278,9 @@ class BrokerListState extends ConsumerState<BrokerList> {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
SizedBox(
|
||||
width: 100,
|
||||
// flex: 1,
|
||||
child: Text('S.No.', style: _headerStyle),
|
||||
),
|
||||
Expanded(
|
||||
@ -386,7 +387,11 @@ class BrokerListState extends ConsumerState<BrokerList> {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(flex: 1, child: Text('$sno' ?? '-', style: _dataBold)),
|
||||
SizedBox(
|
||||
width: 100,
|
||||
// flex: 1,
|
||||
child: Text('$sno' ?? '-', style: _dataBold),
|
||||
),
|
||||
Expanded(flex: 1, child: Text(item['name'] ?? '-', style: _dataBold)),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
|
||||
@ -276,12 +276,16 @@ class PaymentLsitState extends ConsumerState<PaymentLsit> {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
// Expanded(
|
||||
// flex: 1,
|
||||
// child: Text('S.No.', style: _headerStyle),
|
||||
// ),
|
||||
SizedBox(
|
||||
width: 50,
|
||||
child: Text('S.No.', style: _headerStyle),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
flex: 1,
|
||||
child: Text('Payment', style: _headerStyle),
|
||||
),
|
||||
|
||||
@ -293,6 +297,14 @@ class PaymentLsitState extends ConsumerState<PaymentLsit> {
|
||||
flex: 1,
|
||||
child: Text('Action', style: _headerStyle),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text('', style: _headerStyle),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text('', style: _headerStyle),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -380,9 +392,10 @@ class PaymentLsitState extends ConsumerState<PaymentLsit> {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(flex: 1, child: Text('$sno' ?? '-', style: _dataBold)),
|
||||
SizedBox(width: 50, child: Text('$sno' ?? '-', style: _dataBold)),
|
||||
// Expanded(flex: 1, child: Text('$sno' ?? '-', style: _dataBold)),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
flex: 1,
|
||||
child: Text(item['value'] ?? '-', style: _dataBold),
|
||||
),
|
||||
Expanded(
|
||||
@ -462,6 +475,8 @@ class PaymentLsitState extends ConsumerState<PaymentLsit> {
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(flex: 1, child: Text('', style: _dataBold)),
|
||||
Expanded(flex: 1, child: Text('', style: _dataBold)),
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -469,7 +484,6 @@ class PaymentLsitState extends ConsumerState<PaymentLsit> {
|
||||
|
||||
static final _dataBold = GoogleFonts.inter(
|
||||
fontSize: 11.5,
|
||||
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Color(0xFF000000),
|
||||
);
|
||||
|
||||
@ -93,6 +93,7 @@ class _PayOutScreenState extends ConsumerState<PayOutScreen> {
|
||||
|
||||
bool isLoading = false;
|
||||
bool isLoadingPOS = false;
|
||||
bool isLoadingEditData = false;
|
||||
late ApiService apiService;
|
||||
dynamic managerId;
|
||||
dynamic userId;
|
||||
@ -229,7 +230,7 @@ class _PayOutScreenState extends ConsumerState<PayOutScreen> {
|
||||
}
|
||||
|
||||
void _loadEditData(String invoiceID, brokerID) async {
|
||||
setState(() => isLoading = true);
|
||||
setState(() => isLoadingEditData = true);
|
||||
print('_loadEditData');
|
||||
|
||||
final jsondata = {
|
||||
@ -351,7 +352,7 @@ class _PayOutScreenState extends ConsumerState<PayOutScreen> {
|
||||
// });
|
||||
}
|
||||
|
||||
setState(() => isLoading = false);
|
||||
setState(() => isLoadingEditData = false);
|
||||
}
|
||||
|
||||
String formatDate(String date) {
|
||||
@ -654,448 +655,461 @@ class _PayOutScreenState extends ConsumerState<PayOutScreen> {
|
||||
|
||||
return MainLayout(
|
||||
title: "Pay Out",
|
||||
body: Container(
|
||||
color: Colors.white,
|
||||
padding: const EdgeInsets.all(8),
|
||||
margin: isEdit
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: MediaQuery.of(context).size.width * 0.1,
|
||||
)
|
||||
: null,
|
||||
child: Column(
|
||||
children: [
|
||||
// const SizedBox(height: 20),
|
||||
Container(
|
||||
height: 40,
|
||||
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: GestureDetector(
|
||||
onTap: null,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Tooltip(
|
||||
message: 'Back',
|
||||
child: IconButton(
|
||||
icon: const Icon(
|
||||
Icons.arrow_left_sharp,
|
||||
size: 25,
|
||||
color: Color(0xFF425B5B),
|
||||
),
|
||||
onPressed: () {
|
||||
context.go(AppRoutes.invoiceList);
|
||||
},
|
||||
splashRadius: 18,
|
||||
hoverColor: Colors.black12,
|
||||
padding: const EdgeInsets.all(4),
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5), // spacing between icon and text
|
||||
Text(
|
||||
"Invoice",
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
|
||||
// 🟢 Status Chip
|
||||
if (isEdit) ...[
|
||||
Spacer(),
|
||||
Text(
|
||||
controllers['invoiceNo']?.text ?? '',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: const Color(0xFF374151),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
Text(
|
||||
// controllers['invoiceDate']?.text ?? '',
|
||||
'(${controllers['invoiceDate']?.text ?? ''})',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w300,
|
||||
color: const Color(0xFF6B7280),
|
||||
),
|
||||
),
|
||||
// SizedBox(width: 10),
|
||||
// Spacer(),
|
||||
SizedBox(width: 10),
|
||||
Text(
|
||||
'Status: ${isPending ? 'Pending' : 'Completed'}',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w300,
|
||||
color: const Color(0xFF6B7280),
|
||||
// color: isPending
|
||||
// ? Colors.blueAccent
|
||||
// : const Color(0xFF047857),
|
||||
),
|
||||
),
|
||||
|
||||
Spacer(),
|
||||
|
||||
ThemedSearchField(
|
||||
hintText: 'Search',
|
||||
|
||||
// backgroundColor: Color(0xFFF6F8F8),
|
||||
onChanged: filterPolicyData,
|
||||
|
||||
controller: _searchStaffController,
|
||||
backgroundColor: Color(0xFFFFFFFF),
|
||||
txtHeight: 30,
|
||||
txtwidth: ResponsiveLayout.isMobile(context)
|
||||
? MediaQuery.of(context).size.width * 0.7
|
||||
: MediaQuery.of(context).size.width * 0.15,
|
||||
),
|
||||
],
|
||||
|
||||
if (!isEdit) ...[
|
||||
const Spacer(),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 6,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFECFDF5), // emerald bg
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"SELECTED POLICIES : ",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: const Color(0xFF065F46),
|
||||
letterSpacing: 0.4,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
// "15",
|
||||
// selectedPolicies.length.toString(),
|
||||
totalPolicies,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: const Color(0xFF047857),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(width: 10),
|
||||
|
||||
// 💰 TOTAL COMMISSION
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 6,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF10B981), // emerald green
|
||||
borderRadius: BorderRadius.circular(22),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: const Color(0xFF10B981).withOpacity(0.25),
|
||||
blurRadius: 6,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.account_balance_wallet_outlined,
|
||||
size: 14,
|
||||
color: Colors.white,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
"TOTAL COMMISSION :",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white.withOpacity(0.9),
|
||||
letterSpacing: 0.4,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
// "₹${_calculateTotalCommission()}",
|
||||
"₹$totalCommission",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// SizedBox(height: 5),
|
||||
if (!isEdit) ...[
|
||||
Container(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: DateFilterRowPayout(
|
||||
formKey: _formKey,
|
||||
// key: ValueKey(SelectedStatus ?? ''),
|
||||
role: roleId,
|
||||
id: userId,
|
||||
selectedParnter: selectedAgentId,
|
||||
selectedBroker: selectedBrokerID,
|
||||
onBrokerChanged: (val) {
|
||||
print('Selected Filterd SselectedBrokerID - $val');
|
||||
setState(() {
|
||||
selectedBrokerID = val; // ✅ parent state updated
|
||||
});
|
||||
},
|
||||
|
||||
onPartnerChanges: (val) {
|
||||
setState(() {
|
||||
selectedAgentId = val; // ✅ parent state updated
|
||||
});
|
||||
},
|
||||
selectedStaffId: '',
|
||||
startController: controllers['startDate']!,
|
||||
endController: controllers['endDate']!,
|
||||
|
||||
isMobile: ResponsiveLayout.isMobile(context),
|
||||
onFilter: () {
|
||||
print(
|
||||
'DATEROw- ${controllers['startDate']!} -${controllers['endDate']!}'
|
||||
' - $selectedAgentId - $selectedBrokerID',
|
||||
);
|
||||
// call your filter logic
|
||||
// filterDateRange();
|
||||
|
||||
loadPolicies();
|
||||
},
|
||||
onRefresh: () {
|
||||
// call your refresh logic
|
||||
refresh();
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 10),
|
||||
],
|
||||
// Policy Selection
|
||||
Card(
|
||||
// color: Colors.amber,
|
||||
body: !isLoadingEditData
|
||||
? Container(
|
||||
color: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
elevation: 0,
|
||||
padding: const EdgeInsets.all(8),
|
||||
margin: isEdit
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: MediaQuery.of(context).size.width * 0.1,
|
||||
)
|
||||
: null,
|
||||
child: Column(
|
||||
children: [
|
||||
AnimatedCrossFade(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
crossFadeState: policyCollapsed
|
||||
? CrossFadeState.showFirst
|
||||
: CrossFadeState.showSecond,
|
||||
firstChild: const SizedBox(),
|
||||
secondChild: Column(
|
||||
children: [
|
||||
_policyTableHeader(), // 🔒 Static header
|
||||
_policyTableBody(), // 🔽 Scrollable rows
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// const SizedBox(height: 20),
|
||||
Container(
|
||||
height: 40,
|
||||
|
||||
if (selectedPolicies.isNotEmpty) ...[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
// color: Colors.amber,
|
||||
color: Color(0xFFf9fafb),
|
||||
// color: Colors.white,
|
||||
child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// ---------------- SELECTED COUNT ----------------
|
||||
Row(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
// selectedPolicies.length.toString(),
|
||||
totalPolicies,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.blueGrey,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
"policies selected",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.blueGrey,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
"|",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.blueGrey,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
"Total Commission",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.blueGrey,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
|
||||
/// NULL-SAFE TOTAL COMMISSION CALCULATION
|
||||
Text(
|
||||
// "₹ ${_calculateTotalCommission()}",
|
||||
"₹ $totalCommission",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.teal,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Spacer(),
|
||||
buildPOS(context),
|
||||
SizedBox(width: 20),
|
||||
// ---------------- BUTTONS ----------------
|
||||
Row(
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: saveInvoice,
|
||||
style: ElevatedButton.styleFrom(
|
||||
// backgroundColor: const Color(0xff45a049),
|
||||
backgroundColor: Colors.teal,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
4,
|
||||
), // 🔽 reduced radius
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 10,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: GestureDetector(
|
||||
onTap: null,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Tooltip(
|
||||
message: 'Back',
|
||||
child: IconButton(
|
||||
icon: const Icon(
|
||||
Icons.arrow_left_sharp,
|
||||
size: 25,
|
||||
color: Color(0xFF425B5B),
|
||||
),
|
||||
onPressed: () {
|
||||
context.go(AppRoutes.invoiceList);
|
||||
},
|
||||
splashRadius: 18,
|
||||
hoverColor: Colors.black12,
|
||||
padding: const EdgeInsets.all(4),
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
"Raise Invoice",
|
||||
style: GoogleFonts.poppins(
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
), // spacing between icon and text
|
||||
Text(
|
||||
"Invoice",
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
TextButton(
|
||||
onPressed: () =>
|
||||
setState(() => selectedPolicies.clear()),
|
||||
child: const Text("Clear"),
|
||||
|
||||
// 🟢 Status Chip
|
||||
if (isEdit) ...[
|
||||
Spacer(),
|
||||
Text(
|
||||
controllers['invoiceNo']?.text ?? '',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: const Color(0xFF374151),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
Text(
|
||||
// controllers['invoiceDate']?.text ?? '',
|
||||
'(${controllers['invoiceDate']?.text ?? ''})',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w300,
|
||||
color: const Color(0xFF6B7280),
|
||||
),
|
||||
),
|
||||
// SizedBox(width: 10),
|
||||
// Spacer(),
|
||||
SizedBox(width: 10),
|
||||
Text(
|
||||
'Status: ${isPending ? 'Pending' : 'Completed'}',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w300,
|
||||
color: const Color(0xFF6B7280),
|
||||
// color: isPending
|
||||
// ? Colors.blueAccent
|
||||
// : const Color(0xFF047857),
|
||||
),
|
||||
),
|
||||
|
||||
Spacer(),
|
||||
|
||||
ThemedSearchField(
|
||||
hintText: 'Search',
|
||||
|
||||
// backgroundColor: Color(0xFFF6F8F8),
|
||||
onChanged: filterPolicyData,
|
||||
|
||||
controller: _searchStaffController,
|
||||
backgroundColor: Color(0xFFFFFFFF),
|
||||
txtHeight: 30,
|
||||
txtwidth: ResponsiveLayout.isMobile(context)
|
||||
? MediaQuery.of(context).size.width * 0.7
|
||||
: MediaQuery.of(context).size.width * 0.15,
|
||||
),
|
||||
],
|
||||
|
||||
if (!isEdit) ...[
|
||||
const Spacer(),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 6,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFECFDF5), // emerald bg
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"SELECTED POLICIES : ",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: const Color(0xFF065F46),
|
||||
letterSpacing: 0.4,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
// "15",
|
||||
// selectedPolicies.length.toString(),
|
||||
totalPolicies,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: const Color(0xFF047857),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(width: 10),
|
||||
|
||||
// 💰 TOTAL COMMISSION
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 6,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF10B981), // emerald green
|
||||
borderRadius: BorderRadius.circular(22),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: const Color(
|
||||
0xFF10B981,
|
||||
).withOpacity(0.25),
|
||||
blurRadius: 6,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.account_balance_wallet_outlined,
|
||||
size: 14,
|
||||
color: Colors.white,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
"TOTAL COMMISSION :",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white.withOpacity(0.9),
|
||||
letterSpacing: 0.4,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
// "₹${_calculateTotalCommission()}",
|
||||
"₹$totalCommission",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// SizedBox(height: 5),
|
||||
if (!isEdit) ...[
|
||||
Container(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: DateFilterRowPayout(
|
||||
formKey: _formKey,
|
||||
// key: ValueKey(SelectedStatus ?? ''),
|
||||
role: roleId,
|
||||
id: userId,
|
||||
selectedParnter: selectedAgentId,
|
||||
selectedBroker: selectedBrokerID,
|
||||
onBrokerChanged: (val) {
|
||||
print('Selected Filterd SselectedBrokerID - $val');
|
||||
setState(() {
|
||||
selectedBrokerID = val; // ✅ parent state updated
|
||||
});
|
||||
},
|
||||
|
||||
onPartnerChanges: (val) {
|
||||
setState(() {
|
||||
selectedAgentId = val; // ✅ parent state updated
|
||||
});
|
||||
},
|
||||
selectedStaffId: '',
|
||||
startController: controllers['startDate']!,
|
||||
endController: controllers['endDate']!,
|
||||
|
||||
isMobile: ResponsiveLayout.isMobile(context),
|
||||
onFilter: () {
|
||||
print(
|
||||
'DATEROw- ${controllers['startDate']!} -${controllers['endDate']!}'
|
||||
' - $selectedAgentId - $selectedBrokerID',
|
||||
);
|
||||
// call your filter logic
|
||||
// filterDateRange();
|
||||
|
||||
loadPolicies();
|
||||
},
|
||||
onRefresh: () {
|
||||
// call your refresh logic
|
||||
refresh();
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 10),
|
||||
],
|
||||
// Policy Selection
|
||||
Card(
|
||||
// color: Colors.amber,
|
||||
color: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
elevation: 0,
|
||||
child: Column(
|
||||
children: [
|
||||
AnimatedCrossFade(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
crossFadeState: policyCollapsed
|
||||
? CrossFadeState.showFirst
|
||||
: CrossFadeState.showSecond,
|
||||
firstChild: const SizedBox(),
|
||||
secondChild: Column(
|
||||
children: [
|
||||
_policyTableHeader(), // 🔒 Static header
|
||||
Container(
|
||||
// color: Colors.amber.shade100,
|
||||
child: _policyTableBody(),
|
||||
), // 🔽 Scrollable rows
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
if (selectedPolicies.isNotEmpty) ...[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
// color: Colors.amber,
|
||||
color: Color(0xFFf9fafb),
|
||||
// color: Colors.white,
|
||||
child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// ---------------- SELECTED COUNT ----------------
|
||||
Row(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
// selectedPolicies.length.toString(),
|
||||
totalPolicies,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.blueGrey,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
"policies selected",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.blueGrey,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
"|",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.blueGrey,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
"Total Commission",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.blueGrey,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
|
||||
/// NULL-SAFE TOTAL COMMISSION CALCULATION
|
||||
Text(
|
||||
// "₹ ${_calculateTotalCommission()}",
|
||||
"₹ $totalCommission",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.teal,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Spacer(),
|
||||
buildPOS(context),
|
||||
SizedBox(width: 20),
|
||||
// ---------------- BUTTONS ----------------
|
||||
Row(
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: saveInvoice,
|
||||
style: ElevatedButton.styleFrom(
|
||||
// backgroundColor: const Color(0xff45a049),
|
||||
backgroundColor: Colors.teal,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
4,
|
||||
), // 🔽 reduced radius
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 10,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
"Raise Invoice",
|
||||
style: GoogleFonts.poppins(
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
TextButton(
|
||||
onPressed: () =>
|
||||
setState(() => selectedPolicies.clear()),
|
||||
child: const Text("Clear"),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
if (isEdit) ...[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
// color: Colors.amber,
|
||||
color: Color(0xFFf9fafb),
|
||||
// color: Colors.white,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
// selectedPolicies.length.toString(),
|
||||
totalPolicies,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.blueGrey,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
"policies selected",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.blueGrey,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
"|",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.blueGrey,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
"Total Commission",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.blueGrey,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
if (isEdit) ...[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
// color: Colors.amber,
|
||||
color: Color(0xFFf9fafb),
|
||||
// color: Colors.white,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
// selectedPolicies.length.toString(),
|
||||
totalPolicies,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.blueGrey,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
"policies selected",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.blueGrey,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
"|",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.blueGrey,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
"Total Commission",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.blueGrey,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
|
||||
/// NULL-SAFE TOTAL COMMISSION CALCULATION
|
||||
Text(
|
||||
// "₹ ${_calculateTotalCommission()}",
|
||||
"₹ $totalCommission",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.teal,
|
||||
/// NULL-SAFE TOTAL COMMISSION CALCULATION
|
||||
Text(
|
||||
// "₹ ${_calculateTotalCommission()}",
|
||||
"₹ $totalCommission",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.teal,
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(width: 10),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(width: 10),
|
||||
],
|
||||
),
|
||||
// ----------------------
|
||||
// const SizedBox(height: 100),
|
||||
],
|
||||
),
|
||||
],
|
||||
// ----------------------
|
||||
// const SizedBox(height: 100),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
color: Colors.white,
|
||||
height: MediaQuery.of(context).size.height * 0.7,
|
||||
child: Center(child: CircularProgressIndicator()),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -1191,7 +1205,10 @@ class _PayOutScreenState extends ConsumerState<PayOutScreen> {
|
||||
|
||||
Widget _policyTableBody() {
|
||||
return SizedBox(
|
||||
height: isEdit ? 400 : 340, // avoids overflow
|
||||
// height: isEdit ? 400 : 340, // avoids overflow
|
||||
height: isEdit
|
||||
? MediaQuery.of(context).size.height * 0.65
|
||||
: MediaQuery.of(context).size.height * 0.48, // avoids overflow
|
||||
child: ListView.builder(
|
||||
itemCount: filteredPolicies.length,
|
||||
itemBuilder: (context, index) {
|
||||
|
||||
@ -573,7 +573,7 @@ class policylistState extends ConsumerState<policylist> {
|
||||
// child: Text('Recieved Date', style: _headerStyle),
|
||||
// ),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
flex: 3,
|
||||
child: Text('Assigned To', style: _headerStyle),
|
||||
),
|
||||
|
||||
@ -715,7 +715,7 @@ class policylistState extends ConsumerState<policylist> {
|
||||
// ),
|
||||
// ),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
flex: 3,
|
||||
child: Text(item['assigned_to_name'] ?? '-', style: _dataBold),
|
||||
),
|
||||
Expanded(
|
||||
@ -1102,7 +1102,7 @@ class policylistState extends ConsumerState<policylist> {
|
||||
}
|
||||
|
||||
static final _dataBold = GoogleFonts.inter(
|
||||
fontSize: 11.5,
|
||||
fontSize: 11,
|
||||
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Color(0xFF000000),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user