Skip to content

Instantly share code, notes, and snippets.

@bittersweetryan
Created July 15, 2013 18:58
Show Gist options
  • Save bittersweetryan/6002458 to your computer and use it in GitHub Desktop.
Save bittersweetryan/6002458 to your computer and use it in GitHub Desktop.
; (function ($, _, Backbone, nmConnect) {
var createReportView = Backbone.View.extend({
el: '#CreateReportSection',
initialize: function() {
var selectPagesContainer = $('#SelectPagesContainer');
var invstCheckbox = selectPagesContainer.find('[id$=InvstCheckbox]');
var insuranceCheckbox = selectPagesContainer.find('[id$=InsuranceCheckbox]');
selectPagesContainer.find('[id$=SpreadSheetRadioButton]').click(function() {
if ($(this).is(':checked')){
invstCheckbox.attr("disabled", true);
insuranceCheckbox.attr("disabled", true);
}
});
selectPagesContainer.find('[id$=ReportRadioButton]').click(function() {
if ($(this).is(':checked')){
var insOrInvstIdentifier = selectPagesContainer.find('[id$=InsuranceInvstIdentifier]').val();
if (insOrInvstIdentifier == "Both"){
invstCheckbox.attr("disabled", false);
insuranceCheckbox.attr("disabled", false);
}else if (insOrInvstIdentifier == "InsOnly"){
insuranceCheckbox.attr("disabled", false);
}else if (insOrInvstIdentifier == "InvOnly"){
invstCheckbox.attr("disabled", false);
}
}
});
$('#CreateReport').click(function() {
var url = "";
var spreadsheetRadioButton = selectPagesContainer.find('[id$=SpreadSheetRadioButton]');
if (selectPagesContainer.find('[id$=ReportRadioButton]').is(':checked') == true) url = "TARGET=CCVREPORT";
if (spreadsheetRadioButton.is(':checked') == true) url = "TARGET=SS";
if (selectPagesContainer.find('[id$=ClientFacingReportInd]').is(':checked') == true) url = url + "&CF=Y";
if (selectPagesContainer.find('[id$=InternalUseReport]').is(':checked') == true) url = url + "&CF=N";
if (insuranceCheckbox.is(':checked') == true) url = url + "&INS=4";
if (invstCheckbox.is(':checked') == true) url = url + "&INV=5";
if (insuranceCheckbox.is(':checked') == false
&& invstCheckbox.is(':checked') == false
&& spreadsheetRadioButton.is(':checked') == false){
alert("At least one of the Summary options needs to be selected");
return false;
}
window.open(url);
});
}
});
} (window.jQuery, window._, window.Backbone, window.nmConnect));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment