<commit_before>{% extends "layout.html" %}
{% block main %}
	{%- from "initial_queries_macros.html" import paperWebsiteConsentScript, interviewAssistedWebConsentScript -%}
	<div id="termsContainer">
		{%- if entry_method == 'paper' %}
			{{paperWebsiteConsentScript(terms)}}
		{%- else -%}
			{{interviewAssistedWebConsentScript(terms, declaration_form)}}
		{%- endif -%}
	</div>
	<div class="continue-msg-wrapper">
      <div id="buttonsContainer" class="button-container">
        <button id="continue" type="button" class="btn btn-lg btn-tnth-primary">{{ _("Continue to TrueNTH") }}</button>
      </div>
    </div>
{% endblock %}
{% block footer %}
{%- from "flask_user/_macros.html" import footer -%}
{{footer(user=user)}}
{% endblock %}
{% block document_ready %}
	$(document).ready(function() {

		var tVar = setInterval(function(){
				if ($("#tnthNavWrapper").length > 0) {
					$("#tnthNavWrapper, #homeFooter, .watermark").each(function() {
						$(this).addClass("hidden-print");
					});
					clearInterval(tVar);
				};
		}, 1000);

		//get still needed
		tnthAjax.getStillNeededCoreData({{patient_id}}, true, null, "{{entry_method}}");

		//populate existing checkbox(es)
		tnthAjax.getTerms('{{patient_id}}', false, true, function(data) {
            if ($("[data-agree='false']").length == 0) {
	        	$(".continue-msg-wrapper").show();
	        };
        });

        $(".intro-text").text($(".intro-text").text().replace("[organization]", "{{top_organization.name}}"));

        if ($(".terms-tick-box-text[data-org='{{top_organization.name}}']").length > 0) {
	        $(".terms-tick-box-text[data-org]").each(function() {
	        	if ($(this).attr("data-org").toLowerCase() == "{{top_organization.name}}".toLowerCase()) $(this).show();
	        	else $(this).hide();
	    	});
	    } else $($(".terms-tick-box-text[data-org]").get(0)).show();

		$("[data-type='terms']").each(function() {
			$(this).on("click", function() {
				if ($(this).attr("data-agree") == "false") {
		            var types = $(this).attr("data-tou-type");
		            if (hasValue(types)) {
		                var arrTypes = types.split(",");
		                var self = $(this);
		                arrTypes.forEach(function(type) {
		                    var theTerms = {};
		                    theTerms["agreement_url"] = self.attr("data-url");
		                    theTerms["type"] = type;
		                     // Post terms agreement via API
		                    tnthAjax.postTermsByUser('{{patient_id}}', theTerms);
		                });
		            }
		            // Update UI
		            $(this).find("i").removeClass("fa-square-o").addClass("fa-check-square-o");
		            $(this).attr("data-agree","true");
		            if ($("[data-agree='false']").length == 0) $(".continue-msg-wrapper").fadeIn();
         		};
			});
		});
		$(".button-container").each(function() {
		    $(this).prepend('<div class="loading-message-indicator"><i class="fa fa-spinner fa-spin fa-2x"></i></div>');
		});
		$("#continue").on("click", function() {
			$(this).hide();
        	$(".loading-message-indicator").show();
        	setTimeout("window.location='{{redirect_url|safe}}'", 100);
		});
	});
{% endblock %}<commit_msg>submt organization id when updating terms via manual entry<commit_after>{% extends "layout.html" %}
{% block main %}
	{%- from "initial_queries_macros.html" import paperWebsiteConsentScript, interviewAssistedWebConsentScript -%}
	<div id="termsContainer">
		{%- if entry_method == 'paper' %}
			{{paperWebsiteConsentScript(terms)}}
		{%- else -%}
			{{interviewAssistedWebConsentScript(terms, declaration_form)}}
		{%- endif -%}
	</div>
	<div class="continue-msg-wrapper">
      <div id="buttonsContainer" class="button-container">
        <button id="continue" type="button" class="btn btn-lg btn-tnth-primary">{{ _("Continue to TrueNTH") }}</button>
      </div>
    </div>
{% endblock %}
{% block footer %}
{%- from "flask_user/_macros.html" import footer -%}
{{footer(user=user)}}
{% endblock %}
{% block document_ready %}
	$(document).ready(function() {

		var tVar = setInterval(function(){
				if ($("#tnthNavWrapper").length > 0) {
					$("#tnthNavWrapper, #homeFooter, .watermark").each(function() {
						$(this).addClass("hidden-print");
					});
					clearInterval(tVar);
				};
		}, 1000);

		//get still needed
		tnthAjax.getStillNeededCoreData({{patient_id}}, true, null, "{{entry_method}}");

		//populate existing checkbox(es)
		tnthAjax.getTerms('{{patient_id}}', false, true, function(data) {
            if ($("[data-agree='false']").length == 0) {
	        	$(".continue-msg-wrapper").show();
	        };
        });

        $(".intro-text").text($(".intro-text").text().replace("[organization]", "{{top_organization.name}}"));

        if ($(".terms-tick-box-text[data-org='{{top_organization.name}}']").length > 0) {
	        $(".terms-tick-box-text[data-org]").each(function() {
	        	if ($(this).attr("data-org").toLowerCase() == "{{top_organization.name}}".toLowerCase()) $(this).show();
	        	else $(this).hide();
	    	});
	    } else $($(".terms-tick-box-text[data-org]").get(0)).show();

		$("[data-type='terms']").each(function() {
			$(this).on("click", function() {
				if ($(this).attr("data-agree") == "false") {
		            var types = $(this).attr("data-tou-type");
		            if (hasValue(types)) {
		                var arrTypes = types.split(",");
		                var self = $(this);
		                arrTypes.forEach(function(type) {
		                    var theTerms = {};
		                    theTerms["agreement_url"] = self.attr("data-url");
		                    theTerms["type"] = type;
		                    {% if top_organization %}
		                    	theTerms["organization_id"] = "{{top_organization.id}}";
		                    {% endif %}
		                     // Post terms agreement via API
		                    tnthAjax.postTermsByUser('{{patient_id}}', theTerms);
		                });
		            }
		            // Update UI
		            $(this).find("i").removeClass("fa-square-o").addClass("fa-check-square-o");
		            $(this).attr("data-agree","true");
		            if ($("[data-agree='false']").length == 0) $(".continue-msg-wrapper").fadeIn();
         		};
			});
		});
		$(".button-container").each(function() {
		    $(this).prepend('<div class="loading-message-indicator"><i class="fa fa-spinner fa-spin fa-2x"></i></div>');
		});
		$("#continue").on("click", function() {
			$(this).hide();
        	$(".loading-message-indicator").show();
        	setTimeout("window.location='{{redirect_url|safe}}'", 100);
		});
	});
{% endblock %}
{'fraction_non_alphanumeric': 0.21810822965072701, 'fraction_numerical': 0.003897466646679658, 'mean_word_length': 2.6639209225700164, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3860637', 'n_tokens_mistral': 2357, 'n_tokens_neox': 2031, 'n_words': 307}