--- /dev/null
+<div>
+ <div class="modal-header">
+ <button type="button" class="close"
+ ng-click="cancel()" aria-hidden="true">×</button>
+ <h4 class="modal-title">[% l('Physical Characteristics Wizard') %]</h4>
+ </div>
+ <div class="modal-body">
+ <eg-physchar-wizard changed="args.changed" field="args.field"/>
+ </div>
+ <div class="modal-footer">
+ <input type="submit" ng-click="ok(args)"
+ class="btn btn-primary" value="[% l('Save') %]"/>
+ <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
+ </div>
+</div>
--- /dev/null
+<div>
+ <div class="row">
+ <div class="col-md-4">[% l('007 Value') %]</div>
+ <div class="col-md-4">{{field.data}}</div>
+ </div>
+ <div class="row">
+ <div ng-if="step == 'a'">
+ <div class="col-md-4">[% l('Category of Material') %]</div>
+ <div class="col-md-4">
+ <select ng-model="value_for_step">
+ <option ng-repeat="option in values_for_step"
+ value="{{option.ptype_key()}}">{{option.label()}}</option>
+ </select>
+ </div>
+ </div>
+ <div ng-if="step != 'a'">
+ <div class="col-md-4" ng-show="step != 'a'">{{get_label_for_step()}}</div>
+ <div class="col-md-4">
+ <select ng-model="value_for_step">
+ <option ng-repeat="option in values_for_step"
+ value="{{option.value()}}">{{option.label()}}</option>
+ </select>
+ </div>
+ </div>
+ <div class="col-md-2">
+ <button class="btn btn-default">[% l('Previous') %]</button>
+ </div>
+ <div class="col-md-2">
+ <button class="btn btn-default">[% l('Next') %]</button>
+ </div>
+ </div>
+</div>
'</div>',
scope: { field: "=", onKeydown: '=' },
controller : ['$scope','$modal',
- function ( $scope, $modal ) {
+ function ( $scope, $modal) {
$scope.showPhysCharLink = function () {
return ($scope.$parent.$parent.record_type == 'bre')
&& $scope.field.tag == '007';
}
$scope.spawnPhysCharWizard = function() {
- console.log('HERE');
+ var args = {
+ changed : false,
+ field : $scope.field
+ };
+ $modal.open({
+ templateUrl: './cat/share/t_physchar_dialog',
+ controller: ['$scope','$modalInstance',
+ function( $scope , $modalInstance) {
+ $scope.focusMe = true;
+ $scope.args = args;
+ $scope.ok = function(args) { $modalInstance.close(args) };
+ $scope.cancel = function () { $modalInstance.dismiss() };
+ }],
+ }).result.then(function (args) {
+ if (!args.changed) return;
+ // $scope.field.data = ...
+ });
+
}
}
]
}
})
+.directive("egPhyscharWizard", function () {
+ return {
+ restrict: 'E',
+ replace: true,
+ templateUrl: './cat/share/t_physchar_wizard',
+ scope : {
+ field : '='
+ },
+ controller: ['$scope','egTagTable',
+ function ($scope , egTagTable) {
+ $scope.step = 'a';
+ if ($scope.field.data) $scope.field.data = '';
+
+ $scope.value_for_step = '';
+ $scope.values_for_step = [];
+
+ egTagTable.getPhysCharTypeMap().then(function(list) {
+ // we start with the types selector
+ $scope.values_for_step = list;
+ });
+
+ $scope.current_ptype = function() {
+ return $scope.field.data.substr(0, 1);
+ }
+
+ $scope.get_label_for_step = function() {
+ return 'TEST';
+ }
+
+ $scope.get_values_for_step = function() {
+ if ($scope.step == 'a') {
+ egTagTable.getPhysCharTypeMap().then(function(list) {
+ $scope.values_for_step = list;
+ });
+ } else {
+ //
+ }
+ }
+ }
+ ]
+ }
+})
+
+
.directive("egMarcEditAuthorityBrowser", function () {
return {
restrict: 'E',
return $q.when(service.phys_char_type_map);
}
- return egCore.pcrud.retrieveAll('cmpctm')
- .then(function(map) {service.phys_char_type_map = map});
+ return egCore.pcrud.retrieveAll('cmpctm', {}, {atomic : true})
+ .then(function(map) {return service.phys_char_type_map = map});
}
// Fetch+caches the config.marc21_physical_characteristic_subfield_map
return egCore.pcrud.search('cmpcsm',
{ptype_key : ptype_key},
- {order_by : {cmpcsm : ['start_pos']}})
- .then(function(maps) {
- service.phys_char_sf_map[ptype_key] = maps;
+ {order_by : {cmpcsm : ['start_pos']}},
+ {atomic : true}
+ ).then(function(maps) {
+ return service.phys_char_sf_map[ptype_key] = maps;
});
}
return egCore.pcrud.search('cmpcvm',
{ptype_subfield : ptype_subfield},
- {order_by : {cmpcsm : ['value']}})
- .then(function(maps) {
- service.phys_char_sf_map[ptype_subfield] = maps;
+ {order_by : {cmpcsm : ['value']}},
+ {atomic : true}
+ ).then(function(maps) {
+ return service.phys_char_sf_map[ptype_subfield] = maps;
});
}