This commit is contained in:
2018-01-16 13:36:59 +01:00
parent 97f1b988bc
commit 00246f49f7
10 changed files with 248 additions and 41 deletions
@@ -0,0 +1,43 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 27/12/2017
* Time: 17:45
*/
class RemoveProject {
private $offerID;
private $allowDelete = TRUE;
public function __construct( $projectID )
{
$this->setProjectID( $projectID );
$this->handle();
}
public function getAllowDelete()
{
return $this->allowDelete;
}
private function setProjectID( $customerID )
{
$this->offerID = $customerID;
}
private function handle()
{
$this->checkForOffers();
}
private function checkForOffers()
{
$offers = Offer::whereProjectId($this->setProjectID);
if( $offers->count > 0 ) $this->allowDelete = FALSE;
}
}
+7 -2
View File
@@ -11,6 +11,11 @@ class Offer extends BaseModel {
protected $table = "offers";
public function payments()
{
return $this->hasMany( 'Payment' );
}
public function project()
{
return $this->belongsTo( 'Project' );
@@ -23,7 +28,7 @@ class Offer extends BaseModel {
public static function getAllOffers( $archive = 'F' )
{
$offers = Offer::orderBy('startdate')
$offers = Offer::orderBy( 'startdate' )
->with( 'customer' )
->with( 'project' );
@@ -56,6 +61,6 @@ class Offer extends BaseModel {
public static function removeOffer( $offerID )
{
Offer::whereId($offerID)->delete();
Offer::whereId( $offerID )->delete();
}
}
+18
View File
@@ -0,0 +1,18 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 16/01/2018
* Time: 10:27
*/
class Payment extends BaseModel {
protected $table = "projects";
public function offer()
{
return $this->belongsTo( 'Offer' );
}
}
+14 -1
View File
@@ -32,12 +32,25 @@ class Project extends BaseModel {
'projectleader' => function ( $q ) {
$q->selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" );
}] )
->with( [
'offers' => function ( $q ) {
$q->whereArchive( 'F' )
->with( [
'payment' => function ( $q ) {
$q->selectRaw( '*' );
}] );
}] )
->with( 'customer' );
if($archive == 'F') $projects = $projects->whereArchive('F');
if ( $archive == 'F' ) $projects = $projects->whereArchive( 'F' );
$projects = $projects->get();
return $projects;
}
public static function removeProject( $projectID )
{
Project::whereId($projectID)->delete();
}
}
+39 -14
View File
@@ -1,20 +1,45 @@
<div class="modal modal-fade-in-scale-up modal-primary" tabindex="-1" id="project-modal">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">toevoegen / wijzigen project</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-xl-12">
<div class="project-page" id="project-modal" data-bind="visible:showProject()">
<!-- <div class="container">-->
<!-- <div class="row">-->
<!-- <div class="col-xs-12">-->
<!-- <div class="project-page-header">-->
<!-- <h3>nieuw / wijzigen project-->
<!-- <button class="btn btn-default pull-right" data-bind="click:closeProject">x</button>-->
<!-- </h3>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<div class="container" style="margin-top:50px;">
<div class="row">
<div class="col-md-6">
<div class="panel panel-bordered panel-primary panel-line panel-project">
<div class="panel-heading panel-heading-project">
<h3 class="">
offertes
</h3>
</div>
<div class="panel-body panel-body-project">
<table class="table table-sm">
<thead>
<th class="table-indigoish-header">
nummer
</th>
<th class="table-indigoish-header">
start
</th>
<th class="table-indigoish-header">
eigen omzet
</th>
<th class="table-indigoish-header">
overig omzet
</th>
</thead>
</table>
</div>
</div>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
+9 -13
View File
@@ -9,9 +9,8 @@
<th class="table-tealish-header">klant</th>
<th class="table-tealish-header">start</th>
<th class="table-tealish-header">eind</th>
<th class="table-tealish-header">gefactureerd</th>
<th class="table-tealish-header">te factureren</th>
<th class="table-tealish-header">totaal factuur</th>
<th class="table-tealish-header align-right">eigen omzet</th>
<th class="table-tealish-header align-right">overige omzet</th>
<th class="table-tealish-header">&nbsp;</th>
</tr>
</thead>
@@ -32,27 +31,24 @@
<td data-bind="click:$root.selectPoject" class="pointer">
<span data-bind="text:enddate"></span>
</td>
<td data-bind="click:$root.selectPoject" class="pointer">
<span data-bind="text:billed"></span>
<td data-bind="click:$root.selectPoject" class="pointer align-right">
<span data-bind="text:totalOwnrevenue.toFixed(0)"></span>
</td>
<td data-bind="click:$root.selectPoject" class="pointer">
<span data-bind="text:toBillings"></span>
</td>
<td data-bind="click:$root.selectPoject" class="pointer">
<span data-bind="text:billings"></span>
<td data-bind="click:$root.selectPoject" class="pointer align-right">
<span data-bind="text:totalOtherrevenue.toFixed(0)"></span>
</td>
<td>
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editOffer"></i>
<!-- ko if:archive == 'F' -->
<i class="icon fa-archive pointer" title="archiveer"
data-bind="click:$root.archiveOffer"></i>
data-bind="click:$root.archiveProject"></i>
<!-- /ko -->
<!-- ko if:archive != 'F' -->
<i class="icon fa-minus-circle redish pointer" title="archiveer"
data-bind="click:$root.archiveOffer"></i>
data-bind="click:$root.archiveProject"></i>
<!-- /ko -->
<i class="icon fa-trash redish pointer" title="verwijder"
data-bind="click:$root.removeOffer, css:{'whiteish':$root.selectedRowID() == id}"></i>
data-bind="click:$root.removeProject, css:{'whiteish':$root.selectedRowID() == id}"></i>
</td>
</tr>
</tbody>
+16
View File
@@ -13,4 +13,20 @@ body{
position: relative;
z-index:9999 !important;
}
.site-menubar{
z-index:1030;
}
.panel-project{
margin-top:20px;
}
.panel-heading-project{
padding-top:0 !important;
padding-left:10px !important;
padding-right:10px !important;
}
.panel-body-project{
padding-top:0 !important;
padding-left:10px !important;
padding-right:10px !important;
}
+37 -2
View File
@@ -39,8 +39,13 @@
color: #fff !important;
}
.table-blueish-header {
background-color: #247CF0;
.table-darkish-header {
background-color: #526069;
color: #fff !important;
}
.table-indigoish-header {
background-color: #4D64FA;
color: #fff !important;
}
@@ -191,3 +196,33 @@
opacity: 0;
}
/*********project page*************/
.project-page{
position:fixed;
top:0;
bottom:0;
left:0;
right:0;
width:100%;
height:100%;
background-color: #CCD5DB;
z-index:1035;
}
.project-page-header{
height:50px;
background-color: #3e8ef7;
width:110%;
float:left;
position:relative;
left:-30px;
}
.project-page-header > h3{
color:#fff;
margin-top:10px;
margin-left:30px;
}
.project-page > .container{
background-color: #fff;
}
+16 -2
View File
@@ -6,9 +6,23 @@
*/
$( function () {
dbo.editOfferModal = {
dbo.editProjectModal = {
showProject: ko.observable( false ),
newEditProject: function () {
var vm = dbo.editProjectModal;
vm.showProject( true );
},
closeProject: function(){
var vm = dbo.editProjectModal;
vm.showProject( false );
}
};
ko.applyBindings( dbo.editOfferModal, document.getElementById( 'project-modal' ) );
ko.applyBindings( dbo.editProjectModal, document.getElementById( 'project-modal' ) );
} );
@@ -112,14 +112,56 @@ dbo.projectsInit = function () {
},
Project: function ( data ) {
this.id = data.id;
this.projectnumber = data.projectnumber;
this.projectleader = data.projectleader.fullname;
this.customer = data.customer.name;
this.startdate = data.startdate;
this.enddate = data.enddate;
this.archive = data.archive;
var vm = dbo.projectsModel;
var self = this;
self.id = data.id;
self.projectnumber = data.projectnumber;
self.projectleader = data.projectleader.fullname;
self.customer = data.customer.name;
self.startdate = data.startdate;
self.enddate = data.enddate;
self.archive = data.archive;
self.totalOwnrevenue = 0;
self.totalOtherrevenue = 0;
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));
});
},
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.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.push( new vm.Payment(p));
});
},
Payment : function(data){
self.id = data.id;
self.paymentdate = dbo.helpers.mysql2date(self.paymentdate);
self.paymentamount = data.paymentamount;
}
};
dbo.projectsModel.init();