This commit is contained in:
Daniel Camargo 2015-01-07 21:56:42 -02:00
parent 93888e9c3e
commit 14be07a45c
4 changed files with 28 additions and 9 deletions

View File

@ -2,9 +2,7 @@
class Controller_api_test extends Crunchbutton_Controller_Rest {
public function init() {
// $admin_pexcard = Cockpit_Admin_Pexcard::getByPexcard( 100296 )->get( 0 );
// $admin_pexcard->addArbitraryFunds( 1, 'test' );
Crunchbutton_Pexcard_Action::monitor();
Crunchbutton_Community_Shift::removeRecurring( 6001 );
}
}

View File

@ -119,6 +119,7 @@
<tr><td><a href="/drivers/summary/{{staff.id_admin}}">Payments</a></td></tr>
<tr><td><a href="/staff/{{staff.login}}/payinfo">Payment Info</a></td></tr>
<tr ng-if="staff.pexcard"><td><a href="/staff/{{staff.login}}/pexcard">Pexcard / Add funds</a></td></tr>
<tr ng-if="!staff.pexcard"><td><a href="/pexcard/card/driver/{{staff.id_admin}}">Pexcard</a></td></tr>
</table>
</div>

View File

@ -212,6 +212,12 @@ NGApp.config(['$routeProvider', '$locationProvider', function($routeProvider, $l
controller: 'PexCardLogViewCtrl',
templateUrl: 'assets/view/pexcard-log-view.html'
})
.when('/pexcard/card/driver/:id', {
action: 'pexcard',
driver: true,
controller: 'PexCardIdCtrl',
templateUrl: 'assets/view/pexcard-pex-id.html'
})
.when('/pexcard/card/:id?', {
action: 'pexcard',
controller: 'PexCardIdCtrl',

View File

@ -37,13 +37,15 @@ NGApp.controller( 'PexCardReportCtrl', function ( $scope, $filter, PexCardServic
} );
NGApp.controller( 'PexCardIdCtrl', function ( $scope, $routeParams, PexCardService, DriverOnboardingService ) {
NGApp.controller( 'PexCardIdCtrl', function ( $scope, $routeParams, $route, PexCardService, DriverOnboardingService ) {
$scope.submitted = false;
$scope.isSearching = false;
$scope.status = PexCardService.status;
$scope._id_admin = false;
$scope.search = function() {
$scope.card = null;
@ -66,6 +68,11 @@ NGApp.controller( 'PexCardIdCtrl', function ( $scope, $routeParams, PexCardServi
$scope.submitted = false;
if( json.id ){
$scope.card = json;
if( $scope._id_admin ){
$scope.card.id_admin = $scope._id_admin;
}
console.log('$scope._id_admin',$scope._id_admin);
console.log('$scope.card',$scope.card);
} else {
$scope.flash.setMessage( json.error, 'error' );
$scope.crunchbutton_card_id = '';
@ -148,11 +155,18 @@ NGApp.controller( 'PexCardIdCtrl', function ( $scope, $routeParams, PexCardServi
DriverOnboardingService.pexcard( function( json ){ $scope.drivers = json; } );
if( $routeParams.id ){
setTimeout( function() {
$scope.crunchbutton_card_id = parseInt( $routeParams.id );
App.rootScope.$safeApply();
$scope.search();
}, 500 );
if( $route.current.driver ){
setTimeout( function() {
$scope._id_admin = parseInt( $routeParams.id );
console.log('$scope._id_admin',$scope._id_admin);
}, 50 );
} else {
setTimeout( function() {
$scope.crunchbutton_card_id = parseInt( $routeParams.id );
App.rootScope.$safeApply();
$scope.search();
}, 500 );
}
}
} );