diff --git a/accounting/views.py b/accounting/views.py index 8a80992e..b6e08e03 100644 --- a/accounting/views.py +++ b/accounting/views.py @@ -167,7 +167,7 @@ class OperationCreateView(CanCreateMixin, CreateView): form_class = modelform_factory(Operation, fields=['amount', 'label', 'remark', 'journal', 'target_type', 'target_id', 'target_label', 'date', 'mode', 'cheque_number', 'invoice', 'accounting_type', 'done'], - widgets={'journal': HiddenInput, 'date': SelectDate}) + widgets={'journal': HiddenInput, 'date': SelectDate, 'invoice': SelectFile}) template_name = 'core/create.jinja' def get_initial(self): diff --git a/core/static/core/js/script.js b/core/static/core/js/script.js index 9cf2944e..ded1a1cb 100644 --- a/core/static/core/js/script.js +++ b/core/static/core/js/script.js @@ -6,24 +6,37 @@ $( function() { popups.dialog({ autoOpen: false, modal: true, - width: "80%", - minHeight: "300", - buttons: { - "Choose": function() { + width: "90%", + create: function (event) { + target = $(event.target); + target.parent().css({ + 'position': 'fixed', + 'top': '5%', + 'bottom': '5%', + }); + target.css("height", "300px"); + console.log(target); + }, + buttons: [ + { + text: "Choose", + click: function() { console.log($("#file_id")); $("input[name="+$(this).attr('name')+"]").attr('value', $("#file_id").attr('value')); $( this ).dialog( "close" ); - } + }, + disabled: true, } + ], + }); + $( ".choose_file_button" ).button().on( "click", function() { + popup = popups.filter("[name="+$(this).attr('name')+"]"); + console.log(popup); + popup.html('
'); + popup.dialog({title: $(this).text()}).dialog( "open" ); }); $('.select_date').datepicker({ changeMonth: true, changeYear: true }); - $( ".choose_file_button" ).button().on( "click", function() { - popup = popups.filter("[name="+$(this).attr('name')+"]"); - console.log(popup); - popup.html(''); - popup.dialog({title: $(this).attr('name')}).dialog( "open" ); - }); } ); diff --git a/core/static/core/style.css b/core/static/core/style.css index 713ca7e9..f9d9c3ce 100644 --- a/core/static/core/style.css +++ b/core/static/core/style.css @@ -156,6 +156,11 @@ tbody>tr:hover { float: right; padding: 10px; } +#user_info { + width: 40%; + margin: 0px auto; + background: lightgrey; +} /*-----------------------------USER PROFILE----------------------------*/ #user_profile { @@ -213,7 +218,12 @@ footer{ /*--------------------------------MODALE-------------------------------*/ .choose_file_widget { - display: inline; + display: none; +} +.ui-dialog .ui-dialog-buttonpane { + bottom: 0px; + position: absolute; + width: 97%; } .form-wrapper { display: inline-block; diff --git a/core/templates/core/base.jinja b/core/templates/core/base.jinja index 6b57a300..da79c86d 100644 --- a/core/templates/core/base.jinja +++ b/core/templates/core/base.jinja @@ -5,9 +5,9 @@ {% block title %}{% trans %}Welcome!{% endtrans %}{% endblock %} - + {% endblock %} @@ -50,11 +50,13 @@ {% endblock %}
+ {% if not popup %} + {% endif %}