diff --git a/clientsideapp/locale/ru/LC_MESSAGES/django.po b/clientsideapp/locale/ru/LC_MESSAGES/django.po index 18c7ad8..7f022e9 100644 --- a/clientsideapp/locale/ru/LC_MESSAGES/django.po +++ b/clientsideapp/locale/ru/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-04-24 23:27+0300\n" +"POT-Creation-Date: 2018-05-03 17:15+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Dmitry Novikov nerosketch@gmail.com\n" "Language: ru\n" @@ -19,19 +19,19 @@ msgstr "" "%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n" "%100>=11 && n%100<=14)? 2 : 3);\n" -#: clientsideapp/templates/clientsideapp/debt_buy.html:6 +#: templates/clientsideapp/debt_buy.html:6 msgid "Debts" msgstr "Задолженность" -#: clientsideapp/templates/clientsideapp/debt_buy.html:11 +#: templates/clientsideapp/debt_buy.html:11 msgid "repayment of debts" msgstr "Оплатить задолженность" -#: clientsideapp/templates/clientsideapp/debt_buy.html:18 +#: templates/clientsideapp/debt_buy.html:18 msgid "Are you sure you want to spend a payment?" msgstr "Вы уверены что хотите провести платёж?" -#: clientsideapp/templates/clientsideapp/debt_buy.html:21 +#: templates/clientsideapp/debt_buy.html:21 #, python-format msgid "" "From your account, they withdraw funds in %(amount)s rub.
As a " @@ -42,98 +42,105 @@ msgstr "" "результате у вас на счету останется %(ballance_after)s руб.
Администратор сразу сможет видеть что у вас закрыта задолженность." -#: clientsideapp/templates/clientsideapp/debt_buy.html:26 +#: templates/clientsideapp/debt_buy.html:26 msgid "Description of payment" msgstr "Описание платежа" -#: clientsideapp/templates/clientsideapp/debt_buy.html:34 +#: templates/clientsideapp/debt_buy.html:34 msgid "Confirm" msgstr "Подтвердить" -#: clientsideapp/templates/clientsideapp/debt_buy.html:37 +#: templates/clientsideapp/debt_buy.html:37 msgid "Cancel" msgstr "Отменить" -#: clientsideapp/templates/clientsideapp/debts.html:6 +#: templates/clientsideapp/debts.html:6 msgid "Your debt" msgstr "Ваши долги" -#: clientsideapp/templates/clientsideapp/debts.html:11 +#: templates/clientsideapp/debts.html:11 +#: templates/clientsideapp/tasklist.html:11 msgid "State" msgstr "Состояние" -#: clientsideapp/templates/clientsideapp/debts.html:12 +#: templates/clientsideapp/debts.html:12 msgid "Summ" msgstr "Сумма" -#: clientsideapp/templates/clientsideapp/debts.html:13 +#: templates/clientsideapp/debts.html:13 msgid "Description" msgstr "Описание" -#: clientsideapp/templates/clientsideapp/debts.html:14 +#: templates/clientsideapp/debts.html:14 +#: templates/clientsideapp/tasklist.html:12 msgid "Date of create" msgstr "Дата создания" -#: clientsideapp/templates/clientsideapp/debts.html:15 +#: templates/clientsideapp/debts.html:15 msgid "Date of pay" msgstr "Дата платежа" -#: clientsideapp/templates/clientsideapp/debts.html:16 -#: clientsideapp/templates/clientsideapp/debts.html:38 +#: templates/clientsideapp/debts.html:16 templates/clientsideapp/debts.html:38 msgid "Pay" msgstr "Оплатить" -#: clientsideapp/templates/clientsideapp/debts.html:23 -#: clientsideapp/templates/clientsideapp/ext.html:63 -#: clientsideapp/templates/clientsideapp/modal_service_buy.html:19 -#: clientsideapp/templates/clientsideapp/services.html:26 -#: clientsideapp/templates/clientsideapp/services.html:55 +#: templates/clientsideapp/debts.html:23 templates/clientsideapp/ext.html:78 +#: templates/clientsideapp/modal_service_buy.html:19 +#: templates/clientsideapp/services.html:26 +#: templates/clientsideapp/services.html:55 msgid "currency" msgstr "руб." -#: clientsideapp/templates/clientsideapp/debts.html:31 +#: templates/clientsideapp/debts.html:31 msgid "Created paid" msgstr "Создан оплаченным" -#: clientsideapp/templates/clientsideapp/debts.html:33 +#: templates/clientsideapp/debts.html:33 msgid "Not yet paid" msgstr "Ещё не оплачен" -#: clientsideapp/templates/clientsideapp/debts.html:45 +#: templates/clientsideapp/debts.html:45 msgid "You have no debt" msgstr "У вас нет долгов" -#: clientsideapp/templates/clientsideapp/ext.html:7 -#: clientsideapp/templates/clientsideapp/ext.html:41 +#: templates/clientsideapp/ext.html:7 templates/clientsideapp/ext.html:41 msgid "Personal account" msgstr "Личный кабинет" -#: clientsideapp/templates/clientsideapp/ext.html:46 +#: templates/clientsideapp/ext.html:46 msgid "Pays" msgstr "Платежи" -#: clientsideapp/templates/clientsideapp/ext.html:51 +#: templates/clientsideapp/ext.html:51 msgid "Services" msgstr "Услуги" -#: clientsideapp/templates/clientsideapp/ext.html:55 +#: templates/clientsideapp/ext.html:55 +msgid "Language" +msgstr "Язык" + +#: templates/clientsideapp/ext.html:69 msgid "Other" msgstr "Другое" -#: clientsideapp/templates/clientsideapp/ext.html:57 +#: templates/clientsideapp/ext.html:71 msgid "Show debts and pay it" msgstr "Посмотреть долги и оплатить" -#: clientsideapp/templates/clientsideapp/ext.html:58 +#: templates/clientsideapp/ext.html:72 +msgid "Show task history" +msgstr "Посмотреть заявки" + +#: templates/clientsideapp/ext.html:73 msgid "Quit" msgstr "Выйти" -#: clientsideapp/templates/clientsideapp/ext.html:63 +#: templates/clientsideapp/ext.html:78 #, python-format msgid "Your balance is %(ballance)s" msgstr "Ваш балланс %(ballance)s" -#: clientsideapp/templates/clientsideapp/ext.html:74 +#: templates/clientsideapp/ext.html:89 msgid "" "Attantion! You are is admin, and do not be active here, " "please back to admin side. Client side to you for reference only." @@ -142,15 +149,39 @@ msgstr "" "из кабинета пользователя, производите их из админки. Кабинет клиента для вас " "только для ознакомления." -#: clientsideapp/templates/clientsideapp/modal_service_buy.html:5 +#: templates/clientsideapp/index.html:7 +msgid "Account info" +msgstr "Информация о вашей учётной записи" + +#: templates/clientsideapp/index.html:11 +msgid "Username" +msgstr "Логин" + +#: templates/clientsideapp/index.html:14 +msgid "fio" +msgstr "ФИО" + +#: templates/clientsideapp/index.html:17 +msgid "Primary telephone" +msgstr "Основной номер телефона" + +#: templates/clientsideapp/index.html:20 +msgid "Ip Address" +msgstr "ip адрес" + +#: templates/clientsideapp/index.html:24 +msgid "Address" +msgstr "Адрес" + +#: templates/clientsideapp/modal_service_buy.html:5 msgid "Pick service" msgstr "Заказать услугу" -#: clientsideapp/templates/clientsideapp/modal_service_buy.html:8 +#: templates/clientsideapp/modal_service_buy.html:8 msgid "Are you sure you want to order the service?" msgstr "Вы уверены что хотите заказать услугу?" -#: clientsideapp/templates/clientsideapp/modal_service_buy.html:9 +#: templates/clientsideapp/modal_service_buy.html:9 msgid "" "Be careful, after purchasing the service you will withdraw money, and " "you will be able to use the purchased service." @@ -158,64 +189,64 @@ msgstr "" "Будте внимательны, после заказа услуги с вашего счёта снимутся средства, и вы сможете пользоваться купленной услугой." -#: clientsideapp/templates/clientsideapp/modal_service_buy.html:15 +#: templates/clientsideapp/modal_service_buy.html:15 #, python-format msgid "" "Inbound speed: %(speedIn)s MBit/s
Outgoing speed: %(speedOut)s MBit/" "s
Cost: %(amount)s rubles." msgstr "" -#: clientsideapp/templates/clientsideapp/modal_service_buy.html:19 +#: templates/clientsideapp/modal_service_buy.html:19 #, python-format msgid "The cost is %(amount)s" msgstr "Стоимость %(amount)s" -#: clientsideapp/templates/clientsideapp/modal_service_buy.html:23 -#: clientsideapp/templates/clientsideapp/services.html:63 +#: templates/clientsideapp/modal_service_buy.html:23 +#: templates/clientsideapp/services.html:63 msgid "Pick" msgstr "Заказать" -#: clientsideapp/templates/clientsideapp/modal_service_buy.html:25 +#: templates/clientsideapp/modal_service_buy.html:25 msgid "Close" msgstr "Закрыть" -#: clientsideapp/templates/clientsideapp/pays.html:6 +#: templates/clientsideapp/pays.html:6 msgid "conducted payments" msgstr "Проведённые платежи" -#: clientsideapp/templates/clientsideapp/pays.html:11 +#: templates/clientsideapp/pays.html:11 msgid "Transaction Amount (rubles)" msgstr "Сумма транзакции (руб)" -#: clientsideapp/templates/clientsideapp/pays.html:12 +#: templates/clientsideapp/pays.html:12 msgid "Date of transaction" msgstr "Дата транзакции" -#: clientsideapp/templates/clientsideapp/pays.html:13 +#: templates/clientsideapp/pays.html:13 msgid "Comment" msgstr "Комментарий" -#: clientsideapp/templates/clientsideapp/pays.html:25 +#: templates/clientsideapp/pays.html:25 msgid "You have not spent payments" msgstr "У вас нет проведённых платежей" -#: clientsideapp/templates/clientsideapp/services.html:14 +#: templates/clientsideapp/services.html:14 msgid "Your current service" msgstr "Ваша текущая услуга" -#: clientsideapp/templates/clientsideapp/services.html:19 +#: templates/clientsideapp/services.html:19 msgid "The date of connection" msgstr "Дата подключения" -#: clientsideapp/templates/clientsideapp/services.html:22 +#: templates/clientsideapp/services.html:22 msgid "The date of finish service" msgstr "Дата завершения услуги" -#: clientsideapp/templates/clientsideapp/services.html:25 +#: templates/clientsideapp/services.html:25 msgid "Cost" msgstr "Стоимость" -#: clientsideapp/templates/clientsideapp/services.html:35 +#: templates/clientsideapp/services.html:35 msgid "" "Attantion! You have not yet a service, for use the services " "please purchase service you want." @@ -223,33 +254,52 @@ msgstr "" "Внимание! У вас нет услуги, для использования ресурсов " "приобретите нужную услугу из представленных тут." -#: clientsideapp/templates/clientsideapp/services.html:46 +#: templates/clientsideapp/services.html:46 msgid "Services available for ordering" msgstr "Доступные для заказа услуги" -#: clientsideapp/templates/clientsideapp/services.html:68 +#: templates/clientsideapp/services.html:68 msgid "No services available for ordering" msgstr "Нет доступных для заказа услуг" -#: clientsideapp/views.py:51 +#: templates/clientsideapp/tasklist.html:6 +msgid "Task history" +msgstr "История заявок" + +#: templates/clientsideapp/tasklist.html:13 +msgid "The nature of the damage" +msgstr "Характер заявки" + +#: templates/clientsideapp/tasklist.html:14 +msgid "Expected or real completion date" +msgstr "Ожидаемый или реальный срок выполнения" + +#: templates/clientsideapp/tasklist.html:36 +msgid "You didn't leave any requests for breakdowns." +msgstr "Заявки по вашей учётной записи не найдены" + +#: views.py:51 #, python-format msgid "Buy the service via user side, service '%s'" msgstr "Покупка тарифного плана через личный кабинет, тариф '%s'" -#: clientsideapp/views.py:54 +#: views.py:54 #, python-format msgid "The service '%s' wan successfully activated" msgstr "Услуга '%s' успешно подключена" -#: clientsideapp/views.py:84 +#: views.py:84 msgid "Are you not sure that you want buy the service?" msgstr "Вы не уверены что хотите оплатить долг?" -#: clientsideapp/views.py:86 +#: views.py:86 msgid "Your account have not enough money" msgstr "Недостаточно средств на счету" -#: clientsideapp/views.py:89 +#: views.py:89 #, python-format msgid "%(username)s paid the debt %(amount).2f" msgstr "%(username)s заплатил долг в размере %(amount).2f" + +msgid "Num of active tasks" +msgstr "Кол. активных заявок" diff --git a/clientsideapp/templates/clientsideapp/ext.html b/clientsideapp/templates/clientsideapp/ext.html index fe10a31..4105265 100644 --- a/clientsideapp/templates/clientsideapp/ext.html +++ b/clientsideapp/templates/clientsideapp/ext.html @@ -51,10 +51,24 @@ {% trans 'Services' %} + + diff --git a/clientsideapp/templates/clientsideapp/index.html b/clientsideapp/templates/clientsideapp/index.html index 8897641..3ac7e35 100644 --- a/clientsideapp/templates/clientsideapp/index.html +++ b/clientsideapp/templates/clientsideapp/index.html @@ -1,4 +1,39 @@ {% extends 'clientsideapp/ext.html' %} +{% load i18n %} + {% block client_main %} + +
+
{% trans 'Account info' %}
+
+ {% with user=request.user %} +
+
{% trans 'Username' %}
+
{{ user.username }}
+ +
{% trans 'fio' %}
+
{{ user.fio }}
+ +
{% trans 'Primary telephone' %}
+
{{ user.telephone }}
+ +
{% trans 'Ip Address' %}
+
{{ user.ip_address }}
+ + {% if user.street %} +
{% trans 'Address' %}
+
{{ user.street.name }}, {{ user.house|default:'' }}
+ {% endif %} + + {% if num_active_tasks > 0 %} +
{% trans 'Num of active tasks' %}
+
{{ num_active_tasks }}
+ {% endif %} + +
+ {% endwith %} +
+
+ {% include 'custom_pages/main_page.htm' %} {% endblock %} diff --git a/clientsideapp/templates/clientsideapp/tasklist.html b/clientsideapp/templates/clientsideapp/tasklist.html new file mode 100644 index 0000000..a060bb0 --- /dev/null +++ b/clientsideapp/templates/clientsideapp/tasklist.html @@ -0,0 +1,52 @@ +{% extends 'clientsideapp/ext.html' %} +{% load i18n %} +{% load tasktags %} +{% block client_main %} + + + +
+ + + + + + + + + + + {% for task in tasks %} + + + + + + + {% empty %} + + + + {% endfor %} + +
{% trans 'State' %}{% trans 'Date of create' %}{% trans 'The nature of the damage' %}{% trans 'Expected or real completion date' %}
{{ task.get_state_display }} + {% if task.time_of_create|is_current_year %} + {{ task.time_of_create|date:'d b H:i' }} + {% else %} + {{ task.time_of_create|date:'d b H:i. Y' }} + {% endif %} + {{ task.get_mode_display }} + {% if task.out_date|is_current_year %} + {{ task.out_date|date:'d E, l' }} + {% else %} + {{ task.out_date|date:'d E, l Y' }} + {% endif %} +
+ {% trans "You didn't leave any requests for breakdowns." %} + +
+
+ +{% endblock %} \ No newline at end of file diff --git a/clientsideapp/urls.py b/clientsideapp/urls.py index 689e42f..3f8274a 100644 --- a/clientsideapp/urls.py +++ b/clientsideapp/urls.py @@ -1,4 +1,3 @@ -# -*- coding:utf-8 -*- from django.conf.urls import url from . import views @@ -10,5 +9,6 @@ urlpatterns = [ url(r'^services$', views.services, name='services'), url(r'^services/(?P\d+)/buy$', views.buy_service, name='buy_service'), url(r'^debts$', views.debts_list, name='debts'), - url(r'^debts/(?P\d+)$', views.debt_buy, name='debt_buy') + url(r'^debts/(?P\d+)$', views.debt_buy, name='debt_buy'), + url(r'^tasks$', views.task_history, name='task_history') ] diff --git a/clientsideapp/views.py b/clientsideapp/views.py index 5faa7db..f95b796 100644 --- a/clientsideapp/views.py +++ b/clientsideapp/views.py @@ -1,4 +1,3 @@ -# coding=utf-8 from django.contrib.auth.decorators import login_required from django.contrib.gis.shortcuts import render_to_text from django.shortcuts import render, get_object_or_404, redirect @@ -8,13 +7,17 @@ from django.utils.translation import gettext_lazy as _, gettext from abonapp.models import AbonLog, InvoiceForPayment, Abon from tariff_app.models import Tariff +from taskapp.models import Task from mydefs import LogicError from agent import NasFailedResult, NasNetworkError @login_required def home(request): - return render(request, 'clientsideapp/index.html') + num_active_tasks = Task.objects.filter(abon=request.user, state='S').count() + return render(request, 'clientsideapp/index.html', { + 'num_active_tasks': num_active_tasks + }) @login_required @@ -105,3 +108,11 @@ def debt_buy(request, d_id): 'amount': debt.amount, 'ballance_after': abon.ballance - debt.amount }) + + +@login_required +def task_history(request): + tasks = Task.objects.filter(abon=request.user) + return render(request, 'clientsideapp/tasklist.html', { + 'tasks': tasks + }) diff --git a/static/clientside/custom.css b/static/clientside/custom.css index 246d210..3015684 100644 --- a/static/clientside/custom.css +++ b/static/clientside/custom.css @@ -1,16 +1,16 @@ img.navbar-brand { - width: 59px; - height: 50px; - padding: 0; - margin: 0 15px 0 0; + width: 59px; + height: 50px; + padding: 0; + margin: 0 15px 0 0; } .table thead { - background-color: #ddd; + background-color: #ddd; } /* White background in tables */ .table tr:nth-of-type(2n) { - background-color: white; + background-color: white; } @@ -21,6 +21,15 @@ img.navbar-brand { .modal-header.primary {background-color: #789cbb;} body{ - padding: 88px 15px 0; + padding: 88px 15px 0; } + +@media (min-width: 768px){ + .dl-horizontal dt { + width: 240px; + } + .dl-horizontal dd{ + margin-left: 260px; + } +} diff --git a/taskapp/templatetags/tasktags.py b/taskapp/templatetags/tasktags.py index 53d9666..bae0206 100644 --- a/taskapp/templatetags/tasktags.py +++ b/taskapp/templatetags/tasktags.py @@ -1,11 +1,12 @@ -from datetime import datetime +from typing import Union +from datetime import datetime, date from django import template register = template.Library() @register.simple_tag -def is_today(time): +def is_today(time: datetime): if type(time) is not datetime: raise TypeError now = datetime.now() @@ -13,8 +14,16 @@ def is_today(time): @register.simple_tag -def is_yesterday(time): +def is_yesterday(time: datetime): if type(time) is not datetime: raise TypeError now = datetime.now() return now.day - 1 == time.day + + +@register.filter +def is_current_year(time: Union[datetime, date]): + if not isinstance(time, (datetime, date)): + raise TypeError + now = datetime.now() + return now.year == time.year