This commit is contained in:
2020-06-17 23:12:12 +00:00
parent bcf2277664
commit 2cc99de152
3 changed files with 131 additions and 128 deletions

View File

@@ -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]

View File

@@ -13,12 +13,12 @@
/*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,
stateMap = {}, initModule,
configModule, initModule, onGenerate; onGenerate;
//----------------- END MODULE SCOPE VARIABLES --------------- //----------------- END MODULE SCOPE VARIABLES ---------------
//------------------- BEGIN UTILITY METHODS ------------------ //------------------- BEGIN UTILITY METHODS ------------------
@@ -56,9 +56,8 @@ app.ravLicense = (function () {
//------------------- BEGIN EVENT HANDLERS ------------------- //------------------- BEGIN EVENT HANDLERS -------------------
onGenerate = function (event) { onGenerate = function (event) {
event.preventDefault(); event.preventDefault();
$.gevent.publish('app-clear-error'); $.gevent.publish("app-clear-error");
//get form data //get form data
var formData = $("form").serializeArray({ var formData = $("form").serializeArray({
checkboxesAsBools: true checkboxesAsBools: true
@@ -82,7 +81,6 @@ app.ravLicense = (function () {
return false; //prevent default return false; //prevent default
}; };
// onSelectAllAddOns = function (event) { // onSelectAllAddOns = function (event) {
// event.preventDefault(); // event.preventDefault();
// $('#wbi').prop('checked', true); // $('#wbi').prop('checked', true);
@@ -97,8 +95,6 @@ app.ravLicense = (function () {
// $('#oli').prop('checked', true); // $('#oli').prop('checked', true);
// $('#importExportCSVDuplicate').prop('checked', true); // $('#importExportCSVDuplicate').prop('checked', true);
// return false; //prevent default // return false; //prevent default
// }; // };
@@ -106,11 +102,9 @@ app.ravLicense = (function () {
// event.preventDefault(); // event.preventDefault();
// alert("STUB: templates"); // alert("STUB: templates");
// return false; //prevent default // return false; //prevent default
// }; // };
//-------------------- END EVENT HANDLERS -------------------- //-------------------- END EVENT HANDLERS --------------------
//------------------- BEGIN PUBLIC METHODS ------------------- //------------------- BEGIN PUBLIC METHODS -------------------
@@ -126,36 +120,28 @@ app.ravLicense = (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.ravLicense']({})); $container.html(Handlebars.templates["app.ravLicense"]({}));
///ravLicense/:id/:site_id ///ravLicense/:id
//either fetch one to display or start one to create //id is always site id and this form is only to make a new license, not to view one
debugger;
//case 3233 customer list //case 3233 customer list
//Fill customer list combo //Fill customer list combo
// var customerList = {}; // var customerList = {};
//get company name to pre-fill regto
//api/site/77/name
// //get customers app.api.get("site/" + stateMap.id + "/customerinfo", function (res) {
// app.api.get('customer/list', function (res) { if (res.error) {
// if (res.error) { $.gevent.publish("app-show-error", res.msg);
// $.gevent.publish('app-show-error', res.msg); } else {
// } else { $("#registeredTo").val(res.name);
}
// var html = '<option value="0">&lt;TRIAL&gt;</option>'; });
// for (var i = 0, len = res.length; i < len; ++i) {
// html += ('<option value="' + res[i]['id'] + '">' + res[i]['name'] + '</option>');
// customerList[res[i]['id']] = res[i]['name'];
// }
// $('#customerId').append(html);
// }
// });
//Context menu //Context menu
app.nav.contextClear(); app.nav.contextClear();
@@ -164,24 +150,30 @@ app.ravLicense = (function () {
//make context menu //make context menu
//Context menu //Context menu
app.nav.contextClear(); app.nav.contextClear();
app.nav.contextAddButton('btn-generate', 'Generate and Send', 'key', onGenerate); app.nav.contextAddButton(
"btn-generate",
"Generate and Send",
"key",
onGenerate
);
// app.nav.contextAddButton('btn-select-all-addons', 'All', 'check-all', onSelectAllAddOns); // app.nav.contextAddButton('btn-select-all-addons', 'All', 'check-all', onSelectAllAddOns);
// app.nav.contextAddLink("licenseRequests/", "Requests", "voice"); // app.nav.contextAddLink("licenseRequests/", "Requests", "voice");
// app.nav.contextAddLink("licenseTemplates/", "", "layers"); // app.nav.contextAddLink("licenseTemplates/", "", "layers");
//case 3233 //case 3233
app.nav.contextAddLink("licenses/", "List", ""); app.nav.contextAddLink("licenses/", "List", "");
//set all date inputs to today plus one year //set all date inputs to today plus one year
var oneYearFromNow = moment().add(1, 'years').toISOString().substring(0, 10); var oneYearFromNow = moment()
.add(1, "years")
.toISOString()
.substring(0, 10);
$('input[type="date"]').val(oneYearFromNow); $('input[type="date"]').val(oneYearFromNow);
$("#siteid").val(stateMap.id);
//var oneMonthFromNow = moment().add(1, 'months').toISOString().substring(0, 10); //var oneMonthFromNow = moment().add(1, 'months').toISOString().substring(0, 10);
//$('#lockoutDate').val(oneMonthFromNow); //$('#lockoutDate').val(oneMonthFromNow);
}; };
// return public methods // return public methods
@@ -190,4 +182,4 @@ app.ravLicense = (function () {
initModule: initModule initModule: initModule
}; };
//------------------- END PUBLIC METHODS --------------------- //------------------- END PUBLIC METHODS ---------------------
}()); })();

View File

@@ -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>