🎨 Fix UI (#4)

* fix cta button

* edit detail text

* set fullcalendar

* fix reservation bug
This commit is contained in:
Ruidy 2020-07-25 16:00:58 +02:00 committed by GitHub
parent e6235e72cc
commit a91914a640
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 233 additions and 40 deletions

View file

@ -37,3 +37,4 @@
- [ ] Blog - [ ] Blog
- [x] Call update_calendar from BookingManager. SOlve circular dependencies - [x] Call update_calendar from BookingManager. SOlve circular dependencies
- [ ] Trigger booking price Update when booking modified (calendar.py l:100) - [ ] Trigger booking price Update when booking modified (calendar.py l:100)
- [ ] mixpanel cdn error

View file

@ -1,7 +1,8 @@
import datetime import datetime
import os import os
import logging
import pickle import pickle
from google.auth.transport.requests import Request from google.auth.transport.requests import Request
from google_auth_oauthlib.flow import InstalledAppFlow, Flow from google_auth_oauthlib.flow import InstalledAppFlow, Flow
from googleapiclient.discovery import build from googleapiclient.discovery import build
@ -58,9 +59,9 @@ def get_bookings(place):
orderBy='startTime' orderBy='startTime'
).execute() ).execute()
events = events_result.get('items', []) events = events_result.get('items', [])
if not events: if not events:
print('No upcoming events found.') logging.info('No upcoming events found.')
reservation = None
else: else:
for event in events: for event in events:
reservation = { reservation = {
@ -79,6 +80,8 @@ def synchronize(place):
Delete from db reservation deleted from cal """ Delete from db reservation deleted from cal """
reservation = get_bookings(place) reservation = get_bookings(place)
if not reservation:
return
place = get_object_or_404(m_place.Place, name=place.name) place = get_object_or_404(m_place.Place, name=place.name)
start = reservation['start'] start = reservation['start']

View file

@ -1656,11 +1656,11 @@ footer .credits {
.btn.btn-b-n { .btn.btn-b-n {
background-color: #5bc0de; background-color: #5bc0de;
color: #ffffff; color: #ffffff;
border-radius: 0; border-radius: 8;
} }
.btn.btn-b-n:hover { .btn.btn-b-n:hover {
background-color: #26a356; background-color: #5bc0de;
color: #ffffff; color: #ffffff;
} }

View file

@ -0,0 +1,30 @@
FullCalendar.globalLocales.push(function () {
'use strict';
var de = {
code: "de",
week: {
dow: 1, // Monday is the first day of the week.
doy: 4 // The week that contains Jan 4th is the first week of the year.
},
buttonText: {
prev: "Zurück",
next: "Vor",
today: "Heute",
year: "Jahr",
month: "Monat",
week: "Woche",
day: "Tag",
list: "Terminübersicht"
},
weekText: "KW",
allDayText: "Ganztägig",
moreLinkText: function(n) {
return "+ weitere " + n;
},
noEventsText: "Keine Ereignisse anzuzeigen"
};
return de;
}());

View file

@ -0,0 +1,14 @@
FullCalendar.globalLocales.push(function () {
'use strict';
var enGb = {
code: "en-gb",
week: {
dow: 1, // Monday is the first day of the week.
doy: 4 // The week that contains Jan 4th is the first week of the year.
}
};
return enGb;
}());

View file

@ -0,0 +1,27 @@
FullCalendar.globalLocales.push(function () {
'use strict';
var es = {
code: "es",
week: {
dow: 1, // Monday is the first day of the week.
doy: 4 // The week that contains Jan 4th is the first week of the year.
},
buttonText: {
prev: "Ant",
next: "Sig",
today: "Hoy",
month: "Mes",
week: "Semana",
day: "Día",
list: "Agenda"
},
weekText: "Sm",
allDayText: "Todo el día",
moreLinkText: "más",
noEventsText: "No hay eventos para mostrar"
};
return es;
}());

View file

@ -0,0 +1,28 @@
FullCalendar.globalLocales.push(function () {
'use strict';
var fr = {
code: "fr",
week: {
dow: 1, // Monday is the first day of the week.
doy: 4 // The week that contains Jan 4th is the first week of the year.
},
buttonText: {
prev: "Précédent",
next: "Suivant",
today: "Aujourd'hui",
year: "Année",
month: "Mois",
week: "Semaine",
day: "Jour",
list: "Planning"
},
weekText: "Sem.",
allDayText: "Toute la journée",
moreLinkText: "en plus",
noEventsText: "Aucun événement à afficher"
};
return fr;
}());

View file

@ -0,0 +1,32 @@
document.addEventListener("DOMContentLoaded", () => {
const calendarEl = document.getElementById("calendar");
const calendar = new FullCalendar.Calendar(calendarEl, {
headerToolbar: {
left: "prev,next",
right: "title",
},
locale: "fr",
firstDay: 1, // week start on Monday
displayEventTime: false, // don't show the time column in list view
googleCalendarApiKey: "AIzaSyC2Wcg2Q2sq071w_L6k5JfHnPptlseU16g",
events: {
googleCalendarId:
"burik7aclvhc7vsboh06c179uo@group.calendar.google.com",
},
// eventColor: "#378006",
contentHeight: "auto",
// don't navigate in main tab
eventClick: (arg) => {
arg.jsEvent.preventDefault();
},
themeSystem: "bootstrap",
loading: (bool) => {
document.getElementById("loading").style.display = bool
? "block"
: "none";
},
});
calendar.render();
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,18 @@
body {
margin: 40px 10px;
padding: 0;
font-family: Arial, Helvetica Neue, Helvetica, sans-serif;
font-size: 14px;
}
#loading {
display: none;
position: absolute;
top: 10px;
right: 10px;
}
#calendar {
max-width: 1100px;
margin: 0 auto;
}

View file

@ -77,20 +77,28 @@
/> />
Villa<span class="color-b">Fleurie</span> Villa<span class="color-b">Fleurie</span>
</a> </a>
<a
type="button"
class="btn btn-link nav-search navbar-toggle-box-collapse d-md-none"
href="{% url 'rental:reservation' %}"
aria-expanded="false"
>
<span class="fa fa-cart-plus" aria-hidden="true"></span>
</a>
<div <div
class="navbar-collapse collapse justify-content-center" class="navbar-collapse collapse justify-content-center"
id="navbarDefault" id="navbarDefault"
> >
<ul class="navbar-nav"> <ul class="navbar-nav">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="{% url 'rental:list_place' %}" <a class="nav-link" href="{% url 'rental:list_place' %}">
>Hébergements</a Hébergements
> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="{% url 'rental:services' %}" <a class="nav-link" href="{% url 'rental:services' %}">
>Services</a Services
> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="{% url 'rental:about' %}">À propos</a> <a class="nav-link" href="{% url 'rental:about' %}">À propos</a>
@ -100,7 +108,12 @@
</li> </li>
</ul> </ul>
</div> </div>
<a class="btn btn-b" href="{% url 'rental:reservation' %}"> <a
type="button"
class="btn btn-b-n navbar-toggle-box-collapse d-none d-md-block"
aria-expanded="false"
href="{% url 'rental:reservation' %}"
>
Réserver Réserver
</a> </a>
</div> </div>

View file

@ -49,16 +49,7 @@
</div> </div>
<div class="col-sm-12 section-t8"> <div class="col-sm-12 section-t8">
<div class="row"> <div class="row">
<div class="col-md-7">
<form class="form-a" action="" method="post" role="form">
<!-- <div class="row">
<div class="col-md-12">
{% csrf_token %} {{ form.as_p }}
<button type="submit" class="btn btn-a">Envoyer</button>
</div>
</div> -->
</form>
</div>
<div class="col-md-5 section-md-t3"> <div class="col-md-5 section-md-t3">
<div class="icon-box section-b2"> <div class="icon-box section-b2">
<div class="icon-box-icon"> <div class="icon-box-icon">

View file

@ -1,5 +1,45 @@
{% extends 'rental/base.html'%} {% load static %} {% block content %} {% extends 'rental/base.html'%} {% load static %} {% block content %}
<link rel="stylesheet" href="{% static 'rental/lib/calendar/main.min.css' %}" />
<link rel="stylesheet" href="{% static 'rental/lib/calendar/style.css' %}" />
<script src="{% static 'rental/lib/calendar/main.min.js' %}"></script>
<script src="{% static 'rental/lib/calendar/main.js' %}"></script>
<script src="{% static 'rental/lib/calendar/locales/fr.js' %}"></script>
<script>
mixpanel.track("View Home Page", { place: "{{place.name}}" });
document.addEventListener("DOMContentLoaded", () => {
const calendarEl = document.getElementById("calendar");
const calendar = new FullCalendar.Calendar(calendarEl, {
headerToolbar: {
left: "prev,next",
right: "title",
},
locale: "fr",
firstDay: 1, // week start on Monday
displayEventTime: false, // don't show the time column in list view
googleCalendarApiKey: "AIzaSyC2Wcg2Q2sq071w_L6k5JfHnPptlseU16g",
events: { googleCalendarId: "{{place.calendar}}" },
// eventColor: "#378006",
contentHeight: "auto",
// don't navigate in main tab
eventClick: (arg) => {
arg.jsEvent.preventDefault();
},
themeSystem: "bootstrap",
loading: (bool) => {
document.getElementById("loading").style.display = bool
? "block"
: "none";
},
});
calendar.render();
});
</script>
<section class="intro-single"> <section class="intro-single">
<div class="container"> <div class="container">
<div class="row"> <div class="row">
@ -45,6 +85,7 @@
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
<div class="row justify-content-between"> <div class="row justify-content-between">
<div class="col-md-5 col-lg-4"> <div class="col-md-5 col-lg-4">
<div class="property-price d-flex justify-content-center foo"> <div class="property-price d-flex justify-content-center foo">
@ -62,6 +103,8 @@
<a href="#reservation" class="btn btn-a">Réserver</a> <a href="#reservation" class="btn btn-a">Réserver</a>
</div> </div>
</div> </div>
<div id="loading">loading...</div>
<div id="calendar"></div>
<div class="property-summary"> <div class="property-summary">
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
@ -98,14 +141,6 @@
</ul> </ul>
</div> </div>
</div> </div>
<iframe
src="{{place.calendar | safe}}"
style="border-width:0"
width="400"
height="400"
frameborder="0"
scrolling="no"
></iframe>
</div> </div>
<div class="col-md-7 col-lg-7 section-md-t3"> <div class="col-md-7 col-lg-7 section-md-t3">
<div class="row"> <div class="row">
@ -165,7 +200,7 @@
width="100%" width="100%"
height="460" height="460"
frameborder="0" frameborder="0"
style="border:0;" style="border: 0;"
allowfullscreen="" allowfullscreen=""
></iframe> ></iframe>
</div> </div>
@ -176,8 +211,5 @@
</div> </div>
</div> </div>
</section> </section>
<script>
mixpanel.track("View Home Page", { place: "{{place.name}}" });
</script>
{% endblock %} {% endblock %}

View file

@ -54,12 +54,13 @@
</div> </div>
<div class="card-body-a"> <div class="card-body-a">
<div class="price-box d-flex"> <div class="price-box d-flex">
<span class="price-a">Dès {{ place.price }} </span> <span class="price-a">Dès {{ place.price }} </span>
</div> </div>
<a <a
href="{% url 'rental:detail_place' place_name=place.name %}" href="{% url 'rental:detail_place' place_name=place.name %}"
class="link-a" class="link-a"
>Plus de détails >
En savoir plus
<span class="ion-ios-arrow-forward"></span> <span class="ion-ios-arrow-forward"></span>
</a> </a>
</div> </div>
@ -80,10 +81,6 @@
<h4 class="card-info-title">Max voyageurs</h4> <h4 class="card-info-title">Max voyageurs</h4>
<span>{{place.max_occupation}}</span> <span>{{place.max_occupation}}</span>
</li> </li>
<!-- <li>
<h4 class="card-info-title">Garages</h4>
<span>1</span>
</li> -->
</ul> </ul>
</div> </div>
</div> </div>