Advertisement
Guest User

Untitled

a guest
Oct 24th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.12 KB | None | 0 0
  1. populate: function (e){
  2. this.setState({ globalClass: window.globalValue})
  3. /*TEST CASES*/
  4. var studentNameArray = ['justin Samuels','thomas Owen','bob Pribe','thomas Owen','thomas Owen','thomas Owen','thomas Owen','thomas Owen','thomas Owen','thomas Owen','thomas Owen','thomas Owen','thomas Owen','thomas Owen','thomas Owen','thomas Owen','thomas Owen','thomas Owen','thomas Owen','thomas Owen','thomas Owen','thomas Owen','thomas Owen','thomas Owen','thomas Owen'];
  5. var studentID_Array = ['0001','0002','0003'];
  6.  
  7. /*
  8. var studentNameArray = [],
  9. studentID_Array = [],
  10.  
  11. var i = 0,
  12. searchStrName,
  13. searchStrNum,
  14. searchStudentName,
  15. searchStudentID;
  16.  
  17. this.props.returnedAll.map((current, index) =>{
  18. searchStrName = current.search(window.globalValue);
  19.  
  20. if(searchStrName > 0){
  21. searchStrName = current.search('!');
  22. searchStrNum = current.search('#');
  23.  
  24. searchStudentName = current.slice(searchStrName + 1,searchStrNum);
  25. studentNameArray[i] = searchStudentName;
  26.  
  27. searchStudentID = current.slice(searchStrNum + 1);
  28. studentID_Array[i] = searchStudentID;
  29.  
  30. i++;
  31. }
  32. })
  33. */
  34.  
  35. var StudentsNewObject = { };
  36. var LeftI = 10;
  37. var TopI = 0;
  38. for(var i = 0; i < studentNameArray.length; i++){
  39. for(var j = 0; j < 3; j++){
  40. StudentsNewObject [i] = { top: this.state.posTop + TopI, left:((this.state.posLeft + 10) + LeftI), studentName: studentNameArray[i], idTag: studentID_Array[i] } ;
  41. LeftI += 120;
  42. i++;
  43. console.log( StudentsNewObject [i]);
  44. }
  45. LeftI = 10;
  46. TopI += 110;
  47. }
  48. var StudentsCopyObject = this.state.Students;
  49. var studentMergeObject = Object.assign(StudentsCopyObject,StudentsNewObject);
  50. console.log(studentMergeObject);
  51. this.setState({ Students: studentMergeObject });
  52. // $("#bank").append(this.state.students);
  53.  
  54.  
  55. },
  56.  
  57. render:function() {
  58. const { Students } = this.state;
  59. var connectDropTarget = this.props.connectDropTarget;
  60. return connectDropTarget(
  61. <div>
  62. <div className = "col">
  63. <h1>Create Your Seating Chart</h1>
  64. <div className = "cont">
  65. <h2>Select Your Class:</h2><br/><br/>
  66. <h2>Enter The Tests Proctor Name:</h2>
  67. <input classname = "textBox" ref = "Instructor" onChange = {this.handleChange} type = "text" /> <br /><br />
  68. <input className = "button" type = "button" onClick = {this.populate} value = "POPULATE"/>
  69. <input className = "button" type = "button" onClick = {this.reset} value = "RESET" /><br />
  70. <input style = {{ marginLeft: '18%' }} className = "button" type = "button" onClick = { this.print } value = "CAPTURE" />
  71. </div>
  72. </div>
  73.  
  74. <div className = "col">
  75.  
  76. </div>
  77. <div className = "col">
  78. <h2 style = {{ color: '#ED1C24'}}>{this.state.globalClass}</h2><br />
  79. <h3 style = {{ marginTop: '-7%'}}>Instructor: <b></b></h3>
  80. <h3 style = {{ marginTop: '-4%' }}>Proctor:<b>{this.state.Instructor}</b></h3>
  81. <div className = "currentSel">
  82. <h1>Current Selection:</h1>
  83. <h2 style = {{ color: '#ED1C24', marginTop: '-4%'}}>{this.state.studentName}</h2>
  84. {/* <h3 style = {{ marginTop: '-4%'}}>ID:{this.state.studentID}</h3> <br /><br /> */}
  85. </div>
  86. <h2><b>STUDENT BANK</b></h2>
  87. <div style = {{background: 'blue'}} id = "bank">
  88. </div>
  89.  
  90. <div id = "boom" style = {{background: 'blue', position: 'static', overflowY: 'scroll'}}>
  91. {
  92. Object.keys(Students).map(key =>{
  93. const { left, top, title, studentName, idTag } = Students[key];
  94. return(
  95. <div key = {key}>
  96. <Student id = {key} left = {left}
  97. top = {top} studentName = {studentName} idTag = {idTag} ></Student>
  98. </div>
  99. );})}
  100. </div>
  101. </div>
  102. </div>
  103. );
  104. }
  105. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement