Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TCP CMU JS Updates #172

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
315 changes: 304 additions & 11 deletions code/right-of-way/right-of-way.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,37 @@ function bigButton(id, view_id, url, fa_icon, button_label, target_blank = false
if (callback) callback();
}

// create large Task Board button on the Home page
$(document).on("knack-view-render.view_644", function(event, page) {
bigButton("task-board", "view_644", "https://atd.knack.com/row#task-board/", "tasks", "Task Board");
});
// create large Customer Portal button on the Home page
$(document).on("knack-view-render.view_645", function(event, page) {
bigButton("customer-portal", "view_645", "https://atd.knack.com/row#customer-portal/", "child", "Customer Portal");
});
// create large Customer Home button on the Home page
$(document).on("knack-view-render.view_1087", function(event, page) {
bigButton("customer-login", "view_1087", "https://atd.knack.com/row#customer/", "unlock-alt", "Customer Login");
});
// create large Account Managment button on the Home page
$(document).on("knack-view-render.view_646", function(event, page) {
bigButton("account-management", "view_646", "https://atd.knack.com/row#account-management/", "users", "Manage Internal Accounts");
});
// create large Manage Customer Accounts button on the Home page
$(document).on("knack-view-render.view_1086", function(event, page) {
bigButton("manage-customers", "view_1086", "https://atd.knack.com/row#app-admin/manage-customers/", "user", "Manage Customer Accounts");
});
// create large TCP Projects button on the Home page
$(document).on("knack-view-render.view_31", function(event, page) {
bigButton("tcp-projects", "view_31", "https://atd.knack.com/row#tcp-projects/", "crop", "TCP Projects");
bigButton("tcp-projects", "view_31", "https://atd.knack.com/row#tcp-projects/", "briefcase", "TCP Projects");
});
// create large CCM button on the Home page
$(document).on("knack-view-render.view_244", function(event, page) {
bigButton("ccm", "view_244", "https://atd.knack.com/row#court-case-management/", "briefcase", "Court Case Management");
bigButton("ccm", "view_244", "https://atd.knack.com/row#court-case-management/", "suitcase", "Court Case Management");
});
// create large COS Reporting button on the Home page
$(document).on("knack-view-render.view_245", function(event, page) {
bigButton("cos", "view_245", "https://atd.knack.com/row#cost-of-service-reporting/", "dollar", "COS Reporting");
bigButton("cos", "view_245", "https://atd.knack.com/row#cost-of-service-data/", "dollar", "Cost of Service Data");
});
// create large CSWZ button on the Home page
$(document).on("knack-view-render.view_451", function(event, page) {
Expand All @@ -80,12 +100,29 @@ $(document).on("knack-view-render.view_451", function(event, page) {

// create large Available Services button on the Customer Portal Home page
$(document).on("knack-view-render.view_234", function(event, page) {
bigButton("services", "view_234", "https://atd.knack.com/row#customer-portal/services", "list-ul", "Available Intake Services");
bigButton("services", "view_234", "https://atd.knack.com/row#customer-portal/services", "list-ul", "Available Services");
});
// create large Available Services button on the ROW Portal page
$(document).on("knack-view-render.view_681", function(event, page) {
bigButton("all-services", "view_681", "https://atd.knack.com/row#portal-home/all-services", "list-ul", "Available Services");
});
// create large Available Services button on the Customer Home page
$(document).on("knack-view-render.view_1117", function(event, page) {
bigButton("customer-services", "view_1117", "https://atd.knack.com/row#customer/customer-services", "list-ul", "Available Services");
});
// create large ROW Division button on the Customer Portal Home page
$(document).on("knack-view-render.view_237", function(event, page) {
bigButton("row-division-link", "view_237", "https://www.austintexas.gov/department/right-way-row-management", "bank", "ROW Division", true);
});
// create large ROW Division button on the ROW Portal page
$(document).on("knack-view-render.view_684", function(event, page) {
bigButton("row-division-link", "view_684", "https://www.austintexas.gov/department/right-way-row-management", "bank", "ROW Division", true);
});
// create large ROW Division button on the Customer Home page
$(document).on("knack-view-render.view_1120", function(event, page) {
bigButton("row-division-link", "view_1120", "https://www.austintexas.gov/department/right-way-row-management", "bank", "ROW Division", true);
});


/********************************************/
/*********** Large Submit Buttons ***********/
Expand All @@ -105,7 +142,11 @@ $(document).on("knack-view-render.view_388", function(event, page) {
// create large Start Application button on the ROW Customer Portal - Services page for CSWZ
$(document).on("knack-view-render.view_444", function(event, page) {
largeSubmitButton("cswz-application", "view_444", "https://atd.knack.com/row#new-cswz/", "arrow-right", "Start Request");
});
});
// create large My Projects button on the Customer Dashboard - Customer Services page
$(document).on("knack-view-render.view_1089", function(event, page) {
largeSubmitButton("my-projects", "view_1089", "https://atd.knack.com/row#customer/my-projects", "arrow-right", "My Projects");
});

/****************************************************/
/*** Disable Breadcrumb Navigation Links Function ***/
Expand All @@ -118,9 +159,9 @@ function disableBreadCrumbsNonAdmin() {
}
}

/***************************************************************/
/*******************************************************************/
/*** Disable Breadcrumb Navigation Links for old TCP Application ***/
/***************************************************************/
/*******************************************************************/

//TCP Application Project Information page
$(document).on("knack-scene-render.scene_97", function () {
Expand All @@ -147,9 +188,9 @@ $(document).on("knack-scene-render.scene_102", function () {
disableBreadCrumbsNonAdmin();
});

/*******************************************************************/
/***************************************************************/
/*** Disable Breadcrumb Navigation Links for TCP Application ***/
/*******************************************************************/
/***************************************************************/

//New TCP Application page
$(document).on("knack-scene-render.scene_137", function () {
Expand Down Expand Up @@ -184,9 +225,9 @@ $(document).on("knack-scene-render.scene_153", function () {
disableBreadCrumbsNonAdmin();
});

/*******************************************************************/
/*******************************************************************************/
/*** Disable Breadcrumb Navigation Links for TCP Conflict/Shared TCP Request ***/
/*******************************************************************/
/*******************************************************************************/

//Applicant Information page
$(document).on("knack-scene-render.scene_183", function () {
Expand Down Expand Up @@ -217,9 +258,261 @@ $(document).on("knack-scene-render.scene_189", function () {
disableBreadCrumbsNonAdmin();
});

/***********************************************************************/
/*** Disable Breadcrumb Navigation Links for Customer Account Signup ***/
/***********************************************************************/

//Customer Account Login Step 2 page
$(document).on("knack-scene-render.scene_480", function () {
disableBreadCrumbsNonAdmin();
});
//Customer Account Setup Step 3 page
$(document).on("knack-scene-render.scene_476", function () {
disableBreadCrumbsNonAdmin();
});

/*************************************************************************/
/*** Disable Breadcrumb Navigation Links for Customer Project Creation ***/
/*************************************************************************/

//Customer Create TCP Project Step 1 page
$(document).on("knack-scene-render.scene_463", function () {
disableBreadCrumbsNonAdmin();
});
//Customer Create TCP Project Step 2 page
$(document).on("knack-scene-render.scene_464", function () {
disableBreadCrumbsNonAdmin();
});
//Customer Create CSWZ Request Step 1 page
$(document).on("knack-scene-render.scene_465", function () {
disableBreadCrumbsNonAdmin();
});
//Customer Create CSWZ Request Step 2 page
$(document).on("knack-scene-render.scene_467", function () {
disableBreadCrumbsNonAdmin();
});


/*************************************************************************************/
/** Disable the ability to Click/Touch outside a Modal Page (accidentally close it) **/
/*************************************************************************************/
$(document).on("knack-scene-render.any", function (event, scene) {
$(".kn-modal-bg").off("click");
});

/*************************************/
/*** Redirect from Blank Nav Pages ***/
/*************************************/
//Task Board Page
$(document).on('knack-scene-render.scene_166', function(event, scene) {
window.location.href = "https://atd.knack.com/row#task-board/my-tasks/";
});

/****************************/
/*** Autosubit Form Pages ***/
/****************************/

/* Auto Submit New TCP Submission Cycle */
$(document).on('knack-scene-render.scene_411', function(event, scene) {
$('button[type=submit]').submit();
});
/* Auto Submit New CSWZ Submission Cycle */
$(document).on('knack-scene-render.scene_417', function(event, scene) {
$('button[type=submit]').submit();
});

/* Auto Submit Begin Review for TCP Submissions */
$(document).on('knack-scene-render.scene_378', function(event, scene) {
$('button[type=submit]').submit();
});
/* Auto Submit Begin Review for CSWZ Submissions */
$(document).on('knack-scene-render.scene_386', function(event, scene) {
$('button[type=submit]').submit();
});

/* Auto Submit Approve TCP Case */
$(document).on('knack-scene-render.scene_488', function(event, scene) {
$('button[type=submit]').submit();
});

/***********************************/
/*** Custom TCP Navigation Menu ***/
/***********************************/
function tcpDropdownMenuItem(recordId, route, iconName, linkName, mobile = false, newTab = false) {
const buttonClass = mobile ? "desktop-button" : "kn-button"
if (newTab) {
return (
`<li class="${buttonClass}">\
<a href="#tcp-projects/tcp-details/${recordId}/${route}/${recordId}" target="_blank" and rel="noopener noreferrer">\
<span class="icon is-small"> \
<i class="fa ${iconName}" /> \
</span>\
<span>${linkName}</span>\
</a>\
</li>`)
}

return (
`<li class="${buttonClass}">\
<a href="#tcp-projects/tcp-details/${recordId}/${route}/${recordId}" class="tcp-nav-menu">\
<span class="icon is-small" style="color:#163f6e"> \
<i class="fa ${iconName}" /> \
</span>\
<span style="color:#163f6e">${linkName}</span>\
</a>\
</li>`)
}

/* TCP Case Details Page */
$(document).on('knack-view-render.view_1175', function(event, view, record) {
var recordId = view.scene.scene_id;

$(`<div class="details-dropdown-menu tabs">\
<ul id="desktop-menu-list">\
<li class="desktop-dropdown-menu kn-dropdown-menu kn-button">\
<a href="#tcp-projects/" data-kn-slug="#case-management">\
<span class="kn-dropdown-icon fa fa-reply" />\
<span class="nav-dropdown-link">&nbsp;Back to TCP Projects</span>\
</a>\
<ul class="kn-dropdown-menu-list desktop-dropdown-menu-list" style="min-width: 152px; margin: 0;">\
</ul>\
</li>\
<li class="desktop-dropdown-menu kn-dropdown-menu kn-button">\
<a href="#tcp-projects/tcp-details/${recordId}/edit-tcp-case/${recordId}" data-kn-slug="#update-case-details">\
<span class="kn-dropdown-icon fa fa-edit" /> \
<span class="nav-dropdown-link">&nbsp;Update Case Details</span>\
<span class="kn-dropdown-icon fa fa-caret-down" /> \
</a>\
<ul class="kn-dropdown-menu-list desktop-dropdown-menu-list" style="min-width: 152px; margin: 0;">\
${tcpDropdownMenuItem(recordId, "edit-tcp-case", "fa-briefcase", "Edit Case Details & Notes")}\
${tcpDropdownMenuItem(recordId, "edit-tcp-engineer-info", "fa-wrench", "Edit Engineer Info")}\
${tcpDropdownMenuItem(recordId, "edit-tcp-financial-info", "fa-dollar", "Edit Financial Info")}\
${tcpDropdownMenuItem(recordId, "edit-tcp-organization-info", "fa-building", "Edit Organization Info")}\
${tcpDropdownMenuItem(recordId, "edit-tcp-contact-person", "fa-child", "Edit Contact")}\
${tcpDropdownMenuItem(recordId, "change-tcp-contact-person", "fa-refresh", "Change Contact")}\
</ul>\
</li>\
${tcpDropdownMenuItem(recordId, "intake-decision", "fa-inbox", "Intake Decision")}\
${tcpDropdownMenuItem(recordId, "create-tcp-submission-cycle-staff", "fa-plus-square", "Create a Submission Cycle")}\
</ul>\
</div>`).appendTo("#view_1175")

/* Mobile TCP Case Details Page */
$(`<div class="mobile-details-dropdown-menu">\
<ul id="mobile-menu-list">\
<li class="mobile-dropdown-menu">\
<span class="desktop-button mobile-dropdown-button"> \
<i class="fa fa-reply desktop-dropdown" /> \
TCP Navigation Menu\
</span>\
<ul class="desktop-dropdown-menu-list" style="min-width: 152px; margin: .5em;">\
</ul>\
</li>\
<li class="mobile-dropdown-menu">\
<span class="desktop-button mobile-dropdown-button">\
<i class="fa fa-angle-down desktop-dropdown" /> \
Update Case Details Menu\
</span>\
<ul class="desktop-dropdown-menu-list" style="min-width: 152px; margin: .5em;">\
${tcpDropdownMenuItem(recordId, "edit-tcp-case", "fa-briefcase", "Edit Case Details & Notes", true)}\
${tcpDropdownMenuItem(recordId, "edit-tcp-engineer-info", "fa-wrench", "Edit Engineer Info", true)}\
${tcpDropdownMenuItem(recordId, "edit-tcp-financial-info", "fa-dollar", "Edit Financial Info", true)}\
${tcpDropdownMenuItem(recordId, "edit-tcp-organization-info", "fa-building", "Edit Organization Info", true)}\
${tcpDropdownMenuItem(recordId, "edit-tcp-contact-person", "fa-child", "Edit Contact", true)}\
${tcpDropdownMenuItem(recordId, "change-tcp-contact-person", "fa-refresh", "Change Contact", true)}\
</ul>\
</li>\
${tcpDropdownMenuItem(recordId, "intake-decision", "fa-inbox", "Intake Decision", true)}\
${tcpDropdownMenuItem(recordId, "create-tcp-submission-cycle-staff", "fa-plus-square", "Create a Submission Cycle", true)}\
</ul>\
</div>`).appendTo("#view_1175")
})

/************************************/
/*** Custom CSWZ Navigation Menu ***/
/************************************/
function cswzDropdownMenuItem(recordId, route, iconName, linkName, mobile = false, newTab = false) {
const buttonClass = mobile ? "desktop-button" : "kn-button"
if (newTab) {
return (
`<li class="${buttonClass}">\
<a href="#tcp-cswz/cswz-request-details/${recordId}/${route}/${recordId}" target="_blank" and rel="noopener noreferrer">\
<span class="icon is-small"> \
<i class="fa ${iconName}" /> \
</span>\
<span>${linkName}</span>\
</a>\
</li>`)
}

return (
`<li class="${buttonClass}">\
<a href="#tcp-cswz/cswz-request-details/${recordId}/${route}/${recordId}" class="cswz-nav-menu">\
<span class="icon is-small" style="color:#163f6e"> \
<i class="fa ${iconName}" /> \
</span>\
<span style="color:#163f6e">${linkName}</span>\
</a>\
</li>`)
}

/* CSWZ Case Details Page */
$(document).on('knack-view-render.view_1176', function(event, view, record) {
var recordId = view.scene.scene_id;

$(`<div class="details-dropdown-menu tabs">\
<ul id="desktop-menu-list">\
<li class="desktop-dropdown-menu kn-dropdown-menu kn-button">\
<a href="#tcp-cswz/" data-kn-slug="#case-management">\
<span class="kn-dropdown-icon fa fa-reply" />\
<span class="nav-dropdown-link">&nbsp;Back to CSWZ Requests</span>\
</a>\
<ul class="kn-dropdown-menu-list desktop-dropdown-menu-list" style="min-width: 152px; margin: 0;">\
</ul>\
</li>\
<li class="desktop-dropdown-menu kn-dropdown-menu kn-button">\
<a href="#tcp-cswz/cswz-request-details/${recordId}/edit-cswz-case/${recordId}" data-kn-slug="#update-case-details">\
<span class="kn-dropdown-icon fa fa-edit" /> \
<span class="nav-dropdown-link">&nbsp;Update Case Details</span>\
<span class="kn-dropdown-icon fa fa-caret-down" /> \
</a>\
<ul class="kn-dropdown-menu-list desktop-dropdown-menu-list" style="min-width: 152px; margin: 0;">\
${cswzDropdownMenuItem(recordId, "edit-cswz-case", "fa-briefcase", "Edit Case Details & Notes")}\
${cswzDropdownMenuItem(recordId, "connect-to-tcp-project", "fa-link", "Connect to TCP Project")}\
${cswzDropdownMenuItem(recordId, "edit-cswz-organization-info", "fa-building", "Edit Organization Info")}\
${cswzDropdownMenuItem(recordId, "edit-cswz-contact-person", "fa-child", "Edit Contact")}\
${cswzDropdownMenuItem(recordId, "change-cswz-contact-person", "fa-refresh", "Change Contact")}\
</ul>\
</li>\
${cswzDropdownMenuItem(recordId, "create-cswz-submission-cycle-staff", "fa-plus-square", "Create a Submission Cycle")}\
</ul>\
</div>`).appendTo("#view_1176")

/* Mobile CSWZ Case Details Page */
$(`<div class="mobile-details-dropdown-menu">\
<ul id="mobile-menu-list">\
<li class="mobile-dropdown-menu">\
<span class="desktop-button mobile-dropdown-button"> \
<i class="fa fa-reply desktop-dropdown" /> \
CSWZ Navigation Menu\
</span>\
<ul class="desktop-dropdown-menu-list" style="min-width: 152px; margin: .5em;">\
</ul>\
</li>\
<li class="mobile-dropdown-menu">\
<span class="desktop-button mobile-dropdown-button">\
<i class="fa fa-angle-down desktop-dropdown" /> \
Update Case Details Menu\
</span>\
<ul class="desktop-dropdown-menu-list" style="min-width: 152px; margin: .5em;">\
${cswzDropdownMenuItem(recordId, "edit-cswz-case", "fa-briefcase", "Edit Case Details & Notes", true)}\
${cswzDropdownMenuItem(recordId, "connect-to-tcp-project", "fa-link", "Connect to TCP Project", true)}\
${cswzDropdownMenuItem(recordId, "edit-cswz-organization-info", "fa-building", "Edit Organization Info", true)}\
${cswzDropdownMenuItem(recordId, "edit-cswz-contact-person", "fa-child", "Edit Contact", true)}\
${cswzDropdownMenuItem(recordId, "change-cswz-contact-person", "fa-refresh", "Change Contact", true)}\
</ul>\
</li>\
${cswzDropdownMenuItem(recordId, "create-cswz-submission-cycle-staff", "fa-plus-square", "Create a Submission Cycle", true)}\
</ul>\
</div>`).appendTo("#view_1176")
})