-
Notifications
You must be signed in to change notification settings - Fork 13
Enable users to update approved claimed facility profiles & display claim info in the details sidebar #575
Conversation
26bbe33
to
571b60b
Compare
I am spinning off the multiselect fields for "certifications", "product types", and "production types" to #576 since we may need to spend some time cataloging the set of options before adding those. |
Remaining work here:
|
I spun off emailing contributors on profile changes to #578 |
fc67a70
to
1e6b6b7
Compare
1e6b6b7
to
91e8732
Compare
9092aa2
to
641f248
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.
The form looks sharp and the core flow is working well. I found a few items that need to be addressed and suggested some follow up issues.
/> | ||
|
||
<ClaimInfoSection | ||
label="Claimed Facility Description" |
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.
The wireframes do not have a "Claimed Facility ..." prefix on these fields. Consider dropping the prefix to reduce some visual noise.
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.
Done in 3c0b219
I also added a header to indicate what the info represents. I think we will also need to add some kind of disclaimed or link to the about page here.
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.
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.
Disclaimer message issue is #588
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.
Consider dropping the "Facility" prefix too. All the information in the sidebar is about the facility.
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.
Dropped the "Facility" prefix in e374b2d
@@ -146,20 +139,38 @@ class FacilityDetailSidebar extends Component { | |||
{data.properties.name} | |||
</h3> | |||
<p className="panel-header__subheading notranslate"> | |||
{data.properties.address} - {data.properties.country_name} | |||
{data.properties.address} -{' '} |
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 did we need to change this line? {' '}
is not something we see regularly.
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 this got added by running Prettier on this file in my editor; it's how Prettier preserves displayed space chars when breaking text across lines. I can put this all on a single line, though, and remove the {' '}
.
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.
Done in 1bf02ca
|
||
<ClaimInfoSection | ||
label="Claimed Facility Address" | ||
value={`${facility.address || ' '} ${facility.country || ' '}`} |
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.
facility.country
is the country code. We probably want the country name in this situation.
But...
I want to double check that we want to have a country field on the form at all. If the country on a row is wrong, it should be corrected at higher level (the facility, or even the facility list item)
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.
Good point. For now I'll remove the facility country selection and field altogether from the form & model (but leave the one for office country). If we decide we do want to allow changing a facility claim country, then we can add it back later.
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.
Removed in 9c3296b
label="Claimed Facility Phone Number" | ||
/> | ||
<ClaimInfoSection | ||
value={facility.minimum_order} |
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.
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.
Fixed in 9c3296b
src/django/api/serializers.py
Outdated
return [] | ||
|
||
try: | ||
contributor = Contributor.objects.get(admin=user) |
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.
Consider using some features of the Django ORM to simplify this a bit
return (FacilityClaim.objects
.filter(status=FacilityClaim.APPROVED)
.filter(contributor=user.contributor)
.values_list('facility__id', flat=True))
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.
Thanks for the suggestion! This is in 5d2e4de
data={data.properties.claim_info} | ||
/> | ||
</ShowOnly> | ||
</FeatureFlag> | ||
<div className="control-panel__group"> | ||
<div style={detailsSidebarStyles.linkSectionStyle}> | ||
<a |
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.
The wireframes show conditionally hiding these links if the logged in contributor has claimed the facility, since the do not apply to the claimant. Instead, the wireframes have a link to the profile editing page above the satellite image. Since we already have access to facilityIsClaimedByCurrentUser
we should consider implementing this link swapping.
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.
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.
Note that the verified badge will already also conditionally link to the facility claim form if it is my claimed facility.
disabled={updating} | ||
/> | ||
<InputSection | ||
label="Email" |
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.
Consider creating a follow up issue to add email address validation to this field.
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 should be trivial to incorporate here, so I can just add it in this PR. I think we want to validate isEmpty(email) || isEmail(email)
for this field, and probably disable the save button concurrently.
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.
Added in 9c3296b
onSwitchChange={updateFacilityPhoneVisibility} | ||
/> | ||
<InputSection | ||
label="Website" |
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.
Consider creating a follow up issue to add url validation to this field and to render it as an active link in the sidebar (using the same conditional "http://" appending that we use on the contributor profile page.
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/will be #587
onChange={updateOfficePhone} | ||
disabled={updating} | ||
/> | ||
{errorUpdating && ( |
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.
Consider opening an issue to use full_clean
on the model to trigger Django's model validation and generate helpful error messages that we can show to the claimant. We do this when parsing uploaded files https://github.com/open-apparel-registry/open-apparel-registry/blob/8fdc09c4d6cac5f4aefc3a313e9c04d84e5ab49f/src/django/api/processing.py#L127
We are currently returning 500 when the claimant enters too many characters into a field.
We could also make use of maxlength
to prevent these types of errors.
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 made #589 for handling it. I think we could also use the existing serializer to check somehow.
color="primary" | ||
disabled={updating} | ||
> | ||
Submit |
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.
Consider "Save" or "Save Changes" instead of "Submit"
Also consider showing some "toast" or similar if there is a 200 response. Right now there is no indication that the save succeeded.
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.
@jwalgran I believe I've addressed all the feedback above, so this is ready for another look! I updated the new migration, so testing will need to start from |
I'm going to squash this down again. |
Thanks for all the revisions. Taking another look. |
Running into a prop type error when selecting a facility on the map
|
Fixed the propType error in 381817e |
d53d5c4
to
381817e
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.
This is working perfectly. Thanks for all the time put into this implementation.
Awesome, thanks for all your help with this! |
381817e
to
6b5365c
Compare
- update model and add migration for editable facility claim profile fields - add Redux actions & React components for editable claimed facility profile form - adjust FacilityDetailsSerializer to return facility claim info conditionally - add FacilityDetailSidebarClaimedInfo component to display claim info
Ensure dashboard claims are always displayed in reverse order by adding -id sort.
6b5365c
to
b6027e1
Compare
Overview
This PR enables users with approved facility claims to edit these claims using a form on the /claimed/claimID route and also updates the facility details sidebar to display that info beneath the existing facility data.
I spun off the work of sending emails to a separate card.
I also spun off adding some multiselect tag fields to a separate card, since we don't really yet know the set of tags for these fields. It occurred to me that we can also remove & defer adding the
minimum_order_quantity
andaverage_lead_time
fields, too, for now since users can currently just include this info in a free form way in thefacility_description
field.Connects #518
Demo
Testing Instructions
resetdb
,processfixtures
, switch on the claim a facility and create a superuser/about/claimedfacilities
routeChecklist
fixup!
commits have been squashed