Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BAH-2013 | Restrictions on edit on form display control and retrospective data entry mode #425

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
04e8457
BAH-1208 | updating bahmni ui form-controls and other dependencies (#…
angshu May 7, 2021
682b6f5
BAH-1201 | Checking whitelisted domains if configured, otherwise chec…
angshu May 11, 2021
ecfcf7c
BAH-1225 | Changing invocation and launch of tele consultation (#362)
angshu Jul 10, 2021
031567c
Removing whitespaces for eslint error (#363)
angshu Jul 12, 2021
ee8e686
Updating Credits for 0.93
angshu Aug 2, 2021
2ef0320
Bindu | MOBN-446 | Change bacteriology save call from specimen to bah…
binduak Aug 11, 2021
718bdf6
Tarun, Gopi | BAH-1170 | Add support to create surgical blocks across…
binduak Aug 30, 2021
f84ac31
Tarun, Venky | BAH-1189 | Fix issues related to multiple clicks whil…
binduak Aug 30, 2021
96c7d3b
Tarun | BAH-1188 | Apply filters dynamically on the Calendar/List vie…
binduak Aug 30, 2021
ece8380
BAH-1240 | Querying pacs studies and identifying studyUID associated …
angshu Sep 13, 2021
b94109b
BAH-1130 | Replace <pre> by <span> to display obs value (#374)
rbuisson Sep 13, 2021
5b4076b
BAH-1240 | reverting to old style function def for array filter, and …
angshu Sep 14, 2021
aa5574b
Bindu, Supriya, Tarun | BAH-1222 | Address Translation gaps in the Cl…
binduak Sep 14, 2021
f44d351
Bindu | BAH-1222 | Fix the failing build
binduak Sep 14, 2021
1bfc5e8
BAH-1240 | Removing check for response head. Oviyam sends a redirect …
angshu Sep 17, 2021
d5fe1da
BAH-1247 | Fixing Short name in locale not showing up on Formrs 1 (#378)
angshu Sep 23, 2021
65eccd1
Buvana, Bindu | BAH-988 | Fix visit type is not showing up in visit d…
binduak Sep 23, 2021
7b4f962
BAH-1249 | Localising concept answer names for patient attribute (#380)
angshu Sep 27, 2021
d24359c
Bindu, Supriya | BAH-1189 | Fix issue with Admit button gets disabled…
binduak Oct 7, 2021
dcb990e
BAH-1161 | Fixing issue of only drug concept name being shown. Also g…
angshu Nov 10, 2021
9db3bed
Merge pull request #388 from Bahmni/BAH-1313
N0-man Feb 18, 2022
4713f5e
Merge pull request #390 from Bahmni/BAH-1361
N0-man Feb 18, 2022
25db31e
BAH-1313 - | Rohit, Deepthi | - Removed non-english translation from …
rohit-yawalkar Mar 31, 2022
ef4ac1e
BAH-1397 | Introduction of additional identifier lookup with generic …
SanoferSameera Mar 31, 2022
5df4a5d
BAH-1397| Refactored:Changed method for ExtraIdentifier Translation f…
swatigogia2020 Apr 1, 2022
4e8e996
BAH-2013 | Restrictions on edit on form display control and retrospec…
adarrrshc Jul 13, 2022
a69b30d
Merge branch 'master' into BAH-2013
adarrrshc Jul 15, 2022
2ce56d6
Merge branch 'master' into BAH-2013
adarrrshc Sep 26, 2022
58464ef
Merge branch 'master' into BAH-2013
adarrrshc Oct 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions ui/app/clinical/common/controllers/patientListHeaderController.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
'use strict';

angular.module('bahmni.clinical')
.controller('PatientListHeaderController', ['$scope', '$rootScope', '$bahmniCookieStore', 'providerService', 'spinner', 'locationService', '$window', 'ngDialog', 'retrospectiveEntryService', '$translate',
function ($scope, $rootScope, $bahmniCookieStore, providerService, spinner, locationService, $window, ngDialog, retrospectiveEntryService, $translate) {
.controller('PatientListHeaderController', ['$scope', '$rootScope', '$bahmniCookieStore', 'providerService', 'spinner', 'locationService', '$window', 'ngDialog', 'retrospectiveEntryService', '$translate', 'appService',
function ($scope, $rootScope, $bahmniCookieStore, providerService, spinner, locationService, $window, ngDialog, retrospectiveEntryService, $translate, appService) {
var DateUtil = Bahmni.Common.Util.DateUtil;
$scope.maxStartDate = DateUtil.getDateWithoutTime(DateUtil.today());
$scope.minStartDate = DateUtil.getDateWithoutTime(new Date(0));
var selectedProvider = {};
$scope.retrospectivePrivilege = Bahmni.Common.Constants.retrospectivePrivilege;
$scope.locationPickerPrivilege = Bahmni.Common.Constants.locationPickerPrivilege;
Expand Down Expand Up @@ -48,7 +49,8 @@ angular.module('bahmni.clinical')
};

$scope.popUpHandler = function () {
$scope.dialog = ngDialog.open({ template: 'consultation/views/defaultDataPopUp.html', className: 'test ngdialog-theme-default',
$scope.dialog = ngDialog.open({ template: 'consultation/views/defaultDataPopUp.html',
className: 'test ngdialog-theme-default',
controller: 'PatientListHeaderController'});
$('body').addClass('show-controller-back');
};
Expand Down Expand Up @@ -77,6 +79,21 @@ angular.module('bahmni.clinical')

$scope.sync = function () {
};
var retrospectiveDateCheck = function () {
var hasPrivilege = _.some($rootScope.currentUser.privileges, {name: 'bypassRetrospectiveDateThreshold'});
var retrospectiveDateThreshold = appService.getAppDescriptor().getConfigValue('retrospectiveDateThreshold');
if (!hasPrivilege && retrospectiveDateThreshold) {
var thresholdDate = new Date(new Date().setDate(retrospectiveDateThreshold));
var currentDate = new Date();

var startDate = new Date(new Date().getFullYear(), new Date().getMonth() - 1, 1, 0);
if (currentDate > thresholdDate) {
startDate = new Date(new Date().getFullYear(), new Date().getMonth(), 1, 0);
}

$scope.minStartDate = DateUtil.getDateWithoutTime(startDate);
}
};

var getCurrentCookieLocation = function () {
return $bahmniCookieStore.get(Bahmni.Common.Constants.locationCookieName) ? $bahmniCookieStore.get(Bahmni.Common.Constants.locationCookieName) : null;
Expand Down Expand Up @@ -107,11 +124,15 @@ angular.module('bahmni.clinical')
$scope.date = retrospectiveDate ? new Date(retrospectiveDate) : new Date($scope.maxStartDate);
$scope.encounterProvider = getCurrentProvider();
selectedProvider = getCurrentProvider();

retrospectiveDateCheck();

const loginLocations = localStorage.getItem("loginLocations");
if (loginLocations) {
$scope.locations = JSON.parse(loginLocations);
return;
}

return locationService.getAllByTag("Login Location").then(function (response) {
$scope.locations = response.data.results;
});
Expand Down
2 changes: 1 addition & 1 deletion ui/app/clinical/consultation/views/defaultDataPopUp.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</div>
<div class="input-container date-widget-container">
<label show-if-privilege="{{retrospectivePrivilege}}" for="retro-date-label" class="retro-date-label" >{{ 'RETROSPECTIVE_POPUP_DATA_FOR_LABEL'|translate }}</label>
<input show-if-privilege="{{retrospectivePrivilege}}" class="retro-date-widget" type="date" ng-model="date" max="{{maxStartDate}}"/>
<input show-if-privilege="{{retrospectivePrivilege}}" class="retro-date-widget" type="date" ng-model="date" max="{{maxStartDate}}" min="{{minStartDate}}"/>
</div>
<div class="retro-widget-button-wrapper">
<button class="retro-widget-button ok_btn" ng-click="windowReload()">{{ 'OKAY_LABEL' | translate}}</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,27 @@ angular.module('bahmni.common.displaycontrol.forms')
} else { return true; }
};

$scope.retrospectiveDateCheck = function (data) {
var hasPrivilege = _.some($rootScope.currentUser.privileges, {name: 'allowDashboardFormsEdit'});
var dashboardFormsEditDateThreshold = appService.getAppDescriptor().getConfigValue('dashboardFormsEditDateThreshold');
if (hasPrivilege || !dashboardFormsEditDateThreshold) {
return true;
}
var formDate = new Date(data.obsDatetime || data.encounterDateTime);
var currentDate = new Date();
var thresholdDate = new Date(new Date().setDate(dashboardFormsEditDateThreshold));

var startDate = new Date(new Date().getFullYear(), new Date().getMonth() - 1, 1, 0);
if (currentDate > thresholdDate) {
startDate = new Date(new Date().getFullYear(), new Date().getMonth(), 1, 0);
}

if (formDate >= startDate) {
return true;
}
return false;
};

$scope.getDisplayName = function (data) {
if ($scope.formsWithNameTranslations && $scope.formsWithNameTranslations.length > 0) {
var formWithNameTranslation = $scope.formsWithNameTranslations.find(function (formWithNameTranslation) {
Expand Down
Loading