x x x
Only portrait mode is currently supported - please rotate your device.

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 25 Next »

AUDIENCE RESULTS

This Event Does Not Exist

Evaluation or non-commercial license for ConfiForms app for Confluence

The app is fully functional, but has limits on the number of records you can store per form and can only be used for evaluation / testing purposes. NOT for commercial use

Purchase a license

` } else { return `

Are you sure you want to delete ${user_display_name}?

` } } const insertModal = () => { let modal_html = ` ` return modal_html; } const openArjModal = (modal_type) => { let modal_form = getForm(modal_type); $("#modal-content-container").html(modal_form) $("#addremovejudge").show(); } /* END MODAL FUNCTIONS */ /* CONTENT FUNCTIONS */ const insertARJHTML = () => { let arj_skeleton = `

Event Judges

Add Judge
`; return arj_skeleton; } const generateARJJudgeHTML = (judge) => { let judge_html = ""; var button_html = `
`; judge_html += `

`+ judge.displayName +`

` + button_html + `
` return judge_html; } const getARJJudges = async () => { res = ""; res = await jQuery.ajax({ url: "/rest/api/group/"+arj_group_name+"/member?", type: "get", dataType: 'json', async: true }).then(res => res); res = res.results; return res; } const insertARJJudges = async () => { let arj_judges_html = ''; if(arj_group_name){ // get judges in entry ID group let arj_judges_arr = await getARJJudges(); console.log(arj_judges_arr) for(var i = 0; i < arj_judges_arr.length; i++){ arj_judges_html += generateARJJudgeHTML(arj_judges_arr[i]); } } return arj_judges_html; } /* END CONTENT FUNCTIONS */ /* FORM SUBMIT FUNCTIONS */ const addJudge = async (judge_info) => { // let judge_info_obj = { // "fullname": "Fareeha Ahmed", "email" : "fareeha@gsvlabs.com", "event_name": "Delhi City Finals", "group" : ["judge-users"], "addUserType":"judge" // } console.log("add judge initiated", judge_info) res = await jQuery.ajax({ url: "/rest/scriptrunner/latest/custom/addEventJudge", headers: { "X-Atlassian-Token": "nocheck", "Content-type": "application/json", }, type: "POST", dataType: "json", data: JSON.stringify(judge_info), async: true }).then(res => res); return res; } const handleAddForm = async () => { console.log("handle add form called") // formatdata, run add & show loading indicator // format data let formInputArr = $("#formaddeventjudge").serializeArray(); let formInputObj = {}; for(var i = 0; i < formInput.length; i++){ obj_name = formInput[i].name; formInputObj[obj_name] = formInput[i].value; } formInputObj.fullname = formInputObj[user_first_name] + formInputObj[user_first_name]; formInputObj.group = formInputObj[groups].split(","); console.log("right before adding", formInputObj) // to do: loading indicator // run add await addJudge(formInputObj).then(res => { console.log("returned", res) // hide loading indicator, show message, close modal, refresh users }).catch(err => console.log(err)); return false; } /* END FORM SUBMIT FUNCTIONS */ // insert stylesheets $(window).load(() => { let insert_html = "" for(var i = 0; i < insert_stylesheets.length; i++){ let curr_stylesheet = insert_stylesheets[i] insert_html += `` } $("head").append(insert_html); }) async function startJudgeScript(){ // create and insert modal which will hold the add and remove forms let modal_html = insertModal(); let arj_html = insertARJHTML(); let arj_judges_html = await insertARJJudges(); $(judges_parent_container_selector).append(arj_html); $("#arj-judges").append(arj_judges_html); $(modal_parent_container_selector).append(modal_html); } document.addEventListener("load", startJudgeScript(), false); // $(document).ready(function() { // // create and insert modal which will hold the add and remove forms // let modal_html = insertModal(); // let arj_html = insertARJHTML(); // let arj_judges_html = await insertARJJudges(); // $(judges_parent_container_selector).append(arj_html); // $("#arj-judges").append(arj_judges_html); // $(modal_parent_container_selector).append(modal_html); // });