Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix adding of Room entities, fix updating, add deletion
- Loading branch information
Showing
8 changed files
with
2,021 additions
and
15,335 deletions.
There are no files selected for viewing
13,507 changes: 0 additions & 13,507 deletions
13,507
react-frontend/things-manager-frontend/package-lock.json
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
40 changes: 40 additions & 0 deletions
40
...s-manager-frontend/src/components/page-components/building_typeahead/BuildingTypeahead.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React, { Component } from 'react' | ||
import { Typeahead, AsyncTypeahead } from 'react-bootstrap-typeahead'; | ||
import 'react-bootstrap-typeahead/css/Typeahead.css'; | ||
import 'react-bootstrap-typeahead/css/Typeahead-bs4.css'; | ||
|
||
export class BuildingTypeahead extends Component { | ||
|
||
onSelectedBuildingUpdated(newValue, reason) { | ||
if (reason === "inp") { | ||
this.props.setFieldValue("building", newValue); | ||
} else { | ||
if (!newValue.name) return; | ||
this.props.setFieldValue("building", newValue); | ||
} | ||
} | ||
|
||
render() { | ||
return ( | ||
<Typeahead | ||
labelKey="name" | ||
id="typeahead" | ||
options={this.props.options} | ||
placeholder="Выберите строение" | ||
onChange={(selected) => { | ||
const building = selected.length > 0 ? selected[0] : {id: undefined, name: undefined}; | ||
this.onSelectedBuildingUpdated(building, "sel"); | ||
}} | ||
onInputChange={(text, event) => { | ||
const building = {id: undefined, name: text}; | ||
this.onSelectedBuildingUpdated(building, "inp"); | ||
}} | ||
ref={this.props.getReference} | ||
selected={this.props.selected} | ||
defaultInputValue={this.props.defaultInputValue} | ||
/> | ||
) | ||
} | ||
} | ||
|
||
export default BuildingTypeahead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.