<div class="pad-vert row">
<div class="col-md-12">
[% l("Item [_1] will be marked damaged. ", "{{barcode}}") %]
- <span ng-if="circ && billArgs.charge != null">[% l("Was returned ") %]
+ <span ng-if="showBill">[% l("Was returned ") %]
<span ng-if="circ_checkin_time">[% l("on [_1] ","{{circ_checkin_time | date:'MM/dd/yy H:mm a'}}") %]</span>
[% l("for [_1] : [_2]. ",
"{{circ_patron_name}}", "{{circ.usr().usrname()}}") %]
[% l("Confirmation required to charge this patron [_1] for the damage.", "{{billArgs.charge | currency}}") %]</span>
</div>
</div>
- <div class="pad-vert row" ng-if="circ && billArgs.charge != null">
+ <div class="pad-vert row" ng-if="showBill">
<div class="col-md-3">
<label>[% l("Fee") %]
- <input type="number" min="0" step="any" class="form-control" ng-disabled="applyFine == 'noapply'"
+ <input type="number" min="0" step="any" class="form-control" ng-disabled="mode == 'waive'"
focus-me='focus' required ng-model="billArgs.charge"></label>
</div>
<div class="col-md-6">
<label>[% l("Type") %]
<select class="form-control" ng-model="billArgs.type">
<option ng-repeat="type in billingTypes | orderBy:'name()'" value="{{type.id()}}"
- ng-disabled="applyFine == 'noapply'">
+ ng-disabled="mode == 'waive'">
{{type.name()}}
</option>
</select>
</label>
</div>
</div>
- <div class="pad-vert row" ng-if="circ && billArgs.charge != null">
+ <div class="pad-vert row" ng-if="showBill">
<div class="col-md-6">
<label>[% l("Note") %]
- <textarea rows="3" class="form-control" placeholder="[% l('Note...') %]" ng-disabled="applyFine == 'noapply'"
+ <textarea rows="3" class="form-control" placeholder="[% l('Note...') %]" ng-disabled="mode == 'waive'"
ng-model="billArgs.note"></textarea></label>
</div>
</div>
</div>
<div class="modal-footer">
- <div class="btn-group pull-left" ng-if="circ && billArgs.charge != null">
+ <div class="btn-group pull-left" ng-if="showBill">
<label class="btn btn-primary" ng-model="mode" btn-radio="'charge'"
ng-class="{active: mode == 'charge'}" ng-click="btnChargeFees()">[% l('Charge Fees') %]</label>
<label class="btn btn-primary" ng-model="mode" btn-radio="'waive'"
ng-class="{active: mode == 'waive'}" ng-click="btnWaiveFees()">[% l('No Charge') %]</label>
</div>
- <button class="btn btn-primary" ng-disabled="applyFine == 'apply' && circ && (billArgs.charge == null || !billArgs.type)" ng-click="ok()">[% l('Submit') %]</button>
- <button class="btn btn-warning" ng-if="!billArgs.charge && applyFine != 'noapply'" ng-click="cancel()">[% l('Cancel') %]</button>
+ <button class="btn btn-primary" ng-disabled="showBill && (billArgs.charge == null || billArgs.charge && !billArgs.type)" ng-click="ok()">[% l('Submit') %]</button>
+ <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
</div>
service.mark_damaged = function(params) {
if (!params) return $q.when();
return $uibModal.open({
+ backdrop: 'static',
templateUrl: './circ/share/t_mark_damaged',
controller:
['$scope', '$uibModalInstance', 'egCore', 'egBilling', 'egItem',
function($scope, $uibModalInstance, egCore, egBilling, egItem) {
var doRefresh = params.refresh;
+ $scope.showBill = params.charge != null && params.circ;
$scope.billArgs = {charge: params.charge};
$scope.mode = 'charge';
$scope.barcode = params.barcode;
- if (params.charge && params.charge > 0) {
- $scope.applyFine = "apply";
- }
if (params.circ) {
$scope.circ = params.circ;
$scope.circ_checkin_time = params.circ.checkin_time();
$scope.btnChargeFees = function() {
$scope.mode = 'charge';
$scope.billArgs.charge = params.charge;
- $scope.applyFine = "apply";
}
$scope.btnWaiveFees = function() {
$scope.mode = 'waive';
$scope.billArgs.charge = 0;
- $scope.applyFine = "noapply";
}
$scope.cancel = function ($event) {
}
var handle_mark_item_damaged = function() {
+ var applyFines;
+ if ($scope.showBill)
+ applyFines = $scope.billArgs.charge ? 'apply' : 'noapply';
+
egCore.net.request(
'open-ils.circ',
'open-ils.circ.mark_item_damaged',
egCore.auth.token(), params.id, {
- apply_fines: $scope.applyFine,
+ apply_fines: applyFines,
override_amount: $scope.billArgs.charge,
override_btype: $scope.billArgs.type,
override_note: $scope.billArgs.note,
- handle_checkin: !$scope.applyFine
+ handle_checkin: !applyFines
}).then(function(resp) {
if (evt = egCore.evt.parse(resp)) {
doRefresh = false;