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