Enabling test server and bug fixes
This commit is contained in:
@@ -51,24 +51,26 @@ const styles = StyleSheet.create({
|
||||
|
||||
export class Activity extends React.Component {
|
||||
static bindings = {
|
||||
dateTime: {
|
||||
isValid: true,
|
||||
header: {
|
||||
noValue: true,
|
||||
isDisabled: (r) => !(r.anyModified && r.allValid),
|
||||
},
|
||||
location: {
|
||||
dateTime: {
|
||||
isValid: (r, v) => v !== "",
|
||||
isReadOnly: true,
|
||||
},
|
||||
details: {
|
||||
isValid: true,
|
||||
isValid: (r, v) => v !== "",
|
||||
},
|
||||
resolution: {
|
||||
isValid: true,
|
||||
isValid: (r, v) => v !== "",
|
||||
},
|
||||
notes: {
|
||||
isValid: true,
|
||||
isValid: (r, v) => v !== "",
|
||||
},
|
||||
status: {
|
||||
isValid: true,
|
||||
isValid: (r, v) => v !== "",
|
||||
alwaysGet: true,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -136,14 +138,55 @@ export class Activity extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
@autobind
|
||||
handleDonePress() {
|
||||
const { binder } = this.state
|
||||
let obj = binder.getModifiedFieldValues()
|
||||
|
||||
if (!obj._id) {
|
||||
api
|
||||
.createActivity(obj)
|
||||
.then((activity) => {
|
||||
this.handleBackPress()
|
||||
})
|
||||
.catch((error) => {
|
||||
this.setState({
|
||||
messageModal: {
|
||||
icon: "hand",
|
||||
message: "Unable to create activity",
|
||||
detail: error.message,
|
||||
},
|
||||
})
|
||||
})
|
||||
} else {
|
||||
api
|
||||
.updateActivity(obj)
|
||||
.then((activity) => {
|
||||
this.handleBackPress()
|
||||
})
|
||||
.catch((error) => {
|
||||
this.setState({
|
||||
messageModal: {
|
||||
icon: "hand",
|
||||
message: "Unable to update activity",
|
||||
detail: error.message,
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { binder, messageModal, region } = this.state
|
||||
|
||||
return (
|
||||
<View style={{ width: "100%", height: "100%" }}>
|
||||
<Header
|
||||
title="Activity"
|
||||
<BoundHeader
|
||||
binder={binder}
|
||||
name="header"
|
||||
title="Work Item"
|
||||
leftButton={{ icon: "back", onPress: this.handleBackPress }}
|
||||
rightButton={{ icon: "done", onPress: this.handleDonePress }}
|
||||
/>
|
||||
<ScrollView style={styles.container}>
|
||||
<View style={styles.panel}>
|
||||
|
||||
Reference in New Issue
Block a user