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;
}
}
+5
View File
@@ -11,6 +11,11 @@ class Offer extends BaseModel {
protected $table = "offers"; protected $table = "offers";
public function payments()
{
return $this->hasMany( 'Payment' );
}
public function project() public function project()
{ {
return $this->belongsTo( 'Project' ); return $this->belongsTo( 'Project' );
+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' );
}
}
+13
View File
@@ -32,6 +32,14 @@ class Project extends BaseModel {
'projectleader' => function ( $q ) { 'projectleader' => function ( $q ) {
$q->selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" ); $q->selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" );
}] ) }] )
->with( [
'offers' => function ( $q ) {
$q->whereArchive( 'F' )
->with( [
'payment' => function ( $q ) {
$q->selectRaw( '*' );
}] );
}] )
->with( 'customer' ); ->with( 'customer' );
if ( $archive == 'F' ) $projects = $projects->whereArchive( 'F' ); if ( $archive == 'F' ) $projects = $projects->whereArchive( 'F' );
@@ -40,4 +48,9 @@ class Project extends BaseModel {
return $projects; 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="project-page" id="project-modal" data-bind="visible:showProject()">
<div class="modal-dialog" role="document"> <!-- <div class="container">-->
<div class="modal-content"> <!-- <div class="row">-->
<div class="modal-header"> <!-- <div class="col-xs-12">-->
<h5 class="modal-title">toevoegen / wijzigen project</h5> <!-- <div class="project-page-header">-->
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <!-- <h3>nieuw / wijzigen project-->
<span aria-hidden="true">&times;</span> <!-- <button class="btn btn-default pull-right" data-bind="click:closeProject">x</button>-->
</button> <!-- </h3>-->
</div> <!-- </div>-->
<div class="modal-body"> <!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<div class="container" style="margin-top:50px;">
<div class="row"> <div class="row">
<div class="col-xl-12"> <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>
</div> <div class="panel-body panel-body-project">
</div> <table class="table table-sm">
<div class="modal-footer"> <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>
</div> </div>
</div> </div>
</div>
</div>
+9 -13
View File
@@ -9,9 +9,8 @@
<th class="table-tealish-header">klant</th> <th class="table-tealish-header">klant</th>
<th class="table-tealish-header">start</th> <th class="table-tealish-header">start</th>
<th class="table-tealish-header">eind</th> <th class="table-tealish-header">eind</th>
<th class="table-tealish-header">gefactureerd</th> <th class="table-tealish-header align-right">eigen omzet</th>
<th class="table-tealish-header">te factureren</th> <th class="table-tealish-header align-right">overige omzet</th>
<th class="table-tealish-header">totaal factuur</th>
<th class="table-tealish-header">&nbsp;</th> <th class="table-tealish-header">&nbsp;</th>
</tr> </tr>
</thead> </thead>
@@ -32,27 +31,24 @@
<td data-bind="click:$root.selectPoject" class="pointer"> <td data-bind="click:$root.selectPoject" class="pointer">
<span data-bind="text:enddate"></span> <span data-bind="text:enddate"></span>
</td> </td>
<td data-bind="click:$root.selectPoject" class="pointer"> <td data-bind="click:$root.selectPoject" class="pointer align-right">
<span data-bind="text:billed"></span> <span data-bind="text:totalOwnrevenue.toFixed(0)"></span>
</td> </td>
<td data-bind="click:$root.selectPoject" class="pointer"> <td data-bind="click:$root.selectPoject" class="pointer align-right">
<span data-bind="text:toBillings"></span> <span data-bind="text:totalOtherrevenue.toFixed(0)"></span>
</td>
<td data-bind="click:$root.selectPoject" class="pointer">
<span data-bind="text:billings"></span>
</td> </td>
<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.editOffer"></i>
<!-- ko if:archive == 'F' --> <!-- ko if:archive == 'F' -->
<i class="icon fa-archive pointer" title="archiveer" <i class="icon fa-archive pointer" title="archiveer"
data-bind="click:$root.archiveOffer"></i> data-bind="click:$root.archiveProject"></i>
<!-- /ko --> <!-- /ko -->
<!-- ko if:archive != 'F' --> <!-- ko if:archive != 'F' -->
<i class="icon fa-minus-circle redish pointer" title="archiveer" <i class="icon fa-minus-circle redish pointer" title="archiveer"
data-bind="click:$root.archiveOffer"></i> data-bind="click:$root.archiveProject"></i>
<!-- /ko --> <!-- /ko -->
<i class="icon fa-trash redish pointer" title="verwijder" <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> </td>
</tr> </tr>
</tbody> </tbody>
+16
View File
@@ -13,4 +13,20 @@ body{
position: relative; position: relative;
z-index:9999 !important; 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; color: #fff !important;
} }
.table-blueish-header { .table-darkish-header {
background-color: #247CF0; background-color: #526069;
color: #fff !important;
}
.table-indigoish-header {
background-color: #4D64FA;
color: #fff !important; color: #fff !important;
} }
@@ -191,3 +196,33 @@
opacity: 0; 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 () { $( 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 ) { Project: function ( data ) {
this.id = data.id; var vm = dbo.projectsModel;
this.projectnumber = data.projectnumber;
this.projectleader = data.projectleader.fullname; var self = this;
this.customer = data.customer.name; self.id = data.id;
this.startdate = data.startdate; self.projectnumber = data.projectnumber;
this.enddate = data.enddate; self.projectleader = data.projectleader.fullname;
this.archive = data.archive; 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(); dbo.projectsModel.init();