// @flow import React from "react"; import { ButtonGrouped, Button, SubmitButton, Modal } from "@scm-manager/ui-components"; import { translate } from "react-i18next"; import PermissionCheckbox from "../components/PermissionCheckbox"; type Props = { readOnly: boolean, availableVerbs: string[], selectedVerbs: string[], onSubmit: (string[]) => void, onClose: () => void, // context props t: string => string }; type State = { verbs: any }; class AdvancedPermissionsDialog extends React.Component { constructor(props: Props) { super(props); const verbs = {}; props.availableVerbs.forEach( verb => (verbs[verb] = props.selectedVerbs ? props.selectedVerbs.includes(verb) : false) ); this.state = { verbs }; } render() { const { t, onClose, readOnly } = this.props; const { verbs } = this.state; const verbSelectBoxes = Object.entries(verbs).map(e => ( )); const submitButton = !readOnly ? ( ) : null; const body = <>{verbSelectBoxes}; const footer = (
{submitButton}