<script language="javascript">
function ConfigureAssumptions()
{
//The following functions are defined in Web Template "Tax Information Request Details - Configuration":
//CreateModal(targetParent, targetButton, modalID, modalTitleText, modalBodyText, modalButtonText)
//AddMessageBelowBooleanRadio(targetBooleanRadio, messageID, response0Text, response1Text)
//RevealElementsOnBooleanResponse1(targetBooleanRadio, elements)
//SetFieldRequired(fieldName, setRequired)
//SetRequiredBasedOnControlField(controlCheckbox, targetField)
//Disable accordion for this page
$("div[data-name='tabAssumptions'] legend.section-title").hide();
//Modify input labels for this page
$("div[data-name='tabAssumptions'] label[for$='_0']").not( $("label[for='tt_assumptionsconfirmation_0']") ).text("Agree");
$("div[data-name='tabAssumptions'] label[for$='_0']").css("padding-right", "30px");
$("div[data-name='tabAssumptions'] label[for$='_1']").not( $("label[for='tt_assumptionsconfirmation_1']") ).text("Disagree");
$("div[data-name='tabAssumptions'] label[for$='_1']").css("padding-right", "30px");
$("div[data-name='tabAssumptions'] div.description").css("font-weight", "bold");
var questionLabel = "empty";
//Capital expenditure in profit and loss
questionLabel = $("#tt_capitalexpenditureinprofitandloss").closest("fieldset").attr("aria-label");
//Question text
$("div.tt_capitalexpenditureinprofitandloss").html(`{{ snippets['PracticeGateway/TIR/Assumptions/CapitalExpenditureInProfitAndLoss/Question'] }}`);
//Info modal
$("div.tt_capitalexpenditureinprofitandloss").append('<span style="float: right;"> <a href="#" id="tt_capitalexpenditureinprofitandlossInfo" class="btn btn-info btn-lg"style="padding:5px 5px;font-size:20px;line-height:1;border-radius:10px;"><span class="glyphicon glyphicon-info-sign"></span></a></span>');
CreateModal("div.tt_capitalexpenditureinprofitandloss", "#tt_capitalexpenditureinprofitandlossInfo", "tt_capitalexpenditureinprofitandlossInfoModal", questionLabel + " information", `{{ snippets['PracticeGateway/TIR/Assumptions/CapitalExpenditureInProfitAndLoss/InfoModal'] }}`, "OK");
//Fines or penalties
questionLabel = $("#tt_finesorpenalties").closest("fieldset").attr("aria-label");
//Question text
$("div.tt_finesorpenalties").html(`{{ snippets['PracticeGateway/TIR/Assumptions/FinesOrPenalties/Question'] }}`);
//Info modal
$("div.tt_finesorpenalties").append('<span style="float: right;"> <a href="#" id="tt_finesorpenaltiesInfo" class="btn btn-info btn-lg"style="padding:5px 5px;font-size:20px;line-height:1;border-radius:10px;"><span class="glyphicon glyphicon-info-sign"></span></a></span>');
CreateModal("div.tt_finesorpenalties", "#tt_finesorpenaltiesInfo", "tt_finesorpenaltiesInfoModal", questionLabel + " information", `{{ snippets['PracticeGateway/TIR/Assumptions/FinesOrPenalties/InfoModal'] }}`, "OK");
//Interest paid/received
questionLabel = $("#tt_interestpaidreceived").closest("fieldset").attr("aria-label");
//Question text
$("div.tt_interestpaidreceived").html(`{{ snippets['PracticeGateway/TIR/Assumptions/InterestPaidReceived/Question'] }}`);
//INVISIBLE info modal - so the line spacing is consistent for all questions
$("div.tt_interestpaidreceived").append('<span style="float: right;"> <a class="btn btn-info btn-lg"style="padding:5px 5px;font-size:20px;line-height:1;border-radius:10px; visibility:hidden;"><span class="glyphicon glyphicon-info-sign"></span></a></span>');
//HMRC interest paid/received
questionLabel = $("#tt_hmrcinterestpaidreceived").closest("fieldset").attr("aria-label");
//Question text
$("div.tt_hmrcinterestpaidreceived").html(`{{ snippets['PracticeGateway/TIR/Assumptions/HMRCInterestPaidReceived/Question'] }}`);
//Info modal
$("div.tt_hmrcinterestpaidreceived").append('<span style="float: right;"> <a href="#" id="tt_hmrcinterestpaidreceivedInfo" class="btn btn-info btn-lg"style="padding:5px 5px;font-size:20px;line-height:1;border-radius:10px;"><span class="glyphicon glyphicon-info-sign"></span></a></span>');
CreateModal("div.tt_hmrcinterestpaidreceived", "#tt_hmrcinterestpaidreceivedInfo", "tt_hmrcinterestpaidreceivedInfoModal", questionLabel + " information", `{{ snippets['PracticeGateway/TIR/Assumptions/HMRCInterestPaidReceived/InfoModal'] }}`, "OK");
//Subscriptions
questionLabel = $("#tt_subscriptions").closest("fieldset").attr("aria-label");
//Question text
$("div.tt_subscriptions").html(`{{ snippets['PracticeGateway/TIR/Assumptions/Subscriptions/Question'] }}`);
//INVISIBLE info modal - so the line spacing is consistent for all questions
$("div.tt_subscriptions").append('<span style="float: right;"> <a class="btn btn-info btn-lg"style="padding:5px 5px;font-size:20px;line-height:1;border-radius:10px; visibility:hidden;"><span class="glyphicon glyphicon-info-sign"></span></a></span>');
//Repairs to integral features
questionLabel = $("#tt_repairstointegralfeatures").closest("fieldset").attr("aria-label");
//Question text
$("div.tt_repairstointegralfeatures").html(`{{ snippets['PracticeGateway/TIR/Assumptions/RepairsToIntegralFeatures/Question'] }}`);
//Info modal
$("div.tt_repairstointegralfeatures").append('<span style="float: right;"> <a href="#" id="tt_repairstointegralfeaturesInfo" class="btn btn-info btn-lg"style="padding:5px 5px;font-size:20px;line-height:1;border-radius:10px;"><span class="glyphicon glyphicon-info-sign"></span></a></span>');
CreateModal("div.tt_repairstointegralfeatures", "#tt_repairstointegralfeaturesInfo", "tt_repairstointegralfeaturesInfoModal", questionLabel + " information", `{{ snippets['PracticeGateway/TIR/Assumptions/RepairsToIntegralFeatures/InfoModal'] }}`, "OK");
//Keyman insurance
questionLabel = $("#tt_keymaninsurance").closest("fieldset").attr("aria-label");
//Question text
$("div.tt_keymaninsurance").html(`{{ snippets['PracticeGateway/TIR/Assumptions/KeymanInsurance/Question'] }}`);
//Info modal
$("div.tt_keymaninsurance").append('<span style="float: right;"> <a href="#" id="tt_keymaninsuranceInfo" class="btn btn-info btn-lg"style="padding:5px 5px;font-size:20px;line-height:1;border-radius:10px;"><span class="glyphicon glyphicon-info-sign"></span></a></span>');
CreateModal("div.tt_keymaninsurance", "#tt_keymaninsuranceInfo", "tt_keymaninsuranceInfoModal", questionLabel + " information", `{{ snippets['PracticeGateway/TIR/Assumptions/KeymanInsurance/InfoModal'] }}`, "OK");
//Irrecoverable VAT
questionLabel = $("#tt_irrecoverablevat").closest("fieldset").attr("aria-label");
//Question text
$("div.tt_irrecoverablevat").html(`{{ snippets['PracticeGateway/TIR/Assumptions/IrrecoverableVAT/Question'] }}`);
//INVISIBLE info modal - so the line spacing is consistent for all questions
$("div.tt_irrecoverablevat").append('<span style="float: right;"> <a class="btn btn-info btn-lg"style="padding:5px 5px;font-size:20px;line-height:1;border-radius:10px; visibility:hidden;"><span class="glyphicon glyphicon-info-sign"></span></a></span>');
//Recharged costs
questionLabel = $("#tt_rechargedcosts").closest("fieldset").attr("aria-label");
//Question text
$("div.tt_rechargedcosts").html(`{{ snippets['PracticeGateway/TIR/Assumptions/RechargedCosts/Question'] }}`);
//INVISIBLE info modal - so the line spacing is consistent for all questions
$("div.tt_rechargedcosts").append('<span style="float: right;"> <a class="btn btn-info btn-lg"style="padding:5px 5px;font-size:20px;line-height:1;border-radius:10px; visibility:hidden;"><span class="glyphicon glyphicon-info-sign"></span></a></span>');
//Capital grants
questionLabel = $("#tt_capitalgrants").closest("fieldset").attr("aria-label");
//Question text
$("div.tt_capitalgrants").html(`{{ snippets['PracticeGateway/TIR/Assumptions/CapitalGrants/Question'] }}`);
//INVISIBLE info modal - so the line spacing is consistent for all questions
$("div.tt_capitalgrants").append('<span style="float: right;"> <a class="btn btn-info btn-lg"style="padding:5px 5px;font-size:20px;line-height:1;border-radius:10px; visibility:hidden;"><span class="glyphicon glyphicon-info-sign"></span></a></span>');
//Changes to prior period or opening reserves
questionLabel = $("#tt_changestopriorperiodoropeningreserves").closest("fieldset").attr("aria-label");
//Question text
$("div.tt_changestopriorperiodoropeningreserves").html(`{{ snippets['PracticeGateway/TIR/Assumptions/ChangesToPriorPeriod/Question'] }}`);
//Info modal
$("div.tt_changestopriorperiodoropeningreserves").append('<span style="float: right;"> <a href="#" id="tt_changestopriorperiodoropeningreservesInfo" class="btn btn-info btn-lg"style="padding:5px 5px;font-size:20px;line-height:1;border-radius:10px;"><span class="glyphicon glyphicon-info-sign"></span></a></span>');
CreateModal("div.tt_changestopriorperiodoropeningreserves", "#tt_changestopriorperiodoropeningreservesInfo", "tt_changestopriorperiodoropeningreservesInfoModal", questionLabel + " information", `{{ snippets['PracticeGateway/TIR/Assumptions/ChangesToPriorPeriod/InfoModal'] }}`, "OK");
//Notes
//Conditional show/hide (reveal if any assumption is Disagree)
$("div[data-name='tabAssumptions'] input[id^='tt_']").not( $("input[id*='confirmation']") ).each(function(){
// Find the closest fieldset ancestor
var fieldset = $(this).closest('fieldset');
// Find the h3 element within the closest fieldset
var h3 = fieldset.find('h3').text();
ShowOrHideAssumptionsNotesDocuments(h3);
// Corrected: Pass a function reference to on('click', ...)
$(this).on('click', function () {
ShowOrHideAssumptionsNotesDocuments(h3);
});
});
//Update this to also pass in the name of the Assumption question
}
function ShowOrHideAssumptionsNotesDocuments(questionName = "")
{
var AssumptionQuestion = questionName.trim().replace(/[&/]/g, '-');
var documentSectionDiv = $(`.contactDocumentLocation[id="${AssumptionQuestion}"]`);
$(AssumptionQuestion).closest('fieldset');
var targetElement = $("h3").filter(function() {
return $(this).text().trim() === questionName;
});
var fieldset = $(targetElement).closest('fieldset');
var input = fieldset.find('input[id$="_1"]').not( $("input[id*='confirmation']") )
if (input.is(":checked"))
{
$("#tt_assumptionsnotes").closest("tr").show();
documentSectionDiv.show();
}
else
{
$("#tt_assumptionsnotes").closest("tr").hide();
documentSectionDiv.hide();
}
}
</script>