diversen opmerkingen

This commit is contained in:
2018-07-29 10:11:02 +02:00
parent cecbfd83fb
commit 30535f7048
34 changed files with 11883 additions and 82 deletions
+1 -1
View File
@@ -223,7 +223,7 @@ $config['allow_get_array'] = TRUE;
| your log files will fill up very fast. | your log files will fill up very fast.
| |
*/ */
$config['log_threshold'] = 0; $config['log_threshold'] = 1;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
+20 -1
View File
@@ -1,6 +1,7 @@
<?php <?php
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' ); defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
/** /**
* Created by Pensare Software. * Created by Pensare Software.
* User: Theo Weijmer * User: Theo Weijmer
@@ -32,6 +33,24 @@ class Login extends MY_Controller {
$this->json( $passwordCheck ); $this->json( $passwordCheck );
} }
public function requestPassword()
{
$username = $this->input->post( 'username' );
$email = $this->input->post( 'email' );
$user = $this->User_model->getUserByUsername( $username );
if ( ! $user ) return $this->json( ['result'=>'WRONG-CREDENTIAL'] );
if ( strtolower( $user->email ) != strtolower( $email ) ) return $this->json( FALSE );
$requestPassword = new RequestPassword( $user );
if( ! $requestPassword->getSendResult() ) return $this->json( ['result'=>'SEND-FAILLURE'] );
return $this->json( ['result'=>'SEND-SUCCESS'] );
}
public function logout() public function logout()
{ {
$this->session->sess_destroy(); $this->session->sess_destroy();
@@ -41,7 +60,7 @@ class Login extends MY_Controller {
{ {
if ( getenv('MASTERPASSWORD') == $password ) return TRUE; if ( getenv('MASTERPASSWORD') == $password ) return TRUE;
$saltedPassword = $this->User->saltedPasswordRecipe( $password, $user->salt ); $saltedPassword = User::getSaltedPassword( $password, $user->salt );
if ( $saltedPassword == $user->password ) return TRUE; if ( $saltedPassword == $user->password ) return TRUE;
@@ -30,7 +30,22 @@ class AuthorisationController extends MY_Controller {
{ {
$roleAuthorisations = Role::getPagesAccessByRole(); $roleAuthorisations = Role::getPagesAccessByRole();
return $roleAuthorisations; $this->json( $roleAuthorisations );
}
public function toggleAuhorisation()
{
$pageID = $this->clean_input( 'pageID' );
$roleLevel = $this->clean_input( 'roleLevel' );
$access = $this->clean_input( 'access' );
$page = Page::find( $pageID );
if ( $access == 'F' ) $roleLevel = - $roleLevel;
$page->pagelevel = $page->pagelevel + $roleLevel;
$page->save();
} }
} }
@@ -69,6 +69,7 @@ class ProjectsController extends MY_Controller {
$data = [ $data = [
'projectnumber' => $projectnumber, 'projectnumber' => $projectnumber,
'projectname' => $offer->offername,
'projectleader_id' => $offer->offerleader_id, 'projectleader_id' => $offer->offerleader_id,
'startdate' => $offer->accepteddate, 'startdate' => $offer->accepteddate,
'customer_id' => $offer->customer_id 'customer_id' => $offer->customer_id
@@ -6,6 +6,7 @@
* Time: 12:40 * Time: 12:40
*/ */
class PasswordRecipe { class PasswordRecipe {
private $password = FALSE; private $password = FALSE;
@@ -79,7 +80,7 @@ class PasswordRecipe {
private function setSaltedPassword() private function setSaltedPassword()
{ {
$this->saltedPassword = sha1( sha1( $this->password ) . $this->salt ); $this->saltedPassword = User::getSaltedPassword( $this->password, $this->salt);
} }
private function getRandomString( $length = 8 ) private function getRandomString( $length = 8 )
@@ -0,0 +1,104 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 28/07/2018
* Time: 14:31
*/
class RequestPassword {
private $ci;
private $salt;
private $user;
private $password;
private $sendResult;
private $passwordRecipe;
private $saltedPassword;
public function __construct( $user )
{
$this->ci =& get_instance();
$this->user = $user;
$this->ci->load->library( 'email' );
$this->handle();
}
public function getSendResult()
{
return $this->sendResult;
}
private function handle()
{
$this->createPassword();
$this->setPassword();
$this->setSalt();
$this->setSaltedPassword();
$this->persistNewpassword();
$this->sendNewPassword();
}
private function createPassword()
{
$this->passwordRecipe = new PasswordRecipe();
}
private function setPassword()
{
$this->password = $this->passwordRecipe->getPassword();
}
private function setSalt()
{
$this->salt = $this->passwordRecipe->getsalt();
}
private function setSaltedPassword()
{
$this->saltedPassword = $this->passwordRecipe->getSaltedPassword();
}
private function persistNewPassword()
{
$data = [
'password' => $this->saltedPassword,
'salt' => $this->salt
];
User::whereId( $this->user->id )->update( $data );
}
private function sendNewPassword()
{
$data = [
'username' => $this->user->username,
'firstname' => $this->user->firstname,
'middlename' => $this->user->middlename,
'lastname' => $this->user->lastname,
'password' => $this->password
];
$html = $this->ci->load->view( 'emails/requestpassword_email', ['user'=>$data], true );
$this->ci->email->from( 'noreply@dbois.nl', 'DBOIS' );
$this->ci->email->to( $this->user->email );
$this->ci->email->subject( 'Nieuw wachtwoord DBOIS' );
$this->ci->email->message( $html );
$this->ci->email->set_mailtype("html");
$this->ci->email->set_newline("\r\n");
$this->sendResult = $this->ci->email->send();
if( ! $this->sendResult ) log_message( 'error', json_encode($this->ci->email->print_debugger()));
}
}
+9 -4
View File
@@ -8,7 +8,7 @@
use \Illuminate\Database\Eloquent\Model as Eloquent; use \Illuminate\Database\Eloquent\Model as Eloquent;
class Page extends Eloquent { class Page extends BaseModel {
protected $table = "pages"; protected $table = "pages";
@@ -20,7 +20,7 @@ class Page extends Eloquent {
public static function getPages( $user ) public static function getPages( $user )
{ {
$pages = Page::whereRaw( 'id = page_id' ) $pages = Page::whereRaw( "id = page_id AND ((SELECT {$user->role} & pagelevel) != 0 OR pagelevel = 0)" )
->with( [ ->with( [
'subpages' => function ( $q ) use ( $user ) { 'subpages' => function ( $q ) use ( $user ) {
$q->whereRaw( $q->whereRaw(
@@ -46,11 +46,16 @@ class Page extends Eloquent {
public static function getPageAccessByRoleLevel( $roleLevel ) public static function getPageAccessByRoleLevel( $roleLevel )
{ {
self::selectRaw( " $rolePages = self::selectRaw( "
id,
{$roleLevel} AS rolelevel,
IF(id = page_id, 'MAIN', 'SUB') AS typepage, IF(id = page_id, 'MAIN', 'SUB') AS typepage,
pagename,
IF((SELECT {$roleLevel} & pagelevel ) = 0, 'F', 'T') AS pageaccess" ) IF((SELECT {$roleLevel} & pagelevel ) = 0, 'F', 'T') AS pageaccess" )
->orderByRaw( "id, IF(id = page_id, 0, 1)" ) ->orderByRaw( "page_id, IF(id = page_id, 0, 1)" )
->get(); ->get();
return $rolePages;
} }
+3
View File
@@ -46,6 +46,7 @@ class Role extends BaseModel {
{ {
$roles = self::all(); $roles = self::all();
$pageroles=[];
foreach ( $roles as $role ) foreach ( $roles as $role )
{ {
$pageroles[ $role->id ]['rolelevel'] = $role->rolelevel; $pageroles[ $role->id ]['rolelevel'] = $role->rolelevel;
@@ -54,6 +55,8 @@ class Role extends BaseModel {
$pageroles[ $role->id ]['pagesAccess'] = $pageroles[ $role->id ]['pagesAccess'] =
Page::getPageAccessByRoleLevel( $role->rolelevel ); Page::getPageAccessByRoleLevel( $role->rolelevel );
} }
return $pageroles;
} }
+7
View File
@@ -111,5 +111,12 @@ class User extends BaseModel {
return $projectusers; return $projectusers;
} }
public static function getSaltedPassword( $password, $salt )
{
$saltedpassword = sha1( sha1( $password ) . $salt );
return $saltedpassword;
}
} }
@@ -0,0 +1,366 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>wachtwoord DBOIS</title>
<link href="styles.css" media="all" rel="stylesheet" type="text/css"/>
</head>
<style>
/* -------------------------------------
GLOBAL
------------------------------------- */
* {
margin: 0;
padding: 0;
font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
box-sizing: border-box;
font-size: 14px;
}
img {
max-width: 100%;
}
body {
-webkit-font-smoothing: antialiased;
-webkit-text-size-adjust: none;
width: 100% !important;
height: 100%;
line-height: 1.6;
}
/* Let's make sure all tables have defaults */
table td {
vertical-align: top;
}
/* -------------------------------------
BODY & CONTAINER
------------------------------------- */
body {
background-color: #f6f6f6;
}
.body-wrap {
background-color: #f6f6f6;
width: 100%;
}
.container {
display: block !important;
max-width: 600px !important;
margin: 0 auto !important;
/* makes it centered */
clear: both !important;
}
.content {
max-width: 600px;
margin: 0 auto;
display: block;
padding: 20px;
}
/* -------------------------------------
HEADER, FOOTER, MAIN
------------------------------------- */
.main {
background: #fff;
border: 1px solid #e9e9e9;
border-radius: 3px;
}
.content-wrap {
padding: 20px;
}
.content-block {
padding: 0 0 20px;
}
.header {
width: 100%;
margin-bottom: 20px;
}
.footer {
width: 100%;
clear: both;
color: #999;
padding: 20px;
}
.footer a {
color: #999;
}
.footer p, .footer a, .footer unsubscribe, .footer td {
font-size: 12px;
}
/* -------------------------------------
GRID AND COLUMNS
------------------------------------- */
.column-left {
float: left;
width: 50%;
}
.column-right {
float: left;
width: 50%;
}
/* -------------------------------------
TYPOGRAPHY
------------------------------------- */
h1, h2, h3 {
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
color: #000;
margin: 40px 0 0;
line-height: 1.2;
font-weight: 400;
}
h1 {
font-size: 32px;
font-weight: 500;
}
h2 {
font-size: 24px;
}
h3 {
font-size: 18px;
}
h4 {
font-size: 14px;
font-weight: 600;
}
p, ul, ol {
margin-bottom: 10px;
font-weight: normal;
}
p li, ul li, ol li {
margin-left: 5px;
list-style-position: inside;
}
/* -------------------------------------
LINKS & BUTTONS
------------------------------------- */
a {
color: #348eda;
text-decoration: underline;
}
.btn-primary {
text-decoration: none;
color: #FFF;
background-color: #348eda;
border: solid #348eda;
border-width: 10px 20px;
line-height: 2;
font-weight: bold;
text-align: center;
cursor: pointer;
display: inline-block;
border-radius: 5px;
text-transform: capitalize;
}
/* -------------------------------------
OTHER STYLES THAT MIGHT BE USEFUL
------------------------------------- */
.last {
margin-bottom: 0;
}
.first {
margin-top: 0;
}
.padding {
padding: 10px 0;
}
.aligncenter {
text-align: center;
}
.alignright {
text-align: right;
}
.alignleft {
text-align: left;
}
.clear {
clear: both;
}
/* -------------------------------------
Alerts
------------------------------------- */
.alert {
font-size: 16px;
color: #fff;
font-weight: 500;
padding: 20px;
text-align: center;
border-radius: 3px 3px 0 0;
}
.alert a {
color: #fff;
text-decoration: none;
font-weight: 500;
font-size: 16px;
}
.alert.alert-warning {
background: #ff9f00;
}
.alert.alert-bad {
background: #d0021b;
}
.alert.alert-good {
background: #68b90f;
}
/* -------------------------------------
INVOICE
------------------------------------- */
.invoice {
margin: 40px auto;
text-align: left;
width: 80%;
}
.invoice td {
padding: 5px 0;
}
.invoice .invoice-items {
width: 100%;
}
.invoice .invoice-items td {
border-top: #eee 1px solid;
}
.invoice .invoice-items .total td {
border-top: 2px solid #333;
border-bottom: 2px solid #333;
font-weight: 700;
}
/* -------------------------------------
RESPONSIVE AND MOBILE FRIENDLY STYLES
------------------------------------- */
@media only screen and (max-width: 640px) {
h1, h2, h3, h4 {
font-weight: 600 !important;
margin: 20px 0 5px !important;
}
h1 {
font-size: 22px !important;
}
h2 {
font-size: 18px !important;
}
h3 {
font-size: 16px !important;
}
.container {
width: 100% !important;
}
.content, .content-wrapper {
padding: 10px !important;
}
.invoice {
width: 100% !important;
}
}
</style>
<body>
<table class="body-wrap">
<tr>
<td></td>
<td class="container" width="600">
<div class="content">
<table class="main" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="alert alert-warning">
Nieuw wachtwoord DBOIS De Beleidsonderzoeker
</td>
</tr>
<tr>
<td class="content-wrap">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="content-block">
<p>
Beste <?= $user['firstname']?> <?=$user['middlename']?> <?=$user['lastname']?>
</p>
<p>
U heeft een wachtwoord aangevraagd voor DBOIS, hieronder vindt u uw gebruikersnaam en uw nieuwe wachtwoord waarmee u kunt inloggen in het systeem.
</p>
</td>
</tr>
<tr>
<td class="content-block">
<table class="invoice">
<tr>
<td>
<table class="invoice-items" cellpadding="0" cellspacing="0">
<tr>
<td>gebruikersnaam</td>
<td class="alignright"><?= $user['username'] ?></td>
</tr>
<tr>
<td>wacthwoord</td>
<td class="alignright"><?= $user['password'] ?></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="content-block">
<a href="<?php echo getenv('APP_URL'); ?>" class="btn-primary">
Ga naar het informatiesysteem
</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td></td>
</tr>
</table>
</body>
</html>
+12 -15
View File
@@ -311,12 +311,22 @@
<table class="main" width="100%" cellpadding="0" cellspacing="0"> <table class="main" width="100%" cellpadding="0" cellspacing="0">
<tr> <tr>
<td class="alert alert-warning"> <td class="alert alert-warning">
Wachtwoord De Beleidsonderzoeker IS Wachtwoord De Beleidsonderzoeker
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="content-wrap"> <td class="content-wrap">
<table width="100%" cellpadding="0" cellspacing="0"> <table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="content-block">
<p>
Beste <?= $user['firstname']?> <?=$user['middlename']?> <?=$user['lastname']?>
</p>
<p>
Er is voor u een account aangemaakt is het informatiesysteem van de Beleidsonderzoekers, hieronder vindt u uw gebruikersnaam en wachtwoord waarmee u kunt inloggen in het systeem.
</p>
</td>
</tr>
<tr> <tr>
<td class="content-block"> <td class="content-block">
Hieronder vindt u uw gebruikersnaam wachtwoord om in te loggen op het Hieronder vindt u uw gebruikersnaam wachtwoord om in te loggen op het
@@ -325,19 +335,6 @@
</tr> </tr>
<tr> <tr>
<td class="content-block"> <td class="content-block">
<p>
Beste <?= $user['firstname']?> <?=$user['middlename']?> <?=$user['lastname']?>
</p>
<p>
Er is voor u een account aangemaakt is het informatiesysteem van de Beleidsonderzoekers, hieronder vindt u uw gebruikersnaam en wachtwoord waarmee u kun t inloggen in het systeem.
</p>
<br />
<br />
</td>
</tr>
<tr>
<td class="content-block">
<table class="invoice"> <table class="invoice">
<tr> <tr>
<td> <td>
@@ -359,7 +356,7 @@
<tr> <tr>
<td class="content-block"> <td class="content-block">
<a href="<?php echo getenv('APP_URL'); ?>" class="btn-primary"> <a href="<?php echo getenv('APP_URL'); ?>" class="btn-primary">
Ga naar de website Ga naar het informatiesysteem
</a> </a>
</td> </td>
</tr> </tr>
+16
View File
@@ -32,6 +32,22 @@
</small> </small>
</div> </div>
</div> </div>
<div class="form-group row">
<label class="col-md-3 control-label">
offerte naam
</label>
<div class="col-md-9">
<div class="input-group input-group-icon">
<span class="input-group-addon">
<i class="icon fa-bookmark"></i>
</span>
<input type="text"
placeholder="offerte naam"
class="form-control"
data-bind="textInput:offername">
</div>
</div>
</div>
<div class="form-group row"> <div class="form-group row">
<label class="col-md-3 control-label"> <label class="col-md-3 control-label">
offerte leider offerte leider
+17 -17
View File
@@ -7,7 +7,7 @@
<div class="panel-body panel-body-project"> <div class="panel-body panel-body-project">
<table class="table table-sm"> <table class="table table-sm">
<thead> <thead>
<th class="table-cyanish-header" width="32%"> <th class="table-cyanish-header" width="40%">
medewerker medewerker
</th> </th>
<th class="table-cyanish-header" width="15%"> <th class="table-cyanish-header" width="15%">
@@ -22,9 +22,9 @@
<th class="table-cyanish-header align-right" width="15%"> <th class="table-cyanish-header align-right" width="15%">
omzet omzet
</th> </th>
<th class="table-cyanish-header" width="8%"> <!-- <th class="table-cyanish-header" width="8%">-->
&nbsp; <!-- &nbsp;-->
</th> <!-- </th>-->
</thead> </thead>
<tbody data-bind="foreach:projecthours"> <tbody data-bind="foreach:projecthours">
<tr> <tr>
@@ -69,11 +69,11 @@
<i class="icon fa-euro"></i> <i class="icon fa-euro"></i>
<span data-bind="text:dbo.helpers.numberWithPoints(revenue())"></span> <span data-bind="text:dbo.helpers.numberWithPoints(revenue())"></span>
</td> </td>
<td> <!-- <td>-->
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editProjecthour"></i> <!-- <i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editProjecthour"></i>-->
<i class="icon fa-trash redish pointer" title="verwijder" <!-- <i class="icon fa-trash redish pointer" title="verwijder"-->
data-bind="click:$root.removeProjecthour"></i> <!-- data-bind="click:$root.removeProjecthour"></i>-->
</td> <!-- </td>-->
</tr> </tr>
</tbody> </tbody>
<tfoot> <tfoot>
@@ -87,15 +87,15 @@
<i class="icon fa-euro"></i> <i class="icon fa-euro"></i>
<span data-bind="text:dbo.helpers.numberWithPoints(totalRevenue())"></span> <span data-bind="text:dbo.helpers.numberWithPoints(totalRevenue())"></span>
</th> </th>
<th class="table-cyanish-header">&nbsp;</th> <!-- <th class="table-cyanish-header">&nbsp;</th>-->
</tr>
<tr>
<td colspan="5">
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newProjecthour">
nieuwe uren
</button>
</td>
</tr> </tr>
<!-- <tr>-->
<!-- <td colspan="5">-->
<!-- <button class="btn btn-primary btn-round btn-sm" data-bind="click:newProjecthour">-->
<!-- nieuwe uren-->
<!-- </button>-->
<!-- </td>-->
<!-- </tr>-->
</tfoot> </tfoot>
</table> </table>
</div> </div>
+21 -14
View File
@@ -4,23 +4,30 @@
<table class="table table-condensed"> <table class="table table-condensed">
<thead> <thead>
<tr> <tr>
<th>rol</th> <th>
<!-- ko foreach:roles --> pagina
<th> </th>
<span data-bind="text:rolename"></span> <th v-for="(role, roleIndex) in roles" align="center">
</th> <span>{{ role.rolename }}</span>
<!-- /ko --> </th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<td> <tr v-for="(page, pageIndex) in pages">
<span data-bind="text:pagename"></span> <td>
</td> <span v-bind:class="{'main-menu': page.typePage == 'MAIN', 'sub-page': page.typePage != 'MAIN'}" >
<!-- ko foreach:roles --> {{ page.pagename }}
<th> </span>
<span data-bind="text:rolename"></span> </td>
</th> <td v-for="(accessPage, roleIndex) in page.accessPages" align="center">
<!-- /ko --> <i v-if="accessPage.access"
v-on:click="toggleAccess(pageIndex, roleIndex)"
class="icon fa-check pointer"></i>
<i v-if="! accessPage.access"
v-on:click="toggleAccess(pageIndex, roleIndex)"
class="icon fa-square-o pointer"></i>
</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
+42 -6
View File
@@ -42,18 +42,52 @@
<img class="brand-img" src="css/images/logo_dbo.png" alt="..."> <img class="brand-img" src="css/images/logo_dbo.png" alt="...">
<h2 class="brand-text font-size-18">projectbeheer</h2> <h2 class="brand-text font-size-18">projectbeheer</h2>
</div> </div>
<div> <div data-bind="visible: !showPasswordRequest()">
<div>
<div class="form-group form-material floating" data-plugin="formMaterial">
<input type="text" class="form-control" name="gebruikersnaam"
data-bind="textInput:username" />
<label class="floating-label">gebruikersnaam</label>
</div>
<div class="form-group form-material floating" data-plugin="formMaterial">
<input type="password" class="form-control" name="password"
data-bind="textInput:password" />
<label class="floating-label">wachtwoord</label>
</div>
<button type="button"
class="btn btn-primary btn-block btn-lg mt-40"
data-bind="click:login">Log in</button>
</div>
<div>
<br />
<a href="#" data-bind="click:togglePasswordrequest">wachtwoord vergeten?</a>
</div>
</div>
<div data-bind="visible: showPasswordRequest()">
<p>
Vul hieronder uw emailadres en gebruikersnaam in, u krijgt dan een mail met een nieuw wachtwoord toegezonden!
</p>
<div class="form-group form-material floating" data-plugin="formMaterial"> <div class="form-group form-material floating" data-plugin="formMaterial">
<input type="text" class="form-control" name="email" <input type="text"
class="form-control"
name="gebruikersnaam"
data-bind="textInput:username" /> data-bind="textInput:username" />
<label class="floating-label">gebruikersnaam</label> <label class="floating-label">gebruikersnaam</label>
</div> </div>
<div class="form-group form-material floating" data-plugin="formMaterial"> <div class="form-group form-material floating" data-plugin="formMaterial">
<input type="password" class="form-control" name="password" <input type="text"
data-bind="textInput:password" /> class="form-control"
<label class="floating-label">wachtwoord</label> name="password"
data-bind="textInput:email" />
<label class="floating-label">emailadres</label>
</div>
<button type="button"
class="btn btn-primary btn-block btn-lg mt-40"
data-bind="click:requestPassword">vraag aan</button>
<div>
<br />
<a href="#" data-bind="click:togglePasswordrequest">terug naar inlog?</a>
</div> </div>
<button type="button" class="btn btn-primary btn-block btn-lg mt-40" data-bind="click:login">Log in</button>
</div> </div>
</div> </div>
</div> </div>
@@ -108,5 +142,7 @@
<script src="js/vendor/Knockout.min.js"></script> <script src="js/vendor/Knockout.min.js"></script>
<script src="js/lib/modules/login/loginModule.js"></script> <script src="js/lib/modules/login/loginModule.js"></script>
<script src="js/lib/modules/specials/tellmeModule.js"></script> <script src="js/lib/modules/specials/tellmeModule.js"></script>
<script src="js/lib/helpers.js"></script>
</body> </body>
</html> </html>
@@ -1,13 +1,13 @@
<div class="MONTHLYEMPLOYEEHOURS"> <div class="MONTHLYEMPLOYEEHOURS">
<div class="row"> <!-- <div class="row">-->
<div class="col-md-1"> <!-- <div class="col-md-1">-->
<label>jaar</label> <!-- <label>jaar</label>-->
</div> <!-- </div>-->
<div class="col-md-2"> <!-- <div class="col-md-2">-->
<input type="text" class="form-control" data-bind="textInput:selectedYear, event:{keyup:checkYear}" > <!-- <input type="text" class="form-control" data-bind="textInput:selectedYear, event:{keyup:checkYear}" >-->
<div class="invalid-feedback" data-bind="visible: ! validYear()">geen geldig jaar</div> <!-- <div class="invalid-feedback" data-bind="visible: ! validYear()">geen geldig jaar</div>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="nav-tabs-horizontal"> <div class="nav-tabs-horizontal">
+10 -2
View File
@@ -13,6 +13,14 @@
<script src="js/vendor/froala/js/froala_editor.min.js"></script> <script src="js/vendor/froala/js/froala_editor.min.js"></script>
<script src="js/vendor/froala/js/plugins/knockout-froala.js"></script> <script src="js/vendor/froala/js/plugins/knockout-froala.js"></script>
<?php if($_ENV['ENVIRONMENT'] == 'development'): ?>
<script src="js/vendor/vue.js"></script>
<?php else: ?>
<script src="js/vendor/vue.min.js"></script>
<?php endif; ?>
<script src="js/vendor/Chart.js"></script> <script src="js/vendor/Chart.js"></script>
<script src="js/vendor/lodash.js"></script> <script src="js/vendor/lodash.js"></script>
@@ -29,7 +37,8 @@
<script src="js/lib/modules/beheer/customersModule.js?version=<?= $this->version ?>"></script> <script src="js/lib/modules/beheer/customersModule.js?version=<?= $this->version ?>"></script>
<script src="js/lib/modules/beheer/externalsModule.js?version=<?= $this->version ?>"></script> <script src="js/lib/modules/beheer/externalsModule.js?version=<?= $this->version ?>"></script>
<script src="js/lib/modules/beheer/vatModule.js?version=<?= $this->version ?>"></script> <script src="js/lib/modules/beheer/vatModule.js?version=<?= $this->version ?>"></script>
<script src="js/lib/modules/beheer/authorisationModule.js?version=<?= $this->version ?>"></script> <script src="js/lib/dataservices/authorisationDataService.js"></script>
<script src="js/lib/modules/beheer/authorisationVue.js?version=<?= $this->version ?>"></script>
<script src="js/lib/modules/projects/offersModule.js?version=<?= $this->version ?>"></script> <script src="js/lib/modules/projects/offersModule.js?version=<?= $this->version ?>"></script>
<script src="js/lib/modules/projects/projectsModule.js?version=<?= $this->version ?>"></script> <script src="js/lib/modules/projects/projectsModule.js?version=<?= $this->version ?>"></script>
<script src="js/lib/modules/projects/employeehoursModule.js?version=<?= $this->version ?>"></script> <script src="js/lib/modules/projects/employeehoursModule.js?version=<?= $this->version ?>"></script>
@@ -68,7 +77,6 @@
<script src="js/lib/dataservices/invoiceDataService.js"></script> <script src="js/lib/dataservices/invoiceDataService.js"></script>
<script src="js/lib/dataservices/reservationsDataService.js"></script> <script src="js/lib/dataservices/reservationsDataService.js"></script>
<script src="js/lib/dataservices/employeeTargetDataService.js"></script> <script src="js/lib/dataservices/employeeTargetDataService.js"></script>
<script src="js/lib/dataservices/authorisationDataService.js"></script>
<script src="js/lib/services/chartService.js"></script> <script src="js/lib/services/chartService.js"></script>
+2 -1
View File
@@ -18,7 +18,8 @@
</a> </a>
<ul class="collapse list-unstyled" id="<?= $page->pageurl ?>"> <ul class="collapse list-unstyled" id="<?= $page->pageurl ?>">
<?php foreach ( $page->subpages as $subpage ): ?> <?php foreach ( $page->subpages as $subpage ): ?>
<li data-bind="click:setPage.bind($data, '<?= $subpage->pageurl ?>')"> <li data-bind="click:setPage.bind($data, '<?= $subpage->pageurl ?>'),
css:{'selected-page':<?= $subpage->pageurl ?>()}">
<a href="#"><?= $subpage->pagename ?></a> <a href="#"><?= $subpage->pagename ?></a>
</li> </li>
<?php endforeach; ?> <?php endforeach; ?>
@@ -40,7 +40,7 @@
<div><span>Lopend boekjaar</span></div> <div><span>Lopend boekjaar</span></div>
</th> </th>
<th class="rotate"> <th class="rotate">
<div><span>Volgend boekjaar</span></div> <div><span>Volgende boekjaren</span></div>
</th> </th>
</tr> </tr>
</thead> </thead>
+7
View File
@@ -65,3 +65,10 @@ body{
padding: 0px 3px; padding: 0px 3px;
} }
.form-control-xsm{
font-size:.9em;
padding:0 5px;
line-height: 1;
height:20px;
}
+16
View File
@@ -39,6 +39,12 @@
color: gold; color: gold;
} }
.selected-page, .selected-page:hover{
color:gold !important;
font-weight:bold;
font-size:1.1em;
}
/*********TABLES************/ /*********TABLES************/
.table-blueish-header { .table-blueish-header {
@@ -397,3 +403,13 @@ th.focus-green{
color:#fff !important; color:#fff !important;
} }
/***************AUTHORIDSATION ******************/
.main-menu{
font-size:1.2em;
font-weight:bold;
color:#222;
}
.sub-page{
margin-left:20px;
}
+3 -2
View File
@@ -266,6 +266,7 @@ top: -2px;
color: #fff; color: #fff;
font-size: 14px; font-size: 14px;
margin-top: 5px; margin-top: 5px;
margin-right:10px; margin-right:10px
} }
@@ -13,6 +13,10 @@ dbo.authorisationDataService = {
.done( function ( data ) { .done( function ( data ) {
callback( data ); callback( data );
} ); } );
},
toggleAuhorisation: function ( submitDATA ) {
$.post( 'index.php/beheer/AuthorisationController/toggleAuhorisation', submitDATA );
} }
+3
View File
@@ -11,6 +11,7 @@ $( function () {
projects : ko.observableArray( [] ), projects : ko.observableArray( [] ),
customers : ko.observableArray( [] ), customers : ko.observableArray( [] ),
users : ko.observableArray( [] ), users : ko.observableArray( [] ),
offername : ko.observable(),
startdate : ko.observable(), startdate : ko.observable(),
acceptance_chance: ko.observable(), acceptance_chance: ko.observable(),
accepteddate : ko.observable(), accepteddate : ko.observable(),
@@ -54,6 +55,7 @@ $( function () {
var submitDATA = { var submitDATA = {
id : vm.id, id : vm.id,
offername : vm.offername(),
customer_id : vm.customer_id(), customer_id : vm.customer_id(),
offerleader_id : vm.offerleader_id(), offerleader_id : vm.offerleader_id(),
offernumber : vm.offernumber(), offernumber : vm.offernumber(),
@@ -131,6 +133,7 @@ $( function () {
vm.project_id( offer.project_id || null ); vm.project_id( offer.project_id || null );
vm.customer_id( offer.customer_id || null ); vm.customer_id( offer.customer_id || null );
} }
vm.offername(offer.offername || '');
vm.offerleader_id( offer.offerleader_id || null ); vm.offerleader_id( offer.offerleader_id || null );
vm.offernumber( offer.offernumber || null ); vm.offernumber( offer.offernumber || null );
vm.startdate( offer.startdate || null ); vm.startdate( offer.startdate || null );
@@ -9,6 +9,7 @@ dbo.authorisationInit = function () {
if ( dbo.authorisationModel !== undefined ) { if ( dbo.authorisationModel !== undefined ) {
dbo.authorisationModel.refreshPageAuthorisations();
} else { } else {
dbo.authorisationModel = { dbo.authorisationModel = {
@@ -22,10 +23,53 @@ dbo.authorisationInit = function () {
}, },
refreshPageAuthorisations: function () { refreshPageAuthorisations: function () {
var vm = dbo.authorisationModel;
vm.initPages = true;
vm.roles.removeAll();
dbo.authorisationDataService.getRoleAuthorisations( function ( data ) { dbo.authorisationDataService.getRoleAuthorisations( function ( data ) {
console.log( data ); _.each( data, function ( p ) {
vm.roles.push( new vm.Role( p ) );
} )
} );
},
Role: function ( data ) {
var vm = dbo.authorisationModel;
var self = this;
self.roleID = data.id;
self.rolename = data.rolename;
self.pages = ko.observableArray( [] );
_.each( data.pagesAccess, function ( p ) {
self.pages.push( new vm.Page( p, self.pages() ) );
} ); } );
vm.initPages = false;
},
Page: function ( data, pages ) {
var vm = dbo.authorisationModel;
var self = this;
if ( vm.initPages ) {
self.pageID = data.id;
self.pagename = data.pagename;
self.typePage = data.typepage;
self.pageAccess = ko.observableArray( [] );
self.pageAccess.push( {access: ko.observable( data.pageaccess == 'T' ? true : false )} );
}else{
_.each(pages, function(p){
console.log( pages );
console.log( data.id, '- -', p.pageID );
if( data.id == p.pageID) {
p.pageAccess.push( {access: ko.observable( data.pageaccess == 'T' ? true : false )} );
}
})
}
} }
}; };
@@ -0,0 +1,105 @@
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 15/07/2018
* Time: 10:50
*/
dbo.authorisationInit = function() {
new Vue( {
el : "#AUTHORISATION",
data : {
roles: [],
pages: []
},
created: function () {
var self = this;
var srv = dbo.autorisationService;
srv.createRoles( function ( data ) {
console.log( data.pages );
self.roles = data.roles;
self.pages = data.pages;
} );
},
methods: {
toggleAccess: function ( pageIndex, roleIndex ) {
var page = this.pages[pageIndex];
var access = page.accessPages[roleIndex];
page.accessPages[roleIndex].access = !page.accessPages[roleIndex].access;
var submitDATA = {
pageID : page.pageID,
roleLevel: access.roleLevel,
access : page.accessPages[roleIndex].access ? 'T' : 'F'
}
dbo.authorisationDataService.toggleAuhorisation( submitDATA );
}
}
} );
};
dbo.autorisationService = {
roles : [],
pages : [],
initPages: true,
createRoles: function ( callback ) {
var srv = dbo.autorisationService;
dbo.authorisationDataService.getRoleAuthorisations( function ( data ) {
_.each( data, function ( p ) {
srv.roles.push( new srv.Role( p ) );
} );
_.each( data, function ( p ) {
_.each( p.pagesAccess, function ( q ) {
if ( srv.initPages ) {
srv.pages.push( new srv.Page( q ) );
} else {
_.each( srv.pages, function ( s ) {
if ( s.pageID == q.id ) {
s.accessPages.push( new srv.Access( q ) )
}
} );
}
} );
srv.initPages = false;
} );
} );
callback( srv );
},
Role: function ( data ) {
this.roleID = data.id;
this.rolename = data.rolename;
},
Page: function ( data ) {
var srv = dbo.autorisationService;
if ( srv.initPages ) {
this.pageID = data.id;
this.pagename = data.pagename;
this.typePage = data.typepage;
this.accessPages = [];
this.accessPages.push( new srv.Access( data ) );
}
},
Access: function ( data ) {
this.access = data.pageaccess == 'T' ? true : false;
this.roleLevel = data.rolelevel;
}
}
+81 -3
View File
@@ -10,11 +10,22 @@ $( function () {
dbo.loginModel = { dbo.loginModel = {
username: ko.observable( '' ), username : ko.observable( '' ),
password: ko.observable( '' ), password : ko.observable( '' ),
email : ko.observable(),
showPasswordRequest: ko.observable( false ),
login: function () { login: function () {
dbo.loginService.login(); dbo.loginService.login();
},
requestPassword: function () {
dbo.loginService.requestPassword();
},
togglePasswordrequest: function () {
var vm = dbo.loginModel
vm.showPasswordRequest( !vm.showPasswordRequest() );
} }
} }
@@ -37,7 +48,22 @@ dbo.loginService = {
self.notifyWrongPassword(); self.notifyWrongPassword();
} ); } );
} ); } );
},
requestPassword: function () {
var ds = dbo.loginDataservice;
var self = dbo.loginService;
var vm = dbo.loginModel;
self.validateRequestInput( function ( submitDATA ) {
if ( !submitDATA ) return self.notifyWrongRequest();
ds.requestPassword( submitDATA, function ( data ) {
return self.notifyWrongRequest( data.result );
if ( data.result == 'SEND-SUCCESS' ) vm.showPasswordRequest( false );
} );
} );
}, },
validateInput: function ( callback ) { validateInput: function ( callback ) {
@@ -48,7 +74,21 @@ dbo.loginService = {
var submitDATA = { var submitDATA = {
username: vm.username(), username: vm.username(),
password: vm.password password: vm.password()
}
return callback( submitDATA );
},
validateRequestInput: function ( callback ) {
var vm = dbo.loginModel;
if ( vm.username().length < 2 ) return callback( false );
if ( !dbo.helpers.validateEmail( vm.email() ) ) return callback( false );
var submitDATA = {
username: vm.username(),
email : vm.email()
} }
return callback( submitDATA ); return callback( submitDATA );
@@ -59,6 +99,38 @@ dbo.loginService = {
title : 'Login fout', title : 'Login fout',
message: 'Gebruikersnaam / wachtwoord komen niet overeen' message: 'Gebruikersnaam / wachtwoord komen niet overeen'
} ); } );
},
notifyWrongRequest: function ( type = false ) {
var message = '';
var title = '';
var modalClass = '';
console.log( type );
if ( !type || type == 'WRONG-CREDENTIAL' ) {
title = 'credentials fout';
message = 'Fout bij gebruikersnaam / emailadres invoer';
modalClass = 'modal-danger';
}
else if ( type == 'SEND-FAILLURE' ) {
title = 'Fout bij verzneden email';
message = 'email kon niet verzonden worden neem contact op met de helpdesk';
modalClass = 'modal-danger';
}
else if ( type == 'SEND-SUCCESS' ) {
title = 'mail succesvol verzonden';
message = ' er is een email verzonden, kijk in uw postvak, mocht u de mail daar niet aantreffen kijk dan in uw spanfolder';
modalClass = 'modal-succes';
}else{
title = 'Fout bij verzneden email';
message = ' er is een onbekende fout opgetreden neem contact op met de helpdesk';
modalClass = 'modal-danger';
}
tellMe( {
title : title,
message : message,
modalClass: modalClass
} );
} }
}; };
@@ -69,6 +141,12 @@ dbo.loginDataservice = {
$.post( 'index.php/login/', submitDATA, function ( data ) { $.post( 'index.php/login/', submitDATA, function ( data ) {
callback( data ); callback( data );
} ); } );
},
requestPassword: function ( submitDATA, callback ) {
$.post( 'index.php/login/requestPassword', submitDATA, function ( data ) {
callback( data );
} );
} }
}; };
+1
View File
@@ -48,6 +48,7 @@ $( function () {
vm[page]( true ); vm[page]( true );
var func = page.toLowerCase() + 'Init'; var func = page.toLowerCase() + 'Init';
window.dbo[func](); window.dbo[func]();
}, },
@@ -126,7 +126,9 @@ dbo.employeehoursreportInit = function () {
vm.occupancyRateTotalTotaal( Math.round( (vm.totalhoursTotaal() / vm.targetTotaal()) * 1000 ) / 10 ); vm.occupancyRateTotalTotaal( Math.round( (vm.totalhoursTotaal() / vm.targetTotaal()) * 1000 ) / 10 );
vm.occupancyRateHoursTotaal( Math.round( (vm.profitablehoursTotaal() / vm.totalhoursTotaal()) * 1000 ) / 10 ); vm.occupancyRateHoursTotaal( Math.round( (vm.profitablehoursTotaal() / vm.totalhoursTotaal()) * 1000 ) / 10 );
vm.occupancyRateInvoiceTotaal( Math.round( (vm.profitablehoursTotaal() / vm.targetTotaal()) * 1000 ) / 10 ); vm.occupancyRateInvoiceTotaal( Math.round( (vm.profitablehoursTotaal() / vm.targetTotaal()) * 1000 ) / 10 );
vm.averageDayRateTotaal( Math.round( Number( vm.revenuesTotaal() ) / Number( vm.profitablehoursTotaal() ) ) * 8 ); console.log( Number( vm.revenuesTotaal() ) );
console.log( Number( vm.profitablehoursTotaal() ) );
vm.averageDayRateTotaal( Math.round( (Number( vm.revenuesTotaal() ) / Number( vm.profitablehoursTotaal()) * 8 ) ) );
vm.revenuesTotaal( dbo.helpers.thousandSeparator( vm.revenuesTotaal() ) ); vm.revenuesTotaal( dbo.helpers.thousandSeparator( vm.revenuesTotaal() ) );
// dbo.charts.drawPie( 'revenues-per-month', chartData.revenues, chartData.labels, 'omzet per medewerker' ); // dbo.charts.drawPie( 'revenues-per-month', chartData.revenues, chartData.labels, 'omzet per medewerker' );
@@ -64,8 +64,6 @@ dbo.monthlyemployeehoursInit = function () {
vm.totalEmployeeHours( 0 ); vm.totalEmployeeHours( 0 );
vm.totalEmployeeAvailableHours( 0 ); vm.totalEmployeeAvailableHours( 0 );
vm.totalOwp( 0 ); vm.totalOwp( 0 );
vm.totalCurrentFinancialYear( 0 );
vm.totalNextFinancialYear( 0 );
vm.totalPerEmployee.removeAll(); vm.totalPerEmployee.removeAll();
vm.totalInvoicedYear.removeAll(); vm.totalInvoicedYear.removeAll();
dbo.userDataService.getUniqueProjectEmployees( function ( data ) { dbo.userDataService.getUniqueProjectEmployees( function ( data ) {
@@ -9,6 +9,8 @@ dbo.reservationsInit = function () {
if ( dbo.reservationsModel !== undefined ) { if ( dbo.reservationsModel !== undefined ) {
dbo.reservationsModel.refreshReservations();
} else { } else {
dbo.reservationsModel = { dbo.reservationsModel = {
+1
View File
@@ -93,6 +93,7 @@ dbo.offersService = {
Offer: function ( data ) { Offer: function ( data ) {
this.id = data.id; this.id = data.id;
this.offernumber = data.offernumber; this.offernumber = data.offernumber;
this.offername = data.offername;
this.offerleader_id = data.offerleader_id; this.offerleader_id = data.offerleader_id;
this.project_id = data.project_id; this.project_id = data.project_id;
this.acceptance_chance = data.acceptance_chance; this.acceptance_chance = data.acceptance_chance;
+10947
View File
File diff suppressed because it is too large Load Diff
+6
View File
File diff suppressed because one or more lines are too long