mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-13 10:58:56 +03:30
2.2.0
This commit is contained in:
Regular → Executable
+39
-2
@@ -1,5 +1,6 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:cssd/models/item_model.dart';
|
||||
import 'package:cssd/models/package_model.dart';
|
||||
|
||||
import '../config/urls.dart';
|
||||
@@ -8,7 +9,10 @@ import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
class PackageProvider extends ChangeNotifier {
|
||||
List<ItemResultObject>? filteredItems;
|
||||
// List<Map<String, dynamic>> itemVals = [];
|
||||
List<String> itemVals = [];
|
||||
|
||||
List<TextEditingController> itemValues = [];
|
||||
String initialItemValue = '';
|
||||
int curItemVal = 1;
|
||||
@@ -18,7 +22,6 @@ class PackageProvider extends ChangeNotifier {
|
||||
itemValues = [];
|
||||
initialItemValue = '';
|
||||
curItemVal = 1;
|
||||
// notifyListeners();
|
||||
}
|
||||
|
||||
addItemVal() {
|
||||
@@ -29,11 +32,28 @@ class PackageProvider extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
removeItemVal() {
|
||||
curItemVal -= 1;
|
||||
TextEditingController lbl = new TextEditingController();
|
||||
lbl.text = initialItemValue;
|
||||
itemValues.removeLast();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
changeItemVal(String value, int index) {
|
||||
itemValues[index].text = value;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
changeItemValByScan(String value, int index) {
|
||||
for (var item in filteredItems!) {
|
||||
if (item.udi == value) {
|
||||
itemValues[index].text = item.id;
|
||||
}
|
||||
}
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
String searchBoxValue = '';
|
||||
bool filterOn = false;
|
||||
List<PackageResultObject>? items;
|
||||
@@ -84,11 +104,28 @@ class PackageProvider extends ChangeNotifier {
|
||||
'Authorization': User.token,
|
||||
},
|
||||
);
|
||||
// List<Map<String, dynamic>> result = [];
|
||||
List<String> result = [];
|
||||
filteredItems = [];
|
||||
var filterData = json.decode(response.body);
|
||||
for (var item in filterData['data']) {
|
||||
// result.add("${item['name']} - ${item['udi'] != null ? item['udi'] : ''}");
|
||||
result.add(item['id'].toString());
|
||||
// result.add({
|
||||
// 'name-udi':
|
||||
// "${item['name']} - ${item['udi'] != null ? item['udi'] : ''}",
|
||||
// 'id': item['id'].toString()
|
||||
// });
|
||||
filteredItems!.add(
|
||||
ItemResultObject(
|
||||
name: item['name'],
|
||||
id: item['id'].toString(),
|
||||
size: item['size'].toString(),
|
||||
userName: item['user'] != null ? item['user']['name'] : '',
|
||||
status: item['status'],
|
||||
udi: item['udi'] != null ? item['udi'] : '',
|
||||
),
|
||||
);
|
||||
}
|
||||
itemVals = result;
|
||||
initialItemValue = itemVals[0];
|
||||
@@ -105,7 +142,7 @@ class PackageProvider extends ChangeNotifier {
|
||||
items,
|
||||
note,
|
||||
) async {
|
||||
List<Map<String, Object>> itms = [];
|
||||
List<Map<String, dynamic>> itms = [];
|
||||
for (var item in items) {
|
||||
itms.add({'id': item});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user