UI: фильтр и inline-селект подразделений — та же иерархия optgroup
This commit is contained in:
@@ -354,7 +354,13 @@ const UsersAdmin = () => {
|
|||||||
/>
|
/>
|
||||||
<select value={filterUnit} onChange={(e) => setFilterUnit(e.target.value)}>
|
<select value={filterUnit} onChange={(e) => setFilterUnit(e.target.value)}>
|
||||||
<option value="">Все подразделения</option>
|
<option value="">Все подразделения</option>
|
||||||
{units.map((u) => <option key={u.id} value={u.id}>{u.name}</option>)}
|
{unitsTree.rcu.map((u) => <option key={u.id} value={u.id}>{u.name}</option>)}
|
||||||
|
{unitsTree.obl.map((u) => <option key={u.id} value={u.id}>{u.name}</option>)}
|
||||||
|
{unitsTree.groups.map((g) => (
|
||||||
|
<optgroup key={g.label} label={g.label}>
|
||||||
|
{g.items.map((u) => <option key={u.id} value={u.id}>{u.name}</option>)}
|
||||||
|
</optgroup>
|
||||||
|
))}
|
||||||
</select>
|
</select>
|
||||||
<button className="us-reload" onClick={load}>↻</button>
|
<button className="us-reload" onClick={load}>↻</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -384,7 +390,13 @@ const UsersAdmin = () => {
|
|||||||
<td>
|
<td>
|
||||||
<select value={u.unit_id || ''} onChange={(e) => changeUnit(u, e.target.value)} className="us-unit-select">
|
<select value={u.unit_id || ''} onChange={(e) => changeUnit(u, e.target.value)} className="us-unit-select">
|
||||||
<option value="">—</option>
|
<option value="">—</option>
|
||||||
{units.map((un) => <option key={un.id} value={un.id}>{un.name}</option>)}
|
{unitsTree.rcu.map((un) => <option key={un.id} value={un.id}>{un.name}</option>)}
|
||||||
|
{unitsTree.obl.map((un) => <option key={un.id} value={un.id}>{un.name}</option>)}
|
||||||
|
{unitsTree.groups.map((g) => (
|
||||||
|
<optgroup key={g.label} label={g.label}>
|
||||||
|
{g.items.map((un) => <option key={un.id} value={un.id}>{un.name}</option>)}
|
||||||
|
</optgroup>
|
||||||
|
))}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td><span className={`us-status ${STATUS_CLASS[u.status] || ''}`}>{STATUS_LABEL[u.status] || u.status}</span></td>
|
<td><span className={`us-status ${STATUS_CLASS[u.status] || ''}`}>{STATUS_LABEL[u.status] || u.status}</span></td>
|
||||||
|
|||||||
Reference in New Issue
Block a user