This commit is contained in:
2020-06-09 23:31:00 +00:00
parent 4021f5a108
commit 25c9c2661e
10 changed files with 544 additions and 8 deletions

View File

@@ -238,6 +238,8 @@ app.shell = (function () {
page('/rfcaseEdit/:id', rfcaseEdit);
page('/rfsettings', rfsettings);
page('/ops', ops);
page('/trials', trials);
page('/trialEdit/:id', trialEdit);
page('*', notFound);
page({
hashbang: true
@@ -549,6 +551,25 @@ app.shell = (function () {
}
//case 3233
var trials = function (ctx) {
app.nav.setSelectedMenuItem('trials');
app.trials.configModule({
context: ctx
});
app.trials.initModule();
}
//case 3233
var trialEdit = function (ctx) {
app.nav.setSelectedMenuItem('trials');
app.trialEdit.configModule({
context: ctx
});
app.trialEdit.initModule();
}
var notFound = function (ctx) {
app.fourohfour.configModule({
context: ctx

116
wwwroot/js/app.trialEdit.js Normal file
View File

@@ -0,0 +1,116 @@
/*jslint browser : true, continue : true,
devel : true, indent : 2, maxerr : 50,
newcap : true, nomen : true, plusplus : true,
regexp : true, sloppy : true, vars : false,
white : true
*/
/*global $, app */
app.trialEdit = (function () {
'use strict';
//---------------- BEGIN MODULE SCOPE VARIABLES --------------
var
stateMap = {},
onSave, onDelete,
configModule, initModule;
//----------------- END MODULE SCOPE VARIABLES ---------------
//------------------- BEGIN EVENT HANDLERS -------------------
//ONSAVE
//
onSave = function (event) {
event.preventDefault();
$.gevent.publish('app-clear-error');
var isFetched=$('#fetched').prop('checked')
// var submitData = { isFetched: isFetched };
app.api.putAction('trial/fetched/' + stateMap.id + "/" + isFetched, function (res) {
if (res.error) {
$.gevent.publish('app-show-error', res.msg);
}
});
return false; //prevent default?
};
//ONDELETE
//
onDelete = function (event) {
event.preventDefault();
$.gevent.publish('app-clear-error');
var r = confirm("Are you sure you want to delete this record?");
if (r == true) {
app.api.remove('trial/' + stateMap.id, function (res) {
if (res.error) {
$.gevent.publish('app-show-error', res.msg);
} else {
page('#!/trials');
return false;
}
});
} else {
return false;
}
return false; //prevent default?
};
//-------------------- END EVENT HANDLERS --------------------
//------------------- BEGIN PUBLIC METHODS -------------------
//CONFIGMODULE
//
configModule = function (context) {
stateMap.context = context.context;
if (stateMap.context.params.id) {
stateMap.id = stateMap.context.params.id;
}
};
//INITMODULE
//
initModule = function ($container) {
if (typeof $container === 'undefined') {
$container = $('#app-shell-main-content');
}
$container.html(Handlebars.templates['app.trialEdit']({}));
document.title = 'trial ';
//fetch existing record
app.api.get('trial/' + stateMap.id, function (res) {
if (res.error) {
$.gevent.publish('app-show-error', res.msg);
} else {
//fill out form
app.utilB.formData(res);
}
});
//Context menu
app.nav.contextClear();
app.nav.contextAddLink("trials/", "List", "");
// bind actions
$('#btn-save').bind('click', onSave);
$('#btn-delete').bind('click', onDelete);
};
// RETURN PUBLIC METHODS
//
return {
configModule: configModule,
initModule: initModule
};
//------------------- END PUBLIC METHODS ---------------------
}());

108
wwwroot/js/app.trials.js Normal file
View File

@@ -0,0 +1,108 @@
/*jslint browser : true, continue : true,
devel : true, indent : 2, maxerr : 50,
newcap : true, nomen : true, plusplus : true,
regexp : true, sloppy : true, vars : false,
white : true
*/
/*global $, app */
app.trials = (function() {
"use strict";
//---------------- BEGIN MODULE SCOPE VARIABLES --------------
var stateMap = {},
configModule,
initModule;
//----------------- END MODULE SCOPE VARIABLES ---------------
//------------------- BEGIN UTILITY METHODS ------------------
//-------------------- END UTILITY METHODS -------------------
//------------------- BEGIN EVENT HANDLERS -------------------
//-------------------- END EVENT HANDLERS --------------------
//------------------- BEGIN PUBLIC METHODS -------------------
//CONFIGMODULE
//
configModule = function(context) {
stateMap.context = context.context;
if (stateMap.context.params.id) {
stateMap.id = stateMap.context.params.id;
}
};
//INITMODULE
//
initModule = function($container) {
if (typeof $container === "undefined") {
$container = $("#app-shell-main-content");
}
$container.html(Handlebars.templates["app.trials"]({}));
//case 3513
document.title = "trials";
//===================
//Get trials
app.api.get("trial/list", function(res) {
if (res.error) {
$.gevent.publish("app-show-error", res.msg);
} else {
var $appList = $("#rf-list");
$appList.append('<ul class="list-group">');
$.each(res, function(i, obj) {
if (obj.fetched) {
$appList.append(
"<li class='rfc-list-item-inactive list-group-item'><a href=\"#!/trialView/" +
obj.id +
'">' +
"<span class='text-muted'>" +
(obj.trial
? "Trial "
: "") +
app.utilB.genListColumn(obj.regto) +
"&nbsp;&nbsp;" +
app.utilB.genListColumn(
app.utilB.epochToShortDate(obj.created)
) +
"</span>" +
"</a></li>"
);
} else {
$appList.append(
"<li class='list-group-item'><a href=\"#!/trialView/" +
obj.id +
'">' +
(obj.trial
? "Trial "
: "") +
app.utilB.genListColumn(obj.regto) +
"&nbsp;&nbsp;" +
app.utilB.genListColumn(
app.utilB.epochToShortDate(obj.created)
) +
"</a></li>"
);
}
});
$appList.append("</ul>");
}
});
//=========/trials==============
app.nav.contextClear();
};
//PUBLIC METHODS
//
return {
configModule: configModule,
initModule: initModule
};
//------------------- END PUBLIC METHODS ---------------------
})();

View File

@@ -1,9 +1,9 @@
<nav id="rf-nav" class="navbar fixed-top navbar-expand-lg navbar-dark" style="background-color: #00205B;">
{{!-- navbar-dark bg-success --}}
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
{{!-- navbar-dark bg-success --}}
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
@@ -16,6 +16,10 @@
<a class="rfac nav-link mdi mdi-contacts" href="#!/customers">Customers </a>
</li>
<li id="trials" class="nav-item">
<a class="rfac nav-link mdi mdi-voice" href="#!/trials">Trial requests </a>
</li>
<li id="subscriptions" class="nav-item">
<a class="rfac nav-link mdi mdi-basket" href="#!/subscription">Subscriptions </a>
</li>
@@ -28,7 +32,7 @@
<a class="rfac nav-link mdi mdi-bug" href="#!/rfcases">Cases </a>
</li>
<li id="rfops" class="nav-item">
<li id="rfops" class="nav-item">
<a class="rfac nav-link mdi mdi-server-network" href="#!/ops">Server Ops </a>
</li>

View File

@@ -0,0 +1,56 @@
<div>
<form id="frm" method="post" action="index.html">
<div class="form-group">
<label for="regTo">Registered to</label>
<input class="form-control" type="text" id="regTo" name="regTo" value="" readonly>
</div>
<div class="form-group">
<label for="customerName">Rockfish customer name</label>
<input class="form-control" type="text" id="customerName" name="customerName" value="" readonly>
</div>
<div class="form-group">
<label for="dtcreated">Created</label>
<input class="form-control" type="date" id="dtcreated" name="dtcreated" value="" readonly>
</div>
<div class="form-group">
<label for="email">Email</label>
<input class="form-control" type="text" id="email" name="email" value="" readonly>
</div>
<div class="form-group">
<label for="code">Fetch code</label>
<input class="form-control" type="text" id="code" name="code" value="" readonly>
</div>
<div class="form-check">
<label class="form-check-label text-success font-weight-bold" for="fetched">
<input class="form-check-input" type="checkbox" name="fetched" id="fetched"> License fetched</label>
</div>
<div class="form-group">
<label for="dtFetched">Fetched on</label>
<input class="form-control" type="date" id="dtfetched" name="dtfetched" value="" readonly>
</div>
{{!-- <div class="form-group">
<label for="fetchFrom">Fetched from</label>
<input class="form-control" type="text" id="fetchFrom" name="fetchFrom" value="" readonly>
</div> --}}
<div class="form-group">
<label for="key">Key</label>
<textarea class="form-control form-control-lg" id="key" name="key" rows="10" readonly/>
</div>
<div class="app-frm-buttons mt-5">
<button id="btn-save" class="btn btn-success">Save</button>
<button id="btn-delete" class="btn btn-outline-dark">Delete</button>
</div>
</form>
</div>

View File

@@ -0,0 +1,3 @@
<div>
<div id="rf-list" class="rf-list"/>
</div>

File diff suppressed because one or more lines are too long