diff --git a/Models/Purchase.cs b/Models/Purchase.cs index 4a282eb..8d68c74 100644 --- a/Models/Purchase.cs +++ b/Models/Purchase.cs @@ -1,11 +1,15 @@ -using System; -using System.Collections.Generic; -using Newtonsoft.Json; +using Newtonsoft.Json; namespace rockfishCore.Models { public partial class Purchase { + public Purchase() + { + Quantity = 1; + VendorName="ShareIT"; + ExpireDate=Util.DateUtil.DateToEpoch(System.DateTime.Today.AddYears(1)); + } public long Id { get; set; } public long CustomerId { get; set; } public long SiteId { get; set; } diff --git a/wwwroot/js/app.customerSiteEdit.js b/wwwroot/js/app.customerSiteEdit.js index 5012ada..5f3abf7 100644 --- a/wwwroot/js/app.customerSiteEdit.js +++ b/wwwroot/js/app.customerSiteEdit.js @@ -132,9 +132,11 @@ app.customerSiteEdit = (function () { app.utilB.formData(res); } }); - } - //set customer name - //app.nav.setContextTitle(title); + } else { + //it's a new record, set default + $("#legacyV7").val(true); + $("#dbId").val("v7_no_dbid"); + } } }); } diff --git a/wwwroot/js/app.purchaseEdit.js b/wwwroot/js/app.purchaseEdit.js index 442517d..fe8057a 100644 --- a/wwwroot/js/app.purchaseEdit.js +++ b/wwwroot/js/app.purchaseEdit.js @@ -216,8 +216,9 @@ app.purchaseEdit = (function() { .attr("name", "customerId") .attr("value", res.customerId) .appendTo("#frm"); - title = "Purchase - " + res.name; + + if (stateMap.id != "new") { //fetch existing record app.api.get("purchase/" + stateMap.id, function(res) { @@ -230,10 +231,18 @@ app.purchaseEdit = (function() { }); } else { //it's a new record, set default + $("#quantity").val(1); $("#purchaseDate").val(new Date().toISOString().substring(0, 10)); + $("#expireDate").val( + moment() + .add(1, "years") + .toISOString() + .substring(0, 10) + ); + $("#vendorName").val("ShareIt"); + } - //set title - //app.nav.setContextTitle(title); + } }); diff --git a/wwwroot/js/templates/app.purchaseEdit.handlebars b/wwwroot/js/templates/app.purchaseEdit.handlebars index a0fa273..1cef35c 100644 --- a/wwwroot/js/templates/app.purchaseEdit.handlebars +++ b/wwwroot/js/templates/app.purchaseEdit.handlebars @@ -17,7 +17,7 @@
- +
diff --git a/wwwroot/js/templates/app.shell.handlebars b/wwwroot/js/templates/app.shell.handlebars index 59c7060..eea1f66 100644 --- a/wwwroot/js/templates/app.shell.handlebars +++ b/wwwroot/js/templates/app.shell.handlebars @@ -1,4 +1,4 @@ -