mirror of
https://github.com/openMF/community-app.git
synced 2026-02-06 17:36:48 +00:00
77 lines
3.0 KiB
JavaScript
77 lines
3.0 KiB
JavaScript
(function (module) {
|
|
mifosX.controllers = _.extend(module, {
|
|
|
|
ViewTransactionController: function (scope, routeParams, resourceFactory, location, route, $modal) {
|
|
scope.flag = false;
|
|
scope.manualEntry = false;
|
|
resourceFactory.journalEntriesResource.get({transactionId: routeParams.transactionId}, function (data) {
|
|
scope.transactionNumber = routeParams.transactionId;
|
|
scope.transactions = data.pageItems;
|
|
for (var i in data.pageItems) {
|
|
scope.manualEntry = data.pageItems[i].manualEntry;
|
|
if (data.pageItems[i].reversed == false) {
|
|
scope.flag = true;
|
|
}
|
|
}
|
|
});
|
|
scope.confirmation = function () {
|
|
$modal.open({
|
|
templateUrl: 'confirmation.html',
|
|
controller: ConfirmationCtrl,
|
|
resolve: {
|
|
id: function () {
|
|
return scope.trxnid;
|
|
}
|
|
}
|
|
});
|
|
};
|
|
|
|
var ConfirmationCtrl = function ($scope, $modalInstance, id) {
|
|
$scope.transactionnumber = id.transactionId;
|
|
$scope.redirect = function () {
|
|
$modalInstance.close('delete');
|
|
location.path('/viewtransactions/' + id.transactionId);
|
|
};
|
|
$scope.cancel = function () {
|
|
$modalInstance.dismiss('cancel');
|
|
};
|
|
};
|
|
|
|
scope.showTransaction = function (transaction) {
|
|
scope.transaction = transaction;
|
|
$modal.open({
|
|
templateUrl: 'viewjournalentry.html',
|
|
controller: ViewJournalEntryCtrl,
|
|
resolve: {
|
|
transaction: function () {
|
|
return scope.transaction;
|
|
}
|
|
}
|
|
});
|
|
};
|
|
|
|
var ViewJournalEntryCtrl = function ($scope, $modalInstance, transaction) {
|
|
$scope.transaction = transaction;
|
|
$scope.cancel = function () {
|
|
$modalInstance.dismiss('cancel');
|
|
};
|
|
};
|
|
|
|
scope.reverseTransaction = function (transactionId) {
|
|
|
|
resourceFactory.journalEntriesResource.reverse({transactionId: transactionId}, function (data) {
|
|
scope.trxnid = data;
|
|
scope.confirmation();
|
|
|
|
route.reload();
|
|
|
|
});
|
|
}
|
|
|
|
}
|
|
});
|
|
mifosX.ng.application.controller('ViewTransactionController', ['$scope', '$routeParams', 'ResourceFactory', '$location', '$route', '$modal', mifosX.controllers.ViewTransactionController]).run(function ($log) {
|
|
$log.info("ViewTransactionController initialized");
|
|
});
|
|
}(mifosX.controllers || {}));
|