2016-02-12 20:36:59 -05:00
|
|
|
var React = require('react');
|
|
|
|
var ReactDOM = require('react-dom');
|
2015-07-03 09:33:45 -04:00
|
|
|
|
2016-02-12 20:36:59 -05:00
|
|
|
var ReactBootstrap = require('react-bootstrap');
|
2015-07-04 08:28:09 -04:00
|
|
|
var Grid = ReactBootstrap.Grid;
|
|
|
|
var Row = ReactBootstrap.Row;
|
|
|
|
var Col = ReactBootstrap.Col;
|
2016-02-12 20:36:59 -05:00
|
|
|
var Input = ReactBootstrap.Input;
|
2015-07-04 08:28:09 -04:00
|
|
|
var Button = ReactBootstrap.Button;
|
|
|
|
var ButtonGroup = ReactBootstrap.ButtonGroup;
|
|
|
|
var Glyphicon = ReactBootstrap.Glyphicon;
|
2016-02-12 20:36:59 -05:00
|
|
|
var ListGroup = ReactBootstrap.ListGroup;
|
|
|
|
var ListGroupItem = ReactBootstrap.ListGroupItem;
|
|
|
|
var Collapse = ReactBootstrap.Collapse;
|
2016-02-13 10:46:08 -05:00
|
|
|
var Alert = ReactBootstrap.Alert;
|
2016-02-12 20:36:59 -05:00
|
|
|
var Modal = ReactBootstrap.Modal;
|
|
|
|
var Collapse = ReactBootstrap.Collapse;
|
2015-07-04 08:28:09 -04:00
|
|
|
|
2016-02-12 20:36:59 -05:00
|
|
|
var Combobox = require('react-widgets').Combobox;
|
2015-07-04 11:42:52 -04:00
|
|
|
|
2016-02-13 16:31:12 -05:00
|
|
|
var models = require('./models.js');
|
|
|
|
var Security = models.Security;
|
|
|
|
var Account = models.Account;
|
|
|
|
var AccountTypeList = models.AccountTypeList;
|
|
|
|
|
2016-02-12 20:36:59 -05:00
|
|
|
var AccountCombobox = require('./AccountCombobox.js');
|
|
|
|
var AccountRegister = require('./AccountRegister.js');
|
2015-07-04 08:28:09 -04:00
|
|
|
|
2015-07-04 21:55:49 -04:00
|
|
|
const AddEditAccountModal = React.createClass({
|
2015-07-03 09:33:45 -04:00
|
|
|
getInitialState: function() {
|
2015-07-04 21:55:49 -04:00
|
|
|
var s = {
|
|
|
|
accountid: -1,
|
|
|
|
security: 1,
|
|
|
|
parentaccountid: -1,
|
|
|
|
type: 1,
|
2015-07-04 08:28:09 -04:00
|
|
|
name: ""
|
2015-07-03 09:33:45 -04:00
|
|
|
};
|
2015-07-04 21:55:49 -04:00
|
|
|
if (this.props.editAccount != null) {
|
|
|
|
s.accountid = this.props.editAccount.AccountId;
|
|
|
|
s.name = this.props.editAccount.Name;
|
|
|
|
s.security = this.props.editAccount.SecurityId;
|
|
|
|
s.parentaccountid = this.props.editAccount.ParentAccountId;
|
|
|
|
s.type = this.props.editAccount.Type;
|
|
|
|
} else if (this.props.initialParentAccount != null) {
|
|
|
|
s.security = this.props.initialParentAccount.SecurityId;
|
|
|
|
s.parentaccountid = this.props.initialParentAccount.AccountId;
|
|
|
|
s.type = this.props.initialParentAccount.Type;
|
|
|
|
}
|
|
|
|
return s;
|
2015-07-03 09:33:45 -04:00
|
|
|
},
|
2015-07-04 08:28:09 -04:00
|
|
|
handleCancel: function() {
|
|
|
|
if (this.props.onCancel != null)
|
|
|
|
this.props.onCancel();
|
|
|
|
},
|
|
|
|
handleChange: function() {
|
|
|
|
this.setState({
|
|
|
|
name: this.refs.name.getValue(),
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleSecurityChange: function(security) {
|
|
|
|
if (security.hasOwnProperty('SecurityId'))
|
|
|
|
this.setState({
|
|
|
|
security: security.SecurityId
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleTypeChange: function(type) {
|
|
|
|
if (type.hasOwnProperty('TypeId'))
|
|
|
|
this.setState({
|
|
|
|
type: type.TypeId
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleParentChange: function(parentAccount) {
|
|
|
|
this.setState({parentaccountid: parentAccount.AccountId});
|
|
|
|
},
|
|
|
|
handleSubmit: function() {
|
|
|
|
var a = new Account();
|
|
|
|
|
2015-07-04 21:55:49 -04:00
|
|
|
if (this.props.editAccount != null)
|
|
|
|
a.AccountId = this.state.accountid;
|
2015-07-04 08:28:09 -04:00
|
|
|
a.Name = this.state.name;
|
|
|
|
a.ParentAccountId = this.state.parentaccountid;
|
|
|
|
a.SecurityId = this.state.security;
|
|
|
|
a.Type = this.state.type;
|
|
|
|
|
|
|
|
if (this.props.onSubmit != null)
|
2015-07-04 21:55:49 -04:00
|
|
|
this.props.onSubmit(a);
|
2015-07-04 08:28:09 -04:00
|
|
|
},
|
2015-07-04 21:11:00 -04:00
|
|
|
componentWillReceiveProps: function(nextProps) {
|
|
|
|
if (nextProps.show && !this.props.show) {
|
|
|
|
this.setState(this.getInitialState());
|
|
|
|
}
|
|
|
|
},
|
2015-07-04 08:28:09 -04:00
|
|
|
render: function() {
|
2015-07-04 21:55:49 -04:00
|
|
|
var headerText = (this.props.editAccount != null) ? "Edit" : "Create New";
|
2015-07-05 21:44:53 -04:00
|
|
|
var buttonText = (this.props.editAccount != null) ? "Save Changes" : "Create Account";
|
2015-07-04 21:55:49 -04:00
|
|
|
var rootName = (this.props.editAccount != null) ? "Top-level Account" : "New Top-level Account";
|
2015-07-04 08:28:09 -04:00
|
|
|
return (
|
|
|
|
<Modal show={this.props.show} onHide={this.handleCancel}>
|
|
|
|
<Modal.Header closeButton>
|
2015-07-04 21:55:49 -04:00
|
|
|
<Modal.Title>{headerText} Account</Modal.Title>
|
2015-07-04 08:28:09 -04:00
|
|
|
</Modal.Header>
|
|
|
|
<Modal.Body>
|
|
|
|
<form onSubmit={this.handleSubmit}
|
|
|
|
className="form-horizontal">
|
|
|
|
<Input type="text"
|
2015-07-04 21:11:00 -04:00
|
|
|
label="Name"
|
|
|
|
value={this.state.name}
|
|
|
|
onChange={this.handleChange}
|
|
|
|
ref="name"
|
|
|
|
labelClassName="col-xs-2"
|
|
|
|
wrapperClassName="col-xs-10"/>
|
2015-07-04 08:28:09 -04:00
|
|
|
<Input wrapperClassName="wrapper"
|
2015-07-04 21:11:00 -04:00
|
|
|
label="Parent Account"
|
|
|
|
labelClassName="col-xs-2"
|
|
|
|
wrapperClassName="col-xs-10">
|
2015-07-04 08:28:09 -04:00
|
|
|
<AccountCombobox
|
2015-07-04 21:11:00 -04:00
|
|
|
accounts={this.props.accounts}
|
|
|
|
account_map={this.props.account_map}
|
|
|
|
value={this.state.parentaccountid}
|
2015-07-04 21:55:49 -04:00
|
|
|
rootName={rootName}
|
2016-02-12 20:36:59 -05:00
|
|
|
onChange={this.handleParentChange}
|
2015-07-04 21:11:00 -04:00
|
|
|
ref="parent" />
|
2015-07-04 08:28:09 -04:00
|
|
|
</Input>
|
|
|
|
<Input wrapperClassName="wrapper"
|
2015-07-04 21:11:00 -04:00
|
|
|
label="Security"
|
|
|
|
labelClassName="col-xs-2"
|
|
|
|
wrapperClassName="col-xs-10">
|
2015-07-04 08:28:09 -04:00
|
|
|
<Combobox
|
2015-07-04 21:11:00 -04:00
|
|
|
data={this.props.securities}
|
|
|
|
valueField='SecurityId'
|
|
|
|
textField='Name'
|
|
|
|
value={this.state.security}
|
2016-02-12 20:36:59 -05:00
|
|
|
onChange={this.handleSecurityChange}
|
2015-07-04 21:11:00 -04:00
|
|
|
ref="security" />
|
2015-07-04 08:28:09 -04:00
|
|
|
</Input>
|
|
|
|
<Input wrapperClassName="wrapper"
|
2015-07-04 21:11:00 -04:00
|
|
|
label="Account Type"
|
|
|
|
labelClassName="col-xs-2"
|
|
|
|
wrapperClassName="col-xs-10">
|
2015-07-04 08:28:09 -04:00
|
|
|
<Combobox
|
2015-07-04 21:11:00 -04:00
|
|
|
data={AccountTypeList}
|
|
|
|
valueField='TypeId'
|
|
|
|
textField='Name'
|
|
|
|
value={this.state.type}
|
2016-02-12 20:36:59 -05:00
|
|
|
onChange={this.handleTypeChange}
|
2015-07-04 21:11:00 -04:00
|
|
|
ref="type" />
|
2015-07-04 08:28:09 -04:00
|
|
|
</Input>
|
|
|
|
</form>
|
|
|
|
</Modal.Body>
|
|
|
|
<Modal.Footer>
|
|
|
|
<ButtonGroup className="pull-right">
|
|
|
|
<Button onClick={this.handleCancel} bsStyle="warning">Cancel</Button>
|
2015-07-05 21:44:53 -04:00
|
|
|
<Button onClick={this.handleSubmit} bsStyle="success">{buttonText}</Button>
|
2015-07-04 08:28:09 -04:00
|
|
|
</ButtonGroup>
|
|
|
|
</Modal.Footer>
|
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-02-12 20:36:59 -05:00
|
|
|
|
2015-07-04 21:11:00 -04:00
|
|
|
const DeleteAccountModal = React.createClass({
|
|
|
|
getInitialState: function() {
|
|
|
|
if (this.props.initialAccount != null)
|
|
|
|
var accountid = this.props.initialAccount.AccountId;
|
|
|
|
else if (this.props.accounts.length > 0)
|
|
|
|
var accountid = this.props.accounts[0].AccountId;
|
|
|
|
else
|
|
|
|
var accountid = -1;
|
|
|
|
return {error: "",
|
|
|
|
accountid: accountid,
|
|
|
|
checked: false,
|
|
|
|
show: false};
|
|
|
|
},
|
|
|
|
handleCancel: function() {
|
|
|
|
if (this.props.onCancel != null)
|
|
|
|
this.props.onCancel();
|
|
|
|
},
|
|
|
|
handleChange: function(account) {
|
|
|
|
this.setState({accountid: account.AccountId});
|
|
|
|
},
|
|
|
|
handleCheckboxClick: function() {
|
|
|
|
this.setState({checked: !this.state.checked});
|
|
|
|
},
|
|
|
|
handleSubmit: function() {
|
|
|
|
if (this.props.account_map.hasOwnProperty(this.state.accountid)) {
|
|
|
|
if (this.state.checked) {
|
|
|
|
if (this.props.onSubmit != null)
|
|
|
|
this.props.onSubmit(this.props.account_map[this.state.accountid]);
|
|
|
|
} else {
|
|
|
|
this.setState({error: "You must confirm you wish to delete this account."});
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
this.setState({error: "You must select an account."});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
componentWillReceiveProps: function(nextProps) {
|
|
|
|
if (nextProps.show && !this.props.show) {
|
|
|
|
this.setState(this.getInitialState());
|
|
|
|
}
|
|
|
|
},
|
|
|
|
render: function() {
|
|
|
|
var checkbox = [];
|
|
|
|
if (this.props.account_map.hasOwnProperty(this.state.accountid)) {
|
|
|
|
var parentAccountId = this.props.account_map[this.state.accountid].ParentAccountId;
|
|
|
|
var parentAccount = "will be deleted and any child accounts will become top-level accounts.";
|
|
|
|
if (parentAccountId != -1)
|
|
|
|
parentAccount = "and any child accounts will be re-parented to: " + this.props.account_map[parentAccountId].Name;
|
|
|
|
|
|
|
|
var warningString = "I understand that deleting this account cannot be undone and that all transactions " + parentAccount;
|
|
|
|
checkbox = (<Input
|
|
|
|
type='checkbox'
|
|
|
|
checked={this.state.checked ? "checked" : ""}
|
|
|
|
onClick={this.handleCheckboxClick}
|
|
|
|
label={warningString}
|
|
|
|
wrapperClassName="col-xs-offset-2 col-xs-10"/>);
|
|
|
|
}
|
|
|
|
var warning = [];
|
|
|
|
if (this.state.error.length != "") {
|
|
|
|
warning = (
|
|
|
|
<Alert bsStyle="danger"><strong>Error: </strong>{this.state.error}</Alert>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Modal
|
|
|
|
show={this.props.show}
|
|
|
|
onHide={this.handleCancel}
|
|
|
|
ref="modal">
|
|
|
|
<Modal.Header closeButton>
|
|
|
|
<Modal.Title>Delete Account</Modal.Title>
|
|
|
|
</Modal.Header>
|
|
|
|
<Modal.Body>
|
|
|
|
{warning}
|
|
|
|
<form onSubmit={this.handleSubmit}
|
|
|
|
className="form-horizontal">
|
|
|
|
<Input wrapperClassName="wrapper"
|
|
|
|
label="Delete Account"
|
|
|
|
labelClassName="col-xs-2"
|
|
|
|
wrapperClassName="col-xs-10">
|
|
|
|
<AccountCombobox
|
|
|
|
includeRoot={false}
|
|
|
|
accounts={this.props.accounts}
|
|
|
|
account_map={this.props.account_map}
|
|
|
|
value={this.state.accountid}
|
2016-02-12 20:36:59 -05:00
|
|
|
onChange={this.handleChange}/>
|
2015-07-04 21:11:00 -04:00
|
|
|
</Input>
|
|
|
|
{checkbox}
|
|
|
|
</form>
|
|
|
|
</Modal.Body>
|
|
|
|
<Modal.Footer>
|
|
|
|
<ButtonGroup className="pull-right">
|
|
|
|
<Button onClick={this.handleCancel} bsStyle="warning">Cancel</Button>
|
|
|
|
<Button onClick={this.handleSubmit} bsStyle="success">Delete Account</Button>
|
|
|
|
</ButtonGroup>
|
|
|
|
</Modal.Footer>
|
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-07-04 11:42:52 -04:00
|
|
|
const AccountTreeNode = React.createClass({
|
2016-02-12 20:36:59 -05:00
|
|
|
getInitialState: function() {
|
|
|
|
return {expanded: false};
|
2015-07-04 11:42:52 -04:00
|
|
|
},
|
|
|
|
handleToggle: function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
this.setState({expanded:!this.state.expanded});
|
|
|
|
},
|
|
|
|
handleChildSelect: function(account) {
|
|
|
|
if (this.props.onSelect != null)
|
|
|
|
this.props.onSelect(account);
|
|
|
|
},
|
|
|
|
handleSelect: function() {
|
|
|
|
if (this.props.onSelect != null)
|
|
|
|
this.props.onSelect(this.props.account);
|
|
|
|
},
|
|
|
|
render: function() {
|
2016-02-12 20:36:59 -05:00
|
|
|
var glyph = this.state.expanded ? 'minus' : 'plus';
|
2015-07-04 11:42:52 -04:00
|
|
|
var active = (this.props.selectedAccount != null &&
|
|
|
|
this.props.account.AccountId == this.props.selectedAccount.AccountId);
|
|
|
|
var buttonStyle = active ? "info" : "link";
|
|
|
|
|
|
|
|
var self = this;
|
|
|
|
var children = this.props.account.Children.map(function(account) {
|
|
|
|
return (
|
|
|
|
<AccountTreeNode
|
2016-02-13 10:19:28 -05:00
|
|
|
key={account.AccountId}
|
2015-07-04 11:42:52 -04:00
|
|
|
account={account}
|
|
|
|
selectedAccount={self.props.selectedAccount}
|
|
|
|
onSelect={self.handleChildSelect}/>
|
|
|
|
);
|
|
|
|
});
|
|
|
|
var accounttreeClasses = "accounttree"
|
|
|
|
var expandButton = [];
|
2016-02-12 20:36:59 -05:00
|
|
|
if (children.length > 0) {
|
2015-07-04 11:42:52 -04:00
|
|
|
expandButton.push((
|
|
|
|
<Button onClick={this.handleToggle}
|
2016-02-13 10:19:28 -05:00
|
|
|
key={1}
|
2015-07-04 11:42:52 -04:00
|
|
|
bsSize="xsmall"
|
|
|
|
bsStyle="link"
|
|
|
|
className="accounttree-expandbutton">
|
|
|
|
<Glyphicon glyph={glyph} bsSize="xsmall"/>
|
|
|
|
</Button>
|
|
|
|
));
|
2016-02-12 20:36:59 -05:00
|
|
|
} else {
|
2015-07-04 11:42:52 -04:00
|
|
|
accounttreeClasses += "-nochildren";
|
2016-02-12 20:36:59 -05:00
|
|
|
}
|
2015-07-04 11:42:52 -04:00
|
|
|
return (
|
|
|
|
<div className={accounttreeClasses}>
|
|
|
|
{expandButton}
|
|
|
|
<Button onClick={this.handleSelect}
|
|
|
|
bsStyle={buttonStyle}
|
|
|
|
className="accounttree-name">
|
|
|
|
{this.props.account.Name}
|
|
|
|
</Button>
|
2016-02-12 20:36:59 -05:00
|
|
|
<Collapse in={this.state.expanded}>
|
|
|
|
<div>
|
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
</Collapse>
|
2015-07-04 11:42:52 -04:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
const AccountTree = React.createClass({
|
|
|
|
getInitialState: function() {
|
2015-07-07 20:18:09 -04:00
|
|
|
return {selectedAccount: null,
|
|
|
|
height: 0};
|
2015-07-04 11:42:52 -04:00
|
|
|
},
|
|
|
|
handleSelect: function(account) {
|
|
|
|
this.setState({selectedAccount: account});
|
|
|
|
if (this.props.onSelect != null) {
|
|
|
|
this.props.onSelect(account);
|
|
|
|
}
|
|
|
|
},
|
2015-07-07 20:18:09 -04:00
|
|
|
resize: function() {
|
2016-02-12 20:36:59 -05:00
|
|
|
var div = ReactDOM.findDOMNode(this);
|
2015-07-07 20:18:09 -04:00
|
|
|
this.setState({height: div.parentElement.clientHeight - 73});
|
|
|
|
},
|
|
|
|
componentDidMount: function() {
|
|
|
|
this.resize();
|
|
|
|
var self = this;
|
|
|
|
$(window).resize(function() {self.resize();});
|
|
|
|
},
|
2015-07-04 11:42:52 -04:00
|
|
|
render: function() {
|
|
|
|
var accounts = this.props.accounts;
|
|
|
|
|
|
|
|
var children = [];
|
|
|
|
for (var i = 0; i < accounts.length; i++) {
|
|
|
|
if (accounts[i].isRootAccount())
|
|
|
|
children.push((<AccountTreeNode
|
2016-02-13 10:19:28 -05:00
|
|
|
key={accounts[i].AccountId}
|
2015-07-04 11:42:52 -04:00
|
|
|
account={accounts[i]}
|
|
|
|
selectedAccount={this.state.selectedAccount}
|
|
|
|
onSelect={this.handleSelect}/>));
|
|
|
|
}
|
|
|
|
|
2015-07-07 20:18:09 -04:00
|
|
|
var style = {height: this.state.height + "px"};
|
|
|
|
|
2015-07-04 11:42:52 -04:00
|
|
|
return (
|
2015-07-07 20:18:09 -04:00
|
|
|
<div className="accounttree-root" style={style} >
|
2015-07-04 11:42:52 -04:00
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-02-12 20:36:59 -05:00
|
|
|
module.exports = React.createClass({
|
|
|
|
displayName: "AccountsTab",
|
2015-07-04 08:28:09 -04:00
|
|
|
getInitialState: function() {
|
|
|
|
return {
|
2015-07-04 11:42:52 -04:00
|
|
|
selectedAccount: null,
|
2015-07-04 21:11:00 -04:00
|
|
|
creatingNewAccount: false,
|
2015-07-04 21:55:49 -04:00
|
|
|
editingAccount: false,
|
2015-07-04 21:11:00 -04:00
|
|
|
deletingAccount: false
|
2015-07-04 08:28:09 -04:00
|
|
|
};
|
|
|
|
},
|
|
|
|
handleNewAccount: function() {
|
|
|
|
this.setState({creatingNewAccount: true});
|
|
|
|
},
|
|
|
|
handleEditAccount: function() {
|
2015-07-04 21:55:49 -04:00
|
|
|
this.setState({editingAccount: true});
|
2015-07-04 08:28:09 -04:00
|
|
|
},
|
|
|
|
handleDeleteAccount: function() {
|
2015-07-04 21:11:00 -04:00
|
|
|
this.setState({deletingAccount: true});
|
2015-07-04 08:28:09 -04:00
|
|
|
},
|
|
|
|
handleCreationCancel: function() {
|
|
|
|
this.setState({creatingNewAccount: false});
|
|
|
|
},
|
2015-07-04 21:55:49 -04:00
|
|
|
handleEditingCancel: function() {
|
|
|
|
this.setState({editingAccount: false});
|
|
|
|
},
|
2015-07-04 21:11:00 -04:00
|
|
|
handleDeletionCancel: function() {
|
|
|
|
this.setState({deletingAccount: false});
|
|
|
|
},
|
2015-07-04 08:28:09 -04:00
|
|
|
handleCreateAccount: function(account) {
|
|
|
|
if (this.props.onCreateAccount != null)
|
|
|
|
this.props.onCreateAccount(account);
|
|
|
|
this.setState({creatingNewAccount: false});
|
|
|
|
},
|
2015-07-04 21:55:49 -04:00
|
|
|
handleUpdateAccount: function(account) {
|
|
|
|
if (this.props.onUpdateAccount != null)
|
|
|
|
this.props.onUpdateAccount(account);
|
|
|
|
this.setState({editingAccount: false});
|
|
|
|
},
|
2015-07-04 21:11:00 -04:00
|
|
|
handleRemoveAccount: function(account) {
|
|
|
|
if (this.props.onDeleteAccount != null)
|
|
|
|
this.props.onDeleteAccount(account);
|
2015-07-04 21:55:49 -04:00
|
|
|
this.setState({deletingAccount: false,
|
|
|
|
selectedAccount: null});
|
2015-07-04 21:11:00 -04:00
|
|
|
},
|
2015-07-04 11:42:52 -04:00
|
|
|
handleAccountSelected: function(account) {
|
|
|
|
this.setState({selectedAccount: account});
|
|
|
|
},
|
2015-07-03 09:33:45 -04:00
|
|
|
render: function() {
|
|
|
|
var accounts = this.props.accounts;
|
|
|
|
var account_map = this.props.account_map;
|
|
|
|
|
2016-02-12 20:36:59 -05:00
|
|
|
var disabled = (this.state.selectedAccount == null) ? true : false;
|
2015-07-04 21:55:49 -04:00
|
|
|
|
2015-07-03 09:33:45 -04:00
|
|
|
return (
|
2015-07-07 20:18:09 -04:00
|
|
|
<Grid fluid className="fullheight"><Row className="fullheight">
|
|
|
|
<Col xs={2} className="fullheight account-column">
|
2015-07-04 21:55:49 -04:00
|
|
|
<AddEditAccountModal
|
2015-07-04 08:28:09 -04:00
|
|
|
show={this.state.creatingNewAccount}
|
2015-07-04 21:11:00 -04:00
|
|
|
initialParentAccount={this.state.selectedAccount}
|
2015-07-04 08:28:09 -04:00
|
|
|
accounts={this.props.accounts}
|
|
|
|
account_map={this.props.account_map}
|
|
|
|
onCancel={this.handleCreationCancel}
|
|
|
|
onSubmit={this.handleCreateAccount}
|
|
|
|
securities={this.props.securities}/>
|
2015-07-04 21:55:49 -04:00
|
|
|
<AddEditAccountModal
|
|
|
|
show={this.state.editingAccount}
|
|
|
|
editAccount={this.state.selectedAccount}
|
|
|
|
accounts={this.props.accounts}
|
|
|
|
account_map={this.props.account_map}
|
|
|
|
onCancel={this.handleEditingCancel}
|
|
|
|
onSubmit={this.handleUpdateAccount}
|
|
|
|
securities={this.props.securities}/>
|
2015-07-04 21:11:00 -04:00
|
|
|
<DeleteAccountModal
|
|
|
|
show={this.state.deletingAccount}
|
|
|
|
initialAccount={this.state.selectedAccount}
|
|
|
|
accounts={this.props.accounts}
|
|
|
|
account_map={this.props.account_map}
|
|
|
|
onCancel={this.handleDeletionCancel}
|
|
|
|
onSubmit={this.handleRemoveAccount}/>
|
2015-07-04 11:42:52 -04:00
|
|
|
<AccountTree
|
|
|
|
accounts={accounts}
|
|
|
|
onSelect={this.handleAccountSelected}/>
|
2015-07-07 20:18:09 -04:00
|
|
|
<ButtonGroup className="account-buttongroup">
|
2015-07-04 08:28:09 -04:00
|
|
|
<Button onClick={this.handleNewAccount} bsStyle="success">
|
|
|
|
<Glyphicon glyph='plus-sign' /></Button>
|
2015-07-04 21:55:49 -04:00
|
|
|
<Button onClick={this.handleEditAccount}
|
|
|
|
bsStyle="primary" disabled={disabled}>
|
2015-07-04 08:28:09 -04:00
|
|
|
<Glyphicon glyph='cog' /></Button>
|
2015-07-04 21:55:49 -04:00
|
|
|
<Button onClick={this.handleDeleteAccount}
|
|
|
|
bsStyle="danger" disabled={disabled}>
|
2015-07-04 08:28:09 -04:00
|
|
|
<Glyphicon glyph='trash' /></Button>
|
|
|
|
</ButtonGroup>
|
2015-07-07 20:18:09 -04:00
|
|
|
</Col><Col xs={10} className="fullheight transactions-column">
|
2015-08-05 21:25:25 -04:00
|
|
|
<AccountRegister
|
|
|
|
selectedAccount={this.state.selectedAccount}
|
|
|
|
accounts={this.props.accounts}
|
|
|
|
account_map={this.props.account_map}
|
|
|
|
securities={this.props.securities}
|
|
|
|
security_map={this.props.security_map} />
|
2015-07-04 08:28:09 -04:00
|
|
|
</Col>
|
|
|
|
</Row></Grid>
|
2015-07-03 09:33:45 -04:00
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|