<!-- Group 6 Scheduler
     Author: Peter Park
     form.jsp
     Display the web form to the user and get inputted times.
-->

<%@ page import="java.util.*" %>
<%@ page import="com.example.model.*" %>

<html>
<head>
<title>Group 6 A07 Scheduler Form</title>

<script type="text/javascript">
function submitflag()
{
var flag = document.getElementById("formflag");
flag.value=0;
}
function addflag()
{
var flag = document.getElementById("formflag");
flag.value=1;
}
function endflag()
{
var flag = document.getElementById("formflag");
flag.value=2;
}
</script>

</head>

<body>
<h1>Add/Edit Schedule </h1>
<form method="post" action="SchedulerAdd.do">
<p>Pick a color for the background:<br />
<input type="button" onClick="document.bgColor='lightblue'" name="Blue" value="Blue">
<input type="button" onClick="document.bgColor='lightgreen'" name="Green" value="Green">
<input type="button" onClick="document.bgColor='white'" name="White" value="White">
<input type="button" onClick="document.bgColor='lightyellow'" name="Yellow" value="Yellow">
</p>
<hr />
  <p>Check those days which you are completely unable to meet:<br />
  <input type="checkbox" name="mon" value="1">Mon 
  <input type="checkbox" name="tues" value="1">Tues 
  <input type="checkbox" name="wed" value="1">Wed 
  <input type="checkbox" name="thurs" value="1">Thurs 
  <input type="checkbox" name="fri" value="1">Fri
  <input type="checkbox" name="sat" value="1">Sat 
  <input type="checkbox" name="sun" value="1">Sun 
  <input type="hidden" name="firstform" value="88" id="firstform">
  <input type="submit" name="Add" value="Add"> 
  </p>
</form>
<form method="post" action="SchedulerAdd.do">
<p>Enter your global constraints:</p>
 <table width="335" border="0">
    <tr> 
      <td width="51"><b>Start Hour</b></td>
      <td width="57"><b>Start Minute</b></td>
      <td width="58"><b>AM/PM</b></td>
      <td width="48"><b>End Hour</b></td>
      <td width="56"><b>End Minute</b></td>
      <td width="58"><b>AM/PM</b></td>
    </tr>
    <tr> 
      <td width="51"> 
        <select name="shour1">
          <option value="01" selected="selected">1</option>
          <option value="02">2</option>
          <option value="03">3</option>
          <option value="04">4</option>
          <option value="05">5</option>
          <option value="06">6</option>
          <option value="07">7</option>
          <option value="08">8</option>
          <option value="09">9</option>
          <option value="10">10</option>
          <option value="11">11</option>
          <option value="12">12</option>
        </select>
      </td>
      <td width="57"> 
        <select name="sminute1">
          <option value="00" selected="selected">00</option>
          <option value="01">1</option>
          <option value="02">2</option>
          <option value="03">3</option>
          <option value="04">4</option>
          <option value="05">5</option>
          <option value="06">6</option>
          <option value="07">7</option>
          <option value="08">8</option>
          <option value="09">9</option>
          <option value="10">10</option>
          <option value="11">11</option>
          <option value="12">12</option>
          <option value="13">13</option>
          <option value="14">14</option>
          <option value="15">15</option>
          <option value="16">16</option>
          <option value="17">17</option>
          <option value="18">18</option>
          <option value="19">19</option>
          <option value="20">20</option>
          <option value="21">21</option>
          <option value="22">22</option>
          <option value="23">23</option>
          <option value="24">24</option>
          <option value="25">25</option>
          <option value="26">26</option>
          <option value="27">27</option>
          <option value="28">28</option>
          <option value="29">29</option>
          <option value="30">30</option>
          <option value="31">31</option>
          <option value="32">32</option>
          <option value="33">33</option>
          <option value="34">34</option>
          <option value="35">35</option>
          <option value="36">36</option>
          <option value="37">37</option>
          <option value="38">38</option>
          <option value="39">39</option>
          <option value="40">40</option>
          <option value="41">41</option>
          <option value="42">42</option>
          <option value="43">43</option>
          <option value="44">44</option>
          <option value="45">45</option>
          <option value="46">46</option>
          <option value="47">47</option>
          <option value="48">48</option>
          <option value="49">49</option>
          <option value="50">50</option>
          <option value="51">51</option>
          <option value="52">52</option>
          <option value="53">53</option>
          <option value="54">54</option>
          <option value="55">55</option>
          <option value="56">56</option>
          <option value="57">57</option>
          <option value="58">58</option>
          <option value="59">59</option>
        </select>
      </td>
      <td width="58"> 
        <select name="ampm11">
          <option value="AM" selected="selected">AM</option>
          <option value="PM">PM</option>
        </select>
      </td>
      <td width="48"> 
        <select name="ehour1">
          <option value="01" selected="selected">1</option>
          <option value="02">2</option>
          <option value="03">3</option>
          <option value="04">4</option>
          <option value="05">5</option>
          <option value="06">6</option>
          <option value="07">7</option>
          <option value="08">8</option>
          <option value="09">9</option>
          <option value="10">10</option>
          <option value="11">11</option>
          <option value="12">12</option>
        </select>
      </td>
      <td width="56"> 
        <select name="eminute1">
          <option value="00" selected="selected">00</option>
          <option value="01">1</option>
          <option value="02">2</option>
          <option value="03">3</option>
          <option value="04">4</option>
          <option value="05">5</option>
          <option value="06">6</option>
          <option value="07">7</option>
          <option value="08">8</option>
          <option value="09">9</option>
          <option value="10">10</option>
          <option value="11">11</option>
          <option value="12">12</option>
          <option value="13">13</option>
          <option value="14">14</option>
          <option value="15">15</option>
          <option value="16">16</option>
          <option value="17">17</option>
          <option value="18">18</option>
          <option value="19">19</option>
          <option value="20">20</option>
          <option value="21">21</option>
          <option value="22">22</option>
          <option value="23">23</option>
          <option value="24">24</option>
          <option value="25">25</option>
          <option value="26">26</option>
          <option value="27">27</option>
          <option value="28">28</option>
          <option value="29">29</option>
          <option value="30">30</option>
          <option value="31">31</option>
          <option value="32">32</option>
          <option value="33">33</option>
          <option value="34">34</option>
          <option value="35">35</option>
          <option value="36">36</option>
          <option value="37">37</option>
          <option value="38">38</option>
          <option value="39">39</option>
          <option value="40">40</option>
          <option value="41">41</option>
          <option value="42">42</option>
          <option value="43">43</option>
          <option value="44">44</option>
          <option value="45">45</option>
          <option value="46">46</option>
          <option value="47">47</option>
          <option value="48">48</option>
          <option value="49">49</option>
          <option value="50">50</option>
          <option value="51">51</option>
          <option value="52">52</option>
          <option value="53">53</option>
          <option value="54">54</option>
          <option value="55">55</option>
          <option value="56">56</option>
          <option value="57">57</option>
          <option value="58">58</option>
          <option value="59">59</option>
        </select>
      </td>
      <td width="58"> 
        <select name="ampm1">
          <option value="AM" selected="selected">AM</option>
          <option value="PM">PM</option>
        </select>
      </td>
    </tr>
  </table>
  <input type="hidden" name="thirdform" value="99" id="thirdform">
    <input type="submit" name="Add Global Constraint" value="Add Global Constraint"> 
