Repository: fossasia/open-event-server

Issue:
UI bugs in Attendees Page
These are some of the UI bugs that need to be fixed in Attendees Page `/events/<event-id>/tickets/attendees/`

- [x] Placed label is shown in red. -> Change it to blue like in orders page.
- [x] Order by whom is not shown.
- [x] Order URL is wrong.
- ~~Only Placed and Completed orders shown.~~ Not an UI issue. So will be solved in #2936 
- [x] The Actions not shown for Completed orders.

@magdalenesuo please fix these issues. Thanks.


Discussion:
@mariobehling a little digging into this issue led me to find that ticket holders info is saved only if the order is placed or completed. This logic seems to be correct because if one doesn't reach either of the state, then the details of attendees can't be attained. In that case I feel the "pending" and "expired" tabs shouldn't be there in Attendees page. @niranjan94 @magdalenesuo views?
@SaptakS Yes, this is one way to see it. However, in that case we could also take out "pending" in "Orders".

Actually it is possible to get the attendee information if the user has entered them already or the user was logged in, when he/she started the process. The only difference is: The user has not paid yet.

So, if the user has entered all data, but has not paid, we actually have all the data in pending, but the order is not finished.

-> So, what we should save is all the attendee data. If the user has only started the order, but not added any attendee information we should just keep the link to the order and not show anything in the field or just "None" or similar.
> it is possible to get the attendee information if the user has entered them already or the user was logged in, when he/she started the process.

We do have the user who started the order but not the details of the all the attendees in that order, i.e. if there are multiple tickets in that order. This already does get save.

> If the user has only started the order, but not added any attendee information we should just keep the link to the order and not show anything in the field or just "None" or similar.

This is a possible way of showing but we can show only the order and order status information. That would be fine?

If the user has entered the attendee data and pressed pay now, but not completed payment procedure or if only partial attendee data was added, then what should be the flow? Should we save the data of attendees when all the attendee data is added and proceeded for payment? I will make a separate issue to handle this implementation.


> If the user has entered the attendee data and pressed pay now, but not completed payment procedure or if only partial attendee data was added, then what should be the flow? Should we save the data of attendees when all the attendee data is added and proceeded for payment? I will make a separate issue to handle this implementation.

Yes, sounds good to me. 

Resolving patch:
diff --git a/app/views/users/ticket_sales.py b/app/views/users/ticket_sales.py
--- a/app/views/users/ticket_sales.py
+++ b/app/views/users/ticket_sales.py
@@ -122,6 +122,8 @@ def display_attendees(event_id):
             order_holder['order_url'] = url_for('ticketing.view_order_after_payment', order_identifier=order.identifier) \
                                         if order.status == 'completed' else url_for('ticketing.show_transaction_error', \
                                         order_identifier=order.identifier)
+            order_holder['by_whom'] = order.user.user_detail.fullname if order.user.user_detail \
+                                        and order.user.user_detail.fullname else order.user.email
             order_holder['paid_via'] = order.paid_via
             order_holder['status'] = order.status
             order_holder['completed_at'] = order.completed_at
@@ -139,6 +141,7 @@ def display_attendees(event_id):
                     order_holder['ticket_price'] = order_holder['ticket_price'] - (order_holder['ticket_price'] \
                                                     * discount.value / 100.0 )
             order_holder['checked_in'] = holder.checked_in
+            order_holder['id'] = holder.id
             holders.append(order_holder)
     return render_template('gentelella/admin/event/tickets/attendees.html', event=event,
                            event_id=event_id, holders=holders)


Test patch: