--- /dev/null
+<!-- use <form> so we get submit-on-enter for free -->
+<form class="form-validated" novalidate name="form" ng-submit="ok(record)">
+ <div>
+ <div class="modal-header">
+ <button type="button" class="close"
+ ng-click="cancel()" aria-hidden="true">×</button>
+ <h4 ng-if="creating" class="modal-title">[% l('Create copy alert type') %]</h4>
+ <h4 ng-if="!creating" class="modal-title">[% l('Update copy alert type') %]</h4>
+ </div>
+ <div class="modal-body">
+ <div class="form-group">
+ <label for="edit-alert-name">[% l('Name') %]</label>
+ <input type="text" class="form-control" focus-me='focusMe' required
+ id="edit-alert-name" ng-model="record.name" placeholder="[% l('Name...') %]"/>
+ </div>
+ <div class="form-group">
+ <label for="active-selector">[% l('Active') %]</label>
+ <select id="active-selector" class="form-control" ng-model="record.active">
+ <option value="t">[% l('Yes') %]</option>
+ <option value="f">[% l('No') %]</option>
+ </select>
+ </div>
+ <div class="form-group">
+ <label for="state-selector">[% l('State') %]</label>
+ <select id="state-selector" class="form-control" ng-model="record.state">
+ <option value="NORMAL">[% l('Normal') %]</option>
+ <option value="LOST">[% l('Lost') %]</option>
+ <option value="LOST_AND_PAID">[% l('Lost and paid for') %]</option>
+ <option value="MISSING">[% l('Missing') %]</option>
+ <option value="DAMAGED">[% l('Damaged') %]</option>
+ <option value="CLAIMSRETURNED">[% l('Claims returned') %]</option>
+ <option value="CLAIMSNEVERCHECKEDOUT">[% l('Claims never checked out') %]</option>
+ </select>
+ </div>
+ <div class="form-group">
+ <label for="event-selector">[% l('Event') %]</label>
+ <select id="event-selector" class="form-control" ng-model="record.event">
+ <option value="CHECKIN">[% l('Checkin') %]</option>
+ <option value="CHECKOUT">[% l('Checkout') %]</option>
+ </select>
+ </div>
+ <div class="form-group">
+ <label for="select-org-unit">[% l('Scope Org Unit') %]</label>
+ <eg-org-selector selected="record.scope_org"></eg-org-selector>
+ </div>
+ <div class="form-group">
+ <label for="edit-alert-next-statuses">[% l('Next Status') %]</label>
+ <input type="text" class="form-control" focus-me='focusMe'
+ id="edit-alert-next-statuses" ng-model="record.next_status" />
+ </div>
+ <div class="form-group">
+ <label for="inrenew-selector">[% l('Renewing?') %]</label>
+ <select id="inrenew-selector" class="form-control" ng-model="record.in_renew">
+ <option value="">[% l('Any') %]</option>
+ <option value="t">[% l('Yes') %]</option>
+ <option value="f">[% l('No') %]</option>
+ </select>
+ </div>
+ <div class="form-group">
+ <label for="invert-location-selector">[% l('Invert location?') %]</label>
+ <select id="invert-location-selector" class="form-control" ng-model="record.invert_location">
+ <option value="t">[% l('Yes') %]</option>
+ <option value="f">[% l('No') %]</option>
+ </select>
+ </div>
+ <div class="form-group">
+ <label for="at-circ-selector">[% l('At Circulating Library?') %]</label>
+ <select id="at-circ-selector" class="form-control" ng-model="record.at_circ">
+ <option value="">[% l('Do not care') %]</option>
+ <option value="t">[% l('Yes') %]</option>
+ <option value="f">[% l('No') %]</option>
+ </select>
+ </div>
+ <div class="form-group">
+ <label for="at-owning-selector">[% l('At Owning Library?') %]</label>
+ <select id="at-owning-selector" class="form-control" ng-model="record.at_owning">
+ <option value="">[% l('Do not care') %]</option>
+ <option value="t">[% l('Yes') %]</option>
+ <option value="f">[% l('No') %]</option>
+ </select>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <input type="submit" ng-disabled="form.$invalid"
+ class="btn btn-primary" value="[% l('Save') %]"/>
+ <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
+ </div>
+ </div> <!-- modal-content -->
+</form>
$routeProvider.when('/admin/local/config/copy_alert_types', {
templateUrl: './admin/local/t_grid_editor',
controller: 'AutoGridEditorCtl',
- fmBase: 'ccat'
+ fmBase: 'ccat',
+ createEditPrefetch: {
+ ccs : { id : {'!=' : null} }
+ },
+ createEditOrgExpand: ['scope_org'],
+ createEditNullableBool : ['in_renew', 'at_circ', 'at_owning']
});
$routeProvider.when('/admin/local/actor/copy_alert_suppress', {
$scope.baseFmClass = $route.current.$$route.fmBase;
$scope.createEditPrefetch = $route.current.$$route.createEditPrefetch || {};
$scope.createEditOrgExpand = $route.current.$$route.createEditOrgExpand || [];
+ $scope.createEditNullableBool = $route.current.$$route.createEditNullableBool || [];
$scope.gridControls = {
setQuery : function(q) {
if (q) query = q;
newRec[key](val);
}
});
+ angular.forEach($scope.createEditNullableBool, function(nb_field) {
+ if (!(record[nb_field] == null) && record[nb_field] == "")
+ newRec[nb_field](null);
+ });
return egCore.pcrud.create(newRec);
}).then(function(){
$scope.gridControls.refresh();
openCreateEditDialog(items[0].id).result.then(function(record) {
var editedRec = new egCore.idl[$scope.baseFmClass]();
angular.forEach(record, function(val, key) {
- if (typeof(val) === 'object') {
+ if (angular.isObject(val)) {
editedRec[key](val.id());
} else {
editedRec[key](val);
}
});
+ angular.forEach($scope.createEditNullableBool, function(nb_field) {
+ if (!(record[nb_field] == null) && record[nb_field] == "")
+ editedRec[nb_field](null);
+ });
return egCore.pcrud.update(editedRec);
}).then(function(){
$scope.gridControls.refresh();