Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Kunto
/
backoffice
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 49e272bd
authored
Oct 19, 2019
by
yasir
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
tambah filter customer dan vendor
1 parent
629e114d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
9 deletions
src/agratek/api/merchant/views/payment_list.py
src/agratek/api/merchant/views/templates/payment/list.pt
src/agratek/api/merchant/views/payment_list.py
View file @
49e272b
...
...
@@ -19,12 +19,13 @@ from .api_merchant import payment_advice
log
=
logging
.
getLogger
(
__name__
)
status_payment
=
(
status_payment
=
[
(
9999
,
'--Semua--'
),
(
0
,
'Pending'
),
(
1
,
'Sukses'
),
(
2
,
'Batal'
),
)
]
def
filter_tanggal
(
request
,
query
,
field
):
...
...
@@ -75,8 +76,36 @@ def query_csv(request, status):
def
form_validator
(
form
,
value
):
pass
def
get_vendors
():
vend_get
=
Partner
.
get_vendor_list
()
select_vendor
=
[(
9999
,
'--Semua--'
)]
for
val
in
vend_get
:
select_vendor
.
append
(
tuple
((
val
.
id
,
val
.
nama
)))
print
(
'isi vendors >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'
)
print
(
select_vendor
)
return
select_vendor
def
get_customers
():
cust_get
=
Partner
.
get_customer_list
()
select_customer
=
[(
9999
,
'--Semua--'
)]
for
val
in
cust_get
:
# select_customer.append(val)
select_customer
.
append
(
tuple
((
val
.
id
,
val
.
nama
)))
print
(
'isi customer >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'
)
print
(
select_customer
)
return
select_customer
class
ViewData
(
BaseView
):
# select_vendor.append(val)
# print('isi list >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
# print(a)
# print(b)
@view_config
(
route_name
=
'api-payment-list'
,
permission
=
"api-payment-list"
,
renderer
=
'templates/payment/list.pt'
)
...
...
@@ -84,7 +113,8 @@ class ViewData(BaseView):
class
ToolbarSchema
(
colander
.
Schema
):
status
=
colander
.
SchemaNode
(
colander
.
String
(),
oid
=
"status"
,
widget
=
widget
.
SelectWidget
(
values
=
status_payment
,
css_class
=
'form-toolbar'
)
oid
=
"status"
,
widget
=
widget
.
SelectWidget
(
values
=
status_payment
)
)
awal
=
colander
.
SchemaNode
(
colander
.
String
(),
...
...
@@ -96,6 +126,18 @@ class ViewData(BaseView):
oid
=
"akhir"
,
title
=
"-"
)
cust_sel
=
colander
.
SchemaNode
(
colander
.
String
(),
oid
=
"cust_sel"
,
title
=
"Customer"
,
widget
=
widget
.
SelectWidget
(
values
=
get_vendors
()),
)
vend_sel
=
colander
.
SchemaNode
(
colander
.
String
(),
oid
=
"vend_sel"
,
title
=
"Vendor"
,
widget
=
widget
.
SelectWidget
(
values
=
get_customers
()),
)
toolbar
=
ToolbarSchema
(
Validator
=
form_validator
)
toolbar
.
request
=
self
.
req
...
...
@@ -168,6 +210,12 @@ class ViewData(BaseView):
status
=
9999
if
'status'
in
request
.
params
:
status
=
int
(
request
.
params
[
'status'
])
opt_cust
=
9999
if
'cust'
in
request
.
params
:
opt_cust
=
int
(
request
.
params
[
'cust'
])
opt_vend
=
9999
if
'vend'
in
request
.
params
:
opt_vend
=
int
(
request
.
params
[
'vend'
])
vendor
=
aliased
(
Partner
,
name
=
'vendor'
)
customer
=
aliased
(
Partner
,
name
=
'customer'
)
...
...
@@ -206,6 +254,10 @@ class ViewData(BaseView):
else
:
query
=
query
.
filter
(
PartnerPay
.
status
==
status
)
query
=
filter_tanggal
(
query
,
PartnerPay
.
created
)
if
opt_cust
!=
9999
:
query
=
query
.
filter
(
customer
.
id
==
opt_cust
)
if
opt_vend
!=
9999
:
query
=
query
.
filter
(
vendor
.
id
==
opt_vend
)
row_table
=
DataTables
(
request
.
GET
,
query
,
columns
)
return
row_table
.
output_result
()
elif
act
==
"csv"
:
...
...
src/agratek/api/merchant/views/templates/payment/list.pt
View file @
49e272b
<html>
<div
metal:use-macro=
"load: ../base.pt"
>
<!-- content -->
<div
metal:fill-slot=
"content"
>
...
...
@@ -8,7 +9,7 @@
overflow-y
:
auto
;
}
</style>
<div id="tmp-toolbar" style="display: inline-block;">
<div
id=
"tmp-toolbar"
class=
"col-md-12"
style=
"display: inline-block;"
>
<span
tal:repeat=
"f params.form"
tal:omit-tag=
""
>
<label
for=
"${f.oid}"
class=
"control-label"
>
${f.title}
...
...
@@ -88,7 +89,10 @@
param
+=
'&akhir='
+
akhir
;
}
return oTableUrl + '?status=' + opt.toString() + param;
var
opt_cust
=
$
(
'select#cust_sel'
).
val
();
var
opt_vend
=
$
(
'select#vend_sel'
).
val
();
return
oTableUrl
+
'?status='
+
opt
.
toString
()
+
param
+
'&cust='
+
opt_cust
.
toString
()
+
'&vend='
+
opt_vend
.
toString
();
}
function
getViewUrl
(
vid
)
{
...
...
@@ -144,7 +148,7 @@
"previous"
:
""
,
"next"
:
""
,
},
"lengthMenu": "
Tampil _MENU_ baris
"
"lengthMenu"
:
"
Tampil _MENU_ baris
"
},
});
...
...
@@ -162,7 +166,7 @@
var
tb
=
tb_array
.
join
(
' '
);
$
(
"div.toolbar"
).
html
(
tb
)
.
attr
(
'style'
,
'display:block; float: left; margin-bottom:6px; line-height:16px;'
);
$('#tmp-toolbar').appendTo($("div.toolbar"));
//
$('#tmp-toolbar').appendTo($("div.toolbar"));
//events
$
(
'#table1 tbody'
).
on
(
'click'
,
'tr'
,
function
()
{
...
...
@@ -210,6 +214,14 @@
mID
=
0
;
oTable
.
ajax
.
url
(
getDataUrl
()).
load
();
});
$
(
'select#cust_sel'
).
on
(
'change'
,
function
()
{
mID
=
0
;
oTable
.
ajax
.
url
(
getDataUrl
()).
load
();
});
$
(
'select#vend_sel'
).
on
(
'change'
,
function
()
{
mID
=
0
;
oTable
.
ajax
.
url
(
getDataUrl
()).
load
();
});
$
(
'#awal,#akhir'
).
datepicker
({
format
:
'dd-mm-yyyy'
,
...
...
@@ -223,6 +235,13 @@
var
el
=
$
(
'#table1_length'
).
parent
();
el
.
addClass
(
'col-md-9'
);
el
.
removeClass
(
'col-md-8'
);
var
elParent
=
el
.
parent
();
$
(
'#tmp-toolbar'
).
appendTo
(
elParent
);
$
(
'#table1_length'
).
addClass
(
'form-control'
);
$
(
'#table1_length'
).
appendTo
(
$
(
'#tmp-toolbar'
));
$
(
'#table1_length'
).
css
(
'border'
,
'0px'
);
$
(
'select[name ="table1_length"]'
).
removeClass
(
'form-control'
);
var
el
=
$
(
'#table1_filter'
).
parent
();
el
.
addClass
(
'col-md-3'
);
...
...
@@ -258,7 +277,10 @@
param
+=
'&akhir='
+
akhir
;
}
return csvUrl + '?status=' + opt.toString() + param;
var
opt_cust
=
$
(
'select#cust_sel'
).
val
();
var
opt_vend
=
$
(
'select#vend_sel'
).
val
();
return
oTableUrl
+
'?status='
+
opt
.
toString
()
+
param
+
'&cust='
+
opt_cust
.
toString
()
+
'&vend='
+
opt_vend
.
toString
();
}
$
(
'#btn_csv'
).
click
(
function
()
{
window
.
open
(
getCSV_url
());
...
...
@@ -300,4 +322,5 @@
});
</script>
</div>
\ No newline at end of file
</div>
</html>
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment