first commit

This commit is contained in:
Senad Uka
2017-11-07 09:23:57 +01:00
commit 0eee92660a
356 changed files with 747259 additions and 0 deletions

72
helix/static/css/fontello.css vendored Executable file
View File

@@ -0,0 +1,72 @@
@font-face {
font-family: 'fontello';
src: url('../font/fontello.eot?10976371');
src: url('../font/fontello.eot?10976371#iefix') format('embedded-opentype'),
url('../font/fontello.woff2?10976371') format('woff2'),
url('../font/fontello.woff?10976371') format('woff'),
url('../font/fontello.ttf?10976371') format('truetype'),
url('../font/fontello.svg?10976371#fontello') format('svg');
font-weight: normal;
font-style: normal;
}
/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
/*
@media screen and (-webkit-min-device-pixel-ratio:0) {
@font-face {
font-family: 'fontello';
src: url('../font/fontello.svg?10976371#fontello') format('svg');
}
}
*/
[class^="icon-"]:before, [class*=" icon-"]:before {
font-family: "fontello";
font-style: normal;
font-weight: normal;
speak: none;
display: inline-block;
text-decoration: inherit;
width: 1em;
margin-right: .2em;
text-align: center;
/* opacity: .8; */
/* For safety - reset parent styles, that can break glyph codes*/
font-variant: normal;
text-transform: none;
/* fix buttons height, for twitter bootstrap */
line-height: 1em;
/* Animation center compensation - margins should be symmetric */
/* remove if not needed */
margin-left: .2em;
/* you can be more comfortable with increased icons size */
/* font-size: 120%; */
/* Font smoothing. That was taken from TWBS */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* Uncomment for 3D effect */
/* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
}
.icon-info-circled:before { content: '\e800'; } /* '' */
.icon-seismic-anchor:before { content: '\e801'; } /* '' */
.icon-trash:before { content: '\e802'; } /* '' */
.icon-down-open-big:before { content: '\e803'; } /* '' */
.icon-ok:before { content: '\e804'; } /* '' */
.icon-pencil:before { content: '\e805'; } /* '' */
.icon-right-open:before { content: '\e806'; } /* '' */
.icon-left-open:before { content: '\e807'; } /* '' */
.icon-down-open:before { content: '\e808'; } /* '' */
.icon-up-open:before { content: '\e809'; } /* '' */
.icon-plus:before { content: '\e80a'; } /* '' */
.icon-info:before { content: '\e80b'; } /* '' */
.icon-close:before { content: '\e80c'; } /* '' */
.icon-sunpower-logo:before { content: '\e80d'; } /* '' */
.icon-upload-cloud:before { content: '\e80e'; } /* '' */

1025
helix/static/css/main.css Normal file

File diff suppressed because it is too large Load Diff

BIN
helix/static/font/fontello.eot Executable file

Binary file not shown.

40
helix/static/font/fontello.svg Executable file
View File

@@ -0,0 +1,40 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Copyright (C) 2016 by original authors @ fontello.com</metadata>
<defs>
<font id="fontello" horiz-adv-x="1000" >
<font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
<missing-glyph horiz-adv-x="1000" />
<glyph glyph-name="info-circled" unicode="&#xe800;" d="M454 810q190 2 326-130t140-322q2-190-131-327t-323-141q-190-2-327 131t-139 323q-4 190 130 327t324 139z m52-152q-42 0-65-24t-23-50q-2-28 15-44t49-16q38 0 61 22t23 54q0 58-60 58z m-120-594q30 0 84 26t106 78l-18 24q-48-36-72-36-14 0-4 38l42 160q26 96-22 96-30 0-89-29t-115-75l16-26q52 34 74 34 12 0 0-34l-36-152q-26-104 34-104z" horiz-adv-x="920" />
<glyph glyph-name="seismic-anchor" unicode="&#xe801;" d="M461 850l-150-544-89 162-110-177h-112l0-83h157l60 100 124-214 114 407 150-650 110 357 336 0v81l-393 2-43-119z" horiz-adv-x="1063" />
<glyph glyph-name="trash" unicode="&#xe802;" d="M50 458q122-70 330-70t330 70l-54-486q-2-14-35-36t-100-43-141-21-140 21-100 43-36 36z m488 300q94-18 158-55t64-71l0-10q0-58-112-99t-268-41-268 41-112 99l0 10q0 34 64 71t158 55l42 48q22 26 70 26l92 0q52 0 70-26z m-54-112l84 0q-92 110-104 126-14 16-32 16l-102 0q-22 0-32-16l-106-126 84 0 64 66 82 0z" horiz-adv-x="760" />
<glyph glyph-name="down-open-big" unicode="&#xe803;" d="M63 570l370-356 372 356q22 26 48 0 26-22 0-48l-396-392q-22-22-48 0l-396 392q-26 26 0 48 24 24 50 0z" horiz-adv-x="866" />
<glyph glyph-name="ok" unicode="&#xe804;" d="M932 534q0-22-15-38l-404-404-76-76q-16-15-38-15t-38 15l-76 76-202 202q-15 16-15 38t15 38l76 76q16 16 38 16t38-16l164-165 366 367q16 16 38 16t38-16l76-76q15-16 15-38z" horiz-adv-x="1000" />
<glyph glyph-name="pencil" unicode="&#xe805;" d="M718 680q32-32 47-64t15-48l0-16-252-252-290-288-238-52 50 240 290 288 252 252q54 12 126-60z m-494-640l24 24q-2 44-52 94-22 22-45 35t-35 13l-14 2-22-24-18-80q28-16 46-34 24-24 36-48z" horiz-adv-x="780" />
<glyph glyph-name="right-open" unicode="&#xe806;" d="M98 626l226-236q16-16 16-40 0-22-16-38l-226-236q-16-16-40-16t-40 16q-36 36 0 80l186 194-186 196q-36 44 0 80 16 16 41 16t39-16z" horiz-adv-x="340" />
<glyph glyph-name="left-open" unicode="&#xe807;" d="M242 626q14 16 39 16t41-16q38-36 0-80l-186-196 186-194q38-44 0-80-16-16-40-16t-40 16l-226 236q-16 16-16 38 0 24 16 40 206 214 226 236z" horiz-adv-x="341" />
<glyph glyph-name="down-open" unicode="&#xe808;" d="M564 422l-234-224q-18-18-40-18t-40 18l-234 224q-16 16-16 41t16 41q38 38 78 0l196-188 196 188q40 38 78 0 16-16 16-41t-16-41z" horiz-adv-x="580" />
<glyph glyph-name="up-open" unicode="&#xe809;" d="M564 280q16-16 16-41t-16-41q-38-38-78 0l-196 188-196-188q-40-38-78 0-16 16-16 41t16 41l234 224q16 16 40 16t40-16z" horiz-adv-x="580" />
<glyph glyph-name="plus" unicode="&#xe80a;" d="M550 400q30 0 30-50t-30-50l-210 0 0-210q0-30-50-30t-50 30l0 210-210 0q-30 0-30 50t30 50l210 0 0 210q0 30 50 30t50-30l0-210 210 0z" horiz-adv-x="580" />
<glyph glyph-name="info" unicode="&#xe80b;" d="M352 850q48 0 74-27t26-69q0-50-39-88t-95-38q-48 0-74 26t-24 72q0 46 35 85t97 39z m-206-1000q-100 0-54 178l60 254q14 56 0 56-12 0-54-18t-72-38l-26 44q90 78 189 126t151 48q78 0 36-162l-70-266q-16-64 6-64 44 0 118 60l30-40q-84-86-175-132t-139-46z" horiz-adv-x="460" />
<glyph glyph-name="close" unicode="&#xe80c;" d="M47 836l-44-44 442-442-444-443 45-44 443 443 442-442 44 44-442 442 443 443-44 44-443-443z" horiz-adv-x="1000" />
<glyph glyph-name="sunpower-logo" unicode="&#xe80d;" d="M466 633c-35 61-77 96-152 96-78 0-146-56-146-137 0-76 78-111 138-138l59-26c114-50 211-107 211-248 0-154-124-272-277-272-141 0-247 91-275 228l96 27c13-90 82-164 177-164 94 0 181 73 181 172 0 103-81 138-163 175l-53 24c-103 47-192 99-192 225 0 137 116 225 247 225 98 0 181-50 228-137l-79-50 0 0z m537-353c0-66-3-140 38-197 39-53 114-84 178-84 63 0 132 29 173 79 47 56 43 133 43 202l0 525 99 0 0-552c0-96-7-172-78-244-60-66-148-101-237-101-83 0-168 32-228 90-77 74-86 154-86 255l0 552 98 0 0-525 0 0z m874 562l688-720 0 683 98 0 0-922-688 720 0-680-98 0 0 919z m1255-128l36 0c114 0 230-11 230-155 0-126-92-159-201-159l-65 0 0 314 0 0z m0-405l71 0c74 0 150 9 209 58 55 46 84 119 84 190 0 78-33 155-99 201-64 44-143 47-219 47l-145 0 0-882 99 0 0 386 0 0z m1949-165l285 706 285-706 232 661 106 0-338-927-285 709-285-709-338 927 106 0 232-661z m1128 661l457 0 0-91-359 0 0-262 348 0 0-91-348 0 0-347 359 0 0-91-457 0 0 882z m886-91l29 0c118 0 225-14 225-159 0-137-113-158-224-158l-30 0 0 317 0 0z m0-404l24 0 267-387 120 0-280 395c136 12 221 108 221 244 0 198-156 243-323 243l-127 0 0-882 98 0 0 387 0 0z m-2487 53c0-257-204-453-463-453-253 0-456 205-456 451 0 249 201 454 456 454 259 0 463-195 463-452m-816-2c0-188 150-354 348-354 204 0 363 154 363 354 0 203-157 357-363 357-200 0-348-166-348-357m3755 309c0 24 6 46 18 67 12 21 29 38 50 50 21 12 43 18 67 18 24 0 47-6 68-18 21-12 37-29 49-49 12-21 18-44 18-68 0-24-6-46-17-66-12-21-28-38-49-50-21-13-44-19-69-19-24 0-47 6-68 19-21 12-37 29-49 49-12 21-18 43-18 67l0 0z m17 0c0-21 5-41 16-59 11-18 25-33 43-43 18-11 38-16 59-16 22 0 41 5 59 16 19 10 33 25 44 43 10 18 16 38 16 59 0 21-6 40-16 58-10 18-24 33-43 44-18 11-38 16-60 16-21 0-40-5-59-16-18-10-32-25-43-43-11-19-16-38-16-59l0 0z m166 33c0-9-2-17-6-25-5-7-12-12-20-17l42-70-22 0-37 65-30 0 0-65-18 0 0 158 37 0c18 0 31-4 40-11 10-8 14-19 14-35l0 0z m-73-33l20 0c11 0 19 3 25 8 7 6 10 14 10 25 0 20-12 30-36 30l-19 0 0-63 0 0z" horiz-adv-x="7828" />
<glyph glyph-name="upload-cloud" unicode="&#xe80e;" d="M760 494q100 0 170-68t70-166-70-166-170-68l-190 0 0 190 106 0-176 230-174-230 104 0 0-190-248 0q-74 0-128 52t-54 124q0 74 53 126t129 52q14 0 20-2-2 12-2 38 0 108 78 184t188 76q90 0 160-52t94-134q28 4 40 4z" horiz-adv-x="1000" />
</font>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
helix/static/font/fontello.ttf Executable file

Binary file not shown.

BIN
helix/static/font/fontello.woff Executable file

Binary file not shown.

BIN
helix/static/font/fontello.woff2 Executable file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,240 @@
(function () {
var originalStringsSelect;
$(document).ready(function () {
setInverterInputsVisibility();
$("#inverter_brand_id").change(submitInverterBrandForm);
$("#inverter_quantity").change(setInverterInputsVisibility);
$("#add_new_power_station").click(function () {
showAddNewPowerStationForm();
});
$('#add_standalone_inverter').click(function () {
showAddStandaloneInverterForm();
});
$('#add_supervisor_monitor').click(function () {
showAddSupervisorMonitorForm();
});
for (var i = 1; i <= 4; i++) {
var currentTarget = $("#inverter_" + i + "-model");
currentTarget[0] && setInverterStringsOptions(currentTarget[0]);
currentTarget.change(setInverterStringsOptionsFromEvent);
}
setInverterStringsOptions($("#inverter-model")[0]);
$("#inverter-model").change(function (event) {
setStandaloneInverterStringLimits();
setInverterStringsOptions($("#inverter-model")[0]);
});
setupEditButtonHandlers('power_station', editPowerStation);
setupEditButtonHandlers('standalone_inverter', editStandaloneInverter);
setupEditButtonHandlers('supervisor_monitor', editSupervisorMonitor);
});
function submitInverterBrandForm() {
$('form[name="inverter_brand_form"]').submit();
}
function setInverterInputsVisibility() {
inverterQuantity = $('#inverter_quantity').val();
for (var i = 1; i <= 4; i++) {
if (i <= inverterQuantity) {
$("#inverter_" + i + "_row").show();
} else {
$("#inverter_" + i + "_row").hide();
}
}
}
function setInverterStringsOptionsFromEvent(event) {
setInverterStringsOptions(event.currentTarget);
}
function setStandaloneInverterStringLimits() {
var inverterStringsPerInverterForm = $('#inverter-strings_per_inverter_row');
var inverterStringsPerInverter = $('#inverter-strings_per_inverter');
var inverterStringsPerInverterValue = inverterStringsPerInverter.val();
var inverterModel = $('#inverter-model');
var selectedStrings = inverterModel.val();
var stringOptions = standaloneInverterStringLimits[selectedStrings];
originalStringsSelect = originalStringsSelect || inverterStringsPerInverter.clone();
inverterStringsPerInverter.empty();
if (stringOptions && stringOptions.length) {
originalStringsSelect
.find('option')
.each(function(i, opt) {
if (stringOptions.indexOf(parseInt(opt.value)) > -1) {
inverterStringsPerInverter.append($(opt).clone())
}
});
inverterStringsPerInverter.val(inverterStringsPerInverterValue);
inverterStringsPerInverterForm.css('display', 'inherit');
} else {
inverterStringsPerInverter.append($('<option selected value="0"></option>'));
inverterStringsPerInverterForm.css('display', 'none');
}
}
function setInverterStringsOptions(currentTarget) {
var defaultStringValue = standaloneInverterStringDefaults[currentTarget.value];
if (defaultStringValue) {
var currentStringValue = defaultStringValue;
var stringsId = currentTarget.id.replace("-model", "-strings_per_inverter");
var stringsField = $("#" + stringsId);
var options = stringsField[0].options;
for (var i = 0; i < options.length; i++) {
if (parseInt(options[i].value) <= parseInt(defaultStringValue)) {
currentStringValue = options[i].value;
} else {
break;
}
}
stringsField.val(currentStringValue);
}
}
function setupEditButtonHandlers(name, editFunction) {
var tableRowSelector = "." + name + "_table tr";
var formId = "#" + name + "_form";
var deleteLinkPrefix = '/delete_' + name + '/';
$(tableRowSelector).each(function () {
var table_row = $(this);
var editButton = table_row.find("i.icon-pencil");
if (editButton.length > 0) {
var uuid = editButton.attr('id').split("edit_")[1];
editButton.click(function () {
$(tableRowSelector).each(function () {
$(this).removeClass('selected');
});
table_row.addClass('selected');
var deleteButton = $(formId + ' .delete_button');
deleteButton.removeClass('hidden');
deleteButton.attr('href', deleteLinkPrefix + uuid);
editFunction(uuid);
})
}
});
}
function editPowerStation(uuid) {
var data = getObjectByUuid(uuid, powerStationData, 'power_station_id');
if (data) {
$('#power_station_id').val(uuid);
$('#power_station_description').val(data['power_station_description']);
$('#power_station_quantity').val(data['power_station_quantity']);
$('#aux_plug').prop('checked', data['aux_plug']);
$('#ac_run_length').val(data['ac_run_length']);
$('#inverter_quantity').val(data['inverter_quantity']);
setInverterInputsVisibility();
var inverters = data['inverters'];
for (var idx = 0; idx < inverters.length; idx++) {
var inverter = inverters[idx];
var prefix = '#inverter_' + (idx + 1);
fillInverterData(inverter, prefix);
$(prefix + '-model').val(inverter['model']);
$(prefix + '-strings_per_inverter').val(inverter['strings_per_inverter']);
$(prefix + '-sunshade').prop('checked', inverter['sunshade']);
$(prefix + '-dc_switch').prop('checked', inverter['dc_switch']);
}
$('.ebom_form .submit input').val('Save');
}
showAddNewPowerStationForm();
}
function editStandaloneInverter(uuid) {
data = getObjectByUuid(uuid, standaloneInverterData, 'standalone_inverter_id');
if (data) {
$('#standalone_inverter_id').val(uuid);
$('#standalone_ac_run_length').val(data['ac_run_length']);
$('#attachment-point').val(data['attachment_point'][0]);
fillInverterData(data, '#inverter');
$('#standalone_inverter_form .submit input').val('Save');
$('#inverter-quantity_row').addClass('hidden');
}
showAddStandaloneInverterForm();
}
function editSupervisorMonitor(uuid) {
data = getObjectByUuid(uuid, supervisorMonitorData, 'monitor_id');
if (data) {
$('#supervisor_monitor_form #monitor_id').val(uuid);
var power_source = data['power_source'];
if (power_source[0] !== 'Switch Gear/External') {
$('#power_source').append($('<option>', {
value: power_source[1],
text: power_source[0]
}));
$('#power_source').val(data['power_source'][1]);
}
$('#supervisor_monitor_form .submit input').val('Save');
}
showAddSupervisorMonitorForm();
}
function fillInverterData(inverter, prefix) {
$(prefix + '-model').val(inverter['model']);
$(prefix + '-strings_per_inverter').val(inverter['strings_per_inverter']);
$(prefix + '-sunshade').prop('checked', inverter['sunshade']);
$(prefix + '-dc_switch').prop('checked', inverter['dc_switch']);
$(prefix + '-splice_box').prop('checked', inverter['splice_box']);
}
function showAddNewPowerStationForm() {
$("#add_new_power_station").addClass('disabled');
$('#add_standalone_inverter').removeClass('disabled');
$('#add_supervisor_monitor').removeClass('disabled');
$('#power_station_form').removeClass('hidden');
$('#supervisor_monitor_form').addClass('hidden');
$('#standalone_inverter_form').addClass('hidden');
}
function showAddStandaloneInverterForm() {
setStandaloneInverterStringLimits();
$('#add_standalone_inverter').addClass('disabled');
$('#add_new_power_station').removeClass('disabled');
$('#add_supervisor_monitor').removeClass('disabled');
$('#power_station_form').addClass('hidden');
$('#supervisor_monitor_form').addClass('hidden');
$('#standalone_inverter_form').removeClass('hidden');
}
function showAddSupervisorMonitorForm() {
$('#add_supervisor_monitor').addClass('disabled');
$('#add_standalone_inverter').removeClass('disabled');
$('#add_new_power_station').removeClass('disabled');
$('#power_station_form').addClass('hidden');
$('#standalone_inverter_form').addClass('hidden');
$('#supervisor_monitor_form').removeClass('hidden');
}
function getObjectByUuid(uuid, data, uuid_key) {
for (var key in data) {
if (data.hasOwnProperty(key)) {
var val = data[key];
if (val[uuid_key] == uuid) {
return val;
}
}
}
}
})();

View File

@@ -0,0 +1,26 @@
$(document).ready(function () {
setExposureTransitionDistanceVisibility();
$("#exposure_category").change(setExposureTransitionDistanceVisibility);
$(".icon-info-circled").click(showTooltip);
});
function setExposureTransitionDistanceVisibility() {
exposureCategory = $("#exposure_category").val();
if ($.inArray(exposureCategory, ["B to C", "C to B"]) != -1) {
$("#exposure_category_transition_distance_row").show();
} else {
$("#exposure_category_transition_distance_row").hide();
}
}
function showTooltip(event) {
$(this).parent().find('.tooltip').removeClass('hidden');
$('body').click(hideTooltip);
event.stopPropagation();
}
function hideTooltip() {
$('.tooltip').addClass('hidden');
$(this).unbind();
}