This commit is contained in:
2020-06-09 23:55:55 +00:00
parent 67b6985a5b
commit 290f806757
3 changed files with 47 additions and 43 deletions

View File

@@ -71,6 +71,8 @@
<script src="js/app.rfcases.js?rfv=6.9"></script> <script src="js/app.rfcases.js?rfv=6.9"></script>
<script src="js/app.rfsettings.js?rfv=6.9"></script> <script src="js/app.rfsettings.js?rfv=6.9"></script>
<script src="js/app.ops.js?rfv=6.9"></script> <script src="js/app.ops.js?rfv=6.9"></script>
<script src="js/app.trials.js?rfv=6.9"></script>
<script src="js/app.trialEdit.js?rfv=6.9"></script>
<!-- handlebars templates --> <!-- handlebars templates -->
<script src="js/templates/templates.js?rfv=6.9"></script> <script src="js/templates/templates.js?rfv=6.9"></script>

View File

@@ -12,11 +12,26 @@ app.trials = (function() {
//---------------- BEGIN MODULE SCOPE VARIABLES -------------- //---------------- BEGIN MODULE SCOPE VARIABLES --------------
var stateMap = {}, var stateMap = {},
configModule, configModule,
initModule; initModule,
statusText;
//----------------- END MODULE SCOPE VARIABLES --------------- //----------------- END MODULE SCOPE VARIABLES ---------------
//------------------- BEGIN UTILITY METHODS ------------------ //------------------- BEGIN UTILITY METHODS ------------------
//////////////////
//Generate a card with collapsible middle section with more details
//
statusText = function (obj) {
switch (obj.status) {
case 0:
return "NEW";
case 1:
return "approved";
case 2:
return "rejected";
default:
return "BAD STATUS: " + obj.status;
}
};
//-------------------- END UTILITY METHODS ------------------- //-------------------- END UTILITY METHODS -------------------
//------------------- BEGIN EVENT HANDLERS ------------------- //------------------- BEGIN EVENT HANDLERS -------------------
@@ -42,7 +57,7 @@ app.trials = (function() {
$container.html(Handlebars.templates["app.trials"]({})); $container.html(Handlebars.templates["app.trials"]({}));
//case 3513 //case 3513
document.title = "trials"; document.title = "Trial requests";
//=================== //===================
//Get trials //Get trials
@@ -52,46 +67,33 @@ app.trials = (function() {
} else { } else {
var $appList = $("#rf-list"); var $appList = $("#rf-list");
if (res.length == 0) {
$appList.append("<h4>NO DATA :(</h4>");
} else {
$appList.append('<ul class="list-group">'); $appList.append('<ul class="list-group">');
$.each(res, function (i, obj) { $.each(res, function (i, obj) {
if (obj.fetched) {
$appList.append( $appList.append(
"<li class='rfc-list-item-inactive list-group-item'><a href=\"#!/trialView/" + "<li class='list-group-item'><a href=\"#!/trialEdit/" +
obj.id + obj.id +
'">' + '">' +
"<span class='text-muted'>" +
(obj.trial
? "Trial "
: "") +
app.utilB.genListColumn(obj.regto) +
"&nbsp;&nbsp;" +
app.utilB.genListColumn( app.utilB.genListColumn(
app.utilB.epochToShortDate(obj.created) obj.companyName + "&nbsp;" + obj.contactName
) +
app.utilB.genListColumn(
obj.companyName + "&nbsp;" + obj.contactName
) + ) +
"</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;" + "&nbsp;&nbsp;" +
app.utilB.genListColumn( app.utilB.genListColumn(
app.utilB.epochToShortDate(obj.created) app.utilB.epochToShortDate(obj.dtRequested)
) + ) +
"</a></li>" "</a></li>"
); );
}
}); });
$appList.append("</ul>"); $appList.append("</ul>");
} }
}
}); });
//=========/trials============== //=========/trials==============

File diff suppressed because one or more lines are too long