Compare commits
10 Commits
f9a96d881a
...
59b758a7b5
Author | SHA1 | Date | |
---|---|---|---|
![]() |
59b758a7b5 | ||
![]() |
03813b5e83 | ||
![]() |
88a1089148 | ||
![]() |
b29af415a4 | ||
![]() |
b4bf13214a | ||
![]() |
91912fcc95 | ||
![]() |
bf3ea7172a | ||
![]() |
18e50b5354 | ||
![]() |
c945c64257 | ||
![]() |
24570b8ae3 |
@ -1,6 +1,7 @@
|
|||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:cheminova/constants/constant.dart';
|
import 'package:cheminova/constants/constant.dart';
|
||||||
|
import 'package:cheminova/provider/add_sales_product_provider.dart';
|
||||||
import 'package:cheminova/provider/home_provider.dart';
|
import 'package:cheminova/provider/home_provider.dart';
|
||||||
import 'package:cheminova/provider/products_provider.dart';
|
import 'package:cheminova/provider/products_provider.dart';
|
||||||
import 'package:cheminova/screens/splash_screen.dart';
|
import 'package:cheminova/screens/splash_screen.dart';
|
||||||
@ -92,6 +93,7 @@ Future<void> main() async {
|
|||||||
runApp(MultiProvider(providers: [
|
runApp(MultiProvider(providers: [
|
||||||
ChangeNotifierProvider(create: (context) => HomeProvider()),
|
ChangeNotifierProvider(create: (context) => HomeProvider()),
|
||||||
ChangeNotifierProvider(create: (context) => ProductProvider()),
|
ChangeNotifierProvider(create: (context) => ProductProvider()),
|
||||||
|
ChangeNotifierProvider(create: (context) => AddSalesProvider()),
|
||||||
], child: const MyApp()));
|
], child: const MyApp()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
103
lib/models/Daily_Task_Response.dart
Normal file
103
lib/models/Daily_Task_Response.dart
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
import 'package:cheminova/models/rejected_applicaton_response.dart';
|
||||||
|
import 'package:cheminova/provider/pd_rd_provider.dart';
|
||||||
|
|
||||||
|
class DailyTasksResponse {
|
||||||
|
bool? success;
|
||||||
|
List<Tasks>? tasks;
|
||||||
|
|
||||||
|
DailyTasksResponse({this.success, this.tasks});
|
||||||
|
|
||||||
|
DailyTasksResponse.fromJson(Map<String, dynamic> json) {
|
||||||
|
success = json['success'];
|
||||||
|
if (json['tasks'] != null) {
|
||||||
|
tasks = <Tasks>[];
|
||||||
|
json['tasks'].forEach((v) {
|
||||||
|
tasks!.add(new Tasks.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['success'] = this.success;
|
||||||
|
if (this.tasks != null) {
|
||||||
|
data['tasks'] = this.tasks!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Tasks {
|
||||||
|
String? tradeName;
|
||||||
|
String? sId;
|
||||||
|
String? taskId;
|
||||||
|
String? task;
|
||||||
|
String? taskStatus;
|
||||||
|
String? taskPriority;
|
||||||
|
String? taskDueDate;
|
||||||
|
String? taskAssignedTo;
|
||||||
|
String? taskAssignedBy;
|
||||||
|
String? addedFor;
|
||||||
|
String? addedForId;
|
||||||
|
String? createdAt;
|
||||||
|
String? updatedAt;
|
||||||
|
int? iV;
|
||||||
|
String? note;
|
||||||
|
|
||||||
|
Tasks(
|
||||||
|
{this.sId,
|
||||||
|
this.taskId,
|
||||||
|
this.tradeName,
|
||||||
|
this.task,
|
||||||
|
this.taskStatus,
|
||||||
|
this.taskPriority,
|
||||||
|
this.taskDueDate,
|
||||||
|
this.taskAssignedTo,
|
||||||
|
this.taskAssignedBy,
|
||||||
|
this.addedFor,
|
||||||
|
this.addedForId,
|
||||||
|
this.createdAt,
|
||||||
|
this.updatedAt,
|
||||||
|
this.iV,
|
||||||
|
this.note});
|
||||||
|
|
||||||
|
Tasks.fromJson(Map<String, dynamic> json) {
|
||||||
|
sId = json['_id'];
|
||||||
|
tradeName = json['tradename'];
|
||||||
|
taskId = json['taskId'];
|
||||||
|
task = json['task'];
|
||||||
|
taskStatus = json['taskStatus'];
|
||||||
|
taskPriority = json['taskPriority'];
|
||||||
|
taskDueDate = json['taskDueDate'];
|
||||||
|
taskAssignedTo = json['taskAssignedTo'];
|
||||||
|
taskAssignedBy = json['taskAssignedBy'];
|
||||||
|
addedFor = json['addedFor'];
|
||||||
|
addedForId = json['addedForId'];
|
||||||
|
createdAt = json['createdAt'];
|
||||||
|
updatedAt = json['updatedAt'];
|
||||||
|
iV = json['__v'];
|
||||||
|
note = json['note'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['_id'] = this.sId;
|
||||||
|
data['tradename'] = this.tradeName;
|
||||||
|
data['taskId'] = this.taskId;
|
||||||
|
data['task'] = this.task;
|
||||||
|
data['taskStatus'] = this.taskStatus;
|
||||||
|
data['taskPriority'] = this.taskPriority;
|
||||||
|
data['taskDueDate'] = this.taskDueDate;
|
||||||
|
data['taskAssignedTo'] = this.taskAssignedTo;
|
||||||
|
data['taskAssignedBy'] = this.taskAssignedBy;
|
||||||
|
data['addedFor'] = this.addedFor;
|
||||||
|
data['addedForId'] = this.addedForId;
|
||||||
|
data['createdAt'] = this.createdAt;
|
||||||
|
data['updatedAt'] = this.updatedAt;
|
||||||
|
data['__v'] = this.iV;
|
||||||
|
data['note'] = this.note;
|
||||||
|
data['Distributor'] = this.taskAssignedTo;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
176
lib/models/SalesTaskResponse.dart
Normal file
176
lib/models/SalesTaskResponse.dart
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
class SalesTaskResponse {
|
||||||
|
bool? success;
|
||||||
|
int? totalData;
|
||||||
|
int? totalPages;
|
||||||
|
List<SalesProduct>? products;
|
||||||
|
|
||||||
|
SalesTaskResponse(
|
||||||
|
{this.success, this.totalData, this.totalPages, this.products});
|
||||||
|
|
||||||
|
SalesTaskResponse.fromJson(Map<String, dynamic> json) {
|
||||||
|
success = json['success'];
|
||||||
|
totalData = json['total_data'];
|
||||||
|
totalPages = json['total_pages'];
|
||||||
|
if (json['products'] != null) {
|
||||||
|
products = <SalesProduct>[];
|
||||||
|
json['products'].forEach((v) {
|
||||||
|
products!.add(SalesProduct.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['success'] = success;
|
||||||
|
data['total_data'] = totalData;
|
||||||
|
data['total_pages'] = totalPages;
|
||||||
|
if (products != null) {
|
||||||
|
data['products'] = products!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SalesProduct {
|
||||||
|
String? sId;
|
||||||
|
String? SKU;
|
||||||
|
String? ProductName;
|
||||||
|
Category? category;
|
||||||
|
Brand? brand;
|
||||||
|
int? price;
|
||||||
|
int? gST;
|
||||||
|
int? hSNCode;
|
||||||
|
String? description;
|
||||||
|
String? productStatus;
|
||||||
|
AddedBy? addedBy;
|
||||||
|
List<Null>? image;
|
||||||
|
String? createdAt;
|
||||||
|
String? updatedAt;
|
||||||
|
int? SalesAmount;
|
||||||
|
int? QuantitySold;
|
||||||
|
String? comments;
|
||||||
|
int? iV;
|
||||||
|
|
||||||
|
SalesProduct(
|
||||||
|
{this.sId,
|
||||||
|
this.SKU,
|
||||||
|
this.ProductName,
|
||||||
|
this.category,
|
||||||
|
this.brand,
|
||||||
|
this.price,
|
||||||
|
this.gST,
|
||||||
|
this.hSNCode,
|
||||||
|
this.description,
|
||||||
|
this.productStatus,
|
||||||
|
this.addedBy,
|
||||||
|
this.image,
|
||||||
|
this.createdAt,
|
||||||
|
this.updatedAt,
|
||||||
|
this.QuantitySold,
|
||||||
|
this.comments,
|
||||||
|
this.SalesAmount,
|
||||||
|
this.iV});
|
||||||
|
|
||||||
|
SalesProduct.fromJson(Map<String, dynamic> json) {
|
||||||
|
sId = json['_id'];
|
||||||
|
SKU = json['SKU'];
|
||||||
|
ProductName = json['name'];
|
||||||
|
category = json['category'] != null
|
||||||
|
? Category.fromJson(json['category'])
|
||||||
|
: null;
|
||||||
|
brand = json['brand'] != null ? Brand.fromJson(json['brand']) : null;
|
||||||
|
price = json['price'];
|
||||||
|
gST = json['GST'];
|
||||||
|
hSNCode = json['HSN_Code'];
|
||||||
|
description = json['description'];
|
||||||
|
productStatus = json['product_Status'];
|
||||||
|
addedBy =
|
||||||
|
json['addedBy'] != null ? AddedBy.fromJson(json['addedBy']) : null;
|
||||||
|
createdAt = json['createdAt'];
|
||||||
|
updatedAt = json['updatedAt'];
|
||||||
|
iV = json['__v'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['_id'] = sId;
|
||||||
|
data['SKU'] = SKU;
|
||||||
|
data['name'] = ProductName;
|
||||||
|
if (category != null) {
|
||||||
|
data['category'] = category!.toJson();
|
||||||
|
}
|
||||||
|
if (brand != null) {
|
||||||
|
data['brand'] = brand!.toJson();
|
||||||
|
}
|
||||||
|
data['price'] = price;
|
||||||
|
data['GST'] = gST;
|
||||||
|
data['HSN_Code'] = hSNCode;
|
||||||
|
data['description'] = description;
|
||||||
|
data['product_Status'] = productStatus;
|
||||||
|
if (addedBy != null) {
|
||||||
|
data['addedBy'] = addedBy!.toJson();
|
||||||
|
}
|
||||||
|
data['createdAt'] = createdAt;
|
||||||
|
data['updatedAt'] = updatedAt;
|
||||||
|
data['__v'] = iV;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Category {
|
||||||
|
String? sId;
|
||||||
|
String? categoryName;
|
||||||
|
|
||||||
|
Category({this.sId, this.categoryName});
|
||||||
|
|
||||||
|
Category.fromJson(Map<String, dynamic> json) {
|
||||||
|
sId = json['_id'];
|
||||||
|
categoryName = json['categoryName'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['_id'] = sId;
|
||||||
|
data['categoryName'] = categoryName;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Brand {
|
||||||
|
String? sId;
|
||||||
|
String? brandName;
|
||||||
|
|
||||||
|
Brand({this.sId, this.brandName});
|
||||||
|
|
||||||
|
Brand.fromJson(Map<String, dynamic> json) {
|
||||||
|
sId = json['_id'];
|
||||||
|
brandName = json['brandName'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['_id'] = sId;
|
||||||
|
data['brandName'] = brandName;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddedBy {
|
||||||
|
String? sId;
|
||||||
|
String? name;
|
||||||
|
|
||||||
|
AddedBy({this.sId, this.name});
|
||||||
|
|
||||||
|
AddedBy.fromJson(Map<String, dynamic> json) {
|
||||||
|
sId = json['_id'];
|
||||||
|
name = json['name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['_id'] = sId;
|
||||||
|
data['name'] = name;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
48
lib/models/product_manual_model.dart
Normal file
48
lib/models/product_manual_model.dart
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
class ProductManualModel {
|
||||||
|
final ProductManualDetail productManualDetail;
|
||||||
|
final String id;
|
||||||
|
final String title;
|
||||||
|
final String createdAt;
|
||||||
|
final String updatedAt;
|
||||||
|
final int version;
|
||||||
|
|
||||||
|
ProductManualModel({
|
||||||
|
required this.productManualDetail,
|
||||||
|
required this.id,
|
||||||
|
required this.title,
|
||||||
|
required this.createdAt,
|
||||||
|
required this.updatedAt,
|
||||||
|
required this.version,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory ProductManualModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
return ProductManualModel(
|
||||||
|
productManualDetail: ProductManualDetail.fromJson(json['product_manual']),
|
||||||
|
id: json['_id'],
|
||||||
|
title: json['title'],
|
||||||
|
createdAt: json['createdAt'],
|
||||||
|
updatedAt: json['updatedAt'],
|
||||||
|
version: json['__v'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ProductManualDetail {
|
||||||
|
final String publicId;
|
||||||
|
final String url;
|
||||||
|
final String filename;
|
||||||
|
|
||||||
|
ProductManualDetail({
|
||||||
|
required this.publicId,
|
||||||
|
required this.url,
|
||||||
|
required this.filename,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory ProductManualDetail.fromJson(Map<String, dynamic> json) {
|
||||||
|
return ProductManualDetail(
|
||||||
|
publicId: json['public_id'],
|
||||||
|
url: json['url'],
|
||||||
|
filename: json['filename'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -36,13 +36,13 @@ class Products {
|
|||||||
String? sKU;
|
String? sKU;
|
||||||
String? name;
|
String? name;
|
||||||
Category? category;
|
Category? category;
|
||||||
|
Brand? brand;
|
||||||
int? price;
|
int? price;
|
||||||
GST? gST;
|
int? gST;
|
||||||
|
int? hSNCode;
|
||||||
String? description;
|
String? description;
|
||||||
String? specialInstructions;
|
|
||||||
String? productStatus;
|
String? productStatus;
|
||||||
AddedBy? addedBy;
|
AddedBy? addedBy;
|
||||||
List<Null>? image;
|
|
||||||
String? createdAt;
|
String? createdAt;
|
||||||
String? updatedAt;
|
String? updatedAt;
|
||||||
int? iV;
|
int? iV;
|
||||||
@ -52,13 +52,13 @@ class Products {
|
|||||||
this.sKU,
|
this.sKU,
|
||||||
this.name,
|
this.name,
|
||||||
this.category,
|
this.category,
|
||||||
|
this.brand,
|
||||||
this.price,
|
this.price,
|
||||||
this.gST,
|
this.gST,
|
||||||
|
this.hSNCode,
|
||||||
this.description,
|
this.description,
|
||||||
this.specialInstructions,
|
|
||||||
this.productStatus,
|
this.productStatus,
|
||||||
this.addedBy,
|
this.addedBy,
|
||||||
this.image,
|
|
||||||
this.createdAt,
|
this.createdAt,
|
||||||
this.updatedAt,
|
this.updatedAt,
|
||||||
this.iV});
|
this.iV});
|
||||||
@ -70,10 +70,11 @@ class Products {
|
|||||||
category = json['category'] != null
|
category = json['category'] != null
|
||||||
? new Category.fromJson(json['category'])
|
? new Category.fromJson(json['category'])
|
||||||
: null;
|
: null;
|
||||||
|
brand = json['brand'] != null ? new Brand.fromJson(json['brand']) : null;
|
||||||
price = json['price'];
|
price = json['price'];
|
||||||
gST = json['GST'] != null ? new GST.fromJson(json['GST']) : null;
|
gST = json['GST'];
|
||||||
|
hSNCode = json['HSN_Code'];
|
||||||
description = json['description'];
|
description = json['description'];
|
||||||
specialInstructions = json['special_instructions'];
|
|
||||||
productStatus = json['product_Status'];
|
productStatus = json['product_Status'];
|
||||||
addedBy =
|
addedBy =
|
||||||
json['addedBy'] != null ? new AddedBy.fromJson(json['addedBy']) : null;
|
json['addedBy'] != null ? new AddedBy.fromJson(json['addedBy']) : null;
|
||||||
@ -90,12 +91,13 @@ class Products {
|
|||||||
if (this.category != null) {
|
if (this.category != null) {
|
||||||
data['category'] = this.category!.toJson();
|
data['category'] = this.category!.toJson();
|
||||||
}
|
}
|
||||||
data['price'] = this.price;
|
if (this.brand != null) {
|
||||||
if (this.gST != null) {
|
data['brand'] = this.brand!.toJson();
|
||||||
data['GST'] = this.gST!.toJson();
|
|
||||||
}
|
}
|
||||||
|
data['price'] = this.price;
|
||||||
|
data['GST'] = this.gST;
|
||||||
|
data['HSN_Code'] = this.hSNCode;
|
||||||
data['description'] = this.description;
|
data['description'] = this.description;
|
||||||
data['special_instructions'] = this.specialInstructions;
|
|
||||||
data['product_Status'] = this.productStatus;
|
data['product_Status'] = this.productStatus;
|
||||||
if (this.addedBy != null) {
|
if (this.addedBy != null) {
|
||||||
data['addedBy'] = this.addedBy!.toJson();
|
data['addedBy'] = this.addedBy!.toJson();
|
||||||
@ -126,24 +128,21 @@ class Category {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class GST {
|
class Brand {
|
||||||
String? sId;
|
String? sId;
|
||||||
String? name;
|
String? brandName;
|
||||||
int? tax;
|
|
||||||
|
|
||||||
GST({this.sId, this.name, this.tax});
|
Brand({this.sId, this.brandName});
|
||||||
|
|
||||||
GST.fromJson(Map<String, dynamic> json) {
|
Brand.fromJson(Map<String, dynamic> json) {
|
||||||
sId = json['_id'];
|
sId = json['_id'];
|
||||||
name = json['name'];
|
brandName = json['brandName'];
|
||||||
tax = json['tax'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
data['_id'] = this.sId;
|
data['_id'] = this.sId;
|
||||||
data['name'] = this.name;
|
data['brandName'] = this.brandName;
|
||||||
data['tax'] = this.tax;
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ class MyData {
|
|||||||
String? uniqueId;
|
String? uniqueId;
|
||||||
String? createdAt;
|
String? createdAt;
|
||||||
String? updatedAt;
|
String? updatedAt;
|
||||||
|
String? designation;
|
||||||
int? iV;
|
int? iV;
|
||||||
|
|
||||||
MyData(
|
MyData(
|
||||||
@ -43,6 +44,7 @@ class MyData {
|
|||||||
this.uniqueId,
|
this.uniqueId,
|
||||||
this.createdAt,
|
this.createdAt,
|
||||||
this.updatedAt,
|
this.updatedAt,
|
||||||
|
this.designation,
|
||||||
this.iV});
|
this.iV});
|
||||||
|
|
||||||
MyData.fromJson(Map<String, dynamic> json) {
|
MyData.fromJson(Map<String, dynamic> json) {
|
||||||
@ -54,6 +56,7 @@ class MyData {
|
|||||||
uniqueId = json['uniqueId'];
|
uniqueId = json['uniqueId'];
|
||||||
createdAt = json['createdAt'];
|
createdAt = json['createdAt'];
|
||||||
updatedAt = json['updatedAt'];
|
updatedAt = json['updatedAt'];
|
||||||
|
designation = json['designation'];
|
||||||
iV = json['__v'];
|
iV = json['__v'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,6 +70,7 @@ class MyData {
|
|||||||
data['uniqueId'] = uniqueId;
|
data['uniqueId'] = uniqueId;
|
||||||
data['createdAt'] = createdAt;
|
data['createdAt'] = createdAt;
|
||||||
data['updatedAt'] = updatedAt;
|
data['updatedAt'] = updatedAt;
|
||||||
|
data['designation'] = designation;
|
||||||
data['__v'] = iV;
|
data['__v'] = iV;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
86
lib/models/select_task_response.dart
Normal file
86
lib/models/select_task_response.dart
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
class SelectTaskKycResponse {
|
||||||
|
bool? success;
|
||||||
|
List<Tasks>? tasks;
|
||||||
|
|
||||||
|
SelectTaskKycResponse({this.success, this.tasks});
|
||||||
|
|
||||||
|
SelectTaskKycResponse.fromJson(Map<String, dynamic> json) {
|
||||||
|
success = json['success'];
|
||||||
|
if (json['tasks'] != null) {
|
||||||
|
tasks = <Tasks>[];
|
||||||
|
json['tasks'].forEach((v) {
|
||||||
|
tasks!.add(new Tasks.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['success'] = this.success;
|
||||||
|
if (this.tasks != null) {
|
||||||
|
data['tasks'] = this.tasks!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Tasks {
|
||||||
|
String? sId;
|
||||||
|
String? taskId;
|
||||||
|
String? task;
|
||||||
|
String? note;
|
||||||
|
String? taskStatus;
|
||||||
|
String? taskPriority;
|
||||||
|
String? taskDueDate;
|
||||||
|
String? taskAssignedTo;
|
||||||
|
String? taskAssignedBy;
|
||||||
|
String? createdAt;
|
||||||
|
String? updatedAt;
|
||||||
|
int? iV;
|
||||||
|
|
||||||
|
Tasks(
|
||||||
|
{this.sId,
|
||||||
|
this.taskId,
|
||||||
|
this.task,
|
||||||
|
this.note,
|
||||||
|
this.taskStatus,
|
||||||
|
this.taskPriority,
|
||||||
|
this.taskDueDate,
|
||||||
|
this.taskAssignedTo,
|
||||||
|
this.taskAssignedBy,
|
||||||
|
this.createdAt,
|
||||||
|
this.updatedAt,
|
||||||
|
this.iV});
|
||||||
|
|
||||||
|
Tasks.fromJson(Map<String, dynamic> json) {
|
||||||
|
sId = json['_id'];
|
||||||
|
taskId = json['taskId'];
|
||||||
|
task = json['task'];
|
||||||
|
note = json['note'];
|
||||||
|
taskStatus = json['taskStatus'];
|
||||||
|
taskPriority = json['taskPriority'];
|
||||||
|
taskDueDate = json['taskDueDate'];
|
||||||
|
taskAssignedTo = json['taskAssignedTo'];
|
||||||
|
taskAssignedBy = json['taskAssignedBy'];
|
||||||
|
createdAt = json['createdAt'];
|
||||||
|
updatedAt = json['updatedAt'];
|
||||||
|
iV = json['__v'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['_id'] = this.sId;
|
||||||
|
data['taskId'] = this.taskId;
|
||||||
|
data['task'] = this.task;
|
||||||
|
data['note'] = this.note;
|
||||||
|
data['taskStatus'] = this.taskStatus;
|
||||||
|
data['taskPriority'] = this.taskPriority;
|
||||||
|
data['taskDueDate'] = this.taskDueDate;
|
||||||
|
data['taskAssignedTo'] = this.taskAssignedTo;
|
||||||
|
data['taskAssignedBy'] = this.taskAssignedBy;
|
||||||
|
data['createdAt'] = this.createdAt;
|
||||||
|
data['updatedAt'] = this.updatedAt;
|
||||||
|
data['__v'] = this.iV;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
126
lib/provider/add_sales_product_provider.dart
Normal file
126
lib/provider/add_sales_product_provider.dart
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:cheminova/constants/constant.dart';
|
||||||
|
import 'package:cheminova/models/SalesTaskResponse.dart';
|
||||||
|
import 'package:cheminova/screens/data_submit_successfull.dart';
|
||||||
|
import 'package:cheminova/services/api_client.dart';
|
||||||
|
import 'package:cheminova/services/api_urls.dart';
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class AddSalesProvider with ChangeNotifier {
|
||||||
|
final _apiClient = ApiClient();
|
||||||
|
List<SalesProduct> tasksList = [];
|
||||||
|
List<SalesProduct> searchList = [];
|
||||||
|
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
bool get isLoading => _isLoading;
|
||||||
|
|
||||||
|
List<SalesProduct> selectedProducts = [];
|
||||||
|
|
||||||
|
void setLoading(bool loading) {
|
||||||
|
_isLoading = loading;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> getTask() async {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
Response response = await _apiClient.get(ApiUrls.salesTaskUrl);
|
||||||
|
setLoading(false);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
final data = SalesTaskResponse.fromJson(response.data);
|
||||||
|
tasksList = data.products ?? [];
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
setLoading(false);
|
||||||
|
debugPrint("Error occurred while fetching sales tasks: $e");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void filterProducts(String val) {
|
||||||
|
tasksList = tasksList.where((element) {
|
||||||
|
final productNameLower = element.ProductName!.toLowerCase();
|
||||||
|
final productSkuLower = element.SKU!.toLowerCase();
|
||||||
|
final searchLower = val.toLowerCase();
|
||||||
|
return productNameLower.contains(searchLower) ||
|
||||||
|
productSkuLower.contains(searchLower);
|
||||||
|
}).toList();
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> submitProducts(
|
||||||
|
{required String distributorType,
|
||||||
|
required String pdRdId,
|
||||||
|
required String date,
|
||||||
|
String? inventoryId,
|
||||||
|
required String tradeName}) async {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
Response response = await _apiClient.post(ApiUrls.postSalesTaskUrl,
|
||||||
|
data: json.encode({
|
||||||
|
"addedFor": distributorType.replaceAll(' ', ''),
|
||||||
|
"addedForId": pdRdId,
|
||||||
|
"tradename": tradeName,
|
||||||
|
"date": date,
|
||||||
|
|
||||||
|
"products": selectedProducts.map((product) {
|
||||||
|
return {
|
||||||
|
"SKU": product.SKU,
|
||||||
|
"ProductName": product.ProductName,
|
||||||
|
"QuantitySold": product.QuantitySold,
|
||||||
|
"comments": product.comments,
|
||||||
|
"SalesAmount": product.SalesAmount
|
||||||
|
};
|
||||||
|
}).toList()
|
||||||
|
// "products": selectedProducts.map((e) => e.toJson()).toList()
|
||||||
|
}));
|
||||||
|
setLoading(false);
|
||||||
|
if (response.statusCode == 201) {
|
||||||
|
ScaffoldMessenger.of(
|
||||||
|
navigatorKey.currentContext!,
|
||||||
|
).showSnackBar(
|
||||||
|
SnackBar(content: Text(response.data['message'])),
|
||||||
|
);
|
||||||
|
if (inventoryId != null) {
|
||||||
|
_apiClient
|
||||||
|
.put(ApiUrls.updateTaskInventoryUrl + inventoryId, data: null)
|
||||||
|
.then((value) {
|
||||||
|
debugPrint('Task Updated');
|
||||||
|
if (value.statusCode == 200) {
|
||||||
|
resetProducts();
|
||||||
|
Navigator.push(
|
||||||
|
navigatorKey.currentContext!,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
const DataSubmitSuccessFullScreen()));
|
||||||
|
} else {
|
||||||
|
ScaffoldMessenger.of(
|
||||||
|
navigatorKey.currentContext!,
|
||||||
|
).showSnackBar(
|
||||||
|
const SnackBar(content: Text('Task not updated')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
resetProducts();
|
||||||
|
Navigator.push(
|
||||||
|
navigatorKey.currentContext!,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const DataSubmitSuccessFullScreen()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
setLoading(false);
|
||||||
|
debugPrint("Error: $e");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void resetProducts() {
|
||||||
|
selectedProducts.clear();
|
||||||
|
tasksList.clear();
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
@ -8,6 +8,7 @@ import 'package:dio/dio.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
|
|
||||||
|
import '../constants/constant.dart';
|
||||||
import '../services/api_urls.dart';
|
import '../services/api_urls.dart';
|
||||||
|
|
||||||
class CollectKycProvider extends ChangeNotifier {
|
class CollectKycProvider extends ChangeNotifier {
|
||||||
@ -149,7 +150,8 @@ class CollectKycProvider extends ChangeNotifier {
|
|||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
const SnackBar(content: Text('Trade Name is required')),
|
const SnackBar(content: Text('Trade Name is required')),
|
||||||
);
|
);
|
||||||
} else if (nameController.text.trim().isEmpty) {
|
} else
|
||||||
|
if (nameController.text.trim().isEmpty) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
const SnackBar(content: Text('Name is required')),
|
const SnackBar(content: Text('Name is required')),
|
||||||
);
|
);
|
||||||
@ -260,12 +262,40 @@ class CollectKycProvider extends ChangeNotifier {
|
|||||||
|
|
||||||
if (response.data['success'] == true) {
|
if (response.data['success'] == true) {
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
|
|
||||||
|
|
||||||
|
if (inventoryId!=null ) {
|
||||||
|
_apiClient.put(ApiUrls.updateTaskInventoryUrl+inventoryId!,data:null).then((value) {
|
||||||
|
debugPrint('Task Updated');
|
||||||
|
if (value.statusCode == 200) {
|
||||||
|
Navigator.push(
|
||||||
|
navigatorKey.currentContext!,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const DataSubmitSuccessFullScreen()));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
ScaffoldMessenger.of(
|
||||||
|
navigatorKey.currentContext!,
|
||||||
|
).showSnackBar(
|
||||||
|
const SnackBar(content: Text('Task not updated')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Navigator.push(
|
||||||
|
navigatorKey.currentContext!,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const DataSubmitSuccessFullScreen()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text(response.data['message'].toString())));
|
SnackBar(content: Text(response.data['message'].toString())));
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => const DataSubmitSuccessFullScreen()));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
@ -286,4 +316,11 @@ class CollectKycProvider extends ChangeNotifier {
|
|||||||
selectedTask = s;
|
selectedTask = s;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String? inventoryId;
|
||||||
|
void setId(String id) {
|
||||||
|
print('inventory id: $id');
|
||||||
|
inventoryId = id;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
52
lib/provider/daily_task_provider.dart
Normal file
52
lib/provider/daily_task_provider.dart
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import 'package:cheminova/models/Daily_Task_Response.dart';
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import '../services/api_client.dart';
|
||||||
|
import '../services/api_urls.dart';
|
||||||
|
|
||||||
|
class DailyTaskProvider extends ChangeNotifier {
|
||||||
|
DailyTaskProvider() {
|
||||||
|
getTask(type: 'New');
|
||||||
|
}
|
||||||
|
|
||||||
|
final _apiClient = ApiClient();
|
||||||
|
List<Tasks> newTasksList = [];
|
||||||
|
List<Tasks> pendingTasksList = [];
|
||||||
|
List<Tasks> completedTasksList = [];
|
||||||
|
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
bool get isLoading => _isLoading;
|
||||||
|
|
||||||
|
void setLoading(bool loading) {
|
||||||
|
_isLoading = loading;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> getTask({required String type}) async {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
Response response = await _apiClient.get(ApiUrls.dailyTaskUrl+type);
|
||||||
|
setLoading(false);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
final data = DailyTasksResponse.fromJson(response.data);
|
||||||
|
|
||||||
|
if (type == 'New') {
|
||||||
|
newTasksList = data.tasks ?? [];
|
||||||
|
} else if (type == 'Pending') {
|
||||||
|
pendingTasksList = data.tasks ?? [];
|
||||||
|
} else {
|
||||||
|
completedTasksList = data.tasks ?? [];
|
||||||
|
}
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
setLoading(false);
|
||||||
|
if (kDebugMode) {
|
||||||
|
print("Error occurred while fetching notifications: $e");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
42
lib/provider/product_manual_provider.dart
Normal file
42
lib/provider/product_manual_provider.dart
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import 'package:cheminova/models/product_manual_model.dart';
|
||||||
|
import 'package:cheminova/services/api_urls.dart';
|
||||||
|
import 'package:cheminova/services/api_client.dart';
|
||||||
|
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class ProductManualProvider extends ChangeNotifier {
|
||||||
|
ProductManualProvider() {
|
||||||
|
getProductManualList();
|
||||||
|
}
|
||||||
|
bool _isLoading = false;
|
||||||
|
List<ProductManualModel> _productManualList = [];
|
||||||
|
final _apiClient = ApiClient();
|
||||||
|
|
||||||
|
List<ProductManualModel> get productManualList => _productManualList;
|
||||||
|
bool get isLoading => _isLoading;
|
||||||
|
|
||||||
|
void setLoading(bool loading) {
|
||||||
|
_isLoading = loading;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> getProductManualList() async {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
Response response = await _apiClient.get(ApiUrls.getProductsManual);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
List<ProductManualModel> data =
|
||||||
|
(response.data['productManuals'] as List)
|
||||||
|
.map((json) => ProductManualModel.fromJson(json))
|
||||||
|
.toList();
|
||||||
|
_productManualList = data;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print("Error occurred: $e");
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,12 +1,10 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:cheminova/constants/constant.dart';
|
import 'package:cheminova/constants/constant.dart';
|
||||||
import 'package:cheminova/screens/data_submit_successfull.dart';
|
import 'package:cheminova/screens/data_submit_successfull.dart';
|
||||||
import 'package:cheminova/services/api_client.dart';
|
import 'package:cheminova/services/api_client.dart';
|
||||||
import 'package:cheminova/services/api_urls.dart';
|
import 'package:cheminova/services/api_urls.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../models/products_response.dart';
|
import '../models/products_response.dart';
|
||||||
|
|
||||||
class ProductProvider extends ChangeNotifier {
|
class ProductProvider extends ChangeNotifier {
|
||||||
@ -38,8 +36,6 @@ class ProductProvider extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getProducts() async {
|
Future<void> getProducts() async {
|
||||||
// setLoading(true);
|
|
||||||
// try {
|
|
||||||
Response response = await _apiClient.get(ApiUrls.getProducts);
|
Response response = await _apiClient.get(ApiUrls.getProducts);
|
||||||
debugPrint('Response: $response');
|
debugPrint('Response: $response');
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
@ -51,14 +47,10 @@ class ProductProvider extends ChangeNotifier {
|
|||||||
.toList();
|
.toList();
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
// } catch (e) {
|
|
||||||
// setLoading(false);
|
|
||||||
// debugPrint("Error: $e");
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> submitProducts(
|
Future<void> submitProducts(
|
||||||
{required String distributorType, required String pdRdId}) async {
|
{required String distributorType, required String pdRdId, String? inventoryId}) async {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
Response response = await _apiClient.post(ApiUrls.submitProductUrl,
|
Response response = await _apiClient.post(ApiUrls.submitProductUrl,
|
||||||
@ -74,11 +66,32 @@ class ProductProvider extends ChangeNotifier {
|
|||||||
).showSnackBar(
|
).showSnackBar(
|
||||||
SnackBar(content: Text(response.data['message'])),
|
SnackBar(content: Text(response.data['message'])),
|
||||||
);
|
);
|
||||||
resetProducts();
|
if (inventoryId!=null ) {
|
||||||
Navigator.push(
|
_apiClient.put(ApiUrls.updateTaskInventoryUrl+inventoryId,data:null).then((value) {
|
||||||
navigatorKey.currentContext!,
|
debugPrint('Task Updated');
|
||||||
MaterialPageRoute(
|
if (value.statusCode == 200) {
|
||||||
builder: (context) => const DataSubmitSuccessFullScreen()));
|
resetProducts();
|
||||||
|
Navigator.push(
|
||||||
|
navigatorKey.currentContext!,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const DataSubmitSuccessFullScreen()));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
ScaffoldMessenger.of(
|
||||||
|
navigatorKey.currentContext!,
|
||||||
|
).showSnackBar(
|
||||||
|
const SnackBar(content: Text('Task not updated')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
resetProducts();
|
||||||
|
Navigator.push(
|
||||||
|
navigatorKey.currentContext!,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const DataSubmitSuccessFullScreen()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
@ -114,6 +127,8 @@ class ProductModel {
|
|||||||
inventory: json['Inventory']);
|
inventory: json['Inventory']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get comments => null;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return {
|
return {
|
||||||
'SKU': sku,
|
'SKU': sku,
|
||||||
|
@ -14,7 +14,6 @@ class RejectedProvider extends ChangeNotifier {
|
|||||||
List<RejectedApplicationResponse> rejectedApplicationList = [];
|
List<RejectedApplicationResponse> rejectedApplicationList = [];
|
||||||
|
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
|
|
||||||
bool get isLoading => _isLoading;
|
bool get isLoading => _isLoading;
|
||||||
|
|
||||||
void setLoading(bool loading) {
|
void setLoading(bool loading) {
|
||||||
|
43
lib/provider/select_task_provider.dart
Normal file
43
lib/provider/select_task_provider.dart
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
import 'package:cheminova/models/select_task_response.dart';
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import '../services/api_client.dart';
|
||||||
|
import '../services/api_urls.dart';
|
||||||
|
|
||||||
|
class SelectTaskProvider extends ChangeNotifier {
|
||||||
|
SelectTaskProvider() {
|
||||||
|
getTask();
|
||||||
|
}
|
||||||
|
|
||||||
|
final _apiClient = ApiClient();
|
||||||
|
List<Tasks> tasksList=[];
|
||||||
|
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
bool get isLoading => _isLoading;
|
||||||
|
|
||||||
|
void setLoading(bool loading) {
|
||||||
|
_isLoading = loading;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> getTask() async {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
Response response = await _apiClient.get(ApiUrls.kycSelectTaskUrl);
|
||||||
|
setLoading(false);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
final data = SelectTaskKycResponse.fromJson(response.data);
|
||||||
|
tasksList = data.tasks ?? [];
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
setLoading(false);
|
||||||
|
if (kDebugMode) {
|
||||||
|
print("Error occurred while fetching notifications: $e");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
45
lib/provider/userprofile_provider.dart
Normal file
45
lib/provider/userprofile_provider.dart
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import 'package:cheminova/models/profile_response.dart';
|
||||||
|
import 'package:cheminova/services/api_client.dart';
|
||||||
|
import 'package:cheminova/services/api_urls.dart';
|
||||||
|
import 'package:cheminova/services/secure__storage_service.dart';
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import '../screens/login_screen.dart';
|
||||||
|
|
||||||
|
class UserprofileProvider extends ChangeNotifier {
|
||||||
|
final _apiClient = ApiClient();
|
||||||
|
ProfileResponse? profileResponse;
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
bool get isLoading => _isLoading;
|
||||||
|
|
||||||
|
void setLoading(bool loading) {
|
||||||
|
_isLoading = loading;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> getProfile() async {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
Response response = await _apiClient.get(ApiUrls.profileUrl);
|
||||||
|
setLoading(false);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
profileResponse = ProfileResponse.fromJson(response.data);
|
||||||
|
} else {}
|
||||||
|
} catch (e) {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> logOut(BuildContext context) async {
|
||||||
|
Response response = await _apiClient.get(ApiUrls.logOutUrl);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(content: Text(response.data['message'].toString())));
|
||||||
|
SecureStorageService().clear();
|
||||||
|
Navigator.pushReplacement(
|
||||||
|
context, MaterialPageRoute(builder: (context) => const LoginPage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
33
lib/provider/visit_pdrd_provider.dart
Normal file
33
lib/provider/visit_pdrd_provider.dart
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import '../constants/constant.dart';
|
||||||
|
import '../screens/data_submit_successfull.dart';
|
||||||
|
import '../services/api_client.dart';
|
||||||
|
import '../services/api_urls.dart';
|
||||||
|
|
||||||
|
class VisitPdRdProvider with ChangeNotifier {
|
||||||
|
final _apiClient = ApiClient();
|
||||||
|
bool _isLoading = false;
|
||||||
|
void setLoading(bool loading) {
|
||||||
|
_isLoading = loading;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> submitVisitPdRd(String id) async {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
Response response = await _apiClient.put(ApiUrls.updateTaskInventoryUrl+id);
|
||||||
|
debugPrint('Response: $response');
|
||||||
|
setLoading(false);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
Navigator.push(
|
||||||
|
navigatorKey.currentContext!,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const DataSubmitSuccessFullScreen()));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
setLoading(false);
|
||||||
|
debugPrint("Error: $e");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -12,12 +12,13 @@ class AddProductsScreen extends StatefulWidget {
|
|||||||
final String distributorType;
|
final String distributorType;
|
||||||
final String tradeName;
|
final String tradeName;
|
||||||
final String pdRdId;
|
final String pdRdId;
|
||||||
|
final String? inventoryId;
|
||||||
|
|
||||||
const AddProductsScreen({
|
const AddProductsScreen({
|
||||||
super.key,
|
super.key,
|
||||||
required this.distributorType,
|
required this.distributorType,
|
||||||
required this.tradeName,
|
required this.tradeName,
|
||||||
required this.pdRdId
|
required this.pdRdId, this.inventoryId
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -39,7 +40,7 @@ class _AddProductsScreenState extends State<AddProductsScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
if (mounted) {
|
if (context.mounted) {
|
||||||
productProvider.resetProducts();
|
productProvider.resetProducts();
|
||||||
}
|
}
|
||||||
super.dispose();
|
super.dispose();
|
||||||
@ -177,7 +178,7 @@ class _AddProductsScreenState extends State<AddProductsScreen> {
|
|||||||
product.inventory != null)) {
|
product.inventory != null)) {
|
||||||
value.submitProducts(
|
value.submitProducts(
|
||||||
distributorType: widget.distributorType,
|
distributorType: widget.distributorType,
|
||||||
pdRdId: widget.pdRdId
|
pdRdId: widget.pdRdId, inventoryId: widget.inventoryId
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
140
lib/screens/Update_inventorytask_screen.dart
Normal file
140
lib/screens/Update_inventorytask_screen.dart
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:cheminova/models/Daily_Task_Response.dart';
|
||||||
|
import 'package:cheminova/widgets/common_app_bar.dart';
|
||||||
|
import 'package:cheminova/widgets/common_background.dart';
|
||||||
|
import 'package:cheminova/widgets/common_drawer.dart';
|
||||||
|
import '../constants/constant.dart';
|
||||||
|
import '../provider/daily_task_provider.dart';
|
||||||
|
import 'Add_products_screen.dart';
|
||||||
|
|
||||||
|
class UpdateInventoryTaskScreen extends StatefulWidget {
|
||||||
|
const UpdateInventoryTaskScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_UpdateInventoryTaskScreenState createState() => _UpdateInventoryTaskScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _UpdateInventoryTaskScreenState extends State<UpdateInventoryTaskScreen> {
|
||||||
|
late DailyTaskProvider _dailyTaskProvider;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_dailyTaskProvider = DailyTaskProvider();
|
||||||
|
_dailyTaskProvider.getTask(type: 'New');
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ChangeNotifierProvider(
|
||||||
|
create: (context) => _dailyTaskProvider,
|
||||||
|
child: Scaffold(
|
||||||
|
extendBodyBehindAppBar: true,
|
||||||
|
appBar: _buildAppBar(),
|
||||||
|
drawer: const CommonDrawer(),
|
||||||
|
body: CommonBackground(
|
||||||
|
child: SafeArea(
|
||||||
|
child: _buildTaskList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
CommonAppBar _buildAppBar() {
|
||||||
|
return CommonAppBar(
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
elevation: 0,
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
icon: Image.asset('assets/Back_attendance.png'),
|
||||||
|
padding: const EdgeInsets.only(right: 20),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
title: const Text(
|
||||||
|
'Inventory Update Tasks',
|
||||||
|
style: TextStyle(color: Colors.black87, fontSize: 20),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildTaskList() {
|
||||||
|
return Consumer<DailyTaskProvider>(
|
||||||
|
builder: (context, value, child) {
|
||||||
|
if (value.isLoading) {
|
||||||
|
return const Center(child: CircularProgressIndicator());
|
||||||
|
}
|
||||||
|
|
||||||
|
final inventoryTasks = value.newTasksList
|
||||||
|
.where((task) => task.task?.toLowerCase() == 'update inventory data')
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
if (inventoryTasks.isEmpty) {
|
||||||
|
return const Center(
|
||||||
|
child: Text(
|
||||||
|
'NO TASK',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.black87,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ListView.separated(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
itemCount: inventoryTasks.length,
|
||||||
|
separatorBuilder: (context, index) => const SizedBox(height: 8),
|
||||||
|
itemBuilder: (context, index) => _buildTaskCard(inventoryTasks[index]),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildTaskCard(Tasks tasksList) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: () {
|
||||||
|
if (tasksList.sId != null && tasksList.addedFor != null) {
|
||||||
|
Navigator.push(
|
||||||
|
navigatorKey.currentContext!,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => AddProductsScreen(
|
||||||
|
distributorType: tasksList.addedFor!,
|
||||||
|
inventoryId: tasksList.sId!,
|
||||||
|
tradeName: tasksList.tradeName??'',
|
||||||
|
pdRdId: tasksList.sId!)));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Card(
|
||||||
|
color: Colors.white,
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||||
|
child: ListTile(
|
||||||
|
leading: const Icon(Icons.inventory, color: Colors.blueAccent),
|
||||||
|
title: Text(
|
||||||
|
tasksList.task ?? '',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.black87,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 16,
|
||||||
|
fontFamily: 'Anek',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text('Distributor: ${tasksList.addedFor ?? ""}'),
|
||||||
|
Text('Trader Name: ${tasksList.tradeName??''}'),
|
||||||
|
if(tasksList.taskDueDate != null) Text('Due Date: ${DateFormat('dd/MM/yyyy').format(DateTime.parse(tasksList.taskDueDate!))}'),
|
||||||
|
Text('Priority: ${tasksList.taskPriority}'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
trailing: const Icon(Icons.arrow_forward_ios, color: Colors.black87),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
423
lib/screens/add_sales_product_screen.dart
Normal file
423
lib/screens/add_sales_product_screen.dart
Normal file
@ -0,0 +1,423 @@
|
|||||||
|
import 'package:cheminova/models/SalesTaskResponse.dart';
|
||||||
|
import 'package:cheminova/provider/add_sales_product_provider.dart';
|
||||||
|
import 'package:cheminova/widgets/common_app_bar.dart';
|
||||||
|
import 'package:cheminova/widgets/common_background.dart';
|
||||||
|
import 'package:cheminova/widgets/common_drawer.dart';
|
||||||
|
import 'package:cheminova/widgets/common_elevated_button.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class AddSalesProductScreen extends StatefulWidget {
|
||||||
|
final String distributorType;
|
||||||
|
final String tradeName;
|
||||||
|
final String pdRdId;
|
||||||
|
final String? inventoryId;
|
||||||
|
|
||||||
|
const AddSalesProductScreen(
|
||||||
|
{super.key,
|
||||||
|
required this.distributorType,
|
||||||
|
required this.tradeName,
|
||||||
|
required this.pdRdId,
|
||||||
|
this.inventoryId});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<AddSalesProductScreen> createState() => _AddSalesProductScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddSalesProductScreenState extends State<AddSalesProductScreen> {
|
||||||
|
final searchController = TextEditingController();
|
||||||
|
late AddSalesProvider salesTaskProvider;
|
||||||
|
final dateController = TextEditingController();
|
||||||
|
final formKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
salesTaskProvider = Provider.of<AddSalesProvider>(context, listen: false);
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
|
salesTaskProvider.getTask();
|
||||||
|
});
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
if (mounted) {
|
||||||
|
salesTaskProvider.resetProducts();
|
||||||
|
}
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
datePicker() async {
|
||||||
|
final DateTime? picked = await showDatePicker(
|
||||||
|
context: context,
|
||||||
|
initialDate: DateTime.now(),
|
||||||
|
firstDate: DateTime(2000),
|
||||||
|
lastDate: DateTime(2101),
|
||||||
|
);
|
||||||
|
if (picked != null) {
|
||||||
|
setState(
|
||||||
|
() => dateController.text = DateFormat('dd/MM/yyyy').format(picked));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return PopScope(
|
||||||
|
canPop: true,
|
||||||
|
child: CommonBackground(
|
||||||
|
child: Scaffold(
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
appBar: CommonAppBar(
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
icon: Image.asset('assets/Back_attendance.png'),
|
||||||
|
padding: const EdgeInsets.only(right: 20))
|
||||||
|
],
|
||||||
|
title: Text('${widget.distributorType}\n${widget.tradeName}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
fontFamily: 'Anek')),
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
elevation: 0),
|
||||||
|
drawer: const CommonDrawer(),
|
||||||
|
bottomNavigationBar: Consumer<AddSalesProvider>(
|
||||||
|
builder: (context, value, child) => Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Align(
|
||||||
|
alignment: value.tasksList.isEmpty
|
||||||
|
? Alignment.center
|
||||||
|
: Alignment.bottomCenter,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
FloatingActionButton.extended(
|
||||||
|
onPressed: () {
|
||||||
|
showModalBottomSheet(
|
||||||
|
isScrollControlled: true,
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
maxHeight: MediaQuery.of(context)
|
||||||
|
.size
|
||||||
|
.height *
|
||||||
|
0.9),
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return Consumer<AddSalesProvider>(
|
||||||
|
builder:
|
||||||
|
(context, value, child) =>
|
||||||
|
StatefulBuilder(builder:
|
||||||
|
(context,
|
||||||
|
setState) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets
|
||||||
|
.all(
|
||||||
|
18.0),
|
||||||
|
child: TextField(
|
||||||
|
controller: searchController,
|
||||||
|
decoration: const InputDecoration(labelText: 'Search by name or SKU', border: OutlineInputBorder(), prefixIcon: Icon(Icons.search)),
|
||||||
|
onChanged: (val) {
|
||||||
|
value.filterProducts(
|
||||||
|
val);
|
||||||
|
setState(
|
||||||
|
() {});
|
||||||
|
})),
|
||||||
|
Expanded(
|
||||||
|
child: ListView
|
||||||
|
.builder(
|
||||||
|
itemCount: searchController.text.isEmpty
|
||||||
|
? value.tasksList.length
|
||||||
|
: value.searchList.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
bool isAlreadySelected = value.selectedProducts.any((selectedProduct) => selectedProduct.SKU == value.tasksList[index].SKU);
|
||||||
|
final data = searchController.text.isEmpty ? value.tasksList[index] : value.searchList[index];
|
||||||
|
return Card(
|
||||||
|
child: ListTile(
|
||||||
|
title: Text(data.ProductName ?? '', style: TextStyle(color: isAlreadySelected ? Colors.grey : Colors.black)),
|
||||||
|
subtitle: Text(data.SKU ?? '', style: TextStyle(color: isAlreadySelected ? Colors.grey : Colors.black)),
|
||||||
|
onTap: isAlreadySelected
|
||||||
|
? null
|
||||||
|
: () {
|
||||||
|
setState(() => value.selectedProducts.add(data));
|
||||||
|
Navigator.pop(context);
|
||||||
|
}));
|
||||||
|
}))
|
||||||
|
]);
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
).whenComplete(() => setState(() {}));
|
||||||
|
},
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
icon: const Icon(Icons.add,
|
||||||
|
color: Colors.black),
|
||||||
|
label: const Text('Add Products',
|
||||||
|
style:
|
||||||
|
TextStyle(color: Colors.black))),
|
||||||
|
if (value.selectedProducts.isNotEmpty) ...[
|
||||||
|
const SizedBox(height: 16.0),
|
||||||
|
Consumer<AddSalesProvider>(
|
||||||
|
builder: (context, value, child) =>
|
||||||
|
CommonElevatedButton(
|
||||||
|
borderRadius: 30,
|
||||||
|
width: double.infinity,
|
||||||
|
height: kToolbarHeight - 10,
|
||||||
|
text: 'SUBMIT',
|
||||||
|
backgroundColor:
|
||||||
|
const Color(0xff004791),
|
||||||
|
onPressed: () {
|
||||||
|
if (formKey.currentState!
|
||||||
|
.validate()) {
|
||||||
|
if (value.selectedProducts
|
||||||
|
.isNotEmpty &&
|
||||||
|
value.selectedProducts.every((product) =>
|
||||||
|
product.SKU!
|
||||||
|
.isNotEmpty &&
|
||||||
|
product.ProductName!
|
||||||
|
.isNotEmpty &&
|
||||||
|
product.SalesAmount !=
|
||||||
|
null &&
|
||||||
|
product.QuantitySold !=
|
||||||
|
null)) {
|
||||||
|
value.submitProducts(
|
||||||
|
distributorType: widget
|
||||||
|
.distributorType,
|
||||||
|
pdRdId: widget.pdRdId,
|
||||||
|
inventoryId:
|
||||||
|
widget.inventoryId,
|
||||||
|
date: dateController
|
||||||
|
.text
|
||||||
|
.trim(),
|
||||||
|
tradeName:
|
||||||
|
widget.tradeName);
|
||||||
|
} else {
|
||||||
|
ScaffoldMessenger.of(
|
||||||
|
context)
|
||||||
|
.showSnackBar(
|
||||||
|
const SnackBar(
|
||||||
|
content: Text(
|
||||||
|
'Please fill out all product details, including sale and inventory.')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
]
|
||||||
|
]))),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body:
|
||||||
|
Consumer<AddSalesProvider>(builder: (context, value, child) {
|
||||||
|
return Stack(children: [
|
||||||
|
Column(children: [
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () => datePicker(),
|
||||||
|
child: AbsorbPointer(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Form(
|
||||||
|
key: formKey,
|
||||||
|
child: TextFormField(
|
||||||
|
controller: dateController,
|
||||||
|
validator: (value) {
|
||||||
|
if (value!.isEmpty) {
|
||||||
|
return 'Please select a date';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Date',
|
||||||
|
fillColor: Colors.white,
|
||||||
|
filled: true,
|
||||||
|
border: InputBorder.none,
|
||||||
|
suffixIcon: Icon(Icons.calendar_today),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (value.selectedProducts.isNotEmpty)
|
||||||
|
Expanded(
|
||||||
|
child: ListView.builder(
|
||||||
|
itemCount: value.selectedProducts.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return ProductBlock(
|
||||||
|
onUpdate: (updatedProduct) {
|
||||||
|
setState(() {
|
||||||
|
value.selectedProducts[index] =
|
||||||
|
updatedProduct;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onRemove: () {
|
||||||
|
setState(() {
|
||||||
|
value.selectedProducts.removeAt(index);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
product: value.selectedProducts[index]);
|
||||||
|
}))
|
||||||
|
]),
|
||||||
|
(value.isLoading)
|
||||||
|
? Container(
|
||||||
|
color: Colors.black12,
|
||||||
|
child:
|
||||||
|
const Center(child: CircularProgressIndicator()))
|
||||||
|
: const SizedBox()
|
||||||
|
]);
|
||||||
|
}))),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ProductBlock extends StatefulWidget {
|
||||||
|
final SalesProduct product;
|
||||||
|
final ValueChanged<SalesProduct> onUpdate;
|
||||||
|
final VoidCallback onRemove;
|
||||||
|
|
||||||
|
const ProductBlock({
|
||||||
|
super.key,
|
||||||
|
required this.product,
|
||||||
|
required this.onUpdate,
|
||||||
|
required this.onRemove,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ProductBlock> createState() => _ProductBlockState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ProductBlockState extends State<ProductBlock> {
|
||||||
|
final saleAmountController = TextEditingController();
|
||||||
|
final quantitySoldController = TextEditingController();
|
||||||
|
final commentController = TextEditingController();
|
||||||
|
String? errorMessage;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
saleAmountController.text = (widget.product.SalesAmount ?? '').toString();
|
||||||
|
commentController.text = (widget.product.comments?? '').toString();
|
||||||
|
quantitySoldController.text =
|
||||||
|
(widget.product.QuantitySold ?? '').toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void validateInput() {
|
||||||
|
setState(() {
|
||||||
|
String? quantitySoldError;
|
||||||
|
String? salesAmountError;
|
||||||
|
|
||||||
|
if (saleAmountController.text.isEmpty) {
|
||||||
|
quantitySoldError = 'Quantity sold cannot be empty.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (quantitySoldController.text.isEmpty) {
|
||||||
|
salesAmountError = 'Sales amount cannot be empty.';
|
||||||
|
}
|
||||||
|
|
||||||
|
errorMessage = null;
|
||||||
|
if (quantitySoldError == null && salesAmountError == null) {
|
||||||
|
int quantitySold = int.parse(quantitySoldController.text);
|
||||||
|
int salesAmount = int.parse(saleAmountController.text);
|
||||||
|
String comments =commentController.text;
|
||||||
|
|
||||||
|
widget.onUpdate(SalesProduct(
|
||||||
|
SKU: widget.product.SKU,
|
||||||
|
ProductName: widget.product.ProductName,
|
||||||
|
QuantitySold: quantitySold,
|
||||||
|
SalesAmount: salesAmount,
|
||||||
|
comments: comments,
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
errorMessage = quantitySoldError ?? salesAmountError;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Card(
|
||||||
|
color: Colors.white,
|
||||||
|
margin: const EdgeInsets.all(8),
|
||||||
|
child: Stack(children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child:
|
||||||
|
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||||
|
Text('Product: ${widget.product.ProductName}',
|
||||||
|
style: const TextStyle(fontSize: 16)),
|
||||||
|
Text('SKU: ${widget.product.SKU}',
|
||||||
|
style: const TextStyle(fontSize: 15)),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||||
|
TextField(
|
||||||
|
controller: saleAmountController,
|
||||||
|
onTapOutside: (event) => FocusScope.of(context).unfocus(),
|
||||||
|
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'Sales amount',
|
||||||
|
errorText: saleAmountController.text.isEmpty
|
||||||
|
? 'Sales amount cannot be empty.'
|
||||||
|
: null),
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
enabled: true,
|
||||||
|
onChanged: (_) => validateInput()),
|
||||||
|
TextField(
|
||||||
|
controller: quantitySoldController,
|
||||||
|
onTapOutside: (event) => FocusScope.of(context).unfocus(),
|
||||||
|
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'Quantity sold',
|
||||||
|
errorText: quantitySoldController.text.isEmpty
|
||||||
|
? 'Quantity sold cannot be empty.'
|
||||||
|
: null),
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
enabled: true,
|
||||||
|
onChanged: (_) => validateInput()),
|
||||||
|
TextField(
|
||||||
|
controller: commentController,
|
||||||
|
onTapOutside: (event) => FocusScope.of(context).unfocus(),
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Comments',),
|
||||||
|
enabled: true,
|
||||||
|
onChanged: (_) => validateInput())
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
top: 0,
|
||||||
|
right: 0,
|
||||||
|
child: IconButton(
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.delete_outlined,
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
onPressed: widget.onRemove)),
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ProductModel {
|
||||||
|
final String sku;
|
||||||
|
final String productName;
|
||||||
|
final int? sale;
|
||||||
|
final int? inventory;
|
||||||
|
final String? comments;
|
||||||
|
final String? date;
|
||||||
|
|
||||||
|
ProductModel({
|
||||||
|
required this.sku,
|
||||||
|
required this.productName,
|
||||||
|
this.sale,
|
||||||
|
this.inventory,
|
||||||
|
this.comments,
|
||||||
|
this.date,
|
||||||
|
});
|
||||||
|
}
|
@ -11,7 +11,8 @@ import 'package:provider/provider.dart';
|
|||||||
import '../widgets/common_app_bar.dart';
|
import '../widgets/common_app_bar.dart';
|
||||||
|
|
||||||
class CollectKycScreen extends StatefulWidget {
|
class CollectKycScreen extends StatefulWidget {
|
||||||
const CollectKycScreen({super.key});
|
final String id;
|
||||||
|
const CollectKycScreen({super.key, required this.id});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<CollectKycScreen> createState() => CollectKycScreenState();
|
State<CollectKycScreen> createState() => CollectKycScreenState();
|
||||||
@ -30,6 +31,7 @@ class CollectKycScreenState extends State<CollectKycScreen>
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
collectKycProvider = CollectKycProvider();
|
collectKycProvider = CollectKycProvider();
|
||||||
|
collectKycProvider.setId(widget.id);
|
||||||
collectKycProvider.tabController = TabController(length: 3, vsync: this);
|
collectKycProvider.tabController = TabController(length: 3, vsync: this);
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:cheminova/models/Daily_Task_Response.dart';
|
||||||
import 'package:cheminova/screens/visit_dealers_screen.dart';
|
import 'package:cheminova/screens/Add_products_screen.dart';
|
||||||
import 'package:cheminova/screens/display_sales_screen.dart';
|
import 'package:cheminova/screens/add_sales_product_screen.dart';
|
||||||
import 'package:cheminova/screens/update_inventory_screen.dart';
|
|
||||||
import 'package:cheminova/screens/collect_kyc_screen.dart';
|
import 'package:cheminova/screens/collect_kyc_screen.dart';
|
||||||
|
import 'package:cheminova/screens/visit_rd_pd_screen.dart';
|
||||||
import 'package:cheminova/widgets/common_app_bar.dart';
|
import 'package:cheminova/widgets/common_app_bar.dart';
|
||||||
import 'package:cheminova/widgets/common_drawer.dart';
|
|
||||||
import 'package:cheminova/widgets/common_background.dart';
|
import 'package:cheminova/widgets/common_background.dart';
|
||||||
|
import 'package:cheminova/widgets/common_drawer.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../provider/daily_task_provider.dart';
|
||||||
|
|
||||||
class DailyTasksScreen extends StatefulWidget {
|
class DailyTasksScreen extends StatefulWidget {
|
||||||
const DailyTasksScreen({super.key});
|
const DailyTasksScreen({super.key});
|
||||||
@ -18,30 +22,39 @@ class DailyTasksScreen extends StatefulWidget {
|
|||||||
class _DailyTasksScreenState extends State<DailyTasksScreen> {
|
class _DailyTasksScreenState extends State<DailyTasksScreen> {
|
||||||
final List<String> _tabTitles = ['NEW', 'PENDING', 'COMPLETED'];
|
final List<String> _tabTitles = ['NEW', 'PENDING', 'COMPLETED'];
|
||||||
int _selectedTabIndex = 0;
|
int _selectedTabIndex = 0;
|
||||||
|
late DailyTaskProvider _dailyTaskProvider;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
_dailyTaskProvider = DailyTaskProvider();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return ChangeNotifierProvider(
|
||||||
extendBodyBehindAppBar: true,
|
create: (context) => _dailyTaskProvider,
|
||||||
appBar: _buildAppBar(),
|
child: Scaffold(
|
||||||
drawer: const CommonDrawer(),
|
extendBodyBehindAppBar: true,
|
||||||
body: CommonBackground(
|
appBar: _buildAppBar(),
|
||||||
child: SafeArea(
|
drawer: const CommonDrawer(),
|
||||||
child: Column(
|
body: CommonBackground(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
child: SafeArea(
|
||||||
children: [
|
child: Column(
|
||||||
_buildCustomTabBar(),
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
Expanded(
|
children: [
|
||||||
child: _buildTaskList(_selectedTabIndex),
|
_buildCustomTabBar(),
|
||||||
|
Expanded(
|
||||||
|
child: _buildTaskList(_selectedTabIndex),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
));
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PreferredSizeWidget _buildAppBar() {
|
CommonAppBar _buildAppBar() {
|
||||||
return CommonAppBar(
|
return CommonAppBar(
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
@ -67,7 +80,16 @@ class _DailyTasksScreenState extends State<DailyTasksScreen> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: List.generate(_tabTitles.length, (index) {
|
children: List.generate(_tabTitles.length, (index) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => setState(() => _selectedTabIndex = index),
|
onTap: () {
|
||||||
|
setState(() => _selectedTabIndex = index);
|
||||||
|
if (index == 0) {
|
||||||
|
_dailyTaskProvider.getTask(type: 'New');
|
||||||
|
} else if (index == 1) {
|
||||||
|
_dailyTaskProvider.getTask(type: 'Pending');
|
||||||
|
} else {
|
||||||
|
_dailyTaskProvider.getTask(type: 'Completed');
|
||||||
|
}
|
||||||
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -135,117 +157,115 @@ class _DailyTasksScreenState extends State<DailyTasksScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildTaskList(int tabIndex) {
|
Widget _buildTaskList(int tabIndex) {
|
||||||
List<TaskItem> tasks;
|
return Consumer<DailyTaskProvider>(
|
||||||
switch (tabIndex) {
|
builder: (context, value, child) => value.isLoading
|
||||||
case 0:
|
? const Center(child: CircularProgressIndicator())
|
||||||
tasks = _newTasks;
|
: ListView.separated(
|
||||||
break;
|
padding: const EdgeInsets.all(16),
|
||||||
case 1:
|
itemCount: _selectedTabIndex == 0
|
||||||
tasks = _pendingTasks;
|
? value.newTasksList.length
|
||||||
break;
|
: _selectedTabIndex == 1
|
||||||
case 2:
|
? value.pendingTasksList.length
|
||||||
tasks = _completedTasks;
|
: value.completedTasksList.length,
|
||||||
break;
|
separatorBuilder: (context, index) => const SizedBox(height: 8),
|
||||||
default:
|
itemBuilder: (context, index) {
|
||||||
tasks = [];
|
final tasksList = tabIndex == 0
|
||||||
}
|
? value.newTasksList
|
||||||
|
: tabIndex == 1
|
||||||
return ListView.separated(
|
? value.pendingTasksList
|
||||||
padding: const EdgeInsets.all(16),
|
: value.completedTasksList;
|
||||||
itemCount: tasks.length,
|
return _buildTaskCard(tasksList[index]);
|
||||||
separatorBuilder: (context, index) => const SizedBox(height: 8),
|
},
|
||||||
itemBuilder: (context, index) => _buildTaskCard(tasks[index]),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildTaskCard(TaskItem task) {
|
Widget _buildTaskCard(Tasks tasksList) {
|
||||||
if (task is KycTaskItem) {
|
return InkWell(
|
||||||
return Card(
|
onTap: _selectedTabIndex == 2
|
||||||
|
? null // Disable click when on the "COMPLETED" tab
|
||||||
|
: () {
|
||||||
|
print('Task: ${tasksList.toJson()}');
|
||||||
|
if (tasksList.task == 'Collect KYC') {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
CollectKycScreen(id: tasksList.sId ?? '')));
|
||||||
|
} else if (tasksList.task == 'REUPLOAD') {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
CollectKycScreen(id: tasksList.taskId ?? '')));
|
||||||
|
} else if (tasksList.task == 'Update Inventory Data') {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => AddProductsScreen(
|
||||||
|
distributorType: tasksList.addedFor!,
|
||||||
|
tradeName: tasksList.tradeName ?? '',
|
||||||
|
pdRdId: tasksList.addedForId!,
|
||||||
|
inventoryId: tasksList.sId)));
|
||||||
|
} else if (tasksList.task == 'Update Sales Data') {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => AddSalesProductScreen(
|
||||||
|
distributorType: tasksList.addedFor!,
|
||||||
|
tradeName: tasksList.tradeName!,
|
||||||
|
pdRdId: tasksList.addedForId!,
|
||||||
|
inventoryId:tasksList.sId,
|
||||||
|
)));
|
||||||
|
} else if (tasksList.task == 'Visit RD/PD') {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => VisitDealersScreen(
|
||||||
|
tradeName: tasksList.tradeName ?? '',
|
||||||
|
id: tasksList.sId,
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Card(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||||
child: Column(
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.task, color: Colors.blueAccent),
|
leading: const Icon(Icons.task, color: Colors.blueAccent),
|
||||||
title: Text(
|
title: Text(tasksList.task ?? '',
|
||||||
task.title,
|
style: const TextStyle(
|
||||||
style: const TextStyle(
|
color: Colors.black87,
|
||||||
color: Colors.black87,
|
fontWeight: FontWeight.w700,
|
||||||
fontWeight: FontWeight.w700,
|
fontSize: 16,
|
||||||
fontSize: 16,
|
fontFamily: 'Anek')),
|
||||||
fontFamily: 'Anek',
|
trailing: _selectedTabIndex == 2
|
||||||
),
|
? null // Remove arrow icon in "COMPLETED" tab
|
||||||
),
|
: const Icon(Icons.arrow_forward_ios, color: Colors.black87),
|
||||||
trailing:
|
|
||||||
const Icon(Icons.arrow_forward_ios, color: Colors.black87),
|
|
||||||
onTap: () => Navigator.push(context,
|
|
||||||
MaterialPageRoute(builder: (context) => task.screen)),
|
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text('Note: ${task.note}'),
|
if (tasksList.note != null) Text('Note: ${tasksList.note}'),
|
||||||
Text('Date: ${task.date.toString().split(' ')[0]}'),
|
if (tasksList.addedFor != null)
|
||||||
Text('Priority: ${task.Low}'),
|
Text('Distributor: ${tasksList.addedFor ?? ""}'),
|
||||||
|
if (tasksList.tradeName != null)
|
||||||
|
Text('Trade Name: ${tasksList.tradeName ?? ""}'),
|
||||||
|
if (tasksList.taskDueDate != null)
|
||||||
|
Text(
|
||||||
|
'Due Date: ${DateFormat('dd/MM/yyyy').format(DateTime.parse(tasksList.taskDueDate!))}'),
|
||||||
|
if (tasksList.taskPriority != null)
|
||||||
|
Text('Priority: ${tasksList.taskPriority}'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
} else {
|
);
|
||||||
return Card(
|
|
||||||
color: Colors.white,
|
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
|
||||||
child: ListTile(
|
|
||||||
leading: const Icon(Icons.task, color: Colors.blueAccent),
|
|
||||||
title: Text(
|
|
||||||
task.title,
|
|
||||||
style: const TextStyle(
|
|
||||||
color: Colors.black87,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontSize: 16,
|
|
||||||
fontFamily: 'Anek',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
trailing: const Icon(Icons.arrow_forward_ios, color: Colors.black87),
|
|
||||||
onTap: () => Navigator.push(
|
|
||||||
context, MaterialPageRoute(builder: (context) => task.screen)),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<TaskItem> _newTasks = [
|
|
||||||
KycTaskItem('Collect KYC Documents', const CollectKycScreen(),
|
|
||||||
'Collect KYC documents from ABC Trader', DateFormat('dd/MM/yyyy').format(DateTime.now()).toString(), 'Priority'),
|
|
||||||
TaskItem('Update Inventory Data', const UpdateInventoryScreen()),
|
|
||||||
];
|
|
||||||
|
|
||||||
final List<TaskItem> _pendingTasks = [
|
|
||||||
TaskItem('Update Sales Data', const DisplaySalesScreen()),
|
|
||||||
TaskItem('Visit Dealers/Retailers', const VisitDealersScreen()),
|
|
||||||
];
|
|
||||||
|
|
||||||
final List<TaskItem> _completedTasks = [
|
|
||||||
TaskItem('Completed Task 1', const Placeholder()),
|
|
||||||
TaskItem('Completed Task 2', const Placeholder()),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
class TaskItem {
|
|
||||||
final String title;
|
|
||||||
final Widget screen;
|
|
||||||
|
|
||||||
TaskItem(this.title, this.screen);
|
|
||||||
}
|
|
||||||
|
|
||||||
class KycTaskItem extends TaskItem {
|
|
||||||
final String note;
|
|
||||||
final String date;
|
|
||||||
final String Low;
|
|
||||||
|
|
||||||
KycTaskItem(super.title, super.screen, this.note, this.date, this.Low);
|
|
||||||
}
|
}
|
||||||
|
@ -1,135 +0,0 @@
|
|||||||
import 'package:cheminova/screens/data_submit_successfull.dart';
|
|
||||||
import 'package:cheminova/widgets/common_drawer.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:cheminova/widgets/common_background.dart';
|
|
||||||
import 'package:intl/intl.dart';
|
|
||||||
import '../widgets/common_app_bar.dart';
|
|
||||||
import '../widgets/common_elevated_button.dart';
|
|
||||||
import '../widgets/common_text_form_field.dart';
|
|
||||||
class DisplaySalesScreen extends StatefulWidget {
|
|
||||||
const DisplaySalesScreen({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<DisplaySalesScreen> createState() => DisplaySalesScreenState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class DisplaySalesScreenState extends State<DisplaySalesScreen> {
|
|
||||||
final dateController = TextEditingController(
|
|
||||||
text: DateFormat('dd/MM/yyyy').format(DateTime.now()));
|
|
||||||
|
|
||||||
final timeController =
|
|
||||||
TextEditingController(text: DateFormat('hh:mm a').format(DateTime.now()));
|
|
||||||
|
|
||||||
final locationController = TextEditingController();
|
|
||||||
final notesController = TextEditingController();
|
|
||||||
final dealercontroller = TextEditingController();
|
|
||||||
final productController = TextEditingController();
|
|
||||||
final qualityController = TextEditingController();
|
|
||||||
final salesController = TextEditingController();
|
|
||||||
final commentController = TextEditingController();
|
|
||||||
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return CommonBackground(
|
|
||||||
child: Scaffold(backgroundColor: Colors.transparent,
|
|
||||||
appBar: CommonAppBar(
|
|
||||||
actions: [
|
|
||||||
IconButton(
|
|
||||||
onPressed: ()
|
|
||||||
{
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
icon: Image.asset('assets/Back_attendance.png'), padding: const EdgeInsets.only(right: 20),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
title: const Text('Display Sales',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.w400,
|
|
||||||
fontFamily: 'Anek')), backgroundColor: Colors.transparent, elevation: 0,
|
|
||||||
),
|
|
||||||
drawer: const CommonDrawer(),
|
|
||||||
body: Padding(
|
|
||||||
padding: const EdgeInsets.all(16.0),
|
|
||||||
child: SingleChildScrollView(
|
|
||||||
physics: const BouncingScrollPhysics(),
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: <Widget>[
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
Container(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.all(20.0).copyWith(top: 30, bottom: 30),
|
|
||||||
// margin: const EdgeInsets.symmetric(horizontal: 30.0),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border.all(color: Colors.white),
|
|
||||||
color: const Color(0xffB4D1E5).withOpacity(0.9),
|
|
||||||
borderRadius: BorderRadius.circular(26.0)),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: <Widget>[
|
|
||||||
CommonTextFormField(
|
|
||||||
title: 'Select Dealer: Dealer 1',
|
|
||||||
fillColor: Colors.white,
|
|
||||||
controller: dealercontroller),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
|
|
||||||
CommonTextFormField(
|
|
||||||
title: 'Select Product: Product A',
|
|
||||||
fillColor: Colors.white,
|
|
||||||
controller: productController),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
|
|
||||||
CommonTextFormField(
|
|
||||||
title: 'visit date',
|
|
||||||
readOnly: true,
|
|
||||||
fillColor: Colors.white,
|
|
||||||
controller: dateController),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
|
|
||||||
CommonTextFormField(
|
|
||||||
title: 'Quantity Sold: 221',
|
|
||||||
fillColor: Colors.white,
|
|
||||||
controller: qualityController),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
|
|
||||||
CommonTextFormField(
|
|
||||||
title: 'Sales Amount: 23,421',
|
|
||||||
fillColor: Colors.white,
|
|
||||||
controller: salesController),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
|
|
||||||
CommonTextFormField(
|
|
||||||
title: 'Comments:',
|
|
||||||
fillColor: Colors.white,
|
|
||||||
maxLines: 4,
|
|
||||||
controller: commentController),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: CommonElevatedButton(
|
|
||||||
borderRadius: 30,
|
|
||||||
width: double.infinity,
|
|
||||||
height: kToolbarHeight - 10,
|
|
||||||
text: 'SUBMIT',
|
|
||||||
backgroundColor: const Color(0xff004791),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => const DataSubmitSuccessFullScreen()));
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,8 @@
|
|||||||
import 'package:cheminova/provider/forgot_password_provider.dart';
|
import 'package:cheminova/provider/forgot_password_provider.dart';
|
||||||
|
import 'package:cheminova/screens/change_password_screen.dart';
|
||||||
import 'package:cheminova/screens/login_screen.dart';
|
import 'package:cheminova/screens/login_screen.dart';
|
||||||
|
import 'package:cheminova/screens/password_change_screen.dart';
|
||||||
|
import 'package:cheminova/screens/verify_code_screen.dart';
|
||||||
import 'package:cheminova/widgets/common_background.dart';
|
import 'package:cheminova/widgets/common_background.dart';
|
||||||
import 'package:cheminova/widgets/common_elevated_button.dart';
|
import 'package:cheminova/widgets/common_elevated_button.dart';
|
||||||
import 'package:cheminova/widgets/common_text_form_field.dart';
|
import 'package:cheminova/widgets/common_text_form_field.dart';
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
import 'package:cheminova/notification_services.dart';
|
import 'package:cheminova/notification_services.dart';
|
||||||
import 'package:cheminova/provider/home_provider.dart';
|
import 'package:cheminova/provider/home_provider.dart';
|
||||||
import 'package:cheminova/screens/rejected_application_screen.dart';
|
import 'package:cheminova/screens/Update_inventorytask_screen.dart';
|
||||||
import 'package:cheminova/screens/calendar_screen.dart';
|
import 'package:cheminova/screens/calendar_screen.dart';
|
||||||
import 'package:cheminova/screens/collect_kyc_screen.dart';
|
|
||||||
import 'package:cheminova/screens/daily_tasks_screen.dart';
|
import 'package:cheminova/screens/daily_tasks_screen.dart';
|
||||||
import 'package:cheminova/screens/display_sales_screen.dart';
|
|
||||||
import 'package:cheminova/screens/mark_attendence_screen.dart';
|
import 'package:cheminova/screens/mark_attendence_screen.dart';
|
||||||
import 'package:cheminova/screens/notification_screen.dart';
|
import 'package:cheminova/screens/notification_screen.dart';
|
||||||
import 'package:cheminova/screens/product_sales_data.dart';
|
import 'package:cheminova/screens/product_purchase_data.dart';
|
||||||
import 'package:cheminova/screens/products_manual_screen.dart';
|
import 'package:cheminova/screens/products_manual_screen.dart';
|
||||||
import 'package:cheminova/screens/summary_screen.dart';
|
import 'package:cheminova/screens/rejected_application_screen.dart';
|
||||||
import 'package:cheminova/screens/update_inventory_screen.dart';
|
import 'package:cheminova/screens/sales_task_screen.dart';
|
||||||
|
import 'package:cheminova/screens/select_taskkyc_screen.dart';
|
||||||
import 'package:cheminova/widgets/common_app_bar.dart';
|
import 'package:cheminova/widgets/common_app_bar.dart';
|
||||||
import 'package:cheminova/widgets/common_background.dart';
|
import 'package:cheminova/widgets/common_background.dart';
|
||||||
import 'package:cheminova/widgets/common_drawer.dart';
|
import 'package:cheminova/widgets/common_drawer.dart';
|
||||||
@ -49,10 +48,6 @@ class _HomePageState extends State<HomePage> {
|
|||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
appBar: CommonAppBar(
|
appBar: CommonAppBar(
|
||||||
title: Row(children: [
|
title: Row(children: [
|
||||||
// CircleAvatar(
|
|
||||||
// backgroundImage: AssetImage(
|
|
||||||
// 'assets/profile.png'), // Replace with actual user image
|
|
||||||
// ),
|
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||||
const Text('Welcome',
|
const Text('Welcome',
|
||||||
@ -62,13 +57,13 @@ class _HomePageState extends State<HomePage> {
|
|||||||
fontWeight: FontWeight.w400)),
|
fontWeight: FontWeight.w400)),
|
||||||
Consumer<HomeProvider>(
|
Consumer<HomeProvider>(
|
||||||
builder: (context, value, child) =>
|
builder: (context, value, child) =>
|
||||||
(value.profileResponse == null ||
|
(value.profileResponse == null ||
|
||||||
value.profileResponse!.myData == null ||
|
value.profileResponse!.myData == null ||
|
||||||
value.profileResponse!.myData!.name == null)
|
value.profileResponse!.myData!.name == null)
|
||||||
? const SizedBox()
|
? const SizedBox()
|
||||||
: Text(value.profileResponse!.myData!.name ?? '',
|
: Text(value.profileResponse!.myData!.name ?? '',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.black87, fontSize: 20)))
|
color: Colors.black87, fontSize: 20)))
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
@ -78,186 +73,185 @@ class _HomePageState extends State<HomePage> {
|
|||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
child: Column(
|
child: LayoutBuilder(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
builder: (context, constraints) {
|
||||||
children: [
|
double screenWidth = constraints.maxWidth;
|
||||||
Expanded(
|
double buttonWidth = screenWidth / 2 - 18; // Adjust button width
|
||||||
child: ListView(
|
|
||||||
children: [
|
return ListView(
|
||||||
_buildCustomCard(
|
children: [
|
||||||
'Mark Attendance',
|
_buildCustomCard(
|
||||||
'Mark Attendance / On Leave',
|
'Mark Attendance',
|
||||||
onTap: () {
|
'Mark Attendance / On Leave',
|
||||||
Navigator.push(
|
screenWidth,
|
||||||
context,
|
onTap: () {
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) =>
|
|
||||||
const MarkAttendanceScreen(),
|
|
||||||
));
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 5,
|
|
||||||
),
|
|
||||||
_buildCustomCard('Daily Tasks', 'Dashboard', onTap: () {
|
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => const DailyTasksScreen(),
|
builder: (context) => const MarkAttendanceScreen(),
|
||||||
));
|
),
|
||||||
}),
|
);
|
||||||
const SizedBox(
|
},
|
||||||
height: 5,
|
),
|
||||||
),
|
const SizedBox(height: 5),
|
||||||
Row(
|
_buildCustomCard(
|
||||||
children: [
|
'Daily Tasks',
|
||||||
Expanded(
|
'Dashboard',
|
||||||
child: _buildCustomCard(
|
screenWidth,
|
||||||
'Display\nSales data', 'Quickly display Sales',
|
onTap: () {
|
||||||
onTap: () {
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const DailyTasksScreen(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 5),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: _buildCustomCard(
|
||||||
|
'Update\nSales data',
|
||||||
|
'Quickly display Sales',
|
||||||
|
buttonWidth,
|
||||||
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
const DisplaySalesScreen(),
|
SalesTaskScreen()
|
||||||
));
|
),
|
||||||
}),
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(
|
),
|
||||||
width: 12,
|
const SizedBox(width: 12),
|
||||||
),
|
Expanded(
|
||||||
Expanded(
|
child: _buildCustomCard(
|
||||||
child: _buildCustomCard('Update Inventory Data',
|
'Update Inventory Data',
|
||||||
'Quickly Inventory Data', onTap: () {
|
'Quickly Inventory Data',
|
||||||
|
buttonWidth,
|
||||||
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
const UpdateInventoryScreen(),
|
const UpdateInventoryTaskScreen(),
|
||||||
));
|
),
|
||||||
}),
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
const SizedBox(
|
),
|
||||||
height: 5,
|
const SizedBox(height: 5),
|
||||||
),
|
Row(
|
||||||
Row(
|
children: [
|
||||||
children: [
|
Expanded(
|
||||||
Expanded(
|
child: _buildCustomCard(
|
||||||
child:
|
'Notifications',
|
||||||
_buildCustomCard('Summary', '\n\n', onTap: () {
|
'Tasks & Alerts\n\n',
|
||||||
|
buttonWidth,
|
||||||
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => const SummaryScreen(),
|
builder: (context) =>
|
||||||
));
|
const NotificationScreen(),
|
||||||
}),
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(
|
),
|
||||||
width: 12,
|
const SizedBox(width: 12),
|
||||||
),
|
Expanded(
|
||||||
Expanded(
|
child: _buildCustomCard(
|
||||||
child: _buildCustomCard(
|
'Product\nPurchase Data Visibility',
|
||||||
'Product\nSales Data Visibility', '',
|
'',
|
||||||
onTap: () {
|
buttonWidth,
|
||||||
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
const ProductSalesData(),
|
const ProductPurchaseData(),
|
||||||
));
|
),
|
||||||
}),
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
const SizedBox(height: 5),
|
),
|
||||||
Row(
|
const SizedBox(height: 5),
|
||||||
children: [
|
_buildCustomCard(
|
||||||
Expanded(
|
'Collect \nKYC Data',
|
||||||
child: _buildCustomCard('Collect \nKYC Data',
|
'Scan and upload KYC Documents',
|
||||||
'Scan and upload KYC Documents', onTap: () {
|
screenWidth,
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const SelectTaskkycScreen(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 5),
|
||||||
|
_buildCustomCard(
|
||||||
|
'Rejected Applications',
|
||||||
|
'Re-upload Rejected Documents',
|
||||||
|
screenWidth,
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
const RejectedApplicationScreen(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 5),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: _buildCustomCard(
|
||||||
|
'Calendar',
|
||||||
|
'Appointments & Deadlines',
|
||||||
|
buttonWidth,
|
||||||
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) => const CalendarScreen(),
|
||||||
const CollectKycScreen(),
|
),
|
||||||
));
|
);
|
||||||
}),
|
},
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
const SizedBox(width: 12),
|
||||||
const SizedBox(height: 5),
|
Expanded(
|
||||||
Row(
|
child: _buildCustomCard(
|
||||||
children: [
|
'Products Manual',
|
||||||
Expanded(
|
'Details of products',
|
||||||
child: _buildCustomCard('Rejected Applications',
|
buttonWidth,
|
||||||
'Re-upload Rejected Documents', onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
const RejectedApplicationScreen(),
|
const ProductsManualScreen(),
|
||||||
));
|
),
|
||||||
}),
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
const SizedBox(height: 5),
|
),
|
||||||
Row(
|
],
|
||||||
children: [
|
);
|
||||||
Expanded(
|
},
|
||||||
child: _buildCustomCard(
|
|
||||||
'Notifications', 'Tasks & Alerts\n\n',
|
|
||||||
onTap: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) =>
|
|
||||||
const NotificationScreen(),
|
|
||||||
));
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 15,
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: _buildCustomCard(
|
|
||||||
'Calendar',
|
|
||||||
' Upcoming Appointments & Deadlines',
|
|
||||||
onTap: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) =>
|
|
||||||
const CalendarScreen(),
|
|
||||||
));
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 5),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: _buildCustomCard(
|
|
||||||
'Products Manual', 'details of products',
|
|
||||||
onTap: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) =>
|
|
||||||
const ProductsManualScreen(),
|
|
||||||
));
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -265,9 +259,10 @@ class _HomePageState extends State<HomePage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCustomCard(String title, String subtitle,
|
Widget _buildCustomCard(String title, String subtitle, double width,
|
||||||
{void Function()? onTap}) {
|
{void Function()? onTap}) {
|
||||||
return Container(
|
return Container(
|
||||||
|
width: width,
|
||||||
margin: const EdgeInsets.only(bottom: 10),
|
margin: const EdgeInsets.only(bottom: 10),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.indigo,
|
color: Colors.indigo,
|
||||||
@ -275,7 +270,6 @@ class _HomePageState extends State<HomePage> {
|
|||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
),
|
),
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
// trailing: Image.asset('assets/forward_icon.png'),
|
|
||||||
title: Text(
|
title: Text(
|
||||||
title,
|
title,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
@ -286,9 +280,9 @@ class _HomePageState extends State<HomePage> {
|
|||||||
),
|
),
|
||||||
subtitle: subtitle.isNotEmpty
|
subtitle: subtitle.isNotEmpty
|
||||||
? Text(
|
? Text(
|
||||||
subtitle,
|
subtitle,
|
||||||
style: const TextStyle(color: Colors.white70, fontSize: 13),
|
style: const TextStyle(color: Colors.white70, fontSize: 13),
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
),
|
),
|
||||||
|
@ -72,7 +72,6 @@ Widget buildProductButton(String productName) {
|
|||||||
text: productName,
|
text: productName,
|
||||||
backgroundColor: const Color(0xff004791),
|
backgroundColor: const Color(0xff004791),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// Handle product button press
|
|
||||||
debugPrint('$productName pressed');
|
debugPrint('$productName pressed');
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -86,7 +85,6 @@ class MyListView extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// Group notifications by date
|
|
||||||
Map<String, List<Notifications>> groupedNotifications = {};
|
Map<String, List<Notifications>> groupedNotifications = {};
|
||||||
|
|
||||||
for (var notification in value.notificationList) {
|
for (var notification in value.notificationList) {
|
||||||
@ -117,7 +115,6 @@ class MyListView extends StatelessWidget {
|
|||||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// Display notifications for the date
|
|
||||||
...notificationsForDate.map((item) => Padding(
|
...notificationsForDate.map((item) => Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 10),
|
padding: const EdgeInsets.only(bottom: 10),
|
||||||
child: ExpansionTile(
|
child: ExpansionTile(
|
||||||
|
@ -7,14 +7,14 @@ import '../widgets/common_app_bar.dart';
|
|||||||
import '../widgets/common_elevated_button.dart';
|
import '../widgets/common_elevated_button.dart';
|
||||||
import '../widgets/common_text_form_field.dart';
|
import '../widgets/common_text_form_field.dart';
|
||||||
|
|
||||||
class ProductSalesData extends StatefulWidget {
|
class ProductPurchaseData extends StatefulWidget {
|
||||||
const ProductSalesData({super.key});
|
const ProductPurchaseData({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ProductSalesData> createState() => ProductSalesDataState();
|
State<ProductPurchaseData> createState() => ProductPurchaseDataState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class ProductSalesDataState extends State<ProductSalesData> {
|
class ProductPurchaseDataState extends State<ProductPurchaseData> {
|
||||||
final dateController = TextEditingController(
|
final dateController = TextEditingController(
|
||||||
text: DateFormat('dd/MM/yyyy').format(DateTime.now()));
|
text: DateFormat('dd/MM/yyyy').format(DateTime.now()));
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ class ProductSalesDataState extends State<ProductSalesData> {
|
|||||||
icon: Image.asset('assets/Back_attendance.png'), padding: const EdgeInsets.only(right: 20),
|
icon: Image.asset('assets/Back_attendance.png'), padding: const EdgeInsets.only(right: 20),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
title: const Text('Product Sales Data',
|
title: const Text('Product Purchase Data',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
@ -1,67 +1,103 @@
|
|||||||
|
import 'package:cheminova/screens/view_pdf_screen.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:cheminova/widgets/common_background.dart';
|
import 'package:cheminova/widgets/common_background.dart';
|
||||||
import 'package:cheminova/widgets/common_drawer.dart';
|
import 'package:cheminova/widgets/common_drawer.dart';
|
||||||
import 'package:cheminova/widgets/common_app_bar.dart';
|
import 'package:cheminova/widgets/common_app_bar.dart';
|
||||||
import 'package:cheminova/widgets/common_elevated_button.dart';
|
import 'package:cheminova/widgets/common_elevated_button.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class ProductsManualScreen extends StatelessWidget {
|
import '../models/product_manual_model.dart';
|
||||||
|
import '../provider/product_manual_provider.dart';
|
||||||
|
|
||||||
|
class ProductsManualScreen extends StatefulWidget {
|
||||||
const ProductsManualScreen({super.key});
|
const ProductsManualScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ProductsManualScreen> createState() => _ProductsManualScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ProductsManualScreenState extends State<ProductsManualScreen> {
|
||||||
|
late ProductManualProvider _productManualProvider;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
_productManualProvider = ProductManualProvider();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CommonBackground(
|
return ChangeNotifierProvider<ProductManualProvider>(
|
||||||
child: Scaffold(
|
create: (_) => _productManualProvider,
|
||||||
backgroundColor: Colors.transparent,
|
builder: (context, child) => CommonBackground(
|
||||||
appBar: CommonAppBar(
|
child: Scaffold(
|
||||||
actions: [
|
backgroundColor: Colors.transparent,
|
||||||
IconButton(
|
appBar: CommonAppBar(
|
||||||
onPressed: () {
|
actions: [
|
||||||
Navigator.pop(context);
|
IconButton(
|
||||||
},
|
onPressed: () {
|
||||||
icon: Image.asset('assets/Back_attendance.png'),
|
Navigator.pop(context);
|
||||||
padding: const EdgeInsets.only(right: 20),
|
},
|
||||||
),
|
icon: Image.asset('assets/Back_attendance.png'),
|
||||||
],
|
padding: const EdgeInsets.only(right: 20),
|
||||||
title: const Text('Products Manual',
|
),
|
||||||
|
],
|
||||||
|
title: const Text(
|
||||||
|
'Products Manual',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
fontFamily: 'Anek')),
|
fontFamily: 'Anek'),
|
||||||
backgroundColor: Colors.transparent,
|
),
|
||||||
elevation: 0,
|
backgroundColor: Colors.transparent,
|
||||||
),
|
elevation: 0,
|
||||||
drawer: const CommonDrawer(),
|
),
|
||||||
body: Padding(
|
drawer: const CommonDrawer(),
|
||||||
padding: const EdgeInsets.all(16.0),
|
body: Padding(
|
||||||
child: SingleChildScrollView(
|
padding: const EdgeInsets.all(16.0),
|
||||||
physics: const BouncingScrollPhysics(),
|
child: SingleChildScrollView(
|
||||||
child: Column(
|
physics: const BouncingScrollPhysics(),
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: <Widget>[
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
const SizedBox(height: 16),
|
children: <Widget>[
|
||||||
Container(
|
const SizedBox(height: 16),
|
||||||
padding: const EdgeInsets.all(20.0).copyWith(top: 30, bottom: 30),
|
Consumer<ProductManualProvider>(
|
||||||
decoration: BoxDecoration(
|
builder: (context, provider, child) {
|
||||||
border: Border.all(color: Colors.white),
|
if (provider.isLoading) {
|
||||||
color: const Color(0xffB4D1E5).withOpacity(0.9),
|
return const Center(
|
||||||
borderRadius: BorderRadius.circular(26.0),
|
child: CircularProgressIndicator(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (provider.productManualList.isEmpty) {
|
||||||
|
return const Center(
|
||||||
|
child: Text('No products available.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.all(20.0)
|
||||||
|
.copyWith(top: 30, bottom: 30),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: Colors.white),
|
||||||
|
color: const Color(0xffB4D1E5).withOpacity(0.9),
|
||||||
|
borderRadius: BorderRadius.circular(26.0),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: provider.productManualList
|
||||||
|
.map(
|
||||||
|
(product) =>
|
||||||
|
_buildProductButton(context, product),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
child: Column(
|
],
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
),
|
||||||
children: <Widget>[
|
|
||||||
_buildProductButton('Product 1'),
|
|
||||||
_buildProductButton('Product 2'),
|
|
||||||
_buildProductButton('Product 3'),
|
|
||||||
_buildProductButton('Product 4'),
|
|
||||||
_buildProductButton('Product 5'),
|
|
||||||
_buildProductButton('Product 6'),
|
|
||||||
_buildProductButton('Product 7'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -69,19 +105,21 @@ class ProductsManualScreen extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildProductButton(String productName) {
|
Widget _buildProductButton(BuildContext context, ProductManualModel product) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 15),
|
padding: const EdgeInsets.only(bottom: 15),
|
||||||
child: CommonElevatedButton(
|
child: CommonElevatedButton(
|
||||||
borderRadius: 30,
|
borderRadius: 30,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: kToolbarHeight - 10,
|
height: kToolbarHeight - 10,
|
||||||
text: productName,
|
text: product.title,
|
||||||
backgroundColor: const Color(0xff004791),
|
backgroundColor: const Color(0xff004791),
|
||||||
onPressed: () {
|
onPressed: () => Navigator.push(
|
||||||
// Handle product button press
|
context,
|
||||||
debugPrint('$productName pressed');
|
MaterialPageRoute(
|
||||||
},
|
builder: (context) => ViewPdfScreen(productManualModel: product),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
97
lib/screens/profile_screen.dart
Normal file
97
lib/screens/profile_screen.dart
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
import 'package:cheminova/provider/home_provider.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:cheminova/widgets/common_app_bar.dart';
|
||||||
|
import 'package:cheminova/widgets/common_background.dart';
|
||||||
|
import 'package:cheminova/widgets/common_drawer.dart';
|
||||||
|
class ProfileScreen extends StatelessWidget {
|
||||||
|
const ProfileScreen({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Stack(
|
||||||
|
children: [
|
||||||
|
CommonBackground(
|
||||||
|
isFullWidth: true,
|
||||||
|
child: Scaffold(
|
||||||
|
drawer: const CommonDrawer(),
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
appBar: CommonAppBar(
|
||||||
|
title: const Text('Profile'),
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
elevation: 0,
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
icon: Image.asset('assets/Back_attendance.png'),
|
||||||
|
padding: const EdgeInsets.only(right: 20),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: Consumer<HomeProvider>(
|
||||||
|
builder: (context, profileProvider, child) {
|
||||||
|
final profileData = profileProvider.profileResponse?.myData!;
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.all(20.0).copyWith(top: 15, bottom: 30),
|
||||||
|
margin: const EdgeInsets.symmetric(horizontal: 30.0, vertical: 20.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: Colors.white),
|
||||||
|
color: const Color(0xffB4D1E5).withOpacity(0.9),
|
||||||
|
borderRadius: BorderRadius.circular(26.0),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
SizedBox(height: 20),
|
||||||
|
_buildProfileItem('Name', profileData?.name ?? ''),
|
||||||
|
_buildProfileItem('ID', profileData?.uniqueId ?? ''),
|
||||||
|
_buildProfileItem('Email ID', profileData?.email ?? ''),
|
||||||
|
_buildProfileItem('Mobile Number', profileData?.mobileNumber ?? ''),
|
||||||
|
_buildProfileItem('Designation', profileData?.designation ?? ''),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildProfileItem(String label, String value) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
label,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Color(0xff004791),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 5),
|
||||||
|
Text(
|
||||||
|
value,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Divider(color: Colors.grey),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -104,7 +104,7 @@ class MyListView extends StatelessWidget {
|
|||||||
subtitle: Column(
|
subtitle: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text((DateFormat("dd/MMMM/yyyy")
|
Text((DateFormat("dd/MMMM /yyyy")
|
||||||
.format(DateTime.parse(item.createdAt ?? '')))),
|
.format(DateTime.parse(item.createdAt ?? '')))),
|
||||||
Text(item.sId ?? ''),
|
Text(item.sId ?? ''),
|
||||||
for (var note in item.notes!) Text(note.message ?? ''),
|
for (var note in item.notes!) Text(note.message ?? ''),
|
||||||
|
@ -43,213 +43,191 @@ class RetailerDetailsScreenState extends State<RetailerDetailsScreen> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
DropdownButtonFormField<String>(
|
Column(
|
||||||
decoration: InputDecoration(
|
children: [
|
||||||
fillColor: Colors.white,
|
const SizedBox(height: 15),
|
||||||
filled: true,
|
CommonTextFormField(
|
||||||
border: OutlineInputBorder(
|
title: 'Trade Name',
|
||||||
borderRadius: BorderRadius.circular(8),
|
fillColor: Colors.white,
|
||||||
borderSide: BorderSide.none)),
|
|
||||||
hint: Text("Select a task"),
|
|
||||||
value: value.selectedTask,
|
|
||||||
onChanged: (String? newValue) {
|
|
||||||
value.setTask(newValue!);
|
|
||||||
},
|
|
||||||
items:["task1", "task2", "task3"].map((String task) {
|
|
||||||
return DropdownMenuItem<String>(
|
|
||||||
value: task,
|
|
||||||
child: Text(task),
|
|
||||||
);
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
IgnorePointer(
|
|
||||||
ignoring: value.selectedTask == null,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
CommonTextFormField(
|
|
||||||
title: 'Trade Name',
|
|
||||||
fillColor: Colors.white,
|
|
||||||
validator: (String? value) {
|
|
||||||
if (value!.isEmpty) {
|
|
||||||
return 'Trade Name cannot be empty';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
controller: value.tradeNameController),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
CommonTextFormField(
|
|
||||||
title: 'Name',
|
|
||||||
fillColor: Colors.white,
|
|
||||||
validator: (String? value) {
|
|
||||||
if (value!.isEmpty) {
|
|
||||||
return 'Name cannot be empty';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
controller: value.nameController),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
CommonTextFormField(
|
|
||||||
title: 'Address',
|
|
||||||
fillColor: Colors.white,
|
|
||||||
validator: (String? value) {
|
|
||||||
if (value!.isEmpty) {
|
|
||||||
return 'Address cannot be empty';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
controller: value.addressController),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
CSCPicker(
|
|
||||||
defaultCountry: CscCountry.India,
|
|
||||||
disableCountry: true,
|
|
||||||
onCountryChanged: (val) {
|
|
||||||
setState(() {
|
|
||||||
value.country.text = val;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onStateChanged: (val) {
|
|
||||||
setState(() {
|
|
||||||
value.state.text = val ?? '';
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onCityChanged: (val) {
|
|
||||||
setState(() {
|
|
||||||
value.city.text = val ?? '';
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
CommonTextFormField(
|
|
||||||
title: 'District',
|
|
||||||
fillColor: Colors.white,
|
|
||||||
validator: (String? value) {
|
|
||||||
if (value!.isEmpty) {
|
|
||||||
return 'District cannot be empty';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
controller: value.districtController),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
CommonTextFormField(
|
|
||||||
maxLength: 6,
|
|
||||||
title: 'Pincode',
|
|
||||||
fillColor: Colors.white,
|
|
||||||
inputFormatters: [
|
|
||||||
FilteringTextInputFormatter.digitsOnly
|
|
||||||
],
|
|
||||||
validator: (String? value) {
|
|
||||||
if (value!.isEmpty) {
|
|
||||||
return 'Pincode cannot be empty';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
controller: value.pinCodeController),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
CommonTextFormField(
|
|
||||||
maxLength: 10,
|
|
||||||
title: 'Mobile Number',
|
|
||||||
fillColor: Colors.white,
|
|
||||||
inputFormatters: [
|
|
||||||
FilteringTextInputFormatter.digitsOnly
|
|
||||||
],
|
|
||||||
validator: (String? value) {
|
|
||||||
if (value!.isEmpty) {
|
|
||||||
return 'Mobile Number cannot be empty';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
controller: value.mobileNumberController),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
CommonTextFormField(
|
|
||||||
maxLength: 12,
|
|
||||||
title: 'Aadhar Number',
|
|
||||||
inputFormatters: [
|
|
||||||
FilteringTextInputFormatter.digitsOnly
|
|
||||||
],
|
|
||||||
fillColor: Colors.white,
|
|
||||||
validator: (String? value) {
|
|
||||||
if (value!.isEmpty) {
|
|
||||||
return 'Aadhar Number cannot be empty';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
controller: value.aadharNumberController),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
CommonTextFormField(
|
|
||||||
inputFormatters: [
|
|
||||||
UpperCaseTextFormatter(),
|
|
||||||
],
|
|
||||||
maxLength: 10,
|
|
||||||
title: 'PAN Number',
|
|
||||||
fillColor: Colors.white,
|
|
||||||
validator: (String? value) {
|
|
||||||
if (value!.isEmpty) {
|
|
||||||
return 'PAN Number cannot be empty';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
controller: value.panNumberController),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
CommonTextFormField(
|
|
||||||
inputFormatters: [
|
|
||||||
UpperCaseTextFormatter(),
|
|
||||||
],
|
|
||||||
maxLength: 15,
|
|
||||||
title: 'GST Number',
|
|
||||||
fillColor: Colors.white,
|
|
||||||
validator: (String? value) {
|
|
||||||
if (value!.isEmpty) {
|
|
||||||
return 'GST Number cannot be empty';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
controller: value.gstNumberController),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
DropdownButtonFormField<String>(
|
|
||||||
decoration: InputDecoration(
|
|
||||||
fillColor: Colors.white,
|
|
||||||
filled: true,
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
borderSide: BorderSide.none),
|
|
||||||
hintText: 'Mapped Principal Distributor'),
|
|
||||||
value: value.selectedDistributor,
|
|
||||||
items: value.pdList.map((GetPdResponse pd) {
|
|
||||||
return DropdownMenuItem<String>(
|
|
||||||
value: pd.sId, child: Text(pd.name ?? ''));
|
|
||||||
}).toList(),
|
|
||||||
onChanged: (String? newValue) {
|
|
||||||
setState(() {
|
|
||||||
value.selectedDistributor = newValue;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
validator: (String? value) {
|
validator: (String? value) {
|
||||||
if (value == null || value.isEmpty) {
|
if (value!.isEmpty) {
|
||||||
return 'Mapped Principal Distributor cannot be empty';
|
return 'Trade Name cannot be empty';
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
controller: value.tradeNameController),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
CommonTextFormField(
|
||||||
|
title: 'Name',
|
||||||
|
fillColor: Colors.white,
|
||||||
|
validator: (String? value) {
|
||||||
|
if (value!.isEmpty) {
|
||||||
|
return 'Name cannot be empty';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: value.nameController),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
CommonTextFormField(
|
||||||
|
title: 'Address',
|
||||||
|
fillColor: Colors.white,
|
||||||
|
validator: (String? value) {
|
||||||
|
if (value!.isEmpty) {
|
||||||
|
return 'Address cannot be empty';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: value.addressController),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
CSCPicker(
|
||||||
|
defaultCountry: CscCountry.India,
|
||||||
|
disableCountry: true,
|
||||||
|
onCountryChanged: (val) {
|
||||||
|
setState(() {
|
||||||
|
value.country.text = val;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onStateChanged: (val) {
|
||||||
|
setState(() {
|
||||||
|
value.state.text = val ?? '';
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onCityChanged: (val) {
|
||||||
|
setState(() {
|
||||||
|
value.city.text = val ?? '';
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
CommonTextFormField(
|
||||||
|
title: 'District',
|
||||||
|
fillColor: Colors.white,
|
||||||
|
validator: (String? value) {
|
||||||
|
if (value!.isEmpty) {
|
||||||
|
return 'District cannot be empty';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: value.districtController),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
CommonTextFormField(
|
||||||
|
maxLength: 6,
|
||||||
|
title: 'Pincode',
|
||||||
|
fillColor: Colors.white,
|
||||||
|
inputFormatters: [
|
||||||
|
FilteringTextInputFormatter.digitsOnly
|
||||||
|
],
|
||||||
|
validator: (String? value) {
|
||||||
|
if (value!.isEmpty) {
|
||||||
|
return 'Pincode cannot be empty';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: value.pinCodeController),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
CommonTextFormField(
|
||||||
|
maxLength: 10,
|
||||||
|
title: 'Mobile Number',
|
||||||
|
fillColor: Colors.white,
|
||||||
|
inputFormatters: [
|
||||||
|
FilteringTextInputFormatter.digitsOnly
|
||||||
|
],
|
||||||
|
validator: (String? value) {
|
||||||
|
if (value!.isEmpty) {
|
||||||
|
return 'Mobile Number cannot be empty';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: value.mobileNumberController),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
CommonTextFormField(
|
||||||
|
maxLength: 12,
|
||||||
|
title: 'Aadhar Number',
|
||||||
|
inputFormatters: [
|
||||||
|
FilteringTextInputFormatter.digitsOnly
|
||||||
|
],
|
||||||
|
fillColor: Colors.white,
|
||||||
|
validator: (String? value) {
|
||||||
|
if (value!.isEmpty) {
|
||||||
|
return 'Aadhar Number cannot be empty';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: value.aadharNumberController),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
CommonTextFormField(
|
||||||
|
inputFormatters: [
|
||||||
|
UpperCaseTextFormatter(),
|
||||||
|
],
|
||||||
|
maxLength: 10,
|
||||||
|
title: 'PAN Number',
|
||||||
|
fillColor: Colors.white,
|
||||||
|
validator: (String? value) {
|
||||||
|
if (value!.isEmpty) {
|
||||||
|
return 'PAN Number cannot be empty';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: value.panNumberController),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
CommonTextFormField(
|
||||||
|
inputFormatters: [
|
||||||
|
UpperCaseTextFormatter(),
|
||||||
|
],
|
||||||
|
maxLength: 15,
|
||||||
|
title: 'GST Number',
|
||||||
|
fillColor: Colors.white,
|
||||||
|
validator: (String? value) {
|
||||||
|
if (value!.isEmpty) {
|
||||||
|
return 'GST Number cannot be empty';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: value.gstNumberController),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
DropdownButtonFormField<String>(
|
||||||
|
decoration: InputDecoration(
|
||||||
|
fillColor: Colors.white,
|
||||||
|
filled: true,
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
borderSide: BorderSide.none),
|
||||||
|
hintText: 'Mapped Principal Distributor'),
|
||||||
|
value: value.selectedDistributor,
|
||||||
|
items: value.pdList.map((GetPdResponse pd) {
|
||||||
|
return DropdownMenuItem<String>(
|
||||||
|
value: pd.sId, child: Text(pd.name ?? ''));
|
||||||
|
}).toList(),
|
||||||
|
onChanged: (String? newValue) {
|
||||||
|
setState(() {
|
||||||
|
value.selectedDistributor = newValue;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
validator: (String? value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return 'Mapped Principal Distributor cannot be empty';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: CommonElevatedButton(
|
||||||
|
borderRadius: 30,
|
||||||
|
width: double.infinity,
|
||||||
|
height: kToolbarHeight - 10,
|
||||||
|
text: 'CONTINUE',
|
||||||
|
backgroundColor: const Color(0xff004791),
|
||||||
|
onPressed: () {
|
||||||
|
if (value.retailerDetailsFormKey.currentState!
|
||||||
|
.validate()) {
|
||||||
|
value.tabController.animateTo(1);
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 30),
|
),
|
||||||
Align(
|
],
|
||||||
alignment: Alignment.center,
|
|
||||||
child: CommonElevatedButton(
|
|
||||||
borderRadius: 30,
|
|
||||||
width: double.infinity,
|
|
||||||
height: kToolbarHeight - 10,
|
|
||||||
text: 'CONTINUE',
|
|
||||||
backgroundColor: const Color(0xff004791),
|
|
||||||
onPressed: () {
|
|
||||||
if (value.retailerDetailsFormKey.currentState!
|
|
||||||
.validate()) {
|
|
||||||
value.tabController.animateTo(1);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
141
lib/screens/sales_task_screen.dart
Normal file
141
lib/screens/sales_task_screen.dart
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
import 'package:cheminova/screens/add_sales_product_screen.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:cheminova/models/Daily_Task_Response.dart';
|
||||||
|
import 'package:cheminova/widgets/common_app_bar.dart';
|
||||||
|
import 'package:cheminova/widgets/common_background.dart';
|
||||||
|
import 'package:cheminova/widgets/common_drawer.dart';
|
||||||
|
import '../constants/constant.dart';
|
||||||
|
import '../provider/daily_task_provider.dart';
|
||||||
|
|
||||||
|
class SalesTaskScreen extends StatefulWidget {
|
||||||
|
const SalesTaskScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_SalesTaskScreenState createState() => _SalesTaskScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SalesTaskScreenState extends State<SalesTaskScreen> {
|
||||||
|
late DailyTaskProvider _dailyTaskProvider;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_dailyTaskProvider = DailyTaskProvider();
|
||||||
|
_dailyTaskProvider.getTask(type: 'New');
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ChangeNotifierProvider(
|
||||||
|
create: (context) => _dailyTaskProvider,
|
||||||
|
child: Scaffold(
|
||||||
|
extendBodyBehindAppBar: true,
|
||||||
|
appBar: _buildAppBar(),
|
||||||
|
drawer: const CommonDrawer(),
|
||||||
|
body: CommonBackground(
|
||||||
|
child: SafeArea(
|
||||||
|
child: _buildTaskList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
CommonAppBar _buildAppBar() {
|
||||||
|
return CommonAppBar(
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
elevation: 0,
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
icon: Image.asset('assets/Back_attendance.png'),
|
||||||
|
padding: const EdgeInsets.only(right: 20),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
title: const Text(
|
||||||
|
'Sales Tasks',
|
||||||
|
style: TextStyle(color: Colors.black87, fontSize: 20),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildTaskList() {
|
||||||
|
return Consumer<DailyTaskProvider>(
|
||||||
|
builder: (context, value, child) {
|
||||||
|
if (value.isLoading) {
|
||||||
|
return const Center(child: CircularProgressIndicator());
|
||||||
|
}
|
||||||
|
|
||||||
|
final salesTasks = value.newTasksList
|
||||||
|
.where((task) => task.task?.toLowerCase() == 'Update Sales Data'.toLowerCase())
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
if (salesTasks.isEmpty) {
|
||||||
|
return const Center(
|
||||||
|
child: Text(
|
||||||
|
'NO TASK',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.black87,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ListView.separated(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
itemCount: salesTasks.length,
|
||||||
|
separatorBuilder: (context, index) => const SizedBox(height: 8),
|
||||||
|
itemBuilder: (context, index) => _buildTaskCard(salesTasks[index]),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildTaskCard(Tasks tasksList) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: () {
|
||||||
|
if (tasksList.sId != null && tasksList.addedFor != null) {
|
||||||
|
Navigator.push(
|
||||||
|
navigatorKey.currentContext!,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => AddSalesProductScreen(
|
||||||
|
distributorType: tasksList.addedFor!,
|
||||||
|
inventoryId: tasksList.sId,
|
||||||
|
tradeName: tasksList.tradeName ?? '',
|
||||||
|
pdRdId: tasksList.addedForId!)));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Card(
|
||||||
|
color: Colors.white,
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||||
|
child: ListTile(
|
||||||
|
leading: const Icon(Icons.attach_money, color: Colors.greenAccent),
|
||||||
|
title: Text(
|
||||||
|
tasksList.task ?? '',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.black87,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 16,
|
||||||
|
fontFamily: 'Anek',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text('Distributor: ${tasksList.addedFor ?? ""}'),
|
||||||
|
Text('Trader Name: ${tasksList.tradeName ?? ''}'),
|
||||||
|
if (tasksList.taskDueDate != null)
|
||||||
|
Text('Due Date: ${DateFormat('dd/MM/yyyy').format(DateTime.parse(tasksList.taskDueDate!))}'),
|
||||||
|
Text('Priority: ${tasksList.taskPriority}'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
trailing: const Icon(Icons.arrow_forward_ios, color: Colors.black87),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
149
lib/screens/select_taskkyc_screen.dart
Normal file
149
lib/screens/select_taskkyc_screen.dart
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
import 'package:cheminova/models/select_task_response.dart';
|
||||||
|
import 'package:cheminova/provider/select_task_provider.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:cheminova/screens/collect_kyc_screen.dart';
|
||||||
|
import 'package:cheminova/widgets/common_app_bar.dart';
|
||||||
|
import 'package:cheminova/widgets/common_drawer.dart';
|
||||||
|
import 'package:cheminova/widgets/common_background.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class SelectTaskkycScreen extends StatefulWidget {
|
||||||
|
const SelectTaskkycScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<SelectTaskkycScreen> createState() => SelectTaskkycScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class SelectTaskkycScreenState extends State<SelectTaskkycScreen> {
|
||||||
|
late SelectTaskProvider _selectTaskProvider;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
_selectTaskProvider = SelectTaskProvider();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ChangeNotifierProvider(
|
||||||
|
create: (context) => _selectTaskProvider,
|
||||||
|
child: CommonBackground(
|
||||||
|
child: Scaffold(
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
appBar: CommonAppBar(
|
||||||
|
title: const Text('Select Task'),
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
elevation: 0,
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
icon: Image.asset('assets/Back_attendance.png'),
|
||||||
|
padding: const EdgeInsets.only(right: 20),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
drawer: const CommonDrawer(),
|
||||||
|
body: Consumer<SelectTaskProvider>(
|
||||||
|
builder: (context, value, child) =>
|
||||||
|
value.isLoading
|
||||||
|
? const Center(child: CircularProgressIndicator())
|
||||||
|
: _buildTaskList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildTaskList() {
|
||||||
|
return Consumer<SelectTaskProvider>(
|
||||||
|
builder: (context, value, child) {
|
||||||
|
if (value.tasksList.isEmpty) {
|
||||||
|
return const Center(
|
||||||
|
child: Text(
|
||||||
|
'NO TASK',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.black87,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return ListView.builder(
|
||||||
|
itemCount: value.tasksList.length,
|
||||||
|
itemBuilder: (context, index) => _buildTaskCard(value.tasksList[index]),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildTaskCard(Tasks task) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: () => Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => CollectKycScreen(id: task.taskId ?? ''),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Card(
|
||||||
|
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
|
color: Colors.white,
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
ListTile(
|
||||||
|
leading: const Icon(Icons.task, color: Colors.blueAccent),
|
||||||
|
title: Text(
|
||||||
|
task.task ?? '',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.black87,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 16,
|
||||||
|
fontFamily: 'Anek',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
trailing: const Icon(Icons.arrow_forward_ios, color: Colors.black87),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text('Note: ${task.note}'),
|
||||||
|
if (task.taskDueDate != null)
|
||||||
|
Text(
|
||||||
|
'Date: ${task.taskDueDate == null ? '' : DateFormat('dd/MM/yyyy').format(DateTime.parse(task.taskDueDate ?? ''))}',
|
||||||
|
),
|
||||||
|
Text('Priority: ${task.taskPriority}'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TaskItem {
|
||||||
|
final String title;
|
||||||
|
final Widget screen;
|
||||||
|
|
||||||
|
TaskItem({required this.title, required this.screen});
|
||||||
|
}
|
||||||
|
|
||||||
|
class KycTaskItem extends TaskItem {
|
||||||
|
final String note;
|
||||||
|
final String date;
|
||||||
|
final String priority;
|
||||||
|
|
||||||
|
KycTaskItem({
|
||||||
|
required String title,
|
||||||
|
required Widget screen,
|
||||||
|
required this.note,
|
||||||
|
required this.date,
|
||||||
|
required this.priority,
|
||||||
|
}) : super(title: title, screen: screen);
|
||||||
|
}
|
30
lib/screens/view_pdf_screen.dart
Normal file
30
lib/screens/view_pdf_screen.dart
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import 'package:cheminova/models/product_manual_model.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_cached_pdfview/flutter_cached_pdfview.dart';
|
||||||
|
|
||||||
|
class ViewPdfScreen extends StatefulWidget {
|
||||||
|
final ProductManualModel productManualModel;
|
||||||
|
|
||||||
|
const ViewPdfScreen({super.key, required this.productManualModel});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ViewPdfScreen> createState() => _ViewPdfScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ViewPdfScreenState extends State<ViewPdfScreen> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: SafeArea(
|
||||||
|
child: const PDF(
|
||||||
|
fitEachPage: true,
|
||||||
|
fitPolicy: FitPolicy.BOTH,
|
||||||
|
autoSpacing: false)
|
||||||
|
.cachedFromUrl(
|
||||||
|
widget.productManualModel.productManualDetail.url,
|
||||||
|
placeholder: (progress) =>
|
||||||
|
Center(child: Text('$progress %')),
|
||||||
|
errorWidget: (error) =>
|
||||||
|
Center(child: Text(error.toString())))));
|
||||||
|
}
|
||||||
|
}
|
@ -1,20 +1,25 @@
|
|||||||
|
import 'package:cheminova/provider/visit_pdrd_provider.dart';
|
||||||
import 'package:cheminova/widgets/common_drawer.dart';
|
import 'package:cheminova/widgets/common_drawer.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:cheminova/widgets/common_background.dart';
|
import 'package:cheminova/widgets/common_background.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
import '../widgets/common_app_bar.dart';
|
import '../widgets/common_app_bar.dart';
|
||||||
import '../widgets/common_elevated_button.dart';
|
import '../widgets/common_elevated_button.dart';
|
||||||
import '../widgets/common_text_form_field.dart';
|
import '../widgets/common_text_form_field.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
|
|
||||||
class VisitDealersScreen extends StatefulWidget {
|
class VisitDealersScreen extends StatefulWidget {
|
||||||
const VisitDealersScreen({super.key});
|
final String? tradeName;
|
||||||
|
final String? id;
|
||||||
|
const VisitDealersScreen({super.key, required this.tradeName, this.id});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<VisitDealersScreen> createState() => VisitDealersScreenState();
|
State<VisitDealersScreen> createState() => VisitDealersScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class VisitDealersScreenState extends State<VisitDealersScreen> {
|
class VisitDealersScreenState extends State<VisitDealersScreen> {
|
||||||
|
late VisitPdRdProvider _visitPdRdProvider;
|
||||||
final dateController = TextEditingController(
|
final dateController = TextEditingController(
|
||||||
text: DateFormat('dd/MM/yyyy').format(DateTime.now()));
|
text: DateFormat('dd/MM/yyyy').format(DateTime.now()));
|
||||||
|
|
||||||
@ -26,6 +31,7 @@ class VisitDealersScreenState extends State<VisitDealersScreen> {
|
|||||||
final meetingSummaryController = TextEditingController();
|
final meetingSummaryController = TextEditingController();
|
||||||
final followUpActionsController = TextEditingController();
|
final followUpActionsController = TextEditingController();
|
||||||
final nextVisitDateController = TextEditingController();
|
final nextVisitDateController = TextEditingController();
|
||||||
|
late TextEditingController retailerController = TextEditingController();
|
||||||
|
|
||||||
String selectedPurpose = 'Sales';
|
String selectedPurpose = 'Sales';
|
||||||
List<String> purposeOptions = ['Sales', 'Dues collection', 'Others'];
|
List<String> purposeOptions = ['Sales', 'Dues collection', 'Others'];
|
||||||
@ -36,34 +42,52 @@ class VisitDealersScreenState extends State<VisitDealersScreen> {
|
|||||||
// Handle the picked image
|
// Handle the picked image
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
_visitPdRdProvider = VisitPdRdProvider();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CommonBackground(
|
retailerController = TextEditingController(text: widget.tradeName);
|
||||||
child: Scaffold(
|
|
||||||
backgroundColor: Colors.transparent,
|
return ChangeNotifierProvider(
|
||||||
appBar: CommonAppBar(
|
create: (context) => _visitPdRdProvider,
|
||||||
actions: [
|
child: CommonBackground(
|
||||||
IconButton(
|
child: Scaffold(
|
||||||
onPressed: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
icon: Image.asset('assets/Back_attendance.png'),
|
|
||||||
padding: const EdgeInsets.only(right: 20),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
title: const Text('Visit Retailers',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.w400,
|
|
||||||
fontFamily: 'Anek')),
|
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
elevation: 0,
|
appBar: CommonAppBar(
|
||||||
),
|
actions: [
|
||||||
drawer: const CommonDrawer(),
|
IconButton(
|
||||||
body: Padding(
|
onPressed: () {
|
||||||
padding: const EdgeInsets.all(16.0),
|
Navigator.pop(context);
|
||||||
child: SingleChildScrollView(
|
},
|
||||||
|
icon: Image.asset('assets/Back_attendance.png'),
|
||||||
|
padding: const EdgeInsets.only(right: 20),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
title: Column(
|
||||||
|
children: [
|
||||||
|
const Text('Visit Retailers',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
fontFamily: 'Anek')),
|
||||||
|
Text(widget.tradeName??'',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
fontFamily: 'Anek')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
elevation: 0,
|
||||||
|
),
|
||||||
|
drawer: const CommonDrawer(),
|
||||||
|
body: SingleChildScrollView(
|
||||||
physics: const BouncingScrollPhysics(),
|
physics: const BouncingScrollPhysics(),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@ -73,7 +97,7 @@ class VisitDealersScreenState extends State<VisitDealersScreen> {
|
|||||||
Container(
|
Container(
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets.all(20.0).copyWith(top: 30, bottom: 30),
|
const EdgeInsets.all(20.0).copyWith(top: 30, bottom: 30),
|
||||||
// margin: const EdgeInsets.symmetric(horizontal: 30.0),
|
margin: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(color: Colors.white),
|
border: Border.all(color: Colors.white),
|
||||||
color: const Color(0xffB4D1E5).withOpacity(0.9),
|
color: const Color(0xffB4D1E5).withOpacity(0.9),
|
||||||
@ -82,9 +106,10 @@ class VisitDealersScreenState extends State<VisitDealersScreen> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
CommonTextFormField(
|
CommonTextFormField(
|
||||||
|
readOnly: true,
|
||||||
title: 'Select Retailer',
|
title: 'Select Retailer',
|
||||||
fillColor: Colors.white,
|
fillColor: Colors.white,
|
||||||
controller: dealerController),
|
controller: retailerController),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
CommonTextFormField(
|
CommonTextFormField(
|
||||||
title: 'Visit date',
|
title: 'Visit date',
|
||||||
@ -151,15 +176,18 @@ class VisitDealersScreenState extends State<VisitDealersScreen> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
Align(
|
Consumer<VisitPdRdProvider>(builder: (context, value, child) => Align(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: CommonElevatedButton(
|
child: CommonElevatedButton(
|
||||||
borderRadius: 30,
|
borderRadius: 30,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: kToolbarHeight - 10,
|
height: kToolbarHeight - 10,
|
||||||
text: 'SUBMIT',
|
text: 'SUBMIT',
|
||||||
backgroundColor: const Color(0xff004791),
|
backgroundColor: const Color(0xff004791),
|
||||||
onPressed: () {},
|
onPressed: () {
|
||||||
|
value.submitVisitPdRd(widget.id ?? '');
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
@ -16,4 +16,11 @@ class ApiUrls {
|
|||||||
static const String getProducts = '${baseUrl}product/getAll/user';
|
static const String getProducts = '${baseUrl}product/getAll/user';
|
||||||
static const String getPdRdUrl = '${baseUrl}inventory/distributors-SC/';
|
static const String getPdRdUrl = '${baseUrl}inventory/distributors-SC/';
|
||||||
static const String submitProductUrl = '${baseUrl}inventory/add-SC';
|
static const String submitProductUrl = '${baseUrl}inventory/add-SC';
|
||||||
|
static const String selectTaskUrl = '${baseUrl}task/tasks';
|
||||||
|
static const String dailyTaskUrl = '${baseUrl}task/tasks/';
|
||||||
|
static const String kycSelectTaskUrl = '${baseUrl}task/task/type/Collect KYC';
|
||||||
|
static const String updateTaskInventoryUrl = '${baseUrl}task/update-task-status/';
|
||||||
|
static const String getProductsManual = '${baseUrl}productmanual/getall';
|
||||||
|
static const String salesTaskUrl = '${baseUrl}product/getAll/user/?category=Bottle';
|
||||||
|
static const String postSalesTaskUrl = '${baseUrl}sales/add-SC';
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ import 'package:cheminova/provider/home_provider.dart';
|
|||||||
import 'package:cheminova/screens/change_password_screen.dart';
|
import 'package:cheminova/screens/change_password_screen.dart';
|
||||||
import 'package:cheminova/screens/home_screen.dart';
|
import 'package:cheminova/screens/home_screen.dart';
|
||||||
import 'package:cheminova/screens/login_screen.dart';
|
import 'package:cheminova/screens/login_screen.dart';
|
||||||
|
import 'package:cheminova/screens/profile_screen.dart';
|
||||||
import 'package:cheminova/services/secure__storage_service.dart';
|
import 'package:cheminova/services/secure__storage_service.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@ -35,7 +36,7 @@ class CommonDrawer extends StatelessWidget {
|
|||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 18)),
|
fontSize: 18)),
|
||||||
Text(value.profileResponse!.myData!.sId!,
|
Text(value.profileResponse!.myData!.uniqueId!,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 15))
|
fontSize: 15))
|
||||||
@ -45,13 +46,17 @@ class CommonDrawer extends StatelessWidget {
|
|||||||
title: const Text('Home'),
|
title: const Text('Home'),
|
||||||
onTap: () => Navigator.push(context,
|
onTap: () => Navigator.push(context,
|
||||||
MaterialPageRoute(builder: (context) => const HomePage()))),
|
MaterialPageRoute(builder: (context) => const HomePage()))),
|
||||||
// ListTile(
|
ListTile(
|
||||||
// leading: const Icon(Icons.account_circle),
|
leading: const Icon(Icons.person),
|
||||||
// title: const Text('Profile'),
|
title: const Text('Profile'),
|
||||||
// onTap: () {
|
onTap: () {
|
||||||
// Navigator.pop(context);
|
Navigator.push(
|
||||||
// },
|
context,
|
||||||
// ),
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const ProfileScreen(),
|
||||||
|
));
|
||||||
|
},
|
||||||
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.settings),
|
leading: const Icon(Icons.settings),
|
||||||
title: const Text('Change Password'),
|
title: const Text('Change Password'),
|
||||||
|
@ -13,6 +13,7 @@ import flutter_local_notifications
|
|||||||
import flutter_secure_storage_macos
|
import flutter_secure_storage_macos
|
||||||
import geolocator_apple
|
import geolocator_apple
|
||||||
import path_provider_foundation
|
import path_provider_foundation
|
||||||
|
import sqflite
|
||||||
|
|
||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
|
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
|
||||||
@ -23,4 +24,5 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
|||||||
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
|
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
|
||||||
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
|
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
|
||||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
|
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
|
||||||
}
|
}
|
||||||
|
62
pubspec.lock
62
pubspec.lock
@ -374,6 +374,22 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
flutter_cache_manager:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_cache_manager
|
||||||
|
sha256: "400b6592f16a4409a7f2bb929a9a7e38c72cceb8ffb99ee57bbf2cb2cecf8386"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.4.1"
|
||||||
|
flutter_cached_pdfview:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: flutter_cached_pdfview
|
||||||
|
sha256: e0019798549828fec482585137cd91c35f19d64b4b4fd5b475b4a1eea9507463
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.4.2"
|
||||||
flutter_gen:
|
flutter_gen:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -430,6 +446,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "7.2.0"
|
version: "7.2.0"
|
||||||
|
flutter_pdfview:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_pdfview
|
||||||
|
sha256: a9055bf920c7095bf08c2781db431ba23577aa5da5a056a7152dc89a18fbec6f
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.3.2"
|
||||||
flutter_plugin_android_lifecycle:
|
flutter_plugin_android_lifecycle:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -852,10 +876,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider
|
name: path_provider
|
||||||
sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161
|
sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.3"
|
version: "2.1.4"
|
||||||
path_provider_android:
|
path_provider_android:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -1016,6 +1040,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.0"
|
version: "1.3.0"
|
||||||
|
rxdart:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: rxdart
|
||||||
|
sha256: "5c3004a4a8dbb94bd4bf5412a4def4acdaa12e12f269737a5751369e12d1a962"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.28.0"
|
||||||
shelf:
|
shelf:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -1061,6 +1093,22 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "7.0.0"
|
version: "7.0.0"
|
||||||
|
sqflite:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: sqflite
|
||||||
|
sha256: a43e5a27235518c03ca238e7b4732cf35eabe863a369ceba6cbefa537a66f16d
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.3.3+1"
|
||||||
|
sqflite_common:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: sqflite_common
|
||||||
|
sha256: "7b41b6c3507854a159e24ae90a8e3e9cc01eb26a477c118d6dca065b5f55453e"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.5.4+2"
|
||||||
stack_trace:
|
stack_trace:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -1093,6 +1141,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "1.2.0"
|
||||||
|
synchronized:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: synchronized
|
||||||
|
sha256: a824e842b8a054f91a728b783c177c1e4731f6b124f9192468457a8913371255
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.2.0"
|
||||||
table_calendar:
|
table_calendar:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -1270,5 +1326,5 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.2"
|
version: "3.1.2"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=3.4.3 <4.0.0"
|
dart: ">=3.5.0 <4.0.0"
|
||||||
flutter: ">=3.22.0"
|
flutter: ">=3.22.0"
|
||||||
|
@ -49,6 +49,7 @@ dependencies:
|
|||||||
firebase_messaging: ^15.0.4
|
firebase_messaging: ^15.0.4
|
||||||
flutter_local_notifications: ^17.2.1+2
|
flutter_local_notifications: ^17.2.1+2
|
||||||
firebase_crashlytics: ^4.0.4
|
firebase_crashlytics: ^4.0.4
|
||||||
|
flutter_cached_pdfview: ^0.4.2
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
Loading…
Reference in New Issue
Block a user