diff --git a/counter/templates/counter/counter_list.jinja b/counter/templates/counter/counter_list.jinja index bc6144b2..b807a7d3 100644 --- a/counter/templates/counter/counter_list.jinja +++ b/counter/templates/counter/counter_list.jinja @@ -18,7 +18,8 @@ {% trans %}Stats{% endtrans %} - {% endif %} {% if user.is_owner(c) %} - {% trans %}Props{% endtrans %} + {% trans %}Props{% endtrans %} - + {% trans %}Refillings list{% endtrans %} {% endif %} {% endfor %} @@ -39,7 +40,8 @@ {% trans %}Create new stock{% endtrans%} - {% endif %} {% if user.is_owner(c) %} - {% trans %}Props{% endtrans %} + {% trans %}Props{% endtrans %} - + {% trans %}Refillings list{% endtrans %} {% endif %} {% endfor %} diff --git a/counter/templates/counter/refilling_list.jinja b/counter/templates/counter/refilling_list.jinja new file mode 100644 index 00000000..df50cf3d --- /dev/null +++ b/counter/templates/counter/refilling_list.jinja @@ -0,0 +1,33 @@ +{% extends "core/base.jinja" %} +{% from 'core/macros.jinja' import paginate %} + +{% block title %} +{%- trans %}Refillings list{% endtrans %} -- {{ counter.name }} +{% endblock %} + +{% block content %} +

{% trans %}Refilling{% endtrans %}

