diff --git a/config.toml b/config.toml index 8337d18..36799a4 100644 --- a/config.toml +++ b/config.toml @@ -19,8 +19,8 @@ unsafe = true Description = "The first-in-class comprehensive digital healthcare suite of patient advocacy tools for patients and consumers who are determined to be empowered in their health care journey. Unblock Health is revolutionizing patient autonomy and healthcare consumerism." logotitle ="Comprehensive Healthcare Suite of Patient Advocacy Services designed for Patients and Consumers - Unblock Health" footersectionaboutcontent ="Unblock Health rejects traditional barriers to patient health information. We empower patients to play an active role in their care and help HIM professionals deliver a positive experience." - recaptchaSiteKey = "6LfG8v8pAAAAAL_bNl24ICh0nOSe5Yx2GnXOmhVD" - recaptchaSecretKey = "6LfG8v8pAAAAAEgxJXOK7v0ko5Z-7HLPQ7f8DdfN" + recaptchaSiteKey = "6LcwogEqAAAAAI2QtVzQNHKN2kE2zXkodWEUzHfD" +recaptchaSecretKey = "6LcwogEqAAAAAKLRTlccbN_3GVKb7O9SsCWsQxKe" recaptchaurl = "https://www.google.com/recaptcha/api.js" # Navigation [params.navigation] diff --git a/layouts/partials/footer-new.html b/layouts/partials/footer-new.html index 2080820..7946598 100644 --- a/layouts/partials/footer-new.html +++ b/layouts/partials/footer-new.html @@ -171,18 +171,37 @@

+
- +
+ {{/*
*/}} + {{/*
*/}} + + + {{/*
*/}} + +
+ +
+ + + + + @@ -238,7 +257,10 @@

