Added condition to show Confirm Order only when ordering a VM, and Invoice when order details page

This commit is contained in:
PCoder 2017-07-30 20:41:11 +05:30
parent b28cbdc940
commit 4883294acf
2 changed files with 6 additions and 2 deletions

View file

@ -20,7 +20,7 @@
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-8 col-md-offset-2"> <div class="col-xs-12 col-md-8 col-md-offset-2">
<div class="invoice-title"> <div class="invoice-title">
<h2>{% trans "Confirm Order"%}</h2><h3 class="pull-right">{% trans "Order #"%} {{order.id}}</h3> <h2>{{page_header_text}}</h2><h3 class="pull-right">{% trans "Order #"%} {{order.id}}</h3>
</div> </div>
<hr> <hr>
<div class="row"> <div class="row">

View file

@ -600,7 +600,7 @@ class PaymentVMView(LoginRequiredMixin, FormView):
email = BaseEmail(**email_data) email = BaseEmail(**email_data)
email.send() email.send()
return HttpResponseRedirect(reverse('hosting:orders', kwargs={'pk': order.id})) return HttpResponseRedirect("{url}?{query_params}".format(url=reverse('hosting:orders', kwargs={'pk': order.id}), query_params='page=payment'))
else: else:
return self.form_invalid(form) return self.form_invalid(form)
@ -619,6 +619,10 @@ class OrdersHostingDetailView(PermissionRequiredMixin, LoginRequiredMixin, Detai
owner = self.request.user owner = self.request.user
manager = OpenNebulaManager(email=owner.email, manager = OpenNebulaManager(email=owner.email,
password=owner.password) password=owner.password)
if self.request.GET.get('page', '') == 'payment':
context['page_header_text'] = _('Confirm Order')
else:
context['page_header_text'] = _('Invoice')
try: try:
vm = manager.get_vm(obj.vm_id) vm = manager.get_vm(obj.vm_id)
context['vm'] = VirtualMachineSerializer(vm).data context['vm'] = VirtualMachineSerializer(vm).data