+ + + + + + + + + {%- for refilling in object_list %} + + + + + + + +
{% trans %}Customer{% endtrans %}{% trans %}Amount{% endtrans %}{% trans %}Payment method{% endtrans %}{% trans %}Seller{% endtrans %}{% trans %}Actions{% endtrans %}
{{ refilling.customer }}{{ refilling.amount }}{{ refilling.payment_method }}{{ refilling.operator }}Delete
+ + {%- endfor %} +{% if is_paginated %} + {{ paginate(page_obj, paginator) }} +{% endif %} +{%- endblock %} + diff --git a/counter/urls.py b/counter/urls.py index 5f939804..aaade292 100644 --- a/counter/urls.py +++ b/counter/urls.py @@ -56,6 +56,8 @@ urlpatterns = [ url(r'^admin/eticket/(?P[0-9]+)$', EticketEditView.as_view(), name='edit_eticket'), url(r'^admin/selling/(?P[0-9]+)/delete$', SellingDeleteView.as_view(), name='selling_delete'), url(r'^admin/refilling/(?P[0-9]+)/delete$', RefillingDeleteView.as_view(), name='refilling_delete'), + url(r'^admin/(?P[0-9]+)/refillings$', CounterRefillingListView.as_view(), name='refilling_list'), + ] diff --git a/counter/views.py b/counter/views.py index 9d4963f8..bc008d54 100644 --- a/counter/views.py +++ b/counter/views.py @@ -1280,3 +1280,23 @@ class EticketPDFView(CanViewMixin, DetailView): p.showPage() p.save() return response + + +class CounterRefillingListView(CounterAdminTabsMixin, CounterAdminMixin, ListView): + """ + List of refillings on a counter + """ + model = Refilling + template_name = 'counter/refilling_list.jinja' + current_tab = "counters" + paginate_by = 30 + + def dispatch(self, request, *args, **kwargs): + self.counter = get_object_or_404(Counter, pk=kwargs['counter_id']) + self.queryset = Refilling.objects.filter(counter__id=self.counter.id) + return super(CounterRefillingListView, self).dispatch(request, *args, **kwargs) + + def get_context_data(self, **kwargs): + kwargs = super(CounterRefillingListView, self).get_context_data(**kwargs) + kwargs['counter'] = self.counter + return kwargs diff --git a/doc/Color Theory - Palette Creator/README.txt b/doc/Color Theory - Palette Creator/README.txt new file mode 100644 index 00000000..81ec8d00 --- /dev/null +++ b/doc/Color Theory - Palette Creator/README.txt @@ -0,0 +1,3 @@ +A Pen created at CodePen.io. You can find this one at https://codepen.io/anon/pen/PKVVXY. + +This page was used to generate the color palette of the sith. \ No newline at end of file diff --git a/doc/Color Theory - Palette Creator/css/style.css b/doc/Color Theory - Palette Creator/css/style.css new file mode 100644 index 00000000..c2172d22 --- /dev/null +++ b/doc/Color Theory - Palette Creator/css/style.css @@ -0,0 +1,74 @@ +html, body { + margin: 0; + padding: 0; + width: 100%; + height: 100%; + background: #424242; + font-size: 16px; +} + +body { + display: flex; + flex-direction: column; + align-items: center; + font-size: .875rem; +} + +.form { + margin: 5rem 0; + width: 30rem; + background: #FAFAFA; + padding: 2rem; + border-radius: .25rem; + box-shadow: 0 4px 5px hsla(0, 0%, 0%, .5); +} + +.form-group { + display: flex; + flex-flow: column nowrap; +} + +.form-group:not(:first-child) { + margin-top: 1rem; +} + +.color-display { + display: flex; + align-items: center; +} + +.color-group { + display: flex; + align-items: center; + justify-content: space-between; +} + +.color-group > .color-code { + flex: 1 0 auto; + margin-left: 1rem; +} + +.color-hue { + height: 2rem; + align-self: stretch; + background-image: linear-gradient(to right, red, yellow, lime, cyan, blue, magenta, red) +} + +.form-input { + width: 100%; + margin: 0; +} + +.color-preview { + height: 5rem; + width: 5rem; + background-color: lightgrey; + border: 1px solid black; + display: flex; + justify-content: center; + align-items: center; +} + +.color-text { + font-size: 3rem; +} \ No newline at end of file diff --git a/doc/Color Theory - Palette Creator/index.html b/doc/Color Theory - Palette Creator/index.html new file mode 100644 index 00000000..b67eb520 --- /dev/null +++ b/doc/Color Theory - Palette Creator/index.html @@ -0,0 +1,422 @@ + + + + + Color Theory Palette creator + + + + + + + + + + +
+
+
+ +
+
+
+ First color +
+
+ +
+
+
+ Second color +
+
+ +
+
+
+
+
+ Primary color +
+
+ +
+
+
+ Secondary color +
+
+ +
+
+
+
+
+ Text on primary color +
+
+ Ab +
+ +
+
+
+ Text on complementary color +
+
+ Ab +
+ +
+
+
+
+
+ Complementary neutral light color +
+
+ Ab +
+ +
+
+
+ Complementary neutral color +
+
+ Ab +
+ +
+
+
+ Complementary neutral dark color +
+
+ Ab +
+ +
+
+
+ Primary neutral light color +
+
+ Ab +
+ +
+
+
+ Primary neutral color +
+
+ Ab +
+ +
+
+
+ Primary neutral dark color +
+
+ Ab +
+ +
+
+
+
+
+ "White" color +
+
+ Ab +
+ +
+
+
+ "Black" color +
+
+ Ab +
+ +
+
+
+
+
+ Primary light color +
+
+ Ab +
+ +
+
+
+ Primary color +
+
+ Ab +
+ +
+
+
+ Primary dark color +
+
+ Ab +
+ +
+
+
+
+ + + + + + + diff --git a/doc/Color Theory - Palette Creator/js/index.js b/doc/Color Theory - Palette Creator/js/index.js new file mode 100644 index 00000000..f085c83f --- /dev/null +++ b/doc/Color Theory - Palette Creator/js/index.js @@ -0,0 +1,103 @@ +/* jshint esversion: 6 */ + +// This is using Sass.js to use Sass built-in color mixing functions + +const firstColorChooser = document.forms['color-theory']['first-color']; +const firstColor = document.querySelector('.first-color'); +const secondColor = document.querySelector('.second-color'); + +let hue = undefined; +let comp = undefined; + +updateColors(); +Sass.options({ + precision: 1 +}); +computeScss(); + +document.forms['color-theory']['first-color'].addEventListener('input', updateColors); + +document.forms['color-theory']['first-color'].addEventListener('change', computeScss); + +function updateColors(ev) { + hue = parseInt(firstColorChooser.value); + comp = (hue + 180) % 360; + setColorPreview([firstColor], `hsl(${hue}, 100%, 50%)`); + setColorPreview([secondColor], `hsl(${comp}, 100%, 50%)`); +} + +function setColorPreview(fieldsets, color) { + Array.from(fieldsets).forEach(fieldset => { + const preview = fieldset.querySelector('.color-preview'); + preview.style.backgroundColor = fieldset.querySelector('.color-code').value = color; + const text = fieldset.querySelector('.color-text') + if(text) + text.style.color = computeTextColor(window.getComputedStyle(preview).backgroundColor); + }); +} + +function setColorText(fieldsets, bg, text) { + Array.from(fieldsets).forEach(fieldset => { + fieldset.querySelector('.color-preview').style.backgroundColor = bg; + fieldset.querySelector('.color-text').style.color = fieldset.querySelector('.color-code').value = text; + }); +} + +function computeScss() { + Sass.compile( + `$first-color: hsl(${hue}, 100%, 50%);` + + document.querySelector('#scss-template').content.firstElementChild.textContent, computedScssHandler); + +} + +function computedScssHandler(result) { + let colors = {}; + result.text.split('\n\n').forEach(rule => { + const color = /\.([\w\-]+) {\s*color: (hsl\() (\d{1,3}(?:\.\d+)?)deg(.*) (\));\s*}/.exec(rule).splice(1, 5).join('').split('hsl'); + colors[color[0]] = `hsl${color[1]}`; + }); + + for (let colorName in colors) + if (document.querySelector(`.${colorName}`)) setColorPreview(document.querySelectorAll(`.${colorName}`), colors[colorName]); + + const primaryTextColor = computeTextColor(window.getComputedStyle(document.querySelector('.primary-color .color-preview')).backgroundColor); + const complementaryTextColor = computeTextColor(window.getComputedStyle(document.querySelector('.complementary-color .color-preview')).backgroundColor); + setColorText([document.querySelector('.text-on-primary')], document.querySelector('.primary-color .color-preview').style.backgroundColor, primaryTextColor); + setColorText([document.querySelector('.text-on-complementary')], document.querySelector('.complementary-color .color-preview').style.backgroundColor, complementaryTextColor) +} + +function computeTextColor(colorStr) { + const black = [0, 0, 0, .87]; + const white = [255, 255, 255, 1]; + + [, , r, g, b, a] = /(rgba?)\((\d{1,3}), (\d{1,3}), (\d{1,3})(?:, (\d(?:\.\d+)))?\)/.exec(colorStr); + const color = [parseInt(r), parseInt(g), parseInt(b), parseFloat(a == undefined ? 1 : a)] + const blackContrast = computeConstrastRatio(black, color); + const whiteContrast = computeConstrastRatio(white, color); + return blackContrast < whiteContrast ? `hsl(0, 0%, 100%)` : `hsla(0, 0%, 0%, 0.87)` +} + +function computeConstrastRatio([fr, fg, fb, fa], [br, bg, bb, ba]) { + if (fa < 1) { + fr = fr * fa + br * (1 - fa); + fg = fg * fa + bg * (1 - fa); + fb = fb * fa + bb * (1 - fa); + fa = 1; + } + const fl = luminance([fr, fg, fb]); + const bl = luminance([br, bg, bb]); + + if (fl < bl) + return (bl + .05) / (fl + .05); + else + return (fl + .05) / (bl + .05); +} + +function luminance([r, g, b]) { + return .2126 * colorComponent(r) + .7152 * colorComponent(g) + .0722 * colorComponent(b); +} + +function colorComponent(color) { + const c = color / 255; + return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4); +} \ No newline at end of file diff --git a/doc/Color Theory - Palette Creator/license.txt b/doc/Color Theory - Palette Creator/license.txt new file mode 100644 index 00000000..5514f9a9 --- /dev/null +++ b/doc/Color Theory - Palette Creator/license.txt @@ -0,0 +1,16 @@ + + + diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index b478a741..a98aa259 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-09-02 12:33+0200\n" +"POT-Creation-Date: 2017-09-02 15:17+0200\n" "PO-Revision-Date: 2016-07-18\n" "Last-Translator: Skia \n" "Language-Team: AE info \n" @@ -404,8 +404,8 @@ msgstr "Nouveau compte club" #: core/templates/core/user_tools.jinja:41 core/views/user.py:186 #: counter/templates/counter/cash_summary_list.jinja:53 #: counter/templates/counter/counter_list.jinja:17 -#: counter/templates/counter/counter_list.jinja:32 -#: counter/templates/counter/counter_list.jinja:53 +#: counter/templates/counter/counter_list.jinja:33 +#: counter/templates/counter/counter_list.jinja:55 #: election/templates/election/election_detail.jinja:279 #: election/templates/election/election_detail.jinja:327 #: election/templates/election/election_detail.jinja:375 @@ -494,6 +494,7 @@ msgstr "Fin" #: core/templates/core/user_account_detail.jinja:53 #: core/templates/core/user_account_detail.jinja:80 #: counter/templates/counter/last_ops.jinja:17 +#: counter/templates/counter/refilling_list.jinja:13 msgid "Amount" msgstr "Montant" @@ -517,6 +518,7 @@ msgstr "Fermé" #: com/templates/com/news_admin_list.jinja:242 #: com/templates/com/news_admin_list.jinja:276 #: com/templates/com/weekmail.jinja:21 com/templates/com/weekmail.jinja:50 +#: counter/templates/counter/refilling_list.jinja:16 msgid "Actions" msgstr "Actions" @@ -1062,6 +1064,7 @@ msgstr "Barman" #: counter/templates/counter/counter_click.jinja:29 #: counter/templates/counter/last_ops.jinja:16 #: counter/templates/counter/last_ops.jinja:41 +#: counter/templates/counter/refilling_list.jinja:12 msgid "Customer" msgstr "Client" @@ -1088,6 +1091,7 @@ msgstr "Total" #: core/templates/core/user_account_detail.jinja:54 #: counter/templates/counter/last_ops.jinja:18 #: counter/templates/counter/last_ops.jinja:45 +#: counter/templates/counter/refilling_list.jinja:14 msgid "Payment method" msgstr "Méthode de paiement" @@ -1188,8 +1192,8 @@ msgid "Mailing list" msgstr "Listes de diffusion" #: club/views.py:134 counter/templates/counter/counter_list.jinja:21 -#: counter/templates/counter/counter_list.jinja:42 -#: counter/templates/counter/counter_list.jinja:57 +#: counter/templates/counter/counter_list.jinja:43 +#: counter/templates/counter/counter_list.jinja:59 msgid "Props" msgstr "Propriétés" @@ -2938,20 +2942,20 @@ msgstr "Appels à facture" #: core/templates/core/user_tools.jinja:42 core/views/user.py:213 #: counter/templates/counter/counter_list.jinja:18 -#: counter/templates/counter/counter_list.jinja:33 -#: counter/templates/counter/counter_list.jinja:54 +#: counter/templates/counter/counter_list.jinja:34 +#: counter/templates/counter/counter_list.jinja:56 msgid "Stats" msgstr "Stats" #: core/templates/core/user_tools.jinja:46 -#: counter/templates/counter/counter_list.jinja:37 +#: counter/templates/counter/counter_list.jinja:38 #: stock/templates/stock/stock_item_list.jinja:11 #: stock/templates/stock/stock_list.jinja:16 msgid "Shopping lists" msgstr "Liste de courses" #: core/templates/core/user_tools.jinja:48 -#: counter/templates/counter/counter_list.jinja:39 +#: counter/templates/counter/counter_list.jinja:40 msgid "Create new stock" msgstr "Créer nouveau stock" @@ -3406,6 +3410,7 @@ msgid "Finish" msgstr "Terminer" #: counter/templates/counter/counter_click.jinja:97 +#: counter/templates/counter/refilling_list.jinja:9 msgid "Refilling" msgstr "Rechargement" @@ -3418,15 +3423,21 @@ msgstr "Liste des comptoirs" msgid "New counter" msgstr "Nouveau comptoir" -#: counter/templates/counter/counter_list.jinja:26 +#: counter/templates/counter/counter_list.jinja:22 +#: counter/templates/counter/counter_list.jinja:44 +#: counter/templates/counter/refilling_list.jinja:5 +msgid "Refillings list" +msgstr "Liste de rechargements" + +#: counter/templates/counter/counter_list.jinja:27 msgid "Bars" msgstr "Bars" -#: counter/templates/counter/counter_list.jinja:47 +#: counter/templates/counter/counter_list.jinja:49 msgid "Offices" msgstr "Bureaux" -#: counter/templates/counter/counter_list.jinja:63 +#: counter/templates/counter/counter_list.jinja:65 msgid "There is no counters in this website." msgstr "Il n'y a pas de comptoirs dans ce site web." @@ -3527,6 +3538,10 @@ msgstr "Nouveau type de produit" msgid "There is no product types in this website." msgstr "Il n'y a pas de types de produit dans ce site web." +#: counter/templates/counter/refilling_list.jinja:15 +msgid "Seller" +msgstr "Vendeur" + #: counter/templates/counter/stats.jinja:5 #: counter/templates/counter/stats.jinja:9 #, python-format