| @@ -252,7 +252,7 @@ class _AssetDetailsState extends State<AssetDetails> with TickerProviderStateMix | |||
| var bUnit = await DBHelper.database.getBUnit(); | |||
| util.showLoading(context); | |||
| http.Response result = await http.get( | |||
| '${prefs.getString(keyClass.hostAddress)??"https://asset.thamringroup.web.id"}/api/images?q=${_asset.tag_number}&s=${dbName}&b=${bUnit}', | |||
| Uri.parse('${prefs.getString(keyClass.hostAddress)??"https://asset.thamringroup.web.id"}/api/images?q=${_asset.tag_number}&s=${dbName}&b=${bUnit}'), | |||
| ).timeout(Duration(seconds: 3)); | |||
| Navigator.pop(context); | |||
| if(result!=null){ | |||
| @@ -21,8 +21,10 @@ class _StockingState extends State<Stocking> with TickerProviderStateMixin { | |||
| bool isLoading = false; | |||
| List<String> lokasi = []; | |||
| List<String> ruangan = []; | |||
| List<String> kategori = []; | |||
| String _currentloc='All'; | |||
| String _currentruang='All'; | |||
| String _currentkategori='All'; | |||
| loadAsset({loading=false})async{ | |||
| if(loading) { | |||
| @@ -34,6 +36,7 @@ class _StockingState extends State<Stocking> with TickerProviderStateMixin { | |||
| if(result!=null){ | |||
| if(_currentloc!='All') result.removeWhere((element) => (element.lantai!=_currentloc)); | |||
| if(_currentruang!='All') result.removeWhere((element) => (element.ruangan!=_currentruang)); | |||
| if(_currentkategori!='All') result.removeWhere((element) => (element.kategori!=_currentkategori)); | |||
| setState(() { | |||
| refAsset = result; | |||
| }); | |||
| @@ -54,6 +57,10 @@ class _StockingState extends State<Stocking> with TickerProviderStateMixin { | |||
| setState(() { | |||
| insertAsset = result.reversed.toList(); | |||
| }); | |||
| if(_currentkategori!='All') result.removeWhere((element) => (element.kategori!=_currentkategori)); | |||
| setState(() { | |||
| insertAsset = result.reversed.toList(); | |||
| }); | |||
| } | |||
| if(lokasi.length==0){ | |||
| var results = await DBHelper.database.getAllLocation(); | |||
| @@ -64,6 +71,14 @@ class _StockingState extends State<Stocking> with TickerProviderStateMixin { | |||
| lokasi.add('All'); | |||
| } | |||
| } | |||
| if(kategori.length==0){ | |||
| var results = await DBHelper.database.getAllKategori(); | |||
| if(results!=null){ | |||
| kategori.clear(); | |||
| kategori = new List<String>.from(results.map((item)=>item.kategori)); | |||
| kategori.add('All'); | |||
| } | |||
| } | |||
| ruangan.clear(); | |||
| var results = (_currentloc=='All')?await DBHelper.database.getAllRuangan():await DBHelper.database.getLantaiRuangan(_currentloc); | |||
| setState(() { | |||
| @@ -153,18 +168,20 @@ class _StockingState extends State<Stocking> with TickerProviderStateMixin { | |||
| child: Container( | |||
| // padding: EdgeInsets.all(8), | |||
| child: Row( | |||
| mainAxisAlignment: MainAxisAlignment.spaceBetween, | |||
| children: [ | |||
| Container( | |||
| child: Text("Lantai : ",style: TextStyle(fontSize: 16),), | |||
| Flexible( | |||
| flex:1, | |||
| child: Text("Lantai:",style: TextStyle(fontSize: 14),), | |||
| ), | |||
| Container( | |||
| width: 100, | |||
| Flexible( | |||
| flex: 3, | |||
| child: DropdownButtonFormField( | |||
| decoration: InputDecoration.collapsed(hintText: null), | |||
| value: _currentloc, | |||
| items: new List<DropdownMenuItem<String>>.from(lokasi.reversed.map((value){ | |||
| return DropdownMenuItem( | |||
| child: Text(value), | |||
| child: Text(value==''||value==null?"-":(value.length>15)? value.substring(0,15):value,style: TextStyle(fontSize: 12),), | |||
| value: value, | |||
| ); | |||
| })), | |||
| @@ -180,18 +197,20 @@ class _StockingState extends State<Stocking> with TickerProviderStateMixin { | |||
| }, | |||
| ), | |||
| ), | |||
| Container( | |||
| child: Text("Ruang : ",style: TextStyle(fontSize: 16)), | |||
| Flexible( | |||
| flex:1, | |||
| child: Text("Ruang:",style: TextStyle(fontSize: 14)), | |||
| ), | |||
| Expanded( | |||
| Flexible( | |||
| flex: 3, | |||
| child: DropdownButtonFormField( | |||
| decoration: InputDecoration.collapsed(hintText: null), | |||
| value: _currentruang, | |||
| items: new List<DropdownMenuItem<String>>.from(ruangan.reversed.map((value){ | |||
| String _string = value; | |||
| if(_string.length>18) _string = _string.substring(0,18); | |||
| if(_string.length>15) _string = _string.substring(0,15); | |||
| return DropdownMenuItem( | |||
| child: Text(_string), | |||
| child: Text(_string==''?"-":_string??'-',style: TextStyle(fontSize: 12),), | |||
| value: value, | |||
| ); | |||
| })), | |||
| @@ -209,6 +228,45 @@ class _StockingState extends State<Stocking> with TickerProviderStateMixin { | |||
| ), | |||
| ), | |||
| Expanded( | |||
| flex: 1, | |||
| child: Container( | |||
| alignment: Alignment.bottomCenter, | |||
| padding: const EdgeInsets.all(8.0), | |||
| child: Container( | |||
| // padding: EdgeInsets.all(8), | |||
| child: Row( | |||
| children: [ | |||
| Container( | |||
| child: Text("Kategori : ",style: TextStyle(fontSize: 14),), | |||
| ), | |||
| Expanded( | |||
| // width: 100, | |||
| child: DropdownButtonFormField( | |||
| decoration: InputDecoration.collapsed(hintText: null), | |||
| value: _currentkategori, | |||
| items: new List<DropdownMenuItem<String>>.from(kategori.reversed.map((value){ | |||
| return DropdownMenuItem( | |||
| child: Text(value==''||value==null?"-":(value.length>15)? value.substring(0,15):value,style: TextStyle(fontSize: 12),), | |||
| value: value, | |||
| ); | |||
| })), | |||
| onChanged: (value){ | |||
| if(_currentkategori!= value){ | |||
| setState(() { | |||
| _currentkategori=value; | |||
| }); | |||
| loadAsset(loading: true); | |||
| } | |||
| }, | |||
| ), | |||
| ), | |||
| ], | |||
| ), | |||
| ), | |||
| ), | |||
| ), | |||
| Expanded( | |||
| flex:16, | |||
| child: Column( | |||
| children: <Widget>[ | |||
| @@ -4,6 +4,7 @@ class Asset{ | |||
| var blob; | |||
| String asset_no; | |||
| String asset_desc; | |||
| String kategori; | |||
| String pic; | |||
| String gedung; | |||
| String lantai; | |||
| @@ -18,6 +19,7 @@ class Asset{ | |||
| this.blob, | |||
| this.asset_no, | |||
| this.asset_desc, | |||
| this.kategori, | |||
| this.pic, | |||
| this.gedung, | |||
| this.lantai, | |||
| @@ -33,6 +35,7 @@ class Asset{ | |||
| blob: json[columnName.blob]??null, | |||
| asset_no: json[columnName.asset_number]??'', | |||
| asset_desc: json[columnName.asset_desc]??'', | |||
| kategori: json[columnName.kategori]??'', | |||
| pic: json[columnName.pic]??'', | |||
| gedung : json[columnName.gedung]??'', | |||
| lantai: json[columnName.lantai]??'', | |||
| @@ -47,6 +50,7 @@ class Asset{ | |||
| columnName.blob: blob, | |||
| columnName.asset_number : asset_no, | |||
| columnName.asset_desc : asset_desc, | |||
| columnName.kategori:kategori, | |||
| columnName.pic: pic, | |||
| columnName.gedung: gedung, | |||
| columnName.lantai :lantai, | |||
| @@ -123,6 +123,20 @@ class DBHelper{ | |||
| } | |||
| } | |||
| getAllKategori() async{ | |||
| try{ | |||
| final database = await db; | |||
| var res = await database.rawQuery("SELECT Distinct UPPER(${columnName.kategori}) ${columnName.kategori} from ${tableName.ref} ORDER BY UPPER(${columnName.kategori})"); | |||
| List<Asset> list = | |||
| res.isNotEmpty ? res.map((c) => Asset.fromJson(c)).toList().reversed.toList() : []; | |||
| return list; | |||
| } | |||
| catch(e){ | |||
| print(e); | |||
| return null; | |||
| } | |||
| } | |||
| getAllLocation() async{ | |||
| try{ | |||
| final database = await db; | |||
| @@ -168,7 +182,7 @@ class DBHelper{ | |||
| getAllAsset() async { | |||
| try{ | |||
| final database = await db; | |||
| var res = await database.rawQuery("SELECT a.${columnName.tag_number}, a.${columnName.asset_desc}, a.${columnName.ruang}, a.${columnName.lantai}, a.${columnName.gedung}, a.${columnName.flag}, b.${columnName.blob} from ${tableName.ref} a LEFT JOIN ${tableName.insert} b on a.${columnName.tag_number} = b.${columnName.tag_number} ORDER BY a.${columnName.flag},a.${columnName.ruang}"); | |||
| var res = await database.rawQuery("SELECT a.${columnName.tag_number}, a.${columnName.asset_desc},a.${columnName.kategori}, a.${columnName.ruang}, a.${columnName.lantai}, a.${columnName.gedung}, a.${columnName.flag}, b.${columnName.blob} from ${tableName.ref} a LEFT JOIN ${tableName.insert} b on a.${columnName.tag_number} = b.${columnName.tag_number} ORDER BY a.${columnName.flag},a.${columnName.ruang}"); | |||
| List<Asset> list = | |||
| res.isNotEmpty ? res.map((c) => Asset.fromJson(c)).toList() : []; | |||
| return list; | |||
| @@ -182,7 +196,7 @@ class DBHelper{ | |||
| filterAllAsset(search) async { | |||
| try{ | |||
| final database = await db; | |||
| var res = await database.rawQuery("SELECT * FROM (SELECT a.${columnName.tag_number}, a.${columnName.asset_desc}, a.${columnName.ruang}, a.${columnName.lantai}, a.${columnName.gedung}, a.${columnName.flag}, b.${columnName.blob} from ${tableName.ref} a LEFT JOIN ${tableName.insert} b on a.${columnName.tag_number} = b.${columnName.tag_number}) WHERE UPPER(${columnName.tag_number}) Like '%$search%' ORDER BY ${columnName.flag},${columnName.ruang}"); | |||
| var res = await database.rawQuery("SELECT * FROM (SELECT a.${columnName.tag_number}, a.${columnName.asset_desc},a.${columnName.kategori}, a.${columnName.ruang}, a.${columnName.lantai}, a.${columnName.gedung}, a.${columnName.flag}, b.${columnName.blob} from ${tableName.ref} a LEFT JOIN ${tableName.insert} b on a.${columnName.tag_number} = b.${columnName.tag_number}) WHERE UPPER(${columnName.tag_number}) Like '%$search%' ORDER BY ${columnName.flag},${columnName.ruang}"); | |||
| List<Asset> list = | |||
| res.isNotEmpty ? res.map((c) => Asset.fromJson(c)).toList() : []; | |||
| return list; | |||
| @@ -16,6 +16,7 @@ class columnName{ | |||
| static String asset_number = 'ASSET_NUMBER'; | |||
| static String tag_number = 'TAG_NUMBER'; | |||
| static String asset_desc = "ASSET_DESCRIPTION"; | |||
| static String kategori = "KATEGORI_MAJOR"; | |||
| static String pic = 'PIC'; | |||
| static String gedung = 'GEDUNG'; | |||
| static String lantai = 'LANTAI'; | |||
| @@ -46,12 +46,12 @@ class Util{ | |||
| var response; | |||
| if (timeout) | |||
| response = await http.post( | |||
| '$url', headers: headers, | |||
| Uri.parse(url), headers: headers, | |||
| body: json.encode(jsonData)).timeout( | |||
| Duration(seconds: duration)); | |||
| else | |||
| response = await http.post( | |||
| '$url', headers: headers, | |||
| Uri.parse(url), headers: headers, | |||
| body: json.encode(jsonData)); | |||
| final Map data = decoder.convert(response.body); | |||
| return data; | |||
| @@ -7,14 +7,14 @@ packages: | |||
| name: archive | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "2.0.13" | |||
| version: "3.1.2" | |||
| args: | |||
| dependency: transitive | |||
| description: | |||
| name: args | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "1.6.0" | |||
| version: "2.0.0" | |||
| async: | |||
| dependency: transitive | |||
| description: | |||
| @@ -64,20 +64,13 @@ packages: | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "1.15.0" | |||
| convert: | |||
| dependency: transitive | |||
| description: | |||
| name: convert | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "2.1.1" | |||
| crypto: | |||
| dependency: transitive | |||
| description: | |||
| name: crypto | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "2.1.5" | |||
| version: "3.0.1" | |||
| cupertino_icons: | |||
| dependency: "direct main" | |||
| description: | |||
| @@ -92,13 +85,20 @@ packages: | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "1.2.0" | |||
| ffi: | |||
| dependency: transitive | |||
| description: | |||
| name: ffi | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "1.1.2" | |||
| file: | |||
| dependency: transitive | |||
| description: | |||
| name: file | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "5.2.1" | |||
| version: "6.1.2" | |||
| fixnum: | |||
| dependency: transitive | |||
| description: | |||
| @@ -117,14 +117,14 @@ packages: | |||
| name: flutter_launcher_icons | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "0.8.1" | |||
| version: "0.9.0" | |||
| flutter_plugin_android_lifecycle: | |||
| dependency: transitive | |||
| description: | |||
| name: flutter_plugin_android_lifecycle | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "1.0.8" | |||
| version: "2.0.2" | |||
| flutter_test: | |||
| dependency: "direct dev" | |||
| description: flutter | |||
| @@ -141,49 +141,56 @@ packages: | |||
| name: fluttertoast | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "4.0.1" | |||
| version: "8.0.7" | |||
| http: | |||
| dependency: transitive | |||
| description: | |||
| name: http | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "0.12.1" | |||
| version: "0.13.3" | |||
| http_parser: | |||
| dependency: transitive | |||
| description: | |||
| name: http_parser | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "3.1.4" | |||
| version: "4.0.0" | |||
| image: | |||
| dependency: transitive | |||
| description: | |||
| name: image | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "2.1.19" | |||
| version: "3.0.2" | |||
| image_picker: | |||
| dependency: "direct main" | |||
| description: | |||
| name: image_picker | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "0.6.7+2" | |||
| version: "0.8.1+1" | |||
| image_picker_for_web: | |||
| dependency: transitive | |||
| description: | |||
| name: image_picker_for_web | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "2.0.0" | |||
| image_picker_platform_interface: | |||
| dependency: transitive | |||
| description: | |||
| name: image_picker_platform_interface | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "1.1.0" | |||
| version: "2.1.0" | |||
| intl: | |||
| dependency: "direct main" | |||
| description: | |||
| name: intl | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "0.16.1" | |||
| version: "0.17.0" | |||
| js: | |||
| dependency: transitive | |||
| description: | |||
| @@ -225,105 +232,126 @@ packages: | |||
| name: path_provider | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "1.6.11" | |||
| version: "2.0.2" | |||
| path_provider_linux: | |||
| dependency: transitive | |||
| description: | |||
| name: path_provider_linux | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "0.0.1+1" | |||
| version: "2.0.0" | |||
| path_provider_macos: | |||
| dependency: transitive | |||
| description: | |||
| name: path_provider_macos | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "0.0.4+3" | |||
| version: "2.0.0" | |||
| path_provider_platform_interface: | |||
| dependency: transitive | |||
| description: | |||
| name: path_provider_platform_interface | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "1.0.2" | |||
| version: "2.0.1" | |||
| path_provider_windows: | |||
| dependency: transitive | |||
| description: | |||
| name: path_provider_windows | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "2.0.1" | |||
| pedantic: | |||
| dependency: transitive | |||
| description: | |||
| name: pedantic | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "1.9.0" | |||
| version: "1.11.1" | |||
| petitparser: | |||
| dependency: transitive | |||
| description: | |||
| name: petitparser | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "3.1.0" | |||
| version: "4.1.0" | |||
| photo_view: | |||
| dependency: "direct main" | |||
| description: | |||
| name: photo_view | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "0.9.2" | |||
| version: "0.11.1" | |||
| platform: | |||
| dependency: transitive | |||
| description: | |||
| name: platform | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "2.2.1" | |||
| version: "3.0.0" | |||
| plugin_platform_interface: | |||
| dependency: transitive | |||
| description: | |||
| name: plugin_platform_interface | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "1.0.2" | |||
| version: "2.0.0" | |||
| process: | |||
| dependency: transitive | |||
| description: | |||
| name: process | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "3.0.13" | |||
| version: "4.2.1" | |||
| protobuf: | |||
| dependency: transitive | |||
| description: | |||
| name: protobuf | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "1.0.1" | |||
| version: "1.1.4" | |||
| shared_preferences: | |||
| dependency: "direct main" | |||
| description: | |||
| name: shared_preferences | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "0.5.7+3" | |||
| version: "2.0.6" | |||
| shared_preferences_linux: | |||
| dependency: transitive | |||
| description: | |||
| name: shared_preferences_linux | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "2.0.0" | |||
| shared_preferences_macos: | |||
| dependency: transitive | |||
| description: | |||
| name: shared_preferences_macos | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "0.0.1+10" | |||
| version: "2.0.0" | |||
| shared_preferences_platform_interface: | |||
| dependency: transitive | |||
| description: | |||
| name: shared_preferences_platform_interface | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "1.0.4" | |||
| version: "2.0.0" | |||
| shared_preferences_web: | |||
| dependency: transitive | |||
| description: | |||
| name: shared_preferences_web | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "0.1.2+7" | |||
| version: "2.0.0" | |||
| shared_preferences_windows: | |||
| dependency: transitive | |||
| description: | |||
| name: shared_preferences_windows | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "2.0.0" | |||
| sky_engine: | |||
| dependency: transitive | |||
| description: flutter | |||
| @@ -342,14 +370,14 @@ packages: | |||
| name: sqflite | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "1.3.1" | |||
| version: "2.0.0+3" | |||
| sqflite_common: | |||
| dependency: transitive | |||
| description: | |||
| name: sqflite_common | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "1.0.2+1" | |||
| version: "2.0.0+2" | |||
| stack_trace: | |||
| dependency: transitive | |||
| description: | |||
| @@ -377,7 +405,7 @@ packages: | |||
| name: synchronized | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "2.2.0+1" | |||
| version: "3.0.0" | |||
| term_glyph: | |||
| dependency: transitive | |||
| description: | |||
| @@ -406,27 +434,34 @@ packages: | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "2.1.0" | |||
| win32: | |||
| dependency: transitive | |||
| description: | |||
| name: win32 | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "2.0.5" | |||
| xdg_directories: | |||
| dependency: transitive | |||
| description: | |||
| name: xdg_directories | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "0.1.0" | |||
| version: "0.2.0" | |||
| xml: | |||
| dependency: transitive | |||
| description: | |||
| name: xml | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "4.5.1" | |||
| version: "5.1.2" | |||
| yaml: | |||
| dependency: transitive | |||
| description: | |||
| name: yaml | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "2.2.1" | |||
| version: "3.1.0" | |||
| sdks: | |||
| dart: ">=2.12.0-0.0 <3.0.0" | |||
| flutter: ">=1.12.13+hotfix.5" | |||
| dart: ">=2.12.0 <3.0.0" | |||
| flutter: ">=2.0.0" | |||