You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
2.3 KiB
77 lines
2.3 KiB
import 'package:flutter/material.dart'; |
|
import 'package:siopas/services/asset_status_service.dart'; // Ganti dengan path yang sesuai |
|
import 'package:siopas/models/m_asset_status_model.dart'; // Ganti dengan path yang sesuai |
|
import 'package:siopas/models/warehouse_mode.dart'; |
|
|
|
import '../models/asset_status_model.dart'; // Ganti dengan path yang sesuai |
|
|
|
class AssetStatusProvider extends ChangeNotifier { |
|
List<AssetStatusModel> _assetStatus = []; |
|
List<AssetStatusModel> get assetStatus => _assetStatus; |
|
|
|
set assetStatus(List<AssetStatusModel> assetStatus) { |
|
_assetStatus = assetStatus; |
|
notifyListeners(); |
|
} |
|
|
|
Future<void> getAssetStatus() async { |
|
try { |
|
List<AssetStatusModel> assetStatus = |
|
await AssetStatusService().getAssetStatus(); |
|
_assetStatus = assetStatus; |
|
print("SUCCESS GET DATA PRODUCT PROVIDER"); |
|
} catch (e) { |
|
print(e); |
|
print('error connection! / product provider'); |
|
} |
|
} |
|
|
|
Future<bool> storePeminjaman({ |
|
// int? asset_id, |
|
DateTime? exit_at, |
|
String? exit_pic, |
|
// int? exit_warehouse, |
|
String? token, |
|
}) async { |
|
try { |
|
AssetStatusModel assetStatus = await AssetStatusService().storePeminjaman( |
|
// asset_id: asset_id!, |
|
exit_at: exit_at!, |
|
exit_pic: exit_pic!, |
|
// exit_warehouse: exit_warehouse!, |
|
token: token!, |
|
); |
|
|
|
_assetStatus.add(assetStatus); |
|
print("SUCCESS STORE DATA Status Peminjaman PROVIDER"); |
|
return true; // Tambahkan return true di sini |
|
} catch (e) { |
|
print("GAGAL STORE DATA Status Peminjaman PROVIDER"); |
|
print(e); |
|
return false; |
|
} |
|
} |
|
} |
|
|
|
// Future<void> storePeminjaman({ |
|
// required int asset_id, |
|
// required String exit_at, |
|
// required String exit_pic, |
|
// required int exit_warehouse, |
|
// required String token, |
|
// }) async { |
|
// try { |
|
// AssetStatusModel assetStatus = await AssetStatusService().storePeminjaman( |
|
// asset_id: asset_id, |
|
// exit_at: exit_at, |
|
// exit_pic: exit_pic, |
|
// exit_warehouse: exit_warehouse, |
|
// token: token, |
|
// ); |
|
// _assetStatus.add(assetStatus); |
|
// print("SUCCESS STORE DATA Status Peminjaman PROVIDER"); |
|
// } catch (e) { |
|
// print(e); |
|
// print('error connection! / Status Peminjaman Provider'); |
|
// } |
|
// }
|
|
|