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"; import SvgIcon from '@common/lib/component/SvgIcon'; import IconExpandDownIos from '@common-ios-icons/icon-expand-down.svg?ios'; import IconExpandDownAndroid from '@common-android-icons/icon-expand-down.svg'; import IconReviewChangesIos from '@common-ios-icons/icon-review-changes.svg?ios'; import IconReviewChangesAndroid from '@common-android-icons/icon-review-changes.svg'; import IconAcceptChangesIos from '@common-ios-icons/icon-accept-changes.svg?ios'; import IconAcceptChangesAndroid from '@common-android-icons/icon-accept-changes.svg'; import IconRejectChangesIos from '@common-ios-icons/icon-reject-changes.svg?ios'; import IconRejectChangesAndroid from '@common-android-icons/icon-reject-changes.svg'; import IconGotoIos from '@common-ios-icons/icon-goto.svg'; import IconGotoAndroid from '@common-android-icons/icon-goto.svg'; import IconPrevChangeIos from '@common-ios-icons/icon-prev-change.svg?ios'; import IconPrevChangeAndroid from '@common-android-icons/icon-prev-change.svg'; import IconNextChangeIos from '@common-ios-icons/icon-next-change.svg?ios'; import IconNextChangeAndroid from '@common-android-icons/icon-next-change.svg'; const PageReview = props => { const { t } = useTranslation(); const _t = t('Common.Collaboration', {returnObjects: true}); const isProtected = props.isProtected; const isDisableAllSettings = props.isReviewOnly || props.displayMode === "final" || props.displayMode === "original"; const canReview = !!props.canReview; return ( {Device.phone && {Device.ios ? : } } {canReview && props.onTrackChanges(!props.trackChanges)} /> } {!props.isRestrictedEdit && } {Device.ios ? : } {canReview && !props.canUseReviewPermissions && !isProtected && {props.onAcceptAll();}}> {Device.ios ? : } } {canReview && !props.canUseReviewPermissions && !isProtected && {props.onRejectAll();}}> {Device.ios ? : } } ) }; const DisplayMode = props => { const { t } = useTranslation(); const _t = t('Common.Collaboration', {returnObjects: true}); const mode = props.storeReview.displayMode; return ( {Device.phone && {Device.ios ? : } } { props.onDisplayMode('markup'); }} > { props.onDisplayMode('final'); }} > { props.onDisplayMode('original'); }} > ) }; const PageReviewChange = inject("storeAppOptions")(observer(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"); const appOptions = props.storeAppOptions; const isProtected = appOptions.isProtected; return ( {Device.phone && {Device.ios ? : } } {(!props.isReviewOnly && !isProtected) && {props.onAcceptCurrentChange()}} >{_t.textAccept} {props.onRejectCurrentChange()}} >{_t.textReject} } {!props.isReviewOnly && change && change?.editable && {props.onDeleteChange()}}>{_t.textDelete} } {props.goto && {props.onGotoNextChange()}}> {Device.ios ? : }} {props.onPrevChange()}} className={isLockPrevNext && 'disabled'} >{Device.ios ? : } {props.onNextChange()}} className={isLockPrevNext && 'disabled'} >{Device.ios ? : } {change ?
{isAndroid &&
{change.initials}
}
{change.userName}
{change.date}
{change.text}
:
{_t.textNoChanges}
}
) })); const PageDisplayMode = inject("storeReview")(observer(DisplayMode)); export {PageReview, PageDisplayMode, PageReviewChange};