text
stringlengths 2.5k
6.39M
| kind
stringclasses 3
values |
---|---|
@*******************************************************************************************************
// Layout.cshtml - Gbtc
//
// Copyright © 2016, Grid Protection Alliance. All Rights Reserved.
//
// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
// the NOTICE file distributed with this work for additional information regarding copyright ownership.
// The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
// file except in compliance with the License. You may obtain a copy of the License at:
//
// http://opensource.org/licenses/MIT
//
// Unless agreed to in writing, the subject software distributed under the License is distributed on an
// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
// License for the specific language governing permissions and limitations.
//
// Code Modification History:
// ----------------------------------------------------------------------------------------------------
// 01/15/2016 - J. Ritchie Carroll
// Generated original version of source code.
//
//*****************************************************************************************************@
@using System.Net.Http
@using System.Text
@using System.Threading
@using GSF.Security
@using GSF.Identity
@using GSF.Web
@using GSF.Web.Model
@using GSF.Web.Security
@using GSF.Web.Shared
@using openHistorian.Model
@inherits ExtendedTemplateBase<AppModel>
@{
if (ViewBag.PageControlScripts == null) {
ViewBag.PageControlScripts = new StringBuilder();
}
string htmlTitle = Model.Global.ApplicationName;
// Define ViewBag.CustomTitle in page code for custom page titles
string pageTitle = ViewBag.CustomTitle ?? ViewBag.Title ?? "";
string subTitle = ViewBag.SubTitle ?? "";
bool pageHasSidebar = ViewBag.PageHasSidebar ?? false;
bool setFullWidth = ViewBag.SetFullWidth ?? pageHasSidebar;
bool hidePageTitle = false;
bool showMenu = true;
bool backgroundUnset = false;
if (!string.IsNullOrWhiteSpace(Model.Global.SystemName)) {
htmlTitle += " [" + Model.Global.SystemName.Trim() + "]";
}
htmlTitle += " - " + pageTitle.Trim();
if (ViewBag.HidePageTitle != null) {
hidePageTitle = ViewBag.HidePageTitle;
}
if (!string.IsNullOrWhiteSpace(subTitle) && !string.IsNullOrWhiteSpace(pageTitle)) {
pageTitle += " ";
}
if (ViewBag.ShowMenu != null) {
showMenu = ViewBag.ShowMenu;
}
if (ViewBag.BackgroundUnset != null) {
backgroundUnset = ViewBag.BackgroundUnset;
}
HttpRequestMessage request = ViewBag.Request;
ReadonlyAuthenticationOptions options = ViewBag.AuthenticationOptions;
string sessionToken = SessionHandler.DefaultSessionToken;
string loginPage = AuthenticationOptions.DefaultLoginPage;
if ((object)options != null)
{
sessionToken = options.SessionToken;
if (!string.IsNullOrWhiteSpace(options.LoginPage)) {
loginPage = options.LoginPage;
}
}
string requiresEditor = UserIsAdminOrEditor() ? "" : " disabled";
string grafanaInstalled = Model.Global.GrafanaServerInstalled ? "" : " disabled";
}
@functions {
public string IsActivePage(string pageTitle, string pageName)
{
return pageTitle.Trim().Equals(pageName, StringComparison.OrdinalIgnoreCase) ?
"class=\"active\"" : "";
}
public string GetCurrentUserID()
{
if (Thread.CurrentPrincipal.Identity == null)
return UserInfo.CurrentUserID;
return Thread.CurrentPrincipal.Identity.Name;
}
public bool UserIsAdmin()
{
SecurityPrincipal securityPrincipal = ViewBag.SecurityPrincipal as SecurityPrincipal;
if ((object)securityPrincipal == null)
return false;
return securityPrincipal.IsInRole("Administrator");
}
public bool UserIsAdminOrEditor()
{
SecurityPrincipal securityPrincipal = ViewBag.SecurityPrincipal as SecurityPrincipal;
if ((object)securityPrincipal == null)
return false;
return securityPrincipal.IsInRole("Administrator,Editor");
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
@* The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags *@
<title>@htmlTitle</title>
<meta name="application-name" content="@Model.Global.ApplicationName" />
<meta name="description" content="@Model.Global.ApplicationDescription" />
<meta name="keywords" content="@Model.Global.ApplicationKeywords" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link href="@Resources.Root/Shared/Content/bootstrap.css" rel="stylesheet">
<link href="@Model.Global.BootstrapTheme" rel="stylesheet">
<link href="@Resources.Root/Shared/Content/jquery-ui.css" rel="stylesheet">
<link href="Content/jquery.jspanel.css" rel="stylesheet">
<link href="Content/Site.css" rel="stylesheet">
@Raw(Resources.HeaderIcons)
@RenderSection("StyleSheets", false)
<style>
@@media (max-width: 995px) {
.navbar-header {
float: none;
}
.navbar-left,.navbar-right {
float: none !important;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.navbar-collapse.collapse {
display: none!important;
}
.navbar-nav {
float: none!important;
margin-top: 7.5px;
}
.navbar-nav>li {
float: none;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
.collapse.in {
display:block !important;
}
}
.sub-title {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
vertical-align: middle;
font-size: 17px;
font-weight: 400;
line-height: 1.4;
color: #777777;
}
</style>
@if (!showMenu) { if (backgroundUnset){
<style>
body {
margin-top: -70px;
margin-right: 20px;
}
</style>
} else {
<style>
body {
margin-top: -70px;
margin-right: 20px;
background-color: #105331;
}
h3 {
color: white;
}
</style>
}}
<script src="@Resources.Root/Shared/Scripts/jquery.js"></script>
<script>
const DateFormat = "@Model.Global.DateFormat";
const TimeFormat = "@Model.Global.TimeFormat";
const DateTimeFormat = "@Model.Global.DateTimeFormat";
</script>
</head>
<body role="document">
@if (showMenu) {
<div class="navbar navbar-inverse navbar-fixed-top" id="menuBar">
<div class="container">
<div class="navbar-header">
<img class="pull-left" style="padding: 10px" alt="@Model.Global.ApplicationName" src="Images/@(Model.Global.ApplicationName).png">
<a href="Index.cshtml" class="navbar-brand" style="font-size: larger; color: white" data-toggle="tooltip" data-placement="bottom" title="@Model.Global.ApplicationDescription">@Model.Global.ApplicationName</a>
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li @Raw(IsActivePage(pageTitle, "Home"))><a href="Index.cshtml">Home</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Devices <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="Devices.cshtml">Browse Devices</a></li>
<li><a href="AddDevice.cshtml" class="@(requiresEditor)"@requiresEditor>Add Device / Import Data</a></li>
<li role="separator" class="divider"></li>
<li><a href="DeviceGroups.cshtml">Device Groups</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Monitoring <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="TrendMeasurements.cshtml">Trend / Export Data</a></li>
<li><a href="grafana" class="@(grafanaInstalled)" @grafanaInstalled>Grafana Visualizations</a></li>
<li><a href="GraphMeasurements.cshtml">Real-time Measurements</a></li>
<li role="separator" class="divider"></li>
<li><a href="Status.cshtml">Current Device Status</a></li>
<li role="separator" class="divider"></li>
<li><a href="RemoteConsole.cshtml">Remote Service Console</a></li>
<li role="separator" class="divider"></li>
<li><a href="IaonGraph.cshtml">Iaon Connections</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Reports <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="UnbalanceReport.cshtml?reportType=0">Signal to Noise Ratio</a></li>
<li><a href="UnbalanceReport.cshtml?reportType=1">Voltage Unbalance</a></li>
<li><a href="UnbalanceReport.cshtml?reportType=2">Current Unbalance</a></li>
</ul>
</li>
@if (UserIsAdmin())
{
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Settings <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="Users.cshtml">Users</a></li>
<li><a href="Groups.cshtml">Groups</a></li>
<li role="separator" class="divider"></li>
<li><a href="Companies.cshtml">Companies</a></li>
<li role="separator" class="divider"></li>
<li><a href="Vendors.cshtml">Vendors</a></li>
<li><a href="VendorDevices.cshtml">Vendor Devices</a></li>
<li role="separator" class="divider"></li>
<li><a href="SelectTheme.cshtml">Select Theme</a></li>
</ul>
</li>
}
<li @Raw(IsActivePage(pageTitle, "Help"))><a href="Help.cshtml">Help</a></li>
</ul>
<div class="nav navbar-text navbar-right" style="margin-top: 10px; margin-bottom: 5px">
<button id="logoutButton" type="button" class="btn btn-sm btn-info" style="display: none" title="Log out @GetCurrentUserID()" hub-dependent>Log Out</button>
<a href="https://www.gridprotectionalliance.org/" target="_blank" style="padding-left: 10px">
<img alt="Grid Protection Alliance" src="@Resources.Root/Shared/Images/gpa-smalllock.png">
</a>
</div>
</div>
</div>
</div><!--/.navbar -->
}
else {
<div id="menuBar"></div>
}
<div class="container theme-showcase" @Raw(setFullWidth ? " style=\"width: 100%\"" : "") role="main" id="bodyContainer">
<div class="page-header" id="pageHeader">
<span class="glyphicon glyphicon-refresh pre-cache"></span>
<span class="glyphicon glyphicon-info-sign pre-cache"></span>
<span class="glyphicon glyphicon-exclamation-sign pre-cache"></span>
<div class="alert alert-info fade in" role="alert" id="info-msg-block" style="display: none">
<a href="#" class="close" aria-label="close" id="dismissInfoMsg">×</a>
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
<span class="sr-only">Info</span>
<span id="info-msg-text"></span>
</div>
<div class="alert alert-danger fade in" role="alert" id="error-msg-block" style="display: none">
<a href="#" class="close" aria-label="close" id="dismissErrorMsg">×</a>
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
<span class="sr-only">Error</span>
<span id="error-msg-text"></span>
</div>
@if (!hidePageTitle) {
<h3 id="pageTitle">
@Raw(pageTitle.Replace(" ", " "))<div id="subTitle" class="sub-title">@Raw(subTitle)</div> <small class="pull-right" id="titleText" style="margin-top: 8px"></small>
</h3>
}
</div>
<!-- Page Body for @request.RequestUri.AbsolutePath -->
@RenderBody()
</div><!--/.container -->
@* jquery-ui.js needs to precede boostrap.js *@
<script src="@Resources.Root/Shared/Scripts/jquery-ui.js"></script>
<script src="@Resources.Root/Shared/Scripts/bootstrap.js"></script>
<script src="@Resources.Root/Shared/Scripts/jquery.signalR.js"></script>
<script src="@Resources.Root/Shared/Scripts/js.cookie.js"></script>
<script src="@Resources.Root/Shared/Scripts/gsf.web.client.js"></script>
<script src="Scripts/jquery.jspanel.js"></script>
<script src="signalr/hubs"></script>
<script src="Scripts/Site.js?ver=2"></script>
@Raw(ViewBag.PageControlScripts.ToString())
@RenderSection("Scripts", false)
<script>
$("#logoutButton").click(function () {
if (!hubIsConnected)
return;
securityHub.logout(Cookies.get("@sessionToken")).done(function(success) {
window.location = "@loginPage.JavaScriptEncode()?logout&sessionCleared=" + success;
});
});
$("#logoutButton").show();
@if (!string.IsNullOrWhiteSpace(subTitle)) {
<text>
var pageTitleWidth;
function updateSubTitleProperties() {
const subTitle = $("#subTitle");
subTitle.width($("#pageHeader").width() - $("#titleText").width() - pageTitleWidth);
subTitle.prop("title", subTitle.text());
subTitle.show();
}
$(window).resize(updateSubTitleProperties);
$(function() {
textMetrics.font = $("#pageTitle").css("font");
pageTitleWidth = textMetrics.measureText("@pageTitle.Replace(" ", " ")").width;
if (pageTitleWidth < 5)
pageTitleWidth = 100;
// Set initial sub-title width
updateSubTitleProperties();
});
</text>
}
</script>
</body>
</html> | the_stack |
@*******************************************************************************************************
// SelectGroupDevices.cshtml - Gbtc
//
// Copyright © 2016, Grid Protection Alliance. All Rights Reserved.
//
// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
// the NOTICE file distributed with this work for additional information regarding copyright ownership.
// The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
// file except in compliance with the License. You may obtain a copy of the License at:
//
// http://opensource.org/licenses/MIT
//
// Unless agreed to in writing, the subject software distributed under the License is distributed on an
// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
// License for the specific language governing permissions and limitations.
//
// Code Modification History:
// ----------------------------------------------------------------------------------------------------
// 03/07/2020 - J. Ritchie Carroll
// Generated original version of source code.
//
//*****************************************************************************************************@
@using System.Net.Http
@using System.Text
@using GSF
@using GSF.Data.Model
@using GSF.Web
@using GSF.Web.Model
@using GSF.Web.Shared.Model
@using openHistorian
@using openHistorian.Model
@inherits ExtendedTemplateBase<AppModel>
@section StyleSheets {
<style>
html, body {
height: 100%;
}
/* Collapsable button style */
.btn-collapsable.btn {
color: #606060;
font-family: "Glyphicons Halflings";
font-size: 8pt;
padding: 0 2px 2px 2px;
height: 18px;
}
/* Collapsable button icon when content is shown - arrow down */
.btn-collapsable.btn:after {
content: "\e114";
}
/* Collapsable button icon when content is hidden - arrow right */
.btn-collapsable.btn.collapsed:after {
content: "\e080";
}
#collapseSelectedDevices.btn-collapsable.btn {
position: absolute;
margin-top: 3px;
margin-left: -22px;
-webkit-transition: all .75s ease-out;
-moz-transition: all .75s ease-out;
transition: all .75s ease-out;
}
#collapseSelectedDevices.btn-collapsable.btn.collapsed {
margin-top: 1px;
margin-left: -18px;
}
span.fixed-font {
font-size: small;
font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;
}
span.input-group-addon i.disabled {
color: #ccc;
cursor: not-allowed;
}
#scrollableDevicesArea {
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
#selectAllProgress {
width: 250px;
margin-bottom: -15px;
font-size: smaller;
}
#selectAllProgressBar {
padding-left: 10px;
padding-bottom: 5px;
padding-top: 2px;
}
#selectAllProgressCancel {
font-size: small;
padding-top: 1px;
padding-bottom: 1px;
margin-top: -20px;
margin-left: 1px
}
#selectAllMessage {
font-size: smaller;
}
#selectAllMessage a {
color: #337ab7;
text-decoration: none;
}
#selectAllMessage a:active, a:hover, a:focus {
color: #23527c;
text-decoration: underline;
cursor: pointer;
}
</style>
}
@{
if (ViewBag.PageControlScripts == null) {
ViewBag.PageControlScripts = new StringBuilder();
}
DataContext dataContext = ViewBag.DataContext;
StringBuilder pageControlScripts = ViewBag.PageControlScripts;
HttpRequestMessage request = ViewBag.Request;
Dictionary<string, string> parameters = request.QueryParameters();
string parameter;
int deviceGroupID;
if (!parameters.TryGetValue("ID", out parameter) || !int.TryParse(parameter, out deviceGroupID)) {
deviceGroupID = 0;
}
string deviceGroupAcronym;
parameters.TryGetValue("Acronym", out deviceGroupAcronym);
Layout = "Layout.cshtml";
ViewBag.Title = "Select " + deviceGroupAcronym + " Group Devices";
ViewBag.AddNewEditTitle = "Device Detail";
ViewBag.ShowSearchFilter = true;
ViewBag.HideUnauthorizedControls = true;
ViewBag.CanEdit = false;
ViewBag.CanAddNew = false;
ViewBag.CanDelete = false;
ViewBag.ShowMenu = false;
ViewBag.BackgroundUnset = true;
ViewBag.HeaderColumns = new[]
{ // { "Field", "Label", "Classes" }
new[] { null, "<input type='checkbox' id='selectAllCheckbox' title='Select All'/>", "text-center valign-middle non-sortable" },
new[] { "Acronym", "Acronym", "text-left" },
new[] { "Name", "Name", "text-left" }
};
ViewBag.BodyRows = BodyRows().ToString();
ViewBag.AddNewEditDialog = AddNewEditDialog(dataContext).ToString();
ViewBag.PageRecordsForEachBinding = "afterRender: postRecordRendering";
ViewBag.ParentKeys = Model.Global.NodeID.ToString();
// Prepend view model extension scripts to occur before model initialization
pageControlScripts.Insert(0, ExtendedViewModel().ToString().TrimStart());
}
@helper BodyRows()
{
<td width="5%" class="text-center valign-middle"><input type="checkbox" /></td>
<td width="50%" class="text-left valign-middle"><button type="button" class="btn btn-link" data-bind="text: Acronym, click: $parent.viewPageRecord"></button></td>
<td width="40%" class="text-left valign-middle" data-bind="text: Name"></td>
<td width="5%" class="text-center valign-middle" nowrap>
<button type="button" class="btn btn-xs" title="View Measurement Detail..." data-bind="click: $parent.viewPageRecord, enable: $parent.dataHubIsConnected"><span class="glyphicon glyphicon-list"></span></button>
</td>
}
@helper AddNewEditDialog(DataContext dataContext)
{
<div class="col-md-6">
@Raw(dataContext.AddInputField<Device>("ID", customDataBinding: "disable: true", groupDataBinding: "visible: $root.recordMode() !== RecordMode.AddNew"))
@Raw(dataContext.AddInputField<Device>("UniqueID", customDataBinding: "disable: true", groupDataBinding: "visible: $root.recordMode() !== RecordMode.AddNew"))
@Raw(dataContext.AddInputField<Device>("Acronym", initialFocus: true))
@Raw(dataContext.AddInputField<Device>("Name"))
@Raw(dataContext.AddSelectField<Device, Protocol>("ProtocolID", "ID", "Acronym", allowUnset: true))
@Raw(dataContext.AddSelectField<Device, VendorDevice>("VendorDeviceID", "ID", "Name", allowUnset: true))
</div>
<div class="col-md-6">
@Raw(dataContext.AddTextAreaField<Device>("ConnectionString", 4))
@Raw(dataContext.AddInputField<Device>("Longitude"))
@Raw(dataContext.AddInputField<Device>("Latitude"))
@Raw(dataContext.AddSelectField<Device, Company>("CompanyID", "ID", "Acronym"))
<div class="form-inline pull-right">
@Raw(dataContext.AddCheckBoxField<Device>("IsConcentrator"))
@Raw(dataContext.AddCheckBoxField<Device>("Enabled"))
</div>
</div>
}
@helper ExtendedViewModel()
{
<script>
function postRecordRendering(elements, sequenceRecord) {
const checkbox = $(elements).find("input[type=checkbox]");
if (!checkbox)
return;
checkbox.click(function() {
const record = viewModel.pageRecords()[checkbox.parents("tr")[0].rowIndex - 1];
if (checkbox[0].checked)
viewModel.addNewSelectedDeviceByRecord(record);
else
viewModel.deleteSelectedDeviceByRecord(record);
$("#selectAllMessage").hide();
});
// Allow up/down arrow keys to change focus between each row's checkbox
checkbox.keydown(function(event) {
if (event.which === 38) {
// Arrow up
const previousIndex = $(event.target).parents("tr")[0].rowIndex - 1;
if (previousIndex >= 0) {
const previous = $("#recordsTable").find("input[type=checkbox]:eq(" + previousIndex + ")");
if (!$.isEmptyObject(previous))
previous.focus();
}
} else if (event.which === 40) {
// Arrow down
const nextIndex = $(event.target).parents("tr")[0].rowIndex + 1;
if (nextIndex <= viewModel.currentPageSize()) {
const next = $("#recordsTable").find("input[type=checkbox]:eq(" + nextIndex + ")");
if (!$.isEmptyObject(next))
next.focus();
}
}
});
}
function ExtendedViewModel() {
const self = this;
PagedViewModel.call(self);
self.selectedDevices = ko.observableArray().extend({ deferred: true });
self.addNewSelectedDevice = function(id, acronym, name) {
if (!self.selectedDevices().any(function(device) { return device.id === id })) {
self.selectedDevices.push({ id: id, acronym: acronym, name: name });
setTimeout(function () {
const container = $("#scrollableDevicesArea");
if (container) {
const row = $("#selectedDevices").parent().find("tr:last");
if (row)
container.scrollTop(row.position().top + row.height());
}
}, 100);
}
}
self.deleteSelectedDevice = function(device) {
self.selectedDevices.remove(device);
}
self.refreshSelectedDevices = function() {
self.selectedDevices.valueHasMutated();
}
self.clearSelectedDevices = function() {
const placeholder = $("#placeholder");
self.selectedDevices([]);
placeholder.empty();
$("#selectAllMessage").hide();
$("#selectAllCheckbox")[0].checked = false;
if (typeof selectPageRecords === "function")
selectPageRecords(false);
}
self.addNewSelectedDeviceByRecord = function(record) {
self.addNewSelectedDevice(record.ID, record.Acronym, record.Name);
}
self.deleteSelectedDeviceByRecord = function(record) {
self.selectedDevices().any(function(device) {
if (device.id === record.ID)
self.deleteSelectedDevice(device);
});
}
self.getSelectedDeviceIDs = function() {
var selectedDeviceIDs = [];
self.selectedDevices().forEach(function(device) {
selectedDeviceIDs.push(device.id);
});
return selectedDeviceIDs.join(",");
}
self.selectAllProgress = ko.observable("0%");
self.saveSelections = function(fileName) {
const data = JSON.stringify(self.selectedDevices(), null, 4);
const anchor = $("#saveSelectionsFileLink");
if (typeof anchor[0].download != "undefined") {
anchor.attr("href", "data:text/json;charset=utf-8," + encodeURIComponent(data));
anchor.attr("download", fileName);
anchor[0].click();
} else {
if (isIE)
window.navigator.msSaveBlob(new Blob([data]), fileName);
else
window.open("data:text/json;charset=utf-8," + encodeURIComponent(data), "_blank", "");
}
}
self.loadSelections = function(fileBlob) {
var reader = new FileReader();
reader.onload = function() {
self.clearSelectedDevices();
self.selectedDevices(JSON.parse(reader.result));
}
reader.onloadend = function() {
if (reader.error && reader.error.message)
showErrorMessage("Failed to load device selections: " + reader.error.message);
};
reader.readAsText(fileBlob);
}
}
function extendViewModel(event, data) {
const newViewModel = new ExtendedViewModel();
data.viewModel.cloneConfiguration(newViewModel);
data.viewModel = newViewModel;
}
$(window).on("beforeApplyBindings", extendViewModel);
</script>
}
@section Scripts {
<script>
"use strict";
@Raw(dataContext.RenderViewModelConfiguration<Device, DataHub>(ViewBag, "Acronym", null, Model.Global.NodeID))
function resizeScreenObjects() {
setTimeout(function() {
const selectedDevicesArea = $("#selectedDevicesArea");
selectedDevicesArea.height(calculateRemainingBodyHeight());
$("#scrollableDevicesArea").height(selectedDevicesArea.height() - $("#selectedDevicesHeader").outerHeight(true) - 5);
}, 100);
const selectedDevicesColumn = $("#selectedDevicesColumn");
const containerWidth = $("#bodyContainer").innerWidth();
if (selectedDevicesColumn.hasClass("in")) {
let areaWidth = containerWidth * 0.25;
if (areaWidth < 150)
areaWidth = 150;
selectedDevicesColumn.width(areaWidth);
}
}
function selectPageRecords(checked) {
for (let i = 0; i < viewModel.pageRecords().length; i++) {
const next = $("#recordsTable").find("input[type=checkbox]:eq(" + (i + 1) + ")");
if (!$.isEmptyObject(next)) {
if (next[0].checked !== checked)
next.click();
}
}
if (checked && viewModel.totalPages() > 1) {
$("#selectAllProgress").hide();
cancelSelectAllRecords();
$("#selectAllMessage").show();
}
}
var selectAllRecordsCanceled = false;
function cancelSelectAllRecords() {
selectAllRecordsCanceled = true;
}
function selectAllRecords() {
$("#selectAllMessage").hide();
$("#tabs").tabs({ active: 0 });
$("a[href='#tab1']").parent().focus();
if (!hubIsConnected)
return;
const totalPages = viewModel.totalPages();
const sortField = viewModel.sortField();
const sortAscending = viewModel.sortAscending();
const currentPageSize = viewModel.currentPageSize();
const filterText = viewModel.filterText;
selectAllRecordsCanceled = false;
viewModel.selectAllProgress("0%");
$("#selectAllProgressCancel").text("Cancel");
$("#selectAllProgress").show();
var page = 1;
var processedPages = 0;
function selectPageRecords() {
if (!hubIsConnected) {
$("#selectAllProgress").hide();
return;
}
viewModel.queryRecords(sortField, sortAscending, page, currentPageSize, filterText).done(function(records) {
if (!selectAllRecordsCanceled) {
records.forEach(function(record) {
viewModel.addNewSelectedDeviceByRecord(record);
return !selectAllRecordsCanceled;
});
}
viewModel.selectAllProgress(String.format("{0}%", (++processedPages / totalPages * 100).truncate()));
if (page === totalPages) {
$("#selectAllProgressCancel").text("Done!");
setTimeout(function() {
$("#selectAllProgress").hide();
}, 2000);
} else if (selectAllRecordsCanceled) {
$("#selectAllProgressCancel").text("Canceled!");
setTimeout(function() {
$("#selectAllProgress").hide();
}, 2000);
} else {
page++;
if (page <= totalPages)
selectPageRecords();
}
}).
fail(function(error) {
showErrorMessage(error);
if (page === totalPages)
$("#selectAllProgress").hide();
});
}
// Start page level record selection
selectPageRecords();
}
$("#bodyContainer").width("95%");
$(function () {
let initialLoad = true;
$("#selectedDevicesColumn").on("shown.bs.collapse", function() {
resizeScreenObjects();
});
$("#selectedDevicesColumn").on("hidden.bs.collapse", function() {
resizeScreenObjects();
});
$(viewModel).on("pageSizeCalculated", function() {
resizeScreenObjects();
});
$(viewModel).on("pageRecordsQueried", function() {
$("#selectAllMessage").hide();
});
$(window).resize(function () {
$("#bodyContainer").width("95%");
});
const selectAllCheckbox = $("#selectAllCheckbox");
selectAllCheckbox.click(function() {
selectPageRecords(selectAllCheckbox[0].checked);
});
selectAllCheckbox.keydown(function(event) {
if (event.which === 40) {
// Arrow down
if (viewModel.currentPageSize() > 0) {
const next = $("#recordsTable").find("input[type=checkbox]:eq(1)");
if (!$.isEmptyObject(next))
next.focus();
}
}
});
$(viewModel).on("pageRecordsQueried", function() {
selectAllCheckbox[0].checked = false;
});
ko.watch(viewModel.currentPage, function(parents, child, item) {
$("#selectAllMessage").hide();
});
// Setup save selections file name dialog functionality
$("#saveSelectionsFile").click(function() {
$("#saveSelectionsFileNameDialog").hide();
var fileName = notNull($("#inputSelectionsFileName").val());
if (fileName.length === 0)
fileName = "SelectedDevices.json";
if (!fileName.endsWith(".json"))
fileName += ".json";
viewModel.saveSelections(fileName);
});
// Make enter key auto-click save
$("#inputSelectionsFileName").keyup(function(event) {
if (event.keyCode === 13)
$("#saveSelectionsFile").click();
});
// Auto-select all text on focus
$("#inputSelectionsFileName").focus(function() {
$(this).select();
});
// Prevent default form submission when user presses enter
$("#saveSelectionsFileNameDialog").submit(function() {
return false;
});
// Auto-hide pop-up form when user clicks outside form area
$("#saveSelectionsFileNameDialog").focusout(function() {
if (!$("#saveSelectionsFileNameDialog").is(":hover") && !$("#showSaveSelectionsFileNameDialog").is(":hover"))
$("#saveSelectionsFileNameDialog").hide();
});
$(window).on("hubConnected", function() {
if (initialLoad) {
initialLoad = false;
dataHub.queryDeviceGroupDevices("@Model.Global.NodeID", @deviceGroupID).done(function(devices) {
devices.forEach(function(device) {
viewModel.addNewSelectedDeviceByRecord(device);
});
}).fail(function() {
initialLoad = true;
});
}
});
ko.watch(viewModel.selectedDevices, function(parents, child, item) {
if (viewModel.dataHubIsConnected()) {
dataHub.queryDeviceGroup("@Model.Global.NodeID", @deviceGroupID).done(function(deviceGroup) {
if (deviceGroup) {
deviceGroup.ConnectionString = "deviceIDs=" + viewModel.getSelectedDeviceIDs();
dataHub.updateDeviceGroup(deviceGroup).done(function() {
if (hubIsConnected)
serviceHub.sendCommand("ReloadConfig");
});
}
});
}
});
});
function showSaveSelectionsFileNameDialog() {
$("#saveSelectionsFileNameDialog").toggle();
if ($("#saveSelectionsFileNameDialog").is(":visible"))
$("#inputSelectionsFileName").focus();
}
function showLoadSelectionsFileNameDialog() {
$("#loadSelectionsFileName").trigger("click");
}
function loadSelectionsFile(event) {
viewModel.loadSelections(event.target.files[0]);
$("#loadSelectionsFileName").val("");
}
</script>
}
<span id="selectAllMessage" style="display: none">Selected <span data-bind="text: pageRecords().length"></span> devices on the current page, <a class="active" onclick="selectAllRecords()">click here</a> to select all <span data-bind="text: recordCount"></span> devices on all pages.</span>
<div class="input-group" id="selectAllProgress" style="display: none">
<span style="display: table-cell; font-size: small">Selecting Devices: </span>
<div class="progress" style="width: 180px; height: 22px">
<div class="progress-bar-info" id="selectAllProgressBar" role="progressbar" data-bind="style: { 'width': selectAllProgress }"><span data-bind="text: selectAllProgress">0%</span> Complete...</div>
</div>
<span class="input-group-btn">
<button class="btn btn-secondary" id="selectAllProgressCancel" type="button" onclick="cancelSelectAllRecords()">Cancel</button>
</span>
</div>
<table style="width: 100%">
<tr>
<td id="selectedDevicesColumn" style="width: 20%; vertical-align: top; padding-right: 3px" class="collapse in">
<div id="selectedDevicesArea" class="well" style="padding: 5px">
<div id="selectedDevicesHeader" class="clearfix">
Selected Devices <span data-bind="text: selectedDevices().length"></span><br/>
<button type="button" class="btn btn-sm" onclick="showSaveSelectionsFileNameDialog()" id="showSaveSelectionsFileNameDialog" data-bind="enable: selectedDevices().length > 0">Export</button>
<div class="well well-sm floating-form" id="saveSelectionsFileNameDialog" style="z-index: 1000">
<form class="form-inline" role="form">
<div class="form-group form-group-sm">
<button type="button" class="close" onclick="$('#saveSelectionsFileNameDialog').hide()" style="margin-top: -13px; margin-left: 8px">×</button>
<div class="input-group">
<input type="text" class="form-control" id="inputSelectionsFileName" placeholder="File name..." />
<span class="input-group-btn">
<button type="button" class="btn btn-default btn-sm" id="saveSelectionsFile" style="margin-right: -3px; font-weight: bold">Save</button>
</span>
</div>
</div>
</form>
</div>
<a href="#" id="saveSelectionsFileLink" target="_blank" style="display: none"></a>
<button type="button" class="btn btn-sm" onclick="showLoadSelectionsFileNameDialog()">Import</button>
<input id="loadSelectionsFileName" type="file" accept="text/json" style="position: fixed; top: -100em" onchange="loadSelectionsFile(event)">
<button type="button" class="btn btn-sm pull-right" data-bind="click: clearSelectedDevices.bind($data)">Clear All</button>
</div>
<div id="scrollableDevicesArea" style="overflow-x: hidden">
<table class="table table-striped table-bordered table-hover table-condensed">
<tbody id="selectedDevices" data-bind="foreach: selectedDevices">
<tr>
<td style="width: 95%" class="table-cell-hard-wrap">
<span class="fixed-font" data-bind="html: acronym + ': <small>' + name + '</small>', attr: { title: acronym }"></span>
</td>
<td style="width: 5%" class="text-center valign-middle"><button type="button" class="btn btn-xs" title="Unselect Device" data-bind="click: $parent.deleteSelectedDevice"><span class="glyphicon glyphicon-remove"></span></button></td>
</tr>
</tbody>
</table>
</div>
</div>
</td>
<td id="pagedViewColumn" style="width: 80%; vertical-align: top">
<button type="button" class="btn btn-xs btn-collapsable" id="collapseSelectedDevices" data-toggle="collapse" data-target="#selectedDevicesColumn"></button>
@Html.RenderResource("GSF.Web.Model.Views.PagedViewModel.cshtml")
</td>
</tr>
</table> | the_stack |
@{
ViewBag.Title = "App";
}
<div style="width:100%;height:100%">
<div class="panel-body" style="padding-bottom:0px;">
<div class="panel panel-default">
<div class="panel-heading">查询条件</div>
<div class="panel-body">
<form id="formSearch" class="form-horizontal">
<div class="form-group" style="margin-top:15px">
<label class="control-label col-sm-1" for="txt_app_Name">应用名</label>
<div class="col-sm-3">
<input type="text" class="form-control" id="txt_app_Name">
</div>
<div class="col-sm-4" style="text-align:left;">
<button type="button" style="margin-left:50px" id="btn_query" class="btn btn-primary">查询</button>
</div>
</div>
</form>
</div>
</div>
<div id="toolbar" class="btn-group">
<button id="btn_add" type="button" class="btn btn-default">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
</button>
<button id="btn_edit" type="button" class="btn btn-default">
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>修改
</button>
<button id="btn_delete" type="button" class="btn btn-default">
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>删除
</button>
</div>
<table id="tb_apps" style="height:15%"></table>
</div>
</div>
<form id="edit-form" class="form-inline">
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document" style="width:65%">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">新增</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label for="txt_appID">应用ID</label>
<input type="text" name="txt_appID" class="form-control has-feedback" id="txt_appID" placeholder="自动生成" disabled>
</div>
<div class="form-group">
<label for="txt_appName">应用名称</label>
<input type="text" name="txt_appName" class="form-control" id="txt_appName" placeholder="应用名称">
</div>
<div class="form-group">
<label for="txt_clientSecret">秘钥</label>
<input type="text" name="txt_clientSecret" class="form-control" id="txt_clientSecret" placeholder="秘钥">
</div>
<div class="form-group">
<label for="txt_returnUrl">应用地址</label>
<input type="text" name="txt_returnUrl" class="form-control" id="txt_returnUrl" placeholder="应用地址">
</div>
<div class="form-group">
<label> 是否可信</label>
<div class="checkbox">
<label>
<input id="ckb_isCredible" type="checkbox">
</label>
</div>
</div>
<div class="form-group" style="display:block">
<label for="txt_iconUrl"> 应用图标</label>
<div style="display:inline-block">
<input type="text" name="txt_iconUrl" class="form-control" id="txt_iconUrl" placeholder="图标" style="display:none">
<input type="file" name="file_iconUrl" class="file-loading" id="file_iconUrl" />
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span>关闭</button>
<button type="submit" id="btn_submit" class="btn btn-primary"><span class="glyphicon glyphicon-floppy-disk"></span>保存</button>
</div>
</div>
</div>
</div>
</form>
<style>
.form-group {
padding: 3px;
}
.form-group > label {
width: 85px;
text-align: right;
}
.form-group > input {
padding-right: 42.5px;
}
.panel {
margin-bottom: 5px;
}
.panel-body {
padding: 5px;
}
</style>
@section scripts
{
<script type="text/javascript">
$(function () {
//1.初始化Table
var oTable = new TableInit();
oTable.Init();
//2.初始化Button的点击事件
var oButtonInit = new ButtonInit();
oButtonInit.Init();
InitForm();
var oFileInput = new FileInput();
oFileInput.Init("file_iconUrl", "/App/ImportIconImage");
});
var TableInit = function () {
var oTableInit = new Object();
//初始化Table
oTableInit.Init = function () {
function iconUrlFormatter(value) {
if (value) {
var imageurl = ImageBaseUrl + value;
return "<img src='" + imageurl + "' height='32' width='32' class='file-preview-image' alt='应用图片' title='应用图片'>";
}
return value;
};
$('#tb_apps').bootstrapTable({
url: '/App/Query', //请求后台的URL(*)
method: 'post', //请求方式(*)
toolbar: '#toolbar', //工具按钮用哪个容器
striped: true, //是否显示行间隔色
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
pagination: true, //是否显示分页(*)
sortable: false, //是否启用排序
sortOrder: "asc", //排序方式
queryParams: oTableInit.queryParams,//传递参数(*)
responseHandler: function (res) { return res.Data; },
sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
pageNumber: 1, //初始化加载第一页,默认第一页
pageSize: 10, //每页的记录行数(*)
pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
strictSearch: true,
showColumns: true, //是否显示所有的列
showRefresh: true, //是否显示刷新按钮
minimumCountColumns: 2, //最少允许的列数
clickToSelect: true, //是否启用点击选中行
height: 400, //行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度
uniqueId: "ID", //每一行的唯一标识,一般为主键列
showToggle: true, //是否显示详细视图和列表视图的切换按钮
cardView: false, //是否显示详细视图
detailView: false, //是否显示父子表
columns: [{
checkbox: true
}, {
field: 'ClientID',
title: '应用ID'
}, {
field: 'Name',
title: '应用名称'
}, {
field: 'ClientSecret',
title: '秘钥'
}, {
field: 'ReturnUrl',
title: '应用地址'
}, {
field: 'IsCredible',
title: '可信'
}, {
formatter: iconUrlFormatter,
field: 'IconUrl',
title: '图标'
}, {
field: 'CreatedOn',
title: '创建时间'
}, {
field: 'CreatedBy',
title: '创建人'
}, {
field: 'LastUpdatedOn',
title: '最后更新时间'
}, {
field: 'LastUpdatedBy',
title: '最后更新人'
}]
});
};
//得到查询的参数
oTableInit.queryParams = function (params) {
var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
Limit: params.limit, //页面大小
Offset: (params.offset), //页码
Name: $("#txt_app_Name").val()
};
return temp;
};
return oTableInit;
};
var ButtonInit = function () {
var oInit = new Object();
oInit.Init = function () {
//新增数据click事件注册
$("#btn_add").click(function () {
$("#myModalLabel").text("新增");
$("#myModal").find(".form-control").val("");
$("#ckb_isCredible").prop("checked", false);
InitForm({ isCreate: true, ID: '' });
$('#file_iconUrl').fileinput('clear');
$('#myModal').modal();
});
//编辑数据click事件注册
$("#btn_edit").click(function () {
var arrselections = $("#tb_apps").bootstrapTable('getSelections');
if (arrselections.length > 1) {
toastr.warning('只能选择一行进行编辑');
return;
}
if (arrselections.length <= 0) {
toastr.warning('请选择有效数据');
return;
}
$("#myModalLabel").text("编辑");
$("#txt_appID").val(arrselections[0].ClientID);
$("#txt_appName").val(arrselections[0].Name);
$("#txt_clientSecret").val(arrselections[0].ClientSecret);
$("#txt_returnUrl").val(arrselections[0].ReturnUrl);
$("#txt_iconUrl").val(arrselections[0].IconUrl);
$("#ckb_isCredible").prop("checked", arrselections[0].IsCredible);
InitForm({ isCreate: false, ID: arrselections[0].ID });
$('#file_iconUrl').fileinput('clear');
if (arrselections[0].IconUrl && arrselections[0].IconUrl.length > 3) {
var control = $("#file_iconUrl");
var imageurl = ImageBaseUrl + arrselections[0].IconUrl;
//重要,需要更新控件的附加参数内容,以及图片初始化显示
control.fileinput('refresh', {
uploadExtraData: { ID: arrselections[0].ID },
initialPreview: [ //预览图片的设置
"<img src='" + imageurl + "' class='file-preview-image' alt='应用图片' title='应用图片'>",
],
});
}
$('#myModal').modal();
});
//删除数据click事件注册
$("#btn_delete").click(function () {
var arrselections = $("#tb_apps").bootstrapTable('getSelections');
if (arrselections.length <= 0) {
toastr.warning('请选择有效数据');
return;
}
Ewin.confirm({ message: "确认要删除选择的数据吗?" }).on(function (e) {
if (!e) {
return;
}
$.ajax({
type: "post",
url: "/App/Delete",
data: { ids: $.Enumerable.From(arrselections).Select('$.ID').ToArray() },
success: function (data, status) {
if (status == "success") {
toastr.success('提交数据成功');
$("#tb_apps").bootstrapTable('refresh');
}
},
dataType: "json",
error: function () {
toastr.error('Error');
},
complete: function () {
}
});
});
});
//条件查询click事件注册
$("#btn_query").click(function () {
$("#tb_apps").bootstrapTable('refresh');
});
};
return oInit;
};
var isCreate, postdata = {};
var InitForm = function (args) {
var editForm = $("#edit-form").data('bootstrapValidator');
if (editForm) {
isCreate = args.isCreate;
postdata.ID = args.ID;
editForm.resetForm();
return;
}
$('#edit-form').bootstrapValidator({
message: 'This value is not valid',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
submitHandler: function (validator, form, submitButton) {
postdata.Name = $("#txt_appName").val();
postdata.ClientSecret = $("#txt_clientSecret").val();
postdata.ReturnUrl = $("#txt_returnUrl").val();
postdata.IsCredible = $("#ckb_isCredible").prop("checked");
postdata.IconUrl = $("#txt_iconUrl").val();
$.ajax({
type: "post",
url: isCreate ? "/App/Create" : "/App/Edit",
data: postdata,
//contentType: "application/json; charset=utf-8",
//dataType: "json",
success: function (data, status) {
if (status == "success") {
toastr.success('提交数据成功');
$('#myModal').modal('hide');
$("#tb_apps").bootstrapTable('refresh');
}
},
error: function () {
toastr.error('Error');
},
complete: function () {
}
});
},
fields: {
txt_appName: {
validators: {
notEmpty: {
message: 'The app name is required'
}
}
},
txt_clientSecret: {
validators: {
notEmpty: {
message: 'The client secret is required'
}
}
}
//,txt_returnUrl: {
// validators: {
// notEmpty: {
// message: 'The returnUrl is required'
// },
// uri: {
// message: 'The returnUrl is uri'
// }
// }
//}
}
});
}
//初始化fileinput
var FileInput = function () {
var oFile = new Object();
//初始化fileinput控件(第一次初始化)
oFile.Init = function (ctrlName, uploadUrl) {
var control = $('#' + ctrlName);
//初始化上传控件的样式
control.fileinput({
language: 'zh', //设置语言
uploadUrl: uploadUrl, //上传的地址
allowedFileExtensions: ['jpg', 'gif', 'png'],//接收的文件后缀
showCaption: false,//是否显示标题
zoomModalHeight: 220,
maxFileCount: 1,
dropZoneEnabled: false//是否显示拖拽区域
//minImageWidth: 50, //图片的最小宽度
//minImageHeight: 50,//图片的最小高度
//maxImageWidth: 1000,//图片的最大宽度
//maxImageHeight: 1000,//图片的最大高度
//maxFileSize: 0,//单位为kb,如果为0表示不限制文件大小
//minFileCount: 0,
});
//导入文件上传完成之后的事件
$("#" + ctrlName).on("fileuploaded", function (event, data, previewId, index) {
var response = data.response;
var result = response.Success;
if (result) {
$("#txt_iconUrl").val(response.Data.Path);
toastr.info('上传成功');
return;
}
else {
toastr.error('上传失败:' + response.Message);
return;
}
});
}
return oFile;
};
</script>
} | the_stack |
@page
@model MarketingDashboardModel
@{
ViewData["Title"] = "Marketing Dashboard";
ViewData["PageName"] = "intel_marketing_dashboard";
ViewData["Category1"] = "Application Intel";
ViewData["Heading"] = "<i class='subheader-icon fal fa-chart-area'></i> Marketing <span class='fw-300'>Dashboard</span>";
}
@section HeadBlock {
<link rel="stylesheet" media="screen, print" href="~/css/datagrid/datatables/datatables.bundle.css">
}
@section SubheaderBlock {
<div class="subheader-block d-lg-flex align-items-center">
<div class="d-flex mr-4">
<div class="mr-2">
<span class="peity-donut" data-peity="{ "fill": ["#967bbd", "#ccbfdf"], "innerRadius": 14, "radius": 20 }">7/10</span>
</div>
<div>
<label class="fs-sm mb-0 mt-2 mt-md-0">New Sessions</label>
<h4 class="font-weight-bold mb-0">70.60%</h4>
</div>
</div>
<div class="d-flex mr-0">
<div class="mr-2">
<span class="peity-donut" data-peity="{ "fill": ["#2196F3", "#9acffa"], "innerRadius": 14, "radius": 20 }">3/10</span>
</div>
<div>
<label class="fs-sm mb-0 mt-2 mt-md-0">Page Views</label>
<h4 class="font-weight-bold mb-0">14,134</h4>
</div>
</div>
</div>
}
<div class="row">
<div class="col-sm-6 col-xl-3">
<div class="p-3 bg-primary-300 rounded overflow-hidden position-relative text-white mb-g">
<div class="">
<h3 class="display-4 d-block l-h-n m-0 fw-500">
21.5k
<small class="m-0 l-h-n">users signed up</small>
</h3>
</div>
<i class="@(Settings.Theme.IconPrefix) fa-user position-absolute pos-right pos-bottom opacity-15 mb-n1 mr-n1" style="font-size:6rem"></i>
</div>
</div>
<div class="col-sm-6 col-xl-3">
<div class="p-3 bg-warning-400 rounded overflow-hidden position-relative text-white mb-g">
<div class="">
<h3 class="display-4 d-block l-h-n m-0 fw-500">
$10,203
<small class="m-0 l-h-n">Visual Index Figure</small>
</h3>
</div>
<i class="@(Settings.Theme.IconPrefix) fa-gem position-absolute pos-right pos-bottom opacity-15 mb-n1 mr-n4" style="font-size: 6rem;"></i>
</div>
</div>
<div class="col-sm-6 col-xl-3">
<div class="p-3 bg-success-200 rounded overflow-hidden position-relative text-white mb-g">
<div class="">
<h3 class="display-4 d-block l-h-n m-0 fw-500">
- 103.72
<small class="m-0 l-h-n">Offset Balance Ratio</small>
</h3>
</div>
<i class="@(Settings.Theme.IconPrefix) fa-lightbulb position-absolute pos-right pos-bottom opacity-15 mb-n5 mr-n6" style="font-size: 8rem;"></i>
</div>
</div>
<div class="col-sm-6 col-xl-3">
<div class="p-3 bg-info-200 rounded overflow-hidden position-relative text-white mb-g">
<div class="">
<h3 class="display-4 d-block l-h-n m-0 fw-500">
+40%
<small class="m-0 l-h-n">Product level increase</small>
</h3>
</div>
<i class="@(Settings.Theme.IconPrefix) fa-globe position-absolute pos-right pos-bottom opacity-15 mb-n1 mr-n4" style="font-size: 6rem;"></i>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div id="panel-1" class="panel">
<div class="panel-hdr">
<h2>
Marketing profits
</h2>
</div>
<div class="panel-container show">
<div class="panel-content bg-subtlelight-fade">
<div id="js-checkbox-toggles" class="d-flex mb-3">
<div class="custom-control custom-switch mr-2">
<input type="checkbox" class="custom-control-input" name="gra-0" id="gra-0" checked="checked">
<label class="custom-control-label" for="gra-0">Target Profit</label>
</div>
<div class="custom-control custom-switch mr-2">
<input type="checkbox" class="custom-control-input" name="gra-1" id="gra-1" checked="checked">
<label class="custom-control-label" for="gra-1">Actual Profit</label>
</div>
<div class="custom-control custom-switch mr-2">
<input type="checkbox" class="custom-control-input" name="gra-2" id="gra-2" checked="checked">
<label class="custom-control-label" for="gra-2">User Signups</label>
</div>
</div>
<div id="flot-toggles" class="w-100 mt-4" style="height: 300px"></div>
</div>
</div>
</div>
</div>
<div class="col-lg-6">
<div id="panel-2" class="panel panel-locked" data-panel-sortable data-panel-collapsed data-panel-close>
<div class="panel-hdr">
<h2>
Returning <span class="fw-300"><i>Target</i></span>
</h2>
</div>
<div class="panel-container show">
<div class="panel-content poisition-relative">
<div class="p-1 position-absolute pos-right pos-top mt-3 mr-3 z-index-cloud d-flex align-items-center justify-content-center">
<div class="border-faded border-top-0 border-left-0 border-bottom-0 py-2 pr-4 mr-3 hidden-sm-down">
<div class="text-right fw-500 l-h-n d-flex flex-column">
<div class="h3 m-0 d-flex align-items-center justify-content-end">
<div class='icon-stack mr-2'>
<i class="base base-7 icon-stack-3x opacity-100 color-success-600"></i>
<i class="base base-7 icon-stack-2x opacity-100 color-success-500"></i>
<i class="@(Settings.Theme.IconPrefix) fa-arrow-up icon-stack-1x opacity-100 color-white"></i>
</div>
$44.34 / GE
</div>
<span class="m-0 fs-xs text-muted">Increased Profit as per redux margins and estimates</span>
</div>
</div>
<div class="js-easy-pie-chart color-info-400 position-relative d-inline-flex align-items-center justify-content-center" data-percent="35" data-piesize="95" data-linewidth="10" data-scalelength="5">
<div class="js-easy-pie-chart color-success-400 position-relative position-absolute pos-left pos-right pos-top pos-bottom d-flex align-items-center justify-content-center" data-percent="65" data-piesize="60" data-linewidth="5" data-scalelength="1" data-scalecolor="#fff">
<div class="position-absolute pos-top pos-left pos-right pos-bottom d-flex align-items-center justify-content-center fw-500 fs-xl text-dark">78%</div>
</div>
</div>
</div>
<div id="flot-area" style="width:100%; height:300px;"></div>
</div>
</div>
</div>
</div>
<div class="col-lg-6">
<div id="panel-3" class="panel panel-locked" data-panel-sortable data-panel-collapsed data-panel-close>
<div class="panel-hdr">
<h2>
Effective <span class="fw-300"><i>Marketing</i></span>
</h2>
</div>
<div class="panel-container show">
<div class="panel-content poisition-relative">
<div class="pb-5 pt-3">
<div class="row">
<div class="col-6 col-xl-3 d-sm-flex align-items-center">
<div class="p-2 mr-3 bg-info-200 rounded">
<span class="peity-bar" data-peity="{"fill": ["#fff"], "width": 27, "height": 27 }">3,4,5,8,2</span>
</div>
<div>
<label class="fs-sm mb-0">Bounce Rate</label>
<h4 class="font-weight-bold mb-0">37.56%</h4>
</div>
</div>
<div class="col-6 col-xl-3 d-sm-flex align-items-center">
<div class="p-2 mr-3 bg-info-300 rounded">
<span class="peity-bar" data-peity="{"fill": ["#fff"], "width": 27, "height": 27 }">5,3,1,7,9</span>
</div>
<div>
<label class="fs-sm mb-0">Sessions</label>
<h4 class="font-weight-bold mb-0">759</h4>
</div>
</div>
<div class="col-6 col-xl-3 d-sm-flex align-items-center">
<div class="p-2 mr-3 bg-success-300 rounded">
<span class="peity-bar" data-peity="{"fill": ["#fff"], "width": 27, "height": 27 }">3,4,3,5,5</span>
</div>
<div>
<label class="fs-sm mb-0">New Sessions</label>
<h4 class="font-weight-bold mb-0">12.17%</h4>
</div>
</div>
<div class="col-6 col-xl-3 d-sm-flex align-items-center">
<div class="p-2 mr-3 bg-success-500 rounded">
<span class="peity-bar" data-peity="{"fill": ["#fff"], "width": 27, "height": 27 }">6,4,7,5,6</span>
</div>
<div>
<label class="fs-sm mb-0">Clickthrough</label>
<h4 class="font-weight-bold mb-0">19.77%</h4>
</div>
</div>
</div>
</div>
<div id="flotVisit" style="width:100%; height:208px;"></div>
</div>
</div>
</div>
</div>
<div class="col-lg-12">
<div id="panel-4" class="panel">
<div class="panel-hdr">
<h2>
Sale <span class="fw-300"><i>Records</i></span>
</h2>
</div>
<div class="panel-container show">
<div class="panel-content">
<table id="dt-basic-example" class="table table-bordered table-hover table-striped w-100">
<thead class="bg-warning-200">
<tr>
<th>CustomerID</th>
<th>Name</th>
<th>PurchaseDate</th>
<th>CustomerEmail</th>
<th>CustomerCVV</th>
<th>Country</th>
<th>InvoiceAmount</th>
<th>Controls</th>
</tr>
</thead>
<tbody>
<tr>
<td>268410636</td>
<td>Cooley, Walker J.</td>
<td>03-13-19</td>
<td>odio.auctor@@orcilobortis.edu</td>
<td>717</td>
<td>Timor-Leste</td>
<td>$7,007</td>
<td>1</td>
</tr>
<tr>
<td>077610947</td>
<td>Wise, Ruby R.</td>
<td>04-10-19</td>
<td>mi.Aliquam@@afeugiat.edu</td>
<td>715</td>
<td>Burkina Faso</td>
<td>$7,052</td>
<td>1</td>
</tr>
<tr>
<td>959104621</td>
<td>Orr, Isabella V.</td>
<td>05-14-20</td>
<td>amet.lorem@@risus.edu</td>
<td>256</td>
<td>Sri Lanka</td>
<td>$6,697</td>
<td>1</td>
</tr>
<tr>
<td>756590147</td>
<td>Schwartz, Xander P.</td>
<td>11-05-18</td>
<td>sagittis.placerat.Cras@@nonlaciniaat.com</td>
<td>963</td>
<td>Liberia</td>
<td>$8,117</td>
<td>1</td>
</tr>
<tr>
<td>533801387</td>
<td>Gilmore, Cedric O.</td>
<td>01-16-20</td>
<td>consectetuer.adipiscing@@semegestasblandit.co.uk</td>
<td>754</td>
<td>Svalbard and Jan Mayen Islands</td>
<td>$5,328</td>
<td>1</td>
</tr>
<tr>
<td>403080948</td>
<td>Foley, Cynthia M.</td>
<td>07-14-18</td>
<td>a.auctor.non@@nuncrisus.net</td>
<td>826</td>
<td>Afghanistan</td>
<td>$6,823</td>
<td>1</td>
</tr>
<tr>
<td>114290869</td>
<td>Marshall, Carter V.</td>
<td>08-30-18</td>
<td>porttitor.interdum@@dolordolortempus.com</td>
<td>256</td>
<td>Singapore</td>
<td>$6,679</td>
<td>1</td>
</tr>
<tr>
<td>033182882</td>
<td>Reilly, Jacob K.</td>
<td>09-19-18</td>
<td>vestibulum.lorem@@adipiscing.ca</td>
<td>703</td>
<td>Chile</td>
<td>$5,252</td>
<td>1</td>
</tr>
<tr>
<td>471026559</td>
<td>Barlow, Jena S.</td>
<td>12-16-19</td>
<td>mollis@@lacusUtnec.org</td>
<td>998</td>
<td>Botswana</td>
<td>$5,542</td>
<td>1</td>
</tr>
<tr>
<td>223467911</td>
<td>Huber, Warren Z.</td>
<td>05-30-20</td>
<td>Nulla@@ipsumdolorsit.edu</td>
<td>127</td>
<td>Equatorial Guinea</td>
<td>$7,331</td>
<td>1</td>
</tr>
<tr>
<td>571295351</td>
<td>Miller, Emerald G.</td>
<td>11-08-19</td>
<td>dui@@faucibus.co.uk</td>
<td>791</td>
<td>Chile</td>
<td>$8,318</td>
<td>1</td>
</tr>
<tr>
<td>314268756</td>
<td>Randolph, Ina Y.</td>
<td>04-20-19</td>
<td>sodales.Mauris@@pharetraNamac.ca</td>
<td>272</td>
<td>Bermuda</td>
<td>$9,181</td>
<td>1</td>
</tr>
<tr>
<td>010785095</td>
<td>Stephens, Brady K.</td>
<td>04-18-19</td>
<td>Suspendisse.sed.dolor@@elementumdui.edu</td>
<td>810</td>
<td>Mayotte</td>
<td>$8,253</td>
<td>1</td>
</tr>
<tr>
<td>522462928</td>
<td>Eaton, Cathleen M.</td>
<td>03-18-20</td>
<td>rhoncus@@tincidunt.com</td>
<td>238</td>
<td>Belgium</td>
<td>$5,585</td>
<td>1</td>
</tr>
<tr>
<td>833601081</td>
<td>Conner, Wylie U.</td>
<td>09-07-18</td>
<td>diam@@infaucibus.edu</td>
<td>917</td>
<td>Hong Kong</td>
<td>$6,687</td>
<td>1</td>
</tr>
<tr>
<td>462938945</td>
<td>Mccall, Hyacinth M.</td>
<td>06-22-19</td>
<td>ante@@gravida.com</td>
<td>335</td>
<td>Mayotte</td>
<td>$5,419</td>
<td>1</td>
</tr>
<tr>
<td>465431336</td>
<td>Calderon, Bruno L.</td>
<td>06-22-19</td>
<td>enim.nisl@@natoquepenatibus.com</td>
<td>449</td>
<td>Pitcairn Islands</td>
<td>$7,833</td>
<td>1</td>
</tr>
<tr>
<td>700402324</td>
<td>Barnes, Brittany O.</td>
<td>08-23-19</td>
<td>nonummy@@massanon.org</td>
<td>200</td>
<td>Jordan</td>
<td>$9,673</td>
<td>1</td>
</tr>
<tr>
<td>999816267</td>
<td>Lambert, Nerea A.</td>
<td>04-01-20</td>
<td>interdum.libero@@sed.com</td>
<td>347</td>
<td>Hong Kong</td>
<td>$5,805</td>
<td>1</td>
</tr>
<tr>
<td>230094773</td>
<td>Hartman, Murphy I.</td>
<td>02-19-19</td>
<td>Aenean.sed.pede@@utodio.ca</td>
<td>120</td>
<td>Equatorial Guinea</td>
<td>$5,785</td>
<td>1</td>
</tr>
<tr>
<td>656291846</td>
<td>Hartman, Griffin I.</td>
<td>09-04-19</td>
<td>diam@@tellusNunc.com</td>
<td>369</td>
<td>Suriname</td>
<td>$6,885</td>
<td>1</td>
</tr>
<tr>
<td>667672315</td>
<td>Buchanan, Jack N.</td>
<td>09-19-19</td>
<td>odio.vel.est@@quam.co.uk</td>
<td>394</td>
<td>India</td>
<td>$6,480</td>
<td>1</td>
</tr>
<tr>
<td>895637221</td>
<td>Holloway, Molly T.</td>
<td>12-04-19</td>
<td>Aliquam.gravida.mauris@@acnullaIn.net</td>
<td>978</td>
<td>Qatar</td>
<td>$7,940</td>
<td>1</td>
</tr>
<tr>
<td>582511127</td>
<td>Pacheco, Nicholas Q.</td>
<td>12-17-19</td>
<td>aliquam.enim.nec@@eros.edu</td>
<td>860</td>
<td>Botswana</td>
<td>$9,291</td>
<td>1</td>
</tr>
<tr>
<td>473206092</td>
<td>Woods, Lucian Y.</td>
<td>04-04-20</td>
<td>ac@@bibendumsedest.co.uk</td>
<td>267</td>
<td>Reunion</td>
<td>$6,514</td>
<td>1</td>
</tr>
<tr>
<td>058837337</td>
<td>Shelton, Benedict Q.</td>
<td>08-18-18</td>
<td>Suspendisse.non@@convallisligulaDonec.net</td>
<td>556</td>
<td>Senegal</td>
<td>$5,960</td>
<td>1</td>
</tr>
<tr>
<td>435186291</td>
<td>Mcmahon, Zephania V.</td>
<td>03-20-19</td>
<td>commodo@@viverra.ca</td>
<td>313</td>
<td>Estonia</td>
<td>$9,119</td>
<td>1</td>
</tr>
<tr>
<td>290955491</td>
<td>Bryant, Paloma S.</td>
<td>08-09-18</td>
<td>tellus.id.nunc@@nonlorem.com</td>
<td>564</td>
<td>Belarus</td>
<td>$7,675</td>
<td>1</td>
</tr>
<tr>
<td>960011146</td>
<td>Sutton, Dominique R.</td>
<td>03-31-19</td>
<td>nisi.magna.sed@@ipsumsodales.co.uk</td>
<td>517</td>
<td>Central African Republic</td>
<td>$5,836</td>
<td>1</td>
</tr>
<tr>
<td>332794726</td>
<td>Whitehead, Amal R.</td>
<td>05-02-20</td>
<td>ultricies.adipiscing@@insodales.edu</td>
<td>450</td>
<td>Equatorial Guinea</td>
<td>$5,351</td>
<td>1</td>
</tr>
<tr>
<td>270594724</td>
<td>Hopkins, Taylor I.</td>
<td>05-03-20</td>
<td>neque.venenatis@@tristique.net</td>
<td>509</td>
<td>Uzbekistan</td>
<td>$5,373</td>
<td>1</td>
</tr>
<tr>
<td>062276811</td>
<td>Dalton, Ursula I.</td>
<td>05-23-19</td>
<td>sit.amet.consectetuer@@Fusce.org</td>
<td>235</td>
<td>Grenada</td>
<td>$8,587</td>
<td>1</td>
</tr>
<tr>
<td>475988143</td>
<td>Velasquez, Harper B.</td>
<td>05-03-20</td>
<td>et.ultrices@@Proinvel.ca</td>
<td>166</td>
<td>Cuba</td>
<td>$5,844</td>
<td>1</td>
</tr>
<tr>
<td>959744004</td>
<td>Flowers, Jackson U.</td>
<td>10-06-19</td>
<td>Cras.pellentesque@@interdum.edu</td>
<td>654</td>
<td>Tokelau</td>
<td>$8,953</td>
<td>1</td>
</tr>
<tr>
<td>461623134</td>
<td>Massey, Mercedes R.</td>
<td>05-22-20</td>
<td>Suspendisse.tristique.neque@@Praesentinterdum.com</td>
<td>199</td>
<td>Bahamas</td>
<td>$7,332</td>
<td>1</td>
</tr>
<tr>
<td>197211170</td>
<td>Barrera, Ulysses V.</td>
<td>02-17-19</td>
<td>leo.in@@duiaugueeu.com</td>
<td>809</td>
<td>Spain</td>
<td>$9,416</td>
<td>1</td>
</tr>
<tr>
<td>918682220</td>
<td>Wilder, Sophia L.</td>
<td>03-06-19</td>
<td>et@@mienim.net</td>
<td>480</td>
<td>Congo, the Democratic Republic of the</td>
<td>$5,571</td>
<td>1</td>
</tr>
<tr>
<td>268276169</td>
<td>Lott, Tucker E.</td>
<td>02-03-19</td>
<td>pede.ultrices.a@@pharetra.org</td>
<td>344</td>
<td>Congo, the Democratic Republic of the</td>
<td>$7,563</td>
<td>1</td>
</tr>
<tr>
<td>690297924</td>
<td>Morse, Alyssa G.</td>
<td>11-27-19</td>
<td>sed.sem@@Aliquamauctor.edu</td>
<td>513</td>
<td>Malta</td>
<td>$8,768</td>
<td>1</td>
</tr>
<tr>
<td>591331798</td>
<td>Kemp, Darrel H.</td>
<td>04-17-20</td>
<td>nunc.ac.mattis@@facilisisSuspendissecommodo.co.uk</td>
<td>479</td>
<td>Papua New Guinea</td>
<td>$7,197</td>
<td>1</td>
</tr>
<tr>
<td>186475257</td>
<td>Madden, Keaton R.</td>
<td>04-27-20</td>
<td>lectus@@convallisconvallis.net</td>
<td>361</td>
<td>Serbia</td>
<td>$9,904</td>
<td>1</td>
</tr>
<tr>
<td>510961618</td>
<td>Chaney, Brynne H.</td>
<td>10-23-19</td>
<td>Aliquam@@venenatisamagna.edu</td>
<td>305</td>
<td>Indonesia</td>
<td>$6,660</td>
<td>1</td>
</tr>
<tr>
<td>543494850</td>
<td>Carroll, Alexis S.</td>
<td>07-07-19</td>
<td>erat.eget@@tincidunt.org</td>
<td>640</td>
<td>Falkland Islands</td>
<td>$9,617</td>
<td>1</td>
</tr>
<tr>
<td>304655673</td>
<td>Key, Chase F.</td>
<td>03-09-19</td>
<td>lectus@@convallisconvallisdolor.edu</td>
<td>171</td>
<td>Cyprus</td>
<td>$8,533</td>
<td>1</td>
</tr>
<tr>
<td>462690355</td>
<td>Douglas, Sebastian Z.</td>
<td>03-16-19</td>
<td>scelerisque.neque@@utlacus.com</td>
<td>432</td>
<td>Guyana</td>
<td>$6,932</td>
<td>1</td>
</tr>
<tr>
<td>156043267</td>
<td>Spence, Gillian K.</td>
<td>09-03-18</td>
<td>pellentesque.eget@@Fusce.org</td>
<td>557</td>
<td>Christmas Island</td>
<td>$9,081</td>
<td>1</td>
</tr>
<tr>
<td>163510126</td>
<td>Hill, Ingrid N.</td>
<td>02-01-20</td>
<td>pede.nec.ante@@pellentesque.edu</td>
<td>395</td>
<td>French Guiana</td>
<td>$8,552</td>
<td>1</td>
</tr>
<tr>
<td>622838605</td>
<td>Larson, Matthew C.</td>
<td>05-09-20</td>
<td>consequat@@vitaeeratvel.net</td>
<td>771</td>
<td>Rwanda</td>
<td>$6,559</td>
<td>1</td>
</tr>
<tr>
<td>916243272</td>
<td>Wagner, Xerxes X.</td>
<td>07-19-18</td>
<td>erat@@egestaslaciniaSed.org</td>
<td>647</td>
<td>Oman</td>
<td>$8,061</td>
<td>1</td>
</tr>
<tr>
<td>218462067</td>
<td>Yang, Savannah M.</td>
<td>08-10-18</td>
<td>lacinia.at@@Morbiaccumsan.co.uk</td>
<td>632</td>
<td>China</td>
<td>$6,029</td>
<td>1</td>
</tr>
<tr>
<td>641016894</td>
<td>Blankenship, Silas Y.</td>
<td>10-08-19</td>
<td>tristique.aliquet.Phasellus@@habitant.edu</td>
<td>780</td>
<td>Indonesia</td>
<td>$8,447</td>
<td>1</td>
</tr>
<tr>
<td>736823352</td>
<td>Schneider, Kamal E.</td>
<td>02-11-20</td>
<td>nec.leo.Morbi@@liberoet.com</td>
<td>905</td>
<td>Hungary</td>
<td>$6,009</td>
<td>1</td>
</tr>
<tr>
<td>014625222</td>
<td>Goodwin, Carol T.</td>
<td>05-20-19</td>
<td>luctus@@tortordictum.com</td>
<td>915</td>
<td>Saint Barthélemy</td>
<td>$7,961</td>
<td>1</td>
</tr>
<tr>
<td>665870531</td>
<td>Sargent, Rogan I.</td>
<td>11-08-19</td>
<td>non.sollicitudin.a@@elitelitfermentum.org</td>
<td>759</td>
<td>Jordan</td>
<td>$7,840</td>
<td>1</td>
</tr>
<tr>
<td>341513158</td>
<td>Mendez, Alfonso Z.</td>
<td>08-14-19</td>
<td>Vestibulum.ante@@sem.edu</td>
<td>766</td>
<td>Falkland Islands</td>
<td>$7,280</td>
<td>1</td>
</tr>
<tr>
<td>746815364</td>
<td>Deleon, Rachel C.</td>
<td>02-16-20</td>
<td>nisl@@semperpretium.edu</td>
<td>183</td>
<td>Peru</td>
<td>$6,726</td>
<td>1</td>
</tr>
<tr>
<td>273111385</td>
<td>Hopper, Tobias W.</td>
<td>05-17-20</td>
<td>convallis@@eratneque.edu</td>
<td>315</td>
<td>Cook Islands</td>
<td>$6,870</td>
<td>1</td>
</tr>
<tr>
<td>025589813</td>
<td>Richmond, Dolan H.</td>
<td>07-20-19</td>
<td>fringilla@@liberoduinec.co.uk</td>
<td>969</td>
<td>American Samoa</td>
<td>$8,530</td>
<td>1</td>
</tr>
<tr>
<td>318399474</td>
<td>Nunez, Thane P.</td>
<td>10-17-19</td>
<td>consequat.lectus@@nunc.org</td>
<td>636</td>
<td>Sweden</td>
<td>$5,656</td>
<td>1</td>
</tr>
<tr>
<td>945440014</td>
<td>Rosario, Kenneth D.</td>
<td>04-07-19</td>
<td>in.molestie@@dolorelit.net</td>
<td>722</td>
<td>Puerto Rico</td>
<td>$6,326</td>
<td>1</td>
</tr>
<tr>
<td>044328789</td>
<td>Chen, Sharon W.</td>
<td>01-24-19</td>
<td>imperdiet.ornare@@augue.co.uk</td>
<td>419</td>
<td>Lesotho</td>
<td>$7,406</td>
<td>1</td>
</tr>
<tr>
<td>348706227</td>
<td>Kennedy, Garth B.</td>
<td>08-20-18</td>
<td>Donec.feugiat@@adipiscing.edu</td>
<td>145</td>
<td>Palestine, State of</td>
<td>$6,961</td>
<td>1</td>
</tr>
<tr>
<td>706217387</td>
<td>Barton, Paki W.</td>
<td>03-13-20</td>
<td>at.velit.Pellentesque@@Suspendisse.ca</td>
<td>847</td>
<td>Sao Tome and Principe</td>
<td>$8,342</td>
<td>1</td>
</tr>
<tr>
<td>570593442</td>
<td>Reed, Adria M.</td>
<td>08-25-18</td>
<td>feugiat@@justonec.co.uk</td>
<td>474</td>
<td>Cyprus</td>
<td>$7,680</td>
<td>1</td>
</tr>
<tr>
<td>308696228</td>
<td>Patton, Blaine M.</td>
<td>10-05-19</td>
<td>elementum@@auctorvelit.org</td>
<td>689</td>
<td>Bermuda</td>
<td>$8,421</td>
<td>1</td>
</tr>
<tr>
<td>225437920</td>
<td>Malone, Serina K.</td>
<td>12-20-19</td>
<td>interdum.Sed.auctor@@dolor.com</td>
<td>936</td>
<td>Luxembourg</td>
<td>$7,529</td>
<td>1</td>
</tr>
<tr>
<td>913619417</td>
<td>Snow, Skyler K.</td>
<td>07-02-19</td>
<td>Curabitur.sed.tortor@@euneque.com</td>
<td>284</td>
<td>Costa Rica</td>
<td>$8,341</td>
<td>1</td>
</tr>
<tr>
<td>246424915</td>
<td>Snider, Cecilia C.</td>
<td>12-17-18</td>
<td>orci.adipiscing@@maurissapien.ca</td>
<td>170</td>
<td>Serbia</td>
<td>$7,146</td>
<td>1</td>
</tr>
<tr>
<td>054562889</td>
<td>Mcgee, Quyn R.</td>
<td>01-14-20</td>
<td>semper@@interdumenimnon.com</td>
<td>281</td>
<td>Spain</td>
<td>$7,673</td>
<td>1</td>
</tr>
<tr>
<td>651566150</td>
<td>Berger, Echo X.</td>
<td>10-08-19</td>
<td>magnis.dis@@nequeInornare.co.uk</td>
<td>686</td>
<td>Niue</td>
<td>$8,190</td>
<td>1</td>
</tr>
<tr>
<td>234164663</td>
<td>Carter, Sopoline N.</td>
<td>07-01-19</td>
<td>sit.amet.metus@@imperdiet.org</td>
<td>538</td>
<td>Cambodia</td>
<td>$8,042</td>
<td>1</td>
</tr>
<tr>
<td>132403056</td>
<td>Hernandez, Desirae W.</td>
<td>10-06-18</td>
<td>commodo.auctor@@tempus.edu</td>
<td>531</td>
<td>Saint Barthélemy</td>
<td>$7,241</td>
<td>1</td>
</tr>
<tr>
<td>302907167</td>
<td>Kidd, Unity R.</td>
<td>07-02-19</td>
<td>fermentum.vel@@atliberoMorbi.co.uk</td>
<td>881</td>
<td>Guinea</td>
<td>$9,476</td>
<td>1</td>
</tr>
<tr>
<td>457711257</td>
<td>Mays, Quynn G.</td>
<td>04-17-19</td>
<td>eget.dictum.placerat@@Donec.co.uk</td>
<td>179</td>
<td>Bangladesh</td>
<td>$6,944</td>
<td>1</td>
</tr>
<tr>
<td>822402913</td>
<td>Cobb, Heather Q.</td>
<td>01-30-19</td>
<td>pharetra.nibh@@erat.org</td>
<td>591</td>
<td>Barbados</td>
<td>$6,243</td>
<td>1</td>
</tr>
<tr>
<td>133496570</td>
<td>Norman, Elijah I.</td>
<td>03-16-19</td>
<td>ridiculus.mus.Proin@@ipsum.edu</td>
<td>313</td>
<td>Bosnia and Herzegovina</td>
<td>$9,748</td>
<td>1</td>
</tr>
<tr>
<td>143641645</td>
<td>Cherry, Phyllis W.</td>
<td>08-06-19</td>
<td>ipsum.leo@@quis.co.uk</td>
<td>626</td>
<td>Sri Lanka</td>
<td>$7,641</td>
<td>1</td>
</tr>
<tr>
<td>997733126</td>
<td>Wright, Warren X.</td>
<td>06-09-19</td>
<td>a.auctor@@interdum.org</td>
<td>876</td>
<td>Egypt</td>
<td>$8,458</td>
<td>1</td>
</tr>
<tr>
<td>433765625</td>
<td>Daugherty, Sylvia O.</td>
<td>04-07-19</td>
<td>blandit.Nam@@disparturientmontes.edu</td>
<td>973</td>
<td>Bermuda</td>
<td>$5,551</td>
<td>1</td>
</tr>
<tr>
<td>468916945</td>
<td>Myers, Bryar W.</td>
<td>10-03-18</td>
<td>Nulla.semper@@nonjustoProin.com</td>
<td>273</td>
<td>Isle of Man</td>
<td>$6,671</td>
<td>1</td>
</tr>
<tr>
<td>874521677</td>
<td>Brennan, Vance I.</td>
<td>03-04-20</td>
<td>urna@@pharetra.edu</td>
<td>509</td>
<td>Puerto Rico</td>
<td>$5,918</td>
<td>1</td>
</tr>
<tr>
<td>609952775</td>
<td>Banks, Portia T.</td>
<td>05-26-20</td>
<td>Proin.vel.nisl@@justonec.com</td>
<td>754</td>
<td>Romania</td>
<td>$6,316</td>
<td>1</td>
</tr>
<tr>
<td>672207271</td>
<td>Mccoy, Brady F.</td>
<td>09-02-18</td>
<td>lobortis.mauris@@atnisiCum.net</td>
<td>179</td>
<td>Venezuela</td>
<td>$7,909</td>
<td>1</td>
</tr>
<tr>
<td>140391038</td>
<td>Mcconnell, Hamish C.</td>
<td>05-19-20</td>
<td>egestas@@Loremipsum.co.uk</td>
<td>424</td>
<td>Netherlands</td>
<td>$6,285</td>
<td>1</td>
</tr>
<tr>
<td>100877406</td>
<td>Stuart, Hilda C.</td>
<td>02-24-20</td>
<td>Vivamus.nibh@@quis.ca</td>
<td>514</td>
<td>Afghanistan</td>
<td>$6,408</td>
<td>1</td>
</tr>
<tr>
<td>083842419</td>
<td>Page, Emi G.</td>
<td>09-16-18</td>
<td>Integer.sem.elit@@quispedePraesent.ca</td>
<td>835</td>
<td>Tokelau</td>
<td>$5,696</td>
<td>1</td>
</tr>
<tr>
<td>025865486</td>
<td>Rasmussen, Piper C.</td>
<td>01-18-19</td>
<td>blandit@@molestiesodales.com</td>
<td>496</td>
<td>Slovakia</td>
<td>$8,843</td>
<td>1</td>
</tr>
<tr>
<td>602908154</td>
<td>Kinney, Laurel N.</td>
<td>01-27-20</td>
<td>neque.Nullam@@penatibuset.org</td>
<td>718</td>
<td>Norfolk Island</td>
<td>$8,374</td>
<td>1</td>
</tr>
<tr>
<td>103910519</td>
<td>Hess, Oren I.</td>
<td>10-29-19</td>
<td>tincidunt.pede.ac@@tellusNunclectus.edu</td>
<td>804</td>
<td>Mauritius</td>
<td>$5,009</td>
<td>1</td>
</tr>
<tr>
<td>053136990</td>
<td>Baldwin, Beau W.</td>
<td>03-20-19</td>
<td>a.felis@@nisiaodio.org</td>
<td>133</td>
<td>Saint Lucia</td>
<td>$8,786</td>
<td>1</td>
</tr>
<tr>
<td>554906412</td>
<td>Herrera, Lila R.</td>
<td>01-10-19</td>
<td>habitant.morbi.tristique@@aptent.edu</td>
<td>441</td>
<td>Malawi</td>
<td>$7,422</td>
<td>1</td>
</tr>
<tr>
<td>813289717</td>
<td>Rowland, Jameson U.</td>
<td>10-19-19</td>
<td>est.vitae@@molestieorcitincidunt.com</td>
<td>224</td>
<td>Bouvet Island</td>
<td>$7,380</td>
<td>1</td>
</tr>
<tr>
<td>552262891</td>
<td>Burks, Tanya X.</td>
<td>03-26-19</td>
<td>nunc.risus@@leo.co.uk</td>
<td>168</td>
<td>Australia</td>
<td>$9,070</td>
<td>1</td>
</tr>
<tr>
<td>925675126</td>
<td>Santana, Knox B.</td>
<td>06-05-20</td>
<td>at.libero@@molestie.org</td>
<td>288</td>
<td>Armenia</td>
<td>$7,205</td>
<td>1</td>
</tr>
<tr>
<td>042657015</td>
<td>Russell, Ima J.</td>
<td>10-06-18</td>
<td>egestas.lacinia.Sed@@risusDonec.com</td>
<td>588</td>
<td>New Caledonia</td>
<td>$7,272</td>
<td>1</td>
</tr>
<tr>
<td>379067929</td>
<td>Knowles, Chanda J.</td>
<td>09-06-18</td>
<td>tristique@@antedictum.co.uk</td>
<td>747</td>
<td>Lebanon</td>
<td>$8,249</td>
<td>1</td>
</tr>
<tr>
<td>322274499</td>
<td>Mcclain, Bree J.</td>
<td>03-12-20</td>
<td>ante@@nislelementumpurus.org</td>
<td>224</td>
<td>Korea, South</td>
<td>$5,587</td>
<td>1</td>
</tr>
<tr>
<td>404718686</td>
<td>Bailey, Lani X.</td>
<td>08-07-19</td>
<td>Proin@@massaMauris.ca</td>
<td>761</td>
<td>Australia</td>
<td>$6,092</td>
<td>1</td>
</tr>
<tr>
<td>359926938</td>
<td>Sloan, Keefe I.</td>
<td>10-14-18</td>
<td>Nullam@@utaliquamiaculis.org</td>
<td>806</td>
<td>South Georgia and The South Sandwich Islands</td>
<td>$5,003</td>
<td>1</td>
</tr>
<tr>
<td>369436084</td>
<td>Stephenson, Lilah J.</td>
<td>07-13-19</td>
<td>nisl@@metus.com</td>
<td>394</td>
<td>Zambia</td>
<td>$6,766</td>
<td>1</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>CustomerID</th>
<th>Name</th>
<th>PurchaseDate</th>
<th>CustomerEmail</th>
<th>CustomerCVV</th>
<th>Country</th>
<th>InvoiceAmount</th>
<th>Controls</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
@section ScriptsBlock {
<script type="text/javascript">
/* Activate smart panels */
$('#js-page-content').smartPanel();
</script>
<script src="~/js/statistics/peity/peity.bundle.js"></script>
<script src="~/js/statistics/flot/flot.bundle.js"></script>
<script src="~/js/statistics/easypiechart/easypiechart.bundle.js"></script>
<script src="~/js/datagrid/datatables/datatables.bundle.js"></script>
<script>
/* defined datas */
var dataTargetProfit = [
[1354586000000, 153],
[1364587000000, 658],
[1374588000000, 198],
[1384589000000, 663],
[1394590000000, 801],
[1404591000000, 1080],
[1414592000000, 353],
[1424593000000, 749],
[1434594000000, 523],
[1444595000000, 258],
[1454596000000, 688],
[1464597000000, 364]
]
var dataProfit = [
[1354586000000, 53],
[1364587000000, 65],
[1374588000000, 98],
[1384589000000, 83],
[1394590000000, 980],
[1404591000000, 808],
[1414592000000, 720],
[1424593000000, 674],
[1434594000000, 23],
[1444595000000, 79],
[1454596000000, 88],
[1464597000000, 36]
]
var dataSignups = [
[1354586000000, 647],
[1364587000000, 435],
[1374588000000, 784],
[1384589000000, 346],
[1394590000000, 487],
[1404591000000, 463],
[1414592000000, 479],
[1424593000000, 236],
[1434594000000, 843],
[1444595000000, 657],
[1454596000000, 241],
[1464597000000, 341]
]
var dataSet1 = [
[0, 10],
[100, 8],
[200, 7],
[300, 5],
[400, 4],
[500, 6],
[600, 3],
[700, 2]
];
var dataSet2 = [
[0, 9],
[100, 6],
[200, 5],
[300, 3],
[400, 3],
[500, 5],
[600, 2],
[700, 1]
];
$(document).ready(function () {
/* init datatables */
$('#dt-basic-example').dataTable(
{
responsive: true,
dom:
"<'row mb-3'<'col-sm-12 col-md-6 d-flex align-items-center justify-content-start'f><'col-sm-12 col-md-6 d-flex align-items-center justify-content-end'B>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
buttons: [
{
extend: 'colvis',
text: 'Column Visibility',
titleAttr: 'Col visibility',
className: 'btn-outline-default'
},
{
extend: 'csvHtml5',
text: 'CSV',
titleAttr: 'Generate CSV',
className: 'btn-outline-default'
},
{
extend: 'copyHtml5',
text: 'Copy',
titleAttr: 'Copy to clipboard',
className: 'btn-outline-default'
},
{
extend: 'print',
text: '<i class="@(Settings.Theme.IconPrefix) fa-print"></i>',
titleAttr: 'Print Table',
className: 'btn-outline-default'
}
],
columnDefs: [
{
targets: -1,
title: '',
orderable: false,
render: function(data, type, full, meta)
{
/*
-- ES6
-- convert using https://babeljs.io online transpiler
return `
<a href='javascript:void(0);' class='btn btn-sm btn-icon btn-outline-danger rounded-circle mr-1' title='Delete Record'>
<i class="@(Settings.Theme.IconPrefix) fa-times"></i>
</a>
<div class='dropdown d-inline-block dropleft '>
<a href='#'' class='btn btn-sm btn-icon btn-outline-primary rounded-circle shadow-0' data-toggle='dropdown' aria-expanded='true' title='More options'>
<i class="@(Settings.Theme.IconPrefix) fa-ellipsis-v"></i>
</a>
<div class='dropdown-menu'>
<a class='dropdown-item' href='javascript:void(0);'>Change Status</a>
<a class='dropdown-item' href='javascript:void(0);'>Generate Report</a>
</div>
</div>`;
ES5 example below:
*/
return "\n\t\t\t\t\t\t<a href='javascript:void(0);' class='btn btn-sm btn-icon btn-outline-danger rounded-circle mr-1' title='Delete Record'>\n\t\t\t\t\t\t\t<i class=\"@(Settings.Theme.IconPrefix) fa-times\"></i>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t\t<div class='dropdown d-inline-block dropleft'>\n\t\t\t\t\t\t\t<a href='#'' class='btn btn-sm btn-icon btn-outline-primary rounded-circle shadow-0' data-toggle='dropdown' aria-expanded='true' title='More options'>\n\t\t\t\t\t\t\t\t<i class=\"@(Settings.Theme.IconPrefix) fa-ellipsis-v\"></i>\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t<div class='dropdown-menu'>\n\t\t\t\t\t\t\t\t<a class='dropdown-item' href='javascript:void(0);'>Change Status</a>\n\t\t\t\t\t\t\t\t<a class='dropdown-item' href='javascript:void(0);'>Generate Report</a>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>";
},
},
]
});
/* flot toggle example */
var flot_toggle = function () {
var data = [{
label: "Target Profit",
data: dataTargetProfit,
color: color.info._400,
bars: {
show: true,
align: "center",
barWidth: 30 * 30 * 60 * 1000 * 80,
lineWidth: 0,
/*fillColor: {
colors: [color.primary._500, color.primary._900]
},*/
fillColor: {
colors: [{
opacity: 0.9
}, {
opacity: 0.1
}]
}
},
highlightColor: 'rgba(255,255,255,0.3)',
shadowSize: 0
}, {
label: "Actual Profit",
data: dataProfit,
color: color.warning._500,
lines: {
show: true,
lineWidth: 2
},
shadowSize: 0,
points: {
show: true
}
}, {
label: "User Signups",
data: dataSignups,
color: color.success._500,
lines: {
show: true,
lineWidth: 2
},
shadowSize: 0,
points: {
show: true
}
}]
var options = {
grid: {
hoverable: true,
clickable: true,
tickColor: 'rgba(0,0,0,0.05)',
borderWidth: 1,
borderColor: 'rgba(0,0,0,0.05)'
},
tooltip: true,
tooltipOpts: {
cssClass: 'tooltip-inner',
defaultTheme: false
},
xaxis: {
mode: "time",
tickColor: 'rgba(0,0,0,0.05)',
},
yaxes: {
tickColor: 'rgba(0,0,0,0.05)',
tickFormatter: function (val, axis) {
return "$" + val;
},
max: 1200
}
};
var plot2 = null;
function plotNow() {
var d = [];
$("#js-checkbox-toggles").find(':checkbox').each(function () {
if ($(this).is(':checked')) {
d.push(data[$(this).attr("name").substr(4, 1)]);
}
});
if (d.length > 0) {
if (plot2) {
plot2.setData(d);
plot2.draw();
} else {
plot2 = $.plot($("#flot-toggles"), d, options);
}
}
};
$("#js-checkbox-toggles").find(':checkbox').on('change', function () {
plotNow();
});
plotNow()
}
flot_toggle();
/* flot toggle example -- end*/
/* flot area */
var flotArea = $.plot($('#flot-area'), [{
data: dataSet1,
label: 'New Customer',
color: color.success._200
},
{
data: dataSet2,
label: 'Returning Customer',
color: color.info._200
}
], {
series: {
lines: {
show: true,
lineWidth: 2,
fill: true,
fillColor: {
colors: [{
opacity: 0
}, {
opacity: 0.5
}]
}
},
shadowSize: 0
},
points: {
show: true,
},
legend: {
noColumns: 1,
position: 'nw'
},
grid: {
hoverable: true,
clickable: true,
borderColor: '#ddd',
tickColor: 'rgba(0,0,0,0.05)',
aboveData: true,
borderWidth: 0,
labelMargin: 5,
backgroundColor: 'transparent'
},
yaxis: {
tickLength: 1,
min: 0,
max: 15,
color: '#eee',
tickColor: 'rgba(0,0,0,0.05)',
font: {
size: 0,
color: '#999'
}
},
xaxis: {
tickLength: 1,
color: '#eee',
tickColor: 'rgba(0,0,0,0.05)',
font: {
size: 10,
color: '#999'
}
}
});
/* flot area -- end */
var flotVisit = $.plot('#flotVisit', [{
data: [
[3, 0],
[4, 1],
[5, 3],
[6, 3],
[7, 10],
[8, 11],
[9, 12],
[10, 9],
[11, 12],
[12, 8],
[13, 5]
],
color: color.success._200
}, {
data: [
[1, 0],
[2, 0],
[3, 1],
[4, 2],
[5, 2],
[6, 5],
[7, 8],
[8, 12],
[9, 9],
[10, 11],
[11, 5]
],
color: color.info._200
}], {
series: {
shadowSize: 0,
lines: {
show: true,
lineWidth: 2,
fill: true,
fillColor: {
colors: [{
opacity: 0
}, {
opacity: 0.12
}]
}
}
},
grid: {
borderWidth: 0
},
yaxis: {
min: 0,
max: 15,
tickColor: 'rgba(0,0,0,0.05)',
ticks: [
[0, ''],
[5, '100K'],
[10, '200K'],
[15, '300K']
],
font: {
color: '#444',
size: 10
}
},
xaxis: {
tickColor: 'rgba(0,0,0,0.05)',
ticks: [
[2, '2am'],
[3, '3am'],
[4, '4am'],
[5, '5am'],
[6, '6am'],
[7, '7am'],
[8, '8am'],
[9, '9am'],
[10, '1pm'],
[11, '2pm'],
[12, '3pm'],
[13, '4pm']
],
font: {
color: '#999',
size: 9
}
}
});
});
</script>
} | the_stack |
#l "lib-generic.cake"
#l "lib-logging.cake"
#l "lib-msbuild.cake"
#l "lib-nuget.cake"
#l "lib-signing.cake"
#l "lib-sourcelink.cake"
#l "issuetrackers.cake"
#l "installers.cake"
#l "sourcecontrol.cake"
#l "notifications.cake"
#l "generic-tasks.cake"
#l "apps-uwp-tasks.cake"
#l "apps-web-tasks.cake"
#l "apps-wpf-tasks.cake"
#l "components-tasks.cake"
#l "dependencies-tasks.cake"
#l "tools-tasks.cake"
#l "docker-tasks.cake"
#l "github-pages-tasks.cake"
#l "vsextensions-tasks.cake"
#l "tests.cake"
#l "templates-tasks.cake"
#addin "nuget:?package=Cake.FileHelpers&version=4.0.1"
#addin "nuget:?package=Cake.Sonar&version=1.1.25"
#addin "nuget:?package=MagicChunks&version=2.0.0.119"
#addin "nuget:?package=Newtonsoft.Json&version=13.0.1"
#addin "nuget:?package=System.Net.Http&version=4.3.4"
// Note: the SonarQube tool must be installed as a global .NET tool:
// `dotnet tool install --global dotnet-sonarscanner --ignore-failed-sources`
//#tool "nuget:?package=MSBuild.SonarQube.Runner.Tool&version=4.8.0"
#tool "nuget:?package=dotnet-sonarscanner&version=5.3.2"
//-------------------------------------------------------------
// BACKWARDS COMPATIBILITY CODE - START
//-------------------------------------------------------------
// Required so we have backwards compatibility, so developers can keep using
// GetBuildServerVariable in build.cake
private BuildServerIntegration _buildServerIntegration = null;
private BuildServerIntegration GetBuildServerIntegration()
{
if (_buildServerIntegration is null)
{
_buildServerIntegration = new BuildServerIntegration(Context, Parameters);
}
return _buildServerIntegration;
}
public string GetBuildServerVariable(string variableName, string defaultValue = null, bool showValue = false)
{
var buildServerIntegration = GetBuildServerIntegration();
return buildServerIntegration.GetVariable(variableName, defaultValue, showValue);
}
//-------------------------------------------------------------
// BACKWARDS COMPATIBILITY CODE - END
//-------------------------------------------------------------
//-------------------------------------------------------------
// BUILD CONTEXT
//-------------------------------------------------------------
public class BuildContext : BuildContextBase
{
public BuildContext(ICakeContext cakeContext)
: base(cakeContext)
{
Processors = new List<IProcessor>();
AllProjects = new List<string>();
Variables = new Dictionary<string, string>();
}
public List<IProcessor> Processors { get; private set; }
public Dictionary<string, object> Parameters { get; set; }
public Dictionary<string, string> Variables { get; private set; }
// Integrations
public BuildServerIntegration BuildServer { get; set; }
public IssueTrackerIntegration IssueTracker { get; set; }
public InstallerIntegration Installer { get; set; }
public NotificationsIntegration Notifications { get; set; }
public SourceControlIntegration SourceControl { get; set; }
public OctopusDeployIntegration OctopusDeploy { get; set; }
// Contexts
public GeneralContext General { get; set; }
public TestsContext Tests { get; set; }
public ComponentsContext Components { get; set; }
public DependenciesContext Dependencies { get; set; }
public DockerImagesContext DockerImages { get; set; }
public GitHubPagesContext GitHubPages { get; set; }
public TemplatesContext Templates { get; set; }
public ToolsContext Tools { get; set; }
public UwpContext Uwp { get; set; }
public VsExtensionsContext VsExtensions { get; set; }
public WebContext Web { get; set; }
public WpfContext Wpf { get; set; }
public List<string> AllProjects { get; private set; }
protected override void ValidateContext()
{
}
protected override void LogStateInfoForContext()
{
}
}
//-------------------------------------------------------------
// TASKS
//-------------------------------------------------------------
Setup<BuildContext>(setupContext =>
{
setupContext.Information("Running setup of build scripts");
var buildContext = new BuildContext(setupContext);
// Important, set parameters first
buildContext.Parameters = Parameters ?? new Dictionary<string, object>();
setupContext.LogSeparator("Creating integrations");
// Important: build server first so other integrations can read values from config
buildContext.BuildServer = GetBuildServerIntegration();
setupContext.LogSeparator("Creating build context");
buildContext.General = InitializeGeneralContext(buildContext, buildContext);
buildContext.Tests = InitializeTestsContext(buildContext, buildContext);
buildContext.Components = InitializeComponentsContext(buildContext, buildContext);
buildContext.Dependencies = InitializeDependenciesContext(buildContext, buildContext);
buildContext.DockerImages = InitializeDockerImagesContext(buildContext, buildContext);
buildContext.GitHubPages = InitializeGitHubPagesContext(buildContext, buildContext);
buildContext.Templates = InitializeTemplatesContext(buildContext, buildContext);
buildContext.Tools = InitializeToolsContext(buildContext, buildContext);
buildContext.Uwp = InitializeUwpContext(buildContext, buildContext);
buildContext.VsExtensions = InitializeVsExtensionsContext(buildContext, buildContext);
buildContext.Web = InitializeWebContext(buildContext, buildContext);
buildContext.Wpf = InitializeWpfContext(buildContext, buildContext);
// Other integrations last
buildContext.IssueTracker = new IssueTrackerIntegration(buildContext);
buildContext.Installer = new InstallerIntegration(buildContext);
buildContext.Notifications = new NotificationsIntegration(buildContext);
buildContext.OctopusDeploy = new OctopusDeployIntegration(buildContext);
buildContext.SourceControl = new SourceControlIntegration(buildContext);
setupContext.LogSeparator("Validating build context");
buildContext.Validate();
setupContext.LogSeparator("Creating processors");
// Note: always put templates and dependencies processor first (it's a dependency after all)
buildContext.Processors.Add(new TemplatesProcessor(buildContext));
buildContext.Processors.Add(new DependenciesProcessor(buildContext));
buildContext.Processors.Add(new ComponentsProcessor(buildContext));
buildContext.Processors.Add(new DockerImagesProcessor(buildContext));
buildContext.Processors.Add(new GitHubPagesProcessor(buildContext));
buildContext.Processors.Add(new ToolsProcessor(buildContext));
buildContext.Processors.Add(new UwpProcessor(buildContext));
buildContext.Processors.Add(new VsExtensionsProcessor(buildContext));
buildContext.Processors.Add(new WebProcessor(buildContext));
buildContext.Processors.Add(new WpfProcessor(buildContext));
// !!! Note: we add test projects *after* preparing all the other processors, see Prepare task !!!
setupContext.LogSeparator("Registering variables for templates");
// Preparing variables for templates
buildContext.Variables["GitVersion_MajorMinorPatch"] = buildContext.General.Version.MajorMinorPatch;
buildContext.Variables["GitVersion_FullSemVer"] = buildContext.General.Version.FullSemVer;
buildContext.Variables["GitVersion_NuGetVersion"] = buildContext.General.Version.NuGet;
setupContext.LogSeparator("Build context is ready, displaying state info");
buildContext.LogStateInfo();
return buildContext;
});
//-------------------------------------------------------------
Task("Initialize")
.Does<BuildContext>(async buildContext =>
{
buildContext.CakeContext.LogSeparator("Writing special values back to build server");
var displayVersion = buildContext.General.Version.FullSemVer;
if (buildContext.General.IsCiBuild)
{
displayVersion += " ci";
}
buildContext.BuildServer.SetVersion(displayVersion);
var variablesToUpdate = new Dictionary<string, string>();
variablesToUpdate["channel"] = buildContext.Wpf.Channel;
variablesToUpdate["publishType"] = buildContext.General.Solution.PublishType.ToString();
variablesToUpdate["isAlphaBuild"] = buildContext.General.IsAlphaBuild.ToString();
variablesToUpdate["isBetaBuild"] = buildContext.General.IsBetaBuild.ToString();
variablesToUpdate["isOfficialBuild"] = buildContext.General.IsOfficialBuild.ToString();
// Also write back versioning (then it can be cached), "worst case scenario" it's writing back the same versions
variablesToUpdate["GitVersion_MajorMinorPatch"] = buildContext.General.Version.MajorMinorPatch;
variablesToUpdate["GitVersion_FullSemVer"] = buildContext.General.Version.FullSemVer;
variablesToUpdate["GitVersion_NuGetVersion"] = buildContext.General.Version.NuGet;
variablesToUpdate["GitVersion_CommitsSinceVersionSource"] = buildContext.General.Version.CommitsSinceVersionSource;
foreach (var variableToUpdate in variablesToUpdate)
{
buildContext.BuildServer.SetVariable(variableToUpdate.Key, variableToUpdate.Value);
}
});
//-------------------------------------------------------------
Task("Prepare")
.Does<BuildContext>(async buildContext =>
{
foreach (var processor in buildContext.Processors)
{
await processor.PrepareAsync();
}
// Now add all projects, but dependencies first & tests last
buildContext.AllProjects.AddRange(buildContext.Dependencies.Items);
buildContext.AllProjects.AddRange(buildContext.Components.Items);
buildContext.AllProjects.AddRange(buildContext.DockerImages.Items);
buildContext.AllProjects.AddRange(buildContext.GitHubPages.Items);
buildContext.AllProjects.AddRange(buildContext.Tools.Items);
buildContext.AllProjects.AddRange(buildContext.Uwp.Items);
buildContext.AllProjects.AddRange(buildContext.VsExtensions.Items);
buildContext.AllProjects.AddRange(buildContext.Web.Items);
buildContext.AllProjects.AddRange(buildContext.Wpf.Items);
// Once we know all the projects that will be built, we calculate which
// test projects need to be built as well
var testProcessor = new TestProcessor(buildContext);
await testProcessor.PrepareAsync();
buildContext.Processors.Add(testProcessor);
buildContext.AllProjects.AddRange(buildContext.Tests.Items);
buildContext.CakeContext.LogSeparator("Final projects to process");
foreach (var item in buildContext.AllProjects.ToList())
{
buildContext.CakeContext.Information($"- {item}");
}
});
//-------------------------------------------------------------
Task("UpdateInfo")
.IsDependentOn("Prepare")
.Does<BuildContext>(async buildContext =>
{
UpdateSolutionAssemblyInfo(buildContext);
foreach (var processor in buildContext.Processors)
{
await processor.UpdateInfoAsync();
}
});
//-------------------------------------------------------------
Task("Build")
.IsDependentOn("Clean")
.IsDependentOn("RestorePackages")
.IsDependentOn("UpdateInfo")
//.IsDependentOn("VerifyDependencies")
.IsDependentOn("CleanupCode")
.Does<BuildContext>(async buildContext =>
{
await buildContext.SourceControl.MarkBuildAsPendingAsync("Build");
var sonarUrl = buildContext.General.SonarQube.Url;
var enableSonar = !buildContext.General.SonarQube.IsDisabled &&
!string.IsNullOrWhiteSpace(sonarUrl);
if (enableSonar)
{
var sonarSettings = new SonarBeginSettings
{
// SonarQube info
Url = sonarUrl,
// Project info
Key = buildContext.General.SonarQube.Project,
Version = buildContext.General.Version.FullSemVer,
// Use core clr version of SonarQube
UseCoreClr = true,
// Minimize extreme logging
Verbose = false,
Silent = true,
// Support waiting for the quality gate
ArgumentCustomization = args => args
.Append("/d:sonar.qualitygate.wait=true")
};
if (!string.IsNullOrWhiteSpace(buildContext.General.SonarQube.Organization))
{
sonarSettings.Organization = buildContext.General.SonarQube.Organization;
}
if (!string.IsNullOrWhiteSpace(buildContext.General.SonarQube.Username))
{
sonarSettings.Login = buildContext.General.SonarQube.Username;
}
if (!string.IsNullOrWhiteSpace(buildContext.General.SonarQube.Password))
{
sonarSettings.Password = buildContext.General.SonarQube.Password;
}
// see https://cakebuild.net/api/Cake.Sonar/SonarBeginSettings/ for more information on
// what to set for SonarCloud
// Branch only works with the branch plugin. Documentation A says it's outdated, but
// B still mentions it:
// A: https://docs.sonarqube.org/latest/branches/overview/
// B: https://docs.sonarqube.org/latest/analysis/analysis-parameters/
if (buildContext.General.SonarQube.SupportBranches)
{
// TODO: How to support PR?
sonarSettings.Branch = buildContext.General.Repository.BranchName;
}
Information("Beginning SonarQube");
SonarBegin(sonarSettings);
}
else
{
Information("Skipping Sonar integration since url is not specified or it has been explicitly disabled");
}
try
{
if (buildContext.General.Solution.BuildSolution)
{
BuildSolution(buildContext);
}
foreach (var processor in buildContext.Processors)
{
if (processor is TestProcessor)
{
// Build test projects *after* SonarQube (not part of SQ analysis)
continue;
}
await processor.BuildAsync();
}
}
finally
{
if (enableSonar)
{
try
{
await buildContext.SourceControl.MarkBuildAsPendingAsync("SonarQube");
var sonarEndSettings = new SonarEndSettings
{
// Use core clr version of SonarQube
UseCoreClr = true
};
if (!string.IsNullOrWhiteSpace(buildContext.General.SonarQube.Username))
{
sonarEndSettings.Login = buildContext.General.SonarQube.Username;
}
if (!string.IsNullOrWhiteSpace(buildContext.General.SonarQube.Password))
{
sonarEndSettings.Password = buildContext.General.SonarQube.Password;
}
Information("Ending SonarQube");
SonarEnd(sonarEndSettings);
await buildContext.SourceControl.MarkBuildAsSucceededAsync("SonarQube");
}
catch (Exception)
{
var projectSpecificSonarUrl = $"{sonarUrl}/dashboard?id={buildContext.General.SonarQube.Project}";
if (buildContext.General.SonarQube.SupportBranches)
{
projectSpecificSonarUrl += $"&branch={buildContext.General.Repository.BranchName}";
}
var failedDescription = $"SonarQube failed, please visit '{projectSpecificSonarUrl}' for more details";
await buildContext.SourceControl.MarkBuildAsFailedAsync("SonarQube", failedDescription);
throw;
}
}
}
var testProcessor = buildContext.Processors.FirstOrDefault(x => x is TestProcessor) as TestProcessor;
if (testProcessor is not null)
{
// Build test projects *after* SonarQube (not part of SQ analysis). Unfortunately, because of this, we cannot yet mark
// the build as succeeded once we end the SQ session. Therefore, if SQ fails, both the SQ *and* build checks
// will be marked as failed if SQ fails.
await testProcessor.BuildAsync();
}
await buildContext.SourceControl.MarkBuildAsSucceededAsync("Build");
Information("Completed build for version '{0}'", buildContext.General.Version.NuGet);
})
.OnError<BuildContext>((ex, buildContext) =>
{
buildContext.SourceControl.MarkBuildAsFailedAsync("Build").Wait();
throw ex;
});
//-------------------------------------------------------------
Task("Test")
.IsDependentOn("Prepare")
// Note: no dependency on 'build' since we might have already built the solution
.Does<BuildContext>(async buildContext =>
{
await buildContext.SourceControl.MarkBuildAsPendingAsync("Test");
foreach (var testProject in buildContext.Tests.Items)
{
buildContext.CakeContext.LogSeparator("Running tests for '{0}'", testProject);
RunUnitTests(buildContext, testProject);
}
await buildContext.SourceControl.MarkBuildAsSucceededAsync("Test");
Information("Completed tests for version '{0}'", buildContext.General.Version.NuGet);
})
.OnError<BuildContext>((ex, buildContext) =>
{
buildContext.SourceControl.MarkBuildAsFailedAsync("Test").Wait();
throw ex;
});
//-------------------------------------------------------------
Task("Package")
// Note: no dependency on 'build' since we might have already built the solution
// Make sure we have the temporary "project.assets.json" in case we need to package with Visual Studio
.IsDependentOn("RestorePackages")
// Make sure to update if we are running on a new agent so we can sign nuget packages
.IsDependentOn("UpdateNuGet")
.IsDependentOn("CodeSign")
.Does<BuildContext>(async buildContext =>
{
foreach (var processor in buildContext.Processors)
{
await processor.PackageAsync();
}
Information("Completed packaging for version '{0}'", buildContext.General.Version.NuGet);
});
//-------------------------------------------------------------
Task("PackageLocal")
.IsDependentOn("Package")
.Does<BuildContext>(buildContext =>
{
// For now only package components, we might need to move this to components-tasks.cake in the future
if (buildContext.Components.Items.Count == 0 &&
buildContext.Tools.Items.Count == 0)
{
return;
}
var localPackagesDirectory = buildContext.General.NuGet.LocalPackagesDirectory;
Information("Copying build artifacts to '{0}'", localPackagesDirectory);
CreateDirectory(localPackagesDirectory);
foreach (var component in buildContext.Components.Items)
{
try
{
Information("Copying build artifact for '{0}'", component);
var sourceFile = System.IO.Path.Combine(buildContext.General.OutputRootDirectory,
$"{component}.{buildContext.General.Version.NuGet}.nupkg");
CopyFiles(new [] { sourceFile }, localPackagesDirectory);
}
catch (Exception)
{
// Ignore
Warning("Failed to copy build artifacts for '{0}'", component);
}
}
Information("Copied build artifacts for version '{0}'", buildContext.General.Version.NuGet);
});
//-------------------------------------------------------------
Task("Deploy")
// Note: no dependency on 'package' since we might have already packaged the solution
// Make sure we have the temporary "project.assets.json" in case we need to package with Visual Studio
.IsDependentOn("RestorePackages")
.Does<BuildContext>(async buildContext =>
{
foreach (var processor in buildContext.Processors)
{
await processor.DeployAsync();
}
});
//-------------------------------------------------------------
Task("Finalize")
// Note: no dependency on 'deploy' since we might have already deployed the solution
.Does<BuildContext>(async buildContext =>
{
Information("Finalizing release '{0}'", buildContext.General.Version.FullSemVer);
foreach (var processor in buildContext.Processors)
{
await processor.FinalizeAsync();
}
if (buildContext.General.IsOfficialBuild)
{
buildContext.BuildServer.PinBuild("Official build");
}
await buildContext.IssueTracker.CreateAndReleaseVersionAsync();
});
//-------------------------------------------------------------
// Wrapper tasks since we don't want to add "Build" as a
// dependency to "Package" because we want to run in multiple
// stages
//-------------------------------------------------------------
Task("BuildAndTest")
.IsDependentOn("Initialize")
.IsDependentOn("Build")
.IsDependentOn("Test");
//-------------------------------------------------------------
Task("BuildAndPackage")
.IsDependentOn("Initialize")
.IsDependentOn("Build")
.IsDependentOn("Test")
.IsDependentOn("Package");
//-------------------------------------------------------------
Task("BuildAndPackageLocal")
.IsDependentOn("Initialize")
.IsDependentOn("Build")
//.IsDependentOn("Test") // Note: don't test for performance on local builds
.IsDependentOn("PackageLocal");
//-------------------------------------------------------------
Task("BuildAndDeploy")
.IsDependentOn("Initialize")
.IsDependentOn("Build")
.IsDependentOn("Test")
.IsDependentOn("Package")
.IsDependentOn("Deploy");
//-------------------------------------------------------------
Task("Default")
.Does<BuildContext>(async buildContext =>
{
Error("No target specified, please specify one of the following targets:\n" +
" - Prepare\n" +
" - UpdateInfo\n" +
" - Build\n" +
" - Test\n" +
" - Package\n" +
" - Deploy\n" +
" - Finalize\n\n" +
"or one of the combined ones:\n" +
" - BuildAndTest\n" +
" - BuildAndPackage\n" +
" - BuildAndPackageLocal\n" +
" - BuildAndDeploy\n");
});
//-------------------------------------------------------------
// Test wrappers
//-------------------------------------------------------------
Task("TestNotifications")
.Does<BuildContext>(async buildContext =>
{
await buildContext.Notifications.NotifyAsync("MyProject", "This is a generic test");
await buildContext.Notifications.NotifyAsync("MyProject", "This is a component test", TargetType.Component);
await buildContext.Notifications.NotifyAsync("MyProject", "This is a docker image test", TargetType.DockerImage);
await buildContext.Notifications.NotifyAsync("MyProject", "This is a web app test", TargetType.WebApp);
await buildContext.Notifications.NotifyAsync("MyProject", "This is a wpf app test", TargetType.WpfApp);
await buildContext.Notifications.NotifyErrorAsync("MyProject", "This is an error");
});
//-------------------------------------------------------------
Task("TestSourceControl")
.Does<BuildContext>(async buildContext =>
{
await buildContext.SourceControl.MarkBuildAsPendingAsync("Build");
await System.Threading.Tasks.Task.Delay(5 * 1000);
await buildContext.SourceControl.MarkBuildAsSucceededAsync("Build");
await buildContext.SourceControl.MarkBuildAsPendingAsync("Test");
await System.Threading.Tasks.Task.Delay(5 * 1000);
await buildContext.SourceControl.MarkBuildAsSucceededAsync("Test");
});
//-------------------------------------------------------------
// ACTUAL RUNNER - MUST BE DEFINED AT THE BOTTOM
//-------------------------------------------------------------
var localTarget = GetBuildServerVariable("Target", "Default", showValue: true);
RunTarget(localTarget); | the_stack |
@page
@model ChartjsModel
@{
ViewData["Title"] = "Chart.js";
ViewData["PageName"] = "statistics_chartjs";
ViewData["Category1"] = "Statistics";
ViewData["Heading"] = "<i class='subheader-icon fal fa-chart-pie'></i> Chart.js <sup class='badge badge-primary fw-500'>ADDON</sup>";
ViewData["PageDescription"] = "Simple yet flexible JavaScript charting for designers & developers";
}
@section HeadBlock {
<link rel="stylesheet" media="screen, print" href="~/css/statistics/chartjs/chartjs.css">
}
<div class="alert alert-primary">
<div class="d-flex flex-start w-100">
<div class="mr-2 hidden-md-down">
<span class="icon-stack icon-stack-lg">
<i class="base base-6 icon-stack-3x opacity-100 color-primary-500"></i>
<i class="base base-10 icon-stack-2x opacity-100 color-primary-300 fa-flip-vertical"></i>
<i class="ni ni-blog-read icon-stack-1x opacity-100 color-white"></i>
</span>
</div>
<div class="d-flex flex-fill">
<div class="flex-fill">
<span class="h5">About</span>
<p>Chart.js is a JavaScript library that allows you to draw different types of charts by using the HTML5 <code>canvas</code> element.</p>
<p>
The library doesn’t have dependencies and its weight is very low as it’s ~11kb in size when minified, concatenated, and served gzipped. However, you’re able to reduce the size even further, if you don’t use all six of the core chart types, by including only the modules you need.
</p>
<p class="m-0">
Find tutorials, guidelines and more on Chart.js's <a href="https://www.chartjs.org/docs/latest/" target="_blank">official documentation</a>
</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xl-12">
<div class="row">
<div class="col-xl-6">
<div id="panel-1" class="panel">
<div class="panel-hdr">
<h2>
Line <span class="fw-300"><i>Chart</i></span>
</h2>
<div class="panel-toolbar">
<button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button>
<button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button>
<button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button>
</div>
</div>
<div class="panel-container show">
<div class="panel-content">
<div class="panel-tag">
The line chart requires an array of labels for each of the data points. This is shown on the X axis. It has a colour for the fill, a colour for the line and colours for the points and strokes of the points
</div>
<div id="lineChart">
<canvas style="width:100%; height:300px;"></canvas>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-6">
<div id="panel-7" class="panel">
<div class="panel-hdr">
<h2>
Area <span class="fw-300"><i>Chart</i></span>
</h2>
<div class="panel-toolbar">
<button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button>
<button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button>
<button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button>
</div>
</div>
<div class="panel-container show">
<div class="panel-content">
<div class="panel-tag">
An area chart or area graph displays graphically quantitative data. It is based on the line chart. The area between axis and line are commonly emphasized with colors, textures and hatchings
</div>
<div id="areaChart">
<canvas style="width:100%; height:300px;"></canvas>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-12">
<div class="row">
<div class="col-xl-6">
<div id="panel-2" class="panel">
<div class="panel-hdr">
<h2>
Horizontal <span class="fw-300"><i>Bar Chart</i></span>
</h2>
<div class="panel-toolbar">
<button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button>
<button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button>
<button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button>
</div>
</div>
<div class="panel-container show">
<div class="panel-content">
<div class="panel-tag">
A horizontal bar chart provides a way of showing data values represented as horizontal bars. It is sometimes used to show trend data, and the comparison of multiple data sets on top of another
</div>
<div id="horizontalBarChart" >
<canvas style="width:100%; height:300px;"></canvas>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-6">
<div id="panel-8" class="panel">
<div class="panel-hdr">
<h2>
Bar <span class="fw-300"><i>Chart</i></span>
</h2>
<div class="panel-toolbar">
<button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button>
<button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button>
<button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button>
</div>
</div>
<div class="panel-container show">
<div class="panel-content">
<div class="panel-tag">
A bar chart provides a way of showing data values represented as vertical bars. It is sometimes used to show trend data, and the comparison of multiple data sets side by side
</div>
<div id="barChart">
<canvas style="width:100%; height:300px;"></canvas>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-12">
<div class="row">
<div class="col-xl-6">
<div id="panel-3" class="panel">
<div class="panel-hdr">
<h2>
Bar <span class="fw-300"><i>Stacked</i></span>
</h2>
<div class="panel-toolbar">
<button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button>
<button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button>
<button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button>
</div>
</div>
<div class="panel-container show">
<div class="panel-content">
<div class="panel-tag">
A stacked bar chart, is a graph that is used to break down and compare parts of a whole. Each bar in the chart represents a whole, and segments in the bar represent different parts or categories of that whole
</div>
<div id="barStacked">
<canvas style="width:100%; height:300px;"></canvas>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-6">
<div id="panel-9" class="panel">
<div class="panel-hdr">
<h2>
Bar <span class="fw-300"><i>Stacked (horizontal)</i></span>
</h2>
<div class="panel-toolbar">
<button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button>
<button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button>
<button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button>
</div>
</div>
<div class="panel-container show">
<div class="panel-content">
<div class="panel-tag">
A stacked horizontal bar chart, shows you a breakdown and compare parts of a whole. Each segment displays a whole brown down into different parts or categories - displayed on top of another
</div>
<div id="barHorizontalStacked">
<canvas style="width:100%; height:300px;"></canvas>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-12">
<div class="row">
<div class="col-xl-6">
<div id="panel-4" class="panel">
<div class="panel-hdr">
<h2>
Bubble <span class="fw-300"><i>Chart</i></span>
</h2>
<div class="panel-toolbar">
<button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button>
<button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button>
<button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button>
</div>
</div>
<div class="panel-container show">
<div class="panel-content">
<div class="panel-tag">
A bubble chart is used to display three dimensions of data. The location of the bubble is determined by the first two dimensions and the third dimension is represented by the size of the individual bubbles
</div>
<div id="bubbleChart">
<canvas style="width:100%; height:300px;"></canvas>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-6">
<div id="panel-10" class="panel">
<div class="panel-hdr">
<h2>
Combination <span class="fw-300"><i>Chart (Bar & Line)</i></span>
</h2>
<div class="panel-toolbar">
<button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button>
<button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button>
<button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button>
</div>
</div>
<div class="panel-container show">
<div class="panel-content">
<div class="panel-tag">
This is a combination of different charts presented together to show how easy it is to built complex charts. Here we use similar data sets to combine a linechart with bar chart
</div>
<div id="barlineCombine">
<canvas style="width:100%; height:300px;"></canvas>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-12">
<div class="row">
<div class="col-xl-6">
<div id="panel-5" class="panel">
<div class="panel-hdr">
<h2>
Polar <span class="fw-300"><i>Area</i></span>
</h2>
<div class="panel-toolbar">
<button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button>
<button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button>
<button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button>
</div>
</div>
<div class="panel-container show">
<div class="panel-content">
<div class="panel-tag">
Polar charts are similar to pie charts, but each segment has the same angle - the radius of the segment differs depending on the value. Polar charts is often useful when we want to show a comparison data similar to a pie chart, but also show a scale of values for context
</div>
<div id="polarArea">
<canvas style="width:100%; height:300px;"></canvas>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-6">
<div id="panel-11" class="panel">
<div class="panel-hdr">
<h2>
Radar <span class="fw-300"><i>Chart</i></span>
</h2>
<div class="panel-toolbar">
<button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button>
<button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button>
<button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button>
</div>
</div>
<div class="panel-container show">
<div class="panel-content">
<div class="panel-tag">
For a radar chart, to provide context of what each point means, we include an array of strings that show around each point in the chart. For the radar chart data, we have an array of datasets as objects, with a fill, stroke, and line color for each point. We also have an array of data values
</div>
<div id="radarChart">
<canvas style="width:100%; height:300px;"></canvas>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-12">
<div class="row">
<div class="col-xl-6">
<div id="panel-6" class="panel">
<div class="panel-hdr">
<h2>
Pie <span class="fw-300"><i>Chart</i></span>
</h2>
<div class="panel-toolbar">
<button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button>
<button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button>
<button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button>
</div>
</div>
<div class="panel-container show">
<div class="panel-content">
<div class="panel-tag">
Pie charts are probably the most commonly used chart there are. They are divided into segments, the arc of each segment shows the proportional value of each piece of data
</div>
<div id="pieChart">
<canvas style="width:100%; height:300px;"></canvas>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-6">
<div id="panel-12" class="panel">
<div class="panel-hdr">
<h2>
Doughnut <span class="fw-300"><i>Chart</i></span>
</h2>
<div class="panel-toolbar">
<button class="btn btn-panel" data-action="panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></button>
<button class="btn btn-panel" data-action="panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></button>
<button class="btn btn-panel" data-action="panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></button>
</div>
</div>
<div class="panel-container show">
<div class="panel-content">
<div class="panel-tag">
Doughnut charts are probably the most commonly used chart there are. They are divided into segments, the arc of each segment shows the proportional value of each piece of data
</div>
<div id="doughnutChart">
<canvas style="width:100%; height:300px;"></canvas>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@section ScriptsBlock {
<script src="~/js/statistics/chartjs/chartjs.bundle.js"></script>
<script>
/* line chart */
var lineChart = function(){
var config = {
type: 'line',
data: {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [{
label: "Success",
borderColor: color.success._500,
pointBackgroundColor: color.success._700,
pointBorderColor: 'rgba(0, 0, 0, 0)',
pointBorderWidth: 1,
borderWidth: 1,
pointRadius: 3,
pointHoverRadius: 4,
data: [
23,
75,
60, -48, -9,
26,
45
],
fill: false
}]
},
options: {
responsive: true,
title: {
display: false,
text: 'Line Chart'
},
tooltips: {
mode: 'index',
intersect: false,
},
hover: {
mode: 'nearest',
intersect: true
},
scales: {
xAxes: [{
display: true,
scaleLabel: {
display: false,
labelString: '6 months forecast'
},
gridLines: {
display: true,
color: "#f2f2f2"
},
ticks: {
beginAtZero: true,
fontSize: 11
}
}],
yAxes: [{
display: true,
scaleLabel: {
display: false,
labelString: 'Profit margin (approx)'
},
gridLines: {
display: true,
color: "#f2f2f2"
},
ticks: {
beginAtZero: true,
fontSize: 11
}
}]
}
}
};
new Chart($("#lineChart > canvas").get(0).getContext("2d"), config);
}
/* line chart -- end */
/* area chart */
var areaChart = function(){
var config = {
type: 'line',
data: {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [{
label: "Primary",
backgroundColor: 'rgba(136,106,181, 0.2)',
borderColor: color.primary._500,
pointBackgroundColor: color.primary._700,
pointBorderColor: 'rgba(0, 0, 0, 0)',
pointBorderWidth: 1,
borderWidth: 1,
pointRadius: 3,
pointHoverRadius: 4,
data: [
45,
75,
26,
23,
60, -48, -9
],
fill: true
}, {
label: "Success",
backgroundColor: 'rgba(29,201,183, 0.2)',
borderColor: color.success._500,
pointBackgroundColor: color.success._700,
pointBorderColor: 'rgba(0, 0, 0, 0)',
pointBorderWidth: 1,
borderWidth: 1,
pointRadius: 3,
pointHoverRadius: 4,
data: [-10,
16,
72,
93,
29, -74,
64
],
fill: true
}]
},
options: {
responsive: true,
title: {
display: false,
text: 'Area Chart'
},
tooltips: {
mode: 'index',
intersect: false,
},
hover: {
mode: 'nearest',
intersect: true
},
scales: {
xAxes: [{
display: true,
scaleLabel: {
display: false,
labelString: '6 months forecast'
},
gridLines: {
display: true,
color: "#f2f2f2"
},
ticks: {
beginAtZero: true,
fontSize: 11
}
}],
yAxes: [{
display: true,
scaleLabel: {
display: false,
labelString: 'Profit margin (approx)'
},
gridLines: {
display: true,
color: "#f2f2f2"
},
ticks: {
beginAtZero: true,
fontSize: 11
}
}]
}
}
};
new Chart($("#areaChart > canvas").get(0).getContext("2d"), config);
}
/* area chart -- end */
/* horizontal bar chart */
var horizontalBarChart = function(){
var horizontalBarChart = {
labels: ["January", "February", "March", "April"],
datasets: [{
label: "Red",
backgroundColor: color.success._300,
borderColor: color.success._500,
borderWidth: 1,
data: [
45,
60, -28, -9
]
}, {
label: "Blue",
backgroundColor: color.primary._300,
borderColor: color.primary._500,
borderWidth: 1,
data: [-10,
29, -34,
64
]
}]
};
var config = {
type: 'horizontalBar',
data: horizontalBarChart,
options: {
responsive: true,
legend: {
position: 'top',
},
title: {
display: false,
text: 'Horizontal Bar Chart'
},
scales: {
xAxes: [{
display: true,
scaleLabel: {
display: false,
labelString: 'Profit margin (approx)'
},
gridLines: {
display: true,
color: "#f2f2f2"
},
ticks: {
beginAtZero: true,
fontSize: 11
}
}],
yAxes: [{
display: true,
scaleLabel: {
display: false,
labelString: 'Quarterly forecast'
},
gridLines: {
display: true,
color: "#f2f2f2"
},
ticks: {
beginAtZero: true,
fontSize: 11
}
}]
}
}
}
new Chart($("#horizontalBarChart > canvas").get(0).getContext("2d"), config);
}
/* horizontal bar chart -- end */
/* bar chart */
var barChart = function(){
var barChartData = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [{
label: "Red",
backgroundColor: color.success._300,
borderColor: color.success._500,
borderWidth: 1,
data: [
45,
75,
26,
23,
60, -48, -9
]
}, {
label: "Blue",
backgroundColor: color.primary._300,
borderColor: color.primary._500,
borderWidth: 1,
data: [-10,
16,
72,
93,
29, -74,
64
]
}]
};
var config = {
type: 'bar',
data: barChartData,
options: {
responsive: true,
legend: {
position: 'top',
},
title: {
display: false,
text: 'Bar Chart'
},
scales: {
xAxes: [{
display: true,
scaleLabel: {
display: false,
labelString: '6 months forecast'
},
gridLines: {
display: true,
color: "#f2f2f2"
},
ticks: {
beginAtZero: true,
fontSize: 11
}
}],
yAxes: [{
display: true,
scaleLabel: {
display: false,
labelString: 'Profit margin (approx)'
},
gridLines: {
display: true,
color: "#f2f2f2"
},
ticks: {
beginAtZero: true,
fontSize: 11
}
}]
}
}
}
new Chart($("#barChart > canvas").get(0).getContext("2d"), config);
}
/* bar chart -- end */
/* bar stacked */
var barStacked = function () {
var barStackedData = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [{
label: "Red",
backgroundColor: color.primary._300,
borderColor: color.primary._500,
borderWidth: 1,
data: [
45,
75,
26,
23,
60, -48, -9
]
}, {
label: "Blue",
backgroundColor: color.success._300,
borderColor: color.success._500,
borderWidth: 1,
data: [-10,
16,
72,
93,
29, -74,
64
]
}]
};
var config = {
type: 'bar',
data: barStackedData,
options: {
legend: {
display: false,
labels: {
display: false
}
},
scales: {
yAxes: [{
stacked: true,
gridLines: {
display: true,
color: "#f2f2f2"
},
ticks: {
beginAtZero: true,
fontSize: 11
}
}],
xAxes: [{
stacked: true,
gridLines: {
display: true,
color: "#f2f2f2"
},
ticks: {
beginAtZero: true,
fontSize: 11
}
}]
}
}
}
new Chart($("#barStacked > canvas").get(0).getContext("2d"), config);
}
/* bar stacked -- end */
/* bar horizontal stacked */
var barHorizontalStacked = function () {
var barHorizontalStackedData = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [{
label: "Red",
backgroundColor: color.primary._300,
borderColor: color.primary._500,
borderWidth: 1,
data: [
45,
75,
26,
23,
60, -48, -9
]
}, {
label: "Blue",
backgroundColor: color.success._300,
borderColor: color.success._500,
borderWidth: 1,
data: [-10,
16,
72,
93,
29, -74,
64
]
}]
};
var config = {
type: 'horizontalBar',
data: barHorizontalStackedData,
options: {
legend: {
display: false,
labels: {
display: false
}
},
scales: {
yAxes: [{
stacked: true,
gridLines: {
display: true,
color: "#f2f2f2"
},
ticks: {
beginAtZero: true,
fontSize: 11
}
}],
xAxes: [{
stacked: true,
gridLines: {
display: true,
color: "#f2f2f2"
},
ticks: {
beginAtZero: true,
fontSize: 11
}
}]
}
}
}
new Chart($("#barHorizontalStacked > canvas").get(0).getContext("2d"), config);
}
/* bar horizontal stacked -- end */
/* grid color */
var gridColor = function () {
var config = {
type: 'line',
data: {
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
datasets: [{
data: [10, 24, 20, 25, 35, 50],
backgroundColor: 'rgba(0,0,0, 0.07)',
borderColor: color.fusion._300,
borderWidth: 1,
fill: true
}, {
data: [20, 30, 28, 33, 45, 65],
backgroundColor: 'rgba(0,0,0, 0.03)',
borderColor: color.fusion._100,
borderWidth: 1,
fill: true
}]
},
options: {
legend: {
display: false,
labels: {
display: false
}
},
scales: {
yAxes: [{
gridLines: {
drawBorder: false,
color: ['', color.danger._500, color.success._500]
},
ticks: {
beginAtZero: true,
fontSize: 11,
max: 80
}
}],
xAxes: [{
ticks: {
beginAtZero: true,
fontSize: 11
}
}]
}
}
}
new Chart($("#gridColor > canvas").get(0).getContext("2d"), config);
}
/* grid color -- end */
/* bar & line combine */
var barlineCombine = function(){
var barlineCombineData = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [{
type: 'line',
label: 'Dataset 1',
borderColor: color.danger._300,
pointBackgroundColor: color.danger._500,
pointBorderColor: color.danger._500,
pointBorderWidth: 1,
borderWidth: 2,
pointRadius: 4,
pointHoverRadius: 5,
fill: false,
data: [
-10,
16,
72,
93,
29,
-74,
64
]
}, {
type: 'bar',
label: 'Dataset 2',
backgroundColor: color.primary._300,
borderColor: color.primary._500,
data: [
45,
75,
26,
23,
60,
-48,
-9
],
borderWidth: 1
}, {
type: 'bar',
label: 'Dataset 3',
backgroundColor: color.success._300,
borderColor: color.success._500,
data: [
-10,
16,
72,
93,
29,
-74,
64
],
borderWidth: 1
}]
};
var config = {
type: 'bar',
data: barlineCombineData,
options: {
responsive: true,
legend: {
position: 'top',
},
title: {
display: true,
text: 'Chart.js Bar Chart'
},
scales: {
xAxes: [{
display: true,
scaleLabel: {
display: false,
labelString: '6 months forecast'
},
gridLines: {
display: true,
color: "#f2f2f2"
},
ticks: {
beginAtZero: true,
fontSize: 11
}
}],
yAxes: [{
display: true,
scaleLabel: {
display: false,
labelString: 'Profit margin (approx)'
},
gridLines: {
display: true,
color: "#f2f2f2"
},
ticks: {
beginAtZero: true,
fontSize: 11
}
}]
}
}
}
new Chart($("#barlineCombine > canvas").get(0).getContext("2d"), config);
}
/* bar & line combine -- end */
/* polar area */
var polarArea = function(){
var config = {
type: 'polarArea',
data: {
datasets: [{
data: [
11,
16,
7,
3,
14
],
backgroundColor: [
color.primary._200,
color.primary._400,
color.success._100,
color.success._400,
color.success._600
],
label: 'My dataset' // for legend
}],
labels: [
"USA",
"Germany",
"Austalia",
"Canada",
"France"
]
},
options: {
responsive: true,
legend: {
display: true,
position: 'bottom',
}
}
};
new Chart($("#polarArea > canvas").get(0).getContext("2d"), config);
}
/* polar area -- end */
/* radar chart */
var radarChart = function(){
var config = {
type: "radar",
data: {
labels: ["Eating", "Drinking", "Sleeping", "Designing", "Coding", "Partying", "Running"],
datasets: [{
label: "First",
pointRadius: 4,
borderDashOffset: 2,
backgroundColor: "rgba(136,106,181, 0.2)",
borderColor: "rgba(0,0,0,0)",
pointBackgroundColor: color.primary._500,
pointBorderColor: color.primary._500,
pointHoverBackgroundColor: color.primary._500,
pointHoverBorderColor: color.primary._500,
data: [65, 59, 90, 81, 56, 55, 40]
}, {
label: "Second",
pointRadius: 4,
borderDashOffset: 2,
backgroundColor: "rgba(29,201,183, 0.2)",
borderColor: "rgba(0,0,0,0)",
pointBackgroundColor: color.success._500,
pointBorderColor: color.success._500,
pointHoverBackgroundColor: color.success._500,
pointHoverBorderColor: color.success._500,
data: [28, 48, 40, 19, 96, 27, 100]
}]
},
options: {
responsive: true,
}
}
new Chart($("#radarChart > canvas").get(0).getContext("2d"), config);
}
/* radar chart -- end */
/* bubble chart */
var bubbleChart = function(){
var config = {
type: 'bubble',
data: {
labels: "Africa",
datasets: [{
label: ["China"],
backgroundColor: color.primary._300,
borderColor: color.primary._500,
data: [{
x: 21269017,
y: 5.245,
r: 15
}]
}, {
label: ["Denmark"],
backgroundColor: color.success._300,
borderColor: color.success._500,
data: [{
x: 258702,
y: 7.526,
r: 10
}]
}, {
label: ["Germany"],
backgroundColor: color.info._300,
borderColor: color.info._500,
data: [{
x: 3979083,
y: 6.994,
r: 15
}]
}, {
label: ["Japan"],
backgroundColor: color.danger._300,
borderColor: color.danger._500,
data: [{
x: 4931877,
y: 5.921,
r: 15
}]
}]
},
options: {
title: {
display: true,
text: 'Predicted world population (millions) in 2050'
},
scales: {
yAxes: [{
scaleLabel: {
display: true,
labelString: "Happiness"
}
}],
xAxes: [{
scaleLabel: {
display: true,
labelString: "GDP (PPP)"
}
}]
}
}
}
new Chart($("#bubbleChart > canvas").get(0).getContext("2d"), config);
}
/* bubble chart -- end*/
/* pie chart */
var pieChart = function(){
var config = {
type: 'pie',
data: {
datasets: [{
data: [
11,
16,
7,
3,
14
],
backgroundColor: [
color.primary._200,
color.primary._400,
color.success._50,
color.success._300,
color.success._500
],
label: 'My dataset' // for legend
}],
labels: [
"USA",
"Germany",
"Austalia",
"Canada",
"France"
]
},
options: {
responsive: true,
legend: {
display: true,
position: 'bottom',
}
}
};
new Chart($("#pieChart > canvas").get(0).getContext("2d"), config);
}
/* pie chart -- end */
/* doughnut chart */
var doughnutChart = function(){
var config = {
type: 'doughnut',
data: {
datasets: [{
data: [
11,
16,
7,
3,
14
],
backgroundColor: [
color.success._200,
color.success._400,
color.primary._50,
color.primary._300,
color.primary._500
],
label: 'My dataset' // for legend
}],
labels: [
"USA",
"Germany",
"Austalia",
"Canada",
"France"
]
},
options: {
responsive: true,
legend: {
display: true,
position: 'bottom',
}
}
};
new Chart($("#doughnutChart > canvas").get(0).getContext("2d"), config);
}
/* doughnut chart -- end */
/* initialize all charts */
$(document).ready(function() {
lineChart();
areaChart();
horizontalBarChart();
barChart();
barStacked();
barHorizontalStacked();
bubbleChart();
barlineCombine();
polarArea();
radarChart();
pieChart();
doughnutChart();
});
</script>
} | the_stack |
@model Sheng.WeixinConstruction.Client.Shell.Models.ShakingLotteryViewModel
@{
ViewBag.SubTitle = "活动";
Layout = "~/Views/Shared/_LayoutBlank.cshtml";
}
<style type="text/css">
body {
margin-bottom: 0.55rem;
}
.campaignName {
font-size: 0.14rem;
font-weight: bold;
}
.campaignDescription {
font-size: 0.13rem;
color: #666;
}
#divMemberInfo {
font-size: 0.14rem;
line-height: 0.14rem;
text-align: center;
margin-top: 0.05rem;
}
#divFooter {
position: fixed;
bottom: 0px;
left: 0px;
right: 0px;
height: 0.4rem;
font-size: 0.14rem;
text-align: center;
background-color: #F5F5F5;
}
</style>
@Scripts.Render("~/Scripts/shake.js")
<script>
var _shaking = false;
var _shakeEvent;
var _shakingLayerIndex;
var _campaignId = getQueryString("campaignId");
var _periodId = "";
var _url = '@Request.Url.Scheme://@Request.Url.Host/Campaign/ShakingLottery/@Model.CampaignBundle.Campaign.Domain?campaignId=@Model.CampaignBundle.Campaign.Id';
$(document).ready(function () {
var jsApiConfigStr = "@Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.JsApiConfig)";
jsApiConfigStr = jsApiConfigStr.replace(new RegExp(""", "gm"), "\"");
jsApiConfigStr = jsApiConfigStr.replace(new RegExp("\r\n", "gm"), "");
jsApiConfigStr = jsApiConfigStr.replace(new RegExp("\n", "gm"), "");
var jsApiConfig = eval('(' + jsApiConfigStr + ')');
wx.config(jsApiConfig);
@if (Model.CampaignBundle.ShakingLottery.Mode == Sheng.WeixinConstruction.Infrastructure.EnumCampaign_ShakingLotteryMode.Period)
{
if (Model.CurrentPeriod != null)
{
<text>
_periodId = '@Model.CurrentPeriod.Id';
</text>
}
@*if (Model.PlayedTimes < Model.CampaignBundle.ShakingLottery.ChanceTimes)
{
<text>
initShaking();
</text>
}
}*@
}
@*else
{
if (Model.CampaignBundle.ShakingLottery.Started && Model.PlayedTimes < Model.CampaignBundle.ShakingLottery.ChanceTimes)
{
<text>
initShaking();
</text>
}
}*@
@if (Model.CampaignBundle.Campaign.Status == Sheng.WeixinConstruction.Infrastructure.EnumCampaignStatus.Ongoing) {
//不论当前还有没有机会,都初始化摇一摇
//以便周期切换时或活动开始时可以直接参与,不用重新打开页面
@:initShaking();
}
});
wx.ready(function () {
wx.onMenuShareTimeline({
title: '@Model.CampaignBundle.Campaign.ShareTimelineTitle', // 分享标题
link: '@Request.Url.Scheme://@Request.Url.Host/Campaign/ShakingLottery/@Model.CampaignBundle.Campaign.Domain?campaignId=@Model.CampaignBundle.Campaign.Id', // 分享链接
imgUrl: '@Model.CampaignBundle.Campaign.ShareImageUrl', // 分享图标
success: function () {
shareSuccess("ShareTimeline");
},
cancel: function () {
// 用户取消分享后执行的回调函数
}
});
wx.onMenuShareAppMessage({
title: '@Model.CampaignBundle.Campaign.ShareAppMessageTitle', // 分享标题
desc: '@Model.CampaignBundle.Campaign.ShareAppMessageDescription', // 分享描述
link: '@Request.Url.Scheme://@Request.Url.Host/Campaign/ShakingLottery/@Model.CampaignBundle.Campaign.Domain?campaignId=@Model.CampaignBundle.Campaign.Id', // 分享链接
imgUrl: '@Model.CampaignBundle.Campaign.ShareImageUrl', // 分享图标
type: 'link', // 分享类型,music、video或link,不填默认为link
dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
success: function () {
shareSuccess("ShareAppMessage");
},
cancel: function () {
// 用户取消分享后执行的回调函数
}
});
});
wx.error(function (res) {
alert("error:" + res);
});
function shareSuccess(type) {
var loadLayerIndex = layer.open({
type: 2,
shadeClose: false,
content: '请稍候...'
});
$.ajax({
url: "/Api/Campaign/" + type + "/@ViewBag.Domain.Id?campaignId=" + _campaignId,
type: "POST",
dataType: "json",
success: function (data, status, jqXHR) {
// alert(data);
layer.close(loadLayerIndex);
if (data.Success) {
var resultObj = data.Data;
if (resultObj.Point == 0)
return;
var msg = "";
if (resultObj.Point > 0) {
msg += "获得积分:" + resultObj.Point;
}
if (msg != "") {
layerAlertBtn(msg);
}
} else {
layerAlert(data.Message);
}
},
error: function (xmlHttpRequest) {
layer.close(loadLayerIndex);
//alert("Error: " + xmlHttpRequest.status);
}
});
}
function initShaking() {
if (window.DeviceMotionEvent) {
// 移动浏览器支持运动传感事件
$("#divNotice").html("摇我点我都可以!");
_shakeEvent = new Shake({
threshold: 15, // optional shake strength threshold
timeout: 1000 // optional, determines the frequency of event generation
});
_shakeEvent.start();
window.addEventListener('shake', shake, false);
} else {
// 移动浏览器不支持运动传感事件
$("#divNotice").html("您的手机似乎不支持摇一摇,请点击抽奖!");
}
}
function shake() {
_shakeEvent.stop();
if (_shaking)
return;
_shaking = true;
_shakingLayerIndex = layer.open({
type: 2,
shadeClose: false,
content: '请稍候...'
});
var delay = parseInt(Math.random() * 3000 + 1, 10);
setTimeout("getShakeResult()", delay)
}
function getShakeResult() {
$.ajax({
url: "/Api/Campaign/ShakeShakingLotteryGift/@ViewBag.Domain.Id?campaignId=" + _campaignId + "&periodId=" + _periodId,
type: "POST",
dataType: "json",
success: function (data, status, jqXHR) {
layer.close(_shakingLayerIndex);
if (data.Success) {
var resultObj = data.Data;
layerAlertBtn("恭喜!您摇得:<br/>" + resultObj.Name, function () {
compulsorilyReload(_url);
});
} else {
//防止多次进入摇动,在提示后自动刷新一下
//用完机会,没有中奖也走这里进入提示
layerAlertBtn(data.Message, function () {
compulsorilyReload(_url);
});
}
},
error: function (xmlHttpRequest) {
layer.close(_shakingLayerIndex);
// alert("Error: " + xmlHttpRequest.status);
}
});
}
function showCampaignDescription() {
var loadLayerIndex = layer.open({
type: 2,
shadeClose: false,
content: '请稍候...'
});
$.ajax({
url: "/Api/Campaign/GetCampaignDescription/@ViewBag.Domain.Id?id=" + _campaignId,
type: "POST",
dataType: "json",
success: function (data, status, jqXHR) {
layer.close(loadLayerIndex);
if (data.Success) {
var resultObj = data.Data;
var gettpl = document.getElementById('campaignDescription').innerHTML;
laytpl(gettpl).render(resultObj, function (html) {
var pageii = layer.open({
type: 1,
content: html,
shadeClose: false,
style: 'position:fixed; left:0.1rem; top:0.1rem;right:0.1rem; bottom:0.1rem; border:none;'
});
});
} else {
layerAlert(data.Message);
}
},
error: function (xmlHttpRequest) {
layer.close(loadLayerIndex);
//alert("Error: " + xmlHttpRequest.status);
}
});
}
</script>
<script type="text/html" id="campaignDescription">
<div style="position: fixed; top: 0.1rem; left: 0.1rem; right: 0.1rem; bottom: 0.45rem; overflow: auto;">
{{ d }}
</div>
<div style="position: fixed; bottom: 0.1rem; left: 0.1rem; right: 0.1rem;">
<div class="divRectangle_Gray" style="margin-top: 0.1rem; " onclick="layer.closeAll()">
关 闭
</div>
</div>
</script>
<div id="divImageContainer">
<img src="@Model.CampaignBundle.Campaign.ImageUrl" name="img" id="img" style="width: 100%;">
</div>
<div class="divContent">
<div style="margin-top: 0.06rem" class="campaignName">
@Model.CampaignBundle.Campaign.Name
</div>
<div style="margin-top: 0.06rem" class="campaignDescription">
@Html.Raw(Model.CampaignBundle.Campaign.Introduction)
</div>
<div class="divDotLine" style="margin-top:0.05rem; margin-top:0.1rem; margin-bottom:0.05rem;">
</div>
<div style="text-align: center; margin-top: 0.1rem;">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="33%" align="center">
参与人次<br />
<span class="defaultColor" style="font-weight:bold">@Model.DataReport.MemberCount</span>
</td>
<td width="33%" align="center">
中奖人次<br />
<span class="defaultColor" style="font-weight:bold">@Model.DataReport.LuckyMemberCount</span>
</td>
<td width="33%" align="center">
围观次数<br />
<span class="defaultColor" style="font-weight:bold">@Model.DataReport.PageVisitCount</span>
</td>
</tr>
</table>
</div>
<div class="divDotLine" style="margin-top:0.05rem; margin-top:0.1rem; margin-bottom:0.05rem;">
</div>
<div style="font-size:0.13rem;" onclick="goUrl('/Home/PersonalInfo/@ViewBag.Domain.Id')">
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="/Content/Images/personalIcon.png" style="width:0.5rem;"></td>
<td>点这里完善个人信息<br />以便中奖后工作人员与您联系</td>
</tr>
</table>
</div>
<div class="divDotLine" style="margin-top:0.05rem; margin-bottom:0.1rem;">
</div>
@if (Model.CampaignBundle.Campaign.Status == Sheng.WeixinConstruction.Infrastructure.EnumCampaignStatus.Preparatory ||
Model.CampaignBundle.Campaign.Status == Sheng.WeixinConstruction.Infrastructure.EnumCampaignStatus.End)
{
<div style="color:#FF0000;text-align:center;margin-top:0.1rem;">
@if (Model.CampaignBundle.Campaign.Status == Sheng.WeixinConstruction.Infrastructure.EnumCampaignStatus.Preparatory)
{
@:活动尚未开始。
}
else
{
@:活动已结束。
}
</div>
}
else
{
if (Model.CampaignBundle.ShakingLottery.Mode == Sheng.WeixinConstruction.Infrastructure.EnumCampaign_ShakingLotteryMode.Period)
{
if (Model.CurrentPeriod == null)
{
<div style="color:#FF0000;text-align:center;margin-top:0.1rem;">
摇奖即将开始<br />请留意主持人的通知哦~
</div>
<div style="text-align:center;margin-top:0.1rem;">
<input type="button" value="点击刷新" class="button" onclick="compulsorilyReload(_url)" />
</div>
}
else
{
<div style="color:#FF0000;text-align:center;">
@Model.CurrentPeriod.Name
</div>
if (Model.PlayedTimes < Model.CampaignBundle.ShakingLottery.ChanceTimes)
{
<div style="text-align:center;margin-top:0.1rem;">
<img src="/Content/Images/shaking.jpg" style="max-width:65%;margin-top:0.1rem;" onclick="shake()" />
</div>
<div id="divNotice" class="defaultColor" style="text-align:center;margin-top:0.1rem; " onclick="shake()">
摇我点我都可以~
</div>
<div class="defaultColor" style="text-align:center;margin-top:0.1rem; ">
您还有 @(Model.CampaignBundle.ShakingLottery.ChanceTimes - Model.PlayedTimes) 次机会哦~
</div>
}
else
{
<div style="color:#FF0000;text-align:center;margin-top:0.1rem;">
您已用完全部摇奖机会~
</div>
}
}
}
else
{
if (Model.CampaignBundle.ShakingLottery.Started)
{
if (Model.PlayedTimes < Model.CampaignBundle.ShakingLottery.ChanceTimes)
{
<div style="text-align:center">
<img src="/Content/Images/shaking.jpg" style="max-width:65%;margin-top:0.1rem;" onclick="shake()" />
</div>
<div id="divNotice" class="defaultColor" style="text-align:center;margin-top:0.1rem; " onclick="shake()">
摇我点我都可以~
</div>
<div class="defaultColor" style="text-align:center;margin-top:0.1rem; ">
您还有 @(Model.CampaignBundle.ShakingLottery.ChanceTimes - Model.PlayedTimes) 次机会哦~
</div>
}
else
{
<div style="color:#FF0000;">
您已用完全部摇奖机会~
</div>
}
}
else
{
<div style="color:#FF0000;text-align:center;margin-top:0.1rem;">
摇奖即将开始<br />请留意主持人的通知哦~
</div>
<div style="text-align:center;margin-top:0.1rem;">
<input type="button" value="点击刷新" class="button" onclick="compulsorilyReload(_url)" />
</div>
}
}
}
<div style="text-align:center;margin-top:0.15rem;">
@if (Model.GiftList != null && Model.GiftList.Count > 0)
{
<div style="font-weight:bold;color:#FF0000;">
恭喜中奖,您已中得以下奖品:
</div>
foreach (var item in Model.GiftList)
{
<div style="color:#FF0000;margin-top:0.05rem; font-size:0.15rem;">
@item.Name
</div>
<div>
<img src="@item.ImageUrl" style="max-width:65%" />
</div>
}
}
</div>
</div>
<div id="divFooter">
<table align="center" border="0" style="height:100%;width:100%">
<tr>
<td valign="middle" align="center" width="50%">
<input name="" type="button" class="button" value="活动说明" style="width:90%" onclick="showCampaignDescription()">
</td>
<!--<td valign="middle" align="center" width="50%">
<input name="" type="button" class="button" value="中奖记录" style="width:90%">
</td>-->
</tr>
</table>
</div> | the_stack |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.