Compare commits
No commits in common. "59b758a7b5859d216e051c086f2397dfada51500" and "f9a96d881af9b52be3addc4fbf3ccd4277ef4f0d" have entirely different histories.
59b758a7b5
...
f9a96d881a
@ -1,7 +1,6 @@
|
|||||||
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';
|
||||||
@ -93,7 +92,6 @@ 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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,103 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,176 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
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;
|
||||||
int? gST;
|
GST? 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,11 +70,10 @@ 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'];
|
gST = json['GST'] != null ? new GST.fromJson(json['GST']) : null;
|
||||||
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;
|
||||||
@ -91,13 +90,12 @@ class Products {
|
|||||||
if (this.category != null) {
|
if (this.category != null) {
|
||||||
data['category'] = this.category!.toJson();
|
data['category'] = this.category!.toJson();
|
||||||
}
|
}
|
||||||
if (this.brand != null) {
|
|
||||||
data['brand'] = this.brand!.toJson();
|
|
||||||
}
|
|
||||||
data['price'] = this.price;
|
data['price'] = this.price;
|
||||||
data['GST'] = this.gST;
|
if (this.gST != null) {
|
||||||
data['HSN_Code'] = this.hSNCode;
|
data['GST'] = this.gST!.toJson();
|
||||||
|
}
|
||||||
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();
|
||||||
@ -128,21 +126,24 @@ class Category {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Brand {
|
class GST {
|
||||||
String? sId;
|
String? sId;
|
||||||
String? brandName;
|
String? name;
|
||||||
|
int? tax;
|
||||||
|
|
||||||
Brand({this.sId, this.brandName});
|
GST({this.sId, this.name, this.tax});
|
||||||
|
|
||||||
Brand.fromJson(Map<String, dynamic> json) {
|
GST.fromJson(Map<String, dynamic> json) {
|
||||||
sId = json['_id'];
|
sId = json['_id'];
|
||||||
brandName = json['brandName'];
|
name = json['name'];
|
||||||
|
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['brandName'] = this.brandName;
|
data['name'] = this.name;
|
||||||
|
data['tax'] = this.tax;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,6 @@ class MyData {
|
|||||||
String? uniqueId;
|
String? uniqueId;
|
||||||
String? createdAt;
|
String? createdAt;
|
||||||
String? updatedAt;
|
String? updatedAt;
|
||||||
String? designation;
|
|
||||||
int? iV;
|
int? iV;
|
||||||
|
|
||||||
MyData(
|
MyData(
|
||||||
@ -44,7 +43,6 @@ 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) {
|
||||||
@ -56,7 +54,6 @@ 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'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +67,6 @@ 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;
|
||||||
}
|
}
|
||||||
|
@ -1,86 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,126 +0,0 @@
|
|||||||
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,7 +8,6 @@ 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 {
|
||||||
@ -150,8 +149,7 @@ 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
|
} else if (nameController.text.trim().isEmpty) {
|
||||||
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')),
|
||||||
);
|
);
|
||||||
@ -262,40 +260,12 @@ 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) {
|
||||||
@ -316,11 +286,4 @@ class CollectKycProvider extends ChangeNotifier {
|
|||||||
selectedTask = s;
|
selectedTask = s;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
String? inventoryId;
|
|
||||||
void setId(String id) {
|
|
||||||
print('inventory id: $id');
|
|
||||||
inventoryId = id;
|
|
||||||
notifyListeners();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
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,10 +1,12 @@
|
|||||||
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 {
|
||||||
@ -36,6 +38,8 @@ 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);
|
||||||
@ -47,10 +51,14 @@ 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, String? inventoryId}) async {
|
{required String distributorType, required String pdRdId}) async {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
Response response = await _apiClient.post(ApiUrls.submitProductUrl,
|
Response response = await _apiClient.post(ApiUrls.submitProductUrl,
|
||||||
@ -66,32 +74,11 @@ class ProductProvider extends ChangeNotifier {
|
|||||||
).showSnackBar(
|
).showSnackBar(
|
||||||
SnackBar(content: Text(response.data['message'])),
|
SnackBar(content: Text(response.data['message'])),
|
||||||
);
|
);
|
||||||
if (inventoryId!=null ) {
|
resetProducts();
|
||||||
_apiClient.put(ApiUrls.updateTaskInventoryUrl+inventoryId,data:null).then((value) {
|
Navigator.push(
|
||||||
debugPrint('Task Updated');
|
navigatorKey.currentContext!,
|
||||||
if (value.statusCode == 200) {
|
MaterialPageRoute(
|
||||||
resetProducts();
|
builder: (context) => const DataSubmitSuccessFullScreen()));
|
||||||
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);
|
||||||
@ -127,8 +114,6 @@ 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,6 +14,7 @@ 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) {
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
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()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
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,13 +12,12 @@ 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, this.inventoryId
|
required this.pdRdId
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -40,7 +39,7 @@ class _AddProductsScreenState extends State<AddProductsScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
if (context.mounted) {
|
if (mounted) {
|
||||||
productProvider.resetProducts();
|
productProvider.resetProducts();
|
||||||
}
|
}
|
||||||
super.dispose();
|
super.dispose();
|
||||||
@ -178,7 +177,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, inventoryId: widget.inventoryId
|
pdRdId: widget.pdRdId
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
@ -1,140 +0,0 @@
|
|||||||
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),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +1,20 @@
|
|||||||
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 {
|
||||||
final String? tradeName;
|
const VisitDealersScreen({super.key});
|
||||||
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()));
|
||||||
|
|
||||||
@ -31,7 +26,6 @@ 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'];
|
||||||
@ -42,52 +36,34 @@ 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) {
|
||||||
retailerController = TextEditingController(text: widget.tradeName);
|
return CommonBackground(
|
||||||
|
child: Scaffold(
|
||||||
return ChangeNotifierProvider(
|
backgroundColor: Colors.transparent,
|
||||||
create: (context) => _visitPdRdProvider,
|
appBar: CommonAppBar(
|
||||||
child: CommonBackground(
|
actions: [
|
||||||
child: Scaffold(
|
IconButton(
|
||||||
backgroundColor: Colors.transparent,
|
onPressed: () {
|
||||||
appBar: CommonAppBar(
|
Navigator.pop(context);
|
||||||
actions: [
|
},
|
||||||
IconButton(
|
icon: Image.asset('assets/Back_attendance.png'),
|
||||||
onPressed: () {
|
padding: const EdgeInsets.only(right: 20),
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
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,
|
title: const Text('Visit Retailers',
|
||||||
),
|
style: TextStyle(
|
||||||
drawer: const CommonDrawer(),
|
fontSize: 20,
|
||||||
body: SingleChildScrollView(
|
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(),
|
physics: const BouncingScrollPhysics(),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@ -97,7 +73,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: 16.0),
|
// margin: const EdgeInsets.symmetric(horizontal: 30.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),
|
||||||
@ -106,10 +82,9 @@ 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: retailerController),
|
controller: dealerController),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
CommonTextFormField(
|
CommonTextFormField(
|
||||||
title: 'Visit date',
|
title: 'Visit date',
|
||||||
@ -176,18 +151,15 @@ class VisitDealersScreenState extends State<VisitDealersScreen> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
Consumer<VisitPdRdProvider>(builder: (context, value, child) => Align(
|
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 ?? '');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
@ -1,423 +0,0 @@
|
|||||||
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,8 +11,7 @@ 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 {
|
||||||
final String id;
|
const CollectKycScreen({super.key});
|
||||||
const CollectKycScreen({super.key, required this.id});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<CollectKycScreen> createState() => CollectKycScreenState();
|
State<CollectKycScreen> createState() => CollectKycScreenState();
|
||||||
@ -31,7 +30,6 @@ 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,16 +1,12 @@
|
|||||||
import 'package:cheminova/models/Daily_Task_Response.dart';
|
|
||||||
import 'package:cheminova/screens/Add_products_screen.dart';
|
|
||||||
import 'package:cheminova/screens/add_sales_product_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_background.dart';
|
|
||||||
import 'package:cheminova/widgets/common_drawer.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:cheminova/screens/visit_dealers_screen.dart';
|
||||||
|
import 'package:cheminova/screens/display_sales_screen.dart';
|
||||||
|
import 'package:cheminova/screens/update_inventory_screen.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: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});
|
||||||
@ -22,39 +18,30 @@ 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 ChangeNotifierProvider(
|
return Scaffold(
|
||||||
create: (context) => _dailyTaskProvider,
|
extendBodyBehindAppBar: true,
|
||||||
child: Scaffold(
|
appBar: _buildAppBar(),
|
||||||
extendBodyBehindAppBar: true,
|
drawer: const CommonDrawer(),
|
||||||
appBar: _buildAppBar(),
|
body: CommonBackground(
|
||||||
drawer: const CommonDrawer(),
|
child: SafeArea(
|
||||||
body: CommonBackground(
|
child: Column(
|
||||||
child: SafeArea(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
child: Column(
|
children: [
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
_buildCustomTabBar(),
|
||||||
children: [
|
Expanded(
|
||||||
_buildCustomTabBar(),
|
child: _buildTaskList(_selectedTabIndex),
|
||||||
Expanded(
|
|
||||||
child: _buildTaskList(_selectedTabIndex),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
));
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
CommonAppBar _buildAppBar() {
|
PreferredSizeWidget _buildAppBar() {
|
||||||
return CommonAppBar(
|
return CommonAppBar(
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
@ -80,16 +67,7 @@ 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: () {
|
onTap: () => setState(() => _selectedTabIndex = index),
|
||||||
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(
|
||||||
@ -157,115 +135,117 @@ class _DailyTasksScreenState extends State<DailyTasksScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildTaskList(int tabIndex) {
|
Widget _buildTaskList(int tabIndex) {
|
||||||
return Consumer<DailyTaskProvider>(
|
List<TaskItem> tasks;
|
||||||
builder: (context, value, child) => value.isLoading
|
switch (tabIndex) {
|
||||||
? const Center(child: CircularProgressIndicator())
|
case 0:
|
||||||
: ListView.separated(
|
tasks = _newTasks;
|
||||||
padding: const EdgeInsets.all(16),
|
break;
|
||||||
itemCount: _selectedTabIndex == 0
|
case 1:
|
||||||
? value.newTasksList.length
|
tasks = _pendingTasks;
|
||||||
: _selectedTabIndex == 1
|
break;
|
||||||
? value.pendingTasksList.length
|
case 2:
|
||||||
: value.completedTasksList.length,
|
tasks = _completedTasks;
|
||||||
separatorBuilder: (context, index) => const SizedBox(height: 8),
|
break;
|
||||||
itemBuilder: (context, index) {
|
default:
|
||||||
final tasksList = tabIndex == 0
|
tasks = [];
|
||||||
? value.newTasksList
|
}
|
||||||
: tabIndex == 1
|
|
||||||
? value.pendingTasksList
|
return ListView.separated(
|
||||||
: value.completedTasksList;
|
padding: const EdgeInsets.all(16),
|
||||||
return _buildTaskCard(tasksList[index]);
|
itemCount: tasks.length,
|
||||||
},
|
separatorBuilder: (context, index) => const SizedBox(height: 8),
|
||||||
),
|
itemBuilder: (context, index) => _buildTaskCard(tasks[index]),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildTaskCard(Tasks tasksList) {
|
Widget _buildTaskCard(TaskItem task) {
|
||||||
return InkWell(
|
if (task is KycTaskItem) {
|
||||||
onTap: _selectedTabIndex == 2
|
return Card(
|
||||||
? 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(tasksList.task ?? '',
|
title: Text(
|
||||||
style: const TextStyle(
|
task.title,
|
||||||
color: Colors.black87,
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.w700,
|
color: Colors.black87,
|
||||||
fontSize: 16,
|
fontWeight: FontWeight.w700,
|
||||||
fontFamily: 'Anek')),
|
fontSize: 16,
|
||||||
trailing: _selectedTabIndex == 2
|
fontFamily: 'Anek',
|
||||||
? 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: [
|
||||||
if (tasksList.note != null) Text('Note: ${tasksList.note}'),
|
Text('Note: ${task.note}'),
|
||||||
if (tasksList.addedFor != null)
|
Text('Date: ${task.date.toString().split(' ')[0]}'),
|
||||||
Text('Distributor: ${tasksList.addedFor ?? ""}'),
|
Text('Priority: ${task.Low}'),
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
135
lib/screens/display_sales_screen.dart
Normal file
135
lib/screens/display_sales_screen.dart
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
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,8 +1,5 @@
|
|||||||
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,15 +1,16 @@
|
|||||||
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/Update_inventorytask_screen.dart';
|
import 'package:cheminova/screens/rejected_application_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_purchase_data.dart';
|
import 'package:cheminova/screens/product_sales_data.dart';
|
||||||
import 'package:cheminova/screens/products_manual_screen.dart';
|
import 'package:cheminova/screens/products_manual_screen.dart';
|
||||||
import 'package:cheminova/screens/rejected_application_screen.dart';
|
import 'package:cheminova/screens/summary_screen.dart';
|
||||||
import 'package:cheminova/screens/sales_task_screen.dart';
|
import 'package:cheminova/screens/update_inventory_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';
|
||||||
@ -48,6 +49,10 @@ 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',
|
||||||
@ -57,13 +62,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,
|
||||||
@ -73,185 +78,186 @@ 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: LayoutBuilder(
|
child: Column(
|
||||||
builder: (context, constraints) {
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
double screenWidth = constraints.maxWidth;
|
children: [
|
||||||
double buttonWidth = screenWidth / 2 - 18; // Adjust button width
|
Expanded(
|
||||||
|
child: ListView(
|
||||||
return ListView(
|
children: [
|
||||||
children: [
|
_buildCustomCard(
|
||||||
_buildCustomCard(
|
'Mark Attendance',
|
||||||
'Mark Attendance',
|
'Mark Attendance / On Leave',
|
||||||
'Mark Attendance / On Leave',
|
onTap: () {
|
||||||
screenWidth,
|
Navigator.push(
|
||||||
onTap: () {
|
context,
|
||||||
|
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 MarkAttendanceScreen(),
|
builder: (context) => const DailyTasksScreen(),
|
||||||
),
|
));
|
||||||
);
|
}),
|
||||||
},
|
const SizedBox(
|
||||||
),
|
height: 5,
|
||||||
const SizedBox(height: 5),
|
),
|
||||||
_buildCustomCard(
|
Row(
|
||||||
'Daily Tasks',
|
children: [
|
||||||
'Dashboard',
|
Expanded(
|
||||||
screenWidth,
|
child: _buildCustomCard(
|
||||||
onTap: () {
|
'Display\nSales data', 'Quickly display Sales',
|
||||||
Navigator.push(
|
onTap: () {
|
||||||
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) =>
|
||||||
SalesTaskScreen()
|
const DisplaySalesScreen(),
|
||||||
),
|
));
|
||||||
);
|
}),
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(
|
||||||
const SizedBox(width: 12),
|
width: 12,
|
||||||
Expanded(
|
),
|
||||||
child: _buildCustomCard(
|
Expanded(
|
||||||
'Update Inventory Data',
|
child: _buildCustomCard('Update Inventory Data',
|
||||||
'Quickly Inventory Data',
|
'Quickly Inventory Data', onTap: () {
|
||||||
buttonWidth,
|
|
||||||
onTap: () {
|
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
const UpdateInventoryTaskScreen(),
|
const UpdateInventoryScreen(),
|
||||||
),
|
));
|
||||||
);
|
}),
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
const SizedBox(
|
||||||
const SizedBox(height: 5),
|
height: 5,
|
||||||
Row(
|
),
|
||||||
children: [
|
Row(
|
||||||
Expanded(
|
children: [
|
||||||
child: _buildCustomCard(
|
Expanded(
|
||||||
'Notifications',
|
child:
|
||||||
'Tasks & Alerts\n\n',
|
_buildCustomCard('Summary', '\n\n', onTap: () {
|
||||||
buttonWidth,
|
|
||||||
onTap: () {
|
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) => const SummaryScreen(),
|
||||||
const NotificationScreen(),
|
));
|
||||||
),
|
}),
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(
|
||||||
const SizedBox(width: 12),
|
width: 12,
|
||||||
Expanded(
|
),
|
||||||
child: _buildCustomCard(
|
Expanded(
|
||||||
'Product\nPurchase Data Visibility',
|
child: _buildCustomCard(
|
||||||
'',
|
'Product\nSales Data Visibility', '',
|
||||||
buttonWidth,
|
onTap: () {
|
||||||
onTap: () {
|
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
const ProductPurchaseData(),
|
const ProductSalesData(),
|
||||||
),
|
));
|
||||||
);
|
}),
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
const SizedBox(height: 5),
|
||||||
const SizedBox(height: 5),
|
Row(
|
||||||
_buildCustomCard(
|
children: [
|
||||||
'Collect \nKYC Data',
|
Expanded(
|
||||||
'Scan and upload KYC Documents',
|
child: _buildCustomCard('Collect \nKYC Data',
|
||||||
screenWidth,
|
'Scan and upload KYC Documents', onTap: () {
|
||||||
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) => const CalendarScreen(),
|
builder: (context) =>
|
||||||
),
|
const CollectKycScreen(),
|
||||||
);
|
));
|
||||||
},
|
}),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
const SizedBox(width: 12),
|
),
|
||||||
Expanded(
|
const SizedBox(height: 5),
|
||||||
child: _buildCustomCard(
|
Row(
|
||||||
'Products Manual',
|
children: [
|
||||||
'Details of products',
|
Expanded(
|
||||||
buttonWidth,
|
child: _buildCustomCard('Rejected Applications',
|
||||||
onTap: () {
|
'Re-upload Rejected Documents', onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
const ProductsManualScreen(),
|
const RejectedApplicationScreen(),
|
||||||
),
|
));
|
||||||
);
|
}),
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
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(),
|
||||||
|
));
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -259,10 +265,9 @@ class _HomePageState extends State<HomePage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCustomCard(String title, String subtitle, double width,
|
Widget _buildCustomCard(String title, String subtitle,
|
||||||
{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,
|
||||||
@ -270,6 +275,7 @@ 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(
|
||||||
@ -280,9 +286,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,6 +72,7 @@ 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');
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -85,6 +86,7 @@ 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) {
|
||||||
@ -115,6 +117,7 @@ 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 ProductPurchaseData extends StatefulWidget {
|
class ProductSalesData extends StatefulWidget {
|
||||||
const ProductPurchaseData({super.key});
|
const ProductSalesData({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ProductPurchaseData> createState() => ProductPurchaseDataState();
|
State<ProductSalesData> createState() => ProductSalesDataState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class ProductPurchaseDataState extends State<ProductPurchaseData> {
|
class ProductSalesDataState extends State<ProductSalesData> {
|
||||||
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 ProductPurchaseDataState extends State<ProductPurchaseData> {
|
|||||||
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 Purchase Data',
|
title: const Text('Product Sales Data',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
@ -1,103 +1,67 @@
|
|||||||
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';
|
|
||||||
|
|
||||||
import '../models/product_manual_model.dart';
|
class ProductsManualScreen extends StatelessWidget {
|
||||||
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 ChangeNotifierProvider<ProductManualProvider>(
|
return CommonBackground(
|
||||||
create: (_) => _productManualProvider,
|
child: Scaffold(
|
||||||
builder: (context, child) => CommonBackground(
|
backgroundColor: Colors.transparent,
|
||||||
child: Scaffold(
|
appBar: CommonAppBar(
|
||||||
backgroundColor: Colors.transparent,
|
actions: [
|
||||||
appBar: CommonAppBar(
|
IconButton(
|
||||||
actions: [
|
onPressed: () {
|
||||||
IconButton(
|
Navigator.pop(context);
|
||||||
onPressed: () {
|
},
|
||||||
Navigator.pop(context);
|
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('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,
|
||||||
backgroundColor: Colors.transparent,
|
elevation: 0,
|
||||||
elevation: 0,
|
),
|
||||||
),
|
drawer: const CommonDrawer(),
|
||||||
drawer: const CommonDrawer(),
|
body: Padding(
|
||||||
body: Padding(
|
padding: const EdgeInsets.all(16.0),
|
||||||
padding: const EdgeInsets.all(16.0),
|
child: SingleChildScrollView(
|
||||||
child: SingleChildScrollView(
|
physics: const BouncingScrollPhysics(),
|
||||||
physics: const BouncingScrollPhysics(),
|
child: Column(
|
||||||
child: Column(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
children: <Widget>[
|
||||||
children: <Widget>[
|
const SizedBox(height: 16),
|
||||||
const SizedBox(height: 16),
|
Container(
|
||||||
Consumer<ProductManualProvider>(
|
padding: const EdgeInsets.all(20.0).copyWith(top: 30, bottom: 30),
|
||||||
builder: (context, provider, child) {
|
decoration: BoxDecoration(
|
||||||
if (provider.isLoading) {
|
border: Border.all(color: Colors.white),
|
||||||
return const Center(
|
color: const Color(0xffB4D1E5).withOpacity(0.9),
|
||||||
child: CircularProgressIndicator(),
|
borderRadius: BorderRadius.circular(26.0),
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
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'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -105,22 +69,20 @@ class _ProductsManualScreenState extends State<ProductsManualScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildProductButton(BuildContext context, ProductManualModel product) {
|
Widget _buildProductButton(String productName) {
|
||||||
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: product.title,
|
text: productName,
|
||||||
backgroundColor: const Color(0xff004791),
|
backgroundColor: const Color(0xff004791),
|
||||||
onPressed: () => Navigator.push(
|
onPressed: () {
|
||||||
context,
|
// Handle product button press
|
||||||
MaterialPageRoute(
|
debugPrint('$productName pressed');
|
||||||
builder: (context) => ViewPdfScreen(productManualModel: product),
|
},
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,97 +0,0 @@
|
|||||||
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,191 +43,213 @@ class RetailerDetailsScreenState extends State<RetailerDetailsScreen> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Column(
|
DropdownButtonFormField<String>(
|
||||||
children: [
|
decoration: InputDecoration(
|
||||||
const SizedBox(height: 15),
|
fillColor: Colors.white,
|
||||||
CommonTextFormField(
|
filled: true,
|
||||||
title: 'Trade Name',
|
border: OutlineInputBorder(
|
||||||
fillColor: Colors.white,
|
borderRadius: BorderRadius.circular(8),
|
||||||
validator: (String? value) {
|
borderSide: BorderSide.none)),
|
||||||
if (value!.isEmpty) {
|
hint: Text("Select a task"),
|
||||||
return 'Trade Name cannot be empty';
|
value: value.selectedTask,
|
||||||
}
|
onChanged: (String? newValue) {
|
||||||
return null;
|
value.setTask(newValue!);
|
||||||
},
|
},
|
||||||
controller: value.tradeNameController),
|
items:["task1", "task2", "task3"].map((String task) {
|
||||||
const SizedBox(height: 15),
|
return DropdownMenuItem<String>(
|
||||||
CommonTextFormField(
|
value: task,
|
||||||
title: 'Name',
|
child: Text(task),
|
||||||
fillColor: Colors.white,
|
);
|
||||||
validator: (String? value) {
|
}).toList(),
|
||||||
if (value!.isEmpty) {
|
),
|
||||||
return 'Name cannot be empty';
|
IgnorePointer(
|
||||||
}
|
ignoring: value.selectedTask == null,
|
||||||
return null;
|
child: Column(
|
||||||
},
|
children: [
|
||||||
controller: value.nameController),
|
const SizedBox(height: 15),
|
||||||
const SizedBox(height: 15),
|
CommonTextFormField(
|
||||||
CommonTextFormField(
|
title: 'Trade Name',
|
||||||
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,
|
fillColor: Colors.white,
|
||||||
filled: true,
|
validator: (String? value) {
|
||||||
border: OutlineInputBorder(
|
if (value!.isEmpty) {
|
||||||
borderRadius: BorderRadius.circular(8),
|
return 'Trade Name cannot be empty';
|
||||||
borderSide: BorderSide.none),
|
}
|
||||||
hintText: 'Mapped Principal Distributor'),
|
return null;
|
||||||
value: value.selectedDistributor,
|
},
|
||||||
items: value.pdList.map((GetPdResponse pd) {
|
controller: value.tradeNameController),
|
||||||
return DropdownMenuItem<String>(
|
const SizedBox(height: 15),
|
||||||
value: pd.sId, child: Text(pd.name ?? ''));
|
CommonTextFormField(
|
||||||
}).toList(),
|
title: 'Name',
|
||||||
onChanged: (String? newValue) {
|
fillColor: Colors.white,
|
||||||
setState(() {
|
validator: (String? value) {
|
||||||
value.selectedDistributor = newValue;
|
if (value!.isEmpty) {
|
||||||
});
|
return 'Name cannot be empty';
|
||||||
},
|
}
|
||||||
validator: (String? value) {
|
return null;
|
||||||
if (value == null || value.isEmpty) {
|
},
|
||||||
return 'Mapped Principal Distributor cannot be empty';
|
controller: value.nameController),
|
||||||
}
|
const SizedBox(height: 15),
|
||||||
return null;
|
CommonTextFormField(
|
||||||
},
|
title: 'Address',
|
||||||
),
|
fillColor: Colors.white,
|
||||||
const SizedBox(height: 30),
|
validator: (String? value) {
|
||||||
Align(
|
if (value!.isEmpty) {
|
||||||
alignment: Alignment.center,
|
return 'Address cannot be empty';
|
||||||
child: CommonElevatedButton(
|
}
|
||||||
borderRadius: 30,
|
return null;
|
||||||
width: double.infinity,
|
},
|
||||||
height: kToolbarHeight - 10,
|
controller: value.addressController),
|
||||||
text: 'CONTINUE',
|
const SizedBox(height: 15),
|
||||||
backgroundColor: const Color(0xff004791),
|
CSCPicker(
|
||||||
onPressed: () {
|
defaultCountry: CscCountry.India,
|
||||||
if (value.retailerDetailsFormKey.currentState!
|
disableCountry: true,
|
||||||
.validate()) {
|
onCountryChanged: (val) {
|
||||||
value.tabController.animateTo(1);
|
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);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -1,141 +0,0 @@
|
|||||||
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),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,149 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
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())))));
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,11 +16,4 @@ 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,7 +2,6 @@ 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';
|
||||||
@ -36,7 +35,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!.uniqueId!,
|
Text(value.profileResponse!.myData!.sId!,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 15))
|
fontSize: 15))
|
||||||
@ -46,17 +45,13 @@ 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.person),
|
// leading: const Icon(Icons.account_circle),
|
||||||
title: const Text('Profile'),
|
// title: const Text('Profile'),
|
||||||
onTap: () {
|
// onTap: () {
|
||||||
Navigator.push(
|
// Navigator.pop(context);
|
||||||
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,7 +13,6 @@ 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"))
|
||||||
@ -24,5 +23,4 @@ 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,22 +374,6 @@ 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:
|
||||||
@ -446,14 +430,6 @@ 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:
|
||||||
@ -876,10 +852,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider
|
name: path_provider
|
||||||
sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378
|
sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.4"
|
version: "2.1.3"
|
||||||
path_provider_android:
|
path_provider_android:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -1040,14 +1016,6 @@ 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:
|
||||||
@ -1093,22 +1061,6 @@ 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:
|
||||||
@ -1141,14 +1093,6 @@ 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:
|
||||||
@ -1326,5 +1270,5 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.2"
|
version: "3.1.2"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=3.5.0 <4.0.0"
|
dart: ">=3.4.3 <4.0.0"
|
||||||
flutter: ">=3.22.0"
|
flutter: ">=3.22.0"
|
||||||
|
@ -49,7 +49,6 @@ 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