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;
};
|