</form>
<p>Add your busy times here:</p>
<form method="post" action="SchedulerAdd.do">
 
  <table width="385" border="0">
    <tr> 
      <td width="89"><b>Day</b></td>
      <td width="51"><b>Start Hour</b></td>
      <td width="57"><b>Start Minute</b></td>
      <td width="58"><b>AM/PM</b></td>
      <td width="48"><b>End Hour</b></td>
      <td width="56"><b>End Minute</b></td>
      <td width="58"><b>AM/PM</b></td>
    </tr>
    <tr> 
      <td width="89"> 
        <select name="day1">
          <option value="1" selected="selected">Monday</option>
          <option value="2">Tuesday</option>
          <option value="3">Wednesday</option>
          <option value="4">Thursday</option>
          <option value="5">Friday</option>
          <option value="6">Saturday</option>
          <option value="0">Sunday</option>
        </select>
      </td>
      <td width="51"> 
        <select name="shour1">
          <option value="01" selected="selected">1</option>
          <option value="02">2</option>
          <option value="03">3</option>
          <option value="04">4</option>
          <option value="05">5</option>
          <option value="06">6</option>
          <option value="07">7</option>
          <option value="08">8</option>
          <option value="09">9</option>
          <option value="10">10</option>
          <option value="11">11</option>
          <option value="12">12</option>
        </select>
      </td>
      <td width="57"> 
        <select name="sminute1">
          <option value="00" selected="selected">00</option>
          <option value="01">1</option>
          <option value="02">2</option>
          <option value="03">3</option>
          <option value="04">4</option>
          <option value="05">5</option>
          <option value="06">6</option>
          <option value="07">7</option>
          <option value="08">8</option>
          <option value="09">9</option>
          <option value="10">10</option>
          <option value="11">11</option>
          <option value="12">12</option>
          <option value="13">13</option>
          <option value="14">14</option>
          <option value="15">15</option>
          <option value="16">16</option>
          <option value="17">17</option>
          <option value="18">18</option>
          <option value="19">19</option>
          <option value="20">20</option>
          <option value="21">21</option>
          <option value="22">22</option>
          <option value="23">23</option>
          <option value="24">24</option>
          <option value="25">25</option>
          <option value="26">26</option>
          <option value="27">27</option>
          <option value="28">28</option>
          <option value="29">29</option>
          <option value="30">30</option>
          <option value="31">31</option>
          <option value="32">32</option>
          <option value="33">33</option>
          <option value="34">34</option>
          <option value="35">35</option>
          <option value="36">36</option>
          <option value="37">37</option>
          <option value="38">38</option>
          <option value="39">39</option>
          <option value="40">40</option>
          <option value="41">41</option>
          <option value="42">42</option>
          <option value="43">43</option>
          <option value="44">44</option>
          <option value="45">45</option>
          <option value="46">46</option>
          <option value="47">47</option>
          <option value="48">48</option>
          <option value="49">49</option>
          <option value="50">50</option>
          <option value="51">51</option>
          <option value="52">52</option>
          <option value="53">53</option>
          <option value="54">54</option>
          <option value="55">55</option>
          <option value="56">56</option>
          <option value="57">57</option>
          <option value="58">58</option>
          <option value="59">59</option>
        </select>
      </td>
      <td width="58"> 
        <select name="ampm11">
          <option value="AM" selected="selected">AM</option>
          <option value="PM">PM</option>
        </select>
      </td>
      <td width="48"> 
        <select name="ehour1">
          <option value="01" selected="selected">1</option>
          <option value="02">2</option>
          <option value="03">3</option>
          <option value="04">4</option>
          <option value="05">5</option>
          <option value="06">6</option>
          <option value="07">7</option>
          <option value="08">8</option>
          <option value="09">9</option>
          <option value="10">10</option>
          <option value="11">11</option>
          <option value="12">12</option>
        </select>
      </td>
      <td width="56"> 
        <select name="eminute1">
          <option value="00" selected="selected">00</option>
          <option value="01">1</option>
          <option value="02">2</option>
          <option value="03">3</option>
          <option value="04">4</option>
          <option value="05">5</option>
          <option value="06">6</option>
          <option value="07">7</option>
          <option value="08">8</option>
          <option value="09">9</option>
          <option value="10">10</option>
          <option value="11">11</option>
          <option value="12">12</option>
          <option value="13">13</option>
          <option value="14">14</option>
          <option value="15">15</option>
          <option value="16">16</option>
          <option value="17">17</option>
          <option value="18">18</option>
          <option value="19">19</option>
          <option value="20">20</option>
          <option value="21">21</option>
          <option value="22">22</option>
          <option value="23">23</option>
          <option value="24">24</option>
          <option value="25">25</option>
          <option value="26">26</option>
          <option value="27">27</option>
          <option value="28">28</option>
          <option value="29">29</option>
          <option value="30">30</option>
          <option value="31">31</option>
          <option value="32">32</option>
          <option value="33">33</option>
          <option value="34">34</option>
          <option value="35">35</option>
          <option value="36">36</option>
          <option value="37">37</option>
          <option value="38">38</option>
          <option value="39">39</option>
          <option value="40">40</option>
          <option value="41">41</option>
          <option value="42">42</option>
          <option value="43">43</option>
          <option value="44">44</option>
          <option value="45">45</option>
          <option value="46">46</option>
          <option value="47">47</option>
          <option value="48">48</option>
          <option value="49">49</option>
          <option value="50">50</option>
          <option value="51">51</option>
          <option value="52">52</option>
          <option value="53">53</option>
          <option value="54">54</option>
          <option value="55">55</option>
          <option value="56">56</option>
          <option value="57">57</option>
          <option value="58">58</option>
          <option value="59">59</option>
        </select>
      </td>
      <td width="58"> 
        <select name="ampm1">
          <option value="AM" selected="selected">AM</option>
          <option value="PM">PM</option>
        </select>
      </td>
    </tr>
  </table>
  <p>   
  <input type="hidden" name="formflag" value="-1" id="formflag">
    <input type="submit" name="Add" value="Add Event" onClick="addflag()">    
  </p>
  <hr />
  <p> 
  <%   
    String days[] = 
     	{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
        "Saturday"};	  
    if(request.getAttribute("eventqueue") != null)
    { 
    LinkedList<Event> EventsQ = (LinkedList<Event>)request.getAttribute("eventqueue");
    		for(int count=0;count<EventsQ.size();count++)
    		{
    		Event firstevent = EventsQ.get(count);
    		out.print(days[firstevent.getID()] + " Starting at " + firstevent.getStartTime() + " to " + firstevent.getEndTime() + "<br />");
    		}
    }

  %>
    <input type="submit" name="Submit" value="Submit" onClick="submitflag()">
    <input type="submit" name="Clear Schedule" value="Clear Schedule" onClick="endflag()">
  </p>
  <p>
  <a href="editSchedule.html">EDIT SCHEDULE</a>
</form>


</body>
</html>
