import { sortBy } from 'common/collections';
import { Fragment } from 'inferno';
import { useBackend } from '../backend';
import { Box, Button, Flex, Input, LabeledList, Section, Table, Tabs } from '../components';
import { Window } from '../layouts';
import { decodeHtmlEntities } from 'common/string';
import { CrewManifestContent } from './CrewManifest';
export const IdentificationComputer = () => {
return (
);
};
export const IdentificationComputerContent = (props, context) => {
const { act, data } = useBackend(context);
const { ntos } = props;
const { mode, has_modify, printing } = data;
let body = ;
if (ntos && !data.have_id_slot) {
body = ;
} else if (printing) {
body = ;
} else if (mode === 1) {
body = ;
}
return (
{(!ntos || !!data.have_id_slot) && (
act('mode', { 'mode_target': 0 })}>
Access Modification
)}
act('mode', { 'mode_target': 1 })}>
Crew Manifest
{!ntos ||
(!!data.have_printer && (
act('print')} disabled={!mode && !has_modify} color="">
Print
))}
{body}
);
};
export const IdentificationComputerPrinting = (props, context) => {
return ;
};
export const IdentificationComputerAccessModification = (props, context) => {
const { act, data } = useBackend(context);
const { ntos } = props;
const {
station_name,
target_name,
target_owner,
scan_name,
authenticated,
has_modify,
account_number,
centcom_access,
all_centcom_access,
regions,
id_rank,
departments,
} = data;
return (
{!authenticated && (
Please insert the IDs into the terminal to proceed.
)}
{!ntos && (
)}
{!!authenticated && !!has_modify && (
{departments.map((dept) => (
{dept.department_name}
{dept.jobs.map((job) => (
))}
{/* Hacky little thing to add spacing */}
))}
Special
{(!!centcom_access && (
{all_centcom_access.map((access) => (
))}
)) || (
)}
)}
);
};
export const IdentificationComputerRegions = (props, context) => {
const { act, data } = useBackend(context);
const { actName } = props;
const { regions } = data;
return (
{sortBy((r) => r.name)(regions).map((region) => (
{sortBy((a) => a.desc)(region.accesses).map((access) => (
))}
))}
);
};