diff --git a/src/views/steps/StepsDoc.vue b/src/views/steps/StepsDoc.vue index cbfb607bb..cb3223813 100755 --- a/src/views/steps/StepsDoc.vue +++ b/src/views/steps/StepsDoc.vue @@ -119,8 +119,10 @@ export default { @@ -143,10 +145,550 @@ export default { { label: 'Confirmation', to: '/steps/confirmation' - }] + }], + formObject: {} + } + }, + components: { + 'StepsDoc': StepsDoc + }, + methods: { + nextPage(event) { + for (let field in event.formData) { + this.formObject[field] = event.formData[field]; + } + + this.$router.push(this.items[event.pageIndex + 1].to); + }, + prevPage(event) { + this.$router.push(this.items[event.pageIndex - 1].to); + }, + complete() { + this.$toast.add({severity:'success', summary:'Order submitted', detail: 'Dear, ' + this.formObject.firstname + ' ' + this.formObject.lastname + ' your order completed.'}); } } } + + +/deep/ .stepsdemo-content { + h1 { + font-weight: 400; + display: inline-block; + vertical-align: middle; + font-size: 24px; + margin-top: 1em; + } + + i { + vertical-align: middle; + font-size: 2em; + margin-top: .3em; + } + + .p-card-body { + padding: 0; + padding-bottom: 0; + padding-top: 0; + border-radius: 2px; + } + + .card-header-message { + font-size: 14px; + color: #ffffff; + } + + .wizard-header { + background-color: #057ad8; + margin:0; + max-height: 48px; + } + + .wizard-header-content { + align-self: center; + padding: 0px; + font-weight: 600; + margin-left: 1em; + } + + .wizard-header-steps { + align-self: center; + text-align: center; + max-width:90px; + padding: 0px; + font-size: 14px; + font-weight: normal; + } + + .wizard-content { + padding-left: 1em; + margin-top: .1em; + + p { + margin: 0; + } + + &.wizard-confirmation { + box-shadow: 0 25px 0 -23px #ededed; + + p { + font-weight: 600; + } + label.wizard-input-label { + opacity: 0.6; + font-size: 14px; + } + } + } + + .wizard-content-summary { + margin-bottom: .1em; + padding-left: 1em; + + p { + margin: 0; + } + } + + .wizard-footer { + background-color: #ededed; + margin-top: 2em; + margin-left: 0; + margin-right:0; + + & button { + max-width: 77px; + + &:disabled { + background-color: #a0a0a0; + border: none; + cursor: unset; + } + } + } + + .wizard-footer-back-button { + align-self: center; + text-align: left; + margin-left: .5em; + + span.pi { + top: 54%; + } + } + + .wizard-footer-next-button { + align-self: center; + text-align: right; + margin-right: .5em; + + span.pi { + top: 54%; + } + } + + .wizard-footer-complete-button { + align-self: center; + text-align: right; + margin-right: .5em; + + & button { + max-width: 108px; + } + } + + .wizard-input-label { + font-size: 12px; + } + + p.wizard-input-header { + margin-bottom: 7px; + } + + @media screen and (max-width: 768px) { + .wizard-content { + padding-right: 1em; + } + + .wizard-header { + max-height: 66px; + } + } +} + + + + + + + + +import {required, integer} from 'vuelidate/lib/validators'; + +export default { + data () { + return { + firstname: '', + lastname: '', + age: '', + submitted: false + } + }, + validations: { + firstname: { + required + }, + lastname: { + required + }, + age: { + integer + } + }, + methods: { + nextPage(isFormValid) { + this.submitted = true; + + if (!isFormValid) { + return; + } + + this.$emit('nextPage', {formData: {firstname: this.firstname, lastname: this.lastname, age: this.age}, pageIndex: 0}); + } + } +} + + + + + + + + +export default { + data () { + return { + selectedClass: '', + classes: [ + {name: 'First Class', code: 'A', factor: 1}, + {name: 'Second Class', code: 'B', factor: 2}, + {name: 'Third Class', code: 'C', factor: 3} + ], + vagons: [], + selectedVagon: '', + seats: [], + selectedSeat: '' + } + }, + methods: { + setVagons(event) { + if (this.selectedClass && event.value) { + this.vagons = []; + this.seats = []; + for (let i = 1; i < 3 * event.value.factor; i++) { + this.vagons.push({vagon: i + event.value.code, type: event.value.name, factor: event.value.factor}); + } + } + }, + setSeats(event) { + if (this.selectedVagon && event.value) { + this.seats = []; + for (let i = 1; i < 10 * event.value.factor; i++) { + this.seats.push({seat: i, type: event.value.type}); + } + } + }, + nextPage() { + this.$emit('nextPage', {formData: {class: this.selectedClass.name, vagon: this.selectedVagon.vagon, seat: this.selectedSeat.seat}, pageIndex: 1}); + }, + prevPage() { + this.$emit('prevPage', {pageIndex: 1}); + } + } +} + + + + + + + + +export default { + data () { + return { + cardholderName:'', + cardholderNumber:'', + date:'', + cvv:'', + remember:false + } + }, + methods: { + nextPage() { + this.$emit('nextPage', {formData: {cardholderName: this.cardholderName, cardholderNumber: this.cardholderNumber, date: this.date, cvv: this.cvv}, pageIndex: 2}); + }, + prevPage() { + this.$emit('prevPage', {pageIndex: 2}); + } + } +} + + + + + + + + +export default { + props: { + formData: Object + }, + methods: { + prevPage() { + this.$emit('prevPage', {pageIndex: 3}); + }, + complete() { + this.$emit('complete'); + } + }, +}