Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CS699_project
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
YADNYESH SANTOSH PATIL
CS699_project
Commits
1547bb6c
Commit
1547bb6c
authored
Nov 28, 2019
by
ASHISH KUMAR GOYAL
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rebate Approve/Reject working
parent
15555813
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
95 additions
and
30 deletions
+95
-30
hostel_mess/db.sqlite3
hostel_mess/db.sqlite3
+0
-0
hostel_mess/templates/apprebate.html
hostel_mess/templates/apprebate.html
+6
-2
hostel_mess/templates/appreq.html
hostel_mess/templates/appreq.html
+5
-2
hostel_mess/templates/rebates.html
hostel_mess/templates/rebates.html
+14
-17
hostel_mess/templates/viewreq.html
hostel_mess/templates/viewreq.html
+2
-2
hostel_mess/usermgmt/__pycache__/urls.cpython-36.pyc
hostel_mess/usermgmt/__pycache__/urls.cpython-36.pyc
+0
-0
hostel_mess/usermgmt/__pycache__/utils.cpython-36.pyc
hostel_mess/usermgmt/__pycache__/utils.cpython-36.pyc
+0
-0
hostel_mess/usermgmt/__pycache__/views.cpython-36.pyc
hostel_mess/usermgmt/__pycache__/views.cpython-36.pyc
+0
-0
hostel_mess/usermgmt/urls.py
hostel_mess/usermgmt/urls.py
+7
-1
hostel_mess/usermgmt/utils.py
hostel_mess/usermgmt/utils.py
+8
-4
hostel_mess/usermgmt/views.py
hostel_mess/usermgmt/views.py
+53
-2
No files found.
hostel_mess/db.sqlite3
View file @
1547bb6c
No preview for this file type
hostel_mess/templates/apprebate.html
View file @
1547bb6c
...
...
@@ -139,6 +139,8 @@
<div
class=
"card-body"
>
{% if pending_rebates %}
<div
class=
"table-responsive"
>
<form>
{% csrf_token %}
<table
class=
"table table-bordered"
id=
"dataTable"
width=
"100%"
cellspacing=
"0"
>
<thead>
<tr>
...
...
@@ -168,12 +170,14 @@
<td>
{{ rebate.ldap }}
</td>
<td>
{{ rebate.name }}
</td>
<td>
{{ rebate.duration }}
</td>
<td><button
type=
"button"
class=
"btn btn-outline-success"
>
APPROVE
</button>
<button
type=
"button"
class=
"btn btn-outline-danger"
>
REJECT
</button>
</td>
<td>
<input
id=
{{rebate.id}}
name=
"approve"
type=
"submit"
class=
"btn btn-outline-success"
formaction=
"/user/rebate/approve/{{rebate.id}}"
formmethod=
"GET"
value=
"APPROVE"
/>
<input
id=
{{rebate.id}}
name=
"reject"
type=
"submit"
class=
"btn btn-outline-danger"
formaction=
"/user/rebate/reject/{{rebate.id}}"
formmethod=
"GET"
value=
"REJECT"
/></td>
</tr>
{% endfor %}
</tbody>
</table>
</form>
</div>
{% else %}
<div
class=
"text-center"
>
...
...
hostel_mess/templates/appreq.html
View file @
1547bb6c
...
...
@@ -124,6 +124,8 @@
<div
class=
"card-body"
>
{% if pending_overheads %}
<div
class=
"table-responsive"
>
<form>
{% csrf_token %}
<table
class=
"table table-bordered"
id=
"dataTable"
width=
"100%"
cellspacing=
"0"
>
<thead>
<tr>
...
...
@@ -153,8 +155,9 @@
<td>
{{ overhead.name }}
</td>
<td>
{{ overhead.mealType }}
</td>
<td>
{{ overhead.count }}
</td>
<td><button
type=
"button"
class=
"btn btn-outline-success"
>
APPROVE
</button>
<button
type=
"button"
class=
"btn btn-outline-danger"
>
REJECT
</button>
</td>
<td>
<input
id=
{{overhead.id}}
name=
"approve"
type=
"submit"
class=
"btn btn-outline-success"
value=
'APPROVE'
formaction=
"/user/overhead/approve/{{overhead.id}}"
formmethod=
"GET"
/>
<input
id=
{{overhead.id}}
name=
"reject"
type=
"submit"
class=
"btn btn-outline-danger"
value=
'REJECT'
formaction=
"/user/overhead/reject/{{overhead.id}}"
formmethod=
"GET"
\
></td>
</tr>
{% endfor %}
</tbody>
...
...
hostel_mess/templates/rebates.html
View file @
1547bb6c
...
...
@@ -34,7 +34,7 @@
<!-- Nav Item - Dashboard -->
<li
class=
"nav-item active"
>
<a
class=
"nav-link"
href=
"
viewreq.html
"
>
<a
class=
"nav-link"
href=
"
{% url 'homepage' %}
"
>
<i
class=
"fas fa-fw fa-tachometer-alt"
></i>
<span>
HOME
</span></a>
</li>
...
...
@@ -56,14 +56,14 @@
<div
id=
"collapseTwo"
class=
"collapse"
aria-labelledby=
"headingTwo"
data-parent=
"#accordionSidebar"
>
<div
class=
"bg-white py-2 collapse-inner rounded"
>
<h6
class=
"collapse-header"
><b>
Raise Request for:
</b></h6>
<a
class=
"collapse-item"
href=
"
rebates.html
"
><b>
REBATES
</b></a>
<a
class=
"collapse-item"
href=
"
overheads.html
"
><b>
OVERHEAD
</b></a>
<a
class=
"collapse-item"
href=
"
{% url 'rebate' %}
"
><b>
REBATES
</b></a>
<a
class=
"collapse-item"
href=
"
{% url 'overhead' %}
"
><b>
OVERHEAD
</b></a>
</div>
</div>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"
viewreq.html
"
>
<a
class=
"nav-link"
href=
"
{% url 'homepage' %}
"
>
<i
class=
"fas fa-fw fa-table"
></i>
<span><b>
VIEW REQUESTS
</b></span></a>
</li>
...
...
@@ -77,13 +77,6 @@
</div>
<!-- Nav Item - Tables -->
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"history.html"
>
<i
class=
"fas fa-fw fa-table"
></i>
<span><b>
HISTORY
</b></span></a>
</li>
<!-- Divider -->
<hr
class=
"sidebar-divider d-none d-md-block"
>
...
...
@@ -133,14 +126,18 @@
<div
class=
"container-fluid"
>
<div
class=
"row d-flex justify-content-center"
>
<div
class=
"col-md-6"
>
<form>
<form
action=
"{% url 'rebate' %}"
method=
"POST"
>
{% csrf_token %}
<div
class=
"form-group text-danger font-weight-bold"
>
<label
id=
'error_msg'
>
{{ error_msg }}
</label>
</div>
<div
class=
"form-group"
>
<label
for=
"
exampleFormControlInput1
"
><b>
FROM (DATE)
</b></label>
<input
type=
"Date"
class=
"form-control"
id=
"
exampleFormControlInput1
"
>
<label
for=
"
from
"
><b>
FROM (DATE)
</b></label>
<input
type=
"Date"
class=
"form-control"
id=
"
from"
name=
"from
"
>
</div>
<div
class=
"form-group"
>
<label
for=
"
exampleFormControlInput1
"
><b>
TO (DATE)
</b></label>
<input
type=
"Date"
class=
"form-control"
id=
"
exampleFormControlInput1"
>
<label
for=
"
to
"
><b>
TO (DATE)
</b></label>
<input
type=
"Date"
class=
"form-control"
id=
"
to"
name=
"to"
>
</div>
<button
type=
"submit"
class=
"btn btn-primary"
><b>
Submit
</b></button>
</form>
...
...
@@ -186,7 +183,7 @@
<div
class=
"modal-body"
>
Select "Logout" below if you are ready to end your current session.
</div>
<div
class=
"modal-footer"
>
<button
class=
"btn btn-secondary"
type=
"button"
data-dismiss=
"modal"
>
Cancel
</button>
<a
class=
"btn btn-primary"
href=
"
login.html
"
>
Logout
</a>
<a
class=
"btn btn-primary"
href=
"
{% url 'logout' %}
"
>
Logout
</a>
</div>
</div>
</div>
...
...
hostel_mess/templates/viewreq.html
View file @
1547bb6c
...
...
@@ -78,11 +78,11 @@
<!-- Nav Item - Tables -->
<li
class=
"nav-item"
>
<
!-- <
li class="nav-item">
<a class="nav-link" href="history.html">
<i class="fas fa-fw fa-table"></i>
<span><b>HISTORY</b></span></a>
</li>
</li>
-->
<!-- Divider -->
<hr
class=
"sidebar-divider d-none d-md-block"
>
...
...
hostel_mess/usermgmt/__pycache__/urls.cpython-36.pyc
View file @
1547bb6c
No preview for this file type
hostel_mess/usermgmt/__pycache__/utils.cpython-36.pyc
View file @
1547bb6c
No preview for this file type
hostel_mess/usermgmt/__pycache__/views.cpython-36.pyc
View file @
1547bb6c
No preview for this file type
hostel_mess/usermgmt/urls.py
View file @
1547bb6c
...
...
@@ -25,5 +25,11 @@ urlpatterns = [
## manager's functions below:
path
(
'apprebate/'
,
views
.
apprebate
),
path
(
'monthlyrepo/'
,
views
.
monthlyrepo
),
path
(
'dailyreqhist/'
,
views
.
dailyreqhist
)
path
(
'dailyreqhist/'
,
views
.
dailyreqhist
),
path
(
'rebate/approve/<int:id>/'
,
views
.
approve_rebate
),
path
(
'rebate/reject/<int:id>/'
,
views
.
reject_rebate
),
path
(
'overhead/approve/<int:id>/'
,
views
.
approve_overhead
),
path
(
'overhead/reject/<int:id>/'
,
views
.
reject_overhead
),
]
\ No newline at end of file
hostel_mess/usermgmt/utils.py
View file @
1547bb6c
...
...
@@ -19,7 +19,8 @@ def generate_pending_rebates():
'to'
:
str
(
reb
.
toDate
),
'ldap'
:
reb
.
student
.
user
.
username
,
'name'
:
f
'{reb.student.user.first_name+reb.student.user.last_name}'
,
'duration'
:
str
((
reb
.
toDate
-
reb
.
fromDate
)
.
days
)
'duration'
:
str
((
reb
.
toDate
-
reb
.
fromDate
)
.
days
),
'id'
:
reb
.
id
}])
if
len
(
context
[
"pending_rebates"
])
==
0
:
return
None
...
...
@@ -34,7 +35,8 @@ def generate_pending_overheads():
'ldap'
:
ovr
.
student
.
user
.
username
,
'name'
:
f
'{ovr.student.user.first_name+ovr.student.user.last_name}'
,
'mealType'
:
ovr
.
mealType
,
'count'
:
ovr
.
count
'count'
:
ovr
.
count
,
'id'
:
ovr
.
id
}])
if
len
(
context
[
"pending_overheads"
])
==
0
:
return
None
...
...
@@ -50,13 +52,15 @@ def generate_my_requests(user):
'date'
:
str
(
ovr
.
date
),
'meal'
:
ovr
.
mealType
,
'status'
:
status
[
ovr
.
status
],
'count'
:
ovr
.
count
'count'
:
ovr
.
count
,
'id'
:
ovr
.
id
}])
for
reb
in
RebateReq
.
objects
.
filter
(
student
=
student
):
context
[
"prev_rebates"
]
.
extend
([{
'from'
:
str
(
reb
.
fromDate
),
'to'
:
str
(
reb
.
toDate
),
'status'
:
status
[
reb
.
status
]
'status'
:
status
[
reb
.
status
],
'id'
:
reb
.
id
}])
if
len
(
context
[
"prev_overheads"
])
==
0
:
context
.
pop
(
"prev_overheads"
)
...
...
hostel_mess/usermgmt/views.py
View file @
1547bb6c
...
...
@@ -4,6 +4,7 @@ from django.contrib.auth.models import User
from
django.contrib.auth
import
authenticate
,
login
,
logout
from
django.contrib.auth.decorators
import
login_required
,
user_passes_test
from
usermgmt.utils
import
*
from
.models
import
Student
,
RebateReq
,
Meal
,
OverheadReq
# Create your views here.
@
login_required
...
...
@@ -66,7 +67,57 @@ def worker_homepage_view(request):
@
login_required
def
rebate
(
request
):
return
render
(
request
,
'rebates.html'
)
student
=
Student
.
objects
.
filter
(
user
=
request
.
user
)[
0
]
reb
=
RebateReq
()
if
request
.
method
==
'GET'
:
return
render
(
request
,
'rebates.html'
)
elif
request
.
method
==
'POST'
:
fromDate
=
request
.
POST
[
'from'
]
toDate
=
request
.
POST
[
'to'
]
print
(
fromDate
)
print
(
toDate
)
reb
.
student
=
student
reb
.
fromDate
=
fromDate
reb
.
toDate
=
toDate
reb
.
status
=
'W'
reb
.
save
()
return
redirect
(
'homepage'
)
@
login_required
@
user_passes_test
(
is_manager
)
def
approve_rebate
(
request
,
id
):
reb
=
RebateReq
.
objects
.
filter
(
id
=
id
)[
0
]
reb
.
status
=
'Y'
reb
.
save
()
return
redirect
(
'manager-homepage'
)
@
login_required
@
user_passes_test
(
is_manager
)
def
reject_rebate
(
request
,
id
):
reb
=
RebateReq
.
objects
.
filter
(
id
=
id
)[
0
]
reb
.
status
=
'N'
reb
.
save
()
return
redirect
(
'manager-homepage'
)
@
login_required
@
user_passes_test
(
is_manager
)
def
approve_overhead
(
request
,
id
):
reb
=
OverheadReq
.
objects
.
filter
(
id
=
id
)[
0
]
reb
.
status
=
'Y'
reb
.
save
()
return
redirect
(
'worker-homepage'
)
@
login_required
@
user_passes_test
(
is_manager
)
def
reject_overhead
(
request
,
id
):
reb
=
OverheadReq
.
objects
.
filter
(
id
=
id
)[
0
]
reb
.
status
=
'N'
reb
.
save
()
return
redirect
(
'worker-homepage'
)
def
overhead
(
request
):
return
render
(
request
,
'overheads.html'
)
...
...
@@ -87,4 +138,4 @@ def monthlyrepo(request):
return
render
(
request
,
'monthlyrepo.html'
)
def
dailyreqhist
(
request
):
return
render
(
request
,
'dialyreqhist.html'
)
\ No newline at end of file
return
render
(
request
,
'dialyreqhist.html'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment