This commit is contained in:
@@ -76,7 +76,8 @@ namespace rockfishCore.Controllers
|
|||||||
return NotFound();
|
return NotFound();
|
||||||
//DO APPROVE
|
//DO APPROVE
|
||||||
//check not already processed and ignore if so
|
//check not already processed and ignore if so
|
||||||
if(trial.DtProcessed!=null){
|
if (trial.DtProcessed != null)
|
||||||
|
{
|
||||||
//already processed, nothing to do here
|
//already processed, nothing to do here
|
||||||
return BadRequest("Already processed");
|
return BadRequest("Already processed");
|
||||||
}
|
}
|
||||||
@@ -108,7 +109,8 @@ namespace rockfishCore.Controllers
|
|||||||
return NotFound();
|
return NotFound();
|
||||||
//DO REJECT
|
//DO REJECT
|
||||||
//check not already processed and ignore if so
|
//check not already processed and ignore if so
|
||||||
if(trial.DtProcessed!=null){
|
if (trial.DtProcessed != null)
|
||||||
|
{
|
||||||
//already processed, nothing to do here
|
//already processed, nothing to do here
|
||||||
return BadRequest("Already processed");
|
return BadRequest("Already processed");
|
||||||
}
|
}
|
||||||
@@ -120,12 +122,13 @@ namespace rockfishCore.Controllers
|
|||||||
|
|
||||||
//send approved email to user
|
//send approved email to user
|
||||||
string reason = string.Empty;
|
string reason = string.Empty;
|
||||||
if(!string.IsNullOrWhiteSpace(rejectReason)){
|
if (!string.IsNullOrWhiteSpace(rejectReason))
|
||||||
|
{
|
||||||
reason = $"The request was rejected due to:\r\n{rejectReason}";
|
reason = $"The request was rejected due to:\r\n{rejectReason}";
|
||||||
}
|
}
|
||||||
var body = $"Your trial license request was not approved.\r\n{reason}";
|
var body = $"Your trial license request was not approved.\r\n{reason}";
|
||||||
//send confirmation email
|
//send confirmation email
|
||||||
RfMail.SendMessage("support@ayanova.com", trial.Email, "AyaNova trial request approved", body, false);
|
RfMail.SendMessage("support@ayanova.com", trial.Email, "AyaNova trial request not approved", body, false);
|
||||||
|
|
||||||
return Ok(trial);
|
return Ok(trial);
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ app.api = (function () {
|
|||||||
update,
|
update,
|
||||||
uploadFile,
|
uploadFile,
|
||||||
putAction,
|
putAction,
|
||||||
|
postAction,
|
||||||
createLicense,
|
createLicense,
|
||||||
getLicenseRequests,
|
getLicenseRequests,
|
||||||
generateFromRequest,
|
generateFromRequest,
|
||||||
@@ -73,7 +74,7 @@ app.api = (function () {
|
|||||||
error: function (jqXHR, textStatus, errorThrown) {
|
error: function (jqXHR, textStatus, errorThrown) {
|
||||||
callback({
|
callback({
|
||||||
error: 1,
|
error: 1,
|
||||||
msg: textStatus + "\n" + errorThrown,
|
msg: textStatus + "\n" + jqXHR.responseText + "\n" + errorThrown,
|
||||||
error_detail: {}
|
error_detail: {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -96,7 +97,7 @@ app.api = (function () {
|
|||||||
error: function (jqXHR, textStatus, errorThrown) {
|
error: function (jqXHR, textStatus, errorThrown) {
|
||||||
callback({
|
callback({
|
||||||
error: 1,
|
error: 1,
|
||||||
msg: textStatus + "\n" + errorThrown,
|
msg: textStatus + "\n" + jqXHR.responseText + "\n" + errorThrown,
|
||||||
error_detail: {}
|
error_detail: {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -135,7 +136,7 @@ app.api = (function () {
|
|||||||
error: function (jqXHR, textStatus, errorThrown) {
|
error: function (jqXHR, textStatus, errorThrown) {
|
||||||
callback({
|
callback({
|
||||||
error: 1,
|
error: 1,
|
||||||
msg: textStatus + "\n" + errorThrown,
|
msg: textStatus + "\n" + jqXHR.responseText + "\n" + errorThrown,
|
||||||
error_detail: {}
|
error_detail: {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -156,7 +157,7 @@ app.api = (function () {
|
|||||||
error: function (jqXHR, textStatus, errorThrown) {
|
error: function (jqXHR, textStatus, errorThrown) {
|
||||||
callback({
|
callback({
|
||||||
error: 1,
|
error: 1,
|
||||||
msg: textStatus + "\n" + errorThrown,
|
msg: textStatus + "\n" + jqXHR.responseText + "\n" + errorThrown,
|
||||||
error_detail: {}
|
error_detail: {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -210,7 +211,7 @@ app.api = (function () {
|
|||||||
error: function (jqXHR, textStatus, errorThrown) {
|
error: function (jqXHR, textStatus, errorThrown) {
|
||||||
callback({
|
callback({
|
||||||
error: 1,
|
error: 1,
|
||||||
msg: textStatus + "\n" + errorThrown,
|
msg: textStatus + "\n" + jqXHR.responseText + "\n" + errorThrown,
|
||||||
error_detail: {}
|
error_detail: {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -237,7 +238,7 @@ app.api = (function () {
|
|||||||
error: function (jqXHR, textStatus, errorThrown) {
|
error: function (jqXHR, textStatus, errorThrown) {
|
||||||
callback({
|
callback({
|
||||||
error: 1,
|
error: 1,
|
||||||
msg: textStatus + "\n" + errorThrown,
|
msg: textStatus + "\n" + jqXHR.responseText + "\n" + errorThrown,
|
||||||
error_detail: {}
|
error_detail: {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,29 +8,29 @@
|
|||||||
/*global $, app */
|
/*global $, app */
|
||||||
|
|
||||||
app.trialEdit = (function () {
|
app.trialEdit = (function () {
|
||||||
'use strict';
|
"use strict";
|
||||||
//---------------- BEGIN MODULE SCOPE VARIABLES --------------
|
//---------------- BEGIN MODULE SCOPE VARIABLES --------------
|
||||||
var
|
var stateMap = {},
|
||||||
stateMap = {},
|
onApprove,
|
||||||
onApprove, onReject, onDelete,
|
onReject,
|
||||||
configModule, initModule;
|
onDelete,
|
||||||
|
configModule,
|
||||||
|
initModule;
|
||||||
//----------------- END MODULE SCOPE VARIABLES ---------------
|
//----------------- END MODULE SCOPE VARIABLES ---------------
|
||||||
|
|
||||||
|
|
||||||
//------------------- BEGIN EVENT HANDLERS -------------------
|
//------------------- BEGIN EVENT HANDLERS -------------------
|
||||||
|
|
||||||
//ONAPPROVE
|
//ONAPPROVE
|
||||||
//
|
//
|
||||||
onApprove = function (event) {
|
onApprove = function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$.gevent.publish('app-clear-error');
|
$.gevent.publish("app-clear-error");
|
||||||
|
|
||||||
var isFetched=$('#fetched').prop('checked')
|
app.api.postAction("trial/approve/" + stateMap.id, function (res) {
|
||||||
|
|
||||||
|
|
||||||
app.api.postAction('trial/fetched/' + stateMap.id + "/" + isFetched, function (res) {
|
|
||||||
if (res.error) {
|
if (res.error) {
|
||||||
$.gevent.publish('app-show-error', res.msg);
|
$.gevent.publish("app-show-error", res.msg);
|
||||||
|
} else {
|
||||||
|
app.utilB.formData(res);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -41,49 +41,55 @@ app.trialEdit = (function () {
|
|||||||
//
|
//
|
||||||
onReject = function (event) {
|
onReject = function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$.gevent.publish('app-clear-error');
|
$.gevent.publish("app-clear-error");
|
||||||
|
|
||||||
var isFetched=$('#fetched').prop('checked')
|
var reason = $("#rejectReason").val();
|
||||||
|
if (reason) {
|
||||||
// var submitData = { isFetched: isFetched };
|
reason = "?rejectReason=" + reason;
|
||||||
app.api.putAction('trial/fetched/' + stateMap.id + "/" + isFetched, function (res) {
|
}
|
||||||
|
var r = confirm("Are you sure you want to reject this request?");
|
||||||
|
if (r == true) {
|
||||||
|
app.api.postAction("trial/reject/" + stateMap.id + reason, function (
|
||||||
|
res
|
||||||
|
) {
|
||||||
if (res.error) {
|
if (res.error) {
|
||||||
$.gevent.publish('app-show-error', res.msg);
|
$.gevent.publish("app-show-error", res.msg);
|
||||||
|
} else {
|
||||||
|
app.utilB.formData(res);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return false; //prevent default?
|
return false; //prevent default?
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//ONDELETE
|
//ONDELETE
|
||||||
//
|
//
|
||||||
onDelete = function (event) {
|
onDelete = function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$.gevent.publish('app-clear-error');
|
$.gevent.publish("app-clear-error");
|
||||||
var r = confirm("Are you sure you want to delete this record?");
|
var r = confirm("Are you sure you want to delete this record?");
|
||||||
if (r == true) {
|
if (r == true) {
|
||||||
app.api.remove('trial/' + stateMap.id, function (res) {
|
app.api.remove("trial/" + stateMap.id, function (res) {
|
||||||
if (res.error) {
|
if (res.error) {
|
||||||
$.gevent.publish('app-show-error', res.msg);
|
$.gevent.publish("app-show-error", res.msg);
|
||||||
} else {
|
} else {
|
||||||
page('#!/trials');
|
page("#!/trials");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return false; //prevent default?
|
return false; //prevent default?
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//-------------------- END EVENT HANDLERS --------------------
|
//-------------------- END EVENT HANDLERS --------------------
|
||||||
|
|
||||||
//------------------- BEGIN PUBLIC METHODS -------------------
|
//------------------- BEGIN PUBLIC METHODS -------------------
|
||||||
|
|
||||||
|
|
||||||
//CONFIGMODULE
|
//CONFIGMODULE
|
||||||
//
|
//
|
||||||
configModule = function (context) {
|
configModule = function (context) {
|
||||||
@@ -96,18 +102,18 @@ app.trialEdit = (function () {
|
|||||||
//INITMODULE
|
//INITMODULE
|
||||||
//
|
//
|
||||||
initModule = function ($container) {
|
initModule = function ($container) {
|
||||||
if (typeof $container === 'undefined') {
|
if (typeof $container === "undefined") {
|
||||||
$container = $('#app-shell-main-content');
|
$container = $("#app-shell-main-content");
|
||||||
}
|
}
|
||||||
|
|
||||||
$container.html(Handlebars.templates['app.trialEdit']({}));
|
$container.html(Handlebars.templates["app.trialEdit"]({}));
|
||||||
|
|
||||||
document.title = 'trial ';
|
document.title = "trial ";
|
||||||
|
|
||||||
//fetch existing record
|
//fetch existing record
|
||||||
app.api.get('trial/' + stateMap.id, function (res) {
|
app.api.get("trial/" + stateMap.id, function (res) {
|
||||||
if (res.error) {
|
if (res.error) {
|
||||||
$.gevent.publish('app-show-error', res.msg);
|
$.gevent.publish("app-show-error", res.msg);
|
||||||
} else {
|
} else {
|
||||||
//fill out form
|
//fill out form
|
||||||
app.utilB.formData(res);
|
app.utilB.formData(res);
|
||||||
@@ -117,14 +123,12 @@ app.trialEdit = (function () {
|
|||||||
app.nav.contextClear();
|
app.nav.contextClear();
|
||||||
app.nav.contextAddLink("trials/", "List", "");
|
app.nav.contextAddLink("trials/", "List", "");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// bind actions
|
// bind actions
|
||||||
$('#btn-save').bind('click', onSave);
|
$("#btn-reject").bind("click", onReject);
|
||||||
$('#btn-delete').bind('click', onDelete);
|
$("#btn-approve").bind("click", onApprove);
|
||||||
|
$("#btn-delete").bind("click", onDelete);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// RETURN PUBLIC METHODS
|
// RETURN PUBLIC METHODS
|
||||||
//
|
//
|
||||||
return {
|
return {
|
||||||
@@ -132,4 +136,4 @@ app.trialEdit = (function () {
|
|||||||
initModule: initModule
|
initModule: initModule
|
||||||
};
|
};
|
||||||
//------------------- END PUBLIC METHODS ---------------------
|
//------------------- END PUBLIC METHODS ---------------------
|
||||||
}());
|
})();
|
||||||
|
|||||||
Reference in New Issue
Block a user