feat: inventory home page

This commit is contained in:
louis 2024-03-21 16:22:00 +08:00
parent b0c51290cf
commit f325cce223
15 changed files with 437 additions and 305 deletions

View File

@ -2,6 +2,7 @@
class GloablConfig { class GloablConfig {
// static const BASE_URL = "http://10.0.2.2:7001/api/"; // static const BASE_URL = "http://10.0.2.2:7001/api/";
static const BASE_URL = "http://192.168.60.220:7001/api/"; static const BASE_URL = "http://192.168.60.220:7001/api/";
static const OSS_URL = "http://192.168.60.220:7001";
static const DOMAIN_NAME = "山矿通"; static const DOMAIN_NAME = "山矿通";
static const DEBUG = true; static const DEBUG = true;
static const PRIVACY_POLICY = 'http://h5.heeru.xyz/privacyPolicy.html'; static const PRIVACY_POLICY = 'http://h5.heeru.xyz/privacyPolicy.html';

View File

@ -3,3 +3,11 @@ enum BackActionEnum {
} }
enum LoginEnum { apple, fastLogin } enum LoginEnum { apple, fastLogin }
enum InventoryInOrOutEnum { In, Out }
// InventoryInOrOutEnum
const Map<InventoryInOrOutEnum, int> InventoryInOrOutEnumValues = {
InventoryInOrOutEnum.In: 1,
InventoryInOrOutEnum.Out: 2,
};

View File

@ -4,3 +4,4 @@ export './project.model.dart';
export './product.model.dart'; export './product.model.dart';
export './dict_item.model.dart'; export './dict_item.model.dart';
export './company.model.dart'; export './company.model.dart';
export './inventory_inout.model.dart';

View File

@ -0,0 +1,98 @@
import 'package:sk_base_mobile/constants/enum.dart';
import 'package:sk_base_mobile/models/file.model.dart';
import 'package:sk_base_mobile/models/index.dart';
import 'package:sk_base_mobile/models/product.model.dart';
import 'package:sk_base_mobile/models/project.model.dart';
class InventoryInOutModel {
InventoryInOutModel({
required this.id,
required this.createdAt,
required this.updatedAt,
required this.inventoryNumber,
required this.productId,
required this.inOrOut,
required this.time,
required this.quantity,
required this.unitPrice,
required this.amount,
required this.agent,
required this.issuanceNumber,
required this.remark,
required this.projectId,
required this.isDelete,
required this.files,
required this.project,
required this.product,
});
final int? id;
final DateTime? createdAt;
final DateTime? updatedAt;
final String? inventoryNumber;
final int? productId;
final int? inOrOut;
final DateTime? time;
final int? quantity;
final String? unitPrice;
final String? amount;
final String? agent;
final dynamic issuanceNumber;
final String? remark;
final int? projectId;
final int? isDelete;
final List<FileModel?> files;
final ProjectModel? project;
final ProductModel? product;
factory InventoryInOutModel.fromJson(Map<String, dynamic> json) {
return InventoryInOutModel(
id: json["id"],
createdAt: DateTime.tryParse(json["createdAt"] ?? ""),
updatedAt: DateTime.tryParse(json["updatedAt"] ?? ""),
inventoryNumber: json["inventoryNumber"],
productId: json["productId"],
inOrOut: json["inOrOut"],
time: DateTime.tryParse(json["time"] ?? ""),
quantity: json["quantity"],
unitPrice: json["unitPrice"],
amount: json["amount"],
agent: json["agent"],
issuanceNumber: json["issuanceNumber"],
remark: json["remark"],
projectId: json["projectId"],
isDelete: json["isDelete"],
files: json["files"] == null
? []
: List<FileModel>.from(
json["files"]!.map((x) => FileModel.fromJson(x))),
project: json["project"] == null
? null
: ProjectModel.fromJson(json["project"]),
product: json["product"] == null
? null
: ProductModel.fromJson(json["product"]),
);
}
Map<String, dynamic> toJson() => {
"id": id,
"createdAt": createdAt?.toIso8601String(),
"updatedAt": updatedAt?.toIso8601String(),
"inventoryNumber": inventoryNumber,
"productId": productId,
"inOrOut": inOrOut,
"time": time,
"quantity": quantity,
"unitPrice": unitPrice,
"amount": amount,
"agent": agent,
"issuanceNumber": issuanceNumber,
"remark": remark,
"projectId": projectId,
"isDelete": isDelete,
"files": files.map((x) => x).toList(),
"project": project?.toJson(),
"product": product?.toJson(),
};
}

View File

@ -0,0 +1,177 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sk_base_mobile/config.dart';
import 'package:sk_base_mobile/constants/bg_color.dart';
import 'package:sk_base_mobile/constants/data.dart';
import 'package:sk_base_mobile/constants/enum.dart';
import 'package:sk_base_mobile/screens/inventory_inout/components/inventory_inout_card_content.dart';
import 'package:sk_base_mobile/screens/inventory_inout/inventory_inout_controller.dart';
import 'package:sk_base_mobile/util/util.dart';
import 'package:sk_base_mobile/widgets/fade_in_cache_image.dart';
class InventoryInoutCard extends StatelessWidget {
InventoryInoutCard({required this.index, required this.ind});
final int index;
final int ind;
final controller = Get.find<InventoryInoutController>();
@override
Widget build(BuildContext context) {
return Dismissible(
key: UniqueKey(),
confirmDismiss: (direction) async {
// return await ModalUtil.showWarningDialog(
// 'Remove Task', 'Are you sure to remove this task', 'Confirm', () {
// controller.db.delete(controller.list[ind][index].key, 'Tasks');
// controller.list[ind].remove(controller.list[ind][index]);
// });
},
child: Container(
margin: EdgeInsets.symmetric(
vertical: ScreenAdaper.height(15),
horizontal: ScreenAdaper.width(15)),
padding: EdgeInsets.symmetric(
horizontal: ScreenAdaper.width(defaultPadding)),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: lightAccentBlue.withOpacity(.5),
offset: Offset(0, ScreenAdaper.height(5)),
blurRadius: ScreenAdaper.sp(10)),
],
color: Colors.white,
borderRadius: BorderRadius.circular(ScreenAdaper.sp(30))),
child: Row(
children: [
// Image.asset(
// Data().images[controller.list[ind][index].image],
// height: 100,
// width: 100,
// ),
if (controller.list[ind][index].files.isNotEmpty)
ClipRRect(
borderRadius: BorderRadius.circular(ScreenAdaper.sp(15)),
child: FadeInCacheImage(
width: ScreenAdaper.width(100),
height: ScreenAdaper.width(100),
url:
'${GloablConfig.OSS_URL}${controller.list[ind][index].files[0]?.path}'),
),
SizedBox(
width: ScreenAdaper.width(defaultPadding) / 2,
),
InventoryInoutCardContent(index: index, ind: ind),
// const Spacer(
// flex: 2,
// ),
// controller.list[ind][index].inOrOut ==
// InventoryInOrOutEnumValues[InventoryInOrOutEnum.In]
// ? Container(
// height: ScreenAdaper.height(40),
// width: ScreenAdaper.width(40),
// decoration: BoxDecoration(
// shape: BoxShape.circle,
// gradient: const LinearGradient(
// begin: Alignment.topCenter,
// end: Alignment.bottomCenter,
// colors: [
// lightOrange,
// darkOrange,
// ]),
// boxShadow: [
// BoxShadow(
// color: lightOrange,
// offset: Offset(0, ScreenAdaper.height(10)),
// blurRadius: ScreenAdaper.sp(10))
// ]),
// child: const Icon(
// Icons.done,
// color: Colors.white,
// ),
// )
// : Align(
// alignment: Alignment.topRight,
// child: Padding(
// padding: EdgeInsets.only(top: ScreenAdaper.height(20)),
// child: PopupMenuButton(
// onSelected: (value) => {
// // controller.onTaskComplete(value, index, ind,
// // controller.list[ind][index].key, context)
// },
// surfaceTintColor: Colors.white,
// padding: EdgeInsets.zero,
// icon: Icon(
// Icons.more_vert_rounded,
// color: Colors.grey,
// size: ScreenAdaper.sp(24),
// ),
// shape: OutlineInputBorder(
// borderRadius:
// BorderRadius.circular(ScreenAdaper.sp(20)),
// borderSide: BorderSide.none,
// ),
// itemBuilder: (context) {
// return [
// PopupMenuItem(
// height: ScreenAdaper.height(20),
// value: 1,
// child: Row(
// children: [
// Icon(
// Icons.edit_note,
// color: Colors.orange,
// size: ScreenAdaper.sp(14),
// ),
// SizedBox(
// width:
// ScreenAdaper.width(defaultPadding) /
// 2,
// ),
// const Text('Edit')
// ],
// )),
// PopupMenuItem(
// height: ScreenAdaper.height(25),
// value: 2,
// child: Row(
// children: [
// Icon(
// Icons.delete_outline,
// color: Colors.orange,
// size: ScreenAdaper.sp(14),
// ),
// SizedBox(
// width:
// ScreenAdaper.width(defaultPadding) /
// 2,
// ),
// Text('Delete')
// ],
// )),
// PopupMenuItem(
// height: ScreenAdaper.height(25),
// value: 3,
// child: Row(
// children: [
// Icon(
// Icons.done_all_outlined,
// color: Colors.orange,
// size: ScreenAdaper.sp(14),
// ),
// SizedBox(
// width:
// ScreenAdaper.width(defaultPadding) /
// 2,
// ),
// Text('Complete')
// ],
// )),
// ];
// },
// )),
// ),
],
),
),
);
}
}

