Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
aa.gusti
/
opensipkd-base
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 6f0008b5
authored
Aug 02, 2022
by
aagusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
perbaikan prosedure
1 parent
314994c5
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
94 additions
and
53 deletions
external/tiny_sxw2rml.py
opensipkd/base/static/css/osipkd.css
opensipkd/base/static/v3/ttr.csv
opensipkd/base/static/v3/user.csv
opensipkd/base/views/base_views.py
opensipkd/detable/detable.py
opensipkd/detable/templates/detable.pt
external/tiny_sxw2rml.py
View file @
6f0008b
...
...
@@ -52,7 +52,7 @@ import string
import
os
import
zipfile
import
xml.dom.minidom
from
reportlab.lib.divisis
import
toLength
#
from reportlab.lib.divisis import toLength
import
base64
class
DomApiGeneral
:
...
...
@@ -150,7 +150,7 @@ class DomApi(DomApiGeneral):
# ******** always use the following order:
self
.
buildStyleDict
()
self
.
buildStylePropertiesDict
()
if
self
.
styles_dom
.
getElementsByTagName
(
"style:page-master"
)
.
__len__
()
<>
0
:
if
self
.
styles_dom
.
getElementsByTagName
(
"style:page-master"
)
.
__len__
()
!=
0
:
self
.
page_master
=
self
.
styles_dom
.
getElementsByTagName
(
"style:page-master"
)[
0
]
self
.
document
=
self
.
content_dom
.
getElementsByTagName
(
"office:document-content"
)[
0
]
...
...
@@ -354,12 +354,13 @@ if __name__ == "__main__":
parser
.
error
(
"incorrect number of arguments"
)
import
sys
import
StringIO
import
io
#StringIO
fname
=
sys
.
argv
[
1
]
f
=
StringIO
.
StringIO
(
file
(
fname
)
.
read
())
f
=
io
.
StringIO
(
open
(
fname
)
.
read
())
xsl
=
file
(
os
.
path
.
join
(
os
.
getcwd
(),
os
.
path
.
dirname
(
sys
.
argv
[
0
]),
'normalized_oo2rml.xsl'
))
.
read
()
xsl
=
open
(
os
.
path
.
join
(
os
.
getcwd
(),
os
.
path
.
dirname
(
sys
.
argv
[
0
]),
'normalized_oo2rml.xsl'
))
.
read
()
result
=
sxw2rml
(
f
,
xsl
,
output
=
opt
.
output
,
save_pict
=
False
)
print
result
print
(
result
)
opensipkd/base/static/css/osipkd.css
View file @
6f0008b
...
...
@@ -184,3 +184,11 @@ div.tab-content {
-ms-user-select
:
none
;
user-select
:
none
;
}
.dataTables_paginate
{
font-size
:
10px
!important
;
}
.paginate_button
.current
{
font-size
:
10px
!important
;
}
\ No newline at end of file
opensipkd/base/static/v3/ttr.csv
0 → 100644
View file @
6f0008b
id,thn_pajak_sppt,nik,nm_wp,nik_doc,tgl_terima_wp
2,32.79-010.006-009.0218-0,2022,1234567890123456,BBB,XGBytf.jpeg,2022-07-26 00:00:00
opensipkd/base/static/v3/user.csv
0 → 100644
View file @
6f0008b
id,thn_pajak_sppt,nik,nm_wp,nik_doc,tgl_terima_wp
2,32.79-010.006-009.0218-0,2022,1234567890123456,BBB,XGBytf.jpeg,2022-07-26 00:00:00
opensipkd/base/views/base_views.py
View file @
6f0008b
...
...
@@ -12,7 +12,7 @@ from pyramid.httpexceptions import HTTPFound
from
.common
import
DataTables
from
..
import
DBSession
,
get_params
from
opensipkd.tools
import
dmy
,
d
my_to_date
,
get_settings
,
get_ext
,
\
from
opensipkd.tools
import
dmy
,
d
ate_from_str
,
get_settings
,
get_ext
,
\
date_from_str
import
colander
from
deform
import
(
widget
,
Form
,
ValidationFailure
,
Button
,
)
...
...
@@ -36,6 +36,12 @@ class BaseView(object):
self
.
params
=
self
.
req
.
params
self
.
settings
=
get_settings
()
now
=
datetime
.
now
()
# self.dt_awal = self.ses["dt_awal"] if "dt_awal" in self.ses else now
# self.awal = dmy(self.dt_awal)
# self.dt_akhir = self.ses["dt_akhir"] if "dt_akhir" in self.ses else now
# self.akhir = dmy(self.dt_akhir)
# self.ses["dt_awal"] = self.dt_awal
# self.ses["dt_akhir"] = self.dt_akhir
self
.
tahun
=
'tahun'
in
self
.
ses
and
self
.
ses
[
'tahun'
]
or
now
.
strftime
(
'
%
Y'
)
self
.
tahun
=
'tahun'
in
self
.
params
and
self
.
params
[
...
...
@@ -47,7 +53,7 @@ class BaseView(object):
if
'bulan'
in
self
.
params
and
self
.
params
[
'bulan'
]:
self
.
bulan
=
self
.
params
[
'bulan'
]
.
strip
()
.
zfill
(
2
)
dt_awal
=
d
my_to_date
(
dt_awal
=
d
ate_from_str
(
'{d}-{m}-{y}'
.
format
(
y
=
self
.
tahun
,
m
=
self
.
bulan
,
d
=
'01'
))
dt_akhir
=
dt_awal
+
relativedelta
(
months
=
1
)
-
relativedelta
(
days
=
1
)
...
...
@@ -66,10 +72,10 @@ class BaseView(object):
self
.
awal
=
'awal'
in
self
.
ses
and
self
.
ses
[
'awal'
]
or
dmy
(
now
)
awal
=
'awal'
in
self
.
params
and
self
.
params
[
'awal'
]
or
self
.
awal
try
:
self
.
dt_awal
=
d
my_to_date
(
awal
)
self
.
dt_awal
=
d
ate_from_str
(
awal
)
self
.
awal
=
awal
except
:
self
.
dt_awal
=
d
my_to_date
(
self
.
awal
)
self
.
dt_awal
=
d
ate_from_str
(
self
.
awal
)
self
.
ses
[
'awal'
]
=
self
.
awal
self
.
ses
[
'dt_awal'
]
=
self
.
dt_awal
...
...
@@ -78,10 +84,10 @@ class BaseView(object):
akhir
=
'akhir'
in
self
.
params
and
self
.
params
[
'akhir'
]
or
self
.
akhir
try
:
self
.
dt_akhir
=
d
my_to_date
(
akhir
)
self
.
dt_akhir
=
d
ate_from_str
(
akhir
)
self
.
akhir
=
akhir
except
:
self
.
dt_akhir
=
d
my_to_date
(
self
.
akhir
)
self
.
dt_akhir
=
d
ate_from_str
(
self
.
akhir
)
self
.
tahun_awal
=
'tahun_awal'
in
self
.
ses
and
self
.
ses
[
'tahun_awal'
]
or
self
.
tahun
...
...
@@ -181,8 +187,8 @@ class BaseView(object):
def
view_list
(
self
,
**
kwargs
):
if
self
.
list_schema
:
allow_edit
=
kwargs
.
get
(
"allow_edit"
,
True
)
allow_delete
=
kwargs
.
get
(
"allow_delete"
,
True
)
allow_edit
=
kwargs
.
get
(
"allow_edit"
,
True
)
allow_delete
=
kwargs
.
get
(
"allow_delete"
,
True
)
table
=
DeTable
(
self
.
list_schema
(),
action
=
self
.
req
.
route_url
(
self
.
list_route
),
action_suffix
=
"/grid/act"
,
...
...
@@ -227,7 +233,7 @@ class BaseView(object):
return
value
def
cancel_act
(
self
):
pass
return
self
.
route_list
()
def
after_add
(
self
,
row
,
values
):
return
...
...
@@ -244,7 +250,7 @@ class BaseView(object):
def
view_act
(
self
,
**
kwargs
):
url_dict
=
self
.
req
.
matchdict
if
url_dict
[
'act'
]
==
'grid'
:
url
=
[]
url
=
[]
columns
=
[]
for
d
in
self
.
list_schema
():
global_search
=
hasattr
(
d
,
"searchable"
)
and
\
...
...
@@ -268,7 +274,7 @@ class BaseView(object):
self
.
table
,
"company_id"
):
query
=
query
.
filter
(
self
.
table
.
company_id
==
self
.
req
.
user
.
company_id
)
query
=
self
.
list_filter
(
query
)
query
=
self
.
list_filter
(
query
)
row_table
=
DataTables
(
self
.
req
.
GET
,
query
,
columns
)
result
=
row_table
.
output_result
()
# for d in result["data"]:
...
...
@@ -301,7 +307,7 @@ class BaseView(object):
values
=
dict
(
c
)
row
=
self
.
save_request
(
values
)
self
.
after_add
(
row
,
values
)
elif
"cancel"
in
self
.
req
.
POST
or
'batal'
in
self
.
req
.
POST
:
elif
"cancel"
in
self
.
req
.
POST
or
'batal'
in
self
.
req
.
POST
or
"close"
in
self
.
req
.
POST
:
self
.
cancel_act
()
else
:
return
self
.
next_add
(
form
,
table
=
table
,
resources
=
resources
)
...
...
@@ -407,7 +413,8 @@ class BaseView(object):
DBSession
.
flush
()
request
.
session
.
flash
(
msg
)
return
self
.
route_list
()
form
=
self
.
get_form
(
self
.
edit_schema
,
buttons
=
(
btn_delete
,
btn_cancel
))
form
=
self
.
get_form
(
self
.
edit_schema
,
buttons
=
(
btn_delete
,
btn_cancel
))
table
=
self
.
get_item_table
(
row
)
resources
=
form
.
get_widget_resources
()
form
.
set_appstruct
(
self
.
get_values
(
row
))
...
...
opensipkd/detable/detable.py
View file @
6f0008b
...
...
@@ -178,6 +178,22 @@ class DeTable(field.Field):
if
hasattr
(
f
,
'visible'
):
d
[
"visible"
]
=
f
.
visible
data
.
append
(
f
"visible: {f.visible}"
)
if
hasattr
(
f
,
'orderable'
):
d
[
"orderable"
]
=
f
.
orderable
data
.
append
(
f
"orderable: {f.orderable}"
)
if
hasattr
(
f
,
"url"
):
request
=
kw
.
get
(
"request"
)
if
request
:
d
[
"url"
]
=
request
.
static_url
(
f
.
url
)
log
.
debug
(
d
[
"url"
])
if
hasattr
(
f
,
"action"
):
d
[
"action"
]
=
f
.
action
else
:
d
[
"action"
]
=
True
if
isinstance
(
f
.
widget
,
deform
.
widget
.
HiddenWidget
):
d
[
"visible"
]
=
False
if
isinstance
(
f
.
widget
,
deform
.
widget
.
CheckboxWidget
):
...
...
@@ -185,9 +201,8 @@ class DeTable(field.Field):
else
:
d
[
"checkbox"
]
=
False
if
hasattr
(
f
,
'orderable'
):
d
[
"orderable"
]
=
f
.
orderable
data
.
append
(
f
"orderable: {f.orderable}"
)
thousand
=
hasattr
(
f
,
'thousand'
)
and
f
.
thousand
or
None
separator
=
thousand
and
"separator"
in
thousand
and
thousand
[
...
...
opensipkd/detable/templates/detable.pt
View file @
6f0008b
<div tal:define="style style|field.widget.style;
<div
tal:define="style style|field.widget.style;
css_class css_class|string:${field.widget.css_class or field.css_class or 'jarviswidget jarviswidget-color-blueLight'};
item_template item_template|field.widget.item_template;
title title|field.title;
...
...
@@ -19,29 +20,29 @@
allow_delete allow_delete|field.allow_delete;
"
tal:attributes="style style; class css_class; attributes|field.widget.attributes|{};"
i18n:domain="detable">
i18n:domain="detable"
>
<header role="heading" class="txt-color-grayDark">
<h2 tal:condition="title">
<i class="fa fa-fw fa-table"></i>${title}
</h2>
<h2 tal:condition="title"><i class="fa fa-fw fa-table"></i>${title}</h2>
<div role="content">
<div class="widget-body">
<table id="${tableid}"
class="table table-bordered table-hover table-condensed dataTable no-footer">
<table
id="${tableid}"
class="table table-bordered table-hover table-condensed dataTable no-footer"
>
<thead>
<tr>
<th tal:repeat="child field">${child.title}</th>
</tr>
</thead>
<tbody>
</tbody>
<tbody></tbody>
</table>
</div>
<!-- widget-body -->
</div>
<!-- widget-body -->
</div>
</header>
<script
>
<script type="text/javascript"
>
deform.addCallback
('${tableid}', function (oid) {
let m${tableid}ID;
...
...
@@ -60,11 +61,27 @@
if (value == true) {
return '<i class="fas fa-check-square" aria-hidden="true">';
}
return '<i class="fas fa-rectangle-xmark" aria-hidden="true">
';
return 'Archived
';
}
if (columns[0].data == "id") {
columns[0].render = function (id) {
for (co in columns) {
console.log(columns[co]);
if (columns[co].checkbox === true) {
columns[co].className = "text-center";
columns[co].width = "30pt";
columns[co].render = function (val) {
if (["", false, 0].indexOf(val) === -1) {
return render_checkbox(true);
} else return render_checkbox(false);
}
}else if (columns[co].hasOwnProperty("url")){
let url = columns[co].url;
columns[co].render = function (data) {
let result = '<a href="'+url+'/' + data + '" target="_blank">'+data+'</a> ';
return result;
}
}else if(columns[co].data == "id" && columns[co].action == true){
columns[co].render = function (id) {
let result = '<a href="${url}/' + id + '/view"><i class="fas fa-eye" aria-hidden="true"></i></a> ';
if (${allow_edit}) {
result += '<a href="${url}/' + id + '/edit"><i class="fas fa-edit" aria-hidden="true"></i></a> '
...
...
@@ -75,25 +92,14 @@
return result;
}
columns[0].width = "40pt";
columns[0].orderable = false;
columns[0].className = "text-center";
columns[0].visible = true;
columns[1].order = "order_asc";
}
for (co in columns) {
if (columns[co].checkbox === true) {
columns[co].className = "text-center";
columns[co].width = "30pt";
columns[co].render = function (val) {
if (["", false, 0].indexOf(val) === -1) {
return render_checkbox(true)
;
} else return render_checkbox(false)
;
}
columns[co].orderable = false;
columns[co].className = "text-center";
columns[co].visible = true
;
//columns[1].order = "order_asc"
;
}
}
console.log(columns);
let language = {
"search": "Cari: ",
"paginate": {
...
...
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