This commit is contained in:
@@ -94,14 +94,25 @@ namespace rockfishCore.Controllers
|
|||||||
return BadRequest(ModelState);
|
return BadRequest(ModelState);
|
||||||
}
|
}
|
||||||
|
|
||||||
var ret = await ct.Site
|
var ret = await ct.Site.AsNoTracking()
|
||||||
.Select(r => new { r.Id, r.Name, r.CustomerId })
|
.Select(r => new { r.Id, r.Name, r.CustomerId })
|
||||||
.Where(r => r.Id == id)
|
.Where(r => r.Id == id)
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
return Ok(ret);
|
return Ok(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Get api/site/77/name
|
||||||
|
[HttpGet("{id}/customerinfo")]
|
||||||
|
public async Task<IActionResult> GetCustomerInfo([FromRoute] long id)
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return BadRequest(ModelState);
|
||||||
|
}
|
||||||
|
var custId = await ct.Site.AsNoTracking().Where(z => z.Id == id).Select(z => z.CustomerId).FirstAsync();
|
||||||
|
var custInfo = await ct.Customer.AsNoTracking().Where(z => z.Id == custId).Select(z => new { z.Name, z.Id }).SingleAsync();
|
||||||
|
return Ok(custInfo);
|
||||||
|
}
|
||||||
|
|
||||||
// GET: api/Site
|
// GET: api/Site
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
|||||||
@@ -13,17 +13,17 @@
|
|||||||
/*global $, app */
|
/*global $, app */
|
||||||
|
|
||||||
app.ravLicense = (function () {
|
app.ravLicense = (function () {
|
||||||
'use strict';
|
"use strict";
|
||||||
//---------------- BEGIN MODULE SCOPE VARIABLES --------------
|
//---------------- BEGIN MODULE SCOPE VARIABLES --------------
|
||||||
var
|
var stateMap = {},
|
||||||
|
configModule,
|
||||||
|
initModule,
|
||||||
|
onGenerate;
|
||||||
|
//----------------- END MODULE SCOPE VARIABLES ---------------
|
||||||
|
|
||||||
stateMap = {},
|
//------------------- BEGIN UTILITY METHODS ------------------
|
||||||
configModule, initModule, onGenerate;
|
//-------------------- END UTILITY METHODS -------------------
|
||||||
//----------------- END MODULE SCOPE VARIABLES ---------------
|
/*
|
||||||
|
|
||||||
//------------------- BEGIN UTILITY METHODS ------------------
|
|
||||||
//-------------------- END UTILITY METHODS -------------------
|
|
||||||
/*
|
|
||||||
public class dtoRavLicense
|
public class dtoRavLicense
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
@@ -54,140 +54,132 @@ app.ravLicense = (function () {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//------------------- BEGIN EVENT HANDLERS -------------------
|
//------------------- BEGIN EVENT HANDLERS -------------------
|
||||||
onGenerate = function (event) {
|
onGenerate = function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
$.gevent.publish("app-clear-error");
|
||||||
|
//get form data
|
||||||
|
var formData = $("form").serializeArray({
|
||||||
|
checkboxesAsBools: true
|
||||||
|
});
|
||||||
|
|
||||||
event.preventDefault();
|
var submitData = app.utilB.objectifyFormDataArray(formData);
|
||||||
$.gevent.publish('app-clear-error');
|
|
||||||
//get form data
|
|
||||||
var formData = $("form").serializeArray({
|
|
||||||
checkboxesAsBools: true
|
|
||||||
});
|
|
||||||
|
|
||||||
var submitData = app.utilB.objectifyFormDataArray(formData);
|
//clean up the data before submit
|
||||||
|
|
||||||
//clean up the data before submit
|
//submit
|
||||||
|
alert("STUB submit");
|
||||||
|
// app.api.createRavLicense(submitData, function (res) {
|
||||||
|
// if (res.error) {
|
||||||
|
// $.gevent.publish('app-show-error', res.msg);
|
||||||
|
// } else {
|
||||||
|
// $('#key').val(res);
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
//submit
|
return false; //prevent default
|
||||||
alert("STUB submit");
|
};
|
||||||
// app.api.createRavLicense(submitData, function (res) {
|
|
||||||
// if (res.error) {
|
|
||||||
// $.gevent.publish('app-show-error', res.msg);
|
|
||||||
// } else {
|
|
||||||
// $('#key').val(res);
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
return false; //prevent default
|
// onSelectAllAddOns = function (event) {
|
||||||
};
|
// event.preventDefault();
|
||||||
|
// $('#wbi').prop('checked', true);
|
||||||
|
// $('#mbi').prop('checked', true);
|
||||||
|
// $('#ri').prop('checked', true);
|
||||||
|
// $('#qbi').prop('checked', true);
|
||||||
|
// $('#qboi').prop('checked', true);
|
||||||
|
// $('#pti').prop('checked', true);
|
||||||
|
// $('#quickNotification').prop('checked', true);
|
||||||
|
// $('#exportToXls').prop('checked', true);
|
||||||
|
// $('#outlookSchedule').prop('checked', true);
|
||||||
|
// $('#oli').prop('checked', true);
|
||||||
|
// $('#importExportCSVDuplicate').prop('checked', true);
|
||||||
|
|
||||||
|
// return false; //prevent default
|
||||||
|
// };
|
||||||
|
|
||||||
// onSelectAllAddOns = function (event) {
|
// onTemplates = function(event) {
|
||||||
// event.preventDefault();
|
// event.preventDefault();
|
||||||
// $('#wbi').prop('checked', true);
|
// alert("STUB: templates");
|
||||||
// $('#mbi').prop('checked', true);
|
|
||||||
// $('#ri').prop('checked', true);
|
|
||||||
// $('#qbi').prop('checked', true);
|
|
||||||
// $('#qboi').prop('checked', true);
|
|
||||||
// $('#pti').prop('checked', true);
|
|
||||||
// $('#quickNotification').prop('checked', true);
|
|
||||||
// $('#exportToXls').prop('checked', true);
|
|
||||||
// $('#outlookSchedule').prop('checked', true);
|
|
||||||
// $('#oli').prop('checked', true);
|
|
||||||
// $('#importExportCSVDuplicate').prop('checked', true);
|
|
||||||
|
|
||||||
|
// return false; //prevent default
|
||||||
|
// };
|
||||||
|
|
||||||
|
//-------------------- END EVENT HANDLERS --------------------
|
||||||
|
|
||||||
// return false; //prevent default
|
//------------------- BEGIN PUBLIC METHODS -------------------
|
||||||
// };
|
//CONFIGMODULE
|
||||||
|
//
|
||||||
|
configModule = function (context) {
|
||||||
|
stateMap.context = context.context;
|
||||||
|
if (stateMap.context.params.id) {
|
||||||
|
stateMap.id = stateMap.context.params.id;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// onTemplates = function(event) {
|
//INITMODULE
|
||||||
// event.preventDefault();
|
//
|
||||||
// alert("STUB: templates");
|
initModule = function ($container) {
|
||||||
|
if (typeof $container === "undefined") {
|
||||||
|
$container = $("#app-shell-main-content");
|
||||||
|
}
|
||||||
|
$container.html(Handlebars.templates["app.ravLicense"]({}));
|
||||||
|
|
||||||
|
///ravLicense/:id
|
||||||
|
//id is always site id and this form is only to make a new license, not to view one
|
||||||
|
|
||||||
// return false; //prevent default
|
//case 3233 customer list
|
||||||
// };
|
//Fill customer list combo
|
||||||
|
// var customerList = {};
|
||||||
|
|
||||||
|
//get company name to pre-fill regto
|
||||||
|
//api/site/77/name
|
||||||
|
|
||||||
//-------------------- END EVENT HANDLERS --------------------
|
app.api.get("site/" + stateMap.id + "/customerinfo", function (res) {
|
||||||
|
if (res.error) {
|
||||||
|
$.gevent.publish("app-show-error", res.msg);
|
||||||
|
} else {
|
||||||
|
$("#registeredTo").val(res.name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//------------------- BEGIN PUBLIC METHODS -------------------
|
//Context menu
|
||||||
//CONFIGMODULE
|
app.nav.contextClear();
|
||||||
//
|
|
||||||
configModule = function (context) {
|
|
||||||
stateMap.context = context.context;
|
|
||||||
if (stateMap.context.params.id) {
|
|
||||||
stateMap.id = stateMap.context.params.id;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//INITMODULE
|
////app.nav.setContextTitle("License");
|
||||||
//
|
|
||||||
initModule = function ($container) {
|
|
||||||
if (typeof $container === 'undefined') {
|
|
||||||
$container = $('#app-shell-main-content');
|
|
||||||
}
|
|
||||||
$container.html(Handlebars.templates['app.ravLicense']({}));
|
|
||||||
|
|
||||||
///ravLicense/:id/:site_id
|
//make context menu
|
||||||
//either fetch one to display or start one to create
|
|
||||||
debugger;
|
|
||||||
|
|
||||||
//case 3233 customer list
|
|
||||||
//Fill customer list combo
|
|
||||||
// var customerList = {};
|
|
||||||
|
|
||||||
|
//Context menu
|
||||||
// //get customers
|
app.nav.contextClear();
|
||||||
// app.api.get('customer/list', function (res) {
|
app.nav.contextAddButton(
|
||||||
// if (res.error) {
|
"btn-generate",
|
||||||
// $.gevent.publish('app-show-error', res.msg);
|
"Generate and Send",
|
||||||
// } else {
|
"key",
|
||||||
|
onGenerate
|
||||||
|
);
|
||||||
|
// app.nav.contextAddButton('btn-select-all-addons', 'All', 'check-all', onSelectAllAddOns);
|
||||||
|
// app.nav.contextAddLink("licenseRequests/", "Requests", "voice");
|
||||||
|
// app.nav.contextAddLink("licenseTemplates/", "", "layers");
|
||||||
|
//case 3233
|
||||||
|
app.nav.contextAddLink("licenses/", "List", "");
|
||||||
|
|
||||||
// var html = '<option value="0"><TRIAL></option>';
|
//set all date inputs to today plus one year
|
||||||
|
var oneYearFromNow = moment()
|
||||||
|
.add(1, "years")
|
||||||
|
.toISOString()
|
||||||
|
.substring(0, 10);
|
||||||
|
$('input[type="date"]').val(oneYearFromNow);
|
||||||
|
$("#siteid").val(stateMap.id);
|
||||||
|
|
||||||
// for (var i = 0, len = res.length; i < len; ++i) {
|
//var oneMonthFromNow = moment().add(1, 'months').toISOString().substring(0, 10);
|
||||||
// html += ('<option value="' + res[i]['id'] + '">' + res[i]['name'] + '</option>');
|
//$('#lockoutDate').val(oneMonthFromNow);
|
||||||
// customerList[res[i]['id']] = res[i]['name'];
|
};
|
||||||
// }
|
|
||||||
// $('#customerId').append(html);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
// return public methods
|
||||||
//Context menu
|
return {
|
||||||
app.nav.contextClear();
|
configModule: configModule,
|
||||||
|
initModule: initModule
|
||||||
////app.nav.setContextTitle("License");
|
};
|
||||||
|
//------------------- END PUBLIC METHODS ---------------------
|
||||||
//make context menu
|
})();
|
||||||
|
|
||||||
|
|
||||||
//Context menu
|
|
||||||
app.nav.contextClear();
|
|
||||||
app.nav.contextAddButton('btn-generate', 'Generate and Send', 'key', onGenerate);
|
|
||||||
// app.nav.contextAddButton('btn-select-all-addons', 'All', 'check-all', onSelectAllAddOns);
|
|
||||||
// app.nav.contextAddLink("licenseRequests/", "Requests", "voice");
|
|
||||||
// app.nav.contextAddLink("licenseTemplates/", "", "layers");
|
|
||||||
//case 3233
|
|
||||||
app.nav.contextAddLink("licenses/", "List", "");
|
|
||||||
|
|
||||||
|
|
||||||
//set all date inputs to today plus one year
|
|
||||||
var oneYearFromNow = moment().add(1, 'years').toISOString().substring(0, 10);
|
|
||||||
$('input[type="date"]').val(oneYearFromNow);
|
|
||||||
|
|
||||||
//var oneMonthFromNow = moment().add(1, 'months').toISOString().substring(0, 10);
|
|
||||||
//$('#lockoutDate').val(oneMonthFromNow);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
// return public methods
|
|
||||||
return {
|
|
||||||
configModule: configModule,
|
|
||||||
initModule: initModule
|
|
||||||
};
|
|
||||||
//------------------- END PUBLIC METHODS ---------------------
|
|
||||||
}());
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="dbId">dbId</label>
|
<label for="dbId">dbId</label>
|
||||||
<input class="form-control" type="text" id="dbId" name="dbId" value="">
|
<input class="form-control" type="text" id="dbId" name="dbId" value="23945a86-0aa7-46de-9485-539ec7d31b31">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user