Commit a356718d authored by tejaswi's avatar tejaswi
Browse files

Changes

parent 4c0f0a25
Showing with 30 additions and 13 deletions
+30 -13
......@@ -59,6 +59,8 @@ export default class Calendar extends Component {
addEventData: [],
selectedItems: [],
title:'',
Description:'',
editEventData:[]
};
this.eventsData();
}
......@@ -336,6 +338,23 @@ export default class Calendar extends Component {
return valid;
}
//Validatios
isValid1() {
const { title, } = this.state.event;
let valid = false;
if (title.length === 0) {
log("Warn", "Enter Title");
this.setState({ error1: 'Enter Title' });
}
else {
valid = true;
}
return valid;
}
//Add event
addEvent() {
// alert(this.state.assignedto)
......@@ -448,9 +467,10 @@ export default class Calendar extends Component {
//Modify the event
editEvent() {
// alert(this.state.event.Id)
const addEventData = {
// alert(this.state.event.title)
const editEventData = {
EventStatus: "Active",
Subject: this.state.title,
Subject: this.state.event.title,
Id:this.state.event.Id,
StartTime: this.state.startDate,
EndTime: this.state.targetDate,
......@@ -460,7 +480,8 @@ export default class Calendar extends Component {
Location: this.state.location,
}
// alert(this.state.Menbers)
alert(this.state.Subject)
alert(this.state.editEventData)
// alert(JSON.stringify(addEventData));
log("Info", " addEpic(sprintId, cropcode) is used Modify the existing module");
......@@ -492,7 +513,7 @@ export default class Calendar extends Component {
// alert("Target Date shouild not exceed Sprint target date");
// }
else {
if (this.isValid()) {
if (this.isValid1()) {
this.setState({ itemPressedDisabled: true })
fetch(API + 'calendar.php',
{
......@@ -502,8 +523,8 @@ export default class Calendar extends Component {
'Content-Type': 'application/json',
},
body: JSON.stringify({
current: addEventData,
action: "EditOccurrence",
current: editEventData,
action: "InsertUpdate",
// idea_id: idea_id,
corp_code: cropcode,
......@@ -517,17 +538,13 @@ export default class Calendar extends Component {
.then((response) => response.json())
.then((responseJson) => {
console.log(responseJson)
alert(JSON.stringify(responseJson))
// alert(JSON.stringify(responseJson))
if (responseJson.status == 'True') {
this.setState({ open: false });
this.setState({
itemPressedDisabled: false,
isVisible: !this.state.isVisible,
title: '',
location: '',
startDate: '',
targetDate: '',
eventdescription: '',
})
//Navigate to AddModule screen
......@@ -742,7 +759,7 @@ export default class Calendar extends Component {
<Text style={{ color: 'red' }}>{this.state.error2}</Text>
<TextInput placeholder="Title" style={{ width: '90%', borderBottomWidth: 0.5, borderBottomColor: 'black' }}
value={this.state.event.title}
onChangeText={(text) => this.setState({ title: text })}></TextInput>
onChangeText={(title) => this.setState({ title: title })}></TextInput>
</View>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment