<%@include file="utils.jsp"%>
<html>
<head><title>Intranet biura podróży</title></head>
<body>
<h1>Intranet biura podróży</h1>
<%
URL rpcRouter = new URL(request.getParameter("rpcrouter"));
DateFormat dateFormat =
     DateFormat.getDateInstance(DateFormat.MEDIUM,Locale.US);
dateFormat.setLenient(true);
Date start = dateFormat.parse(request.getParameter("start")),
     end = dateFormat.parse(request.getParameter("end"));
String resource = request.getParameter("resource"),
       email = request.getParameter("email");
Vector params = new Vector();
params.addElement(new Parameter("name",
                                String.class,resource,null));
params.addElement(new Parameter("start",
                                Date.class,start,null));
params.addElement(new Parameter("end",
                                Date.class,end,null));
params.addElement(new Parameter("email",
                                String.class,email,null));
Response rsp = rpcCall(rpcRouter,"bookResource",params);
if(!rsp.generatedFault()) {
%>
<table>
<tr><td colspan="2" valign="top">Rezerwacja potwierdzona</td></tr>
<tr><td valign="top">Nazwa:</td>
    <td valign="top"><%= resource %></td></tr>
<tr><td valign="top">Od:</td>
    <td valign="top"><%= start %></td></tr>
<tr><td valign="top">Do:</td>
    <td valign="top"><%= end %></td></tr>
</table>
<%
}
else {
   Fault fault = rsp.getFault();
%>
<table>
<tr><td>Error:</td><td><%= fault.getFaultString() %></td></tr>
<tr><td>Code:</td><td><%= fault.getFaultCode() %></td></tr>
</table>
<%
}
%>
<form action="index.jsp" method="post">
<input type="hidden" name="rpcrouter"
   value="<%= rpcRouter.toExternalForm() %>">
<input type="submit" value="Powrót do strony głównej">
</form>
</body>
</html>
