diff --git a/src/components/form/components/DateInput.tsx b/src/components/form/components/DateInput.tsx index 80dc8a30..6656038d 100644 --- a/src/components/form/components/DateInput.tsx +++ b/src/components/form/components/DateInput.tsx @@ -29,7 +29,10 @@ interface IDateInput { error: any; } -const END_OF_MONTH = 'END_OF_MONTH'; +export enum DateValue { + CURRENT = 'CURRENT', + END_OF_MONTH = 'END_OF_MONTH', +} const DateInput: React.FC = (props) => { const { questionId, error, sectionId, widgetId, caseId, questionType } = props; @@ -100,16 +103,25 @@ const DateInput: React.FC = (props) => { return ( handleChange(text, onChange)} outputFormat="DD-MM-YYYY" max={ - question.metadata.validators?.[Validators.MAX_DATE]?.value === END_OF_MONTH + question.metadata.validators?.[Validators.MAX_DATE]?.value === + DateValue.END_OF_MONTH ? new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0).toString() - : undefined + : question.metadata.validators?.[Validators.MAX_TODAY]?.value + ? new Date().toString() + : '' } /> ); diff --git a/src/components/form/components/TimeInput.tsx b/src/components/form/components/TimeInput.tsx index 9c4852d5..b186cc97 100644 --- a/src/components/form/components/TimeInput.tsx +++ b/src/components/form/components/TimeInput.tsx @@ -16,6 +16,7 @@ import { DefaultPickerModeVisibleFormatMapping, IDateTimePickerMode, } from '../../../../RN-UI-LIB/src/utlis/dates'; +import { DateValue } from './DateInput'; interface ITimeInput { questionType: string; @@ -84,7 +85,9 @@ const TimeInput: React.FC = (props) => { return ( { const useFirestoreUpdates = () => { const { - user: { user, isLoggedIn, sessionDetails, lock, selectedAgent = MY_CASE_ITEM }, + user: { user, isLoggedIn, sessionDetails, lock, selectedAgent = MY_CASE_ITEM, isExternalAgent }, allCases: { caseDetails, casesList }, } = useAppSelector((state: RootState) => ({ user: state.user || {}, @@ -211,7 +210,7 @@ const useFirestoreUpdates = () => { }; const subscribeToCollectionTemplate = () => { - const collectionPath = 'template/template_collections_v2'; + const collectionPath = `template/${isExternalAgent ? 'external' : 'inhouse'}_template`; return subscribeToDoc(handleCollectionTemplateUpdate, collectionPath); }; @@ -282,7 +281,7 @@ const useFirestoreUpdates = () => { lockUnsubscribe && lockUnsubscribe(); feedbackFiltersUnsubscribe && feedbackFiltersUnsubscribe(); }; - }, [isLoggedIn, user?.referenceId]); + }, [isLoggedIn, user?.referenceId, isExternalAgent]); useEffect(() => { if (!isTeamLead) {