Skip to content

Commit 8972a12

Browse files
committed
added stuff
1 parent 21821e6 commit 8972a12

File tree

1 file changed

+32
-39
lines changed

1 file changed

+32
-39
lines changed

src/content/create-booking-component.md

Lines changed: 32 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ postnumber: 34
99
framework: vue
1010
---
1111

12-
In this part we will create the booking component.
12+
In this part we will create the booking component. Essentially we will create four tabs that users will be able to enter information about the booking.
1313

1414
First head over and create a `booking` directory and create an `Index.vue` file with the following:
1515

16-
```
16+
```vue
1717
<template>
1818
<div>
1919
<HeadingOne class="text-center">
@@ -25,8 +25,8 @@ First head over and create a `booking` directory and create an `Index.vue` file
2525
v-on:goNext="next"
2626
:personal="personal"
2727
@event="
28-
(newPersonal) => {
29-
personal = newPersonal;
28+
newPersonal => {
29+
personal = newPersonal
3030
}
3131
"
3232
/>
@@ -41,8 +41,8 @@ First head over and create a `booking` directory and create an `Index.vue` file
4141
v-on:goNext="next"
4242
:customers="customers"
4343
@event="
44-
(cus) => {
45-
customers = cus;
44+
cus => {
45+
customers = cus
4646
}
4747
"
4848
@inputData="showData"
@@ -72,12 +72,12 @@ First head over and create a `booking` directory and create an `Index.vue` file
7272
</template>
7373
7474
<script>
75-
import CustomersTab from "./CustomersTab";
76-
import CustomerDetailsTab from "./CustomerDetailsTab";
77-
import SuccessTab from "./SuccessTab";
78-
import CheckoutTab from "./CheckoutTab";
79-
import Typography from "../../components/typography";
80-
const { HeadingOne } = Typography;
75+
import CustomersTab from "./CustomersTab"
76+
import CustomerDetailsTab from "./CustomerDetailsTab"
77+
import SuccessTab from "./SuccessTab"
78+
import CheckoutTab from "./CheckoutTab"
79+
import Typography from "../../components/typography"
80+
const { HeadingOne } = Typography
8181
export default {
8282
name: "BookingIndex",
8383
components: {
@@ -93,7 +93,7 @@ export default {
9393
variables() {
9494
return {
9595
listingId: this.$route.params.id,
96-
};
96+
}
9797
},
9898
},
9999
},
@@ -110,20 +110,14 @@ export default {
110110
showError: "",
111111
mutationObject: {},
112112
getAListing: {},
113-
};
113+
}
114114
},
115115
methods: {
116116
next(k) {
117-
this.activeKey = k.toString();
118-
},
119-
showData() {
120-
console.log(this.customers);
121-
alert(
122-
` ${this.personal.date}${this.personal.number} ${this.personal.email} ${this.customers[0].name}`
123-
);
117+
this.activeKey = k.toString()
124118
},
125119
mutate() {
126-
this.isLoading = true;
120+
this.isLoading = true
127121
this.$apollo
128122
.mutate({
129123
mutation: require("../../graphql/makeABooking.gql"),
@@ -134,38 +128,37 @@ export default {
134128
customers: this.customers,
135129
},
136130
})
137-
.then((data) => {
138-
console.log(data);
139-
this.isLoading = false;
140-
this.mutationObject = data.data.makeABooking;
141-
this.activeKey = "4";
131+
.then(data => {
132+
console.log(data)
133+
this.isLoading = false
134+
this.mutationObject = data.data.makeABooking
135+
this.activeKey = "4"
136+
})
137+
.catch(error => {
138+
console.log(error)
139+
this.isLoading = false
140+
this.hasError = false
141+
this.showError = error
142142
})
143-
.catch((error) => {
144-
console.log(error);
145-
this.isLoading = false;
146-
this.hasError = false;
147-
this.showError = error;
148-
});
149143
},
150144
},
151-
};
145+
}
152146
</script>
153147
<style>
154148
.ant-tabs-bar.ant-tabs-top-bar {
155149
display: none;
156150
}
157151
</style>
158-
159152
```
160153

161154
🐢 We have the Antd Tabs component hooked up to the `v-model` with a field called `activeKey`. This is to tell the component which tab will be active.
162155

163-
🐢 In the first tab we give it a key of 1 and this will be where we will create a form for the date etc. At the bottom we have the Red button and Red Outline button if you click on it will take you to the next tab while te Red outline button wil push you to the home page.
156+
🐢 In the first tab we give it a key of 1 and this will be where we will create a form for the date etc. At the bottom we have the Red button and Red Outline button if you click on it will take you to the next tab while the Red outline button wil push you to the home page.
164157

165158
🐢 In the second tab we will add a form for the people the person is traveling with. It works similar to the 1st tab, in that if you click the buttons it will route you to the next or previous tab.
166159

167-
🐢 The third tab will enable us to charge the user for their trip
160+
🐢 The third tab will enable us to charge the user for their booking.
168161

169-
🐢 The fourth tab is the confirmation one that will fire once they ahve successfully paid for the trip.
162+
🐢 The fourth tab is the confirmation one that will fire once they have successfully paid for the trip.
170163

171-
Next up we will start building out the forms. So if things do not work while we build out the components do not stress
164+
Next up we will start building out the forms. So if things do not work while we build out the components do not stress, we will be implementing them now.

0 commit comments

Comments
 (0)