Last active
April 23, 2018 13:27
-
-
Save erick2014/86c9cbfc3fc5ef95ce2f65ef2829b7cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ClientThumbnailController { | |
constructor(ClientFactory, $mdDialog, $state) { | |
"ngInject"; | |
this.ClientFactory = ClientFactory; | |
this.sortOptions = { | |
"Sort by": '', | |
"name": 'data.commercialName', | |
"country": 'data.country.label', | |
} | |
this.clients; | |
this.$mdDialog = $mdDialog; | |
this.clientId; | |
this.state = $state; | |
this.tiles; | |
} | |
$onInit() { | |
this.loadTiles() | |
} | |
onSelectThumbnail(clientId) { | |
this.ClientFactory.setClientId(clientId); | |
this.state.go('accountManager.management.landingPage'); | |
} | |
loadTiles() { | |
this.accountManagerCtrl.showFeedback("Loading Information.", false); | |
this.ClientFactory.getTiles() | |
.then((response) => { | |
this.tiles = response.data; | |
this.accountManagerCtrl.hideFeedback().then(() => { this.accountManagerCtrl.showFeedback("Loaded Successfully.", 3000, true); }); | |
}) | |
.catch((error) => { | |
this.tiles = []; | |
this.accountManagerCtrl.showError(); | |
}); | |
} | |
loadClients() { | |
let self = this; | |
self.ClientFactory.getClients().success( | |
function success(clients) { | |
self.clients = clients; | |
}) | |
.error(function (error) { | |
self.clients = []; | |
}); | |
} | |
addNewClient() { | |
this.$mdDialog.show({ | |
parent: angular.element(document.body), | |
template: '<modal-add-new-client></modal-add-new-client>', | |
clickOutsideToClose: true | |
}); | |
} | |
} | |
export default ClientThumbnailController; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment