Commit 0a264995 by aa.gusti

Merge branch 'beta-4.2' into 'beta-4.2-training'

# Conflicts:
#   opensipkd/base/__init__.py
Yes
2 parents 5b3198ae 080a93d9
......@@ -795,4 +795,4 @@ class BaseApp():
return self.menus
BASE_CLASS = BaseApp()
BASE_CLASS = BaseApp()
\ No newline at end of file
body {
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
--font-weight: 300;
--color: #ffffff;
--background: #bc2131;
font-size: 12px !important;
padding-top: 40px;
}
h1,
h2,
h3,
......@@ -21,107 +21,116 @@ legend {
}
.bar {
height: 18px;
background: green;
height: 18px;
background: green;
}
.twitter-typeahead .tt-query,
.twitter-typeahead .tt-hint {
margin-bottom: 0;
width: 100%;
height: 26px;
position: absolute;
top: 0;
left: 0;
}
margin-bottom: 0;
width: 100%;
height: 26px;
position: absolute;
top: 0;
left: 0;
}
.twitter-typeahead .tt-hint {
color: #a1a1a1;
z-index: 1;
padding: 3px 6px;
border: 1px solid transparent;
}
color: #a1a1a1;
z-index: 1;
padding: 3px 6px;
border: 1px solid transparent;
}
.select2-container .select2-selection--single .select2-selection__rendered {
/* display: block; */
/* padding-left: 8px; */
/* padding-right: 20px; */
overflow: hidden;
/* text-overflow: ellipsis; */
/* white-space: nowrap; */
padding: 3px 6px;
}
.form-control {
font-size: 12px;
padding: 3px 6px !important;
height: 26px;
}
.btn {
.btn {
font-size: 12px;
padding: 3px 6px;
height: 26px;
}
.input-group-addon{
.input-group-addon {
padding: 3px 6px;
height: 26px;
font-size: 12px;
}
.picker__select--month, .picker__select--year {
padding: 0.1em;
/*height: 3em;*/
.picker__select--month,
.picker__select--year {
padding: 0.1em;
/*height: 3em;*/
}
.container {
--max-width: 1024px;
--max-width: 1024px;
}
.container .info {
font-size: 18px;
padding: 14px;
color: #fff;
font-size: 18px;
padding: 14px;
color: #fff;
}
.container .btn-menu {
text-align: left;
font-size: 16px;
padding: 14px 24px;
border-radius: 6px;
border: 0px none;
width: 100%;
margin-bottom: 10px;
.container .btn-menu {
text-align: left;
font-size: 16px;
padding: 14px 24px;
border-radius: 6px;
border: 0px none;
width: 100%;
margin-bottom: 10px;
}
.container .btn-login {
font-size: 18px;
padding: 10px 20px;
border-radius: 6px;
border: 0px none;
background: #BC2131;
background-image: linear-gradient(to bottom, #C6414E 0px, #BC2131 100%);
background-repeat: repeat-x;
.container .btn-login {
font-size: 18px;
padding: 10px 20px;
border-radius: 6px;
border: 0px none;
background: #bc2131;
background-image: linear-gradient(to bottom, #c6414e 0px, #bc2131 100%);
background-repeat: repeat-x;
margin-top:20px;
margin-top: 20px;
}
.container .btn-logout {
margin-top:12px;
.container .btn-logout {
margin-top: 12px;
}
.container .btn-login:hover {
background: #BC2131;
.container .btn-login:hover {
background: #bc2131;
}
.container .btn-login .label {
display: block;
font-size: 8px;
.container .btn-login .label {
display: block;
font-size: 8px;
}
/* dataTables Customize */
table.dataTable thead {
background-color: #EAEAEA;
background-color: #eaeaea;
}
table.dataTable tr.even.selected td {
background-color: #B0BED9;
background-color: #b0bed9;
}
table.dataTable tr.odd.selected td {
background-color: #9FAFD1;
background-color: #9fafd1;
}
table.dataTable tr.selected td {
background-color: #9FAFD1;
background-color: #9fafd1;
}
/*
......@@ -169,7 +178,7 @@ div.tab-content {
}
*/
.form-horizontal .form-group {
margin-bottom: 4px !important;
margin-bottom: 4px !important;
}
.picker {
......@@ -189,6 +198,6 @@ div.tab-content {
font-size: 10px !important;
}
.paginate_button .current{
.paginate_button .current {
font-size: 10px !important;
}
\ No newline at end of file
}
......@@ -720,6 +720,8 @@ class BaseView(object):
for k in cstruct:
val = cstruct.get(k)
if type(val) is dict:
if k not in value:
value[k] = {}
value[k] = self.update_value(value[k], val)
elif val:
value[k] = cstruct.get(k)
......@@ -747,14 +749,7 @@ class BaseView(object):
e.cstruct[f.name])
if f.name == "captcha":
e.cstruct[f.name] = self.get_captcha_url()
# if e.cstruct[f.name]:
# cstruct = {}
value = self.update_value(value, e.cstruct)
# for k in cstruct:
# if not e.cstruct.get(k):
# e.cstruct[k] = value[k]
# value.update(e.cstruct)
# value.update(cstruct)
form.set_appstruct(value)
return self.returned_form(form, table, **kwargs)
......@@ -771,13 +766,6 @@ class BaseView(object):
form.set_appstruct(values)
return self.returned_form(form, table, **kwargs)
def view_act(self, **kwargs):
if self.req.matchdict['act'] == 'grid':
if self.req.params.get("paren"):
return self.get_list(**kwargs)
return self.get_list(**kwargs)
return super().view_act(**kwargs)
def save(self, values, user, row=None):
log.info("Save")
log.debug(values)
......@@ -890,7 +878,7 @@ class BaseView(object):
form = self.get_form(self.edit_schema, **kwargs)
table = self.get_item_table(row)
resources = form.get_widget_resources()
values = self.get_values(row)
if request.POST:
if 'save' in request.POST:
controls = request.POST.items()
......@@ -899,7 +887,14 @@ class BaseView(object):
controls = form.validate(controls)
except ValidationFailure as e:
log.error(f"Edit Error: {str(e.error.msg)}")
form.set_appstruct(e.cstruct)
for f in e.field.children:
if isinstance(f.typ, colander.Date):
e.cstruct[f.name] = date_from_str(
e.cstruct[f.name])
if f.name == "captcha":
e.cstruct[f.name] = self.get_captcha_url()
values = self.update_value(values, e.cstruct)
form.set_appstruct(values)
return self.returned_form(form, table, **kwargs)
c = dict(controls)
......@@ -908,7 +903,6 @@ class BaseView(object):
return self.next_edit(form, row=row)
values = self.get_values(row)
form.set_appstruct(values)
form = self.before_edit(form)
......
......@@ -78,7 +78,10 @@ class AddSchema(colander.Schema):
missing=colander.drop,
oid="company_id")
status = colander.SchemaNode(colander.Boolean(), oid="status")
status = colander.SchemaNode(
colander.Integer(),
widget=widget.CheckboxWidget(true_val='1', false_val='0'),
oid="status")
def after_bind(self, schema, kwargs):
request = kwargs["request"]
......
<!DOCTYPE html>
<html lang="en-us"
tal:define="
<html lang="en-us" tal:define="
home request._host;
user_path ['user', 'user-add', 'user-edit', 'user-view', 'user-delete'];
user_area_path ['user-area', 'user-area-add', 'user-area-edit', 'user-area-view', 'user-area-delete'];
......@@ -22,6 +21,7 @@
js js|[];
route_name route_name|request.matched_route.name;
">
<head>
<!--<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">-->
......@@ -41,302 +41,316 @@
<!-- Basic Styles -->
<link rel="stylesheet" type="text/css" media="screen" href="${home}/static/v3/css/bootstrap.min.css">
<!--? <link rel="stylesheet" type="text/css" media="screen" href="${home}/static/v3/css/font-awesome.min.css">-->
<link rel="stylesheet" type="text/css" media="screen" href="${home}/static/v3/fonts/fontawesome-free-6.1.2-web/css/all.min.css">
<!--? <link rel="stylesheet" type="text/css" media="screen" href="${home}/static/v3/css/font-awesome.min.css">-->
<link rel="stylesheet" type="text/css" media="screen"
href="${home}/static/v3/fonts/fontawesome-free-6.1.2-web/css/all.min.css">
<!-- SmartAdmin Styles : Caution! DO NOT change the order -->
<link rel="stylesheet" type="text/css" media="screen"
href="${home}/static/v3/css/smartadmin-production-plugins.min.css">
<link rel="stylesheet" type="text/css" media="screen"
href="${home}/static/v3/css/smartadmin-production.min.css">
<link rel="stylesheet" type="text/css" media="screen"
href="${home}/static/v3/css/smartadmin-skins.min.css">
href="${home}/static/v3/css/smartadmin-production-plugins.min.css">
<link rel="stylesheet" type="text/css" media="screen" href="${home}/static/v3/css/smartadmin-production.min.css">
<link rel="stylesheet" type="text/css" media="screen" href="${home}/static/v3/css/smartadmin-skins.min.css">
<!-- We recommend you use "your_style.css" to override SmartAdmin
specific styles this will also ensure you retrain your customization with each SmartAdmin update. -->
<!-- LOOP FORM CSS INCLUDED-->
<tal:loop tal:repeat="css_resource css">
<link rel="stylesheet" href="${home}${request.static_path(css_resource)}"
type="text/css" tal:condition="css_resource[:4]!='http'">
<link rel="stylesheet" href="${css_resource}"
type="text/css" tal:condition="css_resource[:4]=='http'">
<link rel="stylesheet" href="${home}${request.static_path(css_resource)}" type="text/css"
tal:condition="css_resource[:4]!='http'">
<link rel="stylesheet" href="${css_resource}" type="text/css" tal:condition="css_resource[:4]=='http'">
</tal:loop>
<!--? <link href="${home}/static/v3/js/plugin/bootstrap-datepicker/css/bootstrap-datepicker.min.css"-->
<!--? rel="stylesheet">-->
<link href="${home}/deform_static/css/form.css" rel="stylesheet">
<!--? <link href="${home}/static/v3/css/select2.min.css" rel="stylesheet" type="text/css">-->
<metal:css define-slot="css_files"></metal:css>
<link rel="stylesheet" type="text/css" media="screen" href="${home}/static/v3/css/osipkd.css">
</head>
<body class="fixed-header">
<div id="loading" style="display:none;">
<img id="loading-image" src="${home}/static/img/ajax-loader.gif" alt="Loading..."/>
</div>
<!-- #HEADER -->
<header id="header">
<div id="logo-group">
<!-- PLACE YOUR LOGO HERE -->
<h3 id="logo">
<a href="${home}/"><img src="${home}/static/img/logo.png" alt="LOGO"></a>
</h3>
<!-- END LOGO PLACEHOLDER -->
<link rel="stylesheet" type="text/css" media="screen" href="${home}/static/v3/css/osipkd.css">
<div id="loading" style="display:none;">
<img id="loading-image" src="${home}/static/img/ajax-loader.gif" alt="Loading..." />
</div>
<!-- #PROJECTS: projects dropdown -->
<div class="project-context hidden-xs">
<span class="title-page">${request.title}</span>
</div>
<!-- end projects dropdown -->
<!-- #TOGGLE LAYOUT BUTTONS -->
<!-- pulled right: nav area -->
<div class="pull-right">
<div tal:condition="request.user" class="project-context hidden-xs">
<span class="label"><i class="fa fa-sm fa-fw fa-institution"></i> ${request.company}</span>
<span tal:condition="request.user" class="project-selector dropdown-toggle" data-toggle="dropdown">Pilih Module <i
class="fa fa-angle-down"></i></span>
<ul tal:condition="request.user" class="dropdown-menu">
<li tal:repeat="menu request.menus">
<a href="${home}/${menu}">${request.menus[menu]}</a>
</li>
</ul>
<!-- #HEADER -->
<header id="header">
<div id="logo-group">
<!-- PLACE YOUR LOGO HERE -->
<h3 id="logo">
<a href="${home}/"><img src="${home}/static/img/logo.png" alt="LOGO"></a>
</h3>
<!-- END LOGO PLACEHOLDER -->
</div>
<!-- collapse menu button -->
<div id="hide-menu" class="btn-header pull-right">
<span> <a href="javascript:void(0);" data-action="toggleMenu" title="Collapse Menu"><i
class="fa fa-reorder"></i></a> </span>
</div>
<!-- end collapse menu -->
<!-- fullscreen button -->
<div id="fullscreen" class="btn-header transparent pull-right">
<span> <a href="javascript:void(0);" data-action="launchFullscreen" title="Full Screen">
<i class="fa fa-arrows-alt"></i></a> </span>
<!-- #PROJECTS: projects dropdown -->
<div class="project-context hidden-xs">
<span class="title-page">${request.title}</span>
</div>
<!-- end fullscreen button -->
<!-- User info -->
<ul tal:condition="request.user" class="header-dropdown-list hidden-xs">
<li>
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-lg fa-fw fa-user"></i> <span
style="text-transform:capitalize"> ${request.user and request.user.nice_username() or ""} </span>
<i class="fa fa-angle-down"></i> </a>
<ul class="dropdown-menu pull-right">
<li><a style="text-transform:capitalize" href="${request.route_url('profile')}">Profile</a></li>
<li tal:condition="not request.user.external">
<a style="text-transform:capitalize" href="${request.route_url('password')}">Ubah password</a>
<!-- end projects dropdown -->
<!-- #TOGGLE LAYOUT BUTTONS -->
<!-- pulled right: nav area -->
<div class="pull-right">
<div tal:condition="request.user" class="project-context hidden-xs">
<span class="label"><i class="fa fa-sm fa-fw fa-institution"></i> ${request.company}</span>
<span tal:condition="request.user" class="project-selector dropdown-toggle" data-toggle="dropdown">Pilih
Module <i class="fa fa-angle-down"></i></span>
<ul tal:condition="request.user" class="dropdown-menu">
<li tal:repeat="menu request.menus">
<a href="${home}/${menu}">${request.menus[menu]}</a>
</li>
<li><a style="text-transform:capitalize" href="${request.route_url('logout')}">Logout</a></li>
<li tal:condition="request.user.api_key"><a
style="text-transform:capitalize"
href="${home}/recreate-api-key">API Key</a></li>
<li tal:condition="'core' in request.modules and change_unit(request)">
<a style="text-transform:capitalize"
href="${home}/departemen/chg">Ubah
Organisasi</a></li>
</ul>
</li>
</ul>
<!-- end user info -->
</div>
<!-- end pulled right: nav area -->
</header>
<!-- END HEADER -->
<!-- Left panel : Navigation area -->
<!-- Note: This width of the aside area can be adjusted through LESS variables -->
<aside id="left-panel" style="padding-bottom:67px">
<!-- NAVIGATION : This navigation is also responsive-->
<nav style="">
<!-- Modul Menu -->
<ul metal:define-slot="navs"></ul>
<!-- Admin Menu -->
<ul tal:condition="has_permission(request, user_path)" style="margin-top: 0; padding-top: 0;">
<li>
<a href="#"><i class="fa fa-lg fa-fw fa-shield"></i><span class="menu-item-parent">Admin</span></a>
<ul>
<li tal:condition="has_permission(request, ['user-view', 'user-edit'])"
tal:attributes="class route_name in user_path and 'active'">
<a href="${home}/user">User</a>
</li>
<li tal:condition="has_permission(request, ['user-view', 'user-edit'])"
tal:attributes="class route_name in user_area_path and 'active'">
<a href="${home}/user/area">User Area</a>
</li>
<li tal:condition="has_permission(request, ['user-view', 'user-edit'])"
tal:attributes="class route_name in user_dep_path and 'active'">
<a href="${home}/user/departemen">User Departemen</a>
</li>
<li tal:condition="has_permission(request, ['user-view', 'user-edit'])"
tal:attributes="class route_name in user_ext_path and 'active'">
<a href="${home}/user/ext">External User</a>
</li>
<li tal:condition="has_permission(request, ['user-view', 'user-edit'])"
tal:attributes="class route_name in group_path and 'active'">
<a href="${home}/group">Group</a>
</li>
<li tal:condition="has_permission(request, 'upload-logo')"
tal:attributes="class route_name in ['upload-logo'] and 'active'">
<a href="${home}/upload/logo">Upload Logo</a></li>
<li tal:condition="has_permission(request, 'parameter')"
tal:attributes="class route_name in param_path and 'active'">
<a href="${home}/parameter">Parameter</a></li>
<li tal:condition="has_permission(request, 'company')"
tal:attributes="class route_name in company_path and 'active'">
<a href="${home}/company">Pemerintah</a></li>
<li tal:condition="has_permission(request, 'eselon')"
tal:attributes="class route_name in eselon_path and 'active'">
<a href="${home}/eselon">Eselon</a></li>
<li tal:condition="has_permission(request, 'jabatan')"
tal:attributes="class route_name in jabatan_path and 'active'">
<a href="${home}/jabatan">Jabatan</a></li>
<li tal:condition="has_permission(request, 'departemen')"
tal:attributes="class route_name in dep_path and 'active'">
<a href="${home}/departemen">Departemen</a></li>
<li tal:condition="has_permission(request, 'partner')"
tal:attributes="class route_name in partner_path and 'active'">
<a href="${home}/partner">Partner</a></li>
<li tal:condition="has_permission(request, 'partner-departemen')"
tal:attributes="class route_name in part_dep_path and 'active'">
<a href="${home}/partner/departemen">Partner Departemen</a></li>
<li tal:condition="has_permission(request, 'provinsi')"
tal:attributes="class route_name in provinsi_path and 'active'">
<a href="${home}/provinsi">Provinsi</a></li>
<li tal:condition="has_permission(request, 'dati2')"
tal:attributes="class route_name in dati2_path and 'active'">
<a href="${home}/dati2">Kabupaten/Kota</a></li>
<li tal:condition="has_permission(request, 'kecamatan')"
tal:attributes="class route_name in kecamatan_path and 'active'">
<a href="${home}/kecamatan">Kecamatan</a></li>
<li tal:condition="has_permission(request, 'desa')"
tal:attributes="class route_name in desa_path and 'active'">
<a href="${home}/desa">Desa/Kelurahan</a></li>
<li tal:condition="has_permission(request, 'log')"
tal:attributes="class route_name in ['log'] and 'active'">
<a href="${home}/log">Log</a></li>
</div>
<!-- collapse menu button -->
<div id="hide-menu" class="btn-header pull-right">
<span> <a href="javascript:void(0);" data-action="toggleMenu" title="Collapse Menu"><i
class="fa fa-reorder"></i></a> </span>
</div>
<!-- end collapse menu -->
</ul>
</li>
</ul>
</nav>
<span class="minifyme" data-action="minifyMenu">
<i class="fa fa-arrow-circle-left hit"></i>
</span>
<span class="footer-side">&copy; OpenSIPKD.com
<script>document.write(new Date().getFullYear());</script>
</span>
</aside>
<!-- END NAVIGATION -->
<!-- JS -->
<script src="${home}/static/v3/js/jquery-2.1.1.min.js"></script>
<script>
if (!window.jQuery) {
document.write('<script src="${home}/static/v3/js/libs/jquery-2.1.1.min.js"><\/script>');
}
</script>
<!--?<script src="${home}/static/v3/js/jquery-ui-1.10.3.min.js"></script>-->
<script>
// if (!window.jQuery.ui) {
<!--? document.write('<script src="${home}/static/v3/js/libs/jquery-ui-1.10.3.min.js"><\/script>');-->
// }
</script>
<!-- IMPORTANT: APP CONFIG -->
<script src="${home}/static/v3/js/app.config.js"></script>
<!-- BOOTSTRAP JS -->
<script src="${home}/static/v3/js/bootstrap/bootstrap.min.js"></script>
<!-- FastClick: For mobile devices -->
<script src="${home}/static/v3/js/plugin/fastclick/fastclick.min.js"></script>
<!--[if IE 8]>
<!-- fullscreen button -->
<div id="fullscreen" class="btn-header transparent pull-right">
<span> <a href="javascript:void(0);" data-action="launchFullscreen" title="Full Screen">
<i class="fa fa-arrows-alt"></i></a> </span>
</div>
<!-- end fullscreen button -->
<!-- User info -->
<ul tal:condition="request.user" class="header-dropdown-list hidden-xs">
<li>
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-lg fa-fw fa-user"></i>
<span style="text-transform:capitalize"> ${request.user and request.user.nice_username() or ""}
</span>
<i class="fa fa-angle-down"></i> </a>
<ul class="dropdown-menu pull-right">
<li><a style="text-transform:capitalize" href="${request.route_url('profile')}">Profile</a></li>
<li tal:condition="not request.user.external">
<a style="text-transform:capitalize" href="${request.route_url('password')}">Ubah
password</a>
</li>
<li><a style="text-transform:capitalize" href="${request.route_url('logout')}">Logout</a></li>
<li tal:condition="request.user.api_key"><a style="text-transform:capitalize"
href="${home}/recreate-api-key">API Key</a></li>
<li tal:condition="'core' in request.modules and change_unit(request)">
<a style="text-transform:capitalize" href="${home}/departemen/chg">Ubah
Organisasi</a>
</li>
</ul>
</li>
</ul>
<!-- end user info -->
</div>
<!-- end pulled right: nav area -->
</header>
<!-- END HEADER -->
<!-- Left panel : Navigation area -->
<!-- Note: This width of the aside area can be adjusted through LESS variables -->
<aside id="left-panel" style="padding-bottom:67px">
<!-- NAVIGATION : This navigation is also responsive-->
<nav style="">
<!-- Modul Menu -->
<ul metal:define-slot="navs"></ul>
<!-- Admin Menu -->
<ul tal:condition="has_permission(request, user_path)" style="margin-top: 0; padding-top: 0;">
<li>
<a href="#"><i class="fa fa-lg fa-fw fa-shield"></i><span class="menu-item-parent">Admin</span></a>
<ul>
<li tal:condition="has_permission(request, ['user-view', 'user-edit'])"
tal:attributes="class route_name in user_path and 'active'">
<a href="${home}/user">User</a>
</li>
<li tal:condition="has_permission(request, ['user-view', 'user-edit'])"
tal:attributes="class route_name in user_area_path and 'active'">
<a href="${home}/user/area">User Area</a>
</li>
<li tal:condition="has_permission(request, ['user-view', 'user-edit'])"
tal:attributes="class route_name in user_dep_path and 'active'">
<a href="${home}/user/departemen">User Departemen</a>
</li>
<li tal:condition="has_permission(request, ['user-view', 'user-edit'])"
tal:attributes="class route_name in user_ext_path and 'active'">
<a href="${home}/user/ext">External User</a>
</li>
<li tal:condition="has_permission(request, ['user-view', 'user-edit'])"
tal:attributes="class route_name in group_path and 'active'">
<a href="${home}/group">Group</a>
</li>
<li tal:condition="has_permission(request, 'upload-logo')"
tal:attributes="class route_name in ['upload-logo'] and 'active'">
<a href="${home}/upload/logo">Upload Logo</a>
</li>
<li tal:condition="has_permission(request, 'parameter')"
tal:attributes="class route_name in param_path and 'active'">
<a href="${home}/parameter">Parameter</a>
</li>
<li tal:condition="has_permission(request, 'company')"
tal:attributes="class route_name in company_path and 'active'">
<a href="${home}/company">Pemerintah</a>
</li>
<li tal:condition="has_permission(request, 'eselon')"
tal:attributes="class route_name in eselon_path and 'active'">
<a href="${home}/eselon">Eselon</a>
</li>
<li tal:condition="has_permission(request, 'jabatan')"
tal:attributes="class route_name in jabatan_path and 'active'">
<a href="${home}/jabatan">Jabatan</a>
</li>
<li tal:condition="has_permission(request, 'departemen')"
tal:attributes="class route_name in dep_path and 'active'">
<a href="${home}/departemen">Departemen</a>
</li>
<li tal:condition="has_permission(request, 'partner')"
tal:attributes="class route_name in partner_path and 'active'">
<a href="${home}/partner">Partner</a>
</li>
<li tal:condition="has_permission(request, 'partner-departemen')"
tal:attributes="class route_name in part_dep_path and 'active'">
<a href="${home}/partner/departemen">Partner Departemen</a>
</li>
<li tal:condition="has_permission(request, 'provinsi')"
tal:attributes="class route_name in provinsi_path and 'active'">
<a href="${home}/provinsi">Provinsi</a>
</li>
<li tal:condition="has_permission(request, 'dati2')"
tal:attributes="class route_name in dati2_path and 'active'">
<a href="${home}/dati2">Kabupaten/Kota</a>
</li>
<li tal:condition="has_permission(request, 'kecamatan')"
tal:attributes="class route_name in kecamatan_path and 'active'">
<a href="${home}/kecamatan">Kecamatan</a>
</li>
<li tal:condition="has_permission(request, 'desa')"
tal:attributes="class route_name in desa_path and 'active'">
<a href="${home}/desa">Desa/Kelurahan</a>
</li>
<li tal:condition="has_permission(request, 'log')"
tal:attributes="class route_name in ['log'] and 'active'">
<a href="${home}/log">Log</a>
</li>
</ul>
</li>
</ul>
</nav>
<span class="minifyme" data-action="minifyMenu">
<i class="fa fa-arrow-circle-left hit"></i>
</span>
<span class="footer-side">&copy; OpenSIPKD.com
<script>document.write(new Date().getFullYear());</script>
</span>
</aside>
<!-- END NAVIGATION -->
<!-- JS -->
<script src="${home}/static/v3/js/jquery-2.1.1.min.js"></script>
<script>
if (!window.jQuery) {
document.write('<script src="${home}/static/v3/js/libs/jquery-2.1.1.min.js"><\/script>');
}
</script>
<!--?<script src="${home}/static/v3/js/jquery-ui-1.10.3.min.js"></script>-->
<script>
// if (!window.jQuery.ui) {
<!--? document.write('<script src="${home}/static/v3/js/libs/jquery-ui-1.10.3.min.js"><\/script>');-->
// }
</script>
<!-- IMPORTANT: APP CONFIG -->
<script src="${home}/static/v3/js/app.config.js"></script>
<!-- BOOTSTRAP JS -->
<script src="${home}/static/v3/js/bootstrap/bootstrap.min.js"></script>
<!-- FastClick: For mobile devices -->
<script src="${home}/static/v3/js/plugin/fastclick/fastclick.min.js"></script>
<!--[if IE 8]>
<h1>Your browser is out of date, please update your browser by going to www.microsoft.com/download</h1>
<![endif]-->
<!-- MAIN APP JS FILE -->
<script src="${home}/static/v3/js/app.min.js"></script>
<!-- PAGE RELATED PLUGIN(S) -->
<!--?<script src="${home}/static/v3/js/plugin/datatables/jquery.dataTables.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/datatables/dataTables.colVis.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/datatables/dataTables.tableTools.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/datatables/dataTables.bootstrap.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/datatable-responsive/datatables.responsive.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/bootstrap-timepicker/bootstrap-timepicker.min.js"></script>-->
<!--?<script src="${home}/deform_static/scripts/deform.js"></script>-->
<!--?<script src="${home}/deform_static/scripts/typeahead.min.js"></script>-->
<!--?<script src="${home}/deform_static/scripts/jquery.maskMoney-3.1.1.min.js"></script>-->
<!--?<script src="${home}/deform_static/tinymce/tinymce.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/tools.js"></script>-->
<!--?<script src="${home}/static/v3/js/notification/SmartNotification.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/masked-input/jquery.maskedinput.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/select2.full.min.js"></script>-->
<!--?<script src="${home}/deform_static/scripts/file_upload.js"></script>-->
<script src="${home}/static/v3/js/osipkd.js"></script>
<!-- LOOP ON JS RESOURCE -->
<tal:loop tal:repeat="js_resource js">
<script src="${home}${request.static_path(js_resource)}" tal:condition="js_resource[:4]!='http'"></script>
<script src="${js_resource}" tal:condition="js_resource[:4]=='http'"></script>
</tal:loop>
<metal:js define-slot="js_files"></metal:js>
<!-- End isi Script-->
<!-- MAIN PANEL -->
<div id="main" role="main">
<!-- MAIN CONTENT -->
<div id="content">
<!-- Error session flash -->
<div tal:condition="request.session.peek_flash()">
<div class="alert alert-success" tal:repeat="message request.session.pop_flash()"><i
class="fa fa-fw fa-lg fa-check-circle"></i>&nbsp;${message}
<!-- MAIN APP JS FILE -->
<script src="${home}/static/v3/js/app.min.js"></script>
<!-- PAGE RELATED PLUGIN(S) -->
<!--?<script src="${home}/static/v3/js/plugin/datatables/jquery.dataTables.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/datatables/dataTables.colVis.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/datatables/dataTables.tableTools.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/datatables/dataTables.bootstrap.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/datatable-responsive/datatables.responsive.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/bootstrap-timepicker/bootstrap-timepicker.min.js"></script>-->
<!--?<script src="${home}/deform_static/scripts/deform.js"></script>-->
<!--?<script src="${home}/deform_static/scripts/typeahead.min.js"></script>-->
<!--?<script src="${home}/deform_static/scripts/jquery.maskMoney-3.1.1.min.js"></script>-->
<!--?<script src="${home}/deform_static/tinymce/tinymce.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/tools.js"></script>-->
<!--?<script src="${home}/static/v3/js/notification/SmartNotification.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/plugin/masked-input/jquery.maskedinput.min.js"></script>-->
<!--?<script src="${home}/static/v3/js/select2.full.min.js"></script>-->
<!--?<script src="${home}/deform_static/scripts/file_upload.js"></script>-->
<script src="${home}/static/v3/js/osipkd.js"></script>
<!-- LOOP ON JS RESOURCE -->
<tal:loop tal:repeat="js_resource js">
<script src="${home}${request.static_path(js_resource)}" tal:condition="js_resource[:4]!='http'"></script>
<script src="${js_resource}" tal:condition="js_resource[:4]=='http'"></script>
</tal:loop>
<metal:js define-slot="js_files"></metal:js>
<!-- End isi Script-->
<!-- MAIN PANEL -->
<div id="main" role="main">
<!-- MAIN CONTENT -->
<div id="content">
<!-- Error session flash -->
<div tal:condition="request.session.peek_flash()">
<div class="alert alert-success" tal:repeat="message request.session.pop_flash()"><i
class="fa fa-fw fa-lg fa-check-circle"></i>&nbsp;${message}
</div>
</div>
</div>
<div tal:condition="request.session.peek_flash('error')">
<div class="alert alert-danger" tal:repeat="message request.session.pop_flash('error')"><i
class="fa fa-fw fa-lg fa-times-circle"></i>&nbsp;${message}
<div tal:condition="request.session.peek_flash('error')">
<div class="alert alert-danger" tal:repeat="message request.session.pop_flash('error')"><i
class="fa fa-fw fa-lg fa-times-circle"></i>&nbsp;${message}
</div>
</div>
</div>
<!-- Error session flash -->
<!-- Error session flash -->
<!-- <div id="errors" name="errors"> -->
<div class="alert alert-danger" id="errors" name="errors" style="display:none;">errors</div>
<div class="alert alert-success" id="success" name="success" style="display:none;">success</div>
<!-- <div id="errors" name="errors"> -->
<!-- <div id="errors" name="errors"> -->
<div class="alert alert-danger" id="errors" name="errors" style="display:none;">errors</div>
<div class="alert alert-success" id="success" name="success" style="display:none;">success</div>
<!-- <div id="errors" name="errors"> -->
<!-- Global Alert -->
<div tal:condition="request.session.peek_flash()">
<div class="alert alert-success" tal:repeat="message request.session.pop_flash()">${message}</div>
</div>
<div tal:condition="request.session.peek_flash('error')">
<div class="alert alert-danger" tal:repeat="message request.session.pop_flash('error')">${message}</div>
</div>
<!-- Global Alert -->
<div tal:condition="request.session.peek_flash()">
<div class="alert alert-success" tal:repeat="message request.session.pop_flash()">${message}</div>
</div>
<div tal:condition="request.session.peek_flash('error')">
<div class="alert alert-danger" tal:repeat="message request.session.pop_flash('error')">${message}</div>
</div>
<!-- End Global Alert -->
<!-- End Global Alert -->
<!-- SLOT KONTEN -->
<div metal:define-slot="content"></div>
<!-- END SLOT KONTEN -->
<!-- SLOT KONTEN -->
<div metal:define-slot="content"></div>
<!-- END SLOT KONTEN -->
</div>
<!-- END MAIN CONTENT -->
</div>
<!-- END MAIN CONTENT -->
</div>
<!-- END MAIN PANEL -->
<!-- END MAIN PANEL -->
<!-- Define Script-->
<script metal:define-slot="scripts"></script>
<!-- Define Script-->
<script metal:define-slot="scripts"></script>
</body>
</html>
\ No newline at end of file
......@@ -57,9 +57,6 @@ class Login(CSRFSchema):
password = colander.SchemaNode(
colander.String(), widget=widget.PasswordWidget())
# def after_bind(self, schema, kwargs):
# request = kwargs["request"]
# csrf_token = new_csrf_token(request)
......@@ -98,6 +95,8 @@ class LoginUser(object):
self.message = "Login Gagal"
set_user_log(self.message, self.request, log, values["username"])
return
for g in self.user.groups:
log.debug(f"Group: {g.id} as {g.group_name}")
# generate security_code dan simpan dalam session
regenerate_security_code(self.user, 0.03) # berlaku selama 1.8 menit
......@@ -115,8 +114,7 @@ class Oauth2UserExc(Exception):
def oauth2_login(request, params=None):
provider_name = params and params["provider_name"] \
or request.params["provider_name"]
provider_name = params and params["provider_name"] or request.params["provider_name"]
if provider_name == "google":
from .base_google import googlesignin
try:
......@@ -129,8 +127,8 @@ def oauth2_login(request, params=None):
id_info = None
iss = id_info and re.sub(r'https?://', '', id_info['iss']) or None
user = id_info and ExternalIdentityService. \
user_by_external_id_and_provider(id_info['sub'], iss)
user = id_info and ExternalIdentityService.user_by_external_id_and_provider(
id_info['sub'], iss)
log.debug("Users : %s", user)
log.debug("IdInfo : %s", id_info)
if id_info and not user:
......@@ -143,7 +141,8 @@ def oauth2_login(request, params=None):
log.debug("User : %s", user)
log.debug("Partner : %s", partner)
if user or partner:
raise Oauth2UserExc("Email sudah terdaftar silahkan login standard")
raise Oauth2UserExc(
"Email sudah terdaftar silahkan login standard")
user = User()
user.from_dict(values)
......@@ -205,9 +204,9 @@ class ViewLogin(BaseView):
# start cek external module
pckgs = get_params('external-uim')
if user:
external_user = DBSession.query(ExternalIdentity) \
.filter_by(local_user_id=user.id,
external_user_name=identity).first()
external_user = DBSession.query(ExternalIdentity).\
filter_by(local_user_id=user.id,
external_user_name=identity).first()
pckgs = external_user and pckgs or None
if pckgs:
......@@ -224,7 +223,8 @@ class ViewLogin(BaseView):
login = LoginUser(self.req)
if not login.login(values, user):
request.session.flash(login.message, "error")
next_url = get_urls(f"{request.route_url('login')}?next={next_url}")
next_url = get_urls(
f"{request.route_url('login')}?next={next_url}")
return HTTPFound(location=next_url)
return redirect_login(request, user)
......@@ -237,8 +237,7 @@ class ViewLogin(BaseView):
del request.session['login failed']
return r
elif "provider_name" in request.params and \
request.params["provider_name"]:
elif "provider_name" in request.params and request.params["provider_name"]:
try:
user = oauth2_login(request)
except Oauth2ParseExc as e:
......@@ -279,6 +278,9 @@ class ViewLogin(BaseView):
def redirect_login(request, user):
set_user_log("Login Sukses", request, log, user.user_name)
for g in user.groups:
log.debug(f"Group: {g.id} as {g.group_name}")
headers = get_login_headers(request, user)
request.session.flash("Sukses Login")
next_url = request.params.get('next')
......@@ -379,8 +381,7 @@ def view_change_password(request):
code = request.matchdict['code']
q = DBSession.query(User).filter_by(security_code=code)
user = q.first()
if not user or \
create_now() - user.security_code_date > one_hour:
if not user or create_now() - user.security_code_date > one_hour:
request.session.flash('Security code expired', 'error')
return HTTPFound(location=get_urls(request.route_url('login')))
......@@ -436,7 +437,7 @@ class ResetPassword(colander.Schema):
colander.String(), title=_('Email'),
description=_(
'email-reset-password',
default='Enter your email address and we will send you ' \
default='Enter your email address and we will send you '
'a link to reset your password.')
)
......@@ -459,8 +460,7 @@ def send_email_security_code(
**kwargs):
settings = get_settings()
password = kwargs.get("password", "")
if 'mail.sender_name' not in settings \
or 'mail.username' not in settings:
if 'mail.sender_name' not in settings or 'mail.username' not in settings:
return
url = '{}/password/{}?password={}'.format(
......@@ -499,8 +499,7 @@ def sending_mail(request, user, subject, body):
def send_email_pending(
request, user, subject, body_msg_id, body_default_file):
settings = get_settings()
if 'mail.sender_name' not in settings \
or 'mail.username' not in settings:
if 'mail.sender_name' not in settings or 'mail.username' not in settings:
return
here = os.path.abspath(os.path.dirname(__file__))
......@@ -558,4 +557,4 @@ def view_reset_password(request):
route_name='reset-password-sent',
renderer='templates/reset-password-sent.pt')
def view_reset_password_sent(request):
return dict(title=_('Reset password'))
\ No newline at end of file
return dict(title=_('Reset password'))
......@@ -3,8 +3,8 @@
oid oid|field.oid;
style style|field.widget.style;
autofocus autofocus|field.autofocus;
url url|field.widget.url;
slave slave|field.widget.slave;
url url|field.widget.url;
" tal:omit-tag="">
${field.start_mapping()}
<input type="hidden" name="auto_id" id="${oid}-auto_id" value="${auto_id}" />
......@@ -28,15 +28,22 @@
var not_check = ["id", "value"];
$.each(datum, function (key, val) {
if (!not_check.includes(key)) {
var ele = $('#' + key);
if (ele !== undefined) {
var eleName = ele.prop('nodeName').toLowerCase();
var eleName = $('#' + key).prop('nodeName');
if (eleName !== undefined) {
eleName = eleName.toLowerCase();
if (eleName === "select")
$("#" + key).val(val).trigger("change");
else if (eleName === "input")
$("#" + key).val(val);
else
$("#" + key).text(val);
} else {
//Check apakah jika radio button
eleName = $("input[name ='" + key + "']").prop('type');
if (eleName == "radio") {
$("input[name ='" + key + "'][value='" + val + "']").prop('checked', true);
}
}
}
});
......
......@@ -265,6 +265,8 @@ class DeTable(field.Field):
d["action"] = f.action
else:
d["action"] = True
if hasattr(f, "search_method"):
d["search_method"] = f.search_method
if isinstance(f.widget, deform_widget.HiddenWidget):
d["visible"] = False
......@@ -441,18 +443,27 @@ class DeTable(field.Field):
html += '</select>'
elif isinstance(f.typ, colander.Date):
html += f'<div class="form-group" {txt}>'
html += f'<label class="form-label" style="font-size:12px">{f.title}</label>'
html += f'<div class="input-group input-daterange" style="padding: 3px 0px 7px !important;">'
html += f'<input type="date" class="form-control {self.tableid}-control-filter hasDatePicker"'
html += f'data-index={field_index} placeholder="{f.title} Awal"'
html += f'name="{col_id}" id="{col_id}-min"/>'
html += f'<div class="input-group-addon">-</div>'
html += f'<input type="date" class="form-control {self.tableid}-control-filter hasDatePicker"'
html += f'data-index={field_index} placeholder="{f.title} Akhir" '
html += f'name="{col_id}" id="{col_id}-max" /></span>'
html += f'</div>'
html += f'</div>'
search_method = getattr(f, "search_method", None)
if search_method == "date":
# html += f'<div class="tooltip">'
html += f'<label class="form-label" style="font-size:12px">{f.title}</label>'
html += f'<input type="date" class="form-control {self.tableid}-control-filter"'
html += f'{txt}/>'
# html += f'<span class="tooltiptext">{f.title}</span>'
# html += f'</div>'
else:
html += f'<div class="form-group" {txt}>'
html += f'<label class="form-label" style="font-size:12px">{f.title}</label>'
html += f'<div class="input-group input-daterange" style="padding: 3px 0px 7px !important;">'
html += f'<input type="date" class="form-control {self.tableid}-control-filter hasDatePicker"'
html += f'data-index={field_index} placeholder="{f.title} Awal"'
html += f'name="{col_id}" id="{col_id}-min"/>'
html += f'<div class="input-group-addon">-</div>'
html += f'<input type="date" class="form-control {self.tableid}-control-filter hasDatePicker"'
html += f'data-index={field_index} placeholder="{f.title} Akhir" '
html += f'name="{col_id}" id="{col_id}-max" /></span>'
html += f'</div>'
html += f'</div>'
"""
awal
html += f'<div class="form-group" {txt}>'
......
......@@ -41,7 +41,7 @@
<div class="row" tal:condition="filter_columns">
<div id="${tableid}-form-filter-container" class="col-md-3">
<div id="${tableid}-form-filter" class="collapse">
${structure:filter_form}
${structure:filter_form}
</div>
</div>
</div>
......@@ -57,7 +57,7 @@
<script>
$(document).ready(function () {
$(document).on("click",'.${tableid}checkAll',function () {
$(document).on("click", '.${tableid}checkAll', function () {
if (this.checked) {
$(".${tableid}_check").prop("checked", true);
} else {
......@@ -69,18 +69,18 @@
</div>
<table id="${tableid}" class="table table-bordered table-hover table-condensed dataTable no-footer">
<thead>
<tr>
<tr>
<tal:block tal:repeat="child field">
<tr>
<tr>
<tal:block tal:repeat="child field">
<tal:block tal:condition="python:not hasattr(child, 'visible') or getattr(child, 'visible')==True">
<th
tal:condition="python:hasattr(child, 'action') and not getattr(child.condition)==False and False or True">
${child.title} </th>
<tal:block tal:condition="python:not hasattr(child, 'visible') or getattr(child, 'visible')==True">
<th
tal:condition="python:hasattr(child, 'action') and not getattr(child.condition)==False and False or True">
${child.title} </th>
</tal:block>
</tal:block>
</tal:block>
</tr>
</tr>
</thead>
<tbody></tbody>
......@@ -105,20 +105,16 @@
var o${tableid}Url = o${tableid}Uri + "${url_suffix}";
var m${tableid}ID;
var m${tableid}CheckList = [];
var check_field = ${check_field};
var check_field = ${ check_field };
deform.addCallback('${tableid}', function (oid) {
// $(document).ready(function () {
function displayEmptyID() {
$("#emptyID").show();
$('#emptyID').animate({opacity: 0.8}, 2000);
$('#emptyID').animate({ opacity: 0.8 }, 2000);
setTimeout(function () {
$("#emptyID").fadeTo(500, 0).slideUp(500, function () {
$("#emptyID").hide();
});
}
, 4000);
$("#emptyID").fadeTo(500, 0).slideUp(500, function () {
$("#emptyID").hide();
});
}, 4000);
}
let tb_array = [
......@@ -147,28 +143,24 @@
};
let ${tableid}Columns = ${structure: columns};
let ${tableid}Columns = ${ structure: columns };
function render_checkbox(value) {
if (value === true) {
if (value === true)
return '<i class="fas fa-check-square" aria-hidden="true">';
}
if (value === false) {
if (value === false)
return '<i class="fas fa-minus-square" aria-hidden="true">';
//'Archived';
}
return value;
}
function render_checklist(value) {
return '<input type="checkbox" class="${tableid}_check" checked="' + {value} + '"></input>';
return '<input type="checkbox" class="${tableid}_check" checked="' + { value } + '"></input>';
}
for (let co in ${tableid}Columns) {
if (${tableid}Columns[co].wg_checkbox === true) {
${tableid}Columns[co].render = function (value) {
${tableid}Columns[co].render = function (value) {
if (typeof value === "string" && value.length > 0) {
return render_checkbox(value)
}
......@@ -177,134 +169,128 @@
}
return render_checkbox(false);
}
//}
//else if (${tableid}Columns[co].wg_select === true) {
// ${tableid}Columns[co].render = function (value) {
// if (value != null)
// return ${tableid}Columns[co].wg_select_val[value];
// return "";
// }
} else if (${tableid}Columns[co].hasOwnProperty("url")) {
//}
//else if (${tableid}Columns[co].wg_select === true) {
// ${tableid}Columns[co].render = function (value) {
// if (value != null)
// return ${tableid}Columns[co].wg_select_val[value];
// return "";
// }
}else if (${tableid}Columns[co].hasOwnProperty("url")) {
let url = ${tableid}Columns[co].url;
${tableid}Columns[co].render = function (data) {
${tableid}Columns[co].render = function (data) {
let result = "No Data";
if (data != null) {
result = '<a href="' + url + data + '" target="_blank">Link</a>&nbsp;';
}
return result;
}
} else if (${tableid}Columns[co].data === "id") {
}else if (${tableid}Columns[co].data === "id") {
${tableid}Columns[co].render = function (id, typ, data, setting) {
if (${tableid}Columns[co].action === false) return ""
let result = "";
if (${allow_check}) {
if (${ allow_check }) {
var checked = "";
if (check_field !== "") {
checked = data[check_field] !== null ? "checked" : "";
m${tableid}CheckList.push(id);
m${tableid}CheckList.push(id);
}
var mtableId = "${tableid}";
result = '<input type="checkbox" class="' + mtableId + '_check" value="' + id + '" ' + checked + ' name="' + mtableId + '_check"/>&nbsp;';
}
if (${allow_view})
if (${ allow_view })
result += '<a href="${url}/' + id + '/view"><i class="fas fa-eye" aria-hidden="true" title="View"></i></a>&nbsp;';
if (${allow_edit})
if (${ allow_edit })
result += '<a href="${url}/' + id + '/edit"><i class="fas fa-edit" aria-hidden="true" title="Edit"></i></a>&nbsp;'
if (${allow_delete})
if (${ allow_delete })
result += '<a href="${url}/' + id + '/delete"><i class="fas fa-trash" aria-hidden="true" title="Delete"></i></a>';
if (${allow_post})
if (${ allow_post })
result += '<a href="${url}/' + id + '/post"><i class="fas fa-signs-post" aria-hidden="true" title="Post"></i></a>';
if (${allow_unpost})
if (${ allow_unpost })
result += '<a href="${url}/' + id + '/unpost"><i class="fas fa-delete-left" aria-hidden="true" title="Unpost"></i></a>';
return result;
}
//columns[1].order = "order_asc";
}
}
let ${tableid}Params = {}
let ${tableid}Params = {};
var param_ajax = "";
var param_data = [];
if (!${server_side}) {
param_data = ${data};
} else {
param_ajax = o${tableid}Url;
}
if (!${ server_side }) param_data = ${ data };
else param_ajax = o${tableid}Url;
o${tableid} = $('#${tableid}').DataTable({
scrollX: ${field.scroll_x},
//scrollY: ${field.scroll_y},
//dom: '<"row"<"col-md-8"<"toolbar">Bl><"col-md-4"fr>>tip',
dom: '<"row"<"col-md-8"<"toolbar">>><"row"<"col-md-8"Bl><"col-md-4"fr>>t<"row dt-footer"<"col-md-8" i><"col-md-4"p>>',
processing: true,
serverSide: ${server_side},
data: param_data,
ajax: param_ajax,
stateSave: ${state_save},
scrollCollapse: true,
sort: ${sorts},
info: true,
filter: ${filters},
autoWidth: false,
paginate: ${paginates},
paginationType: "full_numbers",
order: [],
lengthMenu: [
[10, 25, 50, 100],
[10, 25, 50, 100]
],
pageLength: 25,
columns: ${tableid}Columns,
language: ${tableid}Language,
initComplete: function () {
$('.dataTables_filter input').unbind()
.bind('keyup', function (e) {
var code = e.keyCode || e.which;
if (code === 13) {
o${tableid}.search(this.value).draw();
}
});
}
}
);
scrollX: ${ field.scroll_x },
//scrollY: ${field.scroll_y},
//dom: '<"row"<"col-md-8"<"toolbar">Bl><"col-md-4"fr>>tip',
dom: '<"row"<"col-md-8"<"toolbar">>><"row"<"col-md-8"Bl><"col-md-4"fr>>t<"row dt-footer"<"col-md-8" i><"col-md-4"p>>',
processing: true,
serverSide: ${ server_side },
data: param_data,
ajax: param_ajax,
stateSave: ${ state_save },
scrollCollapse: true,
sort: ${ sorts },
info: true,
filter: ${ filters },
autoWidth: false,
paginate: ${ paginates },
paginationType: "full_numbers",
order: [],
lengthMenu: [
[10, 25, 50, 100],
[10, 25, 50, 100]
],
pageLength: 25,
columns: ${tableid}Columns,
language: ${tableid}Language,
initComplete: function () {
$('.dataTables_filter input').unbind()
.bind('keyup', function (e) {
var code = e.keyCode || e.which;
if (code === 13) {
o${tableid}.search(this.value).draw();
}
});
}
});
let tb = tb_array.join(' ');
$("div.toolbar").html(tb);
$("div.toolbar").attr('style', 'display:block; float: left; margin-bottom:6px; line-height:16px;');
$("div.dt-footer").attr('style','margin-left: -7px;');
$(".dataTables_scrollBody").attr('style','margin-top: -10px;');
$("div.dt-footer").attr('style', 'margin-left: -7px;');
$(".dataTables_scrollBody").attr('style', 'margin-top: -10px;');
$('#${tableid} tbody').on('click', ':checkbox', function () {
if (this.checked) m${tableid}CheckList.push($(this).val());
else m${tableid}CheckList.splice(m${tableid}CheckList.indexOf($(this).val()), 1);
else m${tableid}CheckList.splice(m${tableid}CheckList.indexOf($(this).val()), 1);
});
$('#${tableid} tbody').on('click', 'tr', function () {
if ($(this).hasClass('selected')) {
$(this).removeClass('selected');
m${tableid}ID = null;
m${tableid}ID = null;
} else {
let aData = o${tableid}.row(this).data();
o${tableid}.$('tr.selected').removeClass('selected');
o${tableid}.$('tr.selected').removeClass('selected');
$(this).addClass('selected');
m${tableid}ID = aData.id;
o${tableid}.$('tr.row_selected').removeClass('row_selected');
m${tableid}ID = aData.id;
o${tableid}.$('tr.row_selected').removeClass('row_selected');
$(this).addClass('row_selected');
}
});
<tal:block tal:condition="filter_columns">
$(".${tableid}-control-filter").on('keyup', function (e) {
var code = e.keyCode || e.which;
if (code === 13) filter_table();
if (code === 13) filter_table();
});
$("#${tableid}_length").append('<label>&emsp;${structure:edit_buttons}</label>')
$("#${tableid}_length").append('<label>&emsp;${structure:edit_buttons}</label>');
function filter_table() {
$(".${tableid}-control-filter").each(function (e) {
......@@ -316,74 +302,69 @@
col_id = col_id.join("-");
value = this.value;
if (this.checked) {
console.log(col_id, $(this).attr('id'), value, this.checked);
//console.log(col_id, $(this).attr('id'), value, this.checked);
localStorage.setItem(col_id, value);
o${tableid}
.column($(this).data('index'))
.search(this.value)
o${tableid}.column($(this).data('index')).search(this.value)
}
}
else if ($(this).attr("type") === 'date') {
}
else if ($(this).attr("type") === 'date') {
value = this.value;
localStorage.setItem(col_id, value);
var splitted = col_id.split('-');
var min_val = undefined;
var max_val = undefined;
if (splitted[splitted.length - 1] === "min") {
min_val = this.value;
splitted.length = splitted.length - 1;
col_id = splitted.join("-");
max_val = $("#" + col_id + '-max').val()
} else {
max_val = this.value;
splitted.length = splitted.length - 1;
col_id = splitted.join("-");
min_val = $("#" + col_id + '-min').val()
if (splitted[splitted.length - 1] !== "min" && splitted[splitted.length - 1] !== "max"){
o${tableid}.column($(this).data('index')).search(value)
}
if (min_val === undefined && max_val !== undefined)
min_val = max_val;
if (max_val === undefined && min_val !== undefined)
max_val = min_val;
if (max_val !== undefined && min_val !== undefined && min_val !== "" && max_val !== "" && min_val !== null && max_val !== null)
o${tableid}
else{
var min_val = undefined;
var max_val = undefined;
if (splitted[splitted.length - 1] === "min") {
min_val = this.value;
splitted.length = splitted.length - 1;
col_id = splitted.join("-");
max_val = $("#" + col_id + '-max').val()
}
else {
max_val = this.value;
splitted.length = splitted.length - 1;
col_id = splitted.join("-");
min_val = $("#" + col_id + '-min').val();
}
if (min_val === undefined && max_val !== undefined) min_val = max_val;
if (max_val === undefined && min_val !== undefined) max_val = min_val;
if (max_val !== undefined && min_val !== undefined && min_val !== null && max_val !== null)
o${tableid}
.column($(this).data('index'))
.search(min_val + '-yadcf_delim-' + max_val, true)
}
else {
.search(min_val + '-yadcf_delim-' + max_val, true);
//&& min_val !== "" && max_val !== ""
}
}
else {
col_id = this.id;
value = this.value;
if (value === undefined || value === null) {
value = "";
}
if (value === undefined || value === null) value = "";
console.log(col_id, $(this).attr('id'), value, $(this).data('index'));
localStorage.setItem(col_id, value);
o${tableid}
.column($(this).data('index'))
.search(value);
.column($(this).data('index'))
.search(value);
}
});
//o${tableid}.ajax.url(o${tableid}Url).load();
o${tableid}.draw();
}
$(".${tableid}-control-filter").on('click', function (e) {
console.log("Write Data Click");
//console.log("Write Data Click");
var typ = $(this).attr("type");
if (typ === 'radio') {
filter_table();
filter_table();
}
});
$(".${tableid}-control-filter").on('change', function (e) {
var typ = $(this).prop("nodeName").toLowerCase();
if (typ === "select") {
filter_table()
}
if (typ === "select") filter_table();
var typ = $(this).attr("type").toLowerCase();
if (typ === "date") {
filter_table();
}
if (typ === "date") filter_table();
});
console.log("Read Data");
......@@ -396,21 +377,20 @@
col_id = col_id.join("-");
value = localStorage.getItem(col_id);
if (value !== undefined && value != null)
if ($(this).val() === value) $(this).attr("checked", true);
else $(this).attr("checked", false);
} else {
if ($(this).val() === value) $(this).attr("checked", true);
else $(this).attr("checked", false);
}
else {
value = localStorage.getItem(col_id);
if (value !== undefined && value !== null)
$(this).val(value);
$(this).val(value);
}
//console.log(col_id, $(this).attr('id'), value);
});
filter_table();
</tal:block>
${structure: btnscripts}
${structure: filter_scripts}
${structure:btnscripts}
${structure:filter_scripts}
});
</script>
</div>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!