import 'package:flutter/foundation.dart';
import 'package:provider/provider.dart';

import '../../Models/crmModels/AccessiblePagesResponse.dart';
import '../../services/api_calling.dart';
import '../HomeScreenNotifier.dart';

class Crmdashboardprovider extends ChangeNotifier{
  List<PagesAccessible> _accessPages = [];
  List<PagesAccessible> get accessPages => _accessPages;

  Future<void> accessPagesAPIFunction(context) async {
    try{
      var HomeProv = Provider.of<HomescreenNotifier>(context,listen: false);
      final data = await ApiCalling.crmAccessiblePagesAPI(HomeProv.empId, HomeProv.session);
      if(data!=null){
        if(data.error=="0"){
          _accessPages = data.pagesAccessible!;
          _accessPages.add(PagesAccessible(mode: "",id: 0,pageName: "Nearby Leads"));
          notifyListeners();
        }
      }

    }catch (e,s){

    }
  }

}