diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/BetweenEditor.js b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/BetweenEditor.js index 644620bc7655a8ab4a00b9e3e2ee1aff7d5e44bf..f82de002593b6c8555798e5a41e9f1c778e060dc 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/BetweenEditor.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/BetweenEditor.js @@ -61,56 +61,50 @@ export default class BetweenEditor extends Component { }); } - - /*isCancelAfterEnd(){console.log('after') - console.log('called') - this.copyDateValue(); - }*/ /** * Call the function on click Esc or Close the dialog */ -async copyDateValue(){ - let consolidateDates = ''; - this.state.rowData.map(row =>{ - if((row['from'] !== '' && row['from'] !== 'undefined') && (row['until'] !== '' && row['until'] !== 'undefined')){ - consolidateDates += ((row['from'] !== '')?moment(row['from']).format(DATE_TIME_FORMAT):'' )+","+((row['until'] !== '')?moment(row['until']).format(DATE_TIME_FORMAT):'')+"|"; - } - }); - await this.props.context.componentParent.updateTime( - this.props.node.rowIndex,this.props.colDef.field, consolidateDates - ); - this.setState({ showDialog: false}); - -} + async copyDateValue(){ + let consolidateDates = ''; + this.state.rowData.map(row =>{ + if((row['from'] !== '' && row['from'] !== 'undefined') && (row['until'] !== '' && row['until'] !== 'undefined')){ + consolidateDates += ((row['from'] !== '')?moment(row['from']).format(DATE_TIME_FORMAT):'' )+","+((row['until'] !== '')?moment(row['until']).format(DATE_TIME_FORMAT):'')+"|"; + } + }); + await this.props.context.componentParent.updateTime( + this.props.node.rowIndex,this.props.colDef.field, consolidateDates + ); + this.setState({ showDialog: false}); + } -/* - Set value in relevant field - */ -updateDateChanges(rowIndex, field, e){ - let tmpRows = this.state.rowData; - let row = tmpRows[rowIndex]; - row[field] = e.value; - tmpRows[rowIndex] = row; - if(this.state.rowData.length === rowIndex+1){ - let line = {'from': '', 'until': ''}; - tmpRows.push(line); + /* + Set value in relevant field + */ + updateDateChanges(rowIndex, field, e){ + let tmpRows = this.state.rowData; + let row = tmpRows[rowIndex]; + row[field] = e.value; + tmpRows[rowIndex] = row; + if(this.state.rowData.length === rowIndex+1){ + let line = {'from': '', 'until': ''}; + tmpRows.push(line); + } + this.setState({ + rowData: tmpRows + }); } - this.setState({ - rowData: tmpRows - }) -} -/* - Remove the the row from dialog -*/ -removeInput(rowIndex){ - let tmpRows = this.state.rowData; - delete tmpRows[rowIndex]; - this.setState({ - rowData: tmpRows - }) -} + /* + Remove the the row from dialog + */ + removeInput(rowIndex){ + let tmpRows = this.state.rowData; + delete tmpRows[rowIndex]; + this.setState({ + rowData: tmpRows + } ); + } render() { return ( diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/CustomDateComponent.js b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/CustomDateComponent.js index 7e0c18e9b6926bb138c3c6b7667d67f7fa76d930..5d90aeb89f6636d1b733d66910ce716e89a79d35 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/CustomDateComponent.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/CustomDateComponent.js @@ -103,12 +103,9 @@ export default class CustomDateComponent extends Component { // LINKING THE UI, THE STATE AND AG-GRID //********************************************************************************* onDateChanged = (selectedDates) => { - //console.log('>>', selectedDates[0]) this.props.context.componentParent.updateTime( this.props.node.rowIndex,this.props.colDef.field,selectedDates[0] ); - - // this.updateAndNotifyAgGrid(selectedDates[0]); }; } \ No newline at end of file diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/MultiSelector.js b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/MultiSelector.js index 5d420bfd8f2f9073d62103079bbfeed9dd1d9908..d3a2ed7731855b86d38c030c219cac7a28932223 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/MultiSelector.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/MultiSelector.js @@ -7,16 +7,10 @@ export default class SkySllector extends Component { super(props); this.dailyOptions= []; - /* - {name: 'require_day', value: 'require_day'}, - {name: 'require_night', value: 'require_night'}, - {name: 'avoid_twilight', value: 'avoid_twilight'}, - ];*/ this.state= { daily: [], dailyOptions: [], } - this.callbackUpdateDailyCell = this.callbackUpdateDailyCell.bind(this); } 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 4b58f3211bb843d7dfa1c8c05673d260c70ba9df..229c4a9ed8acb5183d7840c4e4f1dc1ba9722e72 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Cycle/create.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Cycle/create.js @@ -511,7 +511,7 @@ export class CycleCreate extends Component { </Dialog> <CustomDialog type="confirmation" visible={this.state.showDialog} width="40vw" - header={'Edit Cycle'} message={'Leave this page? Changes you made may not be saved.'} + header={'Add Cycle'} message={'Leave this page? Changes you made may not be saved.'} content={''} onClose={this.close} onCancel={this.close} onSubmit={this.cancelCreate}> </CustomDialog> </div> diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/create.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/create.js index 500e4f98f705ef78061cc6fab54cc39d1dce87e5..76fb2647fe19a6d81469abadb51a2a7ff994aa48 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/create.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/create.js @@ -609,7 +609,7 @@ export class ProjectCreate extends Component { </Dialog> <CustomDialog type="confirmation" visible={this.state.showDialog} width="40vw" - header={'Edit Cycle'} message={'Leave this page? Changes you made may not be saved.'} + header={'Add Project'} message={'Leave this page? Changes you made may not be saved.'} content={''} onClose={this.close} onCancel={this.close} onSubmit={this.cancelCreate}> </CustomDialog> </div> diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js index 92ff3b59c768d74a7cadd7f3a372bfb9652bf082..c36512684266e246fa31bbe14ef31581d0f65c18 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Project/edit.js @@ -622,7 +622,7 @@ export class ProjectEdit extends Component { </Dialog> <CustomDialog type="confirmation" visible={this.state.showDialog} width="40vw" - header={'Edit Cycle'} message={'Leave this page? Changes you made may not be saved.'} + header={'Edit Project'} message={'Leave this page? Changes you made may not be saved.'} content={''} onClose={this.close} onCancel={this.close} onSubmit={this.cancelEdit}> </CustomDialog> </div> diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js index f5d9efeee31e130e9260b1b289287d0c99ae3078..6cb9afb042c82b0261f99e867272c26ec7af87dd 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js @@ -573,7 +573,7 @@ export class EditSchedulingUnit extends Component { <div className="p-grid" data-testid="confirm_dialog"> <CustomDialog type="confirmation" visible={this.state.showDialog} width="40vw" - header={'Edit Cycle'} message={'Leave this page? Changes you made may not be saved.'} + header={'Edit Scheduling Unit'} message={'Leave this page? Changes you made may not be saved.'} content={''} onClose={this.close} onCancel={this.close} onSubmit={this.cancelCreate}> </CustomDialog> </div> diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.scheduleset.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.schedulingset.js similarity index 99% rename from SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.scheduleset.js rename to SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.schedulingset.js index 385a04d7c66520322d0bb944a636956879a2be8d..46acb442ece3f6153de23c828ce7c1096eba7f4b 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.scheduleset.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.schedulingset.js @@ -53,18 +53,12 @@ export class SchedulingSetCreate extends Component { this.tmpRowData = []; this.daily = []; this.dailyOption = []; - this.isNewSet = false; //this.dialogMsg = ''; //this.dialogType = ''; //this.callBackFunction = ''; - - this.state = { - selectedProject: {}, - showAddSet: false, - copyHeader: false, // Copy Table Header to clipboard applyEmptyValue: false, dailyOption: [], @@ -500,9 +494,7 @@ export class SchedulingSetCreate extends Component { schema = await this.resolveSchema(schema); let constraintSchema = await this.getConstraintSchema(scheduleUnit); constraintSchema = await this.resolveSchema(constraintSchema); - // AG Grid Cell Specific Properties - let dailyProps = Object.keys( constraintSchema.schema.properties.daily.properties); this.daily = []; this.dailyOption = []; @@ -1637,7 +1629,7 @@ export class SchedulingSetCreate extends Component { this.dialogMsg = 'No valid Scheduling Unit found !'; this.dialogType = 'warning'; this.onClose = () => { - this.setState({confirmDialogVisible: false, showAddSet: false}); + this.setState({confirmDialogVisible: false}); }; this.setState({ confirmDialogVisible: true, @@ -1656,10 +1648,10 @@ export class SchedulingSetCreate extends Component { this.state.gridApi.redrawRows(); this.showIcon = true; this.onCancel = () => { - this.setState({confirmDialogVisible: false, showAddSet: false}); + this.setState({confirmDialogVisible: false}); }; this.onClose = () => { - this.setState({confirmDialogVisible: false, showAddSet: false}); + this.setState({confirmDialogVisible: false}); }; this.dialogType = "confirmation"; this.dialogHeader = "Save Scheduling Unit(s)"; @@ -2328,7 +2320,7 @@ export class SchedulingSetCreate extends Component { } close(){ - this.setState({/*saveDialogVisible: false,*/ confirmDialogVisible: false, showAddSet: false}); + this.setState({confirmDialogVisible: false}); } showAddSchedulingSet() { diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/schedulingset.create.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/schedulingset.create.js index ec2f038f949cf301b291fcfbf61dc8f4339a04dd..94f205629b8afec137bb323f4046d1c84a59db38 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/schedulingset.create.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/schedulingset.create.js @@ -149,57 +149,57 @@ export class SchedulingSet extends Component { render() { return ( <> - <Growl ref={(el) => this.growl = el} /> - <CustomDialog type="success" visible={this.state.dialogVisible} width="60vw" - header={'Add Scheduling Set'} - message= {<React.Fragment> - <div className="p-fluid"> - <div className="p-field p-grid"> - <label htmlFor="project" className="col-lg-2 col-md-2 col-sm-12">Project</label> - <span className="col-lg-4 col-md-4 col-sm-12" style={{fontWeight: 'bold'}}>{this.state.projectName} </span> - <label className={(this.state.errors.project)?"error":"info"}> - {this.state.errors.project ? this.state.errors.project : ""} - </label> - </div> - </div> - <div className="col-lg-1 col-md-1 col-sm-12"></div> - <div className="p-fluid"> - <div className="p-field p-grid"> - <label htmlFor="project" className="col-lg-2 col-md-2 col-sm-12">Name <span style={{color:'red'}}>*</span></label> - <div className="col-lg-4 col-md-4 col-sm-12"> - <InputText className={(this.state.errors.name) ?'input-error':''} - id="suSetName" - tooltip="Enter name of the Scheduling Set" tooltipOptions={this.tooltipOptions} maxLength="128" - ref={input => {this.nameInput = input;}} - onChange={(e) => this.setSchedulingSetParams('name', e.target.value)} - onBlur={(e) => this.setSchedulingSetParams('name', e.target.value)} - value={this.state.schedulingSet.name} autoFocus - /> - <label className={(this.state.errors.name)?"error":"info"}> - {this.state.errors.name? this.state.errors.name : "Max 128 characters"} - </label> + <Growl ref={(el) => this.growl = el} /> + <CustomDialog type="success" visible={this.state.dialogVisible} width="60vw" + header={'Add Scheduling Set'} + message= { + <React.Fragment> + <div className="p-fluid"> + <div className="p-field p-grid"> + <label htmlFor="project" className="col-lg-2 col-md-2 col-sm-12">Project</label> + <span className="col-lg-4 col-md-4 col-sm-12" style={{fontWeight: 'bold'}}>{this.state.projectName} </span> + <label className={(this.state.errors.project)?"error":"info"}> + {this.state.errors.project ? this.state.errors.project : ""} + </label> + </div> </div> - - <label htmlFor="description" className="col-lg-2 col-md-2 col-sm-12">Description <span style={{color:'red'}}>*</span></label> - <div className="col-lg-4 col-md-4 col-sm-12"> - <InputTextarea className={(this.state.errors.description) ?'input-error':''} rows={3} cols={30} - tooltip="Longer description of the Scheduling Set" maxLength="128" - value={this.state.schedulingSet.description} - onChange={(e) => this.setSchedulingSetParams('description', e.target.value)} - onBlur={(e) => this.setSchedulingSetParams('description', e.target.value)} - /> - <label className={(this.state.errors.description) ?"error":"info"}> - {(this.state.errors.description) ? this.state.errors.description : "Max 255 characters"} - </label> + <div className="col-lg-1 col-md-1 col-sm-12"></div> + <div className="p-fluid"> + <div className="p-field p-grid"> + <label htmlFor="project" className="col-lg-2 col-md-2 col-sm-12">Name <span style={{color:'red'}}>*</span></label> + <div className="col-lg-4 col-md-4 col-sm-12"> + <InputText className={(this.state.errors.name) ?'input-error':''} + id="suSetName" + tooltip="Enter name of the Scheduling Set" tooltipOptions={this.tooltipOptions} maxLength="128" + ref={input => {this.nameInput = input;}} + onChange={(e) => this.setSchedulingSetParams('name', e.target.value)} + onBlur={(e) => this.setSchedulingSetParams('name', e.target.value)} + value={this.state.schedulingSet.name} autoFocus + /> + <label className={(this.state.errors.name)?"error":"info"}> + {this.state.errors.name? this.state.errors.name : "Max 128 characters"} + </label> + </div> + + <label htmlFor="description" className="col-lg-2 col-md-2 col-sm-12">Description <span style={{color:'red'}}>*</span></label> + <div className="col-lg-4 col-md-4 col-sm-12"> + <InputTextarea className={(this.state.errors.description) ?'input-error':''} rows={3} cols={30} + tooltip="Longer description of the Scheduling Set" maxLength="128" + value={this.state.schedulingSet.description} + onChange={(e) => this.setSchedulingSetParams('description', e.target.value)} + onBlur={(e) => this.setSchedulingSetParams('description', e.target.value)} + /> + <label className={(this.state.errors.description) ?"error":"info"}> + {(this.state.errors.description) ? this.state.errors.description : "Max 255 characters"} + </label> + </div> + </div> </div> - </div> - </div> - - </React.Fragment>} - content={''} onClose={this.props.onCancel} onCancel={this.props.onCancel} onSubmit={this.saveSU} showAction={true} - actions={this.actions} - showIcon={false}> - </CustomDialog> + </React.Fragment>} + content={''} onClose={this.props.onCancel} onCancel={this.props.onCancel} onSubmit={this.saveSU} showAction={true} + actions={this.actions} + showIcon={false}> + </CustomDialog> </> ); } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/index.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/index.js index 94d58b7eae7c18417a43f724b300127418ffd788..afe449b4d5daa05d04f2207a4647a8dd5ba397a0 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/index.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/index.js @@ -15,7 +15,7 @@ import SchedulingUnitCreate from './Scheduling/create'; import EditSchedulingUnit from './Scheduling/edit'; import { CycleList, CycleCreate, CycleView, CycleEdit } from './Cycle'; import { TimelineView, WeekTimelineView, ReservationCreate, ReservationList } from './Timeline'; -import SchedulingSetCreate from './Scheduling/excelview.scheduleset'; +import SchedulingSetCreate from './Scheduling/excelview.schedulingset'; import Workflow from './Workflow'; export const routes = [