mirror of
https://github.com/nanoy42/coope
synced 2024-12-25 00:13:46 +00:00
commit
d61bb8204e
9 changed files with 115 additions and 3 deletions
|
@ -13,10 +13,31 @@
|
|||
|
||||
|
||||
{% block content %}
|
||||
{% if floating_buttons %}
|
||||
<div class="alt_payment_buttons">
|
||||
{% for pm in pay_buttons %}
|
||||
<button class="button small pay_button" data-payment="{{pm.pk}}"><i class="fa fa-{{pm.icon}}"></i></button><br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<a class="up_button" href="#intro">
|
||||
UP
|
||||
</a>
|
||||
<style>
|
||||
.alt_payment_buttons{
|
||||
display:block;
|
||||
background-color:white;
|
||||
position:fixed;
|
||||
right:0;
|
||||
padding-right: 1em;
|
||||
top:50%;
|
||||
border-top-left-radius: 5px;
|
||||
border-bottom-left-radius: 5px;
|
||||
}
|
||||
.alt_payment_buttons button{
|
||||
min-width: 0 !important;
|
||||
background-color: white !important;
|
||||
}
|
||||
.up_button{
|
||||
display:block;
|
||||
background-color:white;
|
||||
|
@ -28,7 +49,7 @@
|
|||
text-align:center;
|
||||
line-height:50px;
|
||||
right:1em;
|
||||
bottom : 1em;
|
||||
bottom : 1em;
|
||||
}
|
||||
</style>
|
||||
{% if perms.gestion.add_consumptionhistory %}
|
||||
|
@ -63,7 +84,7 @@
|
|||
<td id="balance">0€</td>
|
||||
<td id="totalAmount">0€</td>
|
||||
<td id="totalAfter">0€</td>
|
||||
<td>{% for pm in pay_buttons %}<button class="btn small pay_button" data-payment="{{pm.pk}}">{{pm.name}}</button> {% endfor %}</td>
|
||||
<td>{% for pm in pay_buttons %}<button class="btn small pay_button" data-payment="{{pm.pk}}"><i class="fa fa-{{pm.icon}}"></i> {{pm.name}}</button> {% endfor %}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -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
|
||||
|
|
23
preferences/migrations/0004_auto_20190106_0452.py
Normal file
23
preferences/migrations/0004_auto_20190106_0452.py
Normal file
|
@ -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'),
|
||||
),
|
||||
]
|
23
preferences/migrations/0005_auto_20190106_0513.py
Normal file
23
preferences/migrations/0005_auto_20190106_0513.py
Normal file
|
@ -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),
|
||||
),
|
||||
]
|
|
@ -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):
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<li><a href="#second">Site actif</a></li>
|
||||
<li><a href="#third">Bureau</a></li>
|
||||
<li><a href="#fourth">Suivi de pintes</a></li>
|
||||
<li><a href="fifth">Autre</a></li>
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
||||
|
@ -23,6 +24,11 @@
|
|||
{{form.global_message}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row uniform">
|
||||
<div class="12u">
|
||||
<button type="submit">Enregistrer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -43,6 +49,11 @@
|
|||
{{form.active_message}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row uniform">
|
||||
<div class="12u">
|
||||
<button type="submit">Enregistrer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -76,6 +87,11 @@
|
|||
{{form.brewer}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row uniform">
|
||||
<div class="12u">
|
||||
<button type="submit">Enregistrer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -105,5 +121,25 @@
|
|||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section id="fifth" class="main">
|
||||
<div class="spotlight">
|
||||
<div class="content">
|
||||
<header class="major">
|
||||
<h2>Autre</h2>
|
||||
</header>
|
||||
<div class="row uniform">
|
||||
<div class="12u">
|
||||
{{form.floating_buttons}}
|
||||
<label for="{{form.floating_buttons.id_for_label}}">Utiliser les boutons de paiement flottants ?</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row uniform">
|
||||
<div class="12u">
|
||||
<button type="submit">Enregistrer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
<th>Cotisations ?</th>
|
||||
<th>Rechargements ?</th>
|
||||
<th>Affecte le solde</th>
|
||||
<th>Icône</th>
|
||||
<th>Administration</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -33,6 +34,7 @@
|
|||
<td>{{ pm.is_usable_in_cotisation | yesno:"Oui, Non" }}</td>
|
||||
<td>{{ pm.is_usable_in_reload | yesno:"Oui, Non" }}</td>
|
||||
<td>{{ pm.affect_balance | yesno:"Oui, Non" }}</td>
|
||||
<td><i class="fa fa-{{ pm.icon }}"></i></td>
|
||||
<td>{% if perms.preferences.change_paymentmethod %}<a class="button small" href="{% url 'preferences:editPaymentMethod' pm.pk %}">Modifier</a> {% endif %}{% if perms.preferences.delete_paymentmethod %}<a class="button small" href="{% url 'preferences:deletePaymentMethod' pm.pk %}">Supprimer</a>{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -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 ##########
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<link rel="icon" sizes="32x32" href="{% static 'favicon32.ico' %}" type="image/x-icon">
|
||||
<link rel="icon" sizes="96x96" href="{% static 'favicon96.ico' %}" type="image/x-icon">
|
||||
<link rel="stylesheet" href="{%static 'css/main.css' %}" />
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
</head>
|
||||
|
|
Loading…
Reference in a new issue