projecten
This commit is contained in:
@@ -29,7 +29,7 @@ class ProjectsController extends MY_Controller {
|
||||
|
||||
public function getAllProjects( $archive = 'F' )
|
||||
{
|
||||
$projects = Project::getAllProjects( FALSE, $archive );
|
||||
$projects = Project::getAllProjects( $archive );
|
||||
|
||||
$this->json( $projects );
|
||||
}
|
||||
@@ -66,11 +66,74 @@ class ProjectsController extends MY_Controller {
|
||||
$projectID = $project['id'];
|
||||
unset( $project['id'] );
|
||||
|
||||
$project['startdate'] = date2mysql( $project['startdate'] );
|
||||
$project['enddate'] = date2mysql( $project['enddate'] );
|
||||
|
||||
$projectID = Project::saveProject( $projectID, $project );
|
||||
|
||||
$this->json( ['success' => TRUE, 'projectID' => $projectID] );
|
||||
}
|
||||
|
||||
public function saveProjectemployee()
|
||||
{
|
||||
$projectemployeeValidation = new ProjectemployeeValidation();
|
||||
|
||||
if ( ! $projectemployeeValidation->getValidationResult() )
|
||||
return $this->json( [
|
||||
'success' => FALSE, 'messages' => $projectemployeeValidation->getErrorMessages()] );
|
||||
|
||||
$projectemployee = $this->input->post();
|
||||
|
||||
$projectemployeeID = $projectemployee['id'];
|
||||
unset( $projectemployee['id'] );
|
||||
|
||||
$projectemployee['startdate'] = date2mysql( $projectemployee['startdate'] );
|
||||
|
||||
Projectemployee::saveProjectemployee( $projectemployeeID, $projectemployee );
|
||||
|
||||
$this->json( ['success' => TRUE] );
|
||||
}
|
||||
|
||||
public function savePayment()
|
||||
{
|
||||
$paymentValidation = new PaymentValidation();
|
||||
|
||||
if ( ! $paymentValidation->getValidationResult() )
|
||||
return $this->json( [
|
||||
'success' => FALSE, 'messages' => $paymentValidation->getErrorMessages()] );
|
||||
|
||||
$payment = $this->input->post();
|
||||
|
||||
$paymentID = $payment['id'];
|
||||
unset( $payment['id'] );
|
||||
|
||||
$payment['paymentdate'] = date2mysql( $payment['paymentdate'] );
|
||||
|
||||
$paymentID = Payment::savePayment( $paymentID, $payment );
|
||||
|
||||
$this->json( ['success' => TRUE, 'paymentID'=> $paymentID ] );
|
||||
}
|
||||
|
||||
public function saveProjecthour()
|
||||
{
|
||||
$projecthourValidation = new ProjecthourValidation();
|
||||
|
||||
if ( ! $projecthourValidation->getValidationResult() )
|
||||
return $this->json( [
|
||||
'success' => FALSE, 'messages' => $projecthourValidation->getErrorMessages()] );
|
||||
|
||||
$projecthour = $this->input->post();
|
||||
|
||||
$projecthourID = $projecthour['id'];
|
||||
unset( $projecthour['id'] );
|
||||
|
||||
$projecthour['hourdate'] = date2mysql( $projecthour['hourdate'] );
|
||||
|
||||
$paymentID = Projecthour::saveProjecthour( $projecthourID, $projecthour );
|
||||
|
||||
$this->json( ['success' => TRUE, 'projecthourID'=> $paymentID ] );
|
||||
}
|
||||
|
||||
public function archiveProject( $projectID, $status )
|
||||
{
|
||||
Project::whereId( $projectID )->update( ['archive' => $status] );
|
||||
@@ -87,4 +150,37 @@ class ProjectsController extends MY_Controller {
|
||||
$this->json( ['result' => TRUE] );
|
||||
}
|
||||
|
||||
public function removeProjectemployee( $projectemployeeID )
|
||||
{
|
||||
$removeProjectemployee = new RemoveProjectemployee( $projectemployeeID );
|
||||
|
||||
if ( $removeProjectemployee->getAllowDelete() === FALSE ) return $this->json( ['result' => FALSE] );
|
||||
|
||||
Projectemployee::removeProjectemployee( $projectemployeeID );
|
||||
|
||||
$this->json( ['result' => TRUE] );
|
||||
}
|
||||
|
||||
public function removePayment( $paymentID )
|
||||
{
|
||||
$removePayment = new RemovePayment( $paymentID );
|
||||
|
||||
if ( $removePayment->getAllowDelete() === FALSE ) return $this->json( ['result' => FALSE] );
|
||||
|
||||
Payment::removePayment( $paymentID );
|
||||
|
||||
$this->json( ['result' => TRUE] );
|
||||
}
|
||||
|
||||
public function removeProjecthour( $projecthourID )
|
||||
{
|
||||
$removeProjecthour = new RemoveProjecthour( $projecthourID );
|
||||
|
||||
if ( $removeProjecthour->getAllowDelete() === FALSE ) return $this->json( ['result' => FALSE] );
|
||||
|
||||
Projecthour::removeProjecthour( $projecthourID );
|
||||
|
||||
$this->json( ['result' => TRUE] );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 27/12/2017
|
||||
* Time: 17:45
|
||||
*/
|
||||
|
||||
class RemovePayment {
|
||||
|
||||
private $paymentID;
|
||||
private $allowDelete = TRUE;
|
||||
|
||||
public function __construct( $paymentID )
|
||||
{
|
||||
$this->setPaymentID( $paymentID );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getAllowDelete()
|
||||
{
|
||||
return $this->allowDelete;
|
||||
}
|
||||
|
||||
private function setPaymentID( $paymentID )
|
||||
{
|
||||
$this->paymentID = $paymentID;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 27/12/2017
|
||||
* Time: 17:45
|
||||
*/
|
||||
|
||||
class RemoveProjectemployee {
|
||||
|
||||
private $projectemployeeID;
|
||||
private $allowDelete = TRUE;
|
||||
|
||||
public function __construct( $projectemployeeID )
|
||||
{
|
||||
$this->setProjectemployeeID( $projectemployeeID );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getAllowDelete()
|
||||
{
|
||||
return $this->allowDelete;
|
||||
}
|
||||
|
||||
private function setProjectemployeeID( $projectemployeeID )
|
||||
{
|
||||
$this->projectemployeeID = $projectemployeeID;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 27/12/2017
|
||||
* Time: 17:45
|
||||
*/
|
||||
|
||||
class RemoveProjecthour {
|
||||
|
||||
private $projecthourID;
|
||||
private $allowDelete = TRUE;
|
||||
|
||||
public function __construct( $projecthourID )
|
||||
{
|
||||
$this->setProjecthourID( $projecthourID );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getAllowDelete()
|
||||
{
|
||||
return $this->allowDelete;
|
||||
}
|
||||
|
||||
private function setProjecthourID( $projecthourID )
|
||||
{
|
||||
$this->projecthourID = $projecthourID;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
|
||||
|
||||
class PaymentValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'offer_id' => [
|
||||
'validations' => 'required|integer',
|
||||
'fieldname' => 'offerte'
|
||||
],
|
||||
'paymentdate' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'betaaldatum'
|
||||
],
|
||||
'paymentamount' => [
|
||||
'validations' => 'number',
|
||||
'fieldname' => 'bedrag'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->ci =& get_instance();
|
||||
}
|
||||
}
|
||||
@@ -13,9 +13,17 @@ class ProjectValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'name' => [
|
||||
'validations' => 'required|alphaNumericSpaces',
|
||||
'fieldname' => 'projectnaam'
|
||||
'customer_id' => [
|
||||
'validations' => 'required|integer',
|
||||
'fieldname' => 'klant'
|
||||
],
|
||||
'startdate' => [
|
||||
'validations' => 'required|date',
|
||||
'fieldname' => 'start project'
|
||||
],
|
||||
'enddate' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'eind project'
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
|
||||
|
||||
class ProjectemployeeValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'user_id' => [
|
||||
'validations' => 'integer',
|
||||
'fieldname' => 'klant'
|
||||
],
|
||||
'startdate' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'start project'
|
||||
],
|
||||
'enddate' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'eind project'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->ci =& get_instance();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
|
||||
|
||||
class ProjecthourValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'projectemployee_id' => [
|
||||
'validations' => 'required|integer',
|
||||
'fieldname' => 'projectmedewerker'
|
||||
],
|
||||
'hourdate' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'datum'
|
||||
],
|
||||
'hours' => [
|
||||
'validations' => 'number',
|
||||
'fieldname' => 'uren'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->ci =& get_instance();
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,8 @@ class BaseModel extends Eloquent {
|
||||
parent::boot();
|
||||
|
||||
static::creating( function ( $model ) {
|
||||
static::$oldValue = '';
|
||||
|
||||
if ( AUTHENTICATED )
|
||||
{
|
||||
$user = User::find(USERID);
|
||||
@@ -44,6 +46,8 @@ class BaseModel extends Eloquent {
|
||||
}
|
||||
} );
|
||||
static::updating( function ( $model ) {
|
||||
static::$oldValue = json_encode($model->original);
|
||||
|
||||
if ( AUTHENTICATED )
|
||||
{
|
||||
$user = User::find(USERID);
|
||||
|
||||
@@ -29,13 +29,14 @@ class Customer extends BaseModel {
|
||||
if( $customerID == 0)
|
||||
{
|
||||
$customer = Customer::create($customer);
|
||||
$customerID = $customer['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$customer = Customer::whereId($customerID)->update($customer);
|
||||
Customer::whereId($customerID)->update($customer);
|
||||
}
|
||||
|
||||
return $customer['id'];
|
||||
return $customerID;
|
||||
}
|
||||
|
||||
public static function removeCustomer($customerID)
|
||||
|
||||
@@ -29,13 +29,14 @@ class External extends BaseModel {
|
||||
if( $externalID == 0)
|
||||
{
|
||||
$external = External::create($external);
|
||||
$externalID = $external['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$external = External::whereId($externalID)->update($external);
|
||||
External::whereId($externalID)->update($external);
|
||||
}
|
||||
|
||||
return $external['id'];
|
||||
return $externalID;
|
||||
}
|
||||
|
||||
public static function removeExternal($externalID)
|
||||
|
||||
@@ -8,11 +8,33 @@
|
||||
|
||||
class Payment extends BaseModel {
|
||||
|
||||
protected $table = "projects";
|
||||
protected $table = "payments";
|
||||
|
||||
public function offer()
|
||||
{
|
||||
return $this->belongsTo( 'Offer' );
|
||||
}
|
||||
|
||||
public static function savePayment( $paymentID, $payment )
|
||||
{
|
||||
$payment = (array) $payment;
|
||||
|
||||
if ( $paymentID == 0 )
|
||||
{
|
||||
$payment = Payment::create( $payment );
|
||||
$paymentID = $payment['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
Payment::whereId( $paymentID )->update( $payment );
|
||||
}
|
||||
|
||||
return $paymentID;
|
||||
}
|
||||
|
||||
public static function removePayment( $paymentID )
|
||||
{
|
||||
Payment::whereId( $paymentID )->delete();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -68,7 +68,7 @@ class Project extends BaseModel {
|
||||
'offers' => function ( $q ) {
|
||||
$q->whereArchive( 'F' )
|
||||
->with( [
|
||||
'payment' => function ( $q ) {
|
||||
'payments' => function ( $q ) {
|
||||
$q->selectRaw( '*' );
|
||||
}] );
|
||||
}] )
|
||||
@@ -76,6 +76,7 @@ class Project extends BaseModel {
|
||||
'projectemployees.user' => function ( $q ) {
|
||||
$q->selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" );
|
||||
}] )
|
||||
->with( 'projectemployees.projecthours' )
|
||||
->with( 'customer' );
|
||||
|
||||
return $project;
|
||||
@@ -83,10 +84,28 @@ class Project extends BaseModel {
|
||||
|
||||
public static function createProject()
|
||||
{
|
||||
$data = ['startdate'=> date('Y-m-d')];
|
||||
$data = ['startdate' => date( 'Y-m-d' )];
|
||||
|
||||
$project = Project::create($data);
|
||||
$project = Project::create( $data );
|
||||
|
||||
return $project->id;
|
||||
}
|
||||
|
||||
public static function saveProject( $projectID, $project )
|
||||
{
|
||||
$project = (array) $project;
|
||||
|
||||
if ( $projectID == 0 )
|
||||
{
|
||||
$project = Project::create( $project );
|
||||
$projectID = $project['id'];;
|
||||
}
|
||||
else
|
||||
{
|
||||
Project::whereId( $projectID )->update( $project );
|
||||
}
|
||||
|
||||
return $projectID;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,11 @@ class Projectemployee extends BaseModel {
|
||||
return $this->belongsTo( 'User' );
|
||||
}
|
||||
|
||||
public function projecthours()
|
||||
{
|
||||
return $this->hasMany( 'Projecthour' );
|
||||
}
|
||||
|
||||
public static function createProjectEmployee( $projectID )
|
||||
{
|
||||
$projectemployee = Projectemployee::create( [
|
||||
@@ -27,4 +32,15 @@ class Projectemployee extends BaseModel {
|
||||
return $projectemployee->id;
|
||||
}
|
||||
|
||||
public static function saveProjectemployee( $projectemployeeID, $projectemployee )
|
||||
{
|
||||
Projectemployee::whereId( $projectemployeeID )
|
||||
->update( $projectemployee );
|
||||
}
|
||||
|
||||
public static function removeProjectemployee( $projectemployeeID )
|
||||
{
|
||||
Projectemployee::whereId( $projectemployeeID )->delete();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 19/01/2018
|
||||
* Time: 15:51
|
||||
*/
|
||||
|
||||
class Projecthour extends BaseModel {
|
||||
|
||||
protected $table = "projecthours";
|
||||
|
||||
public function projectemployee()
|
||||
{
|
||||
$this->belongsTo( 'Projectemployee' );
|
||||
}
|
||||
|
||||
public static function saveProjecthour( $projecthourID, $projecthour )
|
||||
{
|
||||
$projecthour = (array) $projecthour;
|
||||
|
||||
if ( $projecthourID == 0 )
|
||||
{
|
||||
$projecthour = Projecthour::create( $projecthour );
|
||||
$projecthourID = $projecthour['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
Projecthour::whereId( $projecthourID )->update( $projecthour );
|
||||
}
|
||||
|
||||
return $projecthourID;
|
||||
}
|
||||
|
||||
public static function removeProjecthour( $projecthourID )
|
||||
{
|
||||
Projecthour::whereId( $projecthourID )->delete();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -53,13 +53,14 @@ class User extends BaseModel {
|
||||
if ( $userID == 0 )
|
||||
{
|
||||
$user = User::create( $user );
|
||||
$userID = $user['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$user = User::whereId( $userID )->update( $user );
|
||||
User::whereId( $userID )->update( $user );
|
||||
}
|
||||
|
||||
return $user['id'];
|
||||
return $userID;
|
||||
}
|
||||
|
||||
public static function removeUser( $userID )
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
<i class="icon fa-plus-square greenish pointer" data-bind="click:addUser"></i>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ko if : ! hasProject() -->
|
||||
<div class="form-group row">
|
||||
<label class="col-xl-3 form-control-label">
|
||||
klant
|
||||
@@ -66,6 +67,7 @@
|
||||
optionsText:'name',
|
||||
value:customer_id,
|
||||
optionsCaption:'selecteer klant',
|
||||
disable:hasProject,
|
||||
event:{change:getCustomerProjects}"></select>
|
||||
</div>
|
||||
<small class="invalid-feedback"
|
||||
@@ -90,6 +92,7 @@
|
||||
value:project_id"></select>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /ko -->
|
||||
<div class="form-group row">
|
||||
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
<div class="panel panel-bordered panel-primary panel-line">
|
||||
<div class="panel-heading panel-heading-project">
|
||||
<h3 class="">
|
||||
projecturen
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body panel-body-project">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<th class="table-cyanish-header">
|
||||
medewerker
|
||||
</th>
|
||||
<th class="table-cyanish-header">
|
||||
datum
|
||||
</th>
|
||||
<th class="table-cyanish-header">
|
||||
uren
|
||||
</th>
|
||||
<th class="table-cyanish-header" width="40px">
|
||||
|
||||
</th>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:projecthours">
|
||||
<tr>
|
||||
<td>
|
||||
<span data-bind="text:fullname, visible:! inEdit()"></span>
|
||||
<select class="form-control form-control-sm"
|
||||
data-bind="options:$root.projectEmployees,
|
||||
optionsText:'fullname',
|
||||
optionsValue:'id',
|
||||
value:projectemployee_id,
|
||||
optionsCaption:'medewerker',
|
||||
visible: inEdit(),
|
||||
event:{change:$root.saveProjecthour}">
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="text:hourdate, visible:! inEdit()"></span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm"
|
||||
placeholder="start"
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
||||
value:hourdate, visible:inEdit,
|
||||
event:{change:$root.saveProjecthour}"/>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind=" visible: ! inEdit()">
|
||||
<span data-bind="text:hours"></span>
|
||||
uur
|
||||
</span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm align-right"
|
||||
paceholder="uren"
|
||||
data-bind="textInput:hours, visible:inEdit,
|
||||
event:{change:$root.saveProjecthour,keyup:$root.validateNumber.bind($data, 'hours')}"/>
|
||||
</td>
|
||||
<td>
|
||||
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editProjecthour"></i>
|
||||
<i class="icon fa-trash redish pointer" title="verwijder"
|
||||
data-bind="click:$root.removeProjecthour"></i>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newProjecthour">
|
||||
nieuwe projecturen
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,75 @@
|
||||
<div class="panel panel-bordered panel-primary panel-line">
|
||||
<div class="panel-heading panel-heading-project">
|
||||
<h3 class="">
|
||||
betalingen
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body panel-body-project">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<th class="table-cyanish-header">
|
||||
offertenummer
|
||||
</th>
|
||||
<th class="table-cyanish-header">
|
||||
datum
|
||||
</th>
|
||||
<th class="table-cyanish-header">
|
||||
bedrag
|
||||
</th>
|
||||
<th class="table-cyanish-header" width="40px">
|
||||
|
||||
</th>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:payments">
|
||||
<tr>
|
||||
<td>
|
||||
<span data-bind="text:offernumber, visible:! inEdit()"></span>
|
||||
<select class="form-control form-control-sm"
|
||||
data-bind="options:$root.offers,
|
||||
optionsText:'offernumber',
|
||||
optionsValue:'id',
|
||||
value:offer_id,
|
||||
optionsCaption:'offerte',
|
||||
visible: inEdit(),
|
||||
event:{change:$root.savePayment}">
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="text:paymentdate, visible:! inEdit()"></span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm"
|
||||
placeholder="start"
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
||||
value:paymentdate, visible:inEdit,
|
||||
event:{change:$root.savePayment}"/>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind=" visible: ! inEdit()">
|
||||
<i class="icon fa-euro"></i>
|
||||
<span data-bind="text:paymentamount"></span>
|
||||
</span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm align-right"
|
||||
paceholder="bedrag"
|
||||
data-bind="textInput:paymentamount, visible:inEdit,
|
||||
event:{change:$root.savePayment,keyup:$root.validateNumber.bind($data, 'paymentamount')}"/>
|
||||
</td>
|
||||
<td>
|
||||
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editPayment"></i>
|
||||
<i class="icon fa-trash redish pointer" title="verwijder"
|
||||
data-bind="click:$root.removePayment"></i>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newPayment">
|
||||
nieuwe betaling
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,43 @@
|
||||
<div class="panel panel-bordered panel-primary panel-line">
|
||||
<div class="panel-heading panel-heading-project">
|
||||
<h3 class="">
|
||||
opmerkingen
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body panel-body-project">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="2" class="table-cyanish-header">
|
||||
offerte opmerkingen
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:projectFiles">
|
||||
<td>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editPayment"></i>
|
||||
<i class="icon fa-trash redish pointer" title="verwijder"
|
||||
data-bind="click:$root.removePayment"></i>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2" class="table-cyanish-header">
|
||||
project opmerkingen
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,89 @@
|
||||
<div class="panel panel-bordered panel-primary panel-line">
|
||||
<div class="panel-heading panel-heading-project">
|
||||
<h3 class="">
|
||||
kosten
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body panel-body-project">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<th class="table-cyanish-header">
|
||||
externe
|
||||
</th>
|
||||
<th class="table-cyanish-header">
|
||||
omschrijving
|
||||
</th>
|
||||
<th class="table-cyanish-header">
|
||||
datum
|
||||
</th>
|
||||
<th class="table-cyanish-header">
|
||||
bedrag
|
||||
</th>
|
||||
<th class="table-cyanish-header" width="40px">
|
||||
|
||||
</th>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:projecthours">
|
||||
<tr>
|
||||
<td>
|
||||
<span data-bind="text:fullname, visible:! inEdit()"></span>
|
||||
<select class="form-control form-control-sm"
|
||||
data-bind="options:$root.projectEmployees,
|
||||
optionsText:'fullname',
|
||||
optionsValue:'id',
|
||||
value:projectemployee_id,
|
||||
optionsCaption:'medewerker',
|
||||
visible: inEdit(),
|
||||
event:{change:$root.saveProjecthour}">
|
||||
</select>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind=" visible: ! inEdit()">
|
||||
<span data-bind="text:hours"></span>
|
||||
uur
|
||||
</span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm align-right"
|
||||
paceholder="uren"
|
||||
data-bind="textInput:hours, visible:inEdit,
|
||||
event:{change:$root.saveProjecthour,keyup:$root.validateNumber.bind($data, 'hours')}"/>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="text:hourdate, visible:! inEdit()"></span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm"
|
||||
placeholder="start"
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
||||
value:hourdate, visible:inEdit,
|
||||
event:{change:$root.saveProjecthour}"/>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind=" visible: ! inEdit()">
|
||||
<i class="icon fa-euro"></i>
|
||||
<span data-bind="text:paymentamount"></span>
|
||||
</span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm align-right"
|
||||
paceholder="bedrag"
|
||||
data-bind="textInput:paymentamount, visible:inEdit,
|
||||
event:{change:$root.savePayment,keyup:$root.validateNumber.bind($data, 'paymentamount')}"/>
|
||||
</td>
|
||||
<td>
|
||||
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editProjecthour"></i>
|
||||
<i class="icon fa-trash redish pointer" title="verwijder"
|
||||
data-bind="click:$root.removeProjecthour"></i>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newProjecthour">
|
||||
nieuwe projecturen
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
<div class="panel panel-bordered panel-primary panel-line panel-project">
|
||||
<div class="panel panel-bordered panel-primary panel-line">
|
||||
<div class="panel-heading panel-heading-project">
|
||||
<h3 class="">
|
||||
project medewerkers
|
||||
@@ -23,36 +22,71 @@
|
||||
<th class="table-cyanish-header">
|
||||
eind
|
||||
</th>
|
||||
<th class="table-cyanish-header">
|
||||
|
||||
<th class="table-cyanish-header" width="40px">
|
||||
|
||||
</th>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:projectEmployees">
|
||||
<td>
|
||||
<span data-bind="text:fullname"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="text:tarif"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="text:budget"></span> uur
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="text:startdate"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="text:enddate"></span>
|
||||
</td>
|
||||
<td>
|
||||
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editOffer"></i>
|
||||
<i class="icon fa-trash redish pointer" title="verwijder"
|
||||
data-bind="click:$root.removeProject, css:{'whiteish':$root.selectedRowID() == id}"></i>
|
||||
</td>
|
||||
<tr>
|
||||
<td>
|
||||
<span data-bind="text:fullname, visible: ! inEdit()"></span>
|
||||
<select class="form-control form-control-sm"
|
||||
data-bind="
|
||||
options:$root.users,
|
||||
optionsText:'fullname',
|
||||
optionsValue:'id',
|
||||
value:employeeID,
|
||||
optionsCaption:'naam',
|
||||
event:{change:$root.saveProjectemployee},
|
||||
visible:inEdit"></select>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind=" visible: ! inEdit()">
|
||||
<i class="icon fa-euro"></i>
|
||||
<span data-bind="text:tarif"></span>
|
||||
</span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm"
|
||||
paceholder="tarief"
|
||||
data-bind="textInput:tarif, visible:inEdit,
|
||||
event:{change:$root.saveProjectemployee,keyup:$root.validateNumber.bind($data, 'tarif')}"/>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="visible: ! inEdit()"><span data-bind="text:budget"></span> uur</span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm"
|
||||
placeholder="budget"
|
||||
data-bind="textInput:budget, visible:inEdit,
|
||||
event:{change:$root.saveProjectemployee,keyup:$root.validateNumber.bind($data, 'budget')}"/>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="text:startdate, visible: ! inEdit()"></span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm"
|
||||
placeholder="start"
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
||||
value:startdate, visible:inEdit,
|
||||
event:{change:$root.saveProjectemployee}"/>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="visible: ! inEdit()"></span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm"
|
||||
placeholder=""
|
||||
data-bind="visible:inEdit,
|
||||
event:{change:$root.saveProjectemployee}"/>
|
||||
</td>
|
||||
<td>
|
||||
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editProjectemployee"></i>
|
||||
<i class="icon fa-trash redish pointer" title="verwijder"
|
||||
data-bind="click:$root.removeProjectemployee"></i>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:addProjectEmployee">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:addProjectemployee">
|
||||
nieuwe project medewerker
|
||||
</button>
|
||||
</td>
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
<div class="panel panel-bordered panel-primary panel-line">
|
||||
<div class="panel-heading panel-heading-project">
|
||||
<h3 class="">
|
||||
bestanden
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body panel-body-project">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="2" class="table-cyanish-header">
|
||||
offerte bestanden
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:projectFiles">
|
||||
<td>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editPayment"></i>
|
||||
<i class="icon fa-trash redish pointer" title="verwijder"
|
||||
data-bind="click:$root.removePayment"></i>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2" class="table-cyanish-header">
|
||||
project bestanden
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="panel panel-bordered panel-primary panel-line panel-project">
|
||||
<div class="panel panel-bordered panel-primary panel-line">
|
||||
<div class="panel-heading panel-heading-project">
|
||||
<h3 class="">
|
||||
offertes
|
||||
@@ -40,10 +40,19 @@
|
||||
<td>
|
||||
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editOffer"></i>
|
||||
<i class="icon fa-trash redish pointer" title="verwijder"
|
||||
data-bind="click:$root.removeProject, css:{'whiteish':$root.selectedRowID() == id}"></i>
|
||||
data-bind="click:$root.removeOffer"></i>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newOffer">
|
||||
nieuwe offerte
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,10 +1,13 @@
|
||||
<div class="project-page" id="project-modal" data-bind="fadeVisible:showProject()">
|
||||
<div class="container" style="margin-top:50px;">
|
||||
<div class="row">
|
||||
<div class="col-md-3 form-inline">
|
||||
<button class="btn btn-danger" data-bind="click:closeProject" style="position:absolute">
|
||||
sluit
|
||||
</button>
|
||||
<div class="container" style="margin-top:15px;padding-top:15px;">
|
||||
<div class="row" form-inline>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-xs-3 col-form-label">klant</label>
|
||||
<div class="col-xs-9">
|
||||
<label class="col-md-3 col-form-label">klant</label>
|
||||
<div class="col-md-9">
|
||||
<select class="form-control form-control-sm"
|
||||
data-bind="options:customers,
|
||||
optionsText:'name',
|
||||
@@ -12,51 +15,72 @@
|
||||
value:customerID,
|
||||
disable:offers().length > 0,
|
||||
optionsCaption:'selecteer klant',
|
||||
event:{change:saveCustomerID}"></select>
|
||||
event:{change:saveProject},
|
||||
css:{'is-invalid': ! customerID()}"></select>
|
||||
<small class="invalid-feedback"
|
||||
data-bind="style:{display: ! customerID() ? 'block' : 'none'}">
|
||||
selecteer een klant
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-xs-3 col-form-label">begin project</label>
|
||||
<div class="input-group input-group-icon">
|
||||
<label class="col-md-5 col-form-label">projectleider</label>
|
||||
<div class="col-md-7">
|
||||
<select class="form-control form-control-sm"
|
||||
data-bind="options:users,
|
||||
optionsText:'fullname',
|
||||
optionsValue:'id',
|
||||
value:projectleaderID,
|
||||
optionsCaption:'projectleider',
|
||||
event:{change:saveProject}">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-md-5 col-form-label">begin project</label>
|
||||
<div class="col-md-7">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-calendar"></i>
|
||||
</span>
|
||||
<input type="text"
|
||||
placeholder="start project"
|
||||
class="form-control"
|
||||
readonly
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' }, value:startdate">
|
||||
<input type="text"
|
||||
placeholder="start project"
|
||||
class="form-control form-control-sm"
|
||||
readonly
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
||||
value:startdate,
|
||||
event:{change:saveProject}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 form-inline">
|
||||
<div class="col-md-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-xs-3 col-form-label">eind project</label>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-md-5 col-form-label">eind project</label>
|
||||
<div class="col-md-7">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-calendar"></i>
|
||||
</span>
|
||||
<input type="text"
|
||||
placeholder="eind project"
|
||||
class="form-control"
|
||||
class="form-control form-control-sm"
|
||||
readonly
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' }, value:enddate">
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
||||
value:enddate,
|
||||
event:{change:saveProject}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<button class="btn btn-danger" data-bind="click:closeProject">
|
||||
sluit
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="container">-->
|
||||
<!-- <div class="row">-->
|
||||
<!-- <div class="col-xs-12">-->
|
||||
<!-- <div class="col-md-12">-->
|
||||
<!-- <div class="project-page-header">-->
|
||||
<!-- <h3>nieuw / wijzigen project-->
|
||||
<!-- <button class="btn btn-default pull-right" data-bind="click:closeProject">x</button>-->
|
||||
@@ -73,6 +97,25 @@
|
||||
<?php $this->load->view( 'modals/partials/_projectemployees' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" data-bind="fadeVisible:customerID()">
|
||||
<div class="col-md-4">
|
||||
<?php $this->load->view('modals/partials/_payments'); ?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?php $this->load->view('modals/partials/_hours'); ?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?php $this->load->view('modals/partials/_projectcosts'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" data-bind="fadeVisible:customerID()">
|
||||
<div class="col-md-4">
|
||||
<?php $this->load->view('modals/partials/_projectfiles'); ?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?php $this->load->view('modals/partials/_projectcomments'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-xl-8">
|
||||
<div class="col-xl-12">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -82,38 +82,5 @@
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-xl-4">
|
||||
<div class="upload-btn-wrapper" data-bind="visible:selectedRowID()">
|
||||
<button class="upload-btn">voeg bestand toe</button>
|
||||
<input type="file" name="userfile" data-bind="event:{change:addDocument}" id="fileinput"/>
|
||||
</div>
|
||||
<ul class="list-group" data-bind="foreach:documents">
|
||||
<li class="list-group-dividered">
|
||||
<span class="badge badge-info" style="width:100%; text-align:left;">
|
||||
<span data-bind="text:fullname"></span> |
|
||||
<span data-bind="text:uploaddate"></span>
|
||||
</span>
|
||||
<span data-bind="text:originalname"></span>
|
||||
<span style="float:right">
|
||||
<i class="icon fa-download pointer" data-bind="click:$root.downloadDocument"></i>
|
||||
<i class="icon fa-trash redish pointer" data-bind="click:$root.removeFile"></i>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<button data-bind="click:addComment, visible:selectedRowID()" class="upload-btn">
|
||||
voeg commentaar toe
|
||||
</button>
|
||||
<!-- ko foreach: comments -->
|
||||
<div data-bind="click:$root.editComment" class="pointer">
|
||||
<span class="badge badge-info" style="width:100%; text-align:left;">
|
||||
<span data-bind="text:fullname"></span> |
|
||||
<span data-bind="text:comment_date"></span>
|
||||
</span>
|
||||
</div>
|
||||
<div data-bind="html:comment,click:$root.editComment" class="comment-text pointer"></div>
|
||||
<!-- /ko -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -38,7 +38,7 @@
|
||||
<span data-bind="text:totalOtherrevenue.toFixed(0)"></span>
|
||||
</td>
|
||||
<td>
|
||||
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editOffer"></i>
|
||||
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editProject"></i>
|
||||
<!-- ko if:archive == 'F' -->
|
||||
<i class="icon fa-archive pointer" title="archiveer"
|
||||
data-bind="click:$root.archiveProject"></i>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
dbo.offerDataService = {
|
||||
|
||||
getAllOffers: function ( projectID, archive = 'F', callback ) {
|
||||
$.getJSON( 'index.php/projects/offersController/getAllOffers/' + archive )
|
||||
$.getJSON( 'index.php/projects/offersController/getAllOffers/' + projectID + '/' + archive )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
@@ -29,15 +29,15 @@ dbo.offerDataService = {
|
||||
} );
|
||||
},
|
||||
|
||||
archiveOffer: function ( userID, status, callback ) {
|
||||
$.get( 'index.php/projects/offersController/archiveOffer/' + userID + '/' + status )
|
||||
archiveOffer: function ( offerID, status, callback ) {
|
||||
$.get( 'index.php/projects/offersController/archiveOffer/' + offerID + '/' + status )
|
||||
.done( function () {
|
||||
callback();
|
||||
} );
|
||||
},
|
||||
|
||||
removeOffer: function ( userID, callback ) {
|
||||
$.getJSON( 'index.php/projects/offersController/removeOffer/' + userID )
|
||||
removeOffer: function ( offerID, callback ) {
|
||||
$.getJSON( 'index.php/projects/offersController/removeOffer/' + offerID )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
|
||||
@@ -21,6 +21,13 @@ dbo.projectDataService = {
|
||||
} );
|
||||
},
|
||||
|
||||
getpayMents: function ( projectID, callback ) {
|
||||
$.getJSON( 'index.php/projects/projectsController/getP ayments/' + projectID )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
},
|
||||
|
||||
addProject: function ( callback ) {
|
||||
$.getJSON( 'index.php/projects/projectsController/addProject', function ( data ) {
|
||||
callback( data );
|
||||
@@ -33,15 +40,32 @@ dbo.projectDataService = {
|
||||
} );
|
||||
},
|
||||
|
||||
addProjectEmployee: function ( projectID, callback ) {
|
||||
$.getJSON( 'index.php/projects/projectsController/addProjectemployee/' + projectID, function ( data ) {
|
||||
callback( data );
|
||||
addProjectemployee: function ( projectID, callback ) {
|
||||
$.get( 'index.php/projects/projectsController/addProjectemployee/' + projectID, function () {
|
||||
callback();
|
||||
} );
|
||||
},
|
||||
|
||||
saveProject: function ( submitDATA, callback ) {
|
||||
$.post( 'index.php/projects/projectsController/saveProject', submitDATA, function () {
|
||||
}, 'json' )
|
||||
saveProject: function ( projectID, submitDATA, callback ) {
|
||||
$.post( 'index.php/projects/projectsController/saveProject', submitDATA, 'json' )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
},
|
||||
|
||||
saveProjectemployee: function ( submitDATA ) {
|
||||
$.post( 'index.php/projects/projectsController/saveProjectemployee', submitDATA );
|
||||
},
|
||||
|
||||
savePayment: function ( submitDATA, callback ) {
|
||||
$.post( 'index.php/projects/projectsController/savePayment', submitDATA )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
},
|
||||
|
||||
saveProjecthour: function ( submitDATA, callback ) {
|
||||
$.post( 'index.php/projects/projectsController/saveProjecthour', submitDATA )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
@@ -54,8 +78,29 @@ dbo.projectDataService = {
|
||||
} );
|
||||
},
|
||||
|
||||
removeProject: function ( userID, callback ) {
|
||||
$.getJSON( 'index.php/projects/projectsController/removeProject/' + userID )
|
||||
removeProject: function ( projectID, callback ) {
|
||||
$.getJSON( 'index.php/projects/projectsController/removeProject/' + projectID )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
},
|
||||
|
||||
removeProjectemployee: function ( projectemployeeID, callback ) {
|
||||
$.getJSON( 'index.php/projects/projectsController/removeProjectemployee/' + projectemployeeID )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
},
|
||||
|
||||
removePayment: function ( paymentID, callback ) {
|
||||
$.getJSON( 'index.php/projects/projectsController/removePayment/' + paymentID )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
},
|
||||
|
||||
removeProjecthour: function ( projecthourID, callback ) {
|
||||
$.getJSON( 'index.php/projects/projectsController/removeProjecthour/' + projecthourID )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
|
||||
@@ -18,9 +18,9 @@ dbo.helpers = {
|
||||
|
||||
// convert to comma or point number
|
||||
if ( point ) {
|
||||
input = input.replace( ',', '' );
|
||||
input = input.toString().replace( ',', '' );
|
||||
} else {
|
||||
input = input.replace( '.', '' );
|
||||
input = input.toString().replace( '.', '' );
|
||||
}
|
||||
|
||||
//remain only last comma or point and remove all non numbers
|
||||
@@ -58,6 +58,7 @@ dbo.helpers = {
|
||||
},
|
||||
|
||||
mysql2date : function(date){
|
||||
if( ! date ) return null;
|
||||
if( date.length != 10 ) return null;
|
||||
|
||||
var dateParts = date.split("-");
|
||||
|
||||
@@ -76,7 +76,7 @@ $( function () {
|
||||
message : errorMessage,
|
||||
modalClass: 'modal-danger'
|
||||
} );
|
||||
} );
|
||||
} );8
|
||||
},
|
||||
|
||||
setCustomer: function ( customer ) {
|
||||
|
||||
@@ -21,22 +21,21 @@ $( function () {
|
||||
offerleader_id : ko.observable(),
|
||||
own_revenue : ko.observable(),
|
||||
other_revenue : ko.observable(),
|
||||
hasProject : ko.observable(),
|
||||
|
||||
init: function () {
|
||||
var vm = dbo.editOfferModal;
|
||||
|
||||
dbo.editOfferModal.refreshCustomers();
|
||||
|
||||
dbo.editOfferModal.refreshUsers();
|
||||
},
|
||||
|
||||
newEditOffer: function ( offer, callback ) {
|
||||
newEditOffer: function ( offer, projectID = false, customerID = false, hasProject = false, callback ) {
|
||||
var vm = dbo.editOfferModal;
|
||||
vm.callback = typeof(callback) == 'function' ? callback : null;
|
||||
|
||||
vm.showOfferModal();
|
||||
|
||||
vm.setOffer( offer );
|
||||
vm.setOffer( offer, projectID, customerID, hasProject );
|
||||
},
|
||||
|
||||
getCustomerProjects: function () {
|
||||
@@ -92,12 +91,20 @@ $( function () {
|
||||
} );
|
||||
},
|
||||
|
||||
setOffer: function ( offer ) {
|
||||
setOffer: function ( offer, projectID, customerID, hasProject ) {
|
||||
var vm = dbo.editOfferModal;
|
||||
|
||||
vm.hasProject( hasProject );
|
||||
|
||||
vm.id = offer.id || 0;
|
||||
vm.customer_id( offer.customer_id || null );
|
||||
vm.project_id( offer.project_id || null );
|
||||
|
||||
if ( projectID ) {
|
||||
vm.project_id( projectID );
|
||||
vm.customer_id( customerID );
|
||||
} else {
|
||||
vm.project_id( offer.project_id || null );
|
||||
vm.customer_id( offer.customer_id || null );
|
||||
}
|
||||
vm.offerleader_id( offer.offerleader_id || null );
|
||||
vm.offernumber( offer.offernumber || null );
|
||||
vm.startdate( offer.startdate || null );
|
||||
@@ -128,7 +135,7 @@ $( function () {
|
||||
} );
|
||||
},
|
||||
|
||||
addUser:function(){
|
||||
addUser: function () {
|
||||
var vm = dbo.editOfferModal;
|
||||
dbo.editUserModal.newEditUser( false, function () {
|
||||
vm.refreshUsers();
|
||||
|
||||
@@ -6,29 +6,120 @@
|
||||
*/
|
||||
|
||||
$( function () {
|
||||
var timeout;
|
||||
dbo.editProjectModal = {
|
||||
|
||||
offers : ko.observableArray( [] ),
|
||||
projectEmployees: ko.observableArray( [] ),
|
||||
customers : ko.observableArray( [] ),
|
||||
users : ko.observableArray( [] ),
|
||||
payments : ko.observableArray( [] ),
|
||||
projecthours : ko.observableArray( [] ),
|
||||
offerFiles : ko.observableArray( [] ),
|
||||
offerComments : ko.observableArray( [] ),
|
||||
projectFiles : ko.observableArray( [] ),
|
||||
projectComments : ko.observableArray( [] ),
|
||||
showProject : ko.observable( false ),
|
||||
projectID : null,
|
||||
callback : null,
|
||||
customerID : ko.observable( null ),
|
||||
projectleaderID : ko.observable(),
|
||||
archive : ko.observable( false ),
|
||||
startdate : ko.observable( null ),
|
||||
enddate : ko.observable( null ),
|
||||
busy : false,
|
||||
|
||||
init: function () {
|
||||
var vm = dbo.editProjectModal;
|
||||
|
||||
vm.refreshProject();
|
||||
|
||||
dbo.customerDataService.getAllCustomers( 'F', function ( data ) {
|
||||
vm.customers( data );
|
||||
dbo.userDataService.getAllUsers( 'F', function ( data ) {
|
||||
vm.users( data );
|
||||
vm.refreshProject();
|
||||
} );
|
||||
} );
|
||||
},
|
||||
|
||||
editProjectemployee: function () {
|
||||
var self = this;
|
||||
var vm = dbo.editProjectModal;
|
||||
$.each( vm.projectEmployees(), function ( i, p ) {
|
||||
if ( p.id == self.id ) {
|
||||
p.inEdit( !p.inEdit() );
|
||||
} else {
|
||||
p.inEdit( false );
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
editPayment: function () {
|
||||
var self = this;
|
||||
var vm = dbo.editProjectModal;
|
||||
$.each( vm.payments(), function ( i, p ) {
|
||||
if ( p.id == self.id ) {
|
||||
p.inEdit( !p.inEdit() );
|
||||
} else {
|
||||
p.inEdit( false );
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
editProjecthour: function () {
|
||||
var self = this;
|
||||
var vm = dbo.editProjectModal;
|
||||
$.each( vm.projecthours(), function ( i, p ) {
|
||||
if ( p.id == self.id ) {
|
||||
p.inEdit( !p.inEdit() );
|
||||
} else {
|
||||
p.inEdit( false );
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
newOffer: function () {
|
||||
var vm = dbo.editProjectModal;
|
||||
var service = dbo.offersService;
|
||||
service.vm = dbo.editProjectModal;
|
||||
|
||||
service.newOffer( vm.projectID, vm.customerID() );
|
||||
},
|
||||
|
||||
newPayment: function () {
|
||||
var vm = dbo.editProjectModal;
|
||||
|
||||
var payment = {
|
||||
id : 0,
|
||||
offernumber : '',
|
||||
paymentdate : null,
|
||||
paymentamount: 0,
|
||||
inEdit : true
|
||||
};
|
||||
|
||||
vm.payments.push( new vm.Payment( payment ) );
|
||||
},
|
||||
|
||||
newProjecthour: function () {
|
||||
var vm = dbo.editProjectModal;
|
||||
|
||||
var projecthour = {
|
||||
id : 0,
|
||||
projectemployee_id: null,
|
||||
hourdate : null,
|
||||
hours : 0,
|
||||
inEdit : true
|
||||
};
|
||||
|
||||
vm.projecthours.push( new vm.Projecthour( projecthour ) );
|
||||
},
|
||||
|
||||
editOffer: function () {
|
||||
var service = dbo.offersService;
|
||||
service.vm = dbo.editProjectModal;
|
||||
|
||||
service.editOffer( this, false, false, true );
|
||||
},
|
||||
|
||||
addProject: function ( callback ) {
|
||||
var vm = dbo.editProjectModal;
|
||||
|
||||
@@ -43,45 +134,289 @@ $( function () {
|
||||
} );
|
||||
},
|
||||
|
||||
addProjectEmployee: function () {
|
||||
addProjectemployee: function () {
|
||||
var vm = dbo.editProjectModal;
|
||||
dbo.projectDataService.addProjectemployee( function ( projectID ) {
|
||||
vm.projectID = projectID;
|
||||
|
||||
dbo.projectDataService.addProjectemployee( vm.projectID, function () {
|
||||
vm.refreshProject();
|
||||
} );
|
||||
},
|
||||
|
||||
saveCustomerID: function () {
|
||||
editProject: function ( projectID, callback ) {
|
||||
var vm = dbo.editProjectModal;
|
||||
|
||||
vm.callback = callback;
|
||||
vm.projectID = projectID;
|
||||
|
||||
vm.showProject( true );
|
||||
|
||||
vm.init();
|
||||
},
|
||||
|
||||
saveProject: function () {
|
||||
var vm = dbo.editProjectModal;
|
||||
|
||||
if ( vm.busy ) return;
|
||||
|
||||
var submitDATA = {
|
||||
id : vm.projectID,
|
||||
customer_id : vm.customerID(),
|
||||
projectleader_id: vm.projectleaderID(),
|
||||
startdate : vm.startdate(),
|
||||
enddate : vm.enddate()
|
||||
}
|
||||
|
||||
dbo.projectDataService.saveProject( vm.projectID, submitDATA, function ( data ) {
|
||||
vm.projectID = data;
|
||||
} );
|
||||
},
|
||||
|
||||
saveProjectemployee: function () {
|
||||
var vm = dbo.editProjectModal;
|
||||
var self = this;
|
||||
|
||||
$.each( vm.users(), function ( i, p ) {
|
||||
if ( self.employeeID == p.id ) self.fullname( p.fullname );
|
||||
} );
|
||||
|
||||
if ( timeout ) {
|
||||
clearTimeout( timeout );
|
||||
timeout = null;
|
||||
}
|
||||
timeout = setTimeout( function () {
|
||||
var submitDATA = {
|
||||
id : self.id,
|
||||
user_id : self.employeeID(),
|
||||
tarif : self.tarif() ? self.tarif().toString().replace( ',', '.' ) : 0,
|
||||
budget : self.budget() ? self.budget().toString().replace( ',', '.' ) : 0,
|
||||
startdate: self.startdate()
|
||||
}
|
||||
|
||||
dbo.projectDataService.saveProjectemployee( submitDATA );
|
||||
}, 400 );
|
||||
},
|
||||
|
||||
savePayment: function () {
|
||||
var self = this;
|
||||
|
||||
if ( !self.offer_id() ) return;
|
||||
|
||||
var submitDATA = {
|
||||
id : self.id,
|
||||
offer_id : self.offer_id(),
|
||||
paymentdate : self.paymentdate(),
|
||||
paymentamount: self.paymentamount()
|
||||
};
|
||||
|
||||
dbo.projectDataService.savePayment( submitDATA, function ( data ) {
|
||||
if ( data.success ) self.id = data.paymentID;
|
||||
} );
|
||||
},
|
||||
|
||||
saveProjecthour: function () {
|
||||
var self = this;
|
||||
|
||||
if ( !self.projectemployee_id() ) return;
|
||||
|
||||
var submitDATA = {
|
||||
id : self.id,
|
||||
projectemployee_id: self.projectemployee_id(),
|
||||
hourdate : self.hourdate(),
|
||||
hours : self.hours()
|
||||
};
|
||||
|
||||
dbo.projectDataService.saveProjecthour( submitDATA, function ( data ) {
|
||||
console.log( data );
|
||||
if ( data.success ) self.id = data.projecthourID;
|
||||
} );
|
||||
},
|
||||
|
||||
removeProjectemployee: function () {
|
||||
var vm = dbo.editProjectModal;
|
||||
var self = this;
|
||||
|
||||
tellMe( {
|
||||
title : 'verwijderen projectmedewerker',
|
||||
message : 'weet u zeker dat u de projectmedewerker wilt verwijderen, dit kan niet ongedaan worden gemaakt',
|
||||
notify : true,
|
||||
noText : 'nee verwijder de projectmedewerker niet',
|
||||
yesText : 'ja verwijder de projectmedewerker',
|
||||
modalClass: 'modal-warning'
|
||||
}, function ( response ) {
|
||||
console.log( response );
|
||||
if ( response ) {
|
||||
dbo.projectDataService.removeProjectemployee( self.id, function ( data ) {
|
||||
if ( data.result ) {
|
||||
tellMe( {
|
||||
title : 'projectmedewerker verwijderd',
|
||||
message : 'de projectmedewerker is succesvol verwijderd',
|
||||
modalClass: 'modal-success'
|
||||
}, function () {
|
||||
vm.refreshProject();
|
||||
} );
|
||||
} else {
|
||||
tellMe( {
|
||||
title : 'fout bij verwijderen projectmedewerker',
|
||||
message : 'de projectmedewerker kan niet worden verwijderd',
|
||||
modalClass: 'modal-danger'
|
||||
} );
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
removeOffer: function () {
|
||||
var vm = dbo.editProjectModal;
|
||||
var self = this;
|
||||
|
||||
tellMe( {
|
||||
title : 'verwijderen offerte',
|
||||
message : 'weet u zeker dat u de offerte wilt verwijderen, dit kan niet ongedaan worden gemaakt',
|
||||
notify : true,
|
||||
noText : 'nee verwijder de offerte niet',
|
||||
yesText : 'ja verwijder de offerte',
|
||||
modalClass: 'modal-warning'
|
||||
}, function ( response ) {
|
||||
console.log( response );
|
||||
if ( response ) {
|
||||
dbo.offerDataService.removeOffer( self.id, function ( data ) {
|
||||
if ( data.result ) {
|
||||
tellMe( {
|
||||
title : 'offerte verwijderd',
|
||||
message : 'de offerte is succesvol verwijderd',
|
||||
modalClass: 'modal-success'
|
||||
}, function () {
|
||||
vm.refreshProject();
|
||||
} );
|
||||
} else {
|
||||
tellMe( {
|
||||
title : 'fout bij verwijderen offerte',
|
||||
message : 'de offerte kan niet worden verwijderd',
|
||||
modalClass: 'modal-danger'
|
||||
} );
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
removePayment: function () {
|
||||
var vm = dbo.editProjectModal;
|
||||
var self = this;
|
||||
|
||||
tellMe( {
|
||||
title : 'verwijderen betaling',
|
||||
message : 'weet u zeker dat u de betaling wilt verwijderen, dit kan niet ongedaan worden gemaakt',
|
||||
notify : true,
|
||||
noText : 'nee verwijder de betaling niet',
|
||||
yesText : 'ja verwijder de betaling',
|
||||
modalClass: 'modal-warning'
|
||||
}, function ( response ) {
|
||||
console.log( response );
|
||||
if ( response ) {
|
||||
dbo.projectDataService.removePayment( self.id, function ( data ) {
|
||||
if ( data.result ) {
|
||||
tellMe( {
|
||||
title : 'betaling verwijderd',
|
||||
message : 'de betaling is succesvol verwijderd',
|
||||
modalClass: 'modal-success'
|
||||
}, function () {
|
||||
vm.refreshProject();
|
||||
} );
|
||||
} else {
|
||||
tellMe( {
|
||||
title : 'fout bij verwijderen betaling',
|
||||
message : 'de betaling kan niet worden verwijderd',
|
||||
modalClass: 'modal-danger'
|
||||
} );
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
removeProjecthour: function () {
|
||||
var vm = dbo.editProjectModal;
|
||||
var self = this;
|
||||
|
||||
tellMe( {
|
||||
title : 'verwijderen projectuur',
|
||||
message : 'weet u zeker dat u de projectuur wilt verwijderen, dit kan niet ongedaan worden gemaakt',
|
||||
notify : true,
|
||||
noText : 'nee verwijder de projectuur niet',
|
||||
yesText : 'ja verwijder de projectuur',
|
||||
modalClass: 'modal-warning'
|
||||
}, function ( response ) {
|
||||
console.log( response );
|
||||
if ( response ) {
|
||||
dbo.projectDataService.removeProjecthour( self.id, function ( data ) {
|
||||
if ( data.result ) {
|
||||
tellMe( {
|
||||
title : 'projectuur verwijderd',
|
||||
message : 'de projectuur is succesvol verwijderd',
|
||||
modalClass: 'modal-success'
|
||||
}, function () {
|
||||
vm.refreshProject();
|
||||
} );
|
||||
} else {
|
||||
tellMe( {
|
||||
title : 'fout bij verwijderen projectuur',
|
||||
message : 'de projectuur kan niet worden verwijderd',
|
||||
modalClass: 'modal-danger'
|
||||
} );
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
closeProject: function () {
|
||||
var vm = dbo.editProjectModal;
|
||||
|
||||
vm.showProject( false );
|
||||
|
||||
vm.callback();
|
||||
},
|
||||
|
||||
validateNumber: function ( field ) {
|
||||
this[field]( dbo.helpers.validateNumber( this[field](), false ) );
|
||||
},
|
||||
|
||||
refreshProject: function () {
|
||||
var vm = dbo.editProjectModal;
|
||||
vm.busy = true;
|
||||
|
||||
dbo.projectDataService.getProject( vm.projectID, function ( data ) {
|
||||
vm.Project( data );
|
||||
} );
|
||||
},
|
||||
vm.id = data.id
|
||||
vm.projectleaderID( data.projectleader_id );
|
||||
vm.customerID( data.customer_id );
|
||||
vm.startdate( dbo.helpers.mysql2date( data.startdate ) );
|
||||
vm.enddate( dbo.helpers.mysql2date( data.enddate ) );
|
||||
|
||||
Project: function ( data ) {
|
||||
var vm = dbo.editProjectModal;
|
||||
var self = this;
|
||||
vm.projectEmployees.removeAll();
|
||||
vm.projecthours.removeAll();
|
||||
$.each( data.projectemployees, function ( i, p ) {
|
||||
vm.projectEmployees.push( new vm.Projectemployee( p ) );
|
||||
} );
|
||||
|
||||
vm.id = data.id;
|
||||
vm.customerID( data.customer_id );
|
||||
vm.startdate( data.startdate );
|
||||
vm.enddate( data.enddate );
|
||||
$.each( data.projectemployees, function ( i, p ) {
|
||||
var fullname = p.user ? p.user.fullname : '#NB';
|
||||
$.each( p.projecthours, function ( b, q ) {
|
||||
vm.projecthours.push( new vm.Projecthour( q, fullname ) );
|
||||
} );
|
||||
} );
|
||||
|
||||
self.projectEmployees = ko.observableArray( [] );
|
||||
$.each( data.employees, function ( i, p ) {
|
||||
self.projectEmployees.push( new vm.Projectemployee( p ) );
|
||||
vm.offers.removeAll();
|
||||
vm.payments.removeAll();
|
||||
$.each( data.offers, function ( i, p ) {
|
||||
vm.offers.push( new dbo.offersService.Offer( p ) );
|
||||
|
||||
$.each( p.payments, function ( z, q ) {
|
||||
vm.payments.push( new vm.Payment( q, p ) );
|
||||
} );
|
||||
} );
|
||||
|
||||
vm.busy = false;
|
||||
} );
|
||||
},
|
||||
|
||||
@@ -89,12 +424,36 @@ $( function () {
|
||||
var self = this;
|
||||
|
||||
self.id = data.id;
|
||||
self.employee_id = data.employee_id;
|
||||
self.fullname = data.user ? data.user.fullname : '#NB';
|
||||
self.tarif = data.tarif;
|
||||
self.budget = data.budget;
|
||||
self.startdate = dbo.helpers.mysql2date( data.startdate );
|
||||
self.enddate = dbo.helpers.mysql2date( data.enddate );
|
||||
self.employeeID = ko.observable( data.user_id );
|
||||
self.fullname = ko.observable( data.user ? data.user.fullname : '#NB' );
|
||||
self.tarif = ko.observable( data.tarif ? data.tarif.toString().replace( '.', ',' ) : 0 );
|
||||
self.budget = ko.observable( data.budget ? data.budget.toString().replace( '.', ',' ) : 0 );
|
||||
self.startdate = ko.observable( dbo.helpers.mysql2date( data.startdate ) );
|
||||
self.inEdit = ko.observable( sessionStorage.editEmployee == data.id );
|
||||
},
|
||||
|
||||
Payment: function ( data, offer = false ) {
|
||||
var inEdit = sessionStorage.editPayment == data.id;
|
||||
if ( !inEdit ) inEdit = data.inEdit || false;
|
||||
|
||||
this.id = data.id;
|
||||
this.offer_id = ko.observable( data.offer_id );
|
||||
this.offernumber = ko.observable( offer ? offer.offernumber : null );
|
||||
this.paymentdate = ko.observable( dbo.helpers.mysql2date( data.paymentdate ) );
|
||||
this.paymentamount = ko.observable( data.paymentamount );
|
||||
this.inEdit = ko.observable( inEdit );
|
||||
},
|
||||
|
||||
Projecthour: function ( data, fullname ) {
|
||||
var inEdit = sessionStorage.editPayment == data.id;
|
||||
if ( !inEdit ) inEdit = data.inEdit || false;
|
||||
|
||||
this.id = data.id;
|
||||
this.fullname = ko.observable( fullname );
|
||||
this.projectemployee_id = ko.observable( data.projectemployee_id );
|
||||
this.hourdate = ko.observable( dbo.helpers.mysql2date( data.hourdate ) );
|
||||
this.hours = ko.observable( data.hours );
|
||||
this.inEdit = ko.observable( inEdit );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ dbo.offersInit = function () {
|
||||
comments : ko.observableArray( [] ),
|
||||
documents : ko.observableArray( [] ),
|
||||
selectedRowID: ko.observable(),
|
||||
projectID : 0,
|
||||
|
||||
init: function () {
|
||||
var service = dbo.offersService;
|
||||
@@ -46,7 +47,7 @@ dbo.offersInit = function () {
|
||||
var service = dbo.offersService;
|
||||
service.vm = dbo.offersModel;
|
||||
|
||||
service.editOffer();
|
||||
service.editOffer( this );
|
||||
},
|
||||
|
||||
archiveOffer: function () {
|
||||
|
||||
@@ -17,6 +17,7 @@ dbo.projectsInit = function () {
|
||||
project : ko.observable(),
|
||||
archive : ko.observable( false ),
|
||||
selectedRowID: ko.observable(),
|
||||
busy : false,
|
||||
|
||||
init: function () {
|
||||
var vm = dbo.projectsModel;
|
||||
@@ -26,7 +27,7 @@ dbo.projectsInit = function () {
|
||||
|
||||
newProject: function () {
|
||||
var vm = dbo.projectsModel;
|
||||
dbo.editProjectModal.addProject( false, function () {
|
||||
dbo.editProjectModal.addProject( function () {
|
||||
vm.refreshProjects();
|
||||
} );
|
||||
},
|
||||
@@ -43,7 +44,7 @@ dbo.projectsInit = function () {
|
||||
var project = this;
|
||||
var vm = dbo.projectsModel;
|
||||
|
||||
dbo.editProjectModal.newEditProject( project, function () {
|
||||
dbo.editProjectModal.editProject( project.id, function () {
|
||||
vm.refreshProjects();
|
||||
} );
|
||||
},
|
||||
@@ -125,41 +126,41 @@ dbo.projectsInit = function () {
|
||||
|
||||
self.totalOwnrevenue = 0;
|
||||
self.totalOtherrevenue = 0;
|
||||
self.revenues = ko.observableArray([]);
|
||||
$.each(data.offers, function(i,p){
|
||||
if( p.accepteddate ){
|
||||
self.revenues = ko.observableArray( [] );
|
||||
$.each( data.offers, function ( i, p ) {
|
||||
if ( p.accepteddate ) {
|
||||
self.totalOwnrevenue += p.totalOwnrevenue;
|
||||
self.totalOtherrevenue += p.totalOtherrevenue;
|
||||
}
|
||||
self.revenues.push( new vm.Revenue(p));
|
||||
});
|
||||
self.revenues.push( new vm.Revenue( p ) );
|
||||
} );
|
||||
},
|
||||
|
||||
Revenue : function(data){
|
||||
Revenue: function ( data ) {
|
||||
var vm = dbo.projectsModel;
|
||||
var self = this;
|
||||
|
||||
self.id = data.id;
|
||||
self.offernumber = data.offernumber;
|
||||
self.startdate = dbo.helpers.mysql2date(self.startdate);
|
||||
self.accepteddate = dbo.helpers.mysql2date(self.accepteddate);
|
||||
self.rejectdate = dbo.helpers.mysql2date(self.rejectdate);
|
||||
self.startdate = dbo.helpers.mysql2date( self.startdate );
|
||||
self.accepteddate = dbo.helpers.mysql2date( self.accepteddate );
|
||||
self.rejectdate = dbo.helpers.mysql2date( self.rejectdate );
|
||||
self.own_revenue = data.own_revenue;
|
||||
self.other_revenue = data.other_revenue;
|
||||
self.acceptance_chance = data.acceptance_chance;
|
||||
|
||||
self.payed = 0;
|
||||
self.payments = ko.observableArray([]);
|
||||
$.each(data.payments, function(i, p){
|
||||
self.payed =+ p.paymentamount;
|
||||
self.payments = ko.observableArray( [] );
|
||||
$.each( data.payments, function ( i, p ) {
|
||||
self.payed = +p.paymentamount;
|
||||
|
||||
self.payments.push( new vm.Payment(p));
|
||||
});
|
||||
self.payments.push( new vm.Payment( p ) );
|
||||
} );
|
||||
},
|
||||
|
||||
Payment : function(data){
|
||||
Payment: function ( data ) {
|
||||
self.id = data.id;
|
||||
self.paymentdate = dbo.helpers.mysql2date(self.paymentdate);
|
||||
self.paymentdate = dbo.helpers.mysql2date( self.paymentdate );
|
||||
self.paymentamount = data.paymentamount;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -10,16 +10,10 @@ dbo.offersService = {
|
||||
|
||||
vm: null,
|
||||
|
||||
init: function () {
|
||||
newOffer: function (projectID=false, customerID=false) {
|
||||
var service = dbo.offersService;
|
||||
|
||||
service.refreshOffers();
|
||||
},
|
||||
|
||||
newOffer: function () {
|
||||
var service = dbo.offersService;
|
||||
|
||||
dbo.editOfferModal.newEditOffer( false, function () {
|
||||
dbo.editOfferModal.newEditOffer( false, projectID, customerID, function () {
|
||||
service.refreshOffers();
|
||||
} );
|
||||
},
|
||||
@@ -33,10 +27,10 @@ dbo.offersService = {
|
||||
service.refreshOffers();
|
||||
},
|
||||
|
||||
editOffer: function ( that ) {
|
||||
editOffer: function ( that, projectID=false, custormerID=false, hasProject=false ) {
|
||||
var offer = that;
|
||||
|
||||
dbo.editOfferModal.newEditOffer( offer, function () {
|
||||
dbo.editOfferModal.newEditOffer( offer, projectID, custormerID, hasProject, function () {
|
||||
dbo.offersService.refreshOffers();
|
||||
} );
|
||||
},
|
||||
@@ -84,21 +78,23 @@ dbo.offersService = {
|
||||
} );
|
||||
},
|
||||
|
||||
refreshOffers: function (projectID = false) {
|
||||
refreshOffers: function () {
|
||||
var vm = dbo.offersService.vm;
|
||||
var self = dbo.offersService;
|
||||
|
||||
dbo.offerDataService.getAllOffers( projectID, vm.archive() ? 'T' : 'F', function ( data ) {
|
||||
dbo.offerDataService.getAllOffers( vm.projectID , vm.archive() ? 'T' : 'F', function ( data ) {
|
||||
vm.offers.removeAll();
|
||||
$.each( data, function ( i, p ) {
|
||||
vm.offers.push( new self.Offer( p ) );
|
||||
} )
|
||||
} );
|
||||
} );
|
||||
},
|
||||
|
||||
Offer: function ( data ) {
|
||||
this.id = data.id;
|
||||
this.offernumber = data.offernumber;
|
||||
this.offerleader_id = data.offerleader_id;
|
||||
this.project_id = data.project_id;
|
||||
this.acceptance_chance = data.acceptance_chance;
|
||||
this.projectNumber = data.project ? data.project.projectnumber : null;
|
||||
this.customerName = data.customer ? data.customer.name : null;
|
||||
@@ -107,6 +103,8 @@ dbo.offersService = {
|
||||
this.rejectdate = data.rejectdate ? dbo.helpers.mysql2date( data.rejectdate ) : null;
|
||||
this.accepteddate = data.accepteddate ? dbo.helpers.mysql2date( data.accepteddate ) : null;
|
||||
this.acceptance_chance = data.acceptance_chance ? data.acceptance_chance : 0;
|
||||
this.own_revenue = data.own_revenue;
|
||||
this.other_revenue = data.other_revenue;
|
||||
this.archive = data.archive;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user