Skip to content

Commit

Permalink
Merge pull request #341 from MasterFacilityList/fix-regulation
Browse files Browse the repository at this point in the history
fixing regulation payload and action
  • Loading branch information
owagaantony committed Jul 21, 2015
2 parents a826a82 + 9f644e5 commit 9edecbf
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 20 deletions.
25 changes: 16 additions & 9 deletions src/app/facility_mgmt/controllers/regulate.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,19 @@
"mfl.facility_mgmt.services.wrappers",
function ($scope, $state, $stateParams, $log, wrappers) {
$scope.facility_id = $stateParams.facility_id;

$scope.regulation = {
"facility": $scope.facility_id,
"regulation_status": "",
"reason": "",
"license_number": "",
"regulating_body": ""
};

wrappers.facility_detail.get($scope.facility_id)
.success(function(data) {
$scope.facility = data;
$scope.regulation.regulating_body = $scope.facility.regulatory_body;
})
.error(function (data) {
$log.error(data);
Expand All @@ -50,17 +60,14 @@
.error(function (data) {
$log.error(data);
});
$scope.regulation = {
"facility": $scope.facility_id,
"regulation_status": "",
"reason": "",
"license_number": "",
"regulating_body": "344150ec-2f85-47fc-abf9-336765369eca"
};
$scope.regulateFacility = function () {
wrappers.facility_regulation_status.create($scope.regulation)
.success(function () {$state.go("^");})
.error(function (data) {$log.error(data);});
.success(function () {
$state.go("facilities_regulation");
})
.error(function (data) {
$log.error(data);
});
};
}]
);
Expand Down
7 changes: 6 additions & 1 deletion src/app/facility_mgmt/tpls/facilities.list.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@
</a>

<a requires-permission="facilities.change_facility" ui-sref="facilities.facility_edit({facility_id: fac.id})"
class="login-btn login-btn-action" tooltip="View/Edit Facility">
class="login-btn login-btn-action" tooltip="Edit Facility">
&nbsp;Edit
</a>

<a requires-permission="facilities.view_facility" ui-sref="facilities.facility_edit({facility_id: fac.id})"
class="login-btn login-btn-action" tooltip="View Facility">
&nbsp;View
</a>

Expand Down
16 changes: 6 additions & 10 deletions src/app/facility_mgmt/tpls/facility_regulate.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,13 @@ <h4 class="fw-400"><a ui-sref="facilities.facility_edit">{{facility.code}} | {{f
<ui-select-match><span>{{$select.selected.name}}</span></ui-select-match>
</ui-select>
</div>
<div class="group">
<textarea name="reason" required="" ng-model="regulation.reason" row="1"></textarea>
<span class="highlight"></span>
<span class="bar"></span>
<label>Reason</label>
<div class="form-group">
<label for="reason">Reason</label>
<textarea class="form-control" name="reason" required ng-model="regulation.reason"></textarea>
</div>
<div class="group">
<input type="text" name="license_number" ng-model="regulation.license_number" required >
<span class="highlight"></span>
<span class="bar"></span>
<label>License Number</label>
<div class="form-group">
<label for="license_number">License Number / Reference Number</label>
<input class="form-control" type="text" name="license_number" ng-model="regulation.license_number" required >
</div>

<button type="submit" class="login-btn login-btn-action">
Expand Down

0 comments on commit 9edecbf

Please sign in to comment.