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);
}
var ret = await ct.Site
var ret = await ct.Site.AsNoTracking()
.Select(r => new { r.Id, r.Name, r.CustomerId })
.Where(r => r.Id == id)
.FirstAsync();
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
[HttpGet]

View File

@@ -13,17 +13,17 @@
/*global $, app */
app.ravLicense = (function () {
'use strict';
//---------------- BEGIN MODULE SCOPE VARIABLES --------------
var
"use strict";
//---------------- BEGIN MODULE SCOPE VARIABLES --------------
var stateMap = {},
configModule,
initModule,
onGenerate;
//----------------- END MODULE SCOPE VARIABLES ---------------
stateMap = {},
configModule, initModule, onGenerate;
//----------------- END MODULE SCOPE VARIABLES ---------------
//------------------- BEGIN UTILITY METHODS ------------------
//-------------------- END UTILITY METHODS -------------------
/*
//------------------- BEGIN UTILITY METHODS ------------------
//-------------------- END UTILITY METHODS -------------------
/*
public class dtoRavLicense
{
[Required]
@@ -54,140 +54,132 @@ app.ravLicense = (function () {
*/
//------------------- BEGIN EVENT HANDLERS -------------------
onGenerate = function (event) {
//------------------- BEGIN EVENT HANDLERS -------------------
onGenerate = function (event) {
event.preventDefault();
$.gevent.publish("app-clear-error");
//get form data
var formData = $("form").serializeArray({
checkboxesAsBools: true
});
event.preventDefault();
$.gevent.publish('app-clear-error');
//get form data
var formData = $("form").serializeArray({
checkboxesAsBools: true
});
var submitData = app.utilB.objectifyFormDataArray(formData);
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
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
};
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) {
// 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);
// onTemplates = function(event) {
// event.preventDefault();
// alert("STUB: templates");
// 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) {
// event.preventDefault();
// alert("STUB: templates");
//INITMODULE
//
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 -------------------
//CONFIGMODULE
//
configModule = function (context) {
stateMap.context = context.context;
if (stateMap.context.params.id) {
stateMap.id = stateMap.context.params.id;
}
};
//Context menu
app.nav.contextClear();
//INITMODULE
//
initModule = function ($container) {
if (typeof $container === 'undefined') {
$container = $('#app-shell-main-content');
}
$container.html(Handlebars.templates['app.ravLicense']({}));
////app.nav.setContextTitle("License");
///ravLicense/:id/:site_id
//either fetch one to display or start one to create
debugger;
//case 3233 customer list
//Fill customer list combo
// var customerList = {};
//make context menu
// //get customers
// app.api.get('customer/list', function (res) {
// if (res.error) {
// $.gevent.publish('app-show-error', res.msg);
// } else {
//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", "");
// var html = '<option value="0">&lt;TRIAL&gt;</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) {
// html += ('<option value="' + res[i]['id'] + '">' + res[i]['name'] + '</option>');
// customerList[res[i]['id']] = res[i]['name'];
// }
// $('#customerId').append(html);
// }
// });
//var oneMonthFromNow = moment().add(1, 'months').toISOString().substring(0, 10);
//$('#lockoutDate').val(oneMonthFromNow);
};
//Context menu
app.nav.contextClear();
////app.nav.setContextTitle("License");
//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 ---------------------
}());
// return public methods
return {
configModule: configModule,
initModule: initModule
};
//------------------- END PUBLIC METHODS ---------------------
})();

View File

@@ -14,7 +14,7 @@
<div class="col-sm-6">
<div class="form-group">
<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>