Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add first and last name to add staff member dialog
Lukasz Szewczyk5e1028138fbd
diff --git a/saleor/static/dashboard-next/staff/components/StaffAddMemberDialog/StaffAddMemberDialog.tsx b/saleor/static/dashboard-next/staff/components/StaffAddMemberDialog/StaffAddMemberDialog.tsxindex 30b8654035..8ac81bca21 100644--- a/saleor/static/dashboard-next/staff/components/StaffAddMemberDialog/StaffAddMemberDialog.tsx+++ b/saleor/static/dashboard-next/staff/components/StaffAddMemberDialog/StaffAddMemberDialog.tsx@@ -18,17 +18,22 @@ import ConfirmButton, {} from "../../../components/ConfirmButton/ConfirmButton";import { ControlledCheckbox } from "../../../components/ControlledCheckbox";import Form from "../../../components/Form";+import FormSpacer from "../../../components/FormSpacer";import i18n from "../../../i18n";import { UserError } from "../../../types";export interface FormData {email: string;+ firstName: string;fullAccess: boolean;+ lastName: string;}const initialForm: FormData = {email: "",- fullAccess: false+ firstName: "",+ fullAccess: false,+ lastName: ""};const styles = (theme: Theme) =>@@ -43,6 +48,11 @@ const styles = (theme: Theme) =>fontWeight: 600 as 600,marginBottom: theme.spacing.unit,marginTop: theme.spacing.unit * 2+ },+ textFieldGrid: {+ display: "grid",+ gridColumnGap: `${theme.spacing.unit * 2}px`,+ gridTemplateColumns: "1fr 1fr"}});@@ -71,11 +81,32 @@ const StaffAddMemberDialog = withStyles(styles, {<><DialogTitle>{i18n.t("Add Staff Member")}</DialogTitle><DialogContent>+ <div className={classes.textFieldGrid}>+ <TextField+ error={!!formErrors.firstName}+ helperText={formErrors.firstName}+ label={i18n.t("First Name")}+ name="firstName"+ type="text"+ value={data.firstName}+ onChange={change}+ />+ <TextField+ error={!!formErrors.lastName}+ helperText={formErrors.lastName}+ label={i18n.t("Last Name")}+ name="lastName"+ type="text"+ value={data.lastName}+ onChange={change}+ />+ </div>+ <FormSpacer /><TextFielderror={!!formErrors.email}fullWidthhelperText={formErrors.email}- label={i18n.t("E-mail")}+ label={i18n.t("Email address")}name="email"type="email"value={data.email}diff --git a/saleor/static/dashboard-next/staff/components/StaffList/StaffList.tsx b/saleor/static/dashboard-next/staff/components/StaffList/StaffList.tsxindex e05b54874a..b0a57730fb 100644--- a/saleor/static/dashboard-next/staff/components/StaffList/StaffList.tsx+++ b/saleor/static/dashboard-next/staff/components/StaffList/StaffList.tsx@@ -6,11 +6,11 @@ import TableCell from "@material-ui/core/TableCell";import TableFooter from "@material-ui/core/TableFooter";import TableHead from "@material-ui/core/TableHead";import TableRow from "@material-ui/core/TableRow";+import Typography from "@material-ui/core/Typography";import * as classNames from "classnames";import * as React from "react";import Skeleton from "../../../components/Skeleton";-import StatusLabel from "../../../components/StatusLabel";import TablePagination from "../../../components/TablePagination";import i18n from "../../../i18n";import { renderCollection } from "../../../misc";@@ -18,8 +18,14 @@ import { ListProps } from "../../../types";import { StaffList_staffUsers_edges_node } from "../../types/StaffList";const styles = createStyles({+ statusText: {+ color: "#9E9D9D"+ },tableRow: {- cursor: "pointer"+ cursor: "pointer" as "pointer"+ },+ wideColumn: {+ width: "80%"}});@@ -41,8 +47,12 @@ const StaffList = withStyles(styles, { name: "StaffList" })(<Table><TableHead><TableRow>- <TableCell>{i18n.t("E-mail", { context: "object" })}</TableCell>- <TableCell>{i18n.t("Status", { context: "object" })}</TableCell>+ <TableCell className={classes.wideColumn}>+ {i18n.t("Name", { context: "object" })}+ </TableCell>+ <TableCell>+ {i18n.t("Email Address", { context: "object" })}+ </TableCell></TableRow></TableHead><TableFooter>@@ -73,24 +83,31 @@ const StaffList = withStyles(styles, { name: "StaffList" })(key={staffMember ? staffMember.id : "skeleton"}><TableCell>- {staffMember ? (- <span onClick={onRowClick(staffMember.id)}>- {staffMember.email}- </span>+ {staffMember &&+ staffMember.firstName &&+ staffMember.lastName !== undefined ? (+ <>+ <Typography>+ {`${staffMember.firstName} ${staffMember.lastName}`}+ </Typography>+ <Typography+ variant={"caption"}+ className={classes.statusText}+ >+ {staffMember.isActive+ ? i18n.t("Active", { context: "status" })+ : i18n.t("Inactive", { context: "status" })}+ </Typography>+ </>) : (- <Skeleton />+ <Skeleton style={{ width: "10em" }} />)}</TableCell><TableCell>- {staffMember && staffMember.isActive !== undefined ? (- <StatusLabel- label={- staffMember.isActive- ? i18n.t("Active", { context: "status" })- : i18n.t("Inactive", { context: "status" })- }- status={staffMember.isActive ? "success" : "error"}- />+ {staffMember ? (+ <span onClick={onRowClick(staffMember.id)}>+ {staffMember.email}+ </span>) : (<Skeleton />)}