mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-19 13:54:25 +01:00
[bug] unable to list user's payment schedules in the dashboard
This commit is contained in:
parent
645efa37f4
commit
ec301ba07e
@ -3,6 +3,7 @@
|
||||
- Updated user's manual for v5
|
||||
- Fix a bug: unable to process stripe payments with 3DS authentication
|
||||
- Fix a bug: unable to book an event
|
||||
- Fix a bug: unable to list user's payment schedules in the dashboard
|
||||
|
||||
## v5.0.2 2021 June 11
|
||||
|
||||
|
2
Procfile
2
Procfile
@ -1,4 +1,4 @@
|
||||
web: bundle exec rails server puma -p $PORT
|
||||
#web: bundle exec rails server puma -p $PORT
|
||||
worker: bundle exec sidekiq -C ./config/sidekiq.yml
|
||||
wp-client: bin/webpack-dev-server
|
||||
wp-server: SERVER_BUNDLE_ONLY=yes bin/webpack --watch
|
||||
|
@ -8,7 +8,7 @@ class API::PaymentSchedulesController < API::ApiController
|
||||
|
||||
def index
|
||||
@payment_schedules = PaymentSchedule.where('invoicing_profile_id = ?', current_user.invoicing_profile.id)
|
||||
.includes(:invoicing_profile, :payment_schedule_items, :subscription)
|
||||
.includes(:invoicing_profile, :payment_schedule_items, :payment_schedule_objects)
|
||||
.joins(:invoicing_profile)
|
||||
.order('payment_schedules.created_at DESC')
|
||||
.page(params[:page])
|
||||
|
@ -12,72 +12,73 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
Application.Controllers.controller('DashboardController', ['$scope', 'memberPromise', 'trainingsPromise', 'SocialNetworks', function ($scope, memberPromise, trainingsPromise, SocialNetworks) {
|
||||
// Current user's profile
|
||||
$scope.user = memberPromise;
|
||||
Application.Controllers.controller('DashboardController', ['$scope', 'memberPromise', 'trainingsPromise', 'SocialNetworks', 'growl',
|
||||
function ($scope, memberPromise, trainingsPromise, SocialNetworks, growl) {
|
||||
// Current user's profile
|
||||
$scope.user = memberPromise;
|
||||
|
||||
// List of social networks associated with this user and toggle 'show all' state
|
||||
$scope.social = {
|
||||
showAllLinks: false,
|
||||
networks: SocialNetworks
|
||||
};
|
||||
// List of social networks associated with this user and toggle 'show all' state
|
||||
$scope.social = {
|
||||
showAllLinks: false,
|
||||
networks: SocialNetworks
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the member has used his training credits for the given credit
|
||||
* @param trainingCredits array of credits used by the member
|
||||
* @param trainingId id of the training to find
|
||||
*/
|
||||
$scope.hasUsedTrainingCredit = function (trainingCredits, trainingId) {
|
||||
return trainingCredits.find(tc => tc.training_id === trainingId);
|
||||
};
|
||||
/**
|
||||
* Check if the member has used his training credits for the given credit
|
||||
* @param trainingCredits array of credits used by the member
|
||||
* @param trainingId id of the training to find
|
||||
*/
|
||||
$scope.hasUsedTrainingCredit = function (trainingCredits, trainingId) {
|
||||
return trainingCredits.find(tc => tc.training_id === trainingId);
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the name associated with the provided training ID
|
||||
* @param trainingId training identifier
|
||||
* @return {string}
|
||||
*/
|
||||
$scope.getTrainingName = function (trainingId) {
|
||||
return trainingsPromise.find(t => t.id === trainingId).name;
|
||||
};
|
||||
/**
|
||||
* Return the name associated with the provided training ID
|
||||
* @param trainingId training identifier
|
||||
* @return {string}
|
||||
*/
|
||||
$scope.getTrainingName = function (trainingId) {
|
||||
return trainingsPromise.find(t => t.id === trainingId).name;
|
||||
};
|
||||
|
||||
/* PRIVATE SCOPE */
|
||||
/* PRIVATE SCOPE */
|
||||
|
||||
/**
|
||||
* Kind of constructor: these actions will be realized first when the controller is loaded
|
||||
*/
|
||||
const initialize = () => $scope.social.networks = filterNetworks();
|
||||
/**
|
||||
* Kind of constructor: these actions will be realized first when the controller is loaded
|
||||
*/
|
||||
const initialize = () => $scope.social.networks = filterNetworks();
|
||||
|
||||
/**
|
||||
* Filter the social networks or websites that are associated with the profile of the user provided in promise
|
||||
* and return the filtered networks
|
||||
* @return {Array}
|
||||
*/
|
||||
const filterNetworks = function () {
|
||||
const networks = [];
|
||||
for (const network of Array.from(SocialNetworks)) {
|
||||
if ($scope.user.profile[network] && ($scope.user.profile[network].length > 0)) {
|
||||
networks.push(network);
|
||||
/**
|
||||
* Filter the social networks or websites that are associated with the profile of the user provided in promise
|
||||
* and return the filtered networks
|
||||
* @return {Array}
|
||||
*/
|
||||
const filterNetworks = function () {
|
||||
const networks = [];
|
||||
for (const network of Array.from(SocialNetworks)) {
|
||||
if ($scope.user.profile[network] && ($scope.user.profile[network].length > 0)) {
|
||||
networks.push(network);
|
||||
}
|
||||
}
|
||||
}
|
||||
return networks;
|
||||
};
|
||||
return networks;
|
||||
};
|
||||
|
||||
/**
|
||||
* Callback used in PaymentScheduleDashboard, in case of error
|
||||
*/
|
||||
$scope.onError = function (message) {
|
||||
growl.error(message);
|
||||
};
|
||||
/**
|
||||
* Callback used in PaymentScheduleDashboard, in case of error
|
||||
*/
|
||||
$scope.onError = function (message) {
|
||||
growl.error(message);
|
||||
};
|
||||
|
||||
/**
|
||||
* Callback triggered when the user has successfully updated his card
|
||||
*/
|
||||
$scope.onCardUpdateSuccess = function (message) {
|
||||
growl.success(message);
|
||||
};
|
||||
/**
|
||||
* Callback triggered when the user has successfully updated his card
|
||||
*/
|
||||
$scope.onCardUpdateSuccess = function (message) {
|
||||
growl.success(message);
|
||||
};
|
||||
|
||||
// !!! MUST BE CALLED AT THE END of the controller
|
||||
return initialize();
|
||||
}
|
||||
// !!! MUST BE CALLED AT THE END of the controller
|
||||
return initialize();
|
||||
}
|
||||
|
||||
]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user