View File

@ -0,0 +1,72 @@
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sk_base_mobile/constants/bg_color.dart';
import 'package:sk_base_mobile/constants/data.dart';
import 'package:sk_base_mobile/screens/inventory_inout/inventory_inout_controller.dart';
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
class InventoryInoutCardContent extends StatelessWidget {
InventoryInoutCardContent(
{super.key, required this.index, required this.ind});
final int index;
final int ind;
final int randomColor1 = Random().nextInt(9);
final int randomColor2 = Random().nextInt(9);
final controller = Get.find<InventoryInoutController>();
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
controller.list[ind][index].product?.name ?? 'Product Name',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: ScreenAdaper.sp(25)),
),
// Text(
// '${controller.list[ind][index].time} - ${controller.list[ind][index].time}',
// style: const TextStyle(
// color: Colors.grey, fontWeight: FontWeight.w300, fontSize: 12),
// ),
SizedBox(
height: ScreenAdaper.width(defaultPadding) / 2,
),
// Row(
// children: [
// Container(
// alignment: Alignment.center,
// padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 10),
// decoration: BoxDecoration(
// color: Data().colors[randomColor1].withOpacity(.5),
// borderRadius: BorderRadius.circular(10),
// ),
// child: Text(
// Data().tags[Random().nextInt(13)],
// style: TextStyle(color: Data().colors[randomColor1]),
// ),
// ),
// const SizedBox(
// width: defaultPadding / 2,
// ),
// Container(
// alignment: Alignment.center,
// padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 10),
// decoration: BoxDecoration(
// color: Data().colors[randomColor2].withOpacity(.5),
// borderRadius: BorderRadius.circular(10)),
// child: Text(
// Data().tags[Random().nextInt(13)],
// style: TextStyle(color: Data().colors[randomColor2]),
// ),
// )
// ],
// ),
],
);
}
}

