{% load i18n %} {% load ifsetting %}
{% ifnotsetting EDITOR_HIDE_SECTOR_TAB %}
{% endifnotsetting %} {% ifsetting EDITOR_HAS_MSDP %}
{% endifsetting %} {% ifnotsetting EDITOR_HIDE_ORGS %}
{% endifnotsetting %} {% ifnotsetting USE_SIMPLE_LOCATIONS %}
{% else %} {% ifsetting EDITOR_USES_SIMPLELOCATIONS %}
{% else %}
{% endifsetting %} {% endifnotsetting %}
{% ifapp dird_templates %}
{% endifapp %} {% ifsetting EDITOR_HAS_FINANCIALS %} {% if editor_custom_finances_tab %}
{% else %}
{% ifnotsetting BUDGETS_DISABLED %}
{% endifnotsetting %} {% endif %} {% endifsetting %} {% ifapp dird_templates %}
{% endifapp %} {% ifsetting EDITOR_HAS_LEGACY_RESULTS %}
{% endifsetting %} {% ifsetting EDITOR_HAS_RESULTS %}
{% endifsetting %}
{% ifsetting EDITOR_HAS_DOCUMENTS_TAB %}
{% endifsetting %} {% ifsetting ENDORSEMENT_ENABLED %}
{% endifsetting %} {% ifapp dird_templates %}
{% endifapp %}
var tag = this; function getRoutes(){ /* returns a list of all the possible routes for this tag */ return _.map(tag.tags.router.tags.route, 'opts.path'); } function excludeEditor(routes){ /* exclude "editor" routes which are not really directly addressable */ var exported_routes = _.reject(routes, function(r){return _.includes(r, '*')}); /* Sometimes we have a situation such as 'results..', when this occurs we need to route to 'results' not 'results..' */ exported_routes = _.map(exported_routes, function(r){ if (r.substring(r.length-2) === '..'){ return r.substring(0, r.length-2) } return r; }) return exported_routes; } tag.on('mount', function(){ (function setGlobalRoutes(w){ w.routeToTag = { next: function(){ var routes = excludeEditor(getRoutes()); var currentPage = _.replace(location.hash, '#', ''); var currentRouteIndex = _.indexOf(routes, currentPage); var routeTo = routes[currentRouteIndex+1] || routes[0]; route(routeTo); }, getNext: function(){ var routes = excludeEditor(getRoutes()); var currentPage = _.replace(location.hash, '#', ''); var currentRouteIndex = _.indexOf(routes, currentPage); var routeTo = routes[currentRouteIndex+1] || routes[0]; return routeTo; } } })(window); })

{% trans 'Finances' %}

var tag = this; var oipa_fields; var default_finance_tag = 'finances/transactions' tag.current_route = tag.parent.opts.path; tag.on('mount', function(){ if (tag.parent.opts.path === 'finances'){ route(default_finance_tag) } }); {% ifsetting OIPA_SYNC_ENABLED %} tag.iati_budgets_disabled = (data.iati_data.link_info.oipa_fields.indexOf("B") != -1); tag.iati_commitments_disabled = (data.iati_data.link_info.oipa_fields.indexOf("C") != -1); tag.iati_disbursements_disabled = (data.iati_data.link_info.oipa_fields.indexOf("OF") != -1); tag.iati_other_disabled = (data.iati_data.link_info.oipa_fields.indexOf("IF") != -1); {% else %} tag.iati_budgets_disabled = false; tag.iati_commitments_disabled = false; tag.iati_disbursements_disabled = false; tag.iati_other_disabled = false; {% endifsetting %} tag.navs = { 'finances/transactions': '{% trans "Transactions" %}', /* {% ifnotsetting BUDGETS_DISABLED %} */ 'finances/budgets': '{% trans "Budgets" %}', /* {% endifnotsetting %} */ /* {% if iati_tab_accessable %} */ 'finances/iati': '{% trans "IATI Sync" %}', /* {% endif %} */ 'finances/general': '{% trans "Default Settings" %}', } function letsgetouttahere(e) { // Going somewhere? We probably want to check that there are no unsaved changes var modal_opts = {}; var current_tab = window.current_tab; e.preventDefault(); // Override the usual behaviour of links if (!current_tab) { route(e.item.route); } else if (current_tab.enableRouting()) { /* console.log('ok!! You are clear to navigate') */ route(e.item.route); } else { modal_opts = { show: true, current_tag: window.current_tab, route: e.item.route }; $('discard-modal')[0]._tag.update({ opts: modal_opts }); } }; tag.tab = letsgetouttahere; this.incoming_funds = function(){window.modals.incoming_funds.toggle()}; this.commitment = function(){window.modals.commitment.toggle()}; this.transaction = function(){window.modals.transaction.toggle()};