Raw Source
tylercorrea / Admin Extension for JobSight

// ==UserScript==
// @name     Admin Extension for JobSight
// @license MIT
// @updateURL https://openuserjs.org/meta/username/Admin_Extension.meta.js
// @include  https://app.zlien.com/admin/orders/view_order/*
// @require  http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @grant    GM_addStyle
// ==/UserScript==

var companyNum = $( "#wdgt_user_info a:first").attr("href").replace(/[^0-9]/gi, '');
var isAffiliate = $( "#wdgt_user_info .badge-label:last" ).text();
var overrides = { "7083": { "instruction": ["If search for GC comes back empty, send missing contact RN for GC. If unable to locate any project info, send missing address, missing GC, and missing PO. For monthly notices, if Federl Project Type notification is sent and user accepts, cancel the order."] },"17291": { "instruction": ["If a claim is ordered, send a Desk to Natalie (Natalie.Chilson@bluelinerental.com) to confirm they want to proceed"] },"18053": { "instruction": ["Notices: If the project type changes and the document is voluntary or not required, cancel the order. All Orders: If the project type changes and new extra fields are required for $amounts, use the amount info from the previous order."] },"6413": { "instruction": ["If user lists the owner as FPL, Florida Power & Light, etc. send the notice out as-is"] }, "4810": { "instruction": ["If a claim is ordered, send a desk to Barry (barrydambrowski@emser.com) to confirm they want to proceed. Do NOT send conflict or non-match notifications for project address if it is only for a suite number, leave as-is."] }, "24098": { "instruction": ["Keep lot numbers in the project address. If you have to send and alert for conflicting project address make sure to keep the lot numbers as well."] }, "16199": { "instruction": ["If project is new development leave as residential if the order was submitted as residential. Hub does not want to be contacted with the commercial suggestion. If the project is Tribal Land, proceed as is. No need to reach out to the user."] }, "12814": { "instruction": ["Claims: If a claim is ordered, contact their user (Elisabeth to make sure that they want to proceed. "] }, "7186": { "instruction": ["If General Contractor provided is only name with no mailing address, send a contact conflict alert with the address we find. "] }, "16200": { "instruction": ["Monthly Notices: If project is a new development, consider it commercial until it is sold by the developer. "] }, "22533": { "instruction": ["When sending an alert for Legal Property Description attach a PDF of the property report. "] }, "20825": { "instruction": ["If the property address contains CPU or Customer Pick Up, desk the user to see if they would like to cancel or proceed. "] }, "29162": { "instruction": ["Notices: If you're not able to find research on the county assessor, cancel the order. Confirm all DataTree hits on the assessor. "] }, "13366": { "instruction": ["Do NOT send any RNs for missing address. Please reach out to other researchers and as a last resort Amy if you are unable to find anything. Please refer to Amy's instructions on how to research oil and gas jobs before pinging her or others. "] }, "10813": { "instruction": ["For State/County monthly notices, obtain the bond number from the projects page and copy to the order before sending / setting ready for batch. "] }, "18768": { "instruction": ["If NOC is found, send an alert for Owner Designee, do NOT just add the contact. User is concerned about postage. Please attach NOC for reference on RNs"] }, "20587": { "instruction": ["On VMLA orders, cancel the order if there is no Mechanics Lien Agent, if the project is commercial, or if it's confirmed to be an addition or renovation and not new construction. On SCR, if there is no filing to file on, do NOT send out in house, instead cancel the order."] }, "18724": { "instruction": ["When an order appears to be on Tribal Land, do NOT send tribal desk. Send out the notices as the submitted project type and do not contact user."] }, "15697": { "instruction": ["Premium Research Trial Until 7/20."] }, "34840": { "instruction": ["File on LiensNC. 3 Attempts to obtain info before sending RNs"] }, "21194": { "instruction": ["Can update hiring role. 3 Attempts to obtain info before sending RNs"] }, "33972": { "instruction": ["Can update hiring role. 3 Attempts to obtain info before sending RNs"] }, "7026": { "instruction": ["Can update hiring role. 3 Attempts to obtain info before sending RNs"] }, "38704": { "instruction": ["Can update hiring role. 3 Attempts to obtain info before sending RNs"] }, "18756": { "instruction": ["Can update hiring role. 3 Attempts to obtain info before sending RNs"] }, "33757": { "instruction": ["Can update hiring role. 3 Attempts to obtain info before sending RNs"] }, "27367": { "instruction": ["Can update hiring role. Always add legal when applicable. RN after 1st touch when deadline is < 3 days. RN after 1st touch for rushed orders. Try to confirm customer's role. Make sure contacts and PA are in lower case."] },"22346": { "instruction": ["ONLY USE ASSESSOR TO RESEARCH. If search for GC comes back empty, send missing contact RN for GC. IF OIL/GAS PROJECT, CHANGE PROJECT TYPE TO OTHER, CANCEL ORDER. If unable to locate any project info, send missing address, missing GC, and missing PO."] },"15083": { "instruction": ["Please cancel any orders with expired/unresolved alerts and/or where we are missing required prelien information in TERESA’S REGION. Continue to process/send such orders in CYNDE’S REGION. We can still email them to gather more information if needed, as per regular procedure. ONLY ADD INFO GATHERED FROM CALLS, NOT SIMILAR PROJECTS IN THE UDG"] },"42888": { "instruction": ["Send missing GC RN if you're unable to find them."] },"34840": { "instruction": ["Please remember to send the FHMI TE if we cannot find a filing on LiensNC. Can update hiring role. 3 Attempts to obtain info before sending RNs."] },"16199": { "instruction": ["SURETY MIGHT BE UNASSOCIATED, CHECK BEFORE SENDING."] },"46917": { "instruction": ["Do not send RN's for estimated total contract amount."] }}; 
var instList = '';
if (overrides[companyNum]) { var list = $.each(overrides[companyNum].instruction, function(i, inst) {
    var listItem = '<li>' + inst + '</li>';
    instList += listItem;
});} else { instList = "<li>No special instructions</li>"; }
if (isAffiliate == "Affiliate") { instList += "<li>AFFILIATE ORDER</li>"; }
var myHTML = '<div id="gmRightSideBar"><ul>' +
             instList +
             '</ul>' +
             '</div>';
$("body").append (myHTML);

GM_addStyle ( "                                                     \
    #gmRightSideBar {                                               \
        position:               fixed;                              \
        top:                    0;                                  \
        right:                  0;                                  \
        margin:                 1ex;                                \
        padding:                1em;                                \
        background:             orange;                             \
        width:                  200px;                              \
        z-index:                6666;                               \
        opacity:                0.9;                                \
    }                                                               \
    #gmRightSideBar p {                                             \
        font-size:              80%;                                \
    }                                                               \
    #gmRightSideBar ul {                                            \
        margin:                 0ex;                                \
    }                                                               \
    #gmRightSideBar a {                                             \
        color:                  blue;                               \
    }                                                               \
" );