View File

@ -1,68 +0,0 @@
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sk_base_mobile/constants/bg_color.dart';
import 'package:sk_base_mobile/constants/data.dart';
import 'package:sk_base_mobile/screens/inventory_inout/inventory_inout_controller.dart';
class TaskTitle extends StatelessWidget {
TaskTitle({super.key, required this.index, required this.ind});
final int index;
final int ind;
final int randomColor1 = Random().nextInt(9);
final int randomColor2 = Random().nextInt(9);
final controller = Get.put(InventoryInoutController());
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
controller.list[ind][index].title,
style: const TextStyle(
color: Colors.black, fontWeight: FontWeight.bold, fontSize: 20),
),
Text(
'${controller.list[ind][index].startTime} - ${controller.list[ind][index].endTime}',
style: const TextStyle(
color: Colors.grey, fontWeight: FontWeight.w300, fontSize: 12),
),
const SizedBox(
height: defaultPadding / 2,
),
Row(
children: [
Container(
alignment: Alignment.center,
padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 10),
decoration: BoxDecoration(
color: Data().colors[randomColor1].withOpacity(.5),
borderRadius: BorderRadius.circular(10),
),
child: Text(
Data().tags[Random().nextInt(13)],
style: TextStyle(color: Data().colors[randomColor1]),
),
),
const SizedBox(
width: defaultPadding / 2,
),
Container(
alignment: Alignment.center,
padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 10),
decoration: BoxDecoration(
color: Data().colors[randomColor2].withOpacity(.5),
borderRadius: BorderRadius.circular(10)),
child: Text(
Data().tags[Random().nextInt(13)],
style: TextStyle(color: Data().colors[randomColor2]),
),
)
],
),
],
);
}
}

