mirror of
https://github.com/openMF/community-app.git
synced 2026-02-06 13:17:04 +00:00
27 lines
1.2 KiB
JavaScript
27 lines
1.2 KiB
JavaScript
(function (module) {
|
|
mifosX.controllers = _.extend(module, {
|
|
ClientDocumentController: function (scope, location, http, routeParams, API_VERSION, $upload, $rootScope) {
|
|
scope.clientId = routeParams.clientId;
|
|
scope.onFileSelect = function ($files) {
|
|
scope.file = $files[0];
|
|
};
|
|
|
|
scope.submit = function () {
|
|
$upload.upload({
|
|
url: $rootScope.hostUrl + API_VERSION + '/clients/' + scope.clientId + '/documents',
|
|
data: scope.formData,
|
|
file: scope.file
|
|
}).then(function (data) {
|
|
// to fix IE not refreshing the model
|
|
if (!scope.$$phase) {
|
|
scope.$apply();
|
|
}
|
|
location.path('/viewclient/' + scope.clientId);
|
|
});
|
|
};
|
|
}
|
|
});
|
|
mifosX.ng.application.controller('ClientDocumentController', ['$scope', '$location', '$http', '$routeParams', 'API_VERSION', '$upload', '$rootScope', mifosX.controllers.ClientDocumentController]).run(function ($log) {
|
|
$log.info("ClientDocumentController initialized");
|
|
});
|
|
}(mifosX.controllers || {})); |