diff --git a/Controllers/PurchaseController.cs b/Controllers/PurchaseController.cs index a704b30..ed495ae 100644 --- a/Controllers/PurchaseController.cs +++ b/Controllers/PurchaseController.cs @@ -90,7 +90,7 @@ namespace rockfishCore.Controllers throw; } } - updateCustomerActive(purchase.CustomerId); + // updateCustomerActive(purchase.CustomerId); ParseOrderAndUpdateEmail(purchase); return NoContent(); } @@ -107,7 +107,7 @@ namespace rockfishCore.Controllers _context.Purchase.Add(purchase); await _context.SaveChangesAsync(); - updateCustomerActive(purchase.CustomerId); + // updateCustomerActive(purchase.CustomerId); ParseOrderAndUpdateEmail(purchase); return CreatedAtAction("GetPurchase", new { id = purchase.Id }, purchase); @@ -132,7 +132,9 @@ namespace rockfishCore.Controllers _context.Purchase.Remove(purchase); await _context.SaveChangesAsync(); - updateCustomerActive(customerId); + //removed, now have the concept of lapsed so active should be in manual control + // + // updateCustomerActive(customerId); return Ok(purchase); } @@ -141,24 +143,24 @@ namespace rockfishCore.Controllers return _context.Purchase.Any(e => e.Id == id); } - //check if customer has any active subs and flag accordingly - private void updateCustomerActive(long customerId) - { - var cust = _context.Customer.First(m => m.Id == customerId); - bool active = hasActiveSubs(customerId); - if (cust.Active != active) - { - cust.Active = active; - _context.Customer.Update(cust); - _context.SaveChanges(); - } - } + // //check if customer has any active subs and flag accordingly + // private void updateCustomerActive(long customerId) + // { + // var cust = _context.Customer.First(m => m.Id == customerId); + // bool active = hasActiveSubs(customerId); + // if (cust.Active != active) + // { + // cust.Active = active; + // _context.Customer.Update(cust); + // _context.SaveChanges(); + // } + // } - //check if a customer has active subscriptions - private bool hasActiveSubs(long customerId) - { - return _context.Purchase.Where(m => m.CustomerId == customerId && m.CancelDate == null).Count() > 0; - } + // //check if a customer has active subscriptions + // private bool hasActiveSubs(long customerId) + // { + // return _context.Purchase.Where(m => m.CustomerId == customerId && m.CancelDate == null).Count() > 0; + // } diff --git a/wwwroot/js/app.customers.js b/wwwroot/js/app.customers.js index edc1f35..7db5285 100644 --- a/wwwroot/js/app.customers.js +++ b/wwwroot/js/app.customers.js @@ -23,10 +23,31 @@ app.customers = (function() { // generateCard = function(obj) { var editUrl = "#!/customerEdit/" + obj.id; - var cardClass = obj.active - ? "border-primary text-primary" - : "border-secondary text-secondary"; - var urlClass = obj.active ? "" : "text-secondary"; + + var cardClass = ""; + var urlClass = ""; + + //LAPSED + if (obj.active && obj.lapsed) { + cardClass = "border-warning text-warning"; + urlClass = "text-warning"; + } + + //ACTIVE + if (obj.active && !obj.lapsed) { + cardClass = "border-primary text-primary"; + } + + //INACTIVE + if (!obj.active) { + cardClass = "border-primary text-primary"; + urlClass = "text-secondary"; + } + + // var cardClass = obj.active + // ? "border-primary text-primary" + // : "border-secondary text-secondary"; + // var urlClass = obj.active ? "" : "text-secondary"; return ( '
-
-
+
+
+

Active + +

+
+

Lapsed + +

+
+ + +

+ Inactive + +

+ + + + +
\ No newline at end of file diff --git a/wwwroot/js/templates/templates.js b/wwwroot/js/templates/templates.js index e5ca789..a88ed43 100644 --- a/wwwroot/js/templates/templates.js +++ b/wwwroot/js/templates/templates.js @@ -1,2 +1,2 @@ -!function(){var n=Handlebars.template,e=Handlebars.templates=Handlebars.templates||{};e["app.authenticate"]=n({compiler:[7,">= 4.0.0"],main:function(n,e,l,a,o){return'
\n Rockfish logo\n

Login

\n
\n

\n

\n

\n
\n
'},useData:!0}),e["app.customerEdit"]=n({compiler:[7,">= 4.0.0"],main:function(n,e,l,a,o){return'
\n
\n\n\n
\n \n \n
\n\n
\n \n \n
\n\n
\n \n \n
\n\n
\n \n \n
\n\n
\n \n
\n\n\n
\n \n
\n\n\n\n
\n \n