Skip to content

Commit 9227aa9

Browse files
authored
Merge pull request #213 from OscarK-coder/new-branch
Product Inventory System
2 parents c53a122 + 91cd215 commit 9227aa9

File tree

1 file changed

+117
-0
lines changed

1 file changed

+117
-0
lines changed

Coding/Product Inventory System.html

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Product Inventory System</title>
7+
<style>
8+
body {
9+
font-family: Arial, sans-serif;
10+
text-align: center;
11+
background-color: #f4f4f4;
12+
}
13+
14+
h1 {
15+
color: rgb(0, 100, 0);
16+
}
17+
18+
table {
19+
border-collapse: collapse;
20+
width: 70%;
21+
margin: 30px auto;
22+
}
23+
24+
th, td {
25+
padding: 10px;
26+
text-align: center;
27+
}
28+
29+
th {
30+
background-color: rgb(0, 128, 128);
31+
color: white;
32+
}
33+
34+
tr:nth-child(even) {
35+
background-color: rgb(220, 220, 220);
36+
}
37+
38+
tr:nth-child(odd) {
39+
background-color: rgb(198, 213, 217);
40+
}
41+
42+
tr:hover {
43+
background-color: rgb(125, 218, 32);
44+
color: white;
45+
}
46+
47+
input[type="text"] {
48+
padding: 5px;
49+
border: 1px solid #ccc;
50+
border-radius: 5px;
51+
}
52+
53+
button {
54+
background-color: rgb(0, 128, 128);
55+
color: white;
56+
padding: 10px 20px;
57+
border: none;
58+
border-radius: 5px;
59+
cursor: pointer;
60+
}
61+
62+
button:hover {
63+
background-color: rgb(0, 100, 0);
64+
}
65+
</style>
66+
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
67+
<script>
68+
var app = angular.module("MyApp", []);
69+
app.controller("MyController", function ($scope) {
70+
$scope.products = [];
71+
72+
$scope.addProduct = function () {
73+
if ($scope.name != undefined && $scope.price) {
74+
let data = {
75+
name: $scope.name,
76+
price: $scope.price
77+
}
78+
$scope.products.push(data);
79+
$scope.name = '';
80+
$scope.price = '';
81+
}
82+
else {
83+
alert("Please enter the data..")
84+
}
85+
}
86+
87+
$scope.remove = function (index) {
88+
$scope.products.splice(index, 1);
89+
}
90+
});
91+
</script>
92+
</head>
93+
<body ng-app="MyApp" ng-controller="MyController">
94+
<h1>Product Inventory System</h1>
95+
Enter the Product Name <input type="text" ng-model="name"><br><br>
96+
Enter the Product Price <input type="text" ng-model="price"><br><br>
97+
<button ng-click="addProduct()">Add Product</button>
98+
<hr>
99+
<table border='1'>
100+
<tr>
101+
<th>SI No.</th>
102+
<th>Name</th>
103+
<th>Price</th>
104+
<th>Remove</th>
105+
</tr>
106+
107+
<tr ng-repeat="x in products">
108+
<td>{{$index+1}}</td>
109+
<td>{{x.name | lowercase}}</td>
110+
<td>{{x.price | currency:'Rs.'}}</td>
111+
<td>
112+
<button ng-click="remove($index)">Delete</button>
113+
</td>
114+
</tr>
115+
</table>
116+
</body>
117+
</html>

0 commit comments

Comments
 (0)