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
[IMP] website_sale: add location_selector raw design #3087
base: master-delivery_location_selector-vcr
Are you sure you want to change the base?
[IMP] website_sale: add location_selector raw design #3087
Conversation
This PR targets the un-managed branch odoo-dev/odoo:master-delivery_location_selector-vcr, it needs to be retargeted before it can be merged. |
border-bottom: $border-width solid $primary; | ||
} | ||
|
||
.modal-footer, |
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.
@Brieuc-brd , these lines will affect the entire frontend ^^ ... Let's scope the entire file, thanks 👍
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.
@stefanorigano Indeed 👍
Since there's no easy way to add a custom class to the <Dialog/>
(I wanted to avoid using xpath), I wrapped the component into a div.o_locationSelector
.
What do you think?
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.
Ok to me, it suits the current needs.
The goal is indeed to style this backbone layout, the entire feature is not ready for production just yet, we'll see how to improve this specific part during the "real implementation".
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.
What do you mean there is no easy way to add a custom class to the <Dialog/>
? What about contentClass=
attribute on the XML element?
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 catch @chevalierv ! I don't know why, I thought contentClass
only targeted the body of the modal 🤔 .
It's much better using it, thanks! 👍
01d3b07
to
b8b12f3
Compare
<div class="collapse show" t-attf-id="collapseLocationInfosMobile_{{this.state.selectedLocationId.toString()}}"> | ||
<button class="collapsed d-flex gap-2 gap-lg-3 w-100 border-0 p-3 bg-transparent text-start" type="button" t-attf-data-bs-target="#map_collapseHours_{{props.id}}" aria-expanded="false" t-attf-aria-controls="map_collapseHours_{{props.id}}" data-bs-toggle="collapse"> | ||
<strong class="o_locationSelector_number fw-bold">6</strong> | ||
<span class="d-flex flex-column gap-2 w-100"> | ||
<span class="d-flex flex-column"> | ||
<strong class="fw-bold">Librairie l’as-tu lu Jauche</strong> | ||
<small class="text-muted">Av. Albert Drossart 323, 1350 Orp-Jauche</small> | ||
</span> | ||
<span class="d-flex align-items-center gap-1 small fw-bold"> | ||
<i class="fa fa-clock-o" role="img"/> | ||
Opening hours | ||
<i class="o_locationSelector_hours_caret fa fa-caret-up ms-auto transition-base"/> | ||
</span> | ||
<span class="collapse" t-attf-id="map_collapseHours_{{props.id}}"> | ||
<span class="o_locationSelector_schedule d-grid gap-1 border rounded p-2 bg-white"> | ||
<span class="d-contents"> | ||
<small class="me-4 text-muted">Monday</small> | ||
<span class="o_locationSelector_schedule_hours d-flex flex-wrap"> | ||
<small>06:30 - 12:00</small> | ||
</span> | ||
</span> | ||
<span class="d-contents"> | ||
<small class="me-4 text-muted">Tuesday</small> | ||
<span class="o_locationSelector_schedule_hours d-flex flex-wrap"> | ||
<small>06:30 - 12:00</small> | ||
<small>13:00 - 19:30</small> | ||
</span> | ||
</span> | ||
<span class="d-contents"> | ||
<small class="me-4 text-muted">Wednesday</small> | ||
<span class="o_locationSelector_schedule_hours d-flex flex-wrap"> | ||
<small>06:30 - 12:00</small> | ||
<small>13:00 - 19:30</small> | ||
</span> | ||
</span> | ||
<span class="d-contents"> | ||
<small class="me-4 text-muted">Thursday</small> | ||
<span class="o_locationSelector_schedule_hours d-flex flex-wrap"> | ||
<small>06:30 - 12:00</small> | ||
<small>13:00 - 19:30</small> | ||
</span> | ||
</span> | ||
<span class="d-contents"> | ||
<small class="me-4 text-muted">Friday</small> | ||
<span class="o_locationSelector_schedule_hours d-flex flex-wrap"> | ||
<small>13:00 - 19:30</small> | ||
</span> | ||
</span> | ||
<span class="d-contents"> | ||
<small class="me-4 text-muted">Saturday</small> | ||
<span class="o_locationSelector_schedule_hours d-flex flex-wrap"> | ||
<small class="text-danger">Closed</small> | ||
</span> | ||
</span> | ||
<span class="d-contents"> | ||
<small class="me-4 text-muted">Sunday</small> | ||
<span class="o_locationSelector_schedule_hours d-flex flex-wrap"> | ||
<small class="text-danger">Closed</small> | ||
</span> | ||
</span> | ||
</span> | ||
</span> | ||
<!-- TODO: Toggle "Open now/Close now" elements depending on the time --> | ||
<small class="d-md-none text-success fw-bold">Open now</small> | ||
<!-- <small class="d-md-none text-danger fw-bold">Close now</small> --> | ||
</span> | ||
</button> | ||
</div> |
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.
IMO this shouldn't be a collapse as the first location will always be selected anyway (it should already be the case but maybe there is a bug on my part). Also, to reduce the code, could you move that part to the Map component?
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.
Ok I've removed the collapse and moved the code into the map view 👍 .
I also took the opportunity to clean up and further simplify the overall xml structure.
My only concern is that this button doesn't work anymore since I moved it into the map view.
Could you take a look at it? I've left you a few comments in the code 👇
https://github.com/odoo-dev/odoo/pull/3087/files#diff-137b82b9720f2631064e69e4e15ed7e89bb15ebe7b528af60d9809ff0d6265d3R16-R19
addons/website_sale/static/src/js/location_selector/map/map.scss
Outdated
Show resolved
Hide resolved
@@ -1,12 +1,12 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<templates xml:space="preserve"> | |||
<t t-name="website_sale.locationSelector.map"> | |||
<div class="w-100 h-100" style="width: 30rem! important; height: 30rem !important;" t-ref="mapContainer"></div> | |||
<div class="w-100 flex-grow-1" t-ref="mapContainer"/> |
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 don't think this would work, it's maybe why it fails in mobile...
According to leaflet quickstart guide, the map container needs to have a defined height.
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 done a few tests and even with a defined height, the card still doesn't work on mobile.
Something seems to break the map when the "md
and below" breakpoint is triggered 🤔 .
Could you have a look at it ?
Selectionne.avril.17.2024.15.46.11.mp4
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 the problem is that the map is rendered when the div is not shown, and then since we use bootstrap, I can't catch easily any event in javascript to inform the map that its size has been updated.
I'll try to drop the use of tab-pane and do the switch in owl instead. If that doesn't work, I'll go back to good old js to catch the event
</t> | ||
|
||
<t t-name="website_sale.locationSelector.map.marker"> | ||
<div style="color: var(--primary);"> | ||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 61 78.9" style="enable-background:new 0 0 61 78.9;" xml:space="preserve"> | ||
<div style="color: var(--light);"> <!-- todo vcr change var to primary on click --> |
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.
on click? do you mean when the location is selected?
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, indeed! 😅
I've cleaned up the map view. All the style is already defined for the selected marker. We just need to add the o_location_selector_marker_icon_selected
class to the selected marker. Could you have a look at it ?
https://github.com/odoo-dev/odoo/pull/3087/files#diff-654f2c8dd7477a3a02004b01f1a588a4a982ea28f8ff607674e6130d4867fa4e
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.
Not possible IMO, the marker shall all have the same design.
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.
It won't work the way it's technically done right now but I'll try to adapt the code to make it works
2f228b5
to
09490bb
Compare
Hey @chevalierv 👋 |
@chevalierv 👋 |
09490bb
to
8559aee
Compare
<button | ||
class="collapsed list-group-item list-group-item-action d-flex gap-2 gap-lg-3" |
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.
Are those changes needed? What is the use of collapsed
and button
?
<button | |
class="collapsed list-group-item list-group-item-action d-flex gap-2 gap-lg-3" | |
<div | |
class="list-group-item list-group-item-action d-flex gap-2 gap-lg-3" |
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.
Indeed, collapsed
wasn't necessary, I removed it 👍
But button
follows the semantics provided by the Bootstrap component.
addons/website_sale/static/src/js/location_selector/location/location.xml
Show resolved
Hide resolved
|
||
<!-- Schedule --> | ||
<span class="collapse d-md-none" t-attf-id="collapseHours_{{props.id}}" data-bs-parent="#o_location_selector_list_view"> | ||
<t t-call="website_sale.locationSelector.schedule"/> |
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 can't call a template of another component. I'll create a new owl component if you need to use the schedule at multiple places.
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 would be nice, thanks 👍
...e_sale/static/src/js/location_selector/location_selector_dialog/location_selector_dialog.xml
Outdated
Show resolved
Hide resolved
8559aee
to
08ed69f
Compare
cacd594
to
0e14844
Compare
08ed69f
to
141cb6f
Compare
Hello @Brieuc-brd, I'm starting to update my branches to enable the features you need in your branch (like the opening hours). I've seen that you've created a branch in an enterprise. As no changes were made, I've deleted it as it causes runbot to be red. Please use my branch directly if you don't need to change anything. The hours are dynamic but there is a problem when the pickup point has only one time frame: the opening hours are too much on the right. Can you take a quick look at that? At the same time, I'm fixing the others point like the map and the choose location button. |
9ed217f
to
53d73de
Compare
0e14844
to
10ce3b7
Compare
53d73de
to
7c2304d
Compare
8e13a69
to
5ced43d
Compare
f5057d3
to
51361c4
Compare
7c2304d
to
86107a3
Compare
86107a3
to
807d54d
Compare
This commit will be divided into the base branch to ease the review of the design team.
task-3795332