View File

@ -1,153 +0,0 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sk_base_mobile/constants/bg_color.dart';
import 'package:sk_base_mobile/constants/data.dart';
import 'package:sk_base_mobile/screens/inventory_inout/components/task_detail_col.dart';
import 'package:sk_base_mobile/screens/inventory_inout/inventory_inout_controller.dart';
import 'package:sk_base_mobile/util/util.dart';
class TaskDetailContainer extends StatelessWidget {
TaskDetailContainer({super.key, required this.index, required this.ind});
final int index;
final int ind;
final controller = Get.put(InventoryInoutController());
@override
Widget build(BuildContext context) {
return Dismissible(
key: UniqueKey(),
confirmDismiss: (direction) async {
return await ModalUtil.showWarningDialog(
'Remove Task', 'Are you sure to remove this task', 'Confirm', () {
controller.db.delete(controller.list[ind][index].key, 'Tasks');
controller.list[ind].remove(controller.list[ind][index]);
});
},
child: Container(
margin: const EdgeInsets.symmetric(vertical: 10, horizontal: 20),
padding: const EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(boxShadow: [
BoxShadow(
color: lightAccentBlue.withOpacity(.5),
offset: Offset(0, 5),
blurRadius: 10),
], color: Colors.white, borderRadius: BorderRadius.circular(30)),
child: Row(
children: [
Image.asset(
Data().images[controller.list[ind][index].image],
height: 100,
width: 100,
),
const Spacer(
flex: 1,
),
TaskTitle(index: index, ind: ind),
const Spacer(
flex: 2,
),
controller.list[ind][index].status == 'complete'
? Container(
height: 40,
width: 40,
decoration: const BoxDecoration(
shape: BoxShape.circle,
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
lightOrange,
darkOrange,
]),
boxShadow: [
BoxShadow(
color: lightOrange,
offset: Offset(0, 10),
blurRadius: 10)
]),
child: const Icon(
Icons.done,
color: Colors.white,
),
)
: Align(
alignment: Alignment.topRight,
child: Padding(
padding: const EdgeInsets.only(top: 20),
child: PopupMenuButton(
onSelected: (value) => controller.onTaskComplete(
value,
index,
ind,
controller.list[ind][index].key,
context),
surfaceTintColor: Colors.white,
padding: EdgeInsets.zero,
icon: const Icon(
Icons.more_vert_rounded,
color: Colors.grey,
size: 24,
),
shape: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide.none,
),
itemBuilder: (context) {
return [
const PopupMenuItem(
height: 25,
value: 1,
child: Row(
children: [
Icon(
Icons.edit_note,
color: Colors.orange,
size: 14,
),
SizedBox(
width: defaultPadding / 2,
),
Text('Edit')
],
)),
const PopupMenuItem(
height: 25,
value: 2,
child: Row(
children: [
Icon(
Icons.delete_outline,
color: Colors.orange,
size: 14,
),
SizedBox(
width: defaultPadding / 2,
),
Text('Delete')
],
)),
const PopupMenuItem(
height: 25,
value: 3,
child: Row(
children: [
Icon(
Icons.done_all_outlined,
color: Colors.orange,
size: 14,
),
SizedBox(
width: defaultPadding / 2,
),
Text('Complete')
],
)),
];
},
)),
),
],
),
),
);
}
}

