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