So we have the displaying of an individual sail working really well.
And, of course, we'll have to do the refund.
We'll get to that before too long.
So now we obviously need to do the same thing for showing all subscriptions.
And I could if I wanted to go back to my code over here and duplicate this entire page and make it a
subscription page Dutko HTML and that would work really well.
But we can probably simplify this.
So let's go back to our handlers.
Handlers don't go right here and let's modify the way that we're showing a sale.
So right now we're just showing this and we have the title and the world and everything else hardcoded
we can pass that is data to this handler so we can say make a string map and that's going to be a sign
the value of make a map, string, string.
Now, the reason I'm doing that is if you look at our render function, which is where is it web render
right here the very top of this file.
We're passing certain kinds of data to every template.
And one of those things is a string map, which is a map of string string.
So back here in our handlers, I can create a string map and then populate the only two things that
change between the showing a sale and what I want to do now, which is showing a subscription.
Those are the title and the cancel button.
So I'll put an entry in their string map.
So title is equal to for sale.
I'll just call it sale and string map and I'll call this one cancel.
And the cancel button has a URL that goes to admin, slash all sales and then I just pass this string
map.
Has Temperley do so for the member string map put in string map.
And now if I go back to my template sale page, go HTML and come up here to the top where there is a
title, I can just replace that with index dot string map.
I'm looking for title and I can copy this whole thing and paste it here and go down here to the council
and I'll make this and I'll put it in single code so we don't get what looks like an error but is not
index dot string that council which are better spelled right.
And then close my single quotes right here.
Now if I start my application.
So I'll stop it.
Make stop and make start.
And go back to my Web browser and go to all sales because we hadn't done subscriptions yet, this should
still work.
There it is.
And the cancel button should still work.
And it does.
So now I can go back to my coat, hide my terminal, open my handler's, duplicate this entire handler
and rename it.
And I'll rename it to show subscription
and change the title to subscription
subscription and change this to all subscriptions like that and go back to my roots and duplicate this
root and change that to the one that we get from our old subscriptions page, which is sub script schnozz
and have it show subscription.
And if I made everything right, let's have a look just to verify this admin, all subscriptions subscription
that good.
Let's restart our application.
Make start Mixter.
And go back here to our Web browser and go to all subscriptions.
And click on Order for that's for Diana Prince and there it is, order for Diana Prince subscription.
And if I click on Cancel It, you take me back to all subscriptions.
And it does.
Now, there's still a bit of code duplication around here, of course, for example, or or potential
code duplication, for example.
I have this format currency.
And should I put it here, I may have to use that in lots of places.
I could actually take it out of here and put it in my base load if I wanted to write down here.
And it's JavaScript and that would be something that might be useful if I'm going to put that in more
places.
But for right now, I'll leave it where it is.
And if I need to move it, move it later on.
So let's move on to refunding orders.