-
Notifications
You must be signed in to change notification settings - Fork 0
/
manageCat.php
174 lines (156 loc) · 6.78 KB
/
manageCat.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<?php
session_start();
if(!isset($_SESSION['userId']))
{
header('location:login.php');
}
?>
<?php require "assets/function.php" ?>
<?php require 'assets/db.php';?>
<!DOCTYPE html>
<html>
<head>
<title><?php echo siteTitle(); ?></title>
<?php require "assets/autoloader.php" ?>
<style type="text/css">
<?php include 'css/customStyle.css'; ?>
</style>
<?php
$notice="";
if (isset($_POST['safeIn']))
{
$filename = $_FILES['inPic']['name'];
move_uploaded_file($_FILES["inPic"]["tmp_name"], "photo/".$_FILES["inPic"]["name"]);
if ($con->query("insert into categories (name,pic) value ('$_POST[inName]','$filename')")) {
$notice ="<div class='alert alert-success'>تم الاضافة بنجاح</div>";
}
else
$notice ="<div class='alert alert-danger'>خطأ:".$con->error."</div>";
}
?>
</head>
<body style="background: #ECF0F5;padding:0;margin:0">
<div class="dashboard" style="position: fixed;width: 18%;height: 100%;background:#222D32">
<div style="background:#357CA5;padding: 14px 3px;color:white;font-size: 15pt;text-align: center;text-shadow: 1px 1px 11px black">
<a href="index.php" style="color: white;text-decoration: none;"><?php echo strtoupper(siteName()); ?> </a>
</div>
<div class="flex" style="padding: 3px 7px;margin:5px 2px;">
<div><img src="photo/<?php echo $user['pic'] ?>" class='img-circle' style='width: 77px;height: 66px'></div>
<div style="color:lightgreen;font-size: 13pt;padding: 14px 7px;margin-left: 11px;"><?php echo ucfirst($user['name']); ?></div>
</div>
<div style="background: #1A2226;font-size: 10pt;padding: 11px;color: #79978F">القائمة</div>
<div>
<div style="background:#1E282C;color: white;padding: 13px 17px;border-left: 3px solid #3C8DBC;"><span><i class="fa fa-dashboard fa-fw"></i> لوحة التحكم</span></div>
<div class="item">
<ul class="nostyle zero">
<a href="index.php"><li style="color: white"><i class="fa fa-circle-o fa-fw"></i> الرئيسية</li></a>
<a href="inventeries.php"><li><i class="fa fa-circle-o fa-fw"></i> الادوية</li></a>
<a href="addnew.php"><li><i class="fa fa-circle-o fa-fw"></i> اضافة دواء جديد</li></a>
<a href="reports.php"><li><i class="fa fa-circle-o fa-fw"></i> الفواتير</li></a>
</ul><
</div>
</div>
<div style="background:#1E282C;color: white;padding: 13px 17px;border-left: 3px solid #3C8DBC;"><span><i class="fa fa-globe fa-fw"></i> اعدادات اخرى</span></div>
<div class="item">
<ul class="nostyle zero">
<a href="sitesetting.php"><li><i class="fa fa-circle-o fa-fw"></i> اعدادات النظام</li></a>
<a href="profile.php"><li><i class="fa fa-circle-o fa-fw"></i> الملف الشخصي</li></a>
<a href="accountSetting.php"><li><i class="fa fa-circle-o fa-fw"></i> بيانات الحساب</li></a>
<a href="logout.php"><li><i class="fa fa-circle-o fa-fw"></i> تسجيل الخروج</li></a>
</ul><
</div>
</div>
<div class="marginLeft" >
<div style="color:white;background:#3C8DBC" >
<div class="pull-right flex rightAccount" style="padding-right: 11px;padding: 7px;">
<div><img src="photo/<?php echo $user['pic'] ?>" style='width: 41px;height: 33px;' class='img-circle'></div>
<div style="padding: 8px"><?php echo ucfirst($user['name']) ?></div>
</div>
<div class="clear"></div>
</div>
<div class="account" style="display: none;">
<div style="background: #3C8DBC;padding: 22px;" class="center">
<img src="photo/<?php echo $user['pic'] ?>" style='width: 100px;height: 100px; margin:auto;' class='img-circle img-thumbnail'>
<br><br>
<span style="font-size: 13pt;color:#CEE6F0"><?php echo $user['name'] ?></span><br>
<span style="color: #CEE6F0;font-size: 10pt">عضو منذ:<?php echo $user['date']; ?></span>
</div>
<div style="padding: 11px;">
<a href="profile.php"><button class="btn btn-default" style="border-radius:0">الملف الشخصي</button>
<a href="logout.php"><button class="btn btn-default pull-right" style="border-radius: 0">تسجيل الخروج</button></a>
</div>
</div>
<div class="content2">
<ol class="breadcrumb ">
<li><a href="index.php"><i class="fa fa-dashboard"></i> الرئيسية</a></li>
<li class="active">ادارة التصنيفات</li>
</ol>
<?php echo $notice; ?>
<div>
<span style="font-size: 16pt;color: #333333">التصنيفات </span>
<button class="btn btn-primary btn-sm pull-right" data-toggle="modal" data-target="#addIn"><i class="fa fa-plus fa-fw"> </i>اضافة تصنيف جديد</button>
</div>
<?php
$i=0;
$array = $con->query("select * from categories");
?>
<br>
<table class="table table-hover table-striped " style="width: 55%;margin: auto;">
<tr>
<th>التسلسل</th>
<th>الاسم</th>
<th>كمية الادوية</th>
<th>تحرير</th>
</tr>
<?php
while ($row = $array->fetch_assoc())
{
$i++;
$array2 = $con->query("select count(*) as qty from inventeries where catId = '$row[id]'");
$row2 = $array2->fetch_assoc();
?>
<tr>
<td><?php echo $i ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row2['qty']; ?></td>
<td><a href="delete.php?category=<?php echo $row['id'] ?>"><button class="btn btn-xs btn-danger">حذف</button></a></td>
</tr>
<?php
}
echo "</table>";
?>
</div>
</div>
<div id="addIn" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">اضافة تصنيف جديد</h4>
</div>
<div class="modal-body"> <form method="POST" enctype="multipart/form-data">
<div style="width: 77%;margin: auto;">
<div class="form-group">
<label for="some" class="col-form-label">الاسم</label>
<input type="text" name="inName" class="form-control" id="some" required>
</div>
<div class="form-group">
<label for="2" class="col-form-label">الصورة</label>
<input type="file" name="inPic" class="form-control" id="2" required>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">الغاء</button>
<button type="submit" class="btn btn-primary" name="safeIn">اضافة </button>
</div>
</form>
</div>
</div>
</div>
</body>
</html>
<script type="text/javascript">
$(document).ready(function(){$(".rightAccount").click(function(){$(".account").fadeToggle();});});
</script>