@mui/material#NativeSelect JavaScript Examples

The following examples show how to use @mui/material#NativeSelect. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: User.js    From admin-web with GNU Affero General Public License v3.0 4 votes vote down vote up
render() {
    const { classes, t, user, handlePropertyChange } = this.props;
    const { properties, ldapID } = user;
    const { title, displayname, nickname, primarytelephonenumber, streetaddress,
      departmentname, companyname, officelocation, givenname, surname, initials,
      assistant, country, locality, stateorprovince, postalcode } = properties;
    return (
      <FormControl className={classes.form}>
        <div className={classes.flexRow}>
          <Typography variant="h6">{t('Name')}</Typography>
          {ldapID && <Tooltip title={t("Warning") + ": " + t("Changes will be overwritten with next LDAP sync")}>
            <Warning color="warning" fontSize="inherit" style={{ fontSize: 32 }}/>  
          </Tooltip>}
        </div>
        <Grid container>
          <Grid item xs={12} className={classes.gridItem}>
            <div className={classes.grid}>
              <TextField 
                className={classes.flexTextfield}
                label={t("First name")}
                value={givenname || ''}
                onChange={handlePropertyChange('givenname')}
                variant={ldapID ? "filled" : 'outlined'}
              />
              <TextField 
                //className={classes.flexTextfield}
                label={t("Initials")}
                value={initials || ''}
                onChange={handlePropertyChange('initials')}
                variant={ldapID ? "filled" : 'outlined'}
              />
            </div>
            <TextField 
              className={classes.propertyInput} 
              label={t("Surname")} 
              fullWidth 
              value={surname || ''}
              onChange={handlePropertyChange('surname')}
              variant={ldapID ? "filled" : 'outlined'}
            />
          </Grid>
          <Grid item xs={12} className={classes.gridItem}>
            <TextField 
              className={classes.propertyInput}
              label={t("Display name")}
              fullWidth
              value={displayname || ''}
              onChange={handlePropertyChange('displayname')}
              variant={ldapID ? "filled" : 'outlined'}
            />
            <TextField 
              className={classes.propertyInput} 
              label={t("Nickname")} 
              fullWidth 
              value={nickname || ''}
              onChange={handlePropertyChange('nickname')}
              variant={ldapID ? "filled" : 'outlined'}
            />
          </Grid>
        </Grid>
        <Divider className={classes.divider} />
        <Grid container>
          <Grid item xs={6} style={{ display: 'flex' }}>
            <TextField 
              className={classes.address}
              label={t("Address")}
              value={streetaddress || ''}
              onChange={handlePropertyChange('streetaddress')}
              multiline
              rows={3}
              variant={ldapID ? "filled" : 'outlined'}
              inputProps={{
                style: {
                  height: 95,
                },
              }}
            />
          </Grid>
          <Grid item xs={6} style={{ paddingRight: 16 }}>
            <TextField 
              className={classes.input}
              label={t("Position")}
              fullWidth
              value={title || ''}
              onChange={handlePropertyChange('title')}
              variant={ldapID ? "filled" : 'outlined'}
            />
            <TextField 
              className={classes.input}
              label={t("Company")}
              fullWidth
              value={companyname || ''}
              onChange={handlePropertyChange('companyname')}
              variant={ldapID ? "filled" : 'outlined'}
            />
          </Grid>
        </Grid>
        <Grid container>
          <Grid item xs={12} className={classes.gridItem}>
            <TextField 
              className={classes.propertyInput}
              label={t("Locality")}
              fullWidth
              value={locality || ''}
              onChange={handlePropertyChange('locality')}
              variant={ldapID ? "filled" : 'outlined'}
            />
            <TextField 
              className={classes.propertyInput}
              label={t("Department")}
              fullWidth
              value={departmentname || ''}
              onChange={handlePropertyChange('departmentname')}
              variant={ldapID ? "filled" : 'outlined'}
            />
          </Grid>
          <Grid item xs={12} className={classes.gridItem}>
            <TextField 
              className={classes.propertyInput}
              label={t("State")}
              fullWidth
              value={stateorprovince || ''}
              onChange={handlePropertyChange('stateorprovince')}
              variant={ldapID ? "filled" : 'outlined'}
            />
            <TextField 
              className={classes.propertyInput}
              label={t("Office")}
              fullWidth
              value={officelocation || ''}
              onChange={handlePropertyChange('officelocation')}
              variant={ldapID ? "filled" : 'outlined'}
            />
          </Grid>
          <Grid item xs={12} className={classes.gridItem}>
            <TextField 
              className={classes.propertyInput}
              label={t("Postal Code")}
              fullWidth
              value={postalcode || ''}
              onChange={handlePropertyChange('postalcode')}
              variant={ldapID ? "filled" : 'outlined'}
            />
            <TextField 
              className={classes.propertyInput}
              label={t("Assistant")}
              fullWidth
              value={assistant || ''}
              onChange={handlePropertyChange('assistant')}
              variant={ldapID ? "filled" : 'outlined'}
            />
          </Grid>
          <Grid item xs={12} className={classes.gridItem}>
            <FormControl className={classes.countrySelect}>
              <InputLabel variant="standard">{t("Country")}</InputLabel>
              <NativeSelect
                value={country || "Germany"}
                onChange={handlePropertyChange('country')}
                fullWidth
              >
                {world.map(country =>
                  <option key={country.id} value={country.name}>
                    {country.name}
                  </option>  
                )}
              </NativeSelect>
            </FormControl>
            <TextField 
              className={classes.propertyInput} 
              label={t("Telephone")} 
              fullWidth 
              value={primarytelephonenumber || ''}
              onChange={handlePropertyChange('primarytelephonenumber')}
              variant={ldapID ? "filled" : 'outlined'}
            />
          </Grid>
        </Grid>
      </FormControl>
    );
  }