if (typeof ($jobsitesummary) != "function") { var ctrlindex = 0; var assetIconCollapsed = false; var alertsCollapsed = false; $jobsitesummary = function (p, js, type, jobsites) {//type 0.left;1.bottom if (typeof p === "string") p = $("#" + p); if (!p) p = document; this.type = type; this.jobsite = js; this.jobsites = jobsites; this.status = 0; this.ctrlindex = ctrlindex++; this.jobsitechanged = null; var _this = this; this.basectrl = $('
'); //if (this.jobsites && this.jobsites.length > 1) { // this.basectrl.css('margin-top', 10); // var div_jobsite = $('
'); // div_jobsite.dropdown(this.jobsites, { // search: true, // valueKey: 'ID', // textKey: 'Name' // }); // div_jobsite.find(".dropdown-wrapper").css("border", "1px solid #b9b9b9"); // if (this.jobsite) // div_jobsite.dropdownVal(this.jobsite.ID); // div_jobsite.on('select', function (_e, item) { // if (item.ID != _this.jobsite.ID) { // var temps = _this.jobsites.filter(function (a) { return a.ID == item.ID }) // if (_this.jobsitechanged && temps && temps.length > 0) // _this.jobsitechanged(_this.jobsites.indexOf(temps[0])); // } // }); // p.append(div_jobsite); //} p.append(this.basectrl); //this.maskbgctrl = $('
'); //p.append(this.maskbgctrl); this.contractid = $("#selContractor").val(); if (!this.contractid) this.contractid = ""; this.refresh = function (js) { _this.basectrl.empty(); _this.jobsite = js; showJobsiteInfo(); } if (this.jobsite) { showJobsiteInfo(); } function setIconBr(div_icon) { var br = '
'; //if (_this.type == 0) div_icon.append(br); } function showJobsiteIcon() { var js = _this.jobsite; var div_icon = $('
'); var iconheight = p.height(); if (iconheight == 0) iconheight = p.parent().height(); if (_this.type == 0) { div_icon.css({ 'height': iconheight - 4, 'margin-top': -20 }); } else { div_icon.css({ 'height': iconheight + 5 }); //if (_this.jobsites && _this.jobsites.length > 1) { // div_icon.css({ 'height': p.parent().height() + 5, 'margin-top': -42 }); //} div_icon.removeClass("divicon_left"); div_icon.addClass("divicon_bottom"); } div_icon.removeClass("divicon_bottom"); div_icon.addClass("divicon_left"); var span; if (canEditJobsite) { span = $(''); span.click(js, function (e) { OnEditJobsite(js); }); div_icon.append(span); setIconBr(div_icon); } span = $(""); div_icon.append(span); setIconBr(div_icon); if (type == 0) { div_icon.find("span").click(function (e) { p.hide(); $('#assetsummarytrigle').hide(); }); } return div_icon; } function showJobsiteInfo() { if (!_this.jobsite) return; var js = _this.jobsite; var br = '
'; if (_this.type == 0) { var div_close = $('
'); _this.basectrl.append(div_close); var span_close = $('').click(function () { p.hide(); $('#assetsummarytrigle').hide(); }); div_close.append(span_close); } if (showTooltipIcons) { var div_icon = showJobsiteIcon(); _this.basectrl.append(div_icon); } var div_summary = $('
').css("text-align", "left"); if (!showTooltipIcons) div_summary.css("margin-left", 10); _this.basectrl.append(div_summary); var b = $('' + GetTextByKey("P_MV_NAME_COLON", "Name:") + ' '); div_summary.append(b); var label = $('').text(js.Name); div_summary.append(label).append(br); b = $('' + GetTextByKey("P_JS_CODE_COLON", "Code:") + ' '); div_summary.append(b); var label = $('').text(js.Code); div_summary.append(label).append(br); b = $('' + GetTextByKey("P_JS_NUMBER_COLON", "Number:") + ' '); div_summary.append(b); var label = $('').text(js.Number); div_summary.append(label).append(br); b = $('' + GetTextByKey("P_MV_LATLONG_COLON", "Lat/Long:") + ' '); div_summary.append(b); var label = $('').text(js.Latitude + ", " + js.Longitude); div_summary.append(label).append(br); b = $('' + GetTextByKey("P_MV_DELIVERYADDRESS_COLON", "Delivery Address:") + ' '); div_summary.append(b); label = $('').text(js.Address1); div_summary.append(label).append(br); div_summary.append(br); b = $('' + GetTextByKey("P_JS_FOREMAN_COLON", "Foreman:") + ' '); div_summary.append(b); var ftxt = js.Foreman; if (ftxt === "") { if (js.Phone !== "") ftxt = js.Phone; } else { if (js.Phone !== "") ftxt = ftxt + "," + js.Phone; } var label = $('').text(ftxt); div_summary.append(label).append(br); div_summary.append(br); b = $('' + GetTextByKey("P_JS_STATDATE_COLON", "Start Date:") + ' '); div_summary.append(b); var label = $('').text(js.StartDateStr); div_summary.append(label).append(br); b = $('' + GetTextByKey("P_JS_PROJECTEDENDDATE_COLON", "Projected End Date:") + ' '); div_summary.append(b); var label = $('').text(js.ProjectedEndDateStr); div_summary.append(label).append(br); b = $('' + GetTextByKey("P_JS_ENDDATE_COLON", "End Date:") + ' '); div_summary.append(b); var label = $('').text(js.EndDateStr); div_summary.append(label).append(br); div_summary.append(br); b = $('' + GetTextByKey("P_MV_NOTES_COLON", "Notes:") + ' '); div_summary.append(b); //var notes = (js.Notes && js.Notes !== "") ? replaceHtmlText(js.Notes) : ""; var label = $('').text(js.Notes || ""); div_summary.append(label).append(br); } } }