import React, { Component, useEffect } from 'react';
import { observer, inject } from "mobx-react";
import { Page, Navbar, NavRight, List, ListItem, Icon, Toggle, Toolbar, Link } from 'framework7-react';
import { f7 } from 'framework7-react';
import { useTranslation } from 'react-i18next';
import {Device} from "../../../utils/device";
const PageReview = props => {
const { t } = useTranslation();
const _t = t('Common.Collaboration', {returnObjects: true});
const isDisableAllSettings = props.isReviewOnly || props.displayMode === "final" || props.displayMode === "original";
const canReview = !!props.canReview;
return (
{Device.phone &&
}
{canReview &&
props.onTrackChanges(!props.trackChanges)}/>
}
{!props.isRestrictedEdit &&
}
{canReview && !props.canUseReviewPermissions &&
{props.onAcceptAll();}}>
}
{canReview && !props.canUseReviewPermissions &&
{props.onRejectAll();}}>
}
)
};
const DisplayMode = props => {
const { t } = useTranslation();
const _t = t('Common.Collaboration', {returnObjects: true});
const mode = props.storeReview.displayMode;
return (
{Device.phone &&
}
{
props.onDisplayMode('markup');
}}
>
{
props.onDisplayMode('final');
}}
>
{
props.onDisplayMode('original');
}}
>
)
};
const PageReviewChange = props => {
const isAndroid = Device.android;
const { t } = useTranslation();
const _t = t('Common.Collaboration', {returnObjects: true});
const change = props.change;
const displayMode = props.displayMode;
const isLockAcceptReject = (!change || (change && !change.editable) || (displayMode === "final" || displayMode === "original") || !props.canReview);
const isLockPrevNext = (displayMode === "final" || displayMode === "original");
return (
{Device.phone &&
}
{!props.isReviewOnly &&
{props.onAcceptCurrentChange()}}
>{_t.textAccept}
{props.onRejectCurrentChange()}}
>{_t.textReject}
}
{props.isReviewOnly && change && change.editable &&
{props.onDeleteChange()}}>{_t.textDelete}
}
{props.goto && {props.onGotoNextChange()}}>}
{props.onPrevChange()}}
className={isLockPrevNext && 'disabled'}
>
{props.onNextChange()}}
className={isLockPrevNext && 'disabled'}
>
{change ?
{isAndroid &&
{change.initials}
}
{change.userName}
{change.date}
{change.text}
:
{_t.textNoChanges}
}
)
};
const PageDisplayMode = inject("storeReview")(observer(DisplayMode));
export {PageReview, PageDisplayMode, PageReviewChange};