menambah widgets

1 parent 94106652
<html tal:define="home request.home;">
<body>
<div class="well">
<h3>Forbidden</h3>
<!-- 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 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>
<!-- Error session flash -->
<p><img src="${home}/static/img/logo.png" class="img-float img-thumbnail" /></p>
Anda tidak berhak mengakses halaman <span style="color:red;">${url}</span><br>
<b>Silahkan Hubungi Administrator</b><br>
<a href="${request.referer}" tal:condition=request.referer>Kembali ke Halaman Sebelumnya</a>
<a href="${home}/" tal:condition="not request.referer">Kembali ke Halaman Utama</a>
</div>
</body>
</html>
\ No newline at end of file \ No newline at end of file
<html tal:define="home '';">
<body>
<div class="well">
<h2>${request.app_name}</h2>
<h3>Not Found</h3>
<!-- 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 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>
<!-- Error session flash -->
<p><img src="${home}/static/img/logo.png" class="img-float img-thumbnail"/></p>
Halaman yang anda cari tidak ada <span style="color:red;">${request.url}</span><br>
<a href="${request.referer}" tal:condition=request.referer >Kembali ke Halaman Sebelumnya</a>
<a href="${home}/" tal:condition="not request.referer" >Kembali ke Halaman Utama</a>
</div>
</body>
</html>
<html>
<body>
<div class="well">
<h3>Internal Server Error</h3>
<!-- 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 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>
<!-- Error session flash -->
<p><img src="${request._host}/static/img/logo.png" class="img-float img-thumbnail"/></p>
Halaman yang anda cari tidak ada
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en" tal:define="home request.home;">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="${home}/static/img/favicon.png">
<title tal:content="request.title" />
<!-- 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">
<!-- Bootstrap core CSS -->
<link href="${home}/static/v3/css/bootstrap.min.css" rel="stylesheet">
<!-- Font Awesome -->
<link rel="stylesheet" type="text/css" media="screen" href="${home}/static/v3/css/font-awesome.min.css">
<!-- Jquery CSS -->
<link href="${home}/static/v3/plugin/jqueryui/themes/base/jquery-ui.min.css" rel="stylesheet">
<!-- DataTables -->
<!-- <link href="${home}/static/v3/plugin/datatables/1.10/media/css/dataTables.bootstrap.css" rel="stylesheet"> -->
<!-- <link href="${home}/deform_static/css/typeahead.css" rel="stylesheet"> -->
<link href="${home}/deform_static/css/form.css" rel="stylesheet">
<link href="${home}/static/css/theme.css" rel="stylesheet">
<link href="${home}/static/css/navbar-fixed-top.css" rel="stylesheet">
<!-- Home CSS -->
<link href="${home}/static/css/custom.css" rel="stylesheet" type="text/css">
<metal:css define-slot="css_files"></metal:css>
<style>
#content {
padding-top: 0px;
}
</style>
</head>
<body>
<!-- <div metal:define-slot="header"></div> -->
<!-- Fixed navbar -->
<div class="container-fluid">
<div class="navbar navbar-default navbar-fixed-top bg-color-blue" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar bg-color-white"></span>
<span class="icon-bar bg-color-white"></span>
<span class="icon-bar bg-color-white"></span>
</button>
<!-- Define App Name -->
<a metal:define-slot="apps" class="navbar-brand txt-color-white" href="${home}">${request.app_name}</a>
<!-- End App Name -->
</div>
<!-- <div class="navbar-collapse collapse" tal.condition="not request.user"> -->
<!-- <ul class="nav navbar-nav"> -->
<!-- <li><a href="${home}/eis/sipkd" class="navbar-brand txt-color-white"><strong>${request.company}</strong></a></li> -->
<!-- </ul> -->
<!-- <ul class="nav navbar-nav navbar-right" style="margin-right:0px;"> -->
<!-- <li class="dropdown"> -->
<!-- <a href="${home}/login" class="button txt-color-white"><i class="fa fa-user"></i> Masuk</a> -->
<!-- </li> -->
<!-- </ul> -->
<!-- </div> -->
<div class="navbar-collapse collapse" tal:condition="request.user">
<!-- Define Tombol Navigator -->
<div metal:define-slot="navs"></div>
<!-- End Tombol Navigator -->
<ul class="nav navbar-nav navbar-right" style="margin-right:0px;">
<!-- Admin Menu -->
<li
class="dropdown"
tal:condition="has_permission(request, ['user-view', 'user-edit'])"
tal:attributes="class request.matched_route.name in ['user', 'user-add', 'user-edit', 'user-delete', 'group', 'group-add', 'group-edit', 'group-delete'] and 'active'">
<a href="#" class="dropdown-toggle txt-color-white" data-toggle="dropdown">Admin <b class="caret"></b></a>
<ul class="dropdown-menu">
<li tal:condition="has_permission(request, ['user-view', 'user-edit'])">
<a href="${home}/user">User</a>
</li>
<li tal:condition="has_permission(request, ['user-view', 'user-edit'])">
<a href="${home}/group">Group</a>
</li>
<li tal:condition="has_permission(request, 'routes')"><a href="${home}/routes">Routes</a></li>
<li tal:condition="has_permission(request, 'upload-logo')"><a href="${home}/upload/logo">Upload Logo</a></li>
<li tal:condition="has_permission(request, 'parameter')">
<a href="${home}/parameter">Parameter</a></li>
<li tal:condition="has_permission(request, 'departemen')">
<a href="${home}/departemen">Departemen</a></li>
<li tal:condition="has_permission(request, 'partner')">
<a href="${home}/partner">Partner</a></li>
<li tal:condition="has_permission(request, 'parameter')">
<a href="${home}/parameter">Parameter</a></li>
</ul>
</li>
<!-- User Login Menu-->
<li class="dropdown" tal:attributes="class request.path in
['/password', '/recreate-api-key'] and 'active'">
<a href="#" class="dropdown-toggle txt-color-white" data-toggle="dropdown">My Account <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a style="text-transform:capitalize" href="${home}/logout">${request.user.nice_username()} Logout</a></li>
<li><a style="text-transform:capitalize" href="${home}/profile">Profile</a></li>
<li><a style="text-transform:capitalize" href="${home}/password">Ubah password</a></li>
<li tal:condition="request.user.api_key">
<a style="text-transform:capitalize" href="${home}/recreate-api-key">
API Key
</a>
</li>
<!-- <li talcondition="'core' in request.modules and change_unit(request)"><a style="text-transform:capitalize" href="${home}/departemen/chg">Ubah Organisasi</a></li> -->
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<div class="container-fluid">
<!-- 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 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>
<!-- Error session flash -->
<!--<div>-->
<!--<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>-->
<div metal:define-slot="left-menu"></div>
<div metal:define-slot="content"></div>
</div> <!-- /container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" src="${home}/static/v3/js/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="${home}/static/v3/js/jquery-ui-1.10.3.min.js"></script>
<script type="text/javascript">
// Change JQueryUI plugin names to fix name collision with Bootstrap.
$.widget.bridge('uitooltip', $.ui.tooltip);
$.widget.bridge('uibutton', $.ui.button);
</script>
<script type="text/javascript" src="${home}/static/v3/js/bootstrap/bootstrap.min.js"></script>
<!-- <script type="text/javascript" src="${home}/static/v3/plugin/datatables/1.10/media/js/jquery.dataTables.min.js"></script> -->
<!-- <script type="text/javascript" src="${home}/static/v3/plugin/datatables/1.10/media/js/dataTables.bootstrap.js"></script> -->
<!-- <script type="text/javascript" src="${home}/static/v3/plugin/datatables/1.10/media/js/jquery.dataTables.ext.js"></script> -->
<!-- <script type="text/javascript" src="${home}/deform_static/scripts/deform.js"></script> -->
<!-- <script type="text/javascript" src="${home}/deform_static/scripts/typeahead.min.js"></script> -->
<!-- <script type="text/javascript" src="${home}/static/js/tools.js"></script> -->
<metal:js define-slot="js_files"></metal:js>
<script metal:define-slot="scripts"></script>
</body>
</html>
<!DOCTYPE html>
<html lang="en-us" tal:define="
home request.home;
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'];
user_dep_path ['user-departemen', 'user-departemen-add', 'user-departemen-edit', 'user-departemen-view', 'user-departemen-delete'];
user_ext_path ['user-ext', 'user-ext-view', 'user-ext-delete'];
group_path ['group', 'group-add', 'group-edit', 'group-view', 'group-delete'];
param_path ['parameter', 'parameter-add', 'parameter-edit', 'parameter-view', 'parameter-delete'];
dep_path ['departemen', 'departemen-add', 'departemen-edit', 'departemen-view', 'departemen-delete'];
partner_path ['partner', 'partner-add', 'partner-edit', 'partner-view', 'partner-delete'];
company_path ['company', 'company-add', 'company-edit', 'company-view', 'company-delete'];
part_dep_path ['partner-departemen', 'partner-departemen-add', 'partner-departemen-edit', 'partner-departemen-view', 'partner-departemen-delete'];
jabatan_path ['jabatan', 'jabatan-add', 'jabatan-edit', 'jabatan-view', 'jabatan-delete'];
eselon_path ['eselon', 'eselon-add', 'eselon-edit', 'eselon-view', 'eselon-delete'];
provinsi_path ['provinsi', 'provinsi-add', 'provinsi-edit', 'provinsi-view', 'provinsi-delete'];
dati2_path ['dati2', 'dati2-add', 'dati2-edit', 'dati2-view', 'dati2-delete'];
kecamatan_path ['kecamatan', 'kecamatan-add', 'kecamatan-edit', 'kecamatan-view', 'kecamatan-delete'];
desa_path ['desa', 'desa-add', 'desa-edit', 'desa-view', 'desa-delete'];
css css|[];
js js|[];
route_name route_name|request.matched_route.name;
">
<head>
<!--<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">-->
<title>${request.app_name} | ${request.company}</title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<!-- FAVICONS -->
<link rel="shortcut icon" href="${home}/static/v3/img/favicon.png" type="image/x-icon">
<link rel="icon" href="${home}/static/v3/img/favicon.png" type="image/x-icon">
<!-- GOOGLE FONT -->
<link rel="stylesheet" href="${home}/static/v3/css/gf_open_sans-400italic_700italic_300_400_700.css">
<!-- 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">
<!-- 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">
<!-- 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'">
</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>
</head>
<body class="fixed-header">
<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>
<!-- #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>
<!-- #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>
</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>
</div>
<!-- end fullscreen button -->
<!-- User info -->
<ul tal:condition="not request.user" class="header-dropdown-list hidden-xs">
<li>
<a href="${home}/login" class="dropdown-toggle"><i class="fa fa-lg fa-fw fa-user"></i>Login</a>
</li>
</ul>
<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('base-profile')}">Profile</a>
</li>
<li tal:condition="not request.user.external">
<a style="text-transform:capitalize" href="${request.route_url('base-password')}">Ubah
password</a>
</li>
<li><a style="text-transform:capitalize" href="${request.route_url('base-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 talcondition="'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">
Menu
<!-- NAVIGATION : This navigation is also responsive-->
<nav class="smart-menu" id="menu">
<!-- Modul Menu -->
<ul metal:define-slot="navs"></ul>
<ul style="margin-top: 0; padding-top: 0;">
<li tal:repeat="menu get_base_menus()"
tal:attributes="class route_name in menu['route_name'] and 'active'">
<a tal:condition="python:not menu['children'] and (not menu['permission'] or has_permission(request, menu['permission']))"
href="${home}${menu['path']}">
<i tal:condition="menu['icon']" class="fa fa-lg fa-fw ${menu['icon']}"></i>
<span>${menu['nama']}</span>
</a>
<a tal:condition="python:menu['children'] and (not menu['permission'] or has_permission(request, menu['permission']))"
href="#">
<i tal:condition="menu['icon']" class="fa fa-lg fa-fw ${menu['icon']}"></i>
<span class="menu-item-parent">${menu['nama']}</span>
</a>
<ul
tal:condition="python:menu['children'] and (not menu['permission'] or has_permission(request, menu['permission']))">
<li tal:repeat="submenu menu['children']"
tal:attributes="class route_name in submenu['route_name'] and 'active'">
<a tal:condition="python:not submenu['children'] and (not menu['permission'] or has_permission(request, submenu['permission']))"
href="${home}${submenu['path']}">
<i tal:condition="submenu['icon']" class="fa fa-lg fa-fw ${submenu['icon']}"></i>
<span>${submenu['nama']}</span>
</a>
<a tal:condition="submenu['children']" href="#">
<i tal:condition="submenu['icon']" class="fa fa-lg fa-fw ${submenu['icon']}"></i>
<span class="menu-item-parent">${submenu['nama']}</span>
</a>
<ul tal:condition="submenu['children']">
<li tal:repeat="submenu2 submenu['children']"
tal:attributes="class route_name in submenu2['route_name'] and 'active'">
<a href="${home}${submenu2['path']}">${submenu2['nama']}</a>
</li>
</ul>
</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}
</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>
</div>
<!-- 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"> -->
<!-- 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 -->
<!-- SLOT KONTEN -->
<div metal:define-slot="content"></div>
<!-- END SLOT KONTEN -->
</div>
<!-- END MAIN CONTENT -->
</div>
<!-- END MAIN PANEL -->
<!-- Define Script-->
<script metal:define-slot="scripts"></script>
</body>
</html>
\ No newline at end of file \ No newline at end of file
<html metal:use-macro="load: ./base5.pt"
tal:define="scripts scripts|scripts" >
<div metal:fill-slot="content">
<div class="panel panel-default">
<!-- <div class="panel-heading"> -->
<!-- <h3 class="panel-title"><i class="fa fa-fw fa-plus"></i>&nbsp;${request.title}</h3> -->
<!-- </div> -->
<div class="panel-body">
<div tal:content="structure form"></div>
</div>
</div>
</div>
<div metal:fill-slot="scripts">
<script>
$(document).ready(function () {
// $(".read-only").attr("readonly", true);
$(".readonly").attr("readonly", true);
$(".date").attr("readonly", true);
// $(".date").datepicker({
// format: 'dd-mm-yyyy'
// });
${structure:scripts}
});
</script>
<div metal:define-slot="scripts"></div>
</div>
</html>
<html metal:use-macro="load: ./base5.pt"
tal:define="scripts scripts|scripts" >
<div metal:fill-slot="content">
<div class="col-md-6 col-md-offset-3">
<div class="panel panel-default">
<!-- <div class="panel-heading"> -->
<!-- <h3 class="panel-title"><i class="fa fa-fw fa-plus"></i>&nbsp;${request.title}</h3> -->
<!-- </div> -->
<div class="panel-body">
<div tal:content="structure form"></div>
</div>
</div>
</div>
</div>
<div metal:fill-slot="scripts">
<script>
$(document).ready(function () {
// $(".read-only").attr("readonly", true);
$(".readonly").attr("readonly", true);
$(".date").attr("readonly", true);
// $(".date").datepicker({
// format: 'dd-mm-yyyy'
// });
${structure:scripts}
});
</script>
<div metal:define-slot="scripts"></div>
</div>
</html>
<html metal:use-macro="load: ./base5.pt"
tal:define="scripts scripts|scripts" >
<div metal:fill-slot="content">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<!-- <div class="panel-heading"> -->
<!-- <h3 class="panel-title"><i class="fa fa-fw fa-plus"></i>&nbsp;${request.title}</h3> -->
<!-- </div> -->
<div class="panel-body">
<div tal:content="structure form"></div>
</div>
</div>
</div>
</div>
<div metal:fill-slot="scripts">
<script>
$(document).ready(function () {
// $(".read-only").attr("readonly", true);
$(".readonly").attr("readonly", true);
$(".date").attr("readonly", true);
// $(".date").datepicker({
// format: 'dd-mm-yyyy'
// });
${structure:scripts}
});
</script>
<div metal:define-slot="scripts"></div>
</div>
</html>
<html metal:use-macro="load: base.pt">
<div metal:fill-slot="content">
<style>
.box { padding:25px; color:#fff; min-height:150px; font-size:14px;
line-height:30px; display:block; }
.box i { font-size:30px; margin:0px 5px; }
.box img { max-width:100%;max-height:120px }
.about { background: #138d9c; }
.appname { background: #5d41af; padding:0px; }
.module a { background: #ac284f; color:#fff !important; text-decoration:none !important; }
.module i { margin-top:25px; }
.module:nth-child(2n) a { background: #3372d9; }
.module:nth-child(4n) a { background: #138d9c; }
.module:nth-child(5n) a { background: #0f850e; }
.module:nth-child(3n) a { background: #1956af; }
.module .box i { font-size:45px;display:block; }
.module .box span { font-size:18px; line-height:18px; }
.boxf { background: #890f95; min-height:40px; }
.boxf img { height:32px; margin:0px 15px }
.about-text { font-size:24px;font-weight:normal; }
.about-appname { font-size:25px; font-weight:normal; letter-spacing: 1px; }
.about-company { font-size:28px; font-weight:bold; letter-spacing: 1px; }
.padding-thin { padding:2px }
.padding-medium { padding:15px }
.padding-high { padding:15px }
.no-padding { padding:0px }
.bold { font-weight:bold }
.box i.icon-normal { font-size:18px }
.modal h1 { text-align:center; color:#57889c }
.modal .modal-body { font-size:15px }
.modal .modal-body img { width:100%; margin-bottom:10px }
.modal .modal-body img.powered { height:30px; width:auto; }
img.icon-modul { display:block; max-width:80px; }
.organization { display:block; line-height:20px; font-weight:normal; }
</style>
<!-- MAIN CONTENT -->
<div id="content" class="container">
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<div class="col-sm-12 padding-thin">
<div class="box appname">
<div class="col-sm-3 padding-medium" align="center">
<img src="${home}/${logo}" alt="">
</div>
<div class="col-sm-9 padding-high">
<span class="about-appname">${request.app_name}</span><br>
<span class="about-company">${request.company}</span><br>
<b tal:condition="request.user" class="organization">
${'departemen_nm' in request.session and 'ORGANISASI : '+request.session['departemen_nm'] or ''}</b>
</div>
</div>
</div>
<div class="col-sm-12 no-padding" align="center">
<div tal:repeat="modul modules" class="col-sm-3 col-xs-6 module padding-thin">
<a tal:condition="modul.find('://')<0"
href="${home}/${modul}" icon="${modul.replace('/','_')}" class="box">
<img alt="" class="icon-modul" src="${home}/static/icon/${modul.replace('/','_')}.png">
<span>${modules[modul]}</span>
</a>
<a tal:condition="modul.find('://')>-1"
href="${modul}" class="box">
<img alt="" class="icon-modul"
src="${home}/static/icon/${modul.replace('://','').replace('https','').replace('http','')}.png">
<span>${modules[modul]}</span>
</a>
</div>
</div>
</div>
</div>
</div>
<div id="about-us" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body">
<h1>ABOUT <span class="bold">OPENSIPKD</span></h1>
<img src="${home}/static/img/slide-home-3.jpg" alt="">
Kami adalah perusahaan yang bergerak di bidang perancangan dan pembuatan aplikasi keuangan yang telah digunakan oleh Pemerintah Daerah.<br>
Aplikasi ini dibangun dengan menggunakan platform Open Source yang terdiri dari :
<div class="clearfix" style="margin-top:20px"></div>
<div class="col-sm-6">
<img class="powered" src="${home}/static/img/python.png" alt=""> <a href="https://www.python.org/">Python</a><br>
<img class="powered" src="${home}/static/img/pyramid.png" alt=""> <a href="http://pylonsproject.org/">Pyramid</a><br>
<a href="https://pypi.python.org/pypi/ziggurat-foundations">Ziggurat Foundations</a><br>
<a href="http://docs.pylonsproject.org/projects/pyramid-chameleon/en/latest/">Chameleon</a><br>
<a href="http://docs.pylonsproject.org/projects/deform/">Deform</a>
</div>
<div class="col-sm-6">
<img class="powered" src="${home}/static/img/bootstrap.png" alt=""> <a href="http://getbootstrap.com">Bootstrap</a><br>
<img class="powered" src="${home}/static/img/smartadmin.png" alt=""> <a href="https://github.com/kalichaudhary/SmartAdmin">Smart Admin</a><br>
<img class="powered" src="${home}/static/img/postgree.png" alt=""> <a href="http://postgresql.org">Postgres SQL</a>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>
</div>
<script metal:fill-slot="scripts">
$( ".module a" ).each(function() {
var modul = $(this);
var modulenm = modul.attr('icon');
$.ajax({
url:'${home}/static/icon/'+ modulenm+'.png',
type:'HEAD',
error: function()
{
modul.find('img.icon-modul').attr('src','${home}/static/icon/default.png');
},
});
});
</script>
</html>
<!DOCTYPE html>
<html lang="en"
tal:define="home request.home;">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<!--? <meta tal:condition="request.google_signin_client_id"-->
<!--? name="google-signin-client_id"-->
<!--? content="${request.google_signin_client_id}">-->
<link rel="shortcut icon" href="${home}/static/img/favicon.png">
<title tal:content="request.title" />
<!-- 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">
<!-- 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">
<!-- SmartAdmin RTL Support -->
<link rel="stylesheet" type="text/css" media="screen" href="${home}/static/v3/css/smartadmin-rtl.min.css">
<link rel="stylesheet" type="text/css" href="${home}/static/css/custom.css">
</head>
<body>
<div id="content" class="container">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4" style="margin-top:50px">
<div class="well no-padding">
<form id="deform" method="POST" enctype="multipart/form-data" accept-charset="utf-8"
class="smart-form client-form panel form-signin" style="border:0px;">
<header class="bg-color-blue">
<h1 class="txt-color-white login-header-big" align="center"
style="letter-spacing:1px;">${request.app_name}</h1>
</header>
<fieldset class="deformFormFieldset">
<input type="hidden" name="_charset_"/>
<input type="hidden" name="__formid__" value="deform"/>
<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 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 class="col-md-12" align="center">
<img src="${home}/static/img/logo.png"
class="img-float img-thumbnail" style="height:auto;width:auto;border:none;"/>
</div>
<div class="clearfix"></div>
<section>
<label class="label">USERNAME</label>
<label class="input"> <i class="icon-append fa fa-user"></i>
<input id="username" type="text" name="username" class="form-control">
<b class="tooltip tooltip-top-right">
<i class="fa fa-user txt-color-teal"></i>
ISI DENGAN USERNAME ANDA</b></label>
</section>
<section>
<label class="label">PASSWORD</label>
<label class="input"> <i class="icon-append fa fa-lock"></i>
<input id="password" type="password" name="password" class="form-control">
<b class="tooltip tooltip-top-right"><i class="fa fa-lock txt-color-teal"></i> ISI
DENGAN PASSWORD ANDA</b> </label>
</section>
<section>
<div class="form-group">
<label class=" checkbox checkbox-inline">
<input id="show_password" type="checkbox" style="left: 20px;">Show Password</label>
<div class="note">
<a href="${home}/reset-password" id="lupa" >Lupa Password?</a>
</div>
</div>
</section>
<section tal:condition="'captcha' in form">
<div tal:define="field form['captcha']">
${structure:field.serialize()}
</div>
</section>
<section tal:condition="'csrf_token' in form">
<div tal:define="field form['csrf_token']" style="display: none;">
${structure:field.serialize()}
</div>
</section>
</fieldset>
<footer>
<section>
<div class="row" style="float:right">
<button type="submit" id="login-btn" name="login"
class="btn btn-primary" style="float:left"
value="Login">
Login
</button>
<button tal:condition="request.allow_register"
id="register" name="register" class="btn btn-info"
value="Register" style="float:left">
Register
</button>
<!--? <div class="clearfix"></div>-->
</div>
</section>
</footer>
<footer>
<section>
<div class="row" tal:condition="request.google_signin_client_id and allow_register(request)">
<div id="g_id_onload"
data-client_id="${request.google_signin_client_id}"
data-callback="onSignIn">
</div>
<div class="g_id_signin" data-type="standard"></div>
</div>
</section>
<section>
<input id="provider_name" type="hidden" name="provider_name" class="form-control">
<input id="id_token" type="hidden" name="id_token" class="form-control">
</section>
</footer>
</form>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" src="${home}/deform_static/scripts/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="${home}/deform_static/scripts/bootstrap.min.js"></script>
<script type="text/javascript" src="${home}/deform_static/scripts/deform.js"></script>
<!--? <script tal:condition="request.google_signin_client_id"-->
<!--? src="https://apis.google.com/js/platform.js" async defer></script>-->
<script tal:condition="request.google_signin_client_id"
src="https://accounts.google.com/gsi/client" async defer></script>
<script tal:condition="request.google_signin_client_id">
window.onload = function (e) {
const value = document.cookie;
const parts = value.split(`g_state=`);
if (parts.length === 2) {
document.cookie = document.cookie + ";max-age=0";
}
}
function onSignIn(googleUser) {
// var profile = googleUser.getBasicProfile();
// console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
// console.log('Name: ' + profile.getName());
// console.log('Image URL: ' + profile.getImageUrl());
// console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present.
//getId(), getName(), getGivenName(), getFamilyName(), getImageUrl(), getEmail() methods, and
// console.log(googleUser);
// console.log(googleUser.getId());
// console.log(googleUser.getName());
// var id_token = googleUser.getAuthResponse().id_token;
document.getElementById('provider_name').value = "google";
document.getElementById('id_token').value = JSON.stringify(googleUser);
document.getElementById("deform").submit();
// var xhr = new XMLHttpRequest();
// xhr.open('POST', '/googlesignin');
// xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
// xhr.onload = function() {
// console.log('Signed in as: ' + xhr.responseText);
// };
// xhr.send('idtoken=' + id_token);
}
$(document).ready(function () {
$("form#deform").keypress(function (event) {
var keycode = (event.keyCode ? event.keyCode : event.which);
if (keycode == '13') {
event.preventDefault();
$("button#login-btn").click();
}
});
});
</script>
<script>
$(document).ready(function () {
$("#show_password").on("click", function () {
var x = $("#password");
if (x.attr("type") === "password") {
x.attr("type","text");
} else {
x.attr("type","password");
}
});
});
</script>
</body>
</html>
\ No newline at end of file \ No newline at end of file
<!DOCTYPE html>
<html lang="en" tal:define="home request.home;">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta tal:condition="request.google_signin_client_id"
name="google-signin-client_id"
content="${request.google_signin_client_id}">
<link rel="shortcut icon" href="${home}/static/img/favicon.png">
<title>Logout</title>
<!-- 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">
<!-- 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">
<!-- SmartAdmin RTL Support -->
<link rel="stylesheet" type="text/css" media="screen" href="${home}/static/v3/css/smartadmin-rtl.min.css">
<link rel="stylesheet" type="text/css" href="${home}/static/css/home.css">
</head>
<body onload="onLoad();">
<div id="content" class="container">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4" style="margin-top:50px">
<div class="well no-padding">
<form id="deform" method="POST" enctype="multipart/form-data" accept-charset="utf-8"
class="smart-form client-form panel form-signin" style="border:0px;">
<header class="bg-color-blue">
<h1 class="txt-color-white login-header-big" align="center"
style="letter-spacing:1px;">${request.app_name}</h1>
</header>
<fieldset class="deformFormFieldset">
<input type="hidden" name="_charset_"/>
<input type="hidden" name="__formid__" value="deform"/>
<div tal:condition="request.session.peek_flash()">
<div tal:repeat="message request.session.pop_flash()"
class="alert alert-success">${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>
<div class="col-md-12" align="center">
<img src="${home}/static/img/logo.png"
class="img-float img-thumbnail" style="height:50px;width:auto;border:none;"/>
</div>
<div class="clearfix"></div>
</fieldset>
<footer>
<!--? <button type="submit" name="batal"-->
<!--? class="btn btn-primary"-->
<!--? value="batal">-->
<!--? Batal-->
<!--? </button>-->
<!--? <button type="button" name="logout"-->
<!--? class="btn btn-danger"-->
<!--? value="logout"-->
<!--? onclick="signOut();">-->
<!--? Logout-->
<!--? </button>-->
<div tal:content="structure form"></div>
</footer>
</form>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" src="${home}/deform_static/scripts/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="${home}/deform_static/scripts/bootstrap.min.js"></script>
<script type="text/javascript" src="${home}/deform_static/scripts/deform.js"></script>
<!--?<script tal:condition="request.google_signin_client_id"-->
<!--? src="https://apis.google.com/js/platform.js" async defer></script>-->
<!--?<script tal:condition="request.google_signin_client_id">-->
<!--? function signOut() {-->
<!--? // console.log("Prepare Sign Out");-->
<!--? // var auth2 = gapi.auth2.getAuthInstance();-->
<!--? // auth2.signOut().then(function (data) {-->
<!--? // console.log(data);-->
<!--? // console.log('User signed out.');-->
<!--? // });-->
<!--? document.getElementById("deform").submit();-->
<!--? }-->
<!--? function onLoad() {-->
<!--? // gapi.load('auth2', function (data) {-->
<!--? // console.log(data);-->
<!--? // gapi.auth2.init();-->
<!--? // });-->
<!--? }-->
<!--?</script>-->
<!--?<script tal:condition="not request.google_signin_client_id">-->
<!--? function signOut() {-->
<!--? document.getElementById("deform").submit();-->
<!--? }-->
<!--? function onLoad() {-->
<!--? }-->
<!--?</script>-->
</body>
</html>
<div i18n:domain="deform"
tal:omit-tag=""
tal:define="oid oid|field.oid;
name name|field.name;
css_class css_class|field.widget.css_class;
style style|field.widget.style;">
${field.start_mapping()}
<div class="row">
<div class="col-xs-12 col-lg-6">
<div class="input-group">
<div class="row input-group-addon">
<div class="col-xs-6">
<input type="text" name="blok_kav_no" value="${blok_kav_no}"
class="span2 form-control ${css_class or ''}"
tal:attributes="style style;
blok_kav_no_attributes|field.widget.blok_kav_no_attributes|{};"
maxlength="15" minlength="" placeholder="Blok Kav No"
id="${oid}"/>
</div>
<div class="col-xs-3">
<input type="text" name="rt" value="${rt}"
class="span2 form-control ${css_class or ''}"
tal:attributes="style style;
rt_attributes|field.widget.rt_attributes|{};"
maxlength="3" minlength="3" placeholder="RT"
id="${oid}-rt"/>
</div>
<div class="col-xs-3">
<input type="text" name="rw" value="${rw}"
class="span2 form-control ${css_class or ''}"
tal:attributes="style style;
rw_attributes|field.widget.rw_attributes|{};"
maxlength="2" minlength="2" placeholder="RW"
id="${oid}-rw"/>
</div>
</div>
</div>
</div>
</div>
${field.end_mapping()}
</div>
<div tal:define="css_class css_class|field.widget.css_class;
oid oid|field.oid;
style style|field.widget.style;
type_name type_name|field.widget.type_name;"
tal:omit-tag="">
${field.start_mapping()}
<input type="${type_name}"
name="date"
value="${cstruct}"
tal:attributes="class string: ${css_class or ''} form-control hasDatepicker;
style style;
attributes|field.widget.attributes|{'readonly':'true'};"
id="${oid}"/>
${field.end_mapping()}
<script type="text/javascript">
deform.addCallback(
'${oid}',
function deform_cb(oid) {
$('#'+oid).datepicker(${options_json});
//if (!Modernizr.inputtypes['date'] ||"${type_name}" != "date" || window.forceDateTimePolyfill){
// $('#' + oid).pickadate(${options_json});
//}
}
);
</script>
</div>
<span tal:define="name name|field.name;
css_class css_class|field.widget.css_class;
oid oid|field.oid;
style style|field.widget.style;
"
tal:omit-tag="">
<img style="height:30px; width:auto; margin-bottom:5px;" src="${cstruct}">
<input type="text" name="${name}" value=""
tal:attributes="class string: form-control ${css_class or ''};
style style;
attributes|field.widget.attributes|{};"
id="${oid}"/>
<script>
deform.addCallback(
'${oid}',
function (oid) {
$("#" + oid).on('input', function (evt) {
$(this).val(function (_, val) {
return val.toUpperCase();
});
});
});
</script>
</span>
\ No newline at end of file \ No newline at end of file
<div class="checkbox">
<label for="${field.oid}">
<input tal:define="name name|field.name;
true_val true_val|field.widget.true_val;
css_class css_class|field.widget.css_class;
style style|field.widget.style;
oid oid|field.oid"
type="checkbox"
name="${name}" value="${true_val}"
id="${oid}"
tal:attributes="checked cstruct == true_val;
class css_class;
style style;
attributes|field.widget.attributes|{};" />
<span tal:condition="hasattr(field, 'schema') and hasattr(field.schema, 'label')"
tal:replace="field.schema.label" class="checkbox-label" >
</span>
</label>
</div>
<tal:block tal:define="oid oid|field.oid;
css_class css_class|field.widget.css_class;
style style|field.widget.style;
preview_url cstruct.get('preview_url')|'';
ext str(cstruct.get('filename').split('.')[-1:][0]).lower()|[];
fname str(cstruct.get('filename'))|'';
delete cstruct.get('delete')|'';
maxsize field.widget.size|5242880;
img ['jpg', 'jpeg', 'gif', 'png', 'svg', 'eps', 'psd'];
video ['avi', 'mov', 'mp4']
">
${field.start_mapping()}
<div class="thumbnail" tal:condition="ext in img or ext in video or ext=='pdf'">
<img tal:condition="ext in img" id="preview-${oid}" alt="" src="${preview_url}" style="${style}"
onload="window.URL.revokeObjectURL(this.src);"></img>
<video tal:condition="ext in video" style="${style}" controls src="${preview_url}" type="video/${ext}"
id="preview-${oid}">
Your browser does not support the video tag.
</video>
<video tal:condition="ext=='mp4'" controls style="${style}" src="${preview_url}" type="video/mp4"
id="preview-${oid}">
Your browser does not support the video tag.
</video>
<embed tal:condition="ext=='pdf'" src="${preview_url}" style="${style}" id="preview-${oid}">
</div>
<a tal:condition="ext" class="label label-default" href="${preview_url}" target="_blank" id="a-preview-${oid}"><i
class="fa fa-search"></i> View</a>
<input type="file" name="upload" id="${oid}" tal:attributes="style style;
accept accept|field.widget.accept;
data-filename fname;
attributes|field.widget.attributes|{};" />
<input tal:define="uid cstruct.get('uid')" tal:condition="uid" type="hidden" name="uid" value="${uid}" />
${field.end_mapping()}
<script type="text/javascript">
deform.addCallback('${oid}', function (oid) {
$('#' + oid).upload();
});
document.getElementById("${oid}").onchange = function () {
if (this.files[0].size > ${ maxsize }) {
alert("File is too big!");
this.value = "";
document.getElementById('preview-' + this.id).src = '';
}
document.getElementById('preview-' + this.id).src = window.URL.createObjectURL(this.files[0]);
document.getElementById('labeldelete-' + this.id).remove();
document.getElementById('label-' + this.id).remove();
};
</script>
</tal:block>
\ No newline at end of file \ No newline at end of file
<form
tal:define="style style|field.widget.style;
css_class css_class|string:${field.widget.css_class or field.css_class or ''};
item_template item_template|field.widget.item_template;
autocomplete autocomplete|field.autocomplete;
title title|field.title;
errormsg errormsg|field.errormsg;
description description|field.description;
buttons buttons|field.buttons;
use_ajax use_ajax|field.use_ajax;
ajax_options ajax_options|field.ajax_options;
formid formid|field.formid;
action action|field.action or None;
method method|field.method;"
tal:attributes="autocomplete autocomplete;
style style;
class css_class;
action action;
attributes|field.widget.attributes|{};"
id="${formid}"
method="${method}"
enctype="multipart/form-data"
accept-charset="utf-8"
class="deform ${field.bootstrap_form_style | 'form-horizontal'}"
i18n:domain="deform"
>
<!--osipkdForm Widgets-->
<fieldset class="deform-form-fieldset">
<div class="row">
<legend tal:condition="title">${title}</legend>
<input type="hidden" name="_charset_"/>
<input type="hidden" name="__formid__" value="${formid}"/>
<div class="alert alert-danger" tal:condition="field.error">
<div class="error-msg-lbl" i18n:translate="">There was a problem with your submission</div>
<div class="error-msg-detail" i18n:translate="">Errors have been highlighted below</div>
<p class="error-msg">${field.errormsg}</p>
</div>
<p class="section first" tal:condition="description">
${description}
</p>
<div tal:repeat="child field"
tal:replace="structure child.render_template(item_template)"/>
</div>
<div class="row">
<div class="form-group deform-form-buttons">
<tal:loop tal:repeat="button buttons">
<button
tal:define="btn_disposition repeat.button.start and 'btn-primary' or 'btn-default';"
tal:attributes="disabled button.disabled if button.disabled else None;
attributes|button.attributes|{};"
id="${formid+button.name}"
name="${button.name}"
type="${button.type}"
class="btn ${button.css_class or btn_disposition}"
value="${button.value}"
tal:condition="button.type != 'link'">
<span tal:condition="button.icon" class="glyphicon glyphicon-${button.icon}"></span>
${button.title}
</button>
<a
tal:define="btn_disposition repeat.button.start and 'btn-primary' or 'btn-default';
btn_href button.value|''"
class="btn ${button.css_class or btn_disposition}"
id="${field.formid + button.name}"
href="${btn_href}"
tal:condition="button.type == 'link'">
<span tal:condition="button.icon" class="glyphicon glyphicon-${button.icon}"></span>
${button.title}
</a>
</tal:loop>
</div>
</div>
</fieldset>
<script type="text/javascript" tal:condition="use_ajax">
deform.addCallback(
'${formid}',
function (oid) {
var target = '#' + oid;
var options = {
target: target,
replaceTarget: true,
success: function () {
deform.processCallbacks();
deform.focusFirstInput(target);
},
beforeSerialize: function () {
// See http://bit.ly/1agBs9Z (hack to fix tinymce-related ajax bug)
if ('tinymce' in window) {
$(tinymce.get()).each(
function (i, el) {
var content = el.getContent();
var editor_input = document.getElementById(el.id);
editor_input.value = content;
});
}
}
};
var extra_options = ${ajax_options} ||
{
}
;
$('#' + oid).ajaxForm($.extend(options, extra_options));
}
);
</script>
</form>
\ No newline at end of file \ No newline at end of file
<div tal:define="error_class error_class|field.widget.error_class;
description description|field.description;
title title|field.title;
oid oid|field.oid;
hidden hidden|field.widget.hidden;
category category|field.widget.category;
structural hidden or category == 'structural';
required required|field.required;"
class="form-group ${field.error and 'has-error' or ''} ${field.widget.item_css_class or ''} ${field.default_item_css_class()}"
title="${description}"
id="item-${oid}"
tal:omit-tag="structural"
i18n:domain="deform">
<div class="row">
<div class="col-md-12 col-lg-12 col-sm-12">
<label for="${oid}"
class="control-label col-sm-3 col-md-2 col-lg-2 ${required and 'required' or ''}"
tal:condition="not structural"
id="req-${oid}"
>${title}
</label>
<div class="col-sm-9 col-md-10 col-lg-10" tal:condition="not field.children">
<div tal:define="input_prepend field.widget.input_prepend | None;
input_append field.widget.input_append | None"
tal:omit-tag="not (input_prepend or input_append)"
class="input-group">
<span class="input-group-addon"
tal:condition="input_prepend">${input_prepend}</span>
<span tal:replace="structure field.serialize(cstruct).strip()"/>
<span class="input-group-addon"
tal:condition="input_append">${input_append}</span>
</div>
<p class="help-block"
tal:define="errstr 'error-%s' % field.oid"
tal:repeat="msg field.error.messages()"
i18n:translate=""
tal:attributes="id repeat.msg.index==0 and errstr or
('%s-%s' % (errstr, repeat.msg.index))"
tal:condition="field.error and not field.widget.hidden and not field.typ.__class__.__name__=='Mapping'">
${msg}
</p>
<p tal:condition="field.description and not field.widget.hidden"
class="help-block">
${field.description}
</p>
</div>
<div class="col-sm-12 col-md-12 col-lg-12" tal:condition="field.children">
<div tal:define="input_prepend field.widget.input_prepend | None;
input_append field.widget.input_append | None"
tal:omit-tag="not (input_prepend or input_append)"
class="input-group">
<span class="input-group-addon"
tal:condition="input_prepend">${input_prepend}</span>
<span tal:replace="structure field.serialize(cstruct).strip()"/>
<span class="input-group-addon"
tal:condition="input_append">${input_append}</span>
</div>
<p class="help-block"
tal:define="errstr 'error-%s' % field.oid"
tal:repeat="msg field.error.messages()"
i18n:translate=""
tal:attributes="id repeat.msg.index==0 and errstr or
('%s-%s' % (errstr, repeat.msg.index))"
tal:condition="field.error and not field.widget.hidden and not field.typ.__class__.__name__=='Mapping'">
${msg}
</p>
<p tal:condition="field.description and not field.widget.hidden"
class="help-block">
${field.description}
</p>
</div>
</div>
</div>
</div>
<div tal:define="
oid oid|field.oid;" i18n:domain="deform">
<p class="deform-readonly-true" id="${oid}" i18n:translate="">
<span id="{$oid}-blok_kav_no">${blok_kav_no}</span>
<span id="{$oid}-rt">RT: ${rt}</span>
<span id="{$oid}-rw">RW: ${rw}</span>
</p>
</div>
\ No newline at end of file \ No newline at end of file
<div tal:define="
oid oid|field.oid;
true_val true_val|field.widget.true_val;"
i18n:domain="deform">
<p class="deform-readonly-true"
id="${oid}"
tal:condition="cstruct == true_val"
i18n:translate=""><i class="fas fa-check-square" aria-hidden="true" style="color:green;"></i></p>
<p class="deform-readonly-false"
id="${oid}"
tal:condition="cstruct != true_val"
i18n:translate=""><i class="fas fa-window-close" aria-hidden="true" style="color:red;"></i></p>
</div>
<p tal:define="preview_url cstruct.get('preview_url');
css_class css_class|field.widget.css_class;
style style|field.widget.style;
preview_url cstruct.get('preview_url')|'';
ext str(cstruct.get('filename').split('.')[-1:][0]).lower()|[];
fname str(cstruct.get('filename'))|'';
delete cstruct.get('delete')|'';
ext str(cstruct.get('filename').split('.')[-1:][0]).lower()|[];
oid oid|field.oid;
img ['jpg', 'jpeg', 'gif', 'png', 'svg', 'eps', 'psd'];
video ['avi', 'mov', 'mpv'];
">
<div class="thumbnail">
<img tal:condition="ext in img" id="preview-${oid}" alt="" src="${preview_url}" style="${style}"
onload="window.URL.revokeObjectURL(this.src);"></img>
<video tal:condition="ext in video" style="${style}" controls src="${preview_url}" type="video/${ext}"
id="preview-${oid}">
Your browser does not support the video tag.
</video>
<video tal:condition="ext=='mp4'" controls style="${style}" src="${preview_url}" type="video/mp4" id="preview-${oid}">
Your browser does not support the video tag.
</video>
<embed tal:condition="ext=='pdf'" src="${preview_url}" style="${style}" id="preview-${oid}">
<a id="a-preview-${oid}" class="label label-default" href="${structure: preview_url}" target="_blank"><i
class="fa fa-search"></i> View</a>
</div>
</p>
\ No newline at end of file \ No newline at end of file
<form
tal:define="style style|field.widget.style;
css_class css_class|string:${field.widget.css_class or field.css_class or ''};
item_template item_template|field.widget.readonly_item_template;
title title|field.title;
errormsg errormsg|field.errormsg;
description description|field.description;
buttons buttons|field.buttons;
use_ajax use_ajax|field.use_ajax;
ajax_options ajax_options|field.ajax_options;
formid formid|field.formid;
method method|field.method;"
tal:attributes="style style;
class css_class;"
id="${formid}"
method="${method}"
enctype="multipart/form-data"
accept-charset="utf-8"
i18n:domain="deform"
class="deform ${field.bootstrap_form_style | 'form-horizontal'}"
>
<fieldset class="deform-form-fieldset">
<div class="row">
<legend tal:condition="title">${title}</legend>
<p class="section first" tal:condition="description">
${description}
</p>
<div tal:repeat="child field"
tal:replace="structure child.render_template(item_template)"/>
</div>
<div class="row">
<div class="form-group deform-form-buttons">
<tal:loop tal:repeat="button buttons">
<button
tal:define="btn_disposition repeat.button.start and 'btn-primary' or 'btn-default';"
tal:attributes="disabled button.disabled if button.disabled else None;
attributes|button.attributes|{};"
id="${formid+button.name}"
name="${button.name}"
type="${button.type}"
class="btn ${button.css_class or btn_disposition}"
value="${button.value}"
tal:condition="button.type != 'link'">
<span tal:condition="button.icon" class="glyphicon glyphicon-${button.icon}"></span>
${button.title}
</button>
<a
tal:define="btn_disposition repeat.button.start and 'btn-primary' or 'btn-default';
btn_href button.value|''"
class="btn ${button.css_class or btn_disposition}"
id="${field.formid + button.name}"
href="${btn_href}"
tal:condition="button.type == 'link'">
<span tal:condition="button.icon" class="glyphicon glyphicon-${button.icon}"></span>
${button.title}
</a>
</tal:loop>
</div>
</div>
</fieldset>
</form>
<span tal:define="name name|field.name;
css_class css_class|field.widget.css_class;
oid oid|field.oid;
mask mask|field.widget.mask;
mask_placeholder mask_placeholder|field.widget.mask_placeholder;
style style|field.widget.style;
"
tal:omit-tag="">
<input type="text" name="${name}" value="${cstruct}"
tal:attributes="class string: form-control ${css_class or ''};
style style;
attributes|field.widget.attributes|{};"
id="${oid}"/>
<script tal:condition="mask" type="text/javascript">
deform.addCallback(
'${oid}',
function (oid) {
$("#" + oid).mask("${mask}",
{placeholder:"${mask_placeholder}"});
});
</script>
</span>
<span tal:define="name name|field.name;
css_class css_class|field.widget.css_class;
oid oid|field.oid;
mask mask|field.widget.mask;
button button|field.widget.button;
mask_placeholder mask_placeholder|field.widget.mask_placeholder;
style style|field.widget.style;
js js|field.widget.js;
" tal:omit-tag="">
<input type="text" tal:attributes="class string: form-control ${css_class or ''};
style style;
attributes|field.widget.attributes|{};" id="${oid}" name="${name}" value="${cstruct}"
tal:condition="not button" />
<div class="input-group" tal:condition="button">
<input type="text" name="${name}" value="${cstruct}" tal:attributes="class string: form-control ${css_class or ''};
style style;
attributes|field.widget.attributes|{};" id="${oid}" />
<span class="input-group-btn">
<button tal:define="btn_disposition 'btn-default';" tal:attributes="disabled button.disabled if button.disabled else None;
attributes|button.attributes|{};" id="${oid+button.name}" name="${button.name}"
type="${button.type}" class="btn ${button.css_class or btn_disposition}" value="${button.value}"
tal:condition="button.type != 'link'">
<span tal:condition="button.icon" class="glyphicon glyphicon-${button.icon}"></span>
${button.title}
</button>
<a tal:define="btn_disposition 'btn-default';
btn_href button.value|''" class="btn ${button.css_class or btn_disposition}" id="${oid + button.name}"
href="${btn_href}" tal:condition="button.type == 'link'">
<span tal:condition="button.icon" class="glyphicon glyphicon-${button.icon}"></span>
${button.title}
</a>
</span>
<script tal:condition="js" type="text/javascript">
deform.addCallback(
'${oid+button.name}',
function (oid) {
${structure:js}
});
</script>
</div><!-- /input-group -->
<script tal:condition="mask" type="text/javascript">
deform.addCallback(
'${oid}',
function (oid) {
$("#" + oid).mask("${mask}",
{ placeholder: "${mask_placeholder}" });
});
</script>
</span>
\ No newline at end of file \ No newline at end of file
from iso8601.iso8601 import ISO8601_REGEX
from deform.widget import string_types
import json
import logging
from colander import SchemaNode, null, Mapping, Invalid # , string_types
# from colander import compat # tidak ada di colander 2.0
from deform import widget
from deform.compat import sequence_types, text_type, text_
from deform.form import Button
from deform.i18n import _
from deform.widget import (
Widget, _StrippedString, Select2Widget, _normalize_choices, OptGroup,
DateInputWidget as WidgetDateInputWidget, AutocompleteInputWidget)
from opensipkd.tools.captcha import img_captcha
_logging = logging.getLogger(__name__)
class DokumenWidget(Widget):
template = "opensipkd.base:/widgets/templates/dokumen.pt"
readonly_template = "opensipkd.base:/widgets/templates/readonly/dokumen.pt"
assume_y2k = True
_pstruct_schema = SchemaNode(
Mapping(),
SchemaNode(_StrippedString(), name="jenis"),
SchemaNode(_StrippedString(), name="year"),
SchemaNode(_StrippedString(), name="bundle"),
SchemaNode(_StrippedString(), name="seq"),
)
def serialize(self, field, cstruct, **kw):
if cstruct is null:
jenis = ""
year = ""
bundle = ""
seq = ""
else:
jenis, year, bundle, seq = cstruct.split(".", 3)
kw.setdefault("jenis", jenis)
kw.setdefault("year", year)
kw.setdefault("bundle", bundle)
kw.setdefault("seq", seq)
readonly = kw.get("readonly", self.readonly)
template = readonly and self.readonly_template or self.template
values = self.get_template_values(field, cstruct, kw)
return field.renderer(template, **values)
def deserialize(self, field, pstruct):
if pstruct is null:
return null
else:
try:
validated = self._pstruct_schema.deserialize(pstruct)
except Invalid as exc:
raise Invalid(field.schema, f"Invalid pstruct: {exc}")
jenis = validated["jenis"]
year = validated["year"]
bundle = validated["bundle"]
seq = validated["seq"]
if not year and not bundle and not seq:
return null
if self.assume_y2k and len(year) == 2:
year = "20" + year
result = ".".join([jenis, year, bundle, seq])
if not year or not bundle or not seq:
raise Invalid(field.schema, "No Dokumen tidak lengkap", result)
return result
class FormulirWidget(Widget):
template = "opensipkd.base:/views/widgets/formulir.pt"
readonly_template = "opensipkd.base:/views/widgets/readonly/formulir.pt"
assume_y2k = True
_pstruct_schema = SchemaNode(
Mapping(),
SchemaNode(_StrippedString(), name="year"),
SchemaNode(_StrippedString(), name="bundle"),
SchemaNode(_StrippedString(), name="seq"),
)
def serialize(self, field, cstruct, **kw):
if cstruct is null:
year = ""
bundle = ""
seq = ""
else:
year, bundle, seq = cstruct.split(".", 3)
kw.setdefault("year", year)
kw.setdefault("bundle", bundle)
kw.setdefault("seq", seq)
readonly = kw.get("readonly", self.readonly)
template = readonly and self.readonly_template or self.template
values = self.get_template_values(field, cstruct, kw)
return field.renderer(template, **values)
def deserialize(self, field, pstruct):
if pstruct is null:
return null
else:
try:
validated = self._pstruct_schema.deserialize(pstruct)
except Invalid as exc:
raise Invalid(field.schema, f"Invalid pstruct: {exc}")
year = validated["year"]
bundle = validated["bundle"]
seq = validated["seq"]
if not year and not bundle and not seq:
return null
if self.assume_y2k and len(year) == 2:
year = "20" + year
result = ".".join([year, bundle, seq])
if not year or not bundle or not seq:
raise Invalid(field.schema, "No Dokumen tidak lengkap", result)
return result
class BlokKavNoWidget(Widget):
template = "opensipkd.base:./widgets/templates/blok_kav_no.pt"
readonly_template = "opensipkd.base:./widgets/templates/readonly/blok_kav_no.pt"
_pstruct_schema = SchemaNode(
Mapping(),
SchemaNode(_StrippedString(), name="blok_kav_no"),
SchemaNode(_StrippedString(), name="rt"),
SchemaNode(_StrippedString(), name="rw")
)
def serialize(self, field, cstruct, **kw):
if cstruct is null:
blok_kav_no = ""
rt = "000"
rw = "00"
else:
blok_kav_no, rt, rw = cstruct.split("|", 3)
kw.setdefault("blok_kav_no", blok_kav_no)
kw.setdefault("rt", rt)
kw.setdefault("rw", rw)
readonly = kw.get("readonly", self.readonly)
template = readonly and self.readonly_template or self.template
values = self.get_template_values(field, cstruct, kw)
return field.renderer(template, **values)
def deserialize(self, field, pstruct):
if pstruct is null:
return null
else:
try:
validated = self._pstruct_schema.deserialize(pstruct)
except Invalid as exc:
raise Invalid(field.schema, f"Invalid pstruct: {exc}")
blok_kav_no = validated["blok_kav_no"]
rt = validated["rt"]
rw = validated["rw"]
if not blok_kav_no and not rt and not rw:
return null
result = "|".join([blok_kav_no, rt, rw])
if not rt:
raise Invalid(
field.schema, "RT harus diisi. Minimal 000", result)
if not rw:
raise Invalid(
field.schema, "RW harus diisi. Minimal 00", result)
# if not blok_kav_no or not rt or not rw:
# raise Invalid(field.schema, "Blok Kav No RT/RW tidak lengkap",
# result)
return result
class Select2MsWidget(Select2Widget):
"""
Renders ``<select>`` field based on a predefined set of values using
`select2 <https://select2.org/>`_ library.
**Attributes/Arguments**
Same as :func:`~deform.widget.Select2Widget`, with some extra options
listed here.
url: url for slave select
slave: id of slave select
widget = widget_os.Select2MsWidget(url="https://slave_item_url?item_key=selected_value,
slave="slave_id")
"""
url = ""
slave = ""
template = "select2_ms.pt"
class AutocompleteMsInputWidget(AutocompleteInputWidget):
"""
Renders ``<select>`` field based on a predefined set of values using
`select2 <https://select2.org/>`_ library.
**Attributes/Arguments**
Same as :func:`~deform.widget.Select2Widget`, with some extra options
listed here.
url: url for slave select
slave: id of slave select
widget = widget_os.AutocompleteMsInputWidget(url="https://slave_item_url?item_key=selected_value,
slave="slave_id")
Saat ini untuk slave baru bisa ke select2ms atau select2 atau select
"""
url = ""
slave = ""
template = "autocomplete_input_ms"
_pstruct_schema = SchemaNode(
Mapping(),
SchemaNode(_StrippedString(), name="auto_id"),
SchemaNode(_StrippedString(), name="auto_value"),
)
def serialize(self, field, cstruct, **kw):
if "delay" in kw or getattr(self, "delay", None):
raise ValueError(
"AutocompleteWidget does not support *delay* parameter "
"any longer."
)
if cstruct is null:
auto_id = ""
auto_value = ""
else:
auto_id, auto_value = cstruct.split("|", 2)
kw.setdefault("auto_id", auto_id)
kw.setdefault("auto_value", auto_value)
self.values = self.values or []
readonly = kw.get("readonly", self.readonly)
options = {}
if isinstance(self.values, string_types):
options["remote"] = "%s?term=%%QUERY" % self.values
else:
# vals = []
# for v in self.values:
# if not isinstance(v, string_types):
# vals.append(v[1])
# if not vals:
# vals = self.values
options["local"] = self.values
options["minLength"] = kw.pop("min_length", self.min_length)
options["limit"] = kw.pop("items", self.items)
kw["options"] = json.dumps(options)
kw["data"] = self.values
template = readonly and self.readonly_template or self.template
tmpl_values = self.get_template_values(field, cstruct, kw)
return field.renderer(template, **tmpl_values)
def deserialize(self, field, pstruct):
if pstruct is null:
return null
else:
try:
validated = self._pstruct_schema.deserialize(pstruct)
except Invalid as exc:
raise Invalid(field.schema, text_("Invalid pstruct: %s" % exc))
auto_id = validated["auto_id"]
auto_value = validated["auto_value"]
if not auto_id and not auto_value:
return null
result = "|".join([auto_id, auto_value])
if not auto_id or not auto_value:
raise Invalid(field.schema, _("Incomplete Data"), result)
return result
class QtyWidget(Widget):
template = "opensipkd.base:/widgets/templates/qty.pt"
readonly_template = "opensipkd.base:/viewswidgets/templates/readonly/qty.pt"
_pstruct_schema = SchemaNode(
Mapping(),
SchemaNode(_StrippedString(), name="qty"),
SchemaNode(_StrippedString(), name="measure"),
)
def serialize(self, field, cstruct, **kw):
if cstruct is null:
qty = 0
measure = 0
else:
qty, measure = cstruct.split("|", 3)
kw.setdefault("qty", qty)
kw.setdefault("measure", measure)
readonly = kw.get("readonly", self.readonly)
template = readonly and self.readonly_template or self.template
values = self.get_template_values(field, cstruct, kw)
return field.renderer(template, **values)
def deserialize(self, field, pstruct):
if pstruct is null:
return null
else:
try:
validated = self._pstruct_schema.deserialize(pstruct)
except Invalid as exc:
raise Invalid(field.schema, f"Invalid pstruct: {exc}")
qty = validated["qty"]
measure = validated["measure"]
if not qty and not measure:
return null
result = "|".join([str(qty), str(measure)])
if not qty or not measure:
raise Invalid(field.schema, "Data tidak lengkap", result)
return result
class CaptchaWidget(Widget):
"""
Renders an ``<input type="text"/>`` widget.
**Attributes/Arguments**
template
The template name used to render the widget. Default:
``textinput``.
readonly_template
The template name used to render the widget in read-only mode.
Default: ``readonly/textinput``.
strip
If true, during deserialization, strip the value of leading
and trailing whitespace (default ``True``).
"""
template = "opensipkd.base:widgets/templates/captcha.pt"
readonly_template = "textinput"
strip = True
requirements = ()
request = None
def __init__(self, **kw):
super(CaptchaWidget, self).__init__(**kw)
def serialize(self, field, cstruct, **kw):
kode_captcha, file_name = img_captcha(self.request)
self.request.session["captcha"] = kode_captcha
cstruct = self.url+file_name
readonly = kw.get("readonly", self.readonly)
template = readonly and self.readonly_template or self.template
values = self.get_template_values(field, cstruct, kw)
return field.renderer(template, **values)
def deserialize(self, field, pstruct):
if pstruct is null:
return null
elif not isinstance(pstruct, string_types):
raise Invalid(field.schema, "Pstruct is not a string")
if self.strip:
pstruct = pstruct.strip()
if not pstruct:
return null
if pstruct != self.request.session["captcha"]:
raise Invalid(field.schema, "Captcha tidak sesuai")
return pstruct
class ImageWidget(Widget):
"""
Renders an ``<img src="src"/>`` widget.
**Attributes/Arguments**
template
The template name used to render the widget. Default:
``image``.
readonly_template
The template name used to render the widget in read-only mode.
Default: ``readonly/image``.
strip
If true, during deserialization, strip the value of leading
and trailing whitespace (default ``True``).
"""
template = "opensipkd.base:views/widgets/image.pt"
readonly_template = "image"
strip = True
requirements = ()
height = "30px"
def __init__(self, **kw):
super().__init__(**kw)
def serialize(self, field, cstruct, **kw):
if cstruct in (null, None):
cstruct = ""
readonly = kw.get("readonly", self.readonly)
template = readonly and self.readonly_template or self.template
values = self.get_template_values(field, cstruct, kw)
return field.renderer(template, **values)
def deserialize(self, field, pstruct):
if pstruct is null:
return null
elif not isinstance(pstruct, string_types):
raise Invalid(field.schema, "Pstruct is not a string")
if self.strip:
pstruct = pstruct.strip()
if not pstruct:
return null
return pstruct
class MapWidget(Widget):
"""
Renders an ``<div id="map"/>`` widget.
**Attributes/Arguments**
template
The template name used to render the widget. Default:
``textinput``.
readonly_template
The template name used to render the widget in read-only mode.
Default: ``readonly/textinput``.
strip
If true, during deserialization, strip the value of leading
and trailing whitespace (default ``True``).
"""
template = "opensipkd.base:views/widgets/gmap.pt"
readonly_template = "opensipkd.base:views/widgets/readonly/gmap.pt"
map_center = [0, 0]
map_zoom = 12
gmap_key = None
gmap_control = ['Point', 'Polygon', 'LineString']
gmap_height = "400px"
gmap_width = "100%"
strip = True
html_info = {}
gmap_data_style = {
"editable": True,
"draggable": True,
"clickable": True,
"removable": True,
}
gmap_edit_url = ""
show_options = False
requirements = (('deform', None),
{
"js": "opensipkd.base:static/js/gmap.js",
"css": "deform:static/select2/select2.css",
},)
def __init__(self, **kw):
super().__init__(**kw)
_logging.debug(self.gmap_data_style)
self.gmap_data_style = json.dumps(self.gmap_data_style)
def serialize(self, field, cstruct, **kw):
if cstruct in (null, None):
cstruct = ""
readonly = kw.get("readonly", self.readonly)
template = readonly and self.readonly_template or self.template
_logging.debug(self.gmap_data_style)
# if readonly:
gmap_data_style = {
"editable": not readonly,
"draggable": not readonly,
"clickable": True,
"removable": not readonly,
}
self.gmap_data_style = json.dumps(gmap_data_style)
_logging.debug(self.gmap_data_style)
values = self.get_template_values(field, cstruct, kw)
return field.renderer(template, **values)
def deserialize(self, field, pstruct):
if pstruct is null:
return null
elif not isinstance(pstruct, string_types):
raise Invalid(field.schema, "Pstruct is not a string")
if self.strip:
pstruct = pstruct.strip()
if not pstruct:
return null
return pstruct
class LeafMapWidget(Widget):
"""
Renders an ``<div id="map"/>`` widget.
**Attributes/Arguments**
template
The template name used to render the widget. Default:
``textinput``.
readonly_template
The template name used to render the widget in read-only mode.
Default: ``readonly/textinput``.
strip
If true, during deserialization, strip the value of leading
and trailing whitespace (default ``True``).
"""
template = "opensipkd.base:views/widgets/leafmap.pt"
readonly_template = "opensipkd.base:views/widgets/readonly/leafmap.pt"
map_center = [0, 0]
map_zoom = 12
# gmap_control = ['Point', 'Polygon', 'LineString']
map_height = "400px"
map_width = "100%"
strip = True
html_info = {}
# gmap_data_style = {
# "editable": True,
# "draggable": True,
# "clickable": True,
# "removable": True,
# }
# gmap_edit_url = ""
show_options = True
requirements = (
('deform', None),
{
"js": ["opensipkd.base:static/v3/map/leaflet/leaflet.js",
"https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/0.4.2/leaflet.draw.js"],
"css": ["opensipkd.base:static/v3/map/leaflet/leaflet.css",
"https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/0.4.2/leaflet.draw.css"],
})
def __init__(self, **kw):
super().__init__(**kw)
# _logging.info(self.gmap_data_style)
# self.gmap_data_style = json.dumps(self.gmap_data_style)
def serialize(self, field, cstruct, **kw):
if cstruct in (null, None):
cstruct = ""
readonly = kw.get("readonly", self.readonly)
template = readonly and self.readonly_template or self.template
# _logging.debug(self.gmap_data_style)
# if readonly:
gmap_data_style = {
"editable": not readonly,
"draggable": not readonly,
"clickable": True,
"removable": not readonly,
}
# self.gmap_data_style = json.dumps(gmap_data_style)
# _logging.info(self.gmap_data_style)
values = self.get_template_values(field, cstruct, kw)
return field.renderer(template, **values)
def deserialize(self, field, pstruct):
if pstruct is null:
return null
elif not isinstance(pstruct, string_types):
raise Invalid(field.schema, "Pstruct is not a string")
if self.strip:
pstruct = pstruct.strip()
if not pstruct:
return null
return pstruct
class BootStrapDateInputWidget(Widget):
"""
Renders a date picker widget.
The default rendering is as a native HTML5 date input widget,
falling back to pickadate (https://github.com/amsul/pickadate.js.)
Most useful when the schema node is a ``colander.Date`` object.
**Attributes/Arguments**
options
Dictionary of options for configuring the widget (eg: date format)
template
The template name used to render the widget. Default:
``dateinput``.
readonly_template
The template name used to render the widget in read-only mode.
Default: ``readonly/textinput``.
"""
template = "bootstrapdateinput"
readonly_template = "readonly/textinput"
type_name = "text"
req_path = "opensipkd.base:static/v3/js/plugin"
requirements = (
('deform', None),
{
"js": (
f"{req_path}/bootstrap-datepicker/js/bootstrap-datepicker.min.js",
f"{req_path}/bootstrap-timepicker/bootstrap-timepicker.min.js",
f"{req_path}/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js",
),
"css": (
f"{req_path}/bootstrap-datepicker/css/bootstrap-datepicker.min.css",
# f"{req_path}/bootstrap-timepicker/css/bootstrap-timepicker.min.css",
f"{req_path}/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css",
),
}
)
default_options = (
("format", "yyyy-mm-dd"),
("zIndexOffset", "910"),
)
# ("selectMonths", True),
# ("selectYears", True),
options = None
_pstruct_schema = SchemaNode(
Mapping(),
SchemaNode(_StrippedString(), name="date"),
SchemaNode(_StrippedString(), name="date_submit", missing=""),
)
def serialize(self, field, cstruct, **kw):
if cstruct in (null, None):
cstruct = ""
readonly = kw.get("readonly", self.readonly)
template = readonly and self.readonly_template or self.template
options = dict(
kw.get("options") or self.options or self.default_options
)
options["formatSubmit"] = "yyyy-mm-dd"
kw.setdefault("options_json", json.dumps(options))
values = self.get_template_values(field, cstruct, kw)
return field.renderer(template, **values)
def deserialize(self, field, pstruct):
if pstruct in ("", null):
return null
try:
_logging.debug(f"Date:{self._pstruct_schema}")
validated = self._pstruct_schema.deserialize(pstruct)
except Invalid as exc:
raise Invalid(field.schema, "Invalid pstruct: %s" % exc)
return validated["date_submit"] or validated["date"]
class BootStrapDateTimeInputWidget(Widget):
"""
Renders a datetime picker widget.
The default rendering is as a pair of inputs (a date and a time) using
pickadate.js (https://github.com/amsul/pickadate.js).
Used for ``colander.DateTime`` schema nodes.
**Attributes/Arguments**
date_options
A dictionary of date options passed to pickadate.
time_options
A dictionary of time options passed to pickadate.
template
The template name used to render the widget. Default:
``dateinput``.
readonly_template
The template name used to render the widget in read-only mode.
Default: ``readonly/textinput``.
"""
template = "datetimeinput"
readonly_template = "readonly/datetimeinput"
type_name = "datetime"
requirements = (("modernizr", None), ("pickadate", None))
default_date_options = (
("format", "yyyy-mm-dd"),
("selectMonths", True),
("selectYears", True),
)
date_options = None
default_time_options = (("format", "h:i A"), ("interval", 30))
time_options = None
_pstruct_schema = SchemaNode(
Mapping(),
SchemaNode(_StrippedString(), name="date"),
SchemaNode(_StrippedString(), name="time"),
SchemaNode(_StrippedString(), name="date_submit", missing=""),
SchemaNode(_StrippedString(), name="time_submit", missing=""),
)
def serialize(self, field, cstruct, **kw):
if cstruct in (null, None):
cstruct = ""
readonly = kw.get("readonly", self.readonly)
if cstruct:
parsed = ISO8601_REGEX.match(cstruct)
if parsed: # strip timezone if it's there
timezone = parsed.groupdict()["timezone"]
if timezone and cstruct.endswith(timezone):
cstruct = cstruct[: -len(timezone)]
try:
date, time = cstruct.split("T", 1)
try:
# get rid of milliseconds
time, _ = time.split(".", 1)
except ValueError:
pass
kw["date"], kw["time"] = date, time
except ValueError: # need more than one item to unpack
kw["date"] = kw["time"] = ""
date_options = dict(
kw.get("date_options")
or self.date_options
or self.default_date_options
)
date_options["formatSubmit"] = "yyyy-mm-dd"
kw["date_options_json"] = json.dumps(date_options)
time_options = dict(
kw.get("time_options")
or self.time_options
or self.default_time_options
)
time_options["formatSubmit"] = "HH:i"
kw["time_options_json"] = json.dumps(time_options)
values = self.get_template_values(field, cstruct, kw)
template = readonly and self.readonly_template or self.template
return field.renderer(template, **values)
def deserialize(self, field, pstruct):
if pstruct is null:
return null
else:
try:
validated = self._pstruct_schema.deserialize(pstruct)
except Invalid as exc:
raise Invalid(field.schema, "Invalid pstruct: %s" % exc)
# seriously pickadate? oh. right. i forgot. you're javascript.
date = validated["date_submit"] or validated["date"]
time = validated["time_submit"] or validated["time"]
if not time and not date:
return null
result = "T".join([date, time])
if not date:
raise Invalid(field.schema, _("Incomplete date"), result)
if not time:
raise Invalid(field.schema, _("Incomplete time"), result)
return result
class TextInputWidget(widget.TextInputWidget):
template = "textinput_btn"
button = None
js = None
def __init__(self, **kw):
super(TextInputWidget, self).__init__(**kw)
# if isinstance(self.button, compat.string_types):
if self.button:
if isinstance(self.button, str):
self.button = Button(self.button, type="button")
class DateInputWidget(WidgetDateInputWidget):
type_name = "text"
class MoneyInputWidget(widget.MoneyInputWidget):
readonly_template = "readonly/textinput"
def get_template_values(self, field, cstruct, kw):
options = json.loads(kw.get("mask_options", "{}"))
if options:
decimal = options.get("decimal", '.')
precision = options.get("precision", 2)
thousands = options.get("thousands", ',')
cstr = cstruct and float(cstruct) or 0
cstruct = f"{cstr:,.{precision}f}"\
.replace(".", "%")\
.replace(",", thousands)\
.replace("%", decimal)
values = {"cstruct": cstruct, "field": field}
values.update(kw)
values.pop("template", None)
return values
class FilterWidget(Widget):
template = "opensipkd.base:/views/widgets/filters.pt"
readonly_template = "opensipkd.base:/views/widgets/readonly/filters.pt"
null_value = ""
values = ()
size = None
multiple = False
optgroup_class = OptGroup
long_label_generator = None
selectize_options = None
default_selectize_options = (("allowEmptyOption", True),)
_pstruct_schema = SchemaNode(
Mapping(),
SchemaNode(_StrippedString(), name="fields"),
SchemaNode(_StrippedString(), name="equality"),
SchemaNode(_StrippedString(), name="nilai"),
SchemaNode(_StrippedString(), name="condition"),
)
def get_select_value(self, cstruct, value):
"""Choose whether <opt> is selected or not.
Incoming value is always string, as it has been passed through HTML.
However, our values might be given as integer, UUID.
"""
if self.multiple:
if value in map(text_type, cstruct):
return "selected"
else:
if value == text_type(cstruct):
return "selected"
return None
def serialize(self, field, cstruct, **kw):
if cstruct in (null, None):
condition = ""
fields = ""
equality = ""
nilai = ""
else:
fields, equality, nilai, condition = cstruct.split(".", 4)
# if cstruct in (null, None):
# cstruct = self.null_value
kw.setdefault("condition", condition)
kw.setdefault("fields", fields)
kw.setdefault("equality", equality)
kw.setdefault("nilai", nilai)
readonly = kw.get("readonly", self.readonly)
values = kw.get("values", self.values)
if not isinstance(values, sequence_types):
e = "Values must be a sequence type (list, tuple, or range)."
raise TypeError(e)
template = readonly and self.readonly_template or self.template
kw["values"] = _normalize_choices(values)
selectize_options = dict(
kw.get("selectize_options")
or self.selectize_options
or self.default_selectize_options
)
kw["selectize_options_json"] = json.dumps(selectize_options)
tmpl_values = self.get_template_values(field, cstruct, kw)
return field.renderer(template, **tmpl_values)
def deserialize(self, field, pstruct):
if pstruct is null:
return null
else:
try:
validated = self._pstruct_schema.deserialize(pstruct)
except Invalid as exc:
raise Invalid(field.schema, f"Invalid pstruct: {exc}")
condition = validated["condition"]
fields = validated["fields"]
equality = validated["equality"]
nilai = validated["nilai"]
# if not year and not bundle and not seq:
# return null
#
# if self.assume_y2k and len(year) == 2:
# year = "20" + year
result = ".".join([fields, equality, nilai, condition])
#
# if not year or not bundle or not seq:
# raise Invalid(field.schema, "No Dokumen tidak lengkap", result)
return result
# class AutocompleteInputWidget(widget.AutocompleteInputWidget):
# targets = None
# def serialize(self, field, cstruct, **kw):
# item_id = kw.get("item_id", None)
# super().serialize(field, cstruct, **kw)
# if "delay" in kw or getattr(self, "delay", None):
# raise ValueError(
# "AutocompleteWidget does not support *delay* parameter "
# "any longer."
# )
# if cstruct in (null, None):
# cstruct = ""
# self.values = self.values or []
# readonly = kw.get("readonly", self.readonly)
#
# options = {}
# if isinstance(self.values, string_types):
# options["remote"] = "%s?term=%%QUERY" % self.values
# else:
# options["local"] = self.values
#
# options["minLength"] = kw.pop("min_length", self.min_length)
# options["limit"] = kw.pop("items", self.items)
# kw["options"] = json.dumps(options)
# tmpl_values = self.get_template_values(field, cstruct, kw)
# template = readonly and self.readonly_template or self.template
# return field.renderer(template, **tmpl_values)
#
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!