View File

@ -3,7 +3,7 @@ import 'package:get/get.dart';
import 'package:sk_base_mobile/app_theme.dart'; import 'package:sk_base_mobile/app_theme.dart';
import 'package:sk_base_mobile/constants/constants.dart'; import 'package:sk_base_mobile/constants/constants.dart';
import 'package:sk_base_mobile/screens/inventory_inout/components/responsive.dart'; import 'package:sk_base_mobile/screens/inventory_inout/components/responsive.dart';
import 'package:sk_base_mobile/screens/inventory_inout/components/task_detail_container.dart'; import 'package:sk_base_mobile/screens/inventory_inout/components/inventory_inout_card.dart';
import 'package:sk_base_mobile/screens/inventory_inout/inventory_inout_controller.dart'; import 'package:sk_base_mobile/screens/inventory_inout/inventory_inout_controller.dart';
import 'package:sk_base_mobile/util/util.dart'; import 'package:sk_base_mobile/util/util.dart';
@ -56,12 +56,11 @@ class Grid extends StatelessWidget {
) )
: GridView.builder( : GridView.builder(
padding: const EdgeInsets.only(top: 40), padding: const EdgeInsets.only(top: 40),
reverse: true,
itemCount: controller.list[ind].length, itemCount: controller.list[ind].length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: crossAsis, childAspectRatio: ratio), crossAxisCount: crossAsis, childAspectRatio: ratio),
itemBuilder: (context, index) { itemBuilder: (context, index) {
return TaskDetailContainer( return InventoryInoutCard(
index: index, index: index,
ind: ind, ind: ind,
); );

View File

@ -11,29 +11,10 @@ class TaskPageView extends StatelessWidget {
return PageView( return PageView(
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
controller: controller.pageController, controller: controller.pageController,
children: const [ children: List.generate(
TaskList( controller.daysNum,
index: 0, (index) => TaskList(
), index: index,
TaskList( )));
index: 1,
),
TaskList(
index: 2,
),
TaskList(
index: 3,
),
TaskList(
index: 4,
),
TaskList(
index: 5,
),
TaskList(
index: 6,
),
],
);
} }
} }

View File

