|
|
|
|
@ -40,10 +40,17 @@ class SiteInformationPage extends StatefulWidget {
|
|
|
|
|
class _SiteInformationPageState extends State<SiteInformationPage> {
|
|
|
|
|
AssetInventoryModel assetInventoryModel = AssetInventoryModel();
|
|
|
|
|
bool showMarkAsComplete = false;
|
|
|
|
|
final ScrollController _scrollController = ScrollController();
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
_scrollController.addListener(() {
|
|
|
|
|
final provider = Provider.of<AssetInventoryProvider>(context, listen: false);
|
|
|
|
|
if (_scrollController.position.pixels >= _scrollController.position.maxScrollExtent && !provider.isNextPageLoading && provider.nextPage) {
|
|
|
|
|
getAssetFilteredList(loadMore: true);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
|
|
|
|
@ -59,6 +66,7 @@ class _SiteInformationPageState extends State<SiteInformationPage> {
|
|
|
|
|
body: Column(
|
|
|
|
|
children: [
|
|
|
|
|
ListView(
|
|
|
|
|
controller: _scrollController,
|
|
|
|
|
padding: const EdgeInsets.only(left: 16, right: 16, top: 16),
|
|
|
|
|
children: [
|
|
|
|
|
siteInfoCard(context, widget.sessionModel),
|
|
|
|
|
@ -89,17 +97,9 @@ class _SiteInformationPageState extends State<SiteInformationPage> {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// FooterActionButton.footerContainer(
|
|
|
|
|
// context: context,
|
|
|
|
|
// child: AppFilledButton(
|
|
|
|
|
// buttonColor: AppColor.green70,
|
|
|
|
|
// label: 'Mark as completed'.addTranslation,
|
|
|
|
|
// onPressed: () => _markAsCompleted(),
|
|
|
|
|
// // buttonColor: AppColor.primary10,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
],
|
|
|
|
|
));
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _addAsset() async {
|
|
|
|
|
@ -130,7 +130,6 @@ class _SiteInformationPageState extends State<SiteInformationPage> {
|
|
|
|
|
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
|
|
|
|
|
await provider.markAsComplete(payload: payload).then((success) {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
log('success $success');
|
|
|
|
|
if (success) {
|
|
|
|
|
///TODO need to confirm need to call this or not ..
|
|
|
|
|
// AllRequestsProvider allRequestsProvider = Provider.of<AllRequestsProvider>(context, listen: false);
|
|
|
|
|
@ -148,38 +147,32 @@ class _SiteInformationPageState extends State<SiteInformationPage> {
|
|
|
|
|
return Consumer<AssetInventoryProvider>(
|
|
|
|
|
builder: (context, provider, _) {
|
|
|
|
|
if (provider.isLoading) {
|
|
|
|
|
return SizedBox(height: 300.toScreenHeight, child: const CircularProgressIndicator(color: AppColor.primary10).center);
|
|
|
|
|
return SizedBox(
|
|
|
|
|
height: 300.toScreenHeight,
|
|
|
|
|
child: const CircularProgressIndicator(color: AppColor.primary10).center,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final assets = provider.siteFilterAssetList;
|
|
|
|
|
return NotificationListener<ScrollNotification>(
|
|
|
|
|
onNotification: (scrollInfo) {
|
|
|
|
|
if (!provider.isNextPageLoading && provider.nextPage && scrollInfo.metrics.pixels == scrollInfo.metrics.maxScrollExtent) {
|
|
|
|
|
getAssetFilteredList(loadMore: true);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
},
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
return ListView.separated(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
// Keep non-scrollable, parent handles scroll
|
|
|
|
|
itemCount: assets.length,
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return AssetDetailCardView(
|
|
|
|
|
assetInventoryModel: assets[index],
|
|
|
|
|
onDeletePress: () async {
|
|
|
|
|
log('Delete icon press');
|
|
|
|
|
await provider.deleteAssetISession(id: assets[index].id ?? 0).then((success) async {
|
|
|
|
|
if (success) {
|
|
|
|
|
await getAssetFilteredList();
|
|
|
|
|
await provider.getAssetsInSession(
|
|
|
|
|
sessionId: widget.sessionModel.id ?? 0,
|
|
|
|
|
);
|
|
|
|
|
await provider.getAssetsInSession(sessionId: widget.sessionModel.id ?? 0);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (context, index) => 12.height,
|
|
|
|
|
itemCount: assets.length,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
@ -253,7 +246,9 @@ class _SiteInformationPageState extends State<SiteInformationPage> {
|
|
|
|
|
assetInventoryModel.room = null;
|
|
|
|
|
showMarkAsComplete = true;
|
|
|
|
|
setState(() {});
|
|
|
|
|
if (assetInventoryModel.department != null && assetInventoryModel.department!.rooms!.isEmpty) {
|
|
|
|
|
getAssetFilteredList();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
12.height,
|
|
|
|
|
|