diff --git a/gestion/templates/gestion/manage.html b/gestion/templates/gestion/manage.html
index d08e42e..1f9c6ee 100644
--- a/gestion/templates/gestion/manage.html
+++ b/gestion/templates/gestion/manage.html
@@ -13,10 +13,31 @@
{% block content %}
+{% if floating_buttons %}
+
+ {% for pm in pay_buttons %}
+
+ {% endfor %}
+
+{% endif %}
UP
{% if perms.gestion.add_consumptionhistory %}
@@ -63,7 +84,7 @@
0€ |
0€ |
0€ |
- {% for pm in pay_buttons %} {% endfor %} |
+ {% for pm in pay_buttons %} {% endfor %} |
diff --git a/gestion/views.py b/gestion/views.py
index 3ca3654..525b202 100644
--- a/gestion/views.py
+++ b/gestion/views.py
@@ -76,6 +76,8 @@ def manage(request):
soft = Product.objects.filter(category=Product.SOFT).filter(is_active=True)
menus = Menu.objects.filter(is_active=True)
kegs = Keg.objects.filter(is_active=True)
+ gp, _ = GeneralPreferences.objects.get_or_create(pk=1)
+ floating_buttons = gp.floating_buttons
for keg in kegs:
if(keg.pinte):
bieresPression.append(keg.pinte)
@@ -93,7 +95,8 @@ def manage(request):
"food": food,
"soft": soft,
"menus": menus,
- "pay_buttons": pay_buttons
+ "pay_buttons": pay_buttons,
+ "floating_buttons": floating_buttons,
})
@csrf_exempt
diff --git a/preferences/migrations/0004_auto_20190106_0452.py b/preferences/migrations/0004_auto_20190106_0452.py
new file mode 100644
index 0000000..fb5f3b7
--- /dev/null
+++ b/preferences/migrations/0004_auto_20190106_0452.py
@@ -0,0 +1,23 @@
+# Generated by Django 2.1 on 2019-01-06 03:52
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('preferences', '0003_auto_20181223_1440'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='historicalpaymentmethod',
+ name='icon',
+ field=models.CharField(blank=True, max_length=255, verbose_name='Icône'),
+ ),
+ migrations.AddField(
+ model_name='paymentmethod',
+ name='icon',
+ field=models.CharField(blank=True, max_length=255, verbose_name='Icône'),
+ ),
+ ]
diff --git a/preferences/migrations/0005_auto_20190106_0513.py b/preferences/migrations/0005_auto_20190106_0513.py
new file mode 100644
index 0000000..6b89033
--- /dev/null
+++ b/preferences/migrations/0005_auto_20190106_0513.py
@@ -0,0 +1,23 @@
+# Generated by Django 2.1 on 2019-01-06 04:13
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('preferences', '0004_auto_20190106_0452'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='generalpreferences',
+ name='floating_buttons',
+ field=models.BooleanField(default=False),
+ ),
+ migrations.AddField(
+ model_name='historicalgeneralpreferences',
+ name='floating_buttons',
+ field=models.BooleanField(default=False),
+ ),
+ ]
diff --git a/preferences/models.py b/preferences/models.py
index 0ac2d69..dd1cc7b 100644
--- a/preferences/models.py
+++ b/preferences/models.py
@@ -12,6 +12,7 @@ class PaymentMethod(models.Model):
is_usable_in_cotisation = models.BooleanField(default=True, verbose_name="Cotisations ?")
is_usable_in_reload = models.BooleanField(default=True, verbose_name="Rechargements ?")
affect_balance = models.BooleanField(default=False, verbose_name="Affecte le solde")
+ icon = models.CharField(max_length=255, verbose_name="Icône", blank=True)
history = HistoricalRecords()
def __str__(self):
@@ -32,6 +33,7 @@ class GeneralPreferences(models.Model):
grocer = models.CharField(max_length=255, blank=True)
use_pinte_monitoring = models.BooleanField(default=False)
lost_pintes_allowed = models.PositiveIntegerField(default=0)
+ floating_buttons = models.BooleanField(default=False)
history = HistoricalRecords()
class Cotisation(models.Model):
diff --git a/preferences/templates/preferences/general_preferences.html b/preferences/templates/preferences/general_preferences.html
index 08596d6..f8ee3ba 100644
--- a/preferences/templates/preferences/general_preferences.html
+++ b/preferences/templates/preferences/general_preferences.html
@@ -6,6 +6,7 @@
Site actif
Bureau
Suivi de pintes
+ Autre
{% endblock %}
@@ -23,6 +24,11 @@
{{form.global_message}}
+
@@ -43,6 +49,11 @@
{{form.active_message}}
+
@@ -76,6 +87,11 @@
{{form.brewer}}
+
@@ -105,5 +121,25 @@
+
{% endblock %}
diff --git a/preferences/templates/preferences/payment_methods_index.html b/preferences/templates/preferences/payment_methods_index.html
index a3f940d..b79ea22 100644
--- a/preferences/templates/preferences/payment_methods_index.html
+++ b/preferences/templates/preferences/payment_methods_index.html
@@ -22,6 +22,7 @@
Cotisations ? |
Rechargements ? |
Affecte le solde |
+ Icône |
Administration |
@@ -33,6 +34,7 @@
{{ pm.is_usable_in_cotisation | yesno:"Oui, Non" }} |
{{ pm.is_usable_in_reload | yesno:"Oui, Non" }} |
{{ pm.affect_balance | yesno:"Oui, Non" }} |
+ |
{% if perms.preferences.change_paymentmethod %}Modifier {% endif %}{% if perms.preferences.delete_paymentmethod %}Supprimer{% endif %} |
{% endfor %}
diff --git a/preferences/views.py b/preferences/views.py
index 3f9ec6d..b9bba9c 100644
--- a/preferences/views.py
+++ b/preferences/views.py
@@ -33,6 +33,7 @@ def generalPreferences(request):
form = GeneralPreferencesForm(request.POST or None, instance=gp)
if(form.is_valid()):
form.save()
+ messages.success(request, "Les préférences générales ont bien été mises à jour")
return render(request, "preferences/general_preferences.html", {"form": form})
########## Cotisations ##########
diff --git a/templates/base.html b/templates/base.html
index ce99f42..d9c654f 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -9,6 +9,7 @@
+