-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4117bd8
commit 2f8693d
Showing
26 changed files
with
22,595 additions
and
8 deletions.
There are no files selected for viewing
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,35 @@ | ||
'use strict'; | ||
import React from 'react'; | ||
|
||
var AlertWindow = React.createClass({ | ||
close() { | ||
this.props.close(this.props.index); | ||
}, | ||
|
||
render() { | ||
var lift = this.props.lift; | ||
return ( | ||
<div className="alert fade in col-md-3 col-sm-12 col-xs-12" id={lift._id}> | ||
<a href="#" className="close" data-dismiss="alert" aria-label="close" onClick={this.close}> | ||
<h3>×</h3> | ||
</a> | ||
<div className="panel panel-danger bg-color-gray"> | ||
<div className="panel-heading back-header-success"> | ||
<a href={`/lifts/${lift._id}`}> | ||
<h4>{lift.address}</h4> | ||
</a> | ||
</div> | ||
<div className="panel-body text-center"> | ||
<i className="fa fa-exclamation-triangle fa-5x"></i> | ||
<div className="content big-text text-content-success">{lift.events_count}</div> | ||
</div> | ||
<div className="panel-footer text-center text-content-success"> | ||
<p>{lift.lift_description}</p> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
}); | ||
|
||
module.exports = AlertWindow; |
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,46 @@ | ||
import React from 'react'; | ||
import LabelBox from './labelbox.js'; | ||
|
||
var EnumParamEdit = React.createClass({ | ||
valueChanged(e){ | ||
if(this.props.readOnly) return; | ||
|
||
var newValue = e.target.value; | ||
this.props.changedCallback(newValue); | ||
console.log(newValue); | ||
}, | ||
|
||
render() { | ||
var parameter = this.props.parameter, | ||
readOnly = "", | ||
_enum = parameter.Enum, | ||
enum_items = []; | ||
|
||
for(var index = 0; index < _enum.length; index++) { | ||
enum_items.push( | ||
<option value={index}>{_enum[index]}</option> | ||
); | ||
} | ||
|
||
if(this.props.readOnly) { | ||
readOnly = <div><h4><LabelBox label="Pouze pro čtení!" type="danger"/></h4></div>; | ||
} | ||
|
||
return( | ||
<div className="panel panel-default"> | ||
<div className="panel-body"> | ||
<select className="form-control" value={parameter.Value} onChange={this.valueChanged}> | ||
{enum_items} | ||
</select> | ||
<hr /> | ||
<h2>{_enum[parameter.Value]}</h2> | ||
<hr /> | ||
<h4>Typ ENUM</h4> | ||
{readOnly} | ||
</div> | ||
</div> | ||
); | ||
} | ||
}); | ||
|
||
module.exports = EnumParamEdit; |
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,79 @@ | ||
import React from 'react'; | ||
import LabelBox from './labelbox.js'; | ||
|
||
var IOParamEdit = React.createClass({ | ||
valueChanged(e){ | ||
if(this.props.readOnly) return; | ||
|
||
var newValue = this.props.parameter.Value; | ||
newValue.Function = e.target.value; | ||
this.props.changedCallback(newValue); | ||
console.log(newValue); | ||
}, | ||
|
||
invertChanged(invert){ | ||
if(this.props.readOnly) return; | ||
|
||
var newValue = this.props.parameter.Value; | ||
newValue.Invert = invert; | ||
this.props.changedCallback(newValue); | ||
console.log(invert); | ||
}, | ||
|
||
render() { | ||
var parameter = this.props.parameter; | ||
var _enum = parameter.Enum; | ||
var enum_items = []; | ||
|
||
for(var index = 0; index < _enum.length; index++) { | ||
enum_items.push( | ||
<option value={index}>{_enum[index]}</option> | ||
); | ||
} | ||
|
||
/* Check if there IO has some function */ | ||
//if(parameter.Value.Function === 0) parameter.Value.Invert = false; | ||
|
||
var checkBox, | ||
readOnly = "", | ||
inverted = ""; | ||
if(parameter.Value.Invert) { | ||
checkBox = <input type="checkbox" value="true" aria-label="Negace" checked onClick={this.invertChanged.bind(null, !parameter.Value.Invert)}/>; | ||
inverted = <span className="label label-danger">Invertováno</span>; | ||
} | ||
else { | ||
checkBox = <input type="checkbox" value="true" aria-label="Negace" onClick={this.invertChanged.bind(null, !parameter.Value.Invert)}/>; | ||
} | ||
|
||
if(this.props.readOnly) { | ||
readOnly = <div><h4><LabelBox label="Pouze pro čtení!" type="danger"/></h4></div>; | ||
} | ||
|
||
return( | ||
<div className="panel panel-default"> | ||
<div className="panel-body"> | ||
<div className="input-group"> | ||
<span className="input-group-addon beautiful"> | ||
{checkBox} | ||
</span> | ||
<select className="form-control" value={parameter.Value.Function} onChange={this.valueChanged}> | ||
{enum_items} | ||
</select> | ||
</div> | ||
<hr /> | ||
<div> | ||
<h5>Funkce:</h5> | ||
<h3> | ||
{_enum[parameter.Value.Function]} {inverted} | ||
</h3> | ||
</div> | ||
<hr /> | ||
<h4>Typ IO</h4> | ||
{readOnly} | ||
</div> | ||
</div> | ||
); | ||
} | ||
}); | ||
|
||
module.exports = IOParamEdit; |
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,75 @@ | ||
import React from 'react'; | ||
import LabelBox from './labelbox.js'; | ||
|
||
var IntegerParamEdit = React.createClass({ | ||
valueChanged(e){ | ||
if(this.props.readOnly) return; | ||
|
||
var parameter = this.props.parameter; | ||
var newValue = parseInt(e.target.value); | ||
|
||
if(newValue >= parameter.Min && newValue <= parameter.Max) this.props.changedCallback(newValue); | ||
}, | ||
|
||
valueIncrement(){ | ||
if(this.props.readOnly) return; | ||
|
||
var parameter = this.props.parameter; | ||
var newValue = parameter.Value; | ||
newValue++; | ||
|
||
if(newValue >= parameter.Min && newValue <= parameter.Max) this.props.changedCallback(newValue); | ||
}, | ||
|
||
valueDecrement(){ | ||
if(this.props.readOnly) return; | ||
var parameter = this.props.parameter; | ||
var newValue = parameter.Value; | ||
newValue--; | ||
|
||
if(newValue >= parameter.Min && newValue <= parameter.Max) this.props.changedCallback(newValue); | ||
}, | ||
|
||
valueClear(){ | ||
if(this.props.readOnly) return; | ||
this.props.changedCallback(this.props.parameter.Min); | ||
}, | ||
|
||
render() { | ||
var parameter = this.props.parameter, | ||
readOnly = ""; | ||
|
||
if(this.props.readOnly) { | ||
readOnly = <div><h4><LabelBox label="Pouze pro čtení!" type="danger"/></h4></div>; | ||
} | ||
|
||
return( | ||
<div className="panel panel-default"> | ||
<div className="panel-body"> | ||
<div className="input-group"> | ||
<input type="text" className="form-control" onChange={this.valueChanged} value={parameter.Value}/> | ||
<div className="input-group-btn"> | ||
<button className="btn btn-success" type="button" onClick={this.valueDecrement}> | ||
<span className="glyphicon glyphicon-minus" aria-hidden="true"></span> | ||
</button> | ||
|
||
<button className="btn btn-success" type="button" onClick={this.valueIncrement}> | ||
<span className="glyphicon glyphicon-plus" aria-hidden="true"></span> | ||
</button> | ||
|
||
<button className="btn btn-danger" type="button" onClick={this.valueClear}> | ||
<span className="glyphicon glyphicon-remove" aria-hidden="true"></span> | ||
</button> | ||
</div> | ||
</div> | ||
<h4>Rozsah {parameter.Min} - {parameter.Max}</h4> | ||
<hr /> | ||
<h4>Typ INTEGER</h4> | ||
{readOnly} | ||
</div> | ||
</div> | ||
); | ||
} | ||
}); | ||
|
||
module.exports = IntegerParamEdit; |
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,14 @@ | ||
'use strict'; | ||
import React from "react"; | ||
|
||
var LabelBox = React.createClass({ | ||
render(){ | ||
var type = "label label-" + this.props.type; | ||
|
||
return( | ||
<span className={type}>{this.props.label}</span> | ||
); | ||
} | ||
}); | ||
|
||
module.exports = LabelBox; |
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
require('../less/main.less'); | ||
//require('../less/main.less'); | ||
|
||
'use strict'; | ||
|
||
import React from "react"; | ||
import ParameterContainer from './views/parameters.js'; | ||
|
||
React.render( < div className = "myDiv" > Hello Electron! < /div>, document.getElementById('content')); | ||
React.render( <ParameterContainer Name="Parametry" />, document.getElementById('content')); |
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,49 @@ | ||
'use strict'; | ||
/* | ||
GenericForm Properties | ||
formId: unique form ID | ||
formTitle: | ||
userForm: | ||
submitBtnName: user can change submit button title | ||
submitCallback: | ||
*/ | ||
var GenericForm = React.createClass({ | ||
submitForm() { | ||
this.props.submitCallback(); | ||
}, | ||
|
||
render() { | ||
return ( | ||
<div className="modal fade" id={this.props.formId} tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> | ||
<div className="modal-dialog"> | ||
<div className="modal-content"> | ||
<div className="modal-header modal-header-blue"> | ||
<button type="button" className="close" data-dismiss="modal"> | ||
<span aria-hidden="true">×</span> | ||
<span className="sr-only">Close</span> | ||
</button> | ||
<h4 className="modal-title" id="myModalLabel">{this.props.formTitle}</h4> | ||
</div> | ||
|
||
<div className="modal-body"> | ||
<div className="container-fluid"> | ||
<div className="row"> | ||
<div className="center-block"> | ||
{this.props.userForm} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div className="modal-footer"> | ||
<button type="button" className="btn btn-default btn-red red-border" data-dismiss="modal">Zrušit</button> | ||
<button type="submit" className="btn btn-default btn-green yellow-border" onClick={this.submitForm}>{this.props.submitBtnName}</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
}); | ||
|
||
module.exports = GenericForm; |
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,69 @@ | ||
'use strict'; | ||
|
||
import GenericForm from './GenericForm.jsx'; | ||
|
||
var NewLiftForm = React.createClass({ | ||
submitForm() { | ||
var Update = this.props.Update; | ||
|
||
sendRequest("POST", "/lifts", $('#liftdata').serialize(), | ||
function (data) { | ||
console.log('ok'); | ||
$("#myModal").modal('hide'); | ||
//$('#liftsCount').text(data.liftsCount); | ||
console.log('ok2'); | ||
Update(); | ||
}, | ||
function () { | ||
$("#myModal").modal('hide'); | ||
}); | ||
}, | ||
|
||
createMainForm() { | ||
return ( | ||
<form id="liftdata" className="form-register"> | ||
<div className="form-group"> | ||
<label>Adresa</label> | ||
<input className="form-control input-sm" type="text" placeholder="Adresa" name="address"/> | ||
</div> | ||
<div className="form-group"> | ||
<label>Uživatelský popis</label> | ||
<input className="form-control input-sm" type="text" placeholder="Popis" name="description"/> | ||
</div> | ||
<div className="form-group" id="floors"> | ||
<label>Počet stanic</label> | ||
<input className="form-control input-sm" type="number" min="2" max="32" placeholder="Počet stanic" name="floors"/> | ||
</div> | ||
<label>Řídící systém</label> | ||
<div className="form-group"> | ||
<select name="board_type"> | ||
<option value="0">E348/RV-C01</option> | ||
<option value="1">E248/E148</option> | ||
</select> | ||
</div> | ||
<label>Typ pohonu</label> | ||
<div className="form-group"> | ||
<select name="engine"> | ||
<option value="0">Frekvenční měnič</option> | ||
<option value="1">Hydraulický</option> | ||
<option value="2">2-rychlostní</option> | ||
</select> | ||
</div> | ||
<input type="hidden" name="_csrf" value={this.props.csrf_token}/> | ||
</form> | ||
); | ||
}, | ||
|
||
render() { | ||
return ( | ||
<GenericForm | ||
formId="myModal" | ||
formTitle="Registrace výtahu" | ||
userForm = {this.createMainForm()} | ||
submitBtnName = "Registrovat" | ||
submitCallback = {this.submitForm} /> | ||
); | ||
} | ||
}); | ||
|
||
module.exports = NewLiftForm; |
Oops, something went wrong.