{{/* */}} - + + +{{/* */}} + diff --git a/static/js/main-new.js b/static/js/main-new.js index 5833bc8..d2735da 100644 --- a/static/js/main-new.js +++ b/static/js/main-new.js @@ -1,34 +1,32 @@ $(document).ready(function () { //contact form validation function uuidv4() { - return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => - (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16) - ) + return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) => + ( + c ^ + (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4))) + ).toString(16) + ); } - - const date = new Date(); - const todayDate = date.toLocaleString('en-US', { - timeZone: 'America/New_York', - weekday:"short", - year:"numeric", - month:"long", + + const date = new Date(); + const todayDate = date.toLocaleString("en-US", { + timeZone: "America/New_York", + weekday: "short", + year: "numeric", + month: "long", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric", timeZoneName: "long", - }); - + $("#contact-submit-live").click(function (e) { + // Get server time using an HTTP request - - -$('#contact-submit-live').click(function (e) { - // Get server time using an HTTP request - -// Function to convert a date to EST based on server timezone -/*function convertToEST(serverDate) { + // Function to convert a date to EST based on server timezone + /*function convertToEST(serverDate) { // Assuming serverDate is a valid Date object // Get the offset in minutes @@ -56,10 +54,8 @@ const estDateformat = estDateString + 'Eastern Time: '; //console.log('Server Date:', serverDate.toLocaleString()); console.log('EST Date:', estDateformat);*/ - - - e.preventDefault(); - var $success = $('#success'); + e.preventDefault(); + /*var $success = $('#success'); $success.show().html(''); var uid = 0; uid = uuidv4(); @@ -143,7 +139,7 @@ console.log('EST Date:', estDateformat);*/ "data": JSON.stringify(registerFormData), };*/ -var settings = { + /*var settings = { "url": "https://prime.dcp.infra.experimental.unblock.health/graphql", "method": "POST", "timeout": 0, @@ -206,7 +202,7 @@ $.ajax(settings).done(function (response) { //setInterval('location.reload()', 800); } - }); + });*/ /*$.ajax(settings).done(function (response) { // console.log(response); @@ -238,28 +234,99 @@ $.ajax(settings).done(function (response) { } }); });*/ - }); // console.log("API call successful:", response); -}).fail(function(error) { + /*}).fail(function(error) { console.error("API call error:", error); -}); +});*/ + + /* }); */ + + $("#contact-submit-live").prop("disabled", "disabled"); + $("#contact-submit-live").addClass("is-disabled"); + $("#quickcontact").on( + "blur keyup change", + "textarea,input,select", + function (event) { + quickContactValidation = validateForm( + "#quickcontact", + "#contact-submit-live" + ); + if ( + quickContactValidation == true && + $("#name").val().length > 0 && + $("#email").val().length > 0 && + ($("#patientoption").val() == "PA" || + $("#patientoption").val() == "HIM") + ) { + $("#contact-submit-live").prop("disabled", false); + $("#contact-submit-live").removeClass("is-disabled"); + } + } + ); -}); + $("#contact-submit").click(function (e) { + e.preventDefault(); + var recaptcha_response = document.getElementById( + "g-recaptcha-response" + ).value; + /* console.log("Captcha response: ", recaptcha_response); */ -$('#contact-submit-live').prop('disabled', 'disabled'); - $('#contact-submit-live').addClass('is-disabled'); - $('#quickcontact').on('blur keyup change', 'textarea,input,select', function (event) { - quickContactValidation = validateForm('#quickcontact', '#contact-submit-live'); - if((quickContactValidation==true)&&($("#name").val().length > 0)&&($("#email").val().length > 0)&&($("#patientoption").val()=="PA" ||$("#patientoption").val()=="HIM")){ - $('#contact-submit-live').prop('disabled', false); - $('#contact-submit-live').removeClass('is-disabled'); - } - }); + //var secret_key = document.getElementById("sitekey").value; + /* console.log("Secret Key", secret_key); */ + const secretKey = '6LfG8v8pAAAAAEgxJXOK7v0ko5Z-7HLPQ7f8DdfN'; // Replace with your secret key - $('#contact-submit').click(function (e) { - e.preventDefault(); - var uid = uuidv4(); + /* var responseData = json_decode(verify_url); + console.log("Response Data from Google captcha verify: ", responseData); */ + + // Construct the URL using template literals for easier variable interpolation + + //check captcha response length + if (recaptcha_response.length === 0) { + //alert("reCaptcha response is empty"); + console.log('reCaptcha response is empty'); + } else { + console.log( + "Filled Google Captcha Successful. reCaptcha response length: " + + recaptcha_response.length + ); + + const verificationUrl = `https://www.google.com/recaptcha/api/siteverify?secret=${secretKey}&response=${recaptcha_response}`; + console.log(verificationUrl) + fetch(verificationUrl, { method: 'POST' }) + .then(response => response.json()) + .then(googleResponse => { + console.log('googleResponse'); + console.log(googleResponse); + if (googleResponse.success) { + console.log('reCAPTCHA verified successfully'); + //res.json({ message: 'reCAPTCHA verified successfully' }); + } else { + //res.status(400).json({ message: 'reCAPTCHA verification failed' }); + console.log('reCAPTCHA verification failed'); + } + }) + .catch(error => { + console.error('Error verifying reCAPTCHA:', error); + //res.status(500).json({ message: 'Internal Server Error' }); + }); + + + /* .then((response) =>await recaptcha_response.json()) // Parse the JSON response + .then((result) => { + console.log("fetching verify url: ", verify_url); + // Handle the result here + console.log("Verify url Result: ", result); + }) + .catch((error) => { + // Handle any errors that occur + console.error("Error:", error); + }); */ + } + + // Prevent the default form submission + return false; + /*var uid = uuidv4(); var first_name = $('#quickname').val(); var email = $('#quickemail').val(); var subject = $('#quicksubject').val(); @@ -345,243 +412,287 @@ $('#contact-submit-live').prop('disabled', 'disabled'); $success.show().html('Your Message was sent successfully'); } }); - }); -}); - - - $('#contact-submit').prop('disabled', 'disabled'); - $('#contact-submit').addClass('is-disabled'); - $('#contactform').on('blur keyup change', 'textarea,input', function (event) { - validateForm('#contactform', '#contact-submit'); + });*/ }); -// patient impact story form - - $('#patient_impact_story_form').on('blur keyup change', 'textarea,input,select', function (event) { - var comunityValidation = validateForm('#patient_impact_story_form', '#patient-story-form-submit'); - if ((comunityValidation == true) && $('#agree_checkbox').prop("checked") == true && $("#patient_first_name").val().length > 0 && $("#patient_last_name").val().length > 0 && $("#patient_email").val().length > 0 ) - { - $('#patient-story-form-submit').prop('disabled', false); - $('#patient-story-form-submit').removeClass('is-disabled'); - } + $("#contact-submit").prop("disabled", "disabled"); + $("#contact-submit").addClass("is-disabled"); + $("#contactform").on("blur keyup change", "textarea,input", function (event) { + validateForm("#contactform", "#contact-submit"); }); + // patient impact story form + + $("#patient_impact_story_form").on( + "blur keyup change", + "textarea,input,select", + function (event) { + var comunityValidation = validateForm( + "#patient_impact_story_form", + "#patient-story-form-submit" + ); + if ( + comunityValidation == true && + $("#agree_checkbox").prop("checked") == true && + $("#patient_first_name").val().length > 0 && + $("#patient_last_name").val().length > 0 && + $("#patient_email").val().length > 0 + ) { + $("#patient-story-form-submit").prop("disabled", false); + $("#patient-story-form-submit").removeClass("is-disabled"); + } + } + ); - $('#patient-story-form-submit').click(function (e) { + $("#patient-story-form-submit").click(function (e) { e.preventDefault(); - if($(this).val() == 'Please wait..'){ + if ($(this).val() == "Please wait..") { return false; } - $(this).val('Please wait..'); - $(this).attr('disabled',true); - var First_Name = $('#patient_first_name').val(); - var Last_Name = $('#patient_last_name').val(); - var Email_Address = $('#patient_email').val(); - var story_title = $('#story_title').val(); - var story_description = $('#story_description').val(); - var authorization_granted = $('#agree_checkbox').prop("checked"); - - - var token= "7sTXwg4jeFampJVOa6YxTRBv"; - - var jform = new FormData(); - jform.append('data',$('#imageInput').get(0).files[0]); // Here's the important bit - //console.log($('#imageInput').get(0).files[0]); - //return false; - $.ajax({ - url: 'https://test.admin.web.unblock.health/directus/files', - type: 'POST', - data: jform, - dataType: 'json', - mimeType: 'multipart/form-data', // this too - contentType: false, - cache: false, - processData: false, + $(this).val("Please wait.."); + $(this).attr("disabled", true); + var First_Name = $("#patient_first_name").val(); + var Last_Name = $("#patient_last_name").val(); + var Email_Address = $("#patient_email").val(); + var story_title = $("#story_title").val(); + var story_description = $("#story_description").val(); + var authorization_granted = $("#agree_checkbox").prop("checked"); + + var token = "7sTXwg4jeFampJVOa6YxTRBv"; + + var jform = new FormData(); + jform.append("data", $("#imageInput").get(0).files[0]); // Here's the important bit + //console.log($('#imageInput').get(0).files[0]); + //return false; + $.ajax({ + url: "https://test.admin.web.unblock.health/directus/files", + type: "POST", + data: jform, + dataType: "json", + mimeType: "multipart/form-data", // this too + contentType: false, + cache: false, + processData: false, + headers: { + Authorization: "bearer " + token, + }, + success: function (data, status, jqXHR) { + // console.log(data); + + var photo = data.data.id; + var full_url = data.data.data.full_url; + + var settings = { + async: true, + crossDomain: true, + //"url": "https://test.admin.app.unblock.health/ubhweb/items/himss20_contact_details", + url: "https://test.admin.web.unblock.health/directus/items/patient_stories", + method: "POST", headers: { - "Authorization": "bearer "+ token, - - }, - success: function(data, status, jqXHR){ - // console.log(data); - - var photo = data.data.id; - var full_url = data.data.data.full_url; - - var settings = { - "async": true, - "crossDomain": true, - //"url": "https://test.admin.app.unblock.health/ubhweb/items/himss20_contact_details", - "url": "https://test.admin.web.unblock.health/directus/items/patient_stories", - "method": "POST", - "headers": { - "Content-Type": "application/json", - "Authorization": "bearer "+ token, - }, - "processData": false, - - "data": "{\"status\": \"published\", \"first_name\": \"" + First_Name + "\" , \"last_name\" : \"" + Last_Name + "\" , \"email_id\": \"" + Email_Address + "\", \"story_title\": \"" + story_title + "\", \"story_description\": \"" + story_description + "\", \"photo\": " + photo + ", \"authorization_granted\": " + photo + " \r\n } \r\n\r\n" - } - $.ajax(settings).done(function (response) { - $("#patient_impact_story_form").trigger("reset"); - sendm(token,Email_Address,First_Name,Last_Name,story_title,story_description,full_url); - - var $success = $('#patient_impact_story_success'); // get the reference of the div - $success.show().html('Your Story was sent successfully'); - $('#patient-story-form-submit').val('Submit Your Story'); - $('#patient-story-form-submit').attr('disabled',false); - }); - + "Content-Type": "application/json", + Authorization: "bearer " + token, }, - error: function(jqXHR,status,error){ - // Hopefully we should never reach here - var $success = $('#patient-story_error'); // get the reference of the div - $success.show().html('Sorry, The story was not able to sent, please check all fields are provided.'); - $('#patient-story-form-submit').attr('disabled',false); - } - }); - - + processData: false, + + data: + '{"status": "published", "first_name": "' + + First_Name + + '" , "last_name" : "' + + Last_Name + + '" , "email_id": "' + + Email_Address + + '", "story_title": "' + + story_title + + '", "story_description": "' + + story_description + + '", "photo": ' + + photo + + ', "authorization_granted": ' + + photo + + " \r\n } \r\n\r\n", + }; + $.ajax(settings).done(function (response) { + $("#patient_impact_story_form").trigger("reset"); + sendm( + token, + Email_Address, + First_Name, + Last_Name, + story_title, + story_description, + full_url + ); + + var $success = $("#patient_impact_story_success"); // get the reference of the div + $success.show().html("Your Story was sent successfully"); + $("#patient-story-form-submit").val("Submit Your Story"); + $("#patient-story-form-submit").attr("disabled", false); + }); + }, + error: function (jqXHR, status, error) { + // Hopefully we should never reach here + var $success = $("#patient-story_error"); // get the reference of the div + $success + .show() + .html( + "Sorry, The story was not able to sent, please check all fields are provided." + ); + $("#patient-story-form-submit").attr("disabled", false); + }, + }); }); - function sendm(token,to,First_Name,Last_Name,story_title,story_description,full_url){ - var subject = 'Unblock Health - Story Submitted'; - var to = ["mary.john@netspective.org","enlighteningresults@gmail.com"]; + function sendm( + token, + to, + First_Name, + Last_Name, + story_title, + story_description, + full_url + ) { + var subject = "Unblock Health - Story Submitted"; + var to = ["mary.john@netspective.org", "enlighteningresults@gmail.com"]; //var to = ["rejina.kp@citrusinformatics.com"]; - + var body = ""; body += "
"; body += "
"; body += "HI ,
"; body += "
"; - body += First_Name + " " + Last_Name +" added new story with the following details.
"; + body += + First_Name + + " " + + Last_Name + + " added new story with the following details.
"; body += "
"; - body += "First Name: "+ First_Name + "
"; + body += "First Name: " + First_Name + "
"; body += "
"; - body += "Last Name: "+ Last_Name +"
"; + body += "Last Name: " + Last_Name + "
"; body += "
"; - body += "Story Title: "+ story_title +"
"; + body += "Story Title: " + story_title + "
"; body += "
"; - body += "
Story Description: "+story_description +"

"; - body += "
"; body += "
"; - + var settings = { - "async": true, - "crossDomain": true, + async: true, + crossDomain: true, //"url": "https://test.admin.app.unblock.health/ubhweb/items/himss20_contact_details", - "url": "https://test.admin.web.unblock.health/directus/mail", - "method": "POST", - "headers": { + url: "https://test.admin.web.unblock.health/directus/mail", + method: "POST", + headers: { "Content-Type": "application/json", - "Authorization": "bearer "+ token, + Authorization: "bearer " + token, }, - "processData": false, - "data": JSON.stringify({"to": to, "subject": subject , "body" : body }) - } + processData: false, + data: JSON.stringify({ to: to, subject: subject, body: body }), + }; $.ajax(settings).done(function (response) { // console.log(response); }); - } - - // Clear event - $('.image-clear-btn').click(function(e){ - e.preventDefault(); - $(".myPopover").find("img").remove(); - $(".myPopover").toggleClass("slds-hide"); - $('.image-preview-filename').html("Add Your Photo*"); - $(".image-clear-btn").addClass("slds-hide"); - $(".image-clear-btn").removeClass("slds-show"); - $('.image-preview-input input:file').html(""); - $(".image-preview-input-title").text("Browse"); -}); + } + + // Clear event + $(".image-clear-btn").click(function (e) { + e.preventDefault(); + $(".myPopover").find("img").remove(); + $(".myPopover").toggleClass("slds-hide"); + $(".image-preview-filename").html("Add Your Photo*"); + $(".image-clear-btn").addClass("slds-hide"); + $(".image-clear-btn").removeClass("slds-show"); + $(".image-preview-input input:file").html(""); + $(".image-preview-input-title").text("Browse"); + }); -// Create the preview image -$(".image-preview-input input:file").change(function (){ - $(".myPopover").find("img").remove(); - var img = $('', { - id: 'dynamic', - width:250, - height:200 - }); - var file = this.files[0]; - var reader = new FileReader(); - // Set preview image into the popover data-content - reader.onload = function (e) { + // Create the preview image + $(".image-preview-input input:file").change(function () { + $(".myPopover").find("img").remove(); + var img = $("", { + id: "dynamic", + width: 250, + height: 200, + }); + var file = this.files[0]; + var reader = new FileReader(); + // Set preview image into the popover data-content + reader.onload = function (e) { $(".image-preview-input-title").text("Change"); $(".image-clear-btn").removeClass("slds-hide"); $(".image-clear-btn").addClass("slds-show"); $(".image-preview-filename").html(file.name); - // console.log(file.name); - img.attr('src', e.target.result); + // console.log(file.name); + img.attr("src", e.target.result); $(".myPopover").removeClass("slds-hide").append($(img)[0].outerHTML); //console.log($("#myPopover p").attr("data-content",$(img)[0].outerHTML)); - } - reader.readAsDataURL(file); -}); - -$(document).on('click', '#close-preview', function(e){ - e.preventDefault(); - $(".myPopover").addClass("slds-hide"); - // Hover befor close the preview - // $('.myPopover').hover( - // function () { - // $(".myPopover").removeClass("slds-hide"); - // }, - // function () { - // $(".myPopover").addClass("slds-hide"); - // } - // ); -}); + }; + reader.readAsDataURL(file); + }); - $('#story_description').keyup(function() { - + $(document).on("click", "#close-preview", function (e) { + e.preventDefault(); + $(".myPopover").addClass("slds-hide"); + // Hover befor close the preview + // $('.myPopover').hover( + // function () { + // $(".myPopover").removeClass("slds-hide"); + // }, + // function () { + // $(".myPopover").addClass("slds-hide"); + // } + // ); + }); + + $("#story_description").keyup(function () { var characterCount = $(this).val().length, - current = $('#current'), - maximum = $('#maximum'), - theCount = $('#the-count'); - + current = $("#current"), + maximum = $("#maximum"), + theCount = $("#the-count"); + current.text(characterCount); - - + /*This isn't entirely necessary, just playin around*/ - - + if (characterCount >= 500) { - maximum.css('color', '#8f0001'); - current.css('color', '#8f0001'); - theCount.css('font-weight','bold'); + maximum.css("color", "#8f0001"); + current.css("color", "#8f0001"); + theCount.css("font-weight", "bold"); } else { - maximum.css('color','#666'); - theCount.css('font-weight','normal'); + maximum.css("color", "#666"); + theCount.css("font-weight", "normal"); } - - }); - - $('#register-patient-advocate').click(function () { - $('#patientoption').val('PA').trigger('change'); - }) - $('#register-hospital-him').click(function () { - $('#patientoption').val('HIM').trigger('change'); - }) - + + $("#register-patient-advocate").click(function () { + $("#patientoption").val("PA").trigger("change"); + }); + $("#register-hospital-him").click(function () { + $("#patientoption").val("HIM").trigger("change"); + }); + function validateForm(id, buttonId, survey_category = "PA") { var valid = $(id).validate().checkForm(); - if (valid && survey_category != null ) { - $(buttonId).prop('disabled', false); - $(buttonId).removeClass('is-disabled'); + if (valid && survey_category != null) { + $(buttonId).prop("disabled", false); + $(buttonId).removeClass("is-disabled"); return true; } else { - $(buttonId).prop('disabled', 'disabled'); - $(buttonId).addClass('is-disabled'); + $(buttonId).prop("disabled", "disabled"); + $(buttonId).addClass("is-disabled"); return false; } } - - -}); \ No newline at end of file +});