forked from Nobody9810/React-Event
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheventObject.js
157 lines (142 loc) · 4.35 KB
/
eventObject.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
// THE EVENT OBJECT MODEL
/*
REQUIREMENTS:
1. It contains 30/31 days based on the month of the
year. (ATTAINED USING THE DATE CONSTRUCTOR)
2. Each event is a full day event. (initialized)
3. Date and time are crucial to avoid clashes for multiple seminars in the same venue, date and time. (initialized)
4. First comes, first served basis. (Not yet) needs if else statements or it can be replaced by visual illustration of the information
5. The event is operating from 8am until 5pm. (RECHECK)
*/
// REQUIRED VARIABLES
/**
* WE SUPPOSEDLY GOING TO DECLARE ONE VARIABLE WITH THE NAME 'id', FOR INTERNAL MONGODB USE IF NEEDED
*/
import React, { Component, Fragment, Table } from "react";
var EVENT = new EVENT();
let EVENT; // IT SHOULD REPRESENT A FULL DAY EVENT
var eventName; // HAVE A UNIQUE NAME FOR EACH EVENT OBJECT
const eventVenue = [
"KICT MAIN HALL",
"ECON MAIN HALL",
"LAW MAIN COURT",
"CAS",
];
// SPECIFYING FEW UNIQUE eventVenue ATTRIBUTE VALUES, TO STATE WHERE THE EVENT IS TAKING ACTION
/*
* MAKING USE OF THE JS UTILITY PROVIDED, THE DATE CONSTRUCTOR
* USUALLY IS IN THE FOLLOWING FORM >>> var Date = new Date();
*/
var Date;
var operatingStartTime; // THE STARTING POINT OF ANY EVENT
var operatingEndTime; // THE ENDING POINT OF ANY EVENT
class eventObject extends React.Component {
constructor() {
// DEFAULT CONSTRUCTOR
/**
* THE MAIN USAGE OF THE DEFAULT CONSTRUCTOR IS TO INITIALIZE THE SPECIFIC REQUIRED VALUE TYPES
* FOR ALL PREVIOUSLY DECLARED VARIABLES EACH BASED ON THEIR OWN UTILITY PURPOSES
*/
this.EVENT = {
eventName: "",
Date: Date(month, day, hours, minutes),
eventVenue: [""],
operatingStartTime: Time(hours, minutes),
operatingEndTime: Time(hours, minutes),
};
this.eventObjectView();
}
// constructor(EVENT){ // OVER-RIDE THE DEFAULT CONSTRUCTOR TO INTERACT WITH THE OBJECT MODEL
// this.EVENT = EVENT;
// }
// GETTERS AND SETTERS
get EVENT() {
return this.EVENT;
} // GETS EVENT OBJECT
set EVENT(EVENT) {
this.EVENT = EVENT;
} // SETS EVENT OBJECT
get eventName() {
return this.eventName;
} // GETS eventName ATTRIBUTE OF A PARTICULAR EVENT OBJECT
set eventName(eventName) {
this.eventName = eventName;
} // SETS eventName ATTRIBUTE OF A PARTICULAR EVENT OBJECT
get eventVenue() {
return this.eventVenue;
} // GETS eventVenue ATTRIBUTE OF A PARTICULAR EVENT OBJECT
set eventVenue(eventVenue) {
this.eventVenue = eventVenue;
} // SETS eventVenue ATTRIBUTE OF A PARTICULAR EVENT OBJECT
get Date() {
return this.Date;
} // GETS Date ATTRIBUTE CONSTRUCTOR FOR A PARTICULAR EVENT OBJECT
set Date(Date) {
this.Date = Date;
} // SETS Date ATTRIBUTE CONSTRUCTOR FOR A PARTICULAR EVENT OBJECT
get operatingStartTime() {
return this.operatingStartTime;
}
set operatingStartTime(operatingStartTime) {
this.operatingStartTime = operatingStartTime;
} // PLEASE, VALIDATE AND FIX IF NECESSARY
get operatingEndTime() {
return this.operatingEndTime;
}
set operatingEndTime(operatingEndTime) {
this.operatingEndTime = operatingEndTime;
} // PLEASE, VALIDATE AND FIX IF NECESSARY
eventObjectView = () => {
return (
<table>
<h1>Simple table to view the event {this.EVENT} object:</h1>
<tr>
<th>Attribute:</th>
<th>Information:</th>
</tr>
<tr>
<td>Event Name:</td>
<td>
<div>{this.EVENT.eventName}</div>
</td>
</tr>
<tr>
<td>Event Venue:</td>
<td>
<div>{this.EVENT.eventVenue}</div>
</td>
</tr>
<tr>
<td>Event Date:</td>
<td>
<div>{this.EVENT.Date}</div>
</td>
</tr>
<tr>
<td>Starting Time:</td>
<td>
<div>{this.EVENT.operatingStartTime}</div>
</td>
</tr>
<tr>
<td>Ending Time:</td>
<td>
<div>{this.EVENT.operatingEndTime}</div>
</td>
</tr>
</table>
);
};
}
export default eventObject;
/* HOW TO RETRIEVE DATE DATA
EVENT.getFullYear();
EVENT.getMonth();
EVENT.getDate();
EVENT.getDay();
EVENT.getHours();
EVENT.getMinutes();
EVENT.getSeconds();
EVENT.getMilliseconds();
EVENT.getTime();
*/