Skip to content

Commit

Permalink
feat Added beginning of the Sell view
Browse files Browse the repository at this point in the history
Not much more than boilerplate code.
Github issue #18
  • Loading branch information
krazdax5 committed Jul 12, 2016
1 parent 1e22ce7 commit 6c7b4c7
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 12 deletions.
31 changes: 20 additions & 11 deletions LivrETS/Controllers/FairController.cs
Expand Up @@ -58,9 +58,9 @@ public ActionResult Pick()
var currentFair = Repository.GetCurrentFair();
var currentStep = 0;

model.Fair = currentFair;
model.CurrentStep = currentStep;
model.NumberOfPhases = NUMBER_OF_STEPS;
model.Fair = currentFair;
model.CurrentStep = currentStep;
model.NumberOfPhases = NUMBER_OF_STEPS;
Session[CURRENT_STEP] = currentStep;
return View(model);
}
Expand Down Expand Up @@ -93,11 +93,11 @@ public ActionResult Pick(FairViewModel model)
if (seller == null) return RedirectToAction(nameof(Pick));

Session[CURRENT_STEP] = 1;
Session[SELLER] = seller.Id;
model.CurrentStep = 1;
model.User = seller;
model.UserOffers = seller.Offers;
model.FairOffers = currentFair.Offers;
Session[SELLER] = seller.Id;
model.CurrentStep = 1;
model.User = seller;
model.UserOffers = seller.Offers;
model.FairOffers = currentFair.Offers;
break;

case 1:
Expand All @@ -110,16 +110,25 @@ public ActionResult Pick(FairViewModel model)
.ConvertAll(new Converter<Offer, string>(offer => offer.Id.ToString()));

Session[CURRENT_STEP] = 2;
model.CurrentStep = 2;
model.User = seller1;
model.CurrentStep = 2;
model.User = seller1;
break;

case 2:
return RedirectToAction(nameof(Pick));
}
}


return View(model);
}

[HttpGet]
public ActionResult Sell()
{
SellViewModel model = new SellViewModel()
{
Fair = Repository.GetCurrentFair()
};
return View(model);
}

Expand Down
1 change: 1 addition & 0 deletions LivrETS/LivrETS.csproj
Expand Up @@ -288,6 +288,7 @@
<Content Include="Views\Shared\_AdminLayout.cshtml" />
<Content Include="Views\Shared\_MenuPartial.cshtml" />
<Content Include="Views\Fair\Pick.cshtml" />
<Content Include="Views\Fair\Sell.cshtml" />
<None Include="Web.Debug.sample.config" />
<None Include="Web.Release.sample.config" />
<None Include="Web.sample.config" />
Expand Down
5 changes: 5 additions & 0 deletions LivrETS/ViewModels/FairViewModels.cs
Expand Up @@ -34,4 +34,9 @@ public class FairViewModel
public ICollection<Offer> FairOffers { get; set; }
public string UserBarCode { get; set; }
}

public class SellViewModel
{
public Fair Fair;
}
}
2 changes: 1 addition & 1 deletion LivrETS/Views/Fair/Pick.cshtml
Expand Up @@ -27,7 +27,7 @@

@if (Model.Fair == null || Model.Fair.Phase != FairPhase.PICKING)
{
<h2>Vous n'&ecirc;tes pr&eacute;sentement pas en phase de cueillette =(</h2>
<h2>Vous n'&ecirc;tes pas pr&eacute;sentement en p&eacute;riode de cueillette =(</h2>
}
else
{
Expand Down
62 changes: 62 additions & 0 deletions LivrETS/Views/Fair/Sell.cshtml
@@ -0,0 +1,62 @@
@*
LivrETS - Centralized system that manages selling of pre-owned ETS goods.
Copyright (C) 2016 TribuTerre
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
*@
@using LivrETS.ViewModels
@using LivrETS.Models
@model FairViewModel
@{
ViewBag.Title = "Terminal de vente";
}

@if (Model.Fair == null || Model.Fair.Phase != FairPhase.SALE)
{
<h2>Vous n'&ecirc;tes pas pr&eacute;sentement en p&eacute;riode de vente =(</h2>
}
else
{
<div class="page-header">
<h1>Cueillir des articles <small>Pour la Foire @Model.Fair.LivrETSID</small></h1>
</div>

<div class="row">
<div class="col-md-6">
<input type="text" id="article-livretsid" placeholder="Espace de numérisation" />
</div>
</div>

<div class="row">
<div class="col-md-6">
<h4>Articles</h4>
</div>
</div>

<div class="row">
<div class="col-md-6">
<table class="table table-bordered" style="min-height: 500px;">
<thead>
<tr>
<th>ID</th>
<th>Titre</th>
<th>Vendeur</th>
<th>Prix</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
}

0 comments on commit 6c7b4c7

Please sign in to comment.