@@ -11,117 +11,91 @@ export class slspRefineJournalRequestController {
1111
1212
1313 $doCheck ( ) {
14- this . parentCtrl = this . afterCtrl . parentCtrl ;
15-
16- let isRefined = this . parentCtrl . _refined ;
17- let isPhysicalForm = this . parentCtrl . openphysicalform . openPhysicalForm ;
18- let isPhysicalJournal = this . parentCtrl . isPhysicalJournal ( ) ;
19- let refineOfferDisabled = this . parentCtrl . _refineOfferDisabled ;
20- let volumeData = this . parentCtrl . formData . myVolume ;
21- let noteData = this . parentCtrl . formData . myNote ;
22- let publicationData = this . parentCtrl . formData . myPublicationDate ;
23- // Prüfen, ob #physicalGetItRequest die Klasse no-best-offer hat
24- const physicalGetItRequestElem = document . querySelector ( '#physicalGetItRequest' ) ;
25- const hasNoBestOfferClass = physicalGetItRequestElem && physicalGetItRequestElem . classList . contains ( 'no-best-offer' ) ;
26-
27-
28- // console.log('openphysicalform', this.parentCtrl.openphysicalform.openPhysicalForm);
29- // console.log('parentCtrl', this.parentCtrl);
30- // console.log('volumeData', volumeData);
31- // console.log('_refineOfferDisabled)', this.parentCtrl._refineOfferDisabled);
32-
33- /* console.log('_refined', this.parentCtrl._refined);
34- console.log('sendDisabled', this.parentCtrl.sendDisabled());
35-
36- */
37-
38- // console.log('isPhysicalJournal', this.parentCtrl.isPhysicalJournal());
39- //
40- // console.log('_refineOfferInProgress', this.parentCtrl._refineOfferInProgress);
41- // console.log('_isPhysicalJournalFormValid',this.parentCtrl._isPhysicalJournalFormValid);
42- // console.log('isJournal',this.parentCtrl.isJournal());
43- // console.log('isdigitaloffer',this.parentCtrl.isdigitaloffer);
44- // console.log('getNoOfferOfferDetails',this.parentCtrl.getNoOfferOfferDetails());
45- //console.log('formData:',this.parentCtrl.formData);
46- //console.log('requestSubmitted:',this.parentCtrl._requestSubmitted);
47-
48- if ( isPhysicalJournal && isPhysicalForm ) {
49- if ( ! publicationData ) {
50- this . disableRefineButton ( ) ;
51- } else {
52- this . enableRefineButton ( ) ;
53- }
54- if (
55- ( this . _lastVolumeData !== undefined && this . _lastVolumeData !== volumeData ) ||
56- ( this . _lastPublicationData !== undefined && this . _lastPublicationData !== publicationData )
57- ) {
58- this . parentCtrl . _refined = false ;
59- }
60- this . _lastVolumeData = volumeData ;
61- this . _lastPublicationData = publicationData ;
62-
63- this . parentCtrl . noteField . label = 'customized.journal.note' ;
64-
65- // Button-Handler nur einmal registrieren
66- if ( ! this . _submitHandlerRegistered ) {
67- const submitBtn = document . querySelector ( 'button.button-with-icon.button-confirm' ) ;
68- if ( submitBtn ) {
69- submitBtn . addEventListener ( 'click' , ( event ) => {
70- // Mische publicationData und noteData vor dem Absenden
71- let publicationData = this . parentCtrl . formData . myPublicationDate ;
72- let noteData = this . parentCtrl . formData . myNote ;
73- let currentNote = noteData || '' ;
74- let alreadyCombined = currentNote . includes ( publicationData ) ;
75- let combinedNote = '' ;
76- if ( ! alreadyCombined ) {
77- if ( publicationData && noteData ) {
78- combinedNote = publicationData + ' | ' + noteData ;
79- } else if ( publicationData ) {
80- combinedNote = publicationData ;
81- } else if ( noteData ) {
82- combinedNote = noteData ;
83- }
84- this . parentCtrl . formData . myNote = combinedNote ;
85- }
86- } , true ) ; // Capture-Phase
87- this . _submitHandlerRegistered = true ;
88- }
89- }
90-
91- if ( ! isRefined || hasNoBestOfferClass || refineOfferDisabled ) {
92- this . disableRequestButton ( ) ;
93- } else {
94- this . enableRequestButton ( ) ;
95- }
96-
97- let resetButton = angular . element ( document . querySelector ( 'span[translate="nui.reset"]' ) ) ;
98- if ( resetButton && resetButton . parent ( ) ) {
99- resetButton . parent ( ) . addClass ( 'hidden' ) ;
100- }
101- let getItNgrs = angular . element ( document . querySelector ( 'div.getItNgrs' ) ) ;
102- getItNgrs . addClass ( 'physical-journal' ) ;
103-
104- //console.log('podID:', this.parentCtrl._bestOffer.podId);
105-
106- /* reading room POD */
107- if ( this . parentCtrl . _bestOffer !== undefined && this . parentCtrl . _bestOffer . podId == '452167832730000041' ||
108- this . parentCtrl . _bestOffer !== undefined && this . parentCtrl . _bestOffer . podId == '452167827350000041' ||
109- this . parentCtrl . _bestOffer !== undefined && this . parentCtrl . _bestOffer . podId == '452497325370000041' ||
110- this . parentCtrl . _bestOffer !== undefined && this . parentCtrl . _bestOffer . podId == '452497929300000041' ||
111- this . parentCtrl . _bestOffer !== undefined && this . parentCtrl . _bestOffer . podId == '452084165700000041' ||
112- this . parentCtrl . _bestOffer !== undefined && this . parentCtrl . _bestOffer . podId == '529457897220000041' ) {
113-
114- let pickupInfo = document . querySelectorAll ( 'prm-service-ngrs' ) ;
115- angular . element ( pickupInfo ) . addClass ( 'reading-room' ) ;
116-
117- }
14+ this . parentCtrl = this . afterCtrl . parentCtrl ;
15+
16+ let isRefined = this . parentCtrl . _refined ;
17+ let isPhysicalForm = this . parentCtrl . openphysicalform . openPhysicalForm ;
18+ let isPhysicalJournal = this . parentCtrl . isPhysicalJournal ( ) ;
19+ let refineOfferDisabled = this . parentCtrl . _refineOfferDisabled ;
20+ let volumeData = this . parentCtrl . formData . myVolume ;
21+ let noteData = this . parentCtrl . formData . myNote ;
22+ let publicationData = this . parentCtrl . formData . myPublicationDate ;
23+ // Prüfen, ob #physicalGetItRequest die Klasse no-best-offer hat
24+ const physicalGetItRequestElem = document . querySelector ( '#physicalGetItRequest' ) ;
25+ const hasNoBestOfferClass = physicalGetItRequestElem && physicalGetItRequestElem . classList . contains ( 'no-best-offer' ) ;
26+
27+
28+ // console.log('openphysicalform', this.parentCtrl.openphysicalform.openPhysicalForm);
29+ // console.log('parentCtrl', this.parentCtrl);
30+ // console.log('volumeData', volumeData);
31+ // console.log('_refineOfferDisabled)', this.parentCtrl._refineOfferDisabled);
32+
33+ /* console.log('_refined', this.parentCtrl._refined);
34+ console.log('sendDisabled', this.parentCtrl.sendDisabled());
35+
36+ */
37+
38+ // console.log('isPhysicalJournal', this.parentCtrl.isPhysicalJournal());
39+ //
40+ // console.log('_refineOfferInProgress', this.parentCtrl._refineOfferInProgress);
41+ // console.log('_isPhysicalJournalFormValid',this.parentCtrl._isPhysicalJournalFormValid);
42+ // console.log('isJournal',this.parentCtrl.isJournal());
43+ // console.log('isdigitaloffer',this.parentCtrl.isdigitaloffer);
44+ // console.log('getNoOfferOfferDetails',this.parentCtrl.getNoOfferOfferDetails());
45+ //console.log('formData:',this.parentCtrl.formData);
46+ //console.log('requestSubmitted:',this.parentCtrl._requestSubmitted);
47+
48+ if ( isPhysicalJournal && isPhysicalForm ) {
49+ if ( ! publicationData ) {
50+ this . disableRefineButton ( ) ;
51+ } else {
52+ this . enableRefineButton ( ) ;
11853 }
119- // neue Bedingung für Bücher
120- if ( ! isPhysicalJournal && isPhysicalForm ) {
121- let getItNgrs = angular . element ( document . querySelector ( 'div.getItNgrs' ) ) ;
122- getItNgrs . addClass ( 'physical-book' ) ;
54+ if (
55+ ( this . _lastVolumeData !== undefined && this . _lastVolumeData !== volumeData ) ||
56+ ( this . _lastPublicationData !== undefined && this . _lastPublicationData !== publicationData )
57+ ) {
58+ this . parentCtrl . _refined = false ;
12359 }
60+ this . _lastVolumeData = volumeData ;
61+ this . _lastPublicationData = publicationData ;
12462
63+ this . parentCtrl . noteField . label = 'customized.journal.note' ;
64+
65+
66+ if ( ! isRefined || hasNoBestOfferClass || refineOfferDisabled ) {
67+ this . disableRequestButton ( ) ;
68+ } else {
69+ this . enableRequestButton ( ) ;
70+ }
71+
72+ let resetButton = angular . element ( document . querySelector ( 'span[translate="nui.reset"]' ) ) ;
73+ if ( resetButton && resetButton . parent ( ) ) {
74+ resetButton . parent ( ) . addClass ( 'hidden' ) ;
75+ }
76+ let getItNgrs = angular . element ( document . querySelector ( 'div.getItNgrs' ) ) ;
77+ getItNgrs . addClass ( 'physical-journal' ) ;
78+
79+ //console.log('podID:', this.parentCtrl._bestOffer.podId);
80+
81+ /* reading room POD */
82+ if ( this . parentCtrl . _bestOffer !== undefined && this . parentCtrl . _bestOffer . podId == '452167832730000041' ||
83+ this . parentCtrl . _bestOffer !== undefined && this . parentCtrl . _bestOffer . podId == '452167827350000041' ||
84+ this . parentCtrl . _bestOffer !== undefined && this . parentCtrl . _bestOffer . podId == '452497325370000041' ||
85+ this . parentCtrl . _bestOffer !== undefined && this . parentCtrl . _bestOffer . podId == '452497929300000041' ||
86+ this . parentCtrl . _bestOffer !== undefined && this . parentCtrl . _bestOffer . podId == '452084165700000041' ||
87+ this . parentCtrl . _bestOffer !== undefined && this . parentCtrl . _bestOffer . podId == '529457897220000041' ) {
88+
89+ let pickupInfo = document . querySelectorAll ( 'prm-service-ngrs' ) ;
90+ angular . element ( pickupInfo ) . addClass ( 'reading-room' ) ;
91+
92+ }
93+ }
94+ // neue Bedingung für Bücher
95+ if ( ! isPhysicalJournal && isPhysicalForm ) {
96+ let getItNgrs = angular . element ( document . querySelector ( 'div.getItNgrs' ) ) ;
97+ getItNgrs . addClass ( 'physical-book' ) ;
98+ }
12599
126100 }
127101
0 commit comments