All files / src/redux/AssignProList service.js

0% Statements 0/44
0% Branches 0/4
0% Functions 0/15
0% Lines 0/44
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208                                                                                                                                                                                                                                                                                                                                                                                                                               
import APIService from '../../lib/APIService';
import { BASE_URL_STATS } from '../../helper/urlConstants';
 
const GET_YEAR = `query($input: GetCalendarsInput){
  getCalendars(input:$input){
    id
    year
    flag
    duration
    startdate
    enddate
  }
}`;
 
const GET_PRACTICES = `query($input:GetPracticesInput){
    getPractices(input:$input){
    id
    name
    externalid
    address
    city
    state
    postalcode
    country
    email
    contactnumber
    tin
    practicetype
    }
}`;
 
const GET_PROVIDER = `query($input:getProvidersByPracticeIdInput!){
    getProvidersByPracticeId(input:$input){
    id
    firstname
    lastname
    email
    npi
    designationid
    designationname
    providerSpeciality{
      Speciality
      {
        id
        name
      }
    }
  }
}`;
 
// const GET_COHORT = `query($input:getCohortsInput!){
//     getCohorts(input:$input){
//         cohort_id
//         cohort_name
//         unit
//         ismanual
//         cohort_count
//     }
//   }`;
 
// const FETCH_QUESTIONAIRE = `query($input: getQuestionnairesInput!)
// {
//   getQuestionnaires(input:$input){
//     questionnaire_definition_id
//     questionnaire_name
//     cohort_id
//     outreach_configuration_id
//   }
// }`;
 
const FETACH_ASSIGNPROLIST = `query($input: getCohortsDetailsInput!)
{
    getCohortsDetails(input:$input){
        data
        status
        totalcount
        page_number
        page_size
  }
}`;
 
export const fetchAssignProFromServer = async params => {
    const headers = {
        'request-user-id': 7
    };
    const requestOptions = {
        query: FETACH_ASSIGNPROLIST,
        variables: params
    };
    const res = await APIService.post(BASE_URL_STATS, requestOptions, headers);
 
    return res.data.data.getCohortsDetails;
};
 
export const setAssignProListToStore = async assignProList => {
    return assignProList;
};
 
export const fetchCohortListFromServer = async cohortList => {
    // const requestOptions = {
    //     query: GET_COHORT,
    //     variables: params
    // };
    // const res = await APIService.post('http://192.168.104.25:7013/outrach-buz', requestOptions);
    // // console.log('outreach data =====', res.data.data.getCohorts);
 
    return cohortList;
};
 
export const fetchQuestionaireFromCohort = async questionaireList => {
    // const requestOptions = {
    //     query: FETCH_QUESTIONAIRE,
    //     variables: params
    // };
    // const res = await APIService.post('http://192.168.104.25:7013/outrach-buz', requestOptions);
    // // console.log('questionaire data =====', res.data.data.getQuestionnaires);
 
    return questionaireList;
};
 
export const fetchYearListDropdown = async yearList => {
    // const headers = {
    //     'request-user-id': 7
    // };
    // const requestOptions = {
    //     query: GET_YEAR,
    //     variables: params
    // };
    // const res = await APIService.post(BASE_URL_WEB, requestOptions, headers);
 
    // const calendarData = await res.data.data.getCalendars;
 
    let year = [];
    let _year = [];
    const currentYear = new Date().getFullYear();
    yearList.map((obj, index) => {
        if (_year.indexOf(obj.year) === -1 && obj.year === currentYear) {    // To be removed current year condition.
            _year.push(obj.year);            
            year.push({
                id: obj.id,
                text: obj.year,
                value: obj.id
            });
        }
    });
 
    return year;
};
 
export const fetchPracticeList = async practiceList => {
    // const headers = {
    //     'request-user-id': 7
    // };
    // const requestOptions = {
    //     query: GET_PRACTICES,
    //     variables: params
    // };
    // const res = await APIService.post(BASE_URL_PRACTICE, requestOptions, headers);
    // // console.log('practice data =====', res.data.data.getPractices);
 
    // return res.data.data.getPractices;
 
    return practiceList;
};
 
export const setSelectedYearToStore = async selectedYear => {
    return selectedYear;
};
export const setSelectedPracticeToStore = async selectedPractice => {
    return selectedPractice;
};
 
export const fetchProviderList = async providerList => {
    // const headers = {
    //     'request-user-id': 7
    // };
    // const requestOptions = {
    //     query: GET_PROVIDER,
    //     variables: params
    // };
    // const res = await APIService.post(BASE_URL_PROVIDER, requestOptions, headers);
    // // console.log('provider data =====', res.data.data.getProvidersByPracticeId);
 
    // return res.data.data.getProvidersByPracticeId;
 
    return providerList;
};
 
export const setSelectedProviderToStore = async selectedProvider => {
    return selectedProvider;
};
 
export const setSelectedAssignProToStore = async selectedAssignPro => {
    return selectedAssignPro;
};
 
export const setCohortIdToStore = async selectedCohortId => {
    return selectedCohortId;
};
 
export const setQuestionaireIddToStore = async selectedQuestionaireId => {
    return selectedQuestionaireId;
};
 
export const setAssignPro = async assignPro => {
    return assignPro;
};