project
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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' );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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">×</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,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"> </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>
|
||||
|
||||
Reference in New Issue
Block a user