diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Cycle/create.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Cycle/create.js index cff9b0dac3fb117f9aee4c6c1e132562cc9f0890..a19189c81c18421b9a810a1d13ae86587f5f837d 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Cycle/create.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Cycle/create.js @@ -98,7 +98,8 @@ export class CycleCreate extends Component { let cycleQuota = this.state.cycleQuota; for (const resource of resources) { const conversionFactor = this.resourceUnitMap[resource.quantity_value]?this.resourceUnitMap[resource.quantity_value].conversionFactor:1; - cycleQuota[resource['name']] = this.cycleResourceDefaults[resource.name]/conversionFactor; + // cycleQuota[resource['name']] = this.cycleResourceDefaults[resource.name]/conversionFactor; + cycleQuota[resource['name']] = 0; } return cycleQuota; } @@ -224,7 +225,7 @@ export class CycleCreate extends Component { if(this.state.cycle['start'] && this.state.cycle['stop']){ var isSameOrAfter = moment(this.state.cycle['stop']).isSameOrAfter(this.state.cycle['start']); if(!isSameOrAfter){ - errors['stop'] = ` Stop date should be after Start date`; + errors['stop'] = ` Stop date can not be before Start date`; validForm = false; }else{ validForm = true; @@ -241,6 +242,7 @@ export class CycleCreate extends Component { let cycleQuota = []; let cycle = this.state.cycle; let stoptime = _.replace(this.state.cycle['stop'],'00:00:00', '23:59:59'); + cycle['start'] = moment(cycle['start']).format("YYYY-MM-DDTHH:mm:ss"); cycle['stop'] = moment(stoptime).format("YYYY-MM-DDTHH:mm:ss"); this.setState({cycle: cycle}); for (const resource in this.state.cycleQuota) { @@ -296,7 +298,6 @@ export class CycleCreate extends Component { this.setState({ dialog: { header: '', detail: ''}, cycle: { - url: '', name: '', description: '', start: '', @@ -379,13 +380,14 @@ export class CycleCreate extends Component { d dateFormat="dd-M-yy" value= {this.state.cycle.start} onChange= {e => this.setCycleParams('start',e.value)} + onBlur= {e => this.setCycleParams('start',e.value)} data-testid="start" tooltip="Moment at which the cycle starts, that is, when its projects can run." tooltipOptions={this.tooltipOptions} showIcon={true} /> <label className={this.state.errors.start?"error":"info"}> - {this.state.errors.start ? this.state.errors.start : "Start Date is mandatory"} + {this.state.errors.start ? this.state.errors.start : ""} </label> </div> <div className="col-lg-1 col-md-1 col-sm-12"></div> @@ -395,13 +397,14 @@ export class CycleCreate extends Component { d dateFormat="dd-M-yy" value= {this.state.cycle.stop} onChange= {e => this.setCycleParams('stop', e.value)} + onBlur= {e => this.setCycleParams('stop',e.value)} data-testid="stop" tooltip="Moment at which the cycle officially ends." tooltipOptions={this.tooltipOptions} showIcon={true} /> <label className={this.state.errors.stop?"error":"info"}> - {this.state.errors.stop ? this.state.errors.stop : "Stop Date is mandatory"} + {this.state.errors.stop ? this.state.errors.stop : ""} </label> </div> </div>