Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ipipan/valunifer
1 result
Show changes
Commits on Source (37)
Showing
with 930 additions and 59 deletions
......@@ -82,3 +82,9 @@ Compiled application files will be located in `frontend/dist/`.
export LOADING_THE_SLOWOSIEC_ONTOLOGY_HIERARCHY_DISABLED=true
python manage.py db_import_relation_entries
## Database update for free lexical units
export LOADING_THE_SLOWOSIEC_ONTOLOGY_HIERARCHY_DISABLED=true
python manage.py db_import_potential_entry_2_lu_connections
python manage.py update_table_cursors
......@@ -718,6 +718,50 @@
background: linear-gradient(to right, rgba(256, 256, 256, 0.1), rgb(256, 256, 256)) repeat scroll 0% 0%;
}
.frame.highlight .means, .example-role .means {
background-color: rgb(188, 143, 143);
}
.frame.active .means, .phrase.means, .custom-control.means {
background-color: rgb(149, 92, 92);
}
.frame.highlight .means.source, .example-role .means.source {
background: linear-gradient(to left, rgba(188, 143, 143, 0.1), rgb(188, 143, 143)) repeat scroll 0% 0%;
}
.frame.active .means.source, .phrase.means.source {
background: linear-gradient(to left, rgba(149, 92, 92, 0.1), rgb(149, 92, 92)) repeat scroll 0% 0%;
}
.frame.highlight .means.foreground, .example-role .means.foreground {
background: linear-gradient(to top, rgba(188, 143, 143, 0.1), rgb(188, 143, 143)) repeat scroll 0% 0%;
}
.frame.active .means.foreground, .phrase.means.foreground {
background: linear-gradient(to top, rgba(149, 92, 92, 0.1), rgb(149, 92, 92)) repeat scroll 0% 0%;
}
.frame.highlight .means.background, .example-role .means.background {
background: linear-gradient(to bottom, rgba(188, 143, 143, 0.1), rgb(188, 143, 143)) repeat scroll 0% 0%;
}
.frame.active .means.background, .phrase.means.background {
background: linear-gradient(to bottom, rgba(149, 92, 92, 0.1), rgb(149, 92, 92)) repeat scroll 0% 0%;
}
.frame.highlight .means.goal, .example-role .means.goal {
background: linear-gradient(to right, rgba(188, 143, 143, 0.1), rgb(188, 143, 143)) repeat scroll 0% 0%;
}
.frame.active .means.goal, .phrase.means.goal {
background: linear-gradient(to right, rgba(149, 92, 92, 0.1), rgb(149, 92, 92)) repeat scroll 0% 0%;
}
.custom-control.source {
background: linear-gradient(to left, rgba(104, 104, 104, 0.1), rgb(104, 104, 104)) repeat scroll 0% 0%;
}
......
from django.core.management.base import BaseCommand
from django.db.models import Q
from connections.models import Entry
from meanings.models import LexicalUnit
class Command(BaseCommand):
args = ''
help = 'Import potential entry-lu connections to database.'
def handle(self, **options):
import_potential_entry_lu_connections_cmd()
def import_potential_entry_lu_connections_cmd():
for entry in Entry.objects.all():
print("Processing entry: "+entry.name)
lexical_units = LexicalUnit.objects.filter(Q(Q(base=entry.name) | Q(base__startswith=entry.name+' ')))
for lu in lexical_units.all():
lu.potential_entry_id = entry.id
lu.potential_entries.add(entry.id)
lu.save()
......@@ -38,3 +38,7 @@ table.table-button-menu {
#free-lus-frame .argument.active {
background-color: black;
}
#lu-table .argument.active {
background-color: #dee1e4;
}
......@@ -17,6 +17,10 @@ var main_vertical_relations = []
var temporal_vertical_relations = []
var vertical_relation_negations = []
var example_opinions = []
var example_sources = []
function make_opinion_row(item, span, width) {
const opinion_row = document.createElement('tr');
opinion_row.className = 'opinion-row';
......@@ -1184,6 +1188,30 @@ function getVerticalRelationNegations() {
});
}
function getExampleOpinions() {
$.ajax({
dataType: "json",
url: '/' + lang + '/entries/example_opinions',
success: function(data){
example_opinions = data.example_opinions;
},
async: false
});
}
function getExampleSources() {
$.ajax({
dataType: "json",
url: '/' + lang + '/entries/example_sources',
success: function(data){
example_sources = data.example_sources;
},
async: false
});
}
$(document).ready(function() {
bind_last_visited();
......@@ -1225,6 +1253,10 @@ $(document).ready(function() {
getVerticalRelationNegations();
getExampleOpinions();
getExampleSources();
// $.getJSON('relations', function(data){
// memorizeRelations(data.relations);
// });
......
......@@ -4,3 +4,10 @@ window.update_entries = function () {
window.unificationLeftPaneApp.lexicalUnitId = null;
}
}
window.update_view = function () {
if(window.unificationLeftPaneApp) {
window.unificationLeftPaneApp.unificationEntriesListRefreshKey++;
window.unificationLeftPaneApp.lexicalUnitId = null;
}
}
......@@ -455,7 +455,7 @@ function initialize_main_form() {
});*/
}
function initialize_local_form(selector, url) {
function initialize_local_form(selector, url, reload_function) {
var form = selector.find('form');
......@@ -478,7 +478,7 @@ function initialize_local_form(selector, url) {
show_form_errors(form, response.errors);
} else if (response.success) {
//ponizsza funkcja prowadzi do metody osadzonej w main.js, gdzie nastepuje odpowiednie odswiezenie komponentu z lista elementow Vue
update_entries();
reload_function();
selector.modal('hide');
}
submit.prop('disabled', false);
......@@ -493,17 +493,16 @@ function initialize_local_form(selector, url) {
}
function initialize_frames_form() {
initialize_local_form($('#frame-filters-local'), '/' + lang + '/entries/send_frames_form/');
initialize_local_form($('#frame-filters-local'), '/' + lang + '/entries/send_frames_form/', update_view);
}
function initialize_unified_frames_form() {
initialize_local_form($('#unified-frame-filters'), '/' + lang + '/entries/send_unified_frames_form/');
initialize_local_form($('#unified-frame-filters'), '/' + lang + '/entries/send_unified_frames_form/', update_entries);
}
function initialize_schemata_form() {
initialize_local_form($('#schema-filters-local'), '/' + lang + '/entries/send_schemata_form/');
initialize_local_form($('#schema-filters-local'), '/' + lang + '/entries/send_schemata_form/', update_view);
/*var schemata_form = $('#schema-filters').find('form');
......
function setup_free_lus_list(options) {
const can_see_assignees = has_permission("users.view_assignment");
const ajaxURL = can_see_assignees ? '/' + lang + '/entries/get_entries/?with_lexical_units=false&without_frames=true&show_linked_entries_disabled=true' : '/' + lang + '/unifier/get_unified_frames/?exclude_status=N&show_linked_entries_disabled=true&restrict_to_user='+window.USER_USERNAME;
let ajaxURL = '/' + lang + '/entries/get_entries/?has_unified_frame=false&with_lexical_units=false&free_lus=true&without_frames='+ (options.show_all ? 'false' : 'true') +'&show_linked_entries_disabled=true';
if(!can_see_assignees && !options.show_all) {
ajaxURL += '&restrict_to_user='+window.USER_USERNAME;
}
const datatable = setup_datatable({
element: options.table,
......
......@@ -33,8 +33,8 @@
<li class="nav-item mr-1"><a
onclick='window.location.replace(window.currUnifiedFrameId ? "/pl/entries/hierarchy/?unified_frame_id="+window.currUnifiedFrameId : "/pl/entries/hierarchy")'
class="nav-link cursor-pointer">{% trans "Hierarchia" %}</a></li>
<li class="nav-item mr-1"><a href="{% url 'entries:lu_free' %}" class="nav-link">{% trans "Wolne jednostki" %}</a></li>
{% if is_superlexicograf %}
<li class="nav-item mr-1"><a href="{% url 'entries:lu_free' %}" class="nav-link">{% trans "Wolne jednostki" %}</a></li>
<li class="nav-item mr-1"><a
onclick='window.location.replace(window.currUnifiedFrameId ? "/pl/entries/vertical-relations/?unified_frame_id="+window.currUnifiedFrameId : "/pl/entries/vertical-relations")'
class="nav-link cursor-pointer">{% trans "Relacie poziome" %}</a></li>
......
......@@ -2,7 +2,8 @@ from django.urls import path
from . import autocompletes, views
from .views import ajax_plWN_context_lookup, ajax_predefined_preferences, ajax_relations, ajax_synsets, ajax_roles, \
ajax_role_attributes, ajax_role_sub_attributes, ajax_free_slowal_frame_lookup, ajax_frame_opinions
ajax_role_attributes, ajax_role_sub_attributes, ajax_free_slowal_frame_lookup, ajax_frame_opinions, \
ajax_example_opinions, ajax_example_sources, ajax_lu_selection_lookup
app_name = 'entries'
......@@ -34,6 +35,10 @@ urlpatterns = [
path('synsets/', ajax_synsets, name='synsets'),
path('free_slowal_frame_lookup/', ajax_free_slowal_frame_lookup, name='free_slowal_frame_lookup'),
path('lu_selection_lookup/', ajax_lu_selection_lookup, name='lu_selection_lookup'),
path('example_opinions/', ajax_example_opinions, name='example_opinions'),
path('example_sources/', ajax_example_sources, name='example_sources'),
# TODO remove!
#path('test/', views.test, name='test'),
......
import json
import operator
import time
......@@ -18,13 +19,14 @@ from django.utils.translation import gettext as _
from crispy_forms.utils import render_crispy_form
from connections.models import Entry, Subentry, ArgumentConnection, RealisationDescription
from examples.models import Example, ExampleOpinion, ExampleSource
from meanings.models import LexicalUnit
from syntax.models import NaturalLanguageDescription, Schema
from semantics.models import Frame, PredefinedSelectionalPreference, SelectivePreferenceRelations, SemanticRole, \
RoleAttribute, RoleSubAttribute, SelectionalPreferenceRelation, FrameOpinion
from common.decorators import ajax_required, ajax
from unifier.models import UnifiedFrame
from unifier.models import UnifiedFrame, UnifiedFrame2SlowalFrameMapping
from django.conf import settings
from .forms import (
......@@ -463,6 +465,7 @@ def get_entries(request):
scroller_params = get_scroller_params(request.POST)
with_lexical_units = request.GET.get('with_lexical_units') == 'true'
without_frames = request.GET.get('without_frames') == 'true'
free_lus = request.GET.get('free_lus') == 'true'
exclude_status = request.GET.get('exclude_status')
restrict_to_user = request.GET.get('restrict_to_user')
has_unified_frame = request.GET.get('has_unified_frame')
......@@ -475,7 +478,9 @@ def get_entries(request):
#entries = entries.filter(subentries__schema_hooks__alternation=2)
if without_frames:
entries = entries.filter(name__in=(LexicalUnit.objects.filter(Q(frames__isnull=True) | Q(frames__in_building=True)).values("base")))
# entries = entries.filter(lexical_units__frames__isnull=True)
# entries = entries.filter(Q(lexical_units__frames__isnull=True) | Q(lexical_units__frames__in_building=True))
entries = entries.filter(Q(potential_lexical_unit__frames__isnull=True) | Q(potential_lexical_unit__frames__in_building=True))
total = entries.count()
if scroller_params['filter']:
......@@ -509,8 +514,14 @@ def get_entries(request):
order_field = '-' + order_field
if restrict_to_user:
# pre-filtering entries for performance reasons
entries = entries.filter(lexical_units__frames__assignments__user=User.objects.get(username=restrict_to_user))
if without_frames:
# free lu user filtering
entries = entries.filter(Q(lexical_units__frames__free_lu_user_assignment=User.objects.get(username=restrict_to_user)) |
Q(lexical_units__frames__free_lu_user_assignment=None))
else:
# pre-filtering entries for performance reasons
entries = entries.filter(lexical_units__frames__assignments__user=User.objects.get(username=restrict_to_user))
entries = (
entries
.order_by(order_field)
......@@ -518,7 +529,7 @@ def get_entries(request):
.prefetch_related(Prefetch("assignments", to_attr="_assignments"))
)
if with_lexical_units:
if not free_lus and (with_lexical_units or has_unified_frame):
frameQueryset = Frame.objects.prefetch_related(Prefetch("assignments", to_attr="_assignments"))
entries = entries.prefetch_related(
Prefetch(
......@@ -533,10 +544,12 @@ def get_entries(request):
)
)
if exclude_status is not None:
entries = entries.exclude(lexical_units__frames__status=exclude_status)
entries = entries.filter(lexical_units__frames__status=exclude_status)
entries = entries.filter(lexical_units__frames__isnull=False)
if has_unified_frame == 'true':
entries = entries.filter(lexical_units__frames__slowal_frame_2_unified_frame__isnull=False)
elif has_unified_frame == 'false':
entries = entries.filter(lexical_units__frames__slowal_frame_2_unified_frame__isnull=True)
filtered = entries.count()
......@@ -708,7 +721,15 @@ def frame2dict(frame, entry_meanings):
'entry_meaning' : lu in entry_meanings,
'definition' : lu.definition,
'gloss' : lu.gloss,
'url' : None if lu.luid is None else 'http://plwordnet21.clarin-pl.eu/lemma/{}/{}'.format(lu.base, lu.sense)
'url' : None if lu.luid is None else 'http://plwordnet21.clarin-pl.eu/lemma/{}/{}'.format(lu.base, lu.sense),
'lu_external_argument_connection' : {
'arg_id': lu.lu_external_argument_connection.id,
'role': '{}{}{}'.format(lu.lu_external_argument_connection.role.role.role.lower(),
' ' + lu.lu_external_argument_connection.role.attribute.attribute.lower() if lu.lu_external_argument_connection.role.attribute else '',
' (' + lu.lu_external_argument_connection.role.sub_attribute.sub_attribute.lower() + ')'
if lu.lu_external_argument_connection.role.sub_attribute else '')
if lu.lu_external_argument_connection.role is not None else None,
} if lu.lu_external_argument_connection is not None else None,
} for lu in frame.lexical_units.all()
],
'arguments' : [
......@@ -774,9 +795,9 @@ def get_alternations(schemata, frames):
return alt_dict, phrases, realisation_descriptions
def get_examples(entry):
examples = []
for example in entry.examples.all():
def get_examples(input_examples):
examples_dict = {}
for example in input_examples:
frame_ids, argument_ids, lu_ids, schema_ids, phrases, phrases_syntax, positions = set(), set(), set(), set(), set(), set(), set()
for connection in example.example_connections.all():
for argument in connection.arguments.all():
......@@ -792,7 +813,8 @@ def get_examples(entry):
for argument_connection in hook.argument_connections.all():
frame_ids.add(argument_connection.argument.frame.id)
argument_ids.add('{}-{}'.format(argument_connection.argument.frame.id, argument_connection.argument.id))
examples.append({
examples_dict[example.id] = {
'id' : str(example.id),
'sentence' : example.sentence,
'source' : EXAMPLE_SOURCE()[example.source.key],
......@@ -805,8 +827,8 @@ def get_examples(entry):
'phrases' : sorted(phrases),
'phrases_syntax' : sorted(phrases_syntax),
'positions' : sorted(positions),
})
return sorted(examples, key=lambda x: x['sentence'])
}
return examples_dict
# [[POS1], [POS2, POS3]]
# =>
......@@ -897,6 +919,7 @@ def get_entry(request):
filter_schemata = apply_filters and entry_form.cleaned_data['filter_schemata']
filter_frames = apply_filters and entry_form.cleaned_data['filter_frames']
lu_id = request.POST.get("lexical_unit_id")
free_lus = request.POST.get('free_lus') == 'true'
lexical_unit = LexicalUnit.objects.get(pk=lu_id) if lu_id else None
if filter_schemata:
schema_forms = []
......@@ -956,7 +979,12 @@ def get_entry(request):
all_schema_objects += list(schema_objects)
subentries.append({'str': subentry2str(subentry), 'id': subentry.id, 'schemata': schemata})
# frame_objects = Frame.objects.filter(arguments__argument_connections__schema_connections__subentry__entry=entry).distinct()
frame_objects = Frame.objects.filter(lexical_units__entry=entry).distinct()
if free_lus:
frame_objects = Frame.objects.filter(Q(lexical_units__entry=entry) |
Q(lexical_units__potential_entries=entry)).distinct()
else:
frame_objects = Frame.objects.filter(lexical_units__entry=entry).distinct()
# filter out frames by frame properties
if filter_frames:
frame_objects = get_filtered_objects2(frame_forms, frame_objects)
......@@ -964,10 +992,22 @@ def get_entry(request):
frame_objects = frame_objects.filter(lexical_units=lexical_unit)
if local_frame_filter_form:
frame_objects = get_filtered_objects(local_frame_filter_form, frame_objects)
free_lexical_unit = LexicalUnit.objects.filter(Q(potential_entries=eid) & Q(frames__isnull=True))
all_examples = Example.objects.filter(Q(example_connections__lexical_unit__in=entry.lexical_units.all()) |
Q(example_connections__lexical_unit__in=free_lexical_unit) |
Q(entry=entry) |
Q(example_connections__lexical_unit__in=list(chain.from_iterable(map(lambda frame: frame.lexical_units.all(), frame_objects)))) |
Q(example_connections__schema_connections__schema__in=all_schema_objects)).distinct()
frames = [frame2dict(frame, entry.lexical_units.all()) for frame in filter(lambda frame: not frame.in_building, frame_objects.all())]
frames_in_building_process = [frame2dict(frame, entry.lexical_units.all()) for frame in filter(lambda frame: frame.in_building, frame_objects.all())]
alternations, realisation_phrases, realisation_descriptions = get_alternations(all_schema_objects, frame_objects)
examples = get_examples(entry)
examples_dict = get_examples(all_examples.all())
examples = sorted(examples_dict.values(), key=lambda x: x['sentence'])
unified_frame = None
if lexical_unit and (unified_frame := UnifiedFrame.objects.all().for_lexical_unit(lexical_unit).first()):
unified_frame = {
......@@ -985,9 +1025,11 @@ def get_entry(request):
frame_lexical_unit_ids = set(map(lambda lu: lu['id'], (lu for iterable in frames for lu in iterable['lexical_units'])))
frame_lexical_unit_ids = frame_lexical_unit_ids | set(map(lambda lu: lu['id'], (lu for iterable in frames_in_building_process for lu in iterable['lexical_units'])))
free_lexical_units = [lu2dict(lu) for lu in filter(lambda lu: lu.id not in frame_lexical_unit_ids, LexicalUnit.objects.filter(Q(base=entry.name) | Q(base__startswith=entry.name+' ')).all())]
free_lexical_units = [lu2dict(lu) for lu in filter(lambda lu: lu.id not in frame_lexical_unit_ids, free_lexical_unit.all())]
return JsonResponse({'free_lexical_units': free_lexical_units, 'subentries' : subentries, 'frames' : frames, 'frames_in_building_process': frames_in_building_process, 'alternations' : alternations, 'realisation_phrases' : realisation_phrases, 'realisation_descriptions' : realisation_descriptions, 'examples' : examples, 'unified_frame': unified_frame, 'last_visited' : request.session['last_visited'] })
slowal_frame_with_unified_frame = list(map(lambda mapping: mapping.slowal_frame.id, UnifiedFrame2SlowalFrameMapping.objects.filter(slowal_frame__in=frame_objects)))
return JsonResponse({'slowal_frame_with_unified_frame': slowal_frame_with_unified_frame, 'free_lexical_units': free_lexical_units, 'subentries' : subentries, 'frames' : frames, 'frames_in_building_process': frames_in_building_process, 'alternations' : alternations, 'realisation_phrases' : realisation_phrases, 'realisation_descriptions' : realisation_descriptions, 'examples' : examples, 'unified_frame': unified_frame, 'last_visited' : request.session['last_visited'] })
return JsonResponse({})
......@@ -1092,8 +1134,7 @@ def ajax_predefined_preferences(request):
def ajax_roles(request):
roles = []
for role in SemanticRole.objects.order_by('priority'):
if role.role != 'Lemma':
roles.append({"id": role.id, "role": role.role, "priority": role.priority, "color": role.color})
roles.append({"id": role.id, "role": role.role, "priority": role.priority, "color": role.color})
context = {
'roles': roles,
......@@ -1151,6 +1192,31 @@ def ajax_relations(request):
return context
@ajax(method='get', encode_result=True)
def ajax_example_opinions(request):
relations = [{"id": relation.id, "opinion": relation.key} for relation in ExampleOpinion.objects.all()]
context = {
'example_opinions': relations,
}
return context
@ajax(method='get', encode_result=True)
def ajax_example_sources(request):
relations = [{"id": relation.id, "source": relation.key} for relation in ExampleSource.objects.all()]
context = {
'example_sources': relations,
}
return context
@ajax(method='get', encode_result=True)
def ajax_synsets(request, base, pos):
......@@ -1196,4 +1262,12 @@ def ajax_free_slowal_frame_lookup(request, term):
return {'result': lexical_unit_str}
@ajax(method='get', encode_result=True)
def ajax_lu_selection_lookup(request, term):
if len(term) > 0:
obj_results = LexicalUnit.objects.filter(base__startswith=term)\
.order_by('base', 'sense')
lexical_unit_str = []
for lexical_unit in obj_results:
lexical_unit_str.append(str(lexical_unit))
return {'result': lexical_unit_str}
......@@ -13,9 +13,9 @@ from users.models import Note
class FinStatementForm(forms.ModelForm):
start_date = forms.DateTimeField(input_formats=['%d-%m-%Y'],
start_date = forms.DateTimeField(label='Data rozpoczęcia (dd-mm-yyyy)', input_formats=['%d-%m-%Y'],
widget=forms.DateTimeInput(format='%d-%m-%Y', attrs={'class': 'form-control'}))
end_date = forms.DateTimeField(input_formats=['%d-%m-%Y'],
end_date = forms.DateTimeField(label='Data zakończenia (dd-mm-yyyy)', input_formats=['%d-%m-%Y'],
widget=forms.DateTimeInput(
format='%d-%m-%Y', attrs={'class': 'form-control'}))
......@@ -33,23 +33,39 @@ class FinStatementForm(forms.ModelForm):
'payment',
'last_statement_payment',
'price_per_unified_frame',
'price_per_slowal_frame',
'price_per_free_lexical_unit_frame',
'user',
'is_active'
]
labels = {
'statement_id': 'Numer umowy',
'title': 'Tytuł',
'payment': 'Budżet',
'last_statement_payment': 'Kwota do wykorzystania',
'price_per_unified_frame': 'Stawka za ramę zunifikowaną',
'price_per_slowal_frame': 'Stawka za podpiętą ramę slowal-a',
'price_per_free_lexical_unit_frame': 'Stawka za opracowaną wolną jednostkę',
'user': 'Nazwa użytkownika',
'is_active': "Czy umowa jest aktywna?"
}
def __init__(self, *args, instance, **kwargs):
super().__init__(*args, instance=instance, **kwargs)
self.helper = FormHelper()
self.helper.layout = Layout(
Fieldset('', 'statement_id', 'title', 'start_date', 'end_date',
'payment', 'price_per_unified_frame', 'last_statement_payment', 'user', 'is_active'),
'payment', 'price_per_unified_frame', 'price_per_slowal_frame',
'price_per_free_lexical_unit_frame', 'last_statement_payment', 'user', 'is_active'),
ButtonHolder(
Submit('submit', _('Zapisz'), css_class='btn btn-sm btn-success'),
HTML(format_lazy('<a class="btn btn-sm btn-light" href="{}">{}</a>',
reverse_lazy('financial_settlement:statement_list'), _('Wróć'))),
),
)
for field in ['statement_id', 'title', 'start_date', 'end_date', 'payment', 'price_per_unified_frame', 'user']:
for field in ['statement_id', 'title', 'start_date', 'end_date', 'payment', 'price_per_unified_frame',
'price_per_slowal_frame', 'price_per_free_lexical_unit_frame', 'user']:
self.fields[field].required = True
if instance.pk:
......
......@@ -4,12 +4,14 @@ from django.db import models
class FinStatement(models.Model):
"""" Class represents finance statement assigned to the user. """
statement_id = models.PositiveIntegerField(null=False)
statement_id = models.CharField(max_length=100, default=None, blank=True, null=True)
title = models.CharField(max_length=200, default=None, blank=True, null=True)
start_date = models.DateField(null=False)
end_date = models.DateField(null=False)
payment = models.DecimalField(null=False, default=0, max_digits=10, decimal_places=3)
price_per_unified_frame = models.DecimalField(null=False, default=0, max_digits=10, decimal_places=3)
price_per_slowal_frame = models.DecimalField(null=False, default=0, max_digits=10, decimal_places=3)
price_per_free_lexical_unit_frame = models.DecimalField(null=False, default=0, max_digits=10, decimal_places=3)
last_statement_payment = models.DecimalField(null=False, default=0, max_digits=10, decimal_places=3)
user = models.ForeignKey(User, on_delete=models.PROTECT, default=None, blank=True, null=True)
is_active = models.BooleanField(default=False)
......
{% extends 'base-margins.html' %}
{% load i18n %}
{% block title %}{% trans 'Szczegóły' %}{% endblock %}
{% block content2 %}
<table class="w-100">
<tr><td>
<div class="mt-3 float-right">
<a title="Zamknij" href="{% url 'financial_settlement:statement_list' %}" class="btn btn-sm btn-outline-dark">X</a>
</div>
</td>
</tr>
</table>
<div class="mt-3">
<h5 class="float-left mt-2">{% trans 'Szczegóły pracy nieprzypisanej do żadnej umowy' %}</h5>
</div>
<table class="table" style="display: inline-flex;">
<tbody>
<tr>
<td>{% trans 'Nr umowy' %}</td><td>{{ statement.statement_id }}</td>
</tr>
<tr>
<td>{% trans 'Tytuł umowy' %}</td><td>{{ statement.title }}</td>
</tr>
<tr>
<td>{% trans 'Użytkownik' %}</td><td>{{ statement.user.username }}</td>
</tr>
<tr>
<td>{% trans 'Liczba opracowanych zunifikowanych ram' %}</td><td>{{ unified_frame_count }}</td>
</tr>
<tr>
<td>{% trans 'Liczba podpiętych ram slowala' %}</td><td>{{ slowal_frame_count }}</td>
</tr>
<tr>
<td>{% trans 'Liczba opracowanych wolnych jednostek' %}</td><td>{{ free_lu_frame_count }}</td>
</tr>
<tr>
<td>{% trans 'Kwota wykonenj pracy' %}</td><td>{{ current_cost }}</td>
</tr>
<tr>
<td><a href="{% url 'financial_settlement:statement_list' %}" class="btn btn-xs btn-outline-dark">{% trans 'Odrzuć' %}</a>
<a href="{% url 'financial_settlement:statement_make_assigment' pk=statement.pk %}" class="btn btn-xs btn-outline-dark">{% trans 'Przypisz' %}</a></td>
</tr>
</tbody>
</table>
{% endblock %}
......@@ -5,6 +5,14 @@
{% block title %}{% trans 'Szczegóły umowy' %}{% endblock %}
{% block content2 %}
<table class="w-100">
<tr><td>
<div class="mt-3 float-right">
<a title="Zamknij" href="{% url 'financial_settlement:statement_list' %}" class="btn btn-sm btn-outline-dark">X</a>
</div>
</td>
</tr>
</table>
<div class="mt-3">
<h5 class="float-left mt-2">{% trans 'Szczegóły umowy' %}</h5>
</div>
......@@ -29,16 +37,28 @@
<td>{% trans 'Kwota' %}</td><td>{{ statement.payment }}</td>
</tr>
<tr>
<td>{% trans 'Koszt anotacji' %}</td><td>{{ statement.price_per_unified_frame }}</td>
<td>{% trans 'Stawka za ramę zunifikowaną' %}</td><td>{{ statement.price_per_unified_frame }}</td>
</tr>
<tr>
<td>{% trans 'Stawka za podpiętą ramę slowal-a' %}</td><td>{{ statement.price_per_slowal_frame }}</td>
</tr>
<tr>
<td>{% trans 'Stawka za opracowaną wolną jednostkę' %}</td><td>{{ statement.price_per_free_lexical_unit_frame }}</td>
</tr>
<tr>
<td>{% trans 'Liczba opracowanych zunifikowanych ram' %}</td><td>{{ unified_frame_count }}</td>
</tr>
<tr>
<td>{% trans 'Liczba podpiętych ram slowala' %}</td><td>{{ slowal_frame_count }}</td>
</tr>
<tr>
<td>{% trans 'Liczba wykonanych anotacji' %}</td><td>{{ unified_frame_count }}</td>
<td>{% trans 'Liczba opracowanych wolnych jednostek' %}</td><td>{{ free_lu_frame_count }}</td>
</tr>
<tr>
<td>{% trans 'Kwota wykorzystana' %}</td><td>{{ current_cost }}</td>
</tr>
<tr>
<td>{% trans 'Kwota z poprzedniej umowy' %}</td><td>{{ statement.last_statement_payment }}</td>
<td>{% trans 'Kwota do wykorzystania' %}</td><td>{{ statement.last_statement_payment }}</td>
</tr>
</tbody>
</table>
......
......@@ -7,6 +7,14 @@
{% block title %}{{ title }}{% endblock %}
{% block content2 %}
<table class="w-100">
<tr><td>
<div class="mt-3 float-right">
<a title="Zamknij" href="{% url 'financial_settlement:statement_list' %}" class="btn btn-sm btn-outline-dark">X</a>
</div>
</td>
</tr>
</table>
<h5 class="mt-4 mb-4">{{ title }}</h5>
{% crispy form %}
......
......@@ -39,6 +39,7 @@
<a href="{% url 'financial_settlement:statement_detail' pk=statement.pk %}" class="btn btn-xs btn-outline-dark">{% trans 'Szczegóły' %}</a>
{% if perms.users.edit_statement %}
<a href="{% url 'financial_settlement:statement_edit' pk=statement.pk %}" class="btn btn-xs btn-outline-dark">{% trans 'Edytuj' %}</a>
<a href="{% url 'financial_settlement:statement_assign' pk=statement.pk %}" class="btn btn-xs btn-outline-dark">{% trans 'Przpisz' %}</a>
{% endif %}
</td>
</tr>
......