Skip to content

Commit

Permalink
* remove non existant saveCreditCard method call
Browse files Browse the repository at this point in the history
* continue on mailing (very small step)
  • Loading branch information
dev-mansonthomas committed Jun 18, 2018
1 parent 985f353 commit 95c7960
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 23 deletions.
22 changes: 3 additions & 19 deletions client/src/app/troncs/troncQueteur/troncQueteur.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,29 +196,13 @@
}
else
{
//savedSuccessfully function handle the save of data in adminMode
if(vm.current.tronc.type == 4)
if(vm.current.adminEditMode && vm.currentUserRole >= 4)
{
if(vm.current.adminEditMode && vm.currentUserRole >= 4)
{
vm.current.tronc_queteur.$saveCreditCardAsAdmin(savedSuccessfully, onSaveError);
}
else
{
vm.current.tronc_queteur.$saveCreditCard(savedSuccessfully, onSaveError);
}
vm.current.tronc_queteur.$saveCoinsAsAdmin(savedSuccessfully, onSaveError);
}
else
{
if(vm.current.adminEditMode && vm.currentUserRole >= 4)
{
vm.current.tronc_queteur.$saveCoinsAsAdmin(savedSuccessfully, onSaveError);
}
else
{
vm.current.tronc_queteur.$saveCoins(savedSuccessfully, onSaveError);
}

vm.current.tronc_queteur.$saveCoins(savedSuccessfully, onSaveError);
}
}
};
Expand Down
10 changes: 7 additions & 3 deletions client/src/app/troncs/troncQueteur/troncQueteur.html
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,13 @@ <H2>Ce tronc est d'une année <u>ANTÉRIEURE ({{tq.current.year_tronc_queteur}})

<div class="form-group col-md-4" ng-class="{'has-error':troncQueteurForm.horaireDepartTheorique.$invalid}">
<label for="horaireDepartTheorique" class="control-label">Horaire Théorique de Départ</label>
<input name="horaireDepartTheorique" id="horaireDepartTheorique" type="datetime-local" class="form-control"
ng-model="tq.current.tronc_queteur.depart_theorique" required
ng-readonly="tq.current.adminEditMode == false"/>
<input name="horaireDepartTheorique"
id="horaireDepartTheorique"
type="datetime-local"
class="form-control"
ng-model="tq.current.tronc_queteur.depart_theorique"
required
ng-readonly="tq.current.adminEditMode == false"/>
<span class="help-block" ng-show="prepaTroncForm.horaireDepartTheorique.$error.required">Required</span>
</div>

Expand Down
2 changes: 1 addition & 1 deletion server/src/Entity/MailingSummaryEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use Monolog\Logger;

class NamedDonationEntity extends Entity
class MailingSummaryEntity extends Entity
{
public $ul_id ;
public $secteur ;
Expand Down
1 change: 1 addition & 0 deletions server/src/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
include_once("../../src/routes/10-unite-locale.php");
include_once("../../src/routes/11-yearly-goals.php");
include_once("../../src/routes/12-named_donation.php");
//include_once("../../src/routes/13-mailing.php");

135 changes: 135 additions & 0 deletions server/src/routes/13-mailing.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<?php
/**
* Created by IntelliJ IDEA.
* User: tmanson
* Date: 06/03/2017
* Time: 18:38
*/

use \RedCrossQuest\DBService\NamedDonationDBService;
use \RedCrossQuest\Entity\NamedDonationEntity;

include_once("../../src/Entity/YearlyGoalEntity.php");
/********************************* QUETEUR ****************************************/


/**
* Get summary info about mailing
*
* Dispo pour le role admin local
*/
$app->get('/{role-id:[4-9]}/ul/{ul-id}/mailing', function ($request, $response, $args)
{
$decodedToken = $request->getAttribute('decodedJWT');
try
{
$ulId = (int)$args['ul-id'];
$roleId = (int)$args['role-id'];
$params = $request->getQueryParams();

$namedDonationDBService = new NamedDonationDBService($this->db, $this->logger);
//$this->logger->addInfo("DailyStats list - UL ID '".$ulId."'' role ID : $roleId");
$namedDonations = $namedDonationDBService->getNamedDonations($query, $deleted, $year, $ulId);


$response->getBody()->write(json_encode($namedDonations));



return $response;
}
catch(\Exception $e)
{
$this->logger->addError("Error while fetching the NamedDonation for a year($year), deleted($deleted), query($query)", array('decodedToken'=>$decodedToken, "Exception"=>$e));
throw $e;
}

});

/**
*
* get one named donation
*
*/
$app->get('/{role-id:[4-9]}/ul/{ul-id}/namedDonations/{id}', function ($request, $response, $args)
{
$namedDonationEntity = null;
try
{
$ulId = (int)$args['ul-id'];
$id = (int)$args['id'];
$roleId = (int)$args['role-id'];

$namedDonationDBService = new NamedDonationDBService($this->db, $this->logger);

$namedDonationEntity = $namedDonationDBService->getNamedDonationById($id, $ulId, $roleId);

$response->getBody()->write(json_encode($namedDonationEntity));
return $response;

}
catch(\Exception $e)
{
$this->logger->addError("Error while geting namedDonation $id", array("Exception"=>$e));
throw $e;
}
});

/**
*
* Update named donation
*
*/
$app->put('/{role-id:[4-9]}/ul/{ul-id}/namedDonations/{id}', function ($request, $response, $args)
{
$decodedToken = $request->getAttribute('decodedJWT');
$namedDonationEntity = null;
try
{
$ulId = (int)$args['ul-id'];
$userId = (int)$decodedToken->getUid ();

$namedDonationDBService = new NamedDonationDBService($this->db, $this->logger);
$input = $request->getParsedBody();
$namedDonationEntity = new NamedDonationEntity($input, $this->logger);

$namedDonationDBService->update($namedDonationEntity, $ulId, $userId);
}
catch(\Exception $e)
{
$this->logger->addError("Error while updating namedDonation", array('namedDonationEntity'=>$namedDonationEntity, "Exception"=>$e));
throw $e;
}
return $response;
});



/**
* Create named donation
*/
$app->post('/{role-id:[4-9]}/ul/{ul-id}/namedDonations', function ($request, $response, $args)
{
$decodedToken = $request->getAttribute('decodedJWT');
$namedDonationEntity = null;
try
{
$ulId = (int)$args['ul-id'];
$userId = (int)$decodedToken->getUid ();

$namedDonationDBService = new NamedDonationDBService($this->db, $this->logger);
$input = $request->getParsedBody();
$namedDonationEntity = new NamedDonationEntity($input, $this->logger);
$namedDonationId = $namedDonationDBService->insert($namedDonationEntity, $ulId, $userId);

$response->getBody()->write(json_encode(array("namedDonationId"=>$namedDonationId), JSON_NUMERIC_CHECK));
}
catch(\Exception $e)
{
$this->logger->addError("error while creating named donation", array('namedDonationEntity'=>$namedDonationEntity, "Exception"=>$e));
throw $e;
}
return $response;
});


0 comments on commit 95c7960

Please sign in to comment.