diff --git a/kfet/migrations/0028_auto_20160820_0146.py b/kfet/migrations/0028_auto_20160820_0146.py new file mode 100644 index 00000000..5f8fa377 --- /dev/null +++ b/kfet/migrations/0028_auto_20160820_0146.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('kfet', '0027_auto_20160811_0648'), + ] + + operations = [ + migrations.AlterField( + model_name='operation', + name='group', + field=models.ForeignKey(to='kfet.OperationGroup', on_delete=django.db.models.deletion.PROTECT, related_name='opes'), + ), + migrations.AlterField( + model_name='operationgroup', + name='checkout', + field=models.ForeignKey(to='kfet.Checkout', on_delete=django.db.models.deletion.PROTECT, related_name='opesgroup'), + ), + migrations.AlterField( + model_name='operationgroup', + name='on_acc', + field=models.ForeignKey(to='kfet.Account', on_delete=django.db.models.deletion.PROTECT, related_name='opesgroup'), + ), + ] diff --git a/kfet/models.py b/kfet/models.py index e7807805..0aefaad6 100644 --- a/kfet/models.py +++ b/kfet/models.py @@ -7,6 +7,7 @@ from gestioncof.models import CofProfile from django.utils.six.moves import reduce from django.utils import timezone from django.db import transaction +from django.core.cache import cache from datetime import date, timedelta import re @@ -415,10 +416,10 @@ class Transfer(models.Model): class OperationGroup(models.Model): on_acc = models.ForeignKey( Account, on_delete = models.PROTECT, - related_name = "operations") + related_name = "opesgroup") checkout = models.ForeignKey( Checkout, on_delete = models.PROTECT, - related_name = "operations") + related_name = "opesgroup") at = models.DateTimeField(auto_now_add = True) amount = models.DecimalField( max_digits = 6, decimal_places = 2, @@ -446,7 +447,7 @@ class Operation(models.Model): group = models.ForeignKey( OperationGroup, on_delete = models.PROTECT, - related_name = "+") + related_name = "opes") type = models.CharField( choices = TYPE_ORDER_CHOICES, max_length = choices_length(TYPE_ORDER_CHOICES)) @@ -507,10 +508,15 @@ class Settings(models.Model): @staticmethod def SUBVENTION_COF(): + subvention_cof = cache.get('SUBVENTION_COF') + if subvention_cof: + return subvention_cof try: - return Settings.setting_inst("SUBVENTION_COF").value_decimal + subvention_cof = Settings.setting_inst("SUBVENTION_COF").value_decimal except Settings.DoesNotExist: - return 0 + subvention_cof = 0 + cache.set('SUBVENTION_COF', subvention_cof) + return subvention_cof @staticmethod def ADDCOST_AMOUNT(): diff --git a/kfet/static/kfet/css/history.css b/kfet/static/kfet/css/history.css new file mode 100644 index 00000000..a9a6da08 --- /dev/null +++ b/kfet/static/kfet/css/history.css @@ -0,0 +1,82 @@ +#history { + font-family:'Roboto Mono'; +} + +#history span { + display:inline-block; + height:100%; +} + +#history .day { + height:40px; + line-height:40px; + background-color:#c8102e; + color:#fff; + padding-left:20px; + font-size:16px; + font-weight:bold; +} + +#history .opegroup { + height:30px; + line-height:30px; + background-color:rgba(200,16,46,0.85); + color:#fff; + font-weight:bold; + padding-left:20px; +} + +#history .opegroup .time { + width:70px; +} + +#history .opegroup .trigramme { + width:55px; + text-align:right; +} + +#history .opegroup .amount { + text-align:right; + width:90px; +} + +#history .ope { + position:relative; + height:25px; + line-height:24px; + font-size:12px; + padding-left:15px; +} + +#history .ope .amount { + width:50px; + text-align:right; +} + +#history .ope .infos1 { + width:80px; + text-align:right; +} + +#history .ope .infos2 { + padding-left:15px; +} + +#history div.general.ui-selected, #history div.general.ui-selecting, +#history div.ope.ui-selected, #history div.ope.ui-selecting { + background-color:rgba(200,16,46,0.6); + color:#FFF; +} + +#history .ope.canceled { + color:#444; +} + +#history .ope.canceled::before { + position: absolute; + content: ' '; + width:100%; + left:0; + top: 12px; + border-top: 1px solid rgba(200,16,46,0.5); +} diff --git a/kfet/static/kfet/css/index.css b/kfet/static/kfet/css/index.css index 62e73742..d98453fd 100644 --- a/kfet/static/kfet/css/index.css +++ b/kfet/static/kfet/css/index.css @@ -1,6 +1,7 @@ @import url("nav.css"); @import url("kpsul.css"); @import url("jconfirm-kfet.css"); +@import url("history.css"); body { margin-top:50px; @@ -54,6 +55,10 @@ a:focus, a:hover { padding:0; } +/*.col-content-left { + position:fixed; +}*/ + .content-left-top { background:#fff; padding:10px 30px; @@ -92,3 +97,18 @@ a:focus, a:hover { font-size:45px; text-align:center; } + +.content-right { + margin:0 15px; +} + +.content-right-block h2 { + margin:20px 20px 15px; + padding-bottom:5px; + border-bottom:3px solid #c8102e; + font-size:40px; +} + +.content-right-block table { + width:100%; +} diff --git a/kfet/static/kfet/css/kpsul.css b/kfet/static/kfet/css/kpsul.css index 387a7168..a6a4a9c2 100644 --- a/kfet/static/kfet/css/kpsul.css +++ b/kfet/static/kfet/css/kpsul.css @@ -318,6 +318,10 @@ input[type=number]::-webkit-outer-spin-button { height:100%; } +#basket_rel { + border-top:1px solid #C8102E; +} + #basket { overflow:auto; } @@ -327,6 +331,7 @@ input[type=number]::-webkit-outer-spin-button { margin-right:7px; } #basket_rel { + border-top:0; margin-left:7px; } } @@ -362,74 +367,3 @@ input[type=number]::-webkit-outer-spin-button { .kpsul_middle_right_col { overflow:auto; } - -#history .day { - height:40px; - line-height:40px; - background-color:#c8102e; - color:#fff; - padding-left:20px; - font-size:16px; - font-weight:bold; -} - -#history .opegroup .general { - height:30px; - line-height:30px; - background-color:#c8102e; - color:#fff; - font-weight:bold; - padding-left:10px; -} - -#history .opegroup .general .trigramme { - padding-left:15px; -} - -#history .opegroup .general .amount { - padding-left:15px; -} - -#history .opegroup .ope { - position:relative; - height:25px; - line-height:24px; - font-size:12px; -} - -#history .opegroup .ope .amountukf { - padding-left:15px; -} - -#history .opegroup .ope span { - display:inline-block; - padding-right:10px; -} - -#history .opegroup .ope .amountukf { - width:75px; - text-align:right; -} - -#history .opegroup .ope .infos1 { - width:60px; - text-align:right; -} - -#history div.general.ui-selected, #history div.general.ui-selecting, -#history div.ope.ui-selected, #history div.ope.ui-selecting { - background-color:rgba(200,16,46,0.6); - color:#FFF; -} - -#history .ope.canceled { - color:#444; -} - -#history .ope.canceled::before { - position: absolute; - content: ' '; - width:100%; - top: 12px; - border-top: 1px solid rgba(200,16,46,0.5); -} diff --git a/kfet/templates/kfet/account_read.html b/kfet/templates/kfet/account_read.html index 6a4ddb9c..df2fd0ce 100644 --- a/kfet/templates/kfet/account_read.html +++ b/kfet/templates/kfet/account_read.html @@ -69,7 +69,66 @@