Done Category, Product Catalogue, Customer, Vendor, Purchase Invoice Module

This commit is contained in:
2026-08-28 11:30:18 +05:30
parent 0d13833679
commit 189f49ed07
118 changed files with 12624 additions and 4004 deletions

View File

@@ -85,7 +85,10 @@ class TaskCard extends ConsumerWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 4,
),
decoration: BoxDecoration(
color: statusColor.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(20),
@@ -121,7 +124,11 @@ class TaskCard extends ConsumerWidget {
const SizedBox(height: 4),
Text(
task.description!,
style: TextStyle(fontSize: 12, color: Colors.grey.shade600, height: 1.4),
style: TextStyle(
fontSize: 12,
color: Colors.grey.shade600,
height: 1.4,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
@@ -132,9 +139,13 @@ class TaskCard extends ConsumerWidget {
// Bottom row: assignee + billable badge + invoice button
Row(
children: [
if (task.assigneeName != null && task.assigneeName!.isNotEmpty) ...[
if (task.assigneeName != null &&
task.assigneeName!.isNotEmpty) ...[
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 3,
),
decoration: BoxDecoration(
color: Colors.indigo.withValues(alpha: 0.08),
borderRadius: BorderRadius.circular(16),
@@ -142,11 +153,19 @@ class TaskCard extends ConsumerWidget {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(LucideIcons.user, size: 12, color: Colors.indigo.shade400),
Icon(
LucideIcons.user,
size: 12,
color: Colors.indigo.shade400,
),
const SizedBox(width: 4),
Text(
task.assigneeName!,
style: TextStyle(fontSize: 11, color: Colors.indigo.shade600, fontWeight: FontWeight.w500),
style: TextStyle(
fontSize: 11,
color: Colors.indigo.shade600,
fontWeight: FontWeight.w500,
),
),
],
),
@@ -155,7 +174,10 @@ class TaskCard extends ConsumerWidget {
],
if (task.isBillable)
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 3,
),
decoration: BoxDecoration(
color: Colors.green.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(16),
@@ -163,11 +185,19 @@ class TaskCard extends ConsumerWidget {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(LucideIcons.indianRupee, size: 11, color: Colors.green.shade600),
Icon(
LucideIcons.indianRupee,
size: 11,
color: Colors.green.shade600,
),
const SizedBox(width: 2),
Text(
'Billable',
style: TextStyle(color: Colors.green.shade700, fontSize: 11, fontWeight: FontWeight.w500),
style: TextStyle(
color: Colors.green.shade700,
fontSize: 11,
fontWeight: FontWeight.w500,
),
),
],
),
@@ -180,10 +210,23 @@ class TaskCard extends ConsumerWidget {
style: TextButton.styleFrom(
padding: const EdgeInsets.symmetric(horizontal: 8),
backgroundColor: Colors.green.withValues(alpha: 0.1),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
icon: Icon(
LucideIcons.receipt,
size: 13,
color: Colors.green.shade700,
),
label: Text(
'Invoice',
style: TextStyle(
fontSize: 11,
color: Colors.green.shade700,
fontWeight: FontWeight.w600,
),
),
icon: Icon(LucideIcons.receipt, size: 13, color: Colors.green.shade700),
label: Text('Invoice', style: TextStyle(fontSize: 11, color: Colors.green.shade700, fontWeight: FontWeight.w600)),
onPressed: onGenerateInvoice,
),
),
@@ -219,7 +262,13 @@ class TaskCard extends ConsumerWidget {
),
),
const SizedBox(height: 16),
Text(task.title, style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 16)),
Text(
task.title,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
),
),
const SizedBox(height: 16),
ListTile(
leading: const Icon(LucideIcons.eye),
@@ -245,30 +294,45 @@ class TaskCard extends ConsumerWidget {
),
ListTile(
leading: const Icon(LucideIcons.trash2, color: Colors.red),
title: const Text('Delete Task', style: TextStyle(color: Colors.red)),
title: const Text(
'Delete Task',
style: TextStyle(color: Colors.red),
),
onTap: () async {
Navigator.pop(ctx);
final confirm = await showDialog<bool>(
context: context,
builder: (c) => AlertDialog(
title: const Text('Delete Task'),
content: Text('Are you sure you want to delete "${task.title}"?'),
content: Text(
'Are you sure you want to delete "${task.title}"?',
),
actions: [
TextButton(onPressed: () => Navigator.pop(c, false), child: const Text('Cancel')),
TextButton(
onPressed: () => Navigator.pop(c, false),
child: const Text('Cancel'),
),
TextButton(
onPressed: () => Navigator.pop(c, true),
child: const Text('Delete', style: TextStyle(color: Colors.red)),
child: const Text(
'Delete',
style: TextStyle(color: Colors.red),
),
),
],
),
);
if (confirm == true) {
try {
await ref.read(projectRepositoryProvider).deleteTask(task.id);
await ref
.read(projectRepositoryProvider)
.deleteTask(task.id);
ref.invalidate(projectTasksProvider(task.projectId));
} catch (e) {
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Error: $e')));
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text('Error: $e')));
}
}
}
@@ -288,18 +352,23 @@ class TaskCard extends ConsumerWidget {
tooltip: 'Change Status',
padding: EdgeInsets.zero,
constraints: const BoxConstraints(),
child: Icon(LucideIcons.moreVertical, size: 18, color: Colors.grey.shade500),
child: Icon(
LucideIcons.moreVertical,
size: 18,
color: Colors.grey.shade500,
),
onSelected: (newStatus) async {
if (newStatus != task.status) {
try {
await ref.read(projectRepositoryProvider).updateTask(
taskId: task.id,
status: newStatus,
);
await ref
.read(projectRepositoryProvider)
.updateTask(taskId: task.id, status: newStatus);
ref.invalidate(projectTasksProvider(task.projectId));
} catch (e) {
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Failed to update status: $e')));
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Failed to update status: $e')),
);
}
}
}
@@ -313,7 +382,11 @@ class TaskCard extends ConsumerWidget {
);
}
PopupMenuItem<String> _buildStatusMenuItem(String value, String label, Color color) {
PopupMenuItem<String> _buildStatusMenuItem(
String value,
String label,
Color color,
) {
return PopupMenuItem<String>(
value: value,
child: Row(