@ -24,8 +24,8 @@ class TodayButton extends StatelessWidget {
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: AppTheme.primaryColorLight, color: AppTheme.primaryColorLight,
offset: Offset(0, ScreenAdaper.height(10)), offset: Offset(0, ScreenAdaper.height(5)),
blurRadius: ScreenAdaper.sp(25)) blurRadius: ScreenAdaper.sp(20))
], ],
gradient: const LinearGradient( gradient: const LinearGradient(
begin: Alignment.topLeft, begin: Alignment.topLeft,

View File

@ -23,7 +23,7 @@ class UperBody extends StatelessWidget {
controller: controller.scrollController, controller: controller.scrollController,
shrinkWrap: true, shrinkWrap: true,
reverse: true, reverse: true,
itemCount: 20, itemCount: controller.daysNum,
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
padding: EdgeInsets.only( padding: EdgeInsets.only(
bottom: ScreenAdaper.height(20), top: defaultPadding), bottom: ScreenAdaper.height(20), top: defaultPadding),

View File

@ -7,6 +7,7 @@ import 'package:sk_base_mobile/util/date.util.dart';
import 'package:sk_base_mobile/util/modal.util.dart'; import 'package:sk_base_mobile/util/modal.util.dart';
import 'package:sk_base_mobile/util/screen_adaper_util.dart'; import 'package:sk_base_mobile/util/screen_adaper_util.dart';
import 'package:sk_base_mobile/apis/api.dart' as Api; import 'package:sk_base_mobile/apis/api.dart' as Api;
import '../../models/index.dart';
import 'components/responsive.dart'; import 'components/responsive.dart';
class InventoryInoutController extends GetxController { class InventoryInoutController extends GetxController {
@ -15,18 +16,25 @@ class InventoryInoutController extends GetxController {
final PageController pageController = PageController(); final PageController pageController = PageController();
final DateTime dateTime = DateTime.now(); final DateTime dateTime = DateTime.now();
final DbHelper db = DbHelper(); final DbHelper db = DbHelper();
List<RxList> list = [ List<RxList<InventoryInOutModel>> list = [
[].obs, <InventoryInOutModel>[].obs,
[].obs, <InventoryInOutModel>[].obs,
[].obs, <InventoryInOutModel>[].obs,
[].obs, <InventoryInOutModel>[].obs,
[].obs, <InventoryInOutModel>[].obs,
[].obs, <InventoryInOutModel>[].obs,
[].obs, <InventoryInOutModel>[].obs,
].obs; ].obs;
RxInt barIndex = 0.obs; RxInt barIndex = 0.obs;
RxList model = [].obs; RxList model = [].obs;
final ScrollController scrollController = ScrollController(); final ScrollController scrollController = ScrollController();
final daysNum = 20;
@override
void onInit() {
super.onInit();
getTasks();
// getInoutHistory();
}
/// ///
Future<void> showInOrOutPickerDialog() async { Future<void> showInOrOutPickerDialog() async {
@ -220,16 +228,22 @@ class InventoryInoutController extends GetxController {
); );
} }
Future<void> getInoutHistory() async { Future<List<InventoryInOutModel>> getInoutHistory() async {
final res = await Api.getInventoryInout({}); final res = await Api.getInventoryInout({});
printInfo(info: res.toString());
if (res.data != null) {
return res.data!.items
.map((e) => InventoryInOutModel.fromJson(e))
.toList();
}
return [];
// final List<Map<String, Object?>> queryResult = // final List<Map<String, Object?>> queryResult =
// await dbClient!.query('Tasks'); // await dbClient!.query('Tasks');
// return queryResult.map((e) => TaskModel.fromMap(e)).toList(); // return queryResult.map((e) => TaskModel.fromMap(e)).toList();
} }
getTasks() async { getTasks() async {
db.getData().then((value) { getInoutHistory().then((value) {
model.value = value; model.value = value;
getSepretLists(); getSepretLists();
}); });
@ -242,22 +256,24 @@ class InventoryInoutController extends GetxController {
} }
getDateAccordingTabs(int value) { getDateAccordingTabs(int value) {
return '${DateUtil.addPrefix(dateTime.add(Duration(days: value)).day.toString())}/${DateUtil.addPrefix(dateTime.add(Duration(days: value)).month.toString())}/${DateUtil.addPrefix(dateTime.add(Duration(days: value)).year.toString())}'; return '${DateUtil.addPrefix(dateTime.add(Duration(days: value)).year.toString())}-${DateUtil.addPrefix(dateTime.add(Duration(days: value)).month.toString())}-${DateUtil.addPrefix(dateTime.add(Duration(days: value)).day.toString())}';
} }
getSepretLists() { getSepretLists() {
List<RxList<dynamic>> tempList = []; List<RxList<InventoryInOutModel>> tempList = [];
for (int i = 0; i < 7; i++) { for (int i = 0; i < 7; i++) {
RxList tempList1 = [].obs; RxList<InventoryInOutModel> tempList1 = <InventoryInOutModel>[].obs;
tempList1.clear(); tempList1.clear();
for (int j = 0; j < model.length; j++) { for (int j = 0; j < model.length; j++) {
if (model[j].date == getDateAccordingTabs(i)) { final sourceDateStr = DateUtil.format(model[j].time);
final currentDateStr = getDateAccordingTabs(i);
if (sourceDateStr == currentDateStr) {
tempList1.add(model[j]); tempList1.add(model[j]);
} }
} }
tempList.add(tempList1); tempList.add(tempList1);
} }
list = tempList; list.assignAll(tempList);
} }
onMoveNextPage() { onMoveNextPage() {
@ -276,15 +292,15 @@ class InventoryInoutController extends GetxController {
int value, int index, int ind, String key, BuildContext context) { int value, int index, int ind, String key, BuildContext context) {
switch (value) { switch (value) {
case 3: case 3:
{ // {
ModalUtil.showWarningDialog('Complete Task', // ModalUtil.showWarningDialog('Complete Task',
'This task will be marked as completed', 'Confirm', () { // 'This task will be marked as completed', 'Confirm', () {
list[ind][index].status = 'complete'; // list[ind][index].status = 'complete';
list[ind].add(''); // list[ind].add('');
list[ind].remove(''); // list[ind].remove('');
db.update(key, 'status', 'complete'); // db.update(key, 'status', 'complete');
}); // });
} // }
case 2: case 2:
{ {
ModalUtil.showWarningDialog( ModalUtil.showWarningDialog(

View File

@ -233,31 +233,31 @@ class NewInventoryInoutController extends GetxController {
} }
loading.value = true; loading.value = true;
db // db
.insert(TaskModel( // .insert(TaskModel(
key: DateTime.now().microsecondsSinceEpoch.toString(), // key: DateTime.now().microsecondsSinceEpoch.toString(),
startTime: startTime.value, // startTime: startTime.value,
endTime: endTime.value, // endTime: endTime.value,
date: selectedDate.value, // date: selectedDate.value,
periority: lowPeriority.value ? 'Low' : 'High', // periority: lowPeriority.value ? 'Low' : 'High',
description: description.value.text.toString(), // description: description.value.text.toString(),
category: category.value.text.toString(), // category: category.value.text.toString(),
title: label.value.text.toString(), // title: label.value.text.toString(),
image: selectedImage.value.toString(), // image: selectedImage.value.toString(),
show: 'yes', // show: 'yes',
status: 'unComplete')) // status: 'unComplete'))
.then((value) { // .then((value) {
Duration dif = pickedDate!.difference(DateTime( // Duration dif = pickedDate!.difference(DateTime(
DateTime.now().year, DateTime.now().month, DateTime.now().day)); // DateTime.now().year, DateTime.now().month, DateTime.now().day));
inventoryInoutController.list[dif.inDays].add(value); // inventoryInoutController.list[dif.inDays].add(value);
Timer(const Duration(seconds: 1), () { // Timer(const Duration(seconds: 1), () {
loading.value = false; // loading.value = false;
Get.back(); // Get.back();
SnackBarUtil().success( // SnackBarUtil().success(
'Successful', // 'Successful',
message: 'Task is created', // message: 'Task is created',
); // );
}); // });
}); // });
} }
} }

View File

@ -136,7 +136,7 @@ class DioService extends Get.GetxService {
if (response.data != null) { if (response.data != null) {
try { try {
if (response.data['code'] == 200) { if (response.data['code'] == 200) {
if (GloablConfig.DEBUG) print(response.data['data']); if (GloablConfig.DEBUG) LoggerUtil().info(response.data['data']);
response.data = response.data['data']; response.data = response.data['data'];
// //