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] );
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user