--- /dev/null
+<div>
+ <div class="modal-header">
+ <button type="button" class="close"
+ ng-click="cancel()" aria-hidden="true">×</button>
+ <h4 class="modal-title">[% l('Edit Lead Record') %]</h4>
+ </div>
+ <div class="modal-body">
+ <eg-marc-edit-record dirty-flag="dirty_flag" record-id="record_id"
+ record-type="bre" />
+ </div>
+ <div class="modal-footer">
+ <input type="submit" ng-click="ok()"
+ class="btn btn-primary" value="[% l('Done') %]"/>
+ <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
+ </div>
+</div>
--- /dev/null
+<div>
+ <div class="modal-header">
+ <button type="button" class="close"
+ ng-click="cancel()" aria-hidden="true">×</button>
+ <h4 class="modal-title">[% l('Merge records?') %]</h4>
+ </div>
+ <div class="modal-body">
+ <div class="row">
+ <div class="col-xs-6">
+ <h4>[% l('Lead record') %]</h4>
+ <div ng-if="lead_id">
+ <button class="btn btn-default btn-sm" ng-click="edit_lead()">[% l('Edit') %]</button>
+ <eg-record-html record-id="lead_id"></eg-record-html>
+ </div>
+ <div ng-if="!lead_id">
+ [% l('Please select a lead record from the right...') %]
+ </div>
+ </div>
+ <div class="col-xs-6">
+ <h4>[% l('Records to merge into lead') %]</h4>
+ <accordion>
+ <accordion-group ng-repeat="rec in records">
+ <accordion-heading>
+ [% l('Record [_1]', '{{rec.id}}') %] <i class="pull-right glyphicon" ng-class="{'glyphicon-chevron-down': status.open, 'glyphicon-chevron-right': !status.open}"></i>
+ </accordion-heading>
+ <button class="btn btn-default btn-sm" ng-click="use_as_lead(rec)">[% l('Use as lead record') %]</button>
+ <button class="btn btn-default btn-sm" ng-click="drop(rec)">[% l('Remove from consideration') %]</button>
+ <eg-record-html record-id="rec.id"></eg-record-html>
+ </accordion-group>
+ </accordian>
+ </div>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <input type="submit" ng-click="ok()"
+ ng-class="{disabled : !lead_id || records.length < 1 }"
+ class="btn btn-primary" value="[% l('Merge') %]"/>
+ <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
+ </div>
+</div>
*/
angular.module('egCatRecordBuckets',
- ['ngRoute', 'ui.bootstrap', 'egCoreMod', 'egUiMod', 'egGridMod'])
+ ['ngRoute', 'ui.bootstrap', 'egCoreMod', 'egUiMod', 'egGridMod', 'egMarcMod'])
.config(function($routeProvider, $locationProvider, $compileProvider) {
$locationProvider.html5Mode(true);
);
}
+ // opens the record merge dialog
+ $scope.openRecordMergeDialog = function(records) {
+ $modal.open({
+ templateUrl: './cat/bucket/record/t_merge_records',
+ size: 'lg',
+ controller:
+ ['$scope', '$modalInstance', function($scope, $modalInstance) {
+ $scope.records = [];
+ $scope.lead_id = 0;
+ angular.forEach(records, function(rec) {
+ $scope.records.push({ id : rec.id });
+ });
+ $scope.ok = function() {
+ $modalInstance.close({
+ lead_id : $scope.lead_id,
+ records : $scope.records
+ });
+ }
+ $scope.cancel = function () { $modalInstance.dismiss() }
+ $scope.use_as_lead = function(rec) {
+ if ($scope.lead_id) {
+ $scope.records.push({ id : $scope.lead_id });
+ }
+ $scope.lead_id = rec.id;
+ $scope.drop(rec);
+ }
+ $scope.drop = function(rec) {
+ angular.forEach($scope.records, function(val, i) {
+ if (rec == $scope.records[i]) {
+ $scope.records.splice(i, 1);
+ }
+ });
+ }
+ $scope.edit_lead = function() {
+ var lead_id = $scope.lead_id;
+ $modal.open({
+ templateUrl: './cat/bucket/record/t_edit_lead_record',
+ size: 'lg',
+ controller:
+ ['$scope', '$modalInstance', function($scope, $modalInstance) {
+ $scope.focusMe = true;
+ $scope.record_id = lead_id;
+ $scope.dirty_flag = false;
+ $scope.ok = function() { $modalInstance.close() }
+ $scope.cancel = function () { $modalInstance.dismiss() }
+ }]
+ }).result.then(function() {
+ // TODO: need a way to force a refresh of the egRecordHtml, as
+ // the record ID does not change
+ });
+ };
+ }]
+ }).result.then(function (args) {
+ if (!args.lead_id) return;
+ if (!args.records.length) return;
+ egCore.net.request(
+ 'open-ils.cat',
+ 'open-ils.cat.biblio.records.merge',
+ egCore.auth.token(),
+ args.lead_id,
+ args.records.map(function(val) { return val.id; })
+ ).then(function() {
+ drawBucket();
+ });
+ });
+ }
+
$scope.showAllRecords = function() {
// TODO: maybe show selected would be better?
// TODO: probably want to set a limit on the number of