Skip to content

Commit 6e13f54

Browse files
committed
Shop design page
1 parent 25becfd commit 6e13f54

File tree

9 files changed

+77
-9
lines changed

9 files changed

+77
-9
lines changed

Zenergy/Zenergy/Pages/shop.html

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<nav class="navbar navbar-default navbar-static-top">
2+
3+
<!-- Collect the nav links, forms, and other content for toggling -->
4+
<div class="collapse navbar-collapse " id="bs-example-navbar-collapse-8">
5+
<ul class="nav navbar-nav">
6+
<li><a href="#Shop" ng-click="test()">All</a></li>
7+
<li ng-repeat="c in categories"><a href="#Shop" ng-click="test()">{{c.categoryName}}</a></li>
8+
</ul>
9+
</div>
10+
</nav>
11+
<div class="container ">
12+
<div class="row">
13+
14+
<div ng-repeat="p in products" class="col-md-4">
15+
<div class="panel panel-primary">
16+
<div class="panel-heading">
17+
<h3 class="panel-title">{{p.productName}} {{p.productPrice}}€ ( -{{p.memberReduction}}% for the members)</h3>
18+
</div>
19+
<div class="panel-body">
20+
<div class="col-md-9">
21+
{{p.productDescr}}
22+
<br />
23+
</div>
24+
<div class="col-md-3">
25+
<button type="button" class="btn btn-success btn-xs" ng-click="">Add to cart</button>
26+
</div>
27+
</div>
28+
</div>
29+
</div>
30+
31+
</div>
32+
</div>

Zenergy/Zenergy/Scripts/Controllers/mainController.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@
1717
};
1818

1919
$scope.isAdmin = function () {
20-
return tokenService.isAdmin();
20+
return tokenService.isAdmin() == "true";
2121
}
2222

2323
$scope.isManager = function () {
24-
return tokenService.isManager();
24+
return tokenService.isManager() == "true";
2525
}
2626

2727
$scope.isContributor = function () {
28-
return tokenService.isContributor();
28+
return tokenService.isContributor() == "true";
2929
}
3030

3131
$scope.isMember = function () {
32-
return tokenService.isMember();
32+
return tokenService.isMember() == "true";
3333
}
3434

3535
$scope.initRoles = function () {

Zenergy/Zenergy/Scripts/Controllers/productsPageController.js

-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111

1212

1313
var Product = $resource('api/products/:productId', { productId: '@id' }, {
14-
update: {
15-
method: 'PUT' // this method issues a PUT request
16-
}
1714
});
1815

1916
$scope.products = Product.query(function () {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
zenergyApp.controller("shopPageController", ["$scope", "$resource", "$uibModal", "$location", function ($scope, $resource, $uibModal, $location) {
2+
3+
if ($scope.isAuthanticated()) {
4+
5+
var Category = $resource('api/categories/:categoryId', { categoryId: '@id' }, {
6+
});
7+
8+
$scope.categories = Category.query(function () {
9+
});
10+
11+
var Product = $resource('api/products/:productId', { productId: '@id' }, {
12+
update: {
13+
method: 'PUT' // this method issues a PUT request
14+
}
15+
});
16+
17+
$scope.products = Product.query(function () {
18+
});
19+
20+
}
21+
else
22+
$location.path("/")
23+
}]);
126 Bytes
Binary file not shown.

Zenergy/Zenergy/Scripts/zenergyApp.js

+10
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@ zenergyApp.config(function ($routeProvider) {
4444
templateUrl: 'Pages/rooms.html',
4545
controller: 'roomsPageController'
4646
})
47+
48+
.when('/Shop', {
49+
templateUrl: 'Pages/shop.html',
50+
controller: 'shopPageController'
51+
})
52+
53+
.when('/Cart', {
54+
templateUrl: 'Pages/cart.html',
55+
controller: 'cartPageController'
56+
})
4757
});
4858

4959

Zenergy/Zenergy/Views/Shared/_Layout.cshtml

+5-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@
2424
<ul class="nav navbar-nav">
2525
<li><a href="#/">Home</a></li>
2626
</ul>
27+
<ul ng-show="isAuthanticated()" class="nav navbar-nav">
28+
<li><a href="#Shop">Shop</a></li>
29+
</ul>
2730
<ul ng-show="isAuthanticated()" class="nav navbar-nav navbar-right">
31+
<li><a href="#Cart"><span class="glyphicon glyphicon glyphicon-shopping-cart" aria-hidden="true"></span></a></li>
2832
<li class="dropdown">
2933
<a class="dropdown-toggle" data-toggle="dropdown" href="">
3034
{{getUserName()}}
@@ -36,7 +40,7 @@
3640
</ul>
3741
</li>
3842
</ul>
39-
<ul class="nav navbar-nav navbar-right" ng-show="isAuthanticated() && isAdmin()">
43+
<ul class="nav navbar-nav navbar-right" ng-show="isAdmin()">
4044
<li class="dropdown">
4145
<a class="dropdown-toggle" data-toggle="dropdown" href="">
4246
Admin Panel

Zenergy/Zenergy/Web.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<!--<add name="ZenergyContext" connectionString="metadata=res://*/Models.ZenergyModel.csdl|res://*/Models.ZenergyModel.ssdl|res://*/Models.ZenergyModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=zenergy.cb9xv2w6phgt.us-west-2.rds.amazonaws.com;initial catalog=zenergy;persist security info=True;user id=admin;password=zenergy1;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />-->
1515

1616
<!-- test-->
17-
<add name="ZenergyContext" connectionString="metadata=res://*/Models.ZenergyModel.csdl|res://*/Models.ZenergyModel.ssdl|res://*/Models.ZenergyModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=zenergy.cb9xv2w6phgt.us-west-2.rds.amazonaws.com;initial catalog=zenergyTest;persist security info=True;user id=admin;password=zenergy1;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
17+
<add name="ZenergyContext" connectionString="metadata=res://*/Models.ZenergyModel.csdl|res://*/Models.ZenergyModel.ssdl|res://*/Models.ZenergyModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=zenergy.cb9xv2w6phgt.us-west-2.rds.amazonaws.com;initial catalog=zenergyTest2;persist security info=True;user id=admin;password=zenergy1;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
1818

1919
</connectionStrings>
2020
<appSettings></appSettings>

Zenergy/Zenergy/Zenergy.csproj

+2
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@
321321
<Content Include="Pages\products.html" />
322322
<Content Include="Pages\profile.html" />
323323
<Content Include="Pages\rooms.html" />
324+
<Content Include="Pages\shop.html" />
324325
<Content Include="Pages\users.html" />
325326
<Content Include="Scripts\Controllers\accountManagementPageController.js" />
326327
<Content Include="Scripts\Controllers\homePageController.js" />
@@ -330,6 +331,7 @@
330331
<Content Include="Scripts\Controllers\registerPageController.js" />
331332
<Content Include="Scripts\Controllers\profilePageController.js" />
332333
<Content Include="Scripts\Controllers\roomsPageController.js" />
334+
<Content Include="Scripts\Controllers\shopPageController.js" />
333335
<Content Include="Scripts\Controllers\usersPageController.js" />
334336
<Content Include="Scripts\Factories\authInterceptorService.js" />
335337
<Content Include="Scripts\Factories\tokenService.js" />

0 commit comments

Comments
 (0)