-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DNCR-41] Add manual payment option #35
Conversation
1735155
to
b4799a9
Compare
e7c7ed8
to
f6c3fff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first I thought that this bigger payment modal from this task could be also used in attendee-list, but on the second thought it's nice to have two ways to do it - it's going to be easier to get feedback from client.
Important: action button doesn't work if you click on the middle of it, where the + sign is - unfortunately that's where I think it's most intuitive to click - it took me several clicks untill I figured out where to click on it to make it work.
GUI-wise, I love how it +
becomes X
when list on action button is expanded. I'd love transparent round fa-buttons as options, but that's definitely not the time to spend on polishing it - current version is great for now :).
I'd love cancel button on attendee-details view, it seems natural to view details of one attendee and then go back to others. There is some PR with @droodev task for reception cancel button waiting for him, I'll merge it tomorrow.
I didn't go through and understand all the code yet, so I'll continue tomorrow.
Edit:
I merged @droodev task, but it doesn't cover attendee-details. If you could add similar close button on left it'd be awesome.
public function index() | ||
{ | ||
// TODO: Replace with proper company fetching | ||
/** @var Builder $query */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, I didn't know that php convention for type-hinting, interesting :)
@@ -11,14 +11,6 @@ | |||
|
|||
class CoursesController extends Controller | |||
{ | |||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this no longer needed? Is this line in our api.php
equivalent (with auth
instead of api
ofc) ?
Route::group(['middleware' => 'auth'], function(){
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's thanks to this group we can omitwhole middleware. Moreover - being in the api.php
routes file adds automatically api
middleware ;)
|
||
use App\Http\Controllers\Controller; | ||
|
||
class AttendeesController extends Controller |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad you did separate namespace, it was getting big.
I get that it's in another namespace, but I still wonder if the name isn't confusing with App\Http\Controllers\AttendeesController
. But I see the idea behind this convention, so maybe it'll work.
And CoursesController
should fit in this namespace too :).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? This is natural to add course-related things to Courses
namespace, but it's not wise to add the Course
controller here as well. As an example take the REST API conventions ;)
|
||
public function company() | ||
{ | ||
return $this->hasOne(Company::class, 'id', 'company_id'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't 'many-to-many' modelled using $this->belongsToMany
on both sides, in this case in both Company
and PaymentType
? https://laravel.com/docs/5.3/eloquent-relationships#many-to-many
I mean I guess it'll work and we get relationship table more explicitly than by using the pivot
attribute, but it's different from docs and we'll soon need some another many-to-many relationships (attendees_presence, course_has_instructor, attendee_has_course), so I'd like to understand difference here.
I think sticking to docs would be easier, but I might be missing why this approach is better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are missing the idea. This CompanyPaymentType
is assignment of the selected payment type to selected company. We also have deposit
value that is used to define how much money you have to take to let someone enter which may vary between companies.
This special many-to-many might work for simple relations, but using this we got simply more power and control over it.
ngOnInit() { | ||
this.paymentService.list().subscribe( | ||
(methods) => this.methods = methods, () => { | ||
this.notifications.error('Błąd', 'Nie udało się pobrać metod płatności'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this notification is already fired in PaymentMethodsResolve
, I think one's enough
Edit: Oh wait, it's a modal and from what I see it doesn't have distinct routing path, so it doesn't use resolve at all. But on the other hand it's url indicates it should be a child of course-details/:course-id
which already has this data, but it's not, because they attendee-details
don't share anything view-wise with course-details
.. now I remember that discussion from Marek's PR.
I think they should share title in general, but for now let's leave it, too much changes. it could theoretically be just passed as parameter from attendee-details page, but this way it's fetched only when needed, ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've searched for a way to replace selected router-outlet
with the views (we are using it with UI-Router in AngularJS), but I couldn't find it.
@@ -0,0 +1,25 @@ | |||
<div class="modal-header"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems very similar to payment-confirmation.component
, but I guess you're right, it'd be more hassle than gain to reuse it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is similar BUT very different. PaymentConfirmation
component is just for confirming that the payment you have selected is correct, while this one is to select payment type.
3ca8bcf
to
3d4490d
Compare
…ront-end. Moved attendee-details title line-up and action button to the top in tablet view.
I did commit with some changes, please pull / look at it before continuing! |
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class CreateCompanyPaymentTypeTable extends Migration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think now we don't need this migration when this relation is created with belongsToMany()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need it as models are not parsed during migration and we need real table to exist. Checked it.
|
||
$values = $request->only(['payment_type_id', 'attendee_id']); | ||
$values['course_id'] = $id; | ||
$values['amount'] = $course->getAttribute('price'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed on Slack, I think it's incorrect. I propose to create additional field on relation's table (pivot), maybe amount
?
And I realized we should be able to store information about paying deposit
itself (and allow this use-case in front-end). I think it should be a separate task. I'm not sure how to model it, especially that I think the use-case with deposits is that attendee's unnotified absence means some amount is subtracted from it. But for now I think modelling it as extra payment (and returning deposit as negative payment?) should be good enough.
If you agree, can you create such task / describe how you think we should do it? I think in the scope of this task just fixing this line above would be perfect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH it's more complex than you think and I propose to do this in separate task. I think you might be too much into our single client as well in this example. I also think that with other systems like Benefit you are right that payment is really only a part of whole price.
No description provided.