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 9e225abb
authored
Sep 20, 2019
by
Tatang
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
list purchase
1 parent
24f3448a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
463 additions
and
124 deletions
src/agratek/api/merchant/views/payment_list.py
src/agratek/api/merchant/views/purchase_list.py
src/agratek/api/merchant/views/templates/base.pt
src/agratek/api/merchant/views/templates/payment/list.pt
src/agratek/api/merchant/views/templates/purchase/list.pt
src/agratek/api/merchant/views/templates/purchase/view.pt
src/agratek/api/merchant/views/payment_list.py
View file @
9e225ab
...
@@ -4,18 +4,24 @@ from deform import widget, Form, ValidationFailure
...
@@ -4,18 +4,24 @@ from deform import widget, Form, ValidationFailure
from
opensipkd.base.views
import
DataTables
from
opensipkd.base.views
import
DataTables
from
pyramid.httpexceptions
import
HTTPFound
from
pyramid.httpexceptions
import
HTTPFound
from
pyramid.view
import
view_config
from
pyramid.view
import
view_config
from
sqlalchemy
.orm
import
aliased
from
sqlalchemy
import
func
from
.
import
BaseView
from
.
import
BaseView
from
..models
import
(
DBSession
,
PartnerPay
,
Partner
)
from
..models
import
(
DBSession
,
H2hArInvoice
,
H2hArInvoiceDet
,
Partner
)
from
opensipkd.base.tools
import
format_json
from
opensipkd.base.tools
import
format_json
from
opensipkd.base.tools.db
import
column_concat
from
opensipkd.base.tools.db
import
column_concat
status_payment
=
(
status_payment
=
(
(
-
1
,
'--Semua--'
),
(
-
1
,
'--Semua--'
),
(
0
,
'Pending'
),
(
0
,
'Pending'
),
(
1
,
'Sukses / Selesai'
),
(
1
,
'Sukses'
),
(
2
,
'Batal / Reversal'
),
(
2
,
'Batal'
),
)
invoice_type
=
(
(
0
,
'--None--'
),
(
1
,
'Purchase'
),
(
2
,
'Register'
),
)
)
...
@@ -29,9 +35,10 @@ class ViewData(BaseView):
...
@@ -29,9 +35,10 @@ class ViewData(BaseView):
renderer
=
'templates/payment/list.pt'
)
renderer
=
'templates/payment/list.pt'
)
def
view_list
(
self
):
def
view_list
(
self
):
class
ToolbarSchema
(
colander
.
Schema
):
class
ToolbarSchema
(
colander
.
Schema
):
status
=
colander
.
SchemaNode
(
inv_type
=
colander
.
SchemaNode
(
colander
.
String
(),
colander
.
Integer
(),
oid
=
"status"
,
widget
=
widget
.
SelectWidget
(
values
=
status_payment
,
css_class
=
'form-toolbar'
)
default
=
1
,
oid
=
"inv_type"
,
widget
=
widget
.
SelectWidget
(
values
=
invoice_type
,
css_class
=
'form-toolbar'
)
)
)
toolbar
=
ToolbarSchema
(
Validator
=
form_validator
)
toolbar
=
ToolbarSchema
(
Validator
=
form_validator
)
...
@@ -40,22 +47,18 @@ class ViewData(BaseView):
...
@@ -40,22 +47,18 @@ class ViewData(BaseView):
params
=
{
params
=
{
'form'
:
form
,
'form'
:
form
,
'
status_payment'
:
[
s
for
k
,
s
in
status_payment
if
k
>
-
1
],
'
invoice_type'
:
[
k
and
s
or
'-'
for
k
,
s
in
invoice_type
],
'columns'
:
[
'columns'
:
[
dict
(
title
=
"ID"
),
dict
(
title
=
"ID"
),
dict
(
title
=
"No. Invoice"
),
dict
(
title
=
"No. Invoice"
),
dict
(
title
=
"Customer"
),
dict
(
title
=
"Customer"
),
dict
(
title
=
"Vendor"
),
dict
(
title
=
"Jenis"
),
dict
(
title
=
"Amount"
),
dict
(
title
=
"Status"
),
],
],
'column_data'
:
[
'column_data'
:
[
dict
(
data
=
"id"
,
width
=
"0px"
),
dict
(
data
=
"id"
,
width
=
"0px"
),
dict
(
data
=
"nomor"
,
width
=
"150px"
),
dict
(
data
=
"nomor"
,
width
=
"150px"
),
dict
(
data
=
"customer"
),
dict
(
data
=
"customer"
),
dict
(
data
=
"vendor"
),
dict
(
data
=
"inv_type"
,
width
=
"100px"
),
dict
(
data
=
"amount"
,
width
=
"100px"
),
dict
(
data
=
"status"
,
width
=
"100px"
),
],
],
'buttons'
:
[
'buttons'
:
[
dict
(
id
=
"btn_view"
,
cls
=
"btn btn btn-primary"
,
title
=
"View"
),
dict
(
id
=
"btn_view"
,
cls
=
"btn btn btn-primary"
,
title
=
"View"
),
...
@@ -79,34 +82,17 @@ class ViewData(BaseView):
...
@@ -79,34 +82,17 @@ class ViewData(BaseView):
url_dict
=
request
.
matchdict
url_dict
=
request
.
matchdict
act
=
url_dict
[
'act'
]
act
=
url_dict
[
'act'
]
if
act
==
"grid"
:
if
act
==
"grid"
:
status
=
-
1
jenis
=
'jenis'
in
request
.
params
and
request
.
params
[
'jenis'
]
and
int
(
request
.
params
[
'jenis'
])
or
None
if
'status'
in
request
.
params
:
status
=
int
(
request
.
params
[
'status'
])
vendor
=
aliased
(
Partner
,
name
=
'vendor'
)
customer
=
aliased
(
Partner
,
name
=
'customer'
)
columns
=
[
columns
=
[
ColumnDT
(
PartnerPay
.
id
,
mData
=
'id'
),
ColumnDT
(
H2hArInvoice
.
id
,
mData
=
'id'
),
ColumnDT
(
PartnerPay
.
cust_inv_no
,
mData
=
'nomor'
),
ColumnDT
(
H2hArInvoice
.
cust_inv_no
,
mData
=
'nomor'
),
ColumnDT
(
ColumnDT
(
Partner
.
nama
,
mData
=
'customer'
),
column_concat
([
ColumnDT
(
func
.
coalesce
(
H2hArInvoice
.
cust_inv_type
,
0
),
mData
=
'inv_type'
),
PartnerPay
.
inv_cust_nm
,
' - ('
,
customer
.
nama
,
')'
]),
mData
=
'customer'
),
ColumnDT
(
vendor
.
nama
,
mData
=
'vendor'
),
ColumnDT
(
PartnerPay
.
amt_sell
,
mData
=
'amount'
),
ColumnDT
(
PartnerPay
.
status
,
mData
=
'status'
),
]
]
query
=
DBSession
.
query
()
.
select_from
(
PartnerPay
)
\
query
=
DBSession
.
query
()
.
select_from
(
H2hArInvoice
)
\
.
join
(
vendor
,
vendor
.
id
==
PartnerPay
.
vendor_id
)
\
.
join
(
Partner
,
Partner
.
id
==
H2hArInvoice
.
customer_id
)
.
join
(
customer
,
customer
.
id
==
PartnerPay
.
customer_id
)
query
=
query
.
filter
(
H2hArInvoice
.
cust_inv_type
==
jenis
)
if
status
>
-
1
:
query
=
query
.
filter
(
PartnerPay
.
status
==
status
)
row_table
=
DataTables
(
request
.
GET
,
query
,
columns
)
row_table
=
DataTables
(
request
.
GET
,
query
,
columns
)
return
row_table
.
output_result
()
return
row_table
.
output_result
()
...
@@ -117,74 +103,19 @@ class ViewData(BaseView):
...
@@ -117,74 +103,19 @@ class ViewData(BaseView):
request
=
self
.
req
request
=
self
.
req
url_dict
=
request
.
matchdict
url_dict
=
request
.
matchdict
view_id
=
url_dict
[
'id'
]
view_id
=
url_dict
[
'id'
]
data
=
PartnerPay
.
query_id
(
id
=
view_id
)
.
first
()
data
=
H2hArInvoice
.
query_id
(
id
=
view_id
)
.
first
()
params
=
dict
(
params
=
dict
(
form
=
None
form
=
None
)
)
if
data
:
if
data
:
customer
=
'{cust} - ({merc})'
.
format
(
cust
=
data
.
inv_cust_nm
,
merc
=
data
.
customer
.
nama
)
form_list
=
(
form_list
=
(
(
'vend_inv_no'
,
data
.
vend_inv_no
or
''
,
'text'
),
(
'inv_no'
,
data
.
cust_inv_no
or
''
,
'text'
),
(
'cust_inv_no'
,
data
.
cust_inv_no
or
''
,
'text'
),
(
'customer'
,
data
.
customer
.
nama
,
'text'
),
# ('tx_id', data.tx_id or '', 'text'),
(
'vendor'
,
data
.
vendor
.
nama
,
'text'
),
(
'amount'
,
data
.
amount
or
0
,
'text'
),
(
'produk'
,
data
.
produk
.
nama
,
'text'
),
(
'inquiry'
,
format_json
(
data
.
inquiry
),
'textarea'
),
# ('id_pel', data.id_pel or '', 'text'),
(
'payment'
,
format_json
(
data
.
payment
),
'textarea'
),
(
'advice'
,
format_json
(
data
.
advice
),
'textarea'
),
(
'customer'
,
customer
,
'text'
),
(
'cust_addr'
,
data
.
inv_cust_addr
or
''
,
'text'
),
(
'cust_phone'
,
data
.
inv_cust_phone
or
''
,
'text'
),
(
'cust_email'
,
data
.
inv_cust_email
or
''
,
'text'
),
(
'cust_city'
,
data
.
inv_cust_city
or
''
,
'text'
),
(
'cust_state'
,
data
.
inv_cust_state
or
''
,
'text'
),
(
'cust_pos'
,
data
.
inv_cust_pos
or
''
,
'text'
),
(
'cust_country'
,
data
.
inv_cust_country
or
''
,
'text'
),
# ('inv_valid_date', data.description, 'text'),
# ('inv_valid_time', data.description, 'text'),
# ('inv_time_stamp', data.description, 'text'),
# ('inv_cust_va', data.description, 'text'),
#
# ('delivery_addr', data.description, 'text'),
# ('delivery_city', data.description, 'text'),
# ('delivery_country', data.description, 'text'),
# ('delivery_nm', data.description, 'text'),
# ('delivery_phone', data.description, 'text'),
# ('delivery_pos', data.description, 'text'),
# ('delivery_state', data.description, 'text'),
# ('delivery_email', data.description, 'text'),
# ('subtotal', data.subtotal, 'text'),
# ('discount', data.discount, 'text'),
# ('amt_sell', data.amt_sell, 'text'),
(
'inquiry'
,
format_json
(
data
.
inquiry
),
'area'
),
(
'payment'
,
format_json
(
data
.
payment
),
'area'
),
(
'advice'
,
format_json
(
data
.
advice
),
'area'
),
(
'notify'
,
format_json
(
data
.
notify
),
'area'
),
(
'cart'
,
format_json
(
data
.
cart
),
'area'
),
# ('notes', data.notes, 'text'),
# ('description', data.description, 'text'),
# ('fee', data.description, 'text'),
# ('instmnt_mon', data.description, 'text'),
# ('instmnt_type', data.description, 'text'),
# ('recurr_opt', data.description, 'text'),
# ('m_ref_no', data.description, 'text'),
# ('notax_amt', data.description, 'text'),
# ('pay_valid_dt', data.description, 'text'),
# ('pay_valid_tm', data.description, 'text'),
#
# ('req_dt', data.description, 'text'),
# ('req_tm', data.description, 'text'),
#
# ('vat', data.description, 'text'),
# ('trans_dt', data.description, 'text'),
# ('trans_tm', data.description, 'text'),
# ('card_no', data.description, 'text'),
# ('callback_url', data.description, 'text'),
)
)
sm
=
colander
.
Schema
()
sm
=
colander
.
Schema
()
...
@@ -194,7 +125,7 @@ class ViewData(BaseView):
...
@@ -194,7 +125,7 @@ class ViewData(BaseView):
k
=
f
[
0
]
k
=
f
[
0
]
v
=
f
[
1
]
v
=
f
[
1
]
wg
=
f
[
2
]
==
'area'
and
widget
.
TextAreaWidget
(
style
=
'height:120px'
)
or
\
wg
=
f
[
2
]
==
'
text
area'
and
widget
.
TextAreaWidget
(
style
=
'height:120px'
)
or
\
widget
.
TextInputWidget
(
readonly
=
True
)
widget
.
TextInputWidget
(
readonly
=
True
)
sm
.
add
(
colander
.
SchemaNode
(
sm
.
add
(
colander
.
SchemaNode
(
...
...
src/agratek/api/merchant/views/purchase_list.py
0 → 100644
View file @
9e225ab
import
colander
from
datatables
import
ColumnDT
from
deform
import
widget
,
Form
,
ValidationFailure
from
opensipkd.base.views
import
DataTables
from
pyramid.httpexceptions
import
HTTPFound
from
pyramid.view
import
view_config
from
sqlalchemy.orm
import
aliased
from
.
import
BaseView
from
..models
import
(
DBSession
,
PartnerPay
,
Partner
)
from
opensipkd.base.tools
import
format_json
from
opensipkd.base.tools.db
import
column_concat
status_payment
=
(
(
-
1
,
'--Semua--'
),
(
0
,
'Pending'
),
(
1
,
'Sukses'
),
(
2
,
'Batal'
),
)
def
form_validator
(
form
,
value
):
pass
class
ViewData
(
BaseView
):
@view_config
(
route_name
=
'api-purchase-list'
,
permission
=
"api-purchase-list"
,
renderer
=
'templates/purchase/list.pt'
)
def
view_list
(
self
):
class
ToolbarSchema
(
colander
.
Schema
):
status
=
colander
.
SchemaNode
(
colander
.
String
(),
oid
=
"status"
,
widget
=
widget
.
SelectWidget
(
values
=
status_payment
,
css_class
=
'form-toolbar'
)
)
toolbar
=
ToolbarSchema
(
Validator
=
form_validator
)
toolbar
.
request
=
self
.
req
form
=
Form
(
schema
=
toolbar
)
params
=
{
'form'
:
form
,
'status_payment'
:
[
s
for
k
,
s
in
status_payment
if
k
>
-
1
],
'columns'
:
[
dict
(
title
=
"ID"
),
dict
(
title
=
"No. Invoice"
),
dict
(
title
=
"Customer"
),
dict
(
title
=
"Vendor"
),
dict
(
title
=
"Amount"
),
dict
(
title
=
"Status"
),
],
'column_data'
:
[
dict
(
data
=
"id"
,
width
=
"0px"
),
dict
(
data
=
"nomor"
,
width
=
"150px"
),
dict
(
data
=
"customer"
),
dict
(
data
=
"vendor"
),
dict
(
data
=
"amount"
,
width
=
"100px"
),
dict
(
data
=
"status"
,
width
=
"100px"
),
],
'buttons'
:
[
dict
(
id
=
"btn_view"
,
cls
=
"btn btn btn-primary"
,
title
=
"View"
),
dict
(
id
=
"btn_close"
,
cls
=
"btn btn-danger"
,
title
=
"Tutup"
),
],
'route'
:
"/api/purchase"
,
'scripts'
:
"""
$("#btn_close").click(function() {
window.location = '/api/merchant';
return false;
});
"""
}
return
dict
(
params
=
params
)
@view_config
(
route_name
=
'api-purchase-act'
,
renderer
=
'json'
,
permission
=
"api-purchase-list"
)
def
view_act
(
self
):
request
=
self
.
req
url_dict
=
request
.
matchdict
act
=
url_dict
[
'act'
]
if
act
==
"grid"
:
status
=
-
1
if
'status'
in
request
.
params
:
status
=
int
(
request
.
params
[
'status'
])
vendor
=
aliased
(
Partner
,
name
=
'vendor'
)
customer
=
aliased
(
Partner
,
name
=
'customer'
)
columns
=
[
ColumnDT
(
PartnerPay
.
id
,
mData
=
'id'
),
ColumnDT
(
PartnerPay
.
cust_inv_no
,
mData
=
'nomor'
),
ColumnDT
(
column_concat
([
PartnerPay
.
inv_cust_nm
,
' - ('
,
customer
.
nama
,
')'
]),
mData
=
'customer'
),
ColumnDT
(
vendor
.
nama
,
mData
=
'vendor'
),
ColumnDT
(
PartnerPay
.
amt_sell
,
mData
=
'amount'
),
ColumnDT
(
PartnerPay
.
status
,
mData
=
'status'
),
]
query
=
DBSession
.
query
()
.
select_from
(
PartnerPay
)
\
.
join
(
vendor
,
vendor
.
id
==
PartnerPay
.
vendor_id
)
\
.
join
(
customer
,
customer
.
id
==
PartnerPay
.
customer_id
)
if
status
>
-
1
:
query
=
query
.
filter
(
PartnerPay
.
status
==
status
)
row_table
=
DataTables
(
request
.
GET
,
query
,
columns
)
return
row_table
.
output_result
()
@view_config
(
route_name
=
'api-purchase-view'
,
permission
=
"api-purchase-list"
,
renderer
=
'templates/purchase/view.pt'
)
def
view_detail
(
self
):
request
=
self
.
req
url_dict
=
request
.
matchdict
view_id
=
url_dict
[
'id'
]
data
=
PartnerPay
.
query_id
(
id
=
view_id
)
.
first
()
params
=
dict
(
form
=
None
)
if
data
:
customer
=
'{cust} - ({merc})'
.
format
(
cust
=
data
.
inv_cust_nm
,
merc
=
data
.
customer
.
nama
)
form_list
=
(
(
'vend_inv_no'
,
data
.
vend_inv_no
or
''
,
'text'
),
(
'cust_inv_no'
,
data
.
cust_inv_no
or
''
,
'text'
),
(
'tx_id'
,
data
.
tx_id
or
''
,
'text'
),
(
'vendor'
,
data
.
vendor
.
nama
,
'text'
),
(
'produk'
,
data
.
produk
.
nama
,
'text'
),
# ('id_pel', data.id_pel or '', 'text'),
(
'customer'
,
customer
,
'text'
),
(
'cust_addr'
,
data
.
inv_cust_addr
or
''
,
'text'
),
(
'cust_phone'
,
data
.
inv_cust_phone
or
''
,
'text'
),
(
'cust_email'
,
data
.
inv_cust_email
or
''
,
'text'
),
(
'cust_city'
,
data
.
inv_cust_city
or
''
,
'text'
),
(
'cust_state'
,
data
.
inv_cust_state
or
''
,
'text'
),
(
'cust_pos'
,
data
.
inv_cust_pos
or
''
,
'text'
),
(
'cust_country'
,
data
.
inv_cust_country
or
''
,
'text'
),
# ('inv_valid_date', data.description, 'text'),
# ('inv_valid_time', data.description, 'text'),
# ('inv_time_stamp', data.description, 'text'),
# ('inv_cust_va', data.description, 'text'),
#
# ('delivery_addr', data.description, 'text'),
# ('delivery_city', data.description, 'text'),
# ('delivery_country', data.description, 'text'),
# ('delivery_nm', data.description, 'text'),
# ('delivery_phone', data.description, 'text'),
# ('delivery_pos', data.description, 'text'),
# ('delivery_state', data.description, 'text'),
# ('delivery_email', data.description, 'text'),
# ('subtotal', data.subtotal, 'text'),
# ('discount', data.discount, 'text'),
# ('amt_sell', data.amt_sell, 'text'),
(
'inquiry'
,
format_json
(
data
.
inquiry
),
'textarea'
),
(
'payment'
,
format_json
(
data
.
payment
),
'textarea'
),
(
'advice'
,
format_json
(
data
.
advice
),
'textarea'
),
(
'notify'
,
format_json
(
data
.
notify
),
'textarea'
),
(
'cancel'
,
format_json
(
data
.
cancel
),
'textarea'
),
(
'cart'
,
format_json
(
data
.
cart
),
'textarea'
),
# ('notes', data.notes, 'text'),
# ('description', data.description, 'text'),
# ('fee', data.description, 'text'),
# ('instmnt_mon', data.description, 'text'),
# ('instmnt_type', data.description, 'text'),
# ('recurr_opt', data.description, 'text'),
# ('m_ref_no', data.description, 'text'),
# ('notax_amt', data.description, 'text'),
# ('pay_valid_dt', data.description, 'text'),
# ('pay_valid_tm', data.description, 'text'),
#
# ('req_dt', data.description, 'text'),
# ('req_tm', data.description, 'text'),
#
# ('vat', data.description, 'text'),
# ('trans_dt', data.description, 'text'),
# ('trans_tm', data.description, 'text'),
# ('card_no', data.description, 'text'),
# ('callback_url', data.description, 'text'),
)
sm
=
colander
.
Schema
()
values
=
{}
for
f
in
form_list
:
k
=
f
[
0
]
v
=
f
[
1
]
wg
=
f
[
2
]
==
'textarea'
and
widget
.
TextAreaWidget
(
style
=
'height:120px'
)
or
\
widget
.
TextInputWidget
(
readonly
=
True
)
sm
.
add
(
colander
.
SchemaNode
(
colander
.
String
(),
name
=
k
,
oid
=
k
,
widget
=
wg
))
values
.
update
({
k
:
v
})
form
=
Form
(
sm
)
form
.
render
(
values
)
params
[
'form'
]
=
form
return
dict
(
params
=
params
)
src/agratek/api/merchant/views/templates/base.pt
View file @
9e225ab
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
</li>
</li>
<li>
<li>
<a
href=
"${request._host}/api/p
ayment
/list"
>
<a
href=
"${request._host}/api/p
urchase
/list"
>
<i
class=
"fa fa-lg fa-fw fa-home"
></i>
<i
class=
"fa fa-lg fa-fw fa-home"
></i>
<span
class=
"menu-item-parent"
>
List Purchase
</span>
<span
class=
"menu-item-parent"
>
List Purchase
</span>
</a>
</a>
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
<li>
<li>
<a
href=
"${request._host}/api/
mercha
nt/list"
>
<a
href=
"${request._host}/api/
payme
nt/list"
>
<i
class=
"fa fa-lg fa-fw fa-home"
></i>
<i
class=
"fa fa-lg fa-fw fa-home"
></i>
<span
class=
"menu-item-parent"
>
List Payment
</span>
<span
class=
"menu-item-parent"
>
List Payment
</span>
</a>
</a>
...
...
src/agratek/api/merchant/views/templates/payment/list.pt
View file @
9e225ab
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
</div>
</div>
<!-- Modal -->
<!-- Modal -->
<div id="payment-view" class="modal fade" role="dialog">
<div id="payment-view" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-dialog
modal-lg
">
<!-- Modal content-->
<!-- Modal content-->
<div class="modal-content">
<div class="modal-content">
<div class="modal-header">
<div class="modal-header">
...
@@ -56,8 +56,8 @@
...
@@ -56,8 +56,8 @@
var oTableUrl = oTableUri + "/grid/act";
var oTableUrl = oTableUri + "/grid/act";
function getDataUrl() {
function getDataUrl() {
var opt = $('select#
status
').val();
var opt = $('select#
inv_type
').val();
return oTableUrl + '?
statu
s=' + opt.toString();
return oTableUrl + '?
jeni
s=' + opt.toString();
}
}
function getViewUrl(vid) {
function getViewUrl(vid) {
...
@@ -82,20 +82,18 @@
...
@@ -82,20 +82,18 @@
[10, 25, 50, 100],
[10, 25, 50, 100],
[10, 25, 50, 100]
[10, 25, 50, 100]
],
],
// columns: [
columns: [
// {'data': 'id', 'width': '0px'},
{'data': 'id', 'width': '0px'},
// {'data': 'nomor', 'width': '150px'},
{'data': 'nomor', 'width': '150px'},
// {'data': 'customer'},
{'data': 'customer'},
// {'data': 'vendor'},
{'data': 'inv_type', 'width': '100px',
// {'data': 'amount', 'width': '100px'},
'render': function(data, type, full, meta) {
// {'data': 'status', 'width': '100px',
var st = ${params.invoice_type};
// 'render': function(data, type, full, meta) {
return st[data];
// var st = ${params.status_payment};
}
// return st[data];
}
// }
],
// }
//columns: ${params.column_data},
// ],
columns: ${params.column_data},
columnDefs: [{
columnDefs: [{
searchable: false,
searchable: false,
visible: false,
visible: false,
...
@@ -150,7 +148,6 @@
...
@@ -150,7 +148,6 @@
$('#btn_view').click(function() {
$('#btn_view').click(function() {
if (mID) {
if (mID) {
//window.location = oTableUri + '/' + mID + '/view';
$('#payment-view').modal('show');
$('#payment-view').modal('show');
} else {
} else {
$.SmartMessageBox({
$.SmartMessageBox({
...
@@ -173,7 +170,7 @@
...
@@ -173,7 +170,7 @@
}
}
});
});
$('select#
status
').on('change', function() {
$('select#
inv_type
').on('change', function() {
mID = 0;
mID = 0;
oTable.ajax.url(getDataUrl()).load();
oTable.ajax.url(getDataUrl()).load();
});
});
...
...
src/agratek/api/merchant/views/templates/purchase/list.pt
0 → 100644
View file @
9e225ab
<div metal:use-macro="load: ../base.pt">
<!-- content -->
<div metal:fill-slot="content">
<style type="text/css">
#content-payment-view {
max-height: 100vw;
overflow-y: auto;
}
</style>
<div id="tmp-toolbar">
<span tal:repeat="f params.form" tal:omit-tag="">
${structure:f.serialize()}
</span>
</div>
<div class="jarviswidget" style="border-top:1px solid #ccc!important">
<div role="content">
<table id="table1" class="table table-bordered table-hover table-condensed">
<thead>
<tr>
<th tal:repeat="f params.columns">${f.title}</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<!-- Modal -->
<div id="payment-view" class="modal fade" role="dialog">
<div class="modal-dialog modal-lg">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">
View Detail
<span style="margin-left: 10px" id="payment-view-title"></span>
</h4>
</div>
<div class="modal-body" id="content-payment-view">
&nbps;
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">OK</button>
</div>
</div>
</div>
</div>
</div>
<!-- end content -->
<script type="text/javascript" metal:fill-slot="scripts">
var mID;
var oTable;
var oTableUri = "${request._host}${params.route}"
var oTableUrl = oTableUri + "/grid/act";
function getDataUrl() {
var opt = $('select#status').val();
return oTableUrl + '?status=' + opt.toString();
}
function getViewUrl(vid) {
return oTableUri + "/" + vid.toString() + "/view";
}
$(document).ready(function() {
oTable = $('#table1').DataTable({
dom: '<"row"<"col-md-8"<"toolbar">l><"col-md-4"f>>rtip',
processing: true,
serverSide: true,
ajax: getDataUrl(),
stateSave: true,
//scrollCollapse: true,
//sort: true,
//info: false,
filter: true,
autoWidth: false,
paginate: true,
paginationType: "full_numbers",
lengthMenu: [
[10, 25, 50, 100],
[10, 25, 50, 100]
],
// columns: [
// {'data': 'id', 'width': '0px'},
// {'data': 'nomor', 'width': '150px'},
// {'data': 'customer'},
// {'data': 'vendor'},
// {'data': 'amount', 'width': '100px'},
// {'data': 'status', 'width': '100px',
// 'render': function(data, type, full, meta) {
// var st = ${params.status_payment};
// return st[data];
// }
// }
// ],
columns: ${params.column_data},
columnDefs: [{
searchable: false,
visible: false,
targets: [0]
}],
"language": {
"search": "Cari : ",
"paginate": {
"first": "Pertama ",
"last": "Akhir ",
"previous": "",
"next": "",
},
"lengthMenu": "Tampil _MENU_ baris "
},
});
var buttons=${params.buttons};
var tb_array=[];
tb_array.push('<div class="btn-group pull-left">');
for (i=0; i<buttons.length; i++){
tb_array.push('<button id="'+buttons[i].id+'" class="' +buttons[i].cls+
'" type="button">'+buttons[i].title+'</button>')
}
tb_array.push(' ');
tb_array.push('</div>');
var tb = tb_array.join(' ');
$("div.toolbar").html(tb)
.attr('style', 'display:block; float: left; margin-bottom:6px; line-height:16px;');
$('select.form-toolbar').appendTo($("div.toolbar"));
$('tmp-toolbar').hide();
//events
$('#table1 tbody').on('click', 'tr', function() {
if ($(this).hasClass('selected')) {
$(this).removeClass('selected');
} else {
var aData = oTable.row(this).data();
oTable.$('tr.selected').removeClass('selected');
$(this).addClass('selected');
mID = aData.id;
// console.log(mID);
oTable.$('tr.row_selected').removeClass('row_selected');
$(this).addClass('row_selected');
}
});
${params.scripts}
$('#btn_view').click(function() {
if (mID) {
//window.location = oTableUri + '/' + mID + '/view';
$('#payment-view').modal('show');
} else {
$.SmartMessageBox({
title : "View",
content : "Pilih Baris yang akan di lihat...",
buttons : '[Oke]'
});
}
});
$("#payment-view").on('show.bs.modal', function(){
var content = '';
var view_container = $('#content-payment-view');
view_container.empty();
if (mID) {
var vUrl = getViewUrl(mID);
view_container.load(vUrl, function() {
$('textarea').attr('readonly', true);
});
}
});
$('select#status').on('change', function() {
mID = 0;
oTable.ajax.url(getDataUrl()).load();
});
});
</script>
</div>
src/agratek/api/merchant/views/templates/purchase/view.pt
0 → 100644
View file @
9e225ab
<div tal:condition="params.form" tal:omit-tag="">
<div class="form-horizontal">
<div tal:repeat="f params.form" class="row">
<div class="form-group">
<label for="${f.oid}" class="control-label col-md-3" id="req-${f.oid}">
${f.title}
</label>
<div class="col-md-9">
${structure:f.serialize()}
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
\ 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