Remove CRM bits

This commit is contained in:
2016-08-25 13:05:31 -04:00
parent a5fcb46e04
commit b57c5ae41c
42 changed files with 0 additions and 1471 deletions
-159
View File
@@ -57,17 +57,6 @@ namespace InventoryTraker.Web
context.SaveChanges();
}
if (!context.Customers.Any())
{
AddNewCustomers(context);
AddExistingCustomers(context);
AddTerminatedCustomers(context);
context.SaveChanges();
}
}
}
@@ -138,153 +127,5 @@ namespace InventoryTraker.Web
}
}
}
private static void AddTerminatedCustomers(AppDbContext context)
{
context.Customers.Add(new Customer
{
Name = "Arlo Seymour",
HomeEmail = "Arlo@home.com",
WorkEmail = "Arlo@work.com",
WorkAddress = "123 Arlo Street\r\nSuite B\r\nNew York, NY 55555",
HomeAddress = "321 Seymour Street\r\nApt 1205\r\nNew York, NY 55555",
HomePhone = "(555) 123-4555",
WorkPhone = "(555) 321-5444",
CreateDate = DateTime.Today.ToStartOfMonth().AddDays(-90),
TerminationDate = DateTime.Today.ToStartOfMonth().AddDays(5),
});
context.Customers.Add(new Customer
{
Name = "Porter Jakeman",
HomeEmail = "Porter@home.com",
WorkEmail = "Porter@work.com",
WorkAddress = "123 Porter Street\r\nSuite B\r\nNew York, NY 55555",
HomeAddress = "321 Jakeman Street\r\nApt 1205\r\nNew York, NY 55555",
HomePhone = "(555) 123-4555",
WorkPhone = "(555) 321-5444",
CreateDate = DateTime.Today.ToStartOfMonth().AddDays(-75),
TerminationDate = DateTime.Today.ToStartOfMonth().AddDays(10),
});
context.Customers.Add(new Customer
{
Name = "Edwyn Perry",
HomeEmail = "Edwyn@home.com",
WorkEmail = "Edwyn@work.com",
WorkAddress = "123 Edwyn Street\r\nSuite B\r\nNew York, NY 55555",
HomeAddress = "321 Perry Street\r\nApt 1205\r\nNew York, NY 55555",
HomePhone = "(555) 123-4555",
WorkPhone = "(555) 321-5444",
CreateDate = DateTime.Today.ToStartOfMonth().AddDays(-45),
TerminationDate = DateTime.Today.ToStartOfMonth().AddDays(15),
});
}
private static void AddExistingCustomers(AppDbContext context)
{
context.Customers.Add(new Customer
{
Name = "Gosse Greene",
HomeEmail = "Gosse@home.com",
WorkEmail = "Gosse@work.com",
WorkAddress = "123 Gosse Street\r\nSuite B\r\nNew York, NY 55555",
HomeAddress = "321 Greene Street\r\nApt 1205\r\nNew York, NY 55555",
HomePhone = "(555) 123-4555",
WorkPhone = "(555) 321-5444",
CreateDate = DateTime.Today.ToStartOfMonth().AddDays(-20),
Risks = new List<Risk>()
{
new Risk{Title = "Considering vendor switch", Description = "His contract is expiring next month, and he's evaluating other vendors. He likes the services we provide, but feels he is paying too much."}
}
});
context.Customers.Add(new Customer
{
Name = "Warwick Rye",
HomeEmail = "Warwick@home.com",
WorkEmail = "Warwick@work.com",
WorkAddress = "123 Warwick Street\r\nSuite B\r\nNew York, NY 55555",
HomeAddress = "321 Rye Street\r\nApt 1205\r\nNew York, NY 55555",
HomePhone = "(555) 123-4555",
WorkPhone = "(555) 321-5444",
CreateDate = DateTime.Today.ToStartOfMonth().AddDays(-15),
Opportunities = new List<Opportunity>
{
new Opportunity{Title = "Expanding business", Description = "Warwick's business is booming. He's considering acquiring a competitor. If that happens, he'll need a *lot* of custom development to integrate the two systems."}
}
});
context.Customers.Add(new Customer
{
Name = "Odell Dennel",
HomeEmail = "Odell@home.com",
WorkEmail = "Odell@work.com",
WorkAddress = "123 Odell Street\r\nSuite B\r\nNew York, NY 55555",
HomeAddress = "321 Dennel Street\r\nApt 1205\r\nNew York, NY 55555",
HomePhone = "(555) 123-4555",
WorkPhone = "(555) 321-5444",
CreateDate = DateTime.Today.ToStartOfMonth().AddDays(-10),
Risks = new List<Risk>
{
new Risk{Title = "Customer may not pay", Description = "Odell is not pleased with the solution we developed. He has threatened to stop all future payments, including outstanding invoices for work that has already been performed."}
}
});
}
private static void AddNewCustomers(AppDbContext context)
{
context.Customers.Add(new Customer
{
Name = "John Doe",
HomeEmail = "john@home.com",
WorkEmail = "john@work.com",
WorkAddress = "123 Main Street\r\nSuite B\r\nNew York, NY 55555",
HomeAddress = "321 Second Street\r\nApt 1205\r\nNew York, NY 55555",
HomePhone = "(555) 123-4555",
WorkPhone = "(555) 321-5444",
CreateDate = DateTime.Today.ToStartOfMonth()
});
context.Customers.Add(new Customer
{
Name = "Roy Irvine",
HomeEmail = "roy@home.com",
WorkEmail = "roy@work.com",
WorkAddress = "123 Roy Street\r\nSuite B\r\nNew York, NY 55555",
HomeAddress = "321 Irvine Street\r\nApt 1205\r\nNew York, NY 55555",
HomePhone = "(555) 123-4555",
WorkPhone = "(555) 321-5444",
CreateDate = DateTime.Today.ToStartOfMonth().AddDays(5),
});
context.Customers.Add(new Customer
{
Name = "Vere Rowland",
HomeEmail = "vere@home.com",
WorkEmail = "vere@work.com",
WorkAddress = "123 Vere Street\r\nSuite B\r\nNew York, NY 55555",
HomeAddress = "321 Roland Street\r\nApt 1205\r\nNew York, NY 55555",
HomePhone = "(555) 123-4555",
WorkPhone = "(555) 321-5444",
CreateDate = DateTime.Today.ToStartOfMonth().AddDays(10),
});
context.Customers.Add(new Customer
{
Name = "Zack Beasley",
HomeEmail = "zack@home.com",
WorkEmail = "zack@work.com",
WorkAddress = "123 Zack Street\r\nSuite B\r\nNew York, NY 55555",
HomeAddress = "321 Beasley Street\r\nApt 1205\r\nNew York, NY 55555",
HomePhone = "(555) 123-4555",
WorkPhone = "(555) 321-5444",
CreateDate = DateTime.Today.ToStartOfMonth().AddDays(15),
Opportunities = new List<Opportunity>
{
new Opportunity{Title = "Interested in on-site support", Description = "Zack likes the solution we developed for his business. He's interested in our on-site support services, too."}
}
});
}
}
}
@@ -1,57 +0,0 @@
using System.Linq;
using System.Web.Mvc;
using AutoMapper;
using AutoMapper.QueryableExtensions;
using InventoryTraker.Web.Core;
using InventoryTraker.Web.Data;
using InventoryTraker.Web.Models;
namespace InventoryTraker.Web.Controllers
{
public class CustomerController : ControllerBase
{
private readonly AppDbContext _context;
public CustomerController(AppDbContext context)
{
_context = context;
}
public ActionResult Index()
{
return View();
}
public JsonResult All()
{
var customerModels = _context.Customers
.OrderByDescending(x => x.CreateDate)
.ProjectTo<CustomerViewModel>();
return BetterJson(customerModels.ToArray());
}
public JsonResult Add(AddCustomerForm form)
{
var customer = Mapper.Map<Customer>(form);
_context.Customers.Add(customer);
_context.SaveChanges();
var model = Mapper.Map<CustomerViewModel>(customer);
return BetterJson(model);
}
public JsonResult Update(EditCustomerForm form)
{
var target = _context.Customers.Find(form.Id);
Mapper.Map(form, target);
_context.SaveChanges();
var updatedCustomer = _context.Customers.ProjectTo<CustomerViewModel>().Single(x => x.Id == form.Id);
return BetterJson(updatedCustomer);
}
}
}
@@ -1,42 +0,0 @@
using System.Data.Entity;
using System.Linq;
using System.Web.Mvc;
using AutoMapper;
using AutoMapper.QueryableExtensions;
using InventoryTraker.Web.Core;
using InventoryTraker.Web.Data;
using InventoryTraker.Web.Models;
namespace InventoryTraker.Web.Controllers
{
public class OpportunityController : ControllerBase
{
private readonly AppDbContext _context;
public OpportunityController(AppDbContext context)
{
_context = context;
}
public ViewResult Index()
{
var models = _context.Opportunities.ProjectTo<OpportunityViewModel>().ToArray();
return View(models);
}
public JsonResult Add(AddOpportunityForm form)
{
var customer = _context.Customers.Include(x => x.Opportunities).Single(x => x.Id == form.CustomerId);
var opportunity = Mapper.Map<Opportunity>(form);
customer.Opportunities.Add(opportunity);
_context.SaveChanges();
var model = Mapper.Map<CustomerOpportunityViewModel>(opportunity);
return BetterJson(model);
}
}
}
@@ -1,47 +0,0 @@
using System;
using System.Linq;
using System.Web.Mvc;
using AutoMapper.QueryableExtensions;
using InventoryTraker.Web.Data;
using InventoryTraker.Web.Models;
using InventoryTraker.Web.Utilities;
namespace InventoryTraker.Web.Controllers
{
public class ReportController : ControllerBase
{
private readonly AppDbContext _context;
public ReportController(AppDbContext context)
{
_context = context;
}
public ActionResult Index()
{
return View();
}
public JsonResult NewCustomers()
{
var startOfMonth = DateTime.Today.ToStartOfMonth();
var endOfMonth = DateTime.Today.ToEndOfMonth();
var customers = _context.Customers.Where(x => x.CreateDate >= startOfMonth && x.CreateDate <= endOfMonth)
.ProjectTo<NewCustomerReportViewModel>().ToArray();
return BetterJson(customers);
}
public JsonResult LostCustomers()
{
var startOfMonth = DateTime.Today.ToStartOfMonth();
var endOfMonth = DateTime.Today.ToEndOfMonth();
var customers = _context.Customers.Where(x => x.TerminationDate >= startOfMonth && x.TerminationDate <= endOfMonth)
.ProjectTo<LostCustomerReportViewModel>().ToArray();
return Json(customers);
}
}
}
@@ -1,42 +0,0 @@
using System.Data.Entity;
using System.Linq;
using System.Web.Mvc;
using AutoMapper;
using AutoMapper.QueryableExtensions;
using InventoryTraker.Web.Core;
using InventoryTraker.Web.Data;
using InventoryTraker.Web.Models;
namespace InventoryTraker.Web.Controllers
{
public class RiskController : ControllerBase
{
private readonly AppDbContext _context;
public RiskController(AppDbContext context)
{
_context = context;
}
public ViewResult Index()
{
var models = _context.Risks.ProjectTo<RiskViewModel>().ToArray();
return View(models);
}
public JsonResult Add(AddRiskForm form)
{
var customer = _context.Customers.Include(x => x.Risks).Single(x => x.Id == form.CustomerId);
var risk = Mapper.Map<Risk>(form);
customer.Risks.Add(risk);
_context.SaveChanges();
var model = Mapper.Map<CustomerRiskViewModel>(risk);
return BetterJson(model);
}
}
}
-37
View File
@@ -1,37 +0,0 @@
using System;
using System.Collections.Generic;
namespace InventoryTraker.Web.Core
{
public class Customer
{
public int Id { get; set; }
public string Name { get; set; }
public string WorkEmail { get; set; }
public string HomeEmail { get; set; }
public string WorkPhone { get; set; }
public string HomePhone { get; set; }
public string HomeAddress { get; set; }
public string WorkAddress { get; set; }
public DateTime CreateDate { get; set; }
public DateTime? TerminationDate { get; set; }
public IList<Opportunity> Opportunities { get; set; }
public IList<Risk> Risks { get; set; }
public Customer()
{
CreateDate = DateTime.Today;
}
}
}
-22
View File
@@ -1,22 +0,0 @@
using System;
namespace InventoryTraker.Web.Core
{
public class Opportunity
{
public int Id { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public DateTime CreateDate { get; set; }
public Customer Customer { get; set; }
public Opportunity()
{
CreateDate = DateTime.Now;
}
}
}
-22
View File
@@ -1,22 +0,0 @@
using System;
namespace InventoryTraker.Web.Core
{
public class Risk
{
public int Id { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public DateTime CreateDate { get; set; }
public Customer Customer { get; set; }
public Risk()
{
CreateDate = DateTime.Today;
}
}
}
-6
View File
@@ -6,12 +6,6 @@ namespace InventoryTraker.Web.Data
{
public class AppDbContext : IdentityDbContext<User>
{
public IDbSet<Customer> Customers { get; set; }
public IDbSet<Opportunity> Opportunities { get; set; }
public IDbSet<Risk> Risks { get; set; }
public IDbSet<Inventory> Inventories { get; set; }
public IDbSet<InventoryType> InventoryTypes { get; set; }
@@ -230,24 +230,8 @@
<Content Include="js\inventory\inventoryTypeSvc.js" />
<Content Include="js\inventory\inventorySvc.js" />
<Content Include="js\inventory\InventoryEditDirective.js" />
<Content Include="js\customer\EditCustomerDirective.js" />
<Content Include="js\customer\AddCustomerDirective.js" />
<Content Include="js\customer\templates\addCustomer.tmpl.cshtml" />
<Content Include="js\customer\templates\customerDetails.tmpl.cshtml" />
<Content Include="js\customer\templates\editCustomer.tmpl.cshtml" />
<Content Include="js\customer\CustomerDetailsDirective.js" />
<Content Include="js\customer\customerSvc.js" />
<Content Include="js\customer\CustomerListController.js" />
<Content Include="js\inventory\InventoryDistributeDirective.js" />
<Content Include="js\opportunity\AddOpportunityDirective.js" />
<Content Include="js\opportunity\templates\addOpportunity.tmpl.cshtml" />
<Content Include="js\profile\EditProfileController.js" />
<Content Include="js\report\LostCustomersReportDirective.js" />
<Content Include="js\report\NewCustomersReportDirective.js" />
<Content Include="js\report\templates\lostCustomersReport.tmpl.html" />
<Content Include="js\report\templates\newCustomersReport.tmpl.html" />
<Content Include="js\risk\AddRiskDirective.js" />
<Content Include="js\risk\templates\addRisk.tmpl.cshtml" />
<Content Include="js\transaction\transactionSvc.js" />
<Content Include="js\utility\ArrayExtensions.js" />
<Content Include="js\utility\FormGroupValidationDirective.js" />
@@ -310,20 +294,13 @@
<Compile Include="Controllers\TransactionController.cs" />
<Compile Include="Controllers\InventoryController.cs" />
<Compile Include="Controllers\AuthenticationController.cs" />
<Compile Include="Controllers\CustomerController.cs" />
<Compile Include="Controllers\ControllerBase.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\InventoryTypeController.cs" />
<Compile Include="Controllers\OpportunityController.cs" />
<Compile Include="Controllers\ProfileController.cs" />
<Compile Include="Controllers\ReportController.cs" />
<Compile Include="Controllers\RiskController.cs" />
<Compile Include="Controllers\TemplateController.cs" />
<Compile Include="Core\Customer.cs" />
<Compile Include="Core\Inventory.cs" />
<Compile Include="Core\InventoryType.cs" />
<Compile Include="Core\Opportunity.cs" />
<Compile Include="Core\Risk.cs" />
<Compile Include="Core\Transaction.cs" />
<Compile Include="Core\User.cs" />
<Compile Include="Data\AppDbContext.cs" />
@@ -341,21 +318,10 @@
<Compile Include="Migrations\Configuration.cs" />
<Compile Include="Models\InventoryDistributeForm.cs" />
<Compile Include="Models\InventoryAddForm.cs" />
<Compile Include="Models\AddCustomerForm.cs" />
<Compile Include="Models\AddRiskForm.cs" />
<Compile Include="Models\CustomerViewModel.cs" />
<Compile Include="Models\EditCustomerForm.cs" />
<Compile Include="Models\InventoryTypeViewModel.cs" />
<Compile Include="Models\InventoryViewModel.cs" />
<Compile Include="Models\LoginForm.cs" />
<Compile Include="Models\LostCustomerReportViewModel.cs" />
<Compile Include="Models\NewCustomerReportViewModel.cs" />
<Compile Include="Models\AddOpportunityForm.cs" />
<Compile Include="Models\CustomerOpportunityViewModel.cs" />
<Compile Include="Models\CustomerRiskViewModel.cs" />
<Compile Include="Models\OpportunityViewModel.cs" />
<Compile Include="Models\ProfileForm.cs" />
<Compile Include="Models\RiskViewModel.cs" />
<Compile Include="Models\TransactionViewModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utilities\ExcelParserBase.cs" />
@@ -375,15 +341,10 @@
<Content Include="Scripts\angular-animate.min.js.map" />
<Content Include="Scripts\jquery-1.9.1.min.map" />
<Content Include="Views\Authentication\Login.cshtml" />
<Content Include="Views\Customer\Index.cshtml" />
<Content Include="Views\Home\Index.cshtml" />
<Content Include="Views\Inventory\Index.cshtml" />
<Content Include="Views\Opportunity\Index.cshtml" />
<Content Include="Views\Profile\Index.cshtml" />
<Content Include="Views\Report\Index.cshtml" />
<Content Include="Views\Risk\Index.cshtml" />
<Content Include="Views\Shared\_NavigationNoAuth.cshtml" />
<Content Include="Views\Shared\_NavigationHero.cshtml" />
<Content Include="Views\Shared\_Navigation.cshtml" />
<Content Include="Views\_ViewStart.cshtml" />
<Content Include="Views\Transaction\Index.cshtml" />
@@ -1,30 +0,0 @@
using System.ComponentModel.DataAnnotations;
using Heroic.AutoMapper;
using InventoryTraker.Web.Core;
namespace InventoryTraker.Web.Models
{
public class AddCustomerForm : IMapTo<Customer>
{
[Required, Display(Name = "Full Name", Prompt = "Full Name (ex: John Doe)...")]
public string Name { get; set; }
[Required, DataType(DataType.EmailAddress)]
public string WorkEmail { get; set; }
[DataType(DataType.EmailAddress)]
public string HomeEmail { get; set; }
[Required, DataType(DataType.PhoneNumber)]
public string WorkPhone { get; set; }
[DataType(DataType.PhoneNumber)]
public string HomePhone { get; set; }
[Required, DataType(DataType.MultilineText)]
public string WorkAddress { get; set; }
[DataType(DataType.MultilineText)]
public string HomeAddress { get; set; }
}
}
@@ -1,19 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using Heroic.AutoMapper;
using InventoryTraker.Web.Core;
namespace InventoryTraker.Web.Models
{
public class AddOpportunityForm : IMapTo<Opportunity>
{
[HiddenInput]
public int CustomerId { get; set; }
[Required]
public string Title { get; set; }
[DataType(DataType.MultilineText)]
public string Description { get; set; }
}
}
-19
View File
@@ -1,19 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using Heroic.AutoMapper;
using InventoryTraker.Web.Core;
namespace InventoryTraker.Web.Models
{
public class AddRiskForm : IMapTo<Risk>
{
[HiddenInput]
public int CustomerId { get; set; }
[Required]
public string Title { get; set; }
[DataType(DataType.MultilineText)]
public string Description { get; set; }
}
}
@@ -1,12 +0,0 @@
using Heroic.AutoMapper;
using InventoryTraker.Web.Core;
namespace InventoryTraker.Web.Models
{
public class CustomerOpportunityViewModel : IMapFrom<Opportunity>
{
public string Title { get; set; }
public string Description { get; set; }
}
}
@@ -1,12 +0,0 @@
using Heroic.AutoMapper;
using InventoryTraker.Web.Core;
namespace InventoryTraker.Web.Models
{
public class CustomerRiskViewModel : IMapFrom<Risk>
{
public string Title { get; set; }
public string Description { get; set; }
}
}
@@ -1,32 +0,0 @@
using System;
using System.Collections.Generic;
using Heroic.AutoMapper;
using InventoryTraker.Web.Core;
namespace InventoryTraker.Web.Models
{
public class CustomerViewModel : IMapFrom<Customer>
{
public int Id { get; set; }
public string Name { get; set; }
public string WorkEmail { get; set; }
public string HomeEmail { get; set; }
public string WorkPhone { get; set; }
public string HomePhone { get; set; }
public string HomeAddress { get; set; }
public string WorkAddress { get; set; }
public DateTime? TerminationDate { get; set; }
public IList<CustomerOpportunityViewModel> Opportunities { get; set; }
public IList<CustomerRiskViewModel> Risks { get; set; }
}
}
@@ -1,34 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using Heroic.AutoMapper;
using InventoryTraker.Web.Core;
namespace InventoryTraker.Web.Models
{
public class EditCustomerForm : IMapTo<Customer>
{
[HiddenInput]
public int Id { get; set; }
[Required, Display(Name = "Full Name", Prompt = "Full Name (ex: John Doe)...")]
public string Name { get; set; }
[Required, DataType(DataType.EmailAddress)]
public string WorkEmail { get; set; }
[DataType(DataType.EmailAddress)]
public string HomeEmail { get; set; }
[Required, DataType(DataType.PhoneNumber)]
public string WorkPhone { get; set; }
[DataType(DataType.PhoneNumber)]
public string HomePhone { get; set; }
[Required, DataType(DataType.MultilineText)]
public string WorkAddress { get; set; }
[DataType(DataType.MultilineText)]
public string HomeAddress { get; set; }
}
}
@@ -1,15 +0,0 @@
using System;
using Heroic.AutoMapper;
using InventoryTraker.Web.Core;
namespace InventoryTraker.Web.Models
{
public class LostCustomerReportViewModel : IMapFrom<Customer>
{
public string Name { get; set; }
public string WorkEmail { get; set; }
public DateTime? TerminationDate { get; set; }
}
}
@@ -1,14 +0,0 @@
using System;
using Heroic.AutoMapper;
namespace InventoryTraker.Web.Models
{
public class NewCustomerReportViewModel : IMapFrom<Core.Customer>
{
public string Name { get; set; }
public string WorkEmail { get; set; }
public DateTime CreateDate { get; set; }
}
}
@@ -1,19 +0,0 @@
using System;
using Heroic.AutoMapper;
using InventoryTraker.Web.Core;
namespace InventoryTraker.Web.Models
{
public class OpportunityViewModel : IMapFrom<Opportunity>
{
public string Title { get; set; }
public string Description { get; set; }
public DateTime CreateDate { get; set; }
public int CustomerId { get; set; }
public string CustomerName { get; set; }
}
}
@@ -1,19 +0,0 @@
using System;
using Heroic.AutoMapper;
using InventoryTraker.Web.Core;
namespace InventoryTraker.Web.Models
{
public class RiskViewModel : IMapFrom<Risk>
{
public int CustomerId { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public DateTime CreateDate { get; set; }
public string CustomerName { get; set; }
}
}
@@ -1,15 +0,0 @@
@model dynamic
@{
ViewBag.Title = "Customers";
}
<div ng-controller="CustomerListController as vm">
<h1 class="page-header">
Customers
<a class="pull-right" href="" ng-click="vm.add()"><i class="fa fa-plus-circle"></i></a>
</h1>
<div class="customer-list">
<customer-details ng-repeat="customer in vm.customers" customer="customer"></customer-details>
</div>
</div>
@@ -1,23 +0,0 @@
@model InventoryTraker.Web.Models.OpportunityViewModel[]
@{
ViewBag.Title = "Opportunities";
}
<h1 class="page-header">
All Opportunities
</h1>
@foreach (var opportunity in Model)
{
<div class="panel panel-default">
<div class="panel-body">
<h4>
@opportunity.CustomerName - @opportunity.Title
<small class="pull-right">@opportunity.CreateDate.ToShortDateString()</small>
</h4>
<hr />
<p>@opportunity.Description</p>
</div>
</div>
}
@@ -1,22 +0,0 @@
@using InventoryTraker.Web.Helpers
@using InventoryTraker.Web.Models
@model dynamic
@{
ViewBag.Title = "Reports";
}
<h1 class="page-header">
Reports
</h1>
@(Html.Angular().GridFor<ReportController>(c => c.NewCustomers())
.Title("New Customers")
.Columns<NewCustomerReportViewModel>(config =>
{
config.Add(x => x.Name);
config.Add(x => x.WorkEmail);
config.Add(x => x.CreateDate, "Date Joined", "date: 'MM/dd/yyyy'");
}))
<lost-customers-report ></lost-customers-report>
@@ -1,23 +0,0 @@
@model InventoryTraker.Web.Models.RiskViewModel[]
@{
ViewBag.Title = "Risks";
}
<h1 class="page-header">
All Risks
</h1>
@foreach (var risk in Model)
{
<div class="panel panel-default">
<div class="panel-body">
<h4>
@risk.CustomerName - @risk.Title
<small class="pull-right">@risk.CreateDate.ToShortDateString()</small>
</h4>
<hr />
<p>@risk.Description</p>
</div>
</div>
}
@@ -1,47 +0,0 @@
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="~/">Inventory Traker</a>
</div>
<!-- Top Menu Items -->
<ul class="nav navbar-right top-nav">
<li class="dropdown">
<a href="" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-user"></i> @User.Identity.Name <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>
<a href="@(Html.BuildUrlFromExpression<ProfileController>(c => c.Index()))"><i class="fa fa-fw fa-user"></i> Profile</a>
</li>
<li>
<a href="@(Html.BuildUrlFromExpression<AuthenticationController>(c => c.Logout()))"><i class="fa fa-fw fa-power-off"></i> Log Out</a>
</li>
</ul>
</li>
</ul>
<!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav side-nav">
<li>
<a href="@(Html.BuildUrlFromExpression<HomeController>(c => c.Index()))"><i class="fa fa-fw fa-dashboard"></i> Dashboard</a>
</li>
<li>
<a href="@(Html.BuildUrlFromExpression<CustomerController>(c => c.Index()))"><i class="fa fa-fw fa-users"></i> Customers</a>
</li>
<li>
<a href="@(Html.BuildUrlFromExpression<OpportunityController>(c => c.Index()))"><i class="fa fa-fw fa-dollar"></i> Opportunities</a>
</li>
<li>
<a href="@(Html.BuildUrlFromExpression<RiskController>(c => c.Index()))"><i class="fa fa-fw fa-exclamation-triangle"></i> Risks</a>
</li>
<li>
<a href="@(Html.BuildUrlFromExpression<ReportController>(c => c.Index()))"><i class="fa fa-fw fa-line-chart"></i> Reports</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</nav>
@@ -1,38 +0,0 @@
(function() {
"use strict";
window.app.directive('addCustomer', addCustomer);
function addCustomer() {
return {
templateUrl: '/customer/template/addCustomer.tmpl.cshtml',
controller: controller,
controllerAs: 'vm'
}
}
controller.$inject = ['$scope', 'customerSvc'];
function controller($scope, customerSvc) {
var vm = this;
vm.add = add;
vm.saving = false;
vm.customer = {};
vm.errorMessage = null;
function add() {
vm.saving = true;
customerSvc.add(vm.customer)
.success(function () {
//Close the modal
$scope.$close();
})
.error(function(data) {
vm.errorMessage = 'There was a problem adding the customer: ' + data;
})
.finally(function() {
vm.saving = false;
});
}
}
})();
@@ -1,54 +0,0 @@
(function() {
'use strict';
window.app.directive('customerDetails', customerDetails);
function customerDetails() {
return {
scope: {
customer: '='
},
templateUrl: '/customer/template/customerDetails.tmpl.cshtml',
controller: controller,
controllerAs: 'vm'
}
}
controller.$inject = ['$scope', '$uibModal'];
function controller($scope, $uibModal) {
var vm = this;
vm.customer = $scope.customer;
vm.selectedView = 'details';
vm.setView = setView;
vm.edit = edit;
vm.addOpportunity = addOpportunity;
vm.addRisk = addRisk;
vm.customer = $scope.customer;
function setView(view) {
vm.selectedView = view;
}
function edit() {
$uibModal.open({
template: '<edit-customer customer="customer" />',
scope: angular.extend($scope.$new(true), { customer: vm.customer })
});
}
function addOpportunity() {
$uibModal.open({
template: '<add-opportunity customer="customer" />',
scope: angular.extend($scope.$new(true), { customer: vm.customer })
});
}
function addRisk() {
$uibModal.open({
template: '<add-risk customer="customer" />',
scope: angular.extend($scope.$new(true), { customer: vm.customer })
});
}
}
})();
@@ -1,19 +0,0 @@
(function() {
'use strict';
window.app.controller('CustomerListController', CustomerListController);
CustomerListController.$inject = ['$uibModal', 'customerSvc'];
function CustomerListController($uibModal, customerSvc) {
var vm = this;
vm.add = add;
vm.customers = customerSvc.customers;
function add() {
$uibModal.open({
template: '<add-customer />'
});
}
}
})();
@@ -1,41 +0,0 @@
(function() {
"use strict";
window.app.directive('editCustomer', editCustomer);
function editCustomer() {
return {
scope: {
customer: "="
},
templateUrl: '/customer/template/editCustomer.tmpl.cshtml',
controller: controller,
controllerAs: 'vm'
}
}
controller.$inject = ['$scope', 'customerSvc'];
function controller($scope, customerSvc) {
var vm = this;
vm.save = save;
vm.saving = false;
vm.customer = angular.copy($scope.customer);
vm.errorMessage = null;
function save() {
vm.saving = true;
customerSvc.update($scope.customer, vm.customer)
.success(function () {
//Close the modal
$scope.$parent.$close();
})
.error(function(data) {
vm.errorMessage = 'There was a problem saving changes to the customer: ' + data;
})
.finally(function() {
vm.saving = false;
});
}
}
})();
@@ -1,49 +0,0 @@
(function() {
window.app.factory('customerSvc', customerSvc);
customerSvc.$inject = ['$http'];
function customerSvc($http) {
var customers = [];
loadCustomers();
var svc = {
add: add,
update: update,
customers: customers,
getCustomer: getCustomer
};
return svc;
function loadCustomers() {
$http.post('/Customer/All')
.success(function(data) {
customers.addRange(data);
});
}
function add(customer) {
return $http.post('/Customer/Add', customer)
.success(function(customer) {
customers.unshift(customer);
});
}
function update(existingCustomer, updatedCustomer) {
return $http.post('/Customer/Update', updatedCustomer)
.success(function(customer) {
angular.extend(existingCustomer, customer);
});
}
function getCustomer(id) {
for (var i = 0; i < customers.length; i++) {
if (customers[i].Id == id) return customers[i];
}
return null;
}
}
})();
@@ -1,31 +0,0 @@
@using InventoryTraker.Web.Helpers
@model InventoryTraker.Web.Models.AddCustomerForm
<form novalidate
name="vm.form"
ng-submit="vm.form.$valid && vm.add()">
<fieldset ng-disabled="vm.saving">
<div class="modal-header">
<h3 class="modal-title">Add New Customer</h3>
</div>
<div class="modal-body">
<div class="alert alert-info" ng-hide="vm.errorMessage != null">
Enter details for the new customer below.
</div>
<div class="alert alert-danger" ng-show="vm.errorMessage != null">
{{vm.errorMessage}}
</div>
@Html.Angular().FormForModel("vm.customer")
</div>
<div class="modal-footer">
<button class="btn btn-success">Add</button>
<button type="button" class="btn btn-warning" ng-click="$dismiss()">Cancel</button>
</div>
</fieldset>
</form>
@@ -1,102 +0,0 @@
@using InventoryTraker.Web.Helpers
@model InventoryTraker.Web.Models.CustomerViewModel
@{
var customer = Html.Angular().ModelFor("vm.customer");
}
<div class="panel panel-default">
<div class="panel-heading">
@customer.BindingFor(x => x.Name) <a href="" ng-click="vm.edit()"><i class="fa fa-edit"></i></a>
<div class="pull-right">
<a class="btn btn-default" href=""
ng-class="{active: vm.selectedView == 'details'}"
ng-click="vm.setView('details')">
<i class="fa fa-user"></i> Info
</a>
<a class="btn btn-green" href=""
ng-class="{active: vm.selectedView == 'opportunities'}"
ng-click="vm.setView('opportunities')">
<i class="fa fa-usd"></i> Opportunities
</a>
<a class="btn btn-red" href=""
ng-class="{active: vm.selectedView == 'risks'}"
ng-click="vm.setView('risks')">
<i class="fa fa-exclamation-triangle"></i>Risks
</a>
</div>
</div>
<table class="table" ng-show="vm.selectedView == 'details'">
<tr>
<td colspan="4">
Rate this customer: @(Html.Angular().UIRating("vm.customer.rating")
.NgClick("vm.setRating()")
.Max(10))
</td>
</tr><tr class="info text-center" ng-show="@customer.ExpressionFor(x => x.TerminationDate)">
<td colspan="4">
Inactive Customer
</td>
</tr>
<tr>
<th>E-mail</th>
<td>
Work: @customer.BindingFor(x => x.WorkEmail)<br />
Home: @customer.BindingFor(x => x.HomeEmail)
</td>
<th>Phone</th>
<td>
Office: @customer.BindingFor(x => x.WorkPhone)<br />
Mobile: @customer.BindingFor(x => x.HomePhone)
</td>
</tr>
<tr>
<th>Work Address</th>
<td style="white-space: pre">@customer.BindingFor(x => x.WorkAddress)</td>
<th>Home Address</th>
<td style="white-space: pre">@customer.BindingFor(x => x.HomeAddress)</td>
</tr>
</table>
<div class="panel-body opportunity-list" ng-show="vm.selectedView == 'opportunities'">
<div class="row">
<div class="col-md-1 half">
<span class="fa fa-2x fa-dollar text-success"></span>
</div>
<div class="col-md-11">
<p ng-show="@customer.ExpressionFor(x => x.Opportunities.Count) == 0">There are no opportunities for this customer.</p>
@using (var opportunity = customer.Repeat(x => x.Opportunities, "opportunity"))
{
<hr ng-hide="$index == 0" />
<h3>
@opportunity.BindingFor(x => x.Title)
</h3>
<p>@opportunity.BindingFor(x => x.Description)</p>
}
<p>
<a class="add-btn" href="" ng-click="vm.addOpportunity()">Add a new opportunity</a>
</p>
</div>
</div>
</div>
<div class="panel-body risk-list" ng-show="vm.selectedView == 'risks'">
<div class="row">
<div class="col-md-1 half">
<span class="fa fa-2x fa-warning text-danger"></span>
</div>
<div class="col-md-11">
<p ng-show="@customer.ExpressionFor(x => x.Risks.Count) == 0">There are no risks for this customer.</p>
@using (var risk = customer.Repeat(x => x.Risks, "risk"))
{
<hr ng-hide="$index == 0" />
<h3>
@risk.BindingFor(x => x.Title)
</h3>
<p>@risk.BindingFor(x => x.Description)</p>
}
<p>
<a class="add-btn" href="" ng-click="vm.addRisk()">Add a new risk</a>
</p>
</div>
</div>
</div>
</div>
@@ -1,31 +0,0 @@
@using InventoryTraker.Web.Helpers
@model InventoryTraker.Web.Models.EditCustomerForm
<form novalidate
name="vm.form"
ng-submit="vm.form.$valid && vm.save()">
<fieldset ng-disabled="vm.saving">
<div class="modal-header">
<h3 class="modal-title">Edit Customer</h3>
</div>
<div class="modal-body">
<div class="alert alert-info" ng-hide="vm.errorMessage != null">
Make changes to the customer below.
</div>
<div class="alert alert-danger" ng-show="vm.errorMessage != null">
{{vm.errorMessage}}
</div>
@Html.Angular().FormForModel("vm.customer")
</div>
<div class="modal-footer">
<button class="btn btn-success">Save</button>
<button type="button" class="btn btn-warning" ng-click="$parent.$dismiss()">Cancel</button>
</div>
</fieldset>
</form>
@@ -1,45 +0,0 @@
(function() {
'use strict';
window.app.directive('addOpportunity', addOpportunity);
function addOpportunity() {
return {
scope: {
customer: "="
},
templateUrl: '/opportunity/template/addOpportunity.tmpl.cshtml',
controller: controller,
controllerAs: 'vm'
}
}
controller.$inject = ['$scope', '$http'];
function controller($scope, $http) {
var vm = this;
vm.saving = false;
vm.opportunity = {
customerId: $scope.customer.id
}
vm.add = add;
function add() {
vm.saving = true;
$http.post('/Opportunity/Add', vm.opportunity)
.success(function (data) {
$scope.customer.opportunities.push(data);
//Close the modal
$scope.$parent.$close();
})
.error(function (data) {
vm.errorMessage = "There was a problem adding the opportunity: " + data;
})
.finally(function () {
vm.saving = false;
});
}
}
})();
@@ -1,31 +0,0 @@
@using InventoryTraker.Web.Helpers
@model InventoryTraker.Web.Models.AddOpportunityForm
<form novalidate
ng-submit="vm.form.$valid && vm.add()"
name="vm.form">
<fieldset ng-disabled="vm.saving">
<div class="modal-header">
<h3 class="modal-title">Add New Opportunity</h3>
</div>
<div class="modal-body">
<div class="alert alert-info" ng-hide="vm.errorMessage != null">
Enter details for the new opportunity.
</div>
<div class="alert alert-danger" ng-show="vm.errorMessage != null">
{{vm.errorMessage}}
</div>
@Html.Angular().FormForModel("vm.opportunity")
</div>
<div class="modal-footer">
<button class="btn btn-success">Add Opportunity</button>
<button type="button" class="btn btn-warning" ng-click="$parent.$dismiss()">Cancel</button>
</div>
</fieldset>
</form>
@@ -1,27 +0,0 @@
(function() {
'use strict';
window.app.directive('lostCustomersReport', lostCustomersReport);
function lostCustomersReport() {
return {
scope: true,
templateUrl: '/js/app/report/templates/lostCustomersReport.tmpl.html',
controller: controller,
controllerAs: 'vm'
}
}
controller.$inject = ['$http'];
function controller($http) {
var vm = this;
vm.isLoading = true;
$http.post('/Report/LostCustomers')
.success(function (customers) {
vm.customers = customers;
vm.isLoading = false;
});
}
})();
@@ -1,27 +0,0 @@
(function() {
'use strict';
window.app.directive('newCustomersReport', newCustomersReport);
function newCustomersReport() {
return {
scope: true,
templateUrl: '/js/app/report/templates/newCustomersReport.tmpl.html',
controller: controller,
controllerAs: 'vm'
}
}
controller.$inject = ['$http'];
function controller($http) {
var vm = this;
vm.isLoading = true;
$http.post('/Report/NewCustomers')
.success(function (customers) {
vm.customers = customers;
vm.isLoading = false;
});
}
})();
@@ -1,36 +0,0 @@
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<i class="fa fa-pie-chart fa-fw"></i> Lost Customers
</h3>
</div>
<table ng-hide="vm.isLoading || vm.customer.length == 0"
class="table table-striped table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Work E-mail</th>
<th>Date Lost</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="customer in vm.customers">
<td>
{{customer.Name}}
</td>
<td>
{{customer.WorkEmail}}
</td>
<td>
{{customer.TerminationDate | parseDate | date: 'shortDate'}}
</td>
</tr>
</tbody>
</table>
<div class="panel-body" ng-show="vm.isLoading">
Loading...
</div>
<div class="panel-body" ng-show="!vm.isLoading && vm.customers.length == 0">
There are no customers on the report.
</div>
</div>
@@ -1,36 +0,0 @@
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<i class="fa fa-pie-chart fa-fw"></i> New Customers
</h3>
</div>
<table ng-hide="vm.isLoading || vm.customers.length == 0"
class="table table-striped table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Work E-mail</th>
<th>Date Acquired</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="customer in vm.customers">
<td>
{{customer.Name}}
</td>
<td>
{{customer.WorkEmail}}
</td>
<td>
{{customer.CreateDate | parseDate | date: 'shortDate'}}
</td>
</tr>
</tbody>
</table>
<div class="panel-body" ng-show="vm.isLoading">
Loading...
</div>
<div class="panel-body" ng-show="!vm.isLoading && vm.customers.length == 0">
There are no customers on the report.
</div>
</div>
@@ -1,45 +0,0 @@
(function() {
'use strict';
window.app.directive('addRisk', addRisk);
function addRisk() {
return {
scope: {
customer: "="
},
templateUrl: '/risk/template/addRisk.tmpl.cshtml',
controller: controller,
controllerAs: 'vm'
}
}
controller.$inject = ['$scope', '$http'];
function controller($scope, $http) {
var vm = this;
vm.saving = false;
vm.risk = {
customerId: $scope.customer.id
}
vm.add = add;
function add() {
vm.saving = true;
$http.post('/Risk/Add', vm.risk)
.success(function (data) {
$scope.customer.risks.push(data);
//Close the modal
$scope.$parent.$close();
})
.error(function (data) {
vm.errorMessage = 'There was a problem adding the risk: ' + data;
})
.finally(function () {
vm.saving = false;
});
}
}
})();
@@ -1,31 +0,0 @@
@using InventoryTraker.Web.Helpers
@model InventoryTraker.Web.Models.AddRiskForm
<form novalidate
ng-submit="vm.form.$valid && vm.add()"
name="vm.form">
<fieldset ng-disabled="vm.saving">
<div class="modal-header">
<h3 class="modal-title">Add New Risk</h3>
</div>
<div class="modal-body">
<div class="alert alert-info" ng-hide="vm.errorMessage != null">
Enter details for the new risk.
</div>
<div class="alert alert-danger" ng-show="vm.errorMessage != null">
{{vm.errorMessage}}
</div>
@Html.Angular().FormForModel("vm.risk")
</div>
<div class="modal-footer">
<button class="btn btn-danger">Add Risk</button>
<button type="button" class="btn btn-warning" ng-click="$parent.$dismiss()">Cancel</button>
</div>
</fieldset>
</form>