1
00:00:01,650 --> 00:00:08,070
So now we want to make the world we built on this button, which goes to Bucaram and then pass some

2
00:00:08,070 --> 00:00:12,390
parameters, it passes the RIM ID, the start date and the end date.

3
00:00:12,690 --> 00:00:19,140
We need to set up a handler that takes that and then creates a special variable for a reservation stores

4
00:00:19,140 --> 00:00:22,440
that in the session and then takes us to the reservation page.

5
00:00:22,450 --> 00:00:23,240
And that's really easy.

6
00:00:23,250 --> 00:00:23,930
Let's do it now.

7
00:00:25,260 --> 00:00:31,980
So let's go over to our roots and create a room and we'll call this room.

8
00:00:32,160 --> 00:00:34,820
It'll be a get request or I'll just duplicate the previous line.

9
00:00:35,370 --> 00:00:38,970
It will be a get request to book Dasch room.

10
00:00:38,970 --> 00:00:44,100
And it's going to take us to a handler called Book Room, which doesn't exist yet, but we can go create

11
00:00:44,100 --> 00:00:44,290
that.

12
00:00:45,480 --> 00:00:53,550
So here in my handlers, let's create a function which will take the repository as a receiver and we'll

13
00:00:53,550 --> 00:00:54,720
call it book room.

14
00:00:55,320 --> 00:01:02,160
And as is the case with every handler, it has to have a response writer, which is a response writer.

15
00:01:04,380 --> 00:01:05,760
And a pointer to a request.

16
00:01:10,780 --> 00:01:15,880
All right, so that should fix the error in our rights file, and it does and what are we going to get

17
00:01:15,880 --> 00:01:16,060
here?

18
00:01:16,090 --> 00:01:19,240
Well, we're going to have to grab the values from the euro.

19
00:01:19,250 --> 00:01:29,860
And I know those are stored in parameters called ID s and E, so let's get the ID is equal to ideate

20
00:01:29,860 --> 00:01:31,670
an error because I'm actually going to.

21
00:01:33,470 --> 00:01:38,360
I have to pass it from a string to an end, and again, I'm just going to ignore the air for now is

22
00:01:38,360 --> 00:01:45,440
equal to our URL query doGet and on the name of the parameter, which is Edet.

23
00:01:46,670 --> 00:01:49,800
And of course, I want to convert that from a string to an end.

24
00:01:49,820 --> 00:01:59,210
So Pesters Seo Astar Seo in the dot a twohy and we'll put the parameter, the parentheses where they

25
00:01:59,210 --> 00:02:10,730
belong and now have the ID and will say the start date is equal to our new URL dot query douget which

26
00:02:10,730 --> 00:02:12,890
allows me to get a parameter, a get parameter.

27
00:02:13,070 --> 00:02:14,320
And this one is called S.

28
00:02:16,510 --> 00:02:17,410
And ending.

29
00:02:20,370 --> 00:02:28,770
This is a sign the value of our UFO query does not get E for end, and I'm pretty sure that's what I

30
00:02:28,770 --> 00:02:29,150
called them.

31
00:02:29,160 --> 00:02:30,020
Let's go make sure.

32
00:02:30,030 --> 00:02:34,900
So it's in the general's page s e and ID.

33
00:02:34,920 --> 00:02:36,500
Yes, that's exactly what I've called them.

34
00:02:36,690 --> 00:02:43,440
Now, just to make sure this works, before we go any further, let's just log this log print line D,

35
00:02:43,800 --> 00:02:47,800
which is uppercase ID, start date and end date.

36
00:02:48,420 --> 00:02:49,530
Let's make sure that works.

37
00:02:49,530 --> 00:02:52,440
So I'm going to start my application.

38
00:02:53,640 --> 00:02:54,690
Run my application.

39
00:02:56,720 --> 00:03:03,440
And I expect to see printed out right here in the terminal those three parameters once I click on this

40
00:03:03,440 --> 00:03:07,070
link, which fortunately I left active, so I should be able to just click on it.

41
00:03:08,420 --> 00:03:12,420
Page not found book dash room ID.

42
00:03:12,860 --> 00:03:13,690
I got something wrong.

43
00:03:13,700 --> 00:03:14,930
Let's go find out what's in the roots.

44
00:03:16,340 --> 00:03:18,860
Sagbo might want to spell room.

45
00:03:18,860 --> 00:03:19,190
Right.

46
00:03:19,220 --> 00:03:20,270
So let's start that over.

47
00:03:24,800 --> 00:03:31,340
And come back here and I should be able to just hit this hit, click in here and hit return, and I

48
00:03:31,340 --> 00:03:32,840
got a blank screen that's promising.

49
00:03:33,600 --> 00:03:38,470
Let's go back to our terminal and there is the ID, the start date and the end date.

50
00:03:38,480 --> 00:03:38,810
Good.

51
00:03:38,820 --> 00:03:41,000
So I know that you are out now.

52
00:03:41,000 --> 00:03:41,470
Works.

53
00:03:41,480 --> 00:03:42,650
Now, what am I going to do with this?

54
00:03:43,190 --> 00:03:44,240
Well, think about what we do.

55
00:03:44,240 --> 00:03:51,670
Let's see when we after we choose a room, when we post book, when we post make a reservation.

56
00:03:51,770 --> 00:03:56,750
It's at this point just before we display the make reservation page, we need to have some information.

57
00:03:56,760 --> 00:03:58,000
So let's go in there and see what we have.

58
00:03:58,460 --> 00:04:02,310
We have to have a sessional variable that is a reservation.

59
00:04:02,330 --> 00:04:05,960
OK, so I'm going to want to create a reservation and put it in the session.

60
00:04:06,260 --> 00:04:09,180
And that has to have some information.

61
00:04:09,350 --> 00:04:16,730
It has to have the start date, the end date, the room ID and the room name so we can do that.

62
00:04:16,820 --> 00:04:17,480
That's not hard.

63
00:04:17,510 --> 00:04:20,120
So let's go down here and get our room.

64
00:04:21,200 --> 00:04:23,090
First of all, let's create a variable call.

65
00:04:23,090 --> 00:04:27,800
A ver rez is of type models, dot reservation.

66
00:04:28,390 --> 00:04:33,790
Now I have an empty reservation so I can assign some things there right away and I need to put in red

67
00:04:33,920 --> 00:04:35,660
dot remedy.

68
00:04:36,050 --> 00:04:36,800
I have that.

69
00:04:37,010 --> 00:04:41,270
That's just the ID, which maybe I'll call remedy, just make it more readable.

70
00:04:41,450 --> 00:04:45,770
Room ID is equal to remedy.

71
00:04:47,030 --> 00:04:48,920
Then I need to put it in the start date in the end date.

72
00:04:48,980 --> 00:04:54,380
But remember the start date in the end date are actually in the format of time dot time.

73
00:04:54,380 --> 00:04:58,550
And we have lots of examples up here where we did precisely that.

74
00:04:58,550 --> 00:05:07,740
So let's just copy these, copy these three lines and come down here and we'll do that right here.

75
00:05:08,420 --> 00:05:14,180
So this expects the spring to the string to be called SD, so I'll just rename this to rename this to

76
00:05:14,180 --> 00:05:14,660
Eddie.

77
00:05:14,660 --> 00:05:18,350
And now I have them in the correct format, which means I can go resort.

78
00:05:18,350 --> 00:05:25,250
Start date is equal to start date and end date is equal to ending.

79
00:05:26,120 --> 00:05:28,790
So I have the remedy, the start date and the end date.

80
00:05:28,970 --> 00:05:29,950
What else do I need?

81
00:05:29,960 --> 00:05:35,030
The last piece of information I need is the room name, which we did up here.

82
00:05:35,030 --> 00:05:38,840
So we can just find that where we did it and copy it, paste it and we'll be good to go.

83
00:05:39,350 --> 00:05:41,480
So let's see where we did it up here.

84
00:05:47,370 --> 00:05:48,570
Which is fine room name.

85
00:05:51,350 --> 00:05:55,040
Right here, so we can copy these lines.

86
00:05:57,250 --> 00:06:02,140
Try that again, kopi these lines and pasted them down here.

87
00:06:07,820 --> 00:06:16,310
So rez remedies should just be remedy that gives me my room and then rez room, the room name equals

88
00:06:16,310 --> 00:06:17,090
room room name.

89
00:06:17,120 --> 00:06:22,610
So at this point I've built up my variable, my special variable, the variable that's going to be put

90
00:06:22,610 --> 00:06:23,360
into the session.

91
00:06:23,390 --> 00:06:31,280
So let's just stick it in session m dot app, dot session dot put and it needs the context arg context,

92
00:06:32,780 --> 00:06:36,790
the name which needs to be reservation because that's what I'm expecting to pull out.

93
00:06:36,800 --> 00:06:39,170
Is it by that key and then there is.

94
00:06:40,160 --> 00:06:40,490
All right.

95
00:06:40,520 --> 00:06:41,720
So now we've got this done.

96
00:06:41,720 --> 00:06:42,960
What do we want to do next.

97
00:06:42,980 --> 00:06:48,380
We want to take them to the make reservation page HGP redirect.

98
00:06:49,910 --> 00:06:50,570
Try that again.

99
00:06:51,170 --> 00:06:57,830
Redirect and that expects to have w r make Dasch reservation.

100
00:07:00,400 --> 00:07:09,190
And the actual code, which will be HDB status, temporary redirect, no less of status will go with

101
00:07:09,190 --> 00:07:09,520
that one.

102
00:07:09,610 --> 00:07:10,630
OK, and that should be it.

103
00:07:10,880 --> 00:07:12,310
That's should be all I have to do.

104
00:07:12,310 --> 00:07:15,370
So I'll get rid of this comment because I'm not using it.

105
00:07:16,330 --> 00:07:18,850
And I'll give this the comment it should have.

106
00:07:20,350 --> 00:07:27,070
I probably have some other ones I have to comment to so I'm able to do that, takes your parameters,

107
00:07:29,680 --> 00:07:38,020
builds a sessional variable and takes user to make res screen.

108
00:07:38,870 --> 00:07:40,500
OK, so that one has its comment.

109
00:07:41,080 --> 00:07:42,180
This one needs a comment.

110
00:07:42,700 --> 00:07:43,990
What does Chew's room do.

111
00:07:45,880 --> 00:07:50,860
Displays list of available rooms.

112
00:07:51,430 --> 00:07:56,050
OK, reservation summary needs a comment because I'm getting sloppy in my old age.

113
00:07:57,010 --> 00:08:03,190
Display's the reservation summary page summary has to Ms.

114
00:08:05,280 --> 00:08:11,900
And reservation doesn't have an extra eye, and I think that should be it looks like the rest of them,

115
00:08:12,150 --> 00:08:13,490
that one doesn't need a comment.

116
00:08:14,160 --> 00:08:15,170
This one does the rest.

117
00:08:15,210 --> 00:08:15,390
Good.

118
00:08:15,420 --> 00:08:15,870
All right.

119
00:08:16,200 --> 00:08:17,610
So let's stop our application.

120
00:08:20,810 --> 00:08:26,260
Started go back to a Web browser and let's start over, so we'll start at localhost right from the beginning

121
00:08:27,860 --> 00:08:31,850
and I'll hide the JavaScript console because I'm pretty sure there's no JavaScript errors.

122
00:08:31,880 --> 00:08:33,890
Now, I want to go to the rooms page.

123
00:08:33,890 --> 00:08:35,810
The only one that set up is generals quarters.

124
00:08:35,810 --> 00:08:42,050
We'll have to do a major suite next and check availability and search for dates I know are available

125
00:08:42,050 --> 00:08:44,420
sometime in February, the ninth to the 10th.

126
00:08:44,940 --> 00:08:51,390
OK, room is available and hopefully this will take us to the reservation page and it does Generals'

127
00:08:51,410 --> 00:08:53,180
quarters, the ninth, the 10th.

128
00:08:53,180 --> 00:08:54,280
We're all set.

129
00:08:54,290 --> 00:08:59,360
And at this point I know that everything is right because otherwise this page wouldn't be displaying

130
00:08:59,360 --> 00:08:59,690
anything.

131
00:08:59,960 --> 00:09:01,510
So we should be good to go.

132
00:09:01,850 --> 00:09:09,710
So the last step at this point is to take the code that we've used for the generals quarters page and

133
00:09:09,710 --> 00:09:12,750
duplicate that functionality on the major sweep page.

134
00:09:13,250 --> 00:09:16,420
So really, that's just a copy and paste exercise.

135
00:09:16,430 --> 00:09:20,060
The one thing you have to remember to change is the remedy.

136
00:09:20,060 --> 00:09:24,010
And the remedy for major suite in my case is to.

137
00:09:24,320 --> 00:09:30,230
So I'll leave that as an exercise for you and then I'll go through I'll do it myself off camera and

138
00:09:30,500 --> 00:09:32,420
show you what I have in the next lecture.

139
00:09:32,420 --> 00:09:34,280
And then we're ready to move on to the next section.
