diff --git a/frontend/src/components/unification/Unification/LexicalUnitEdit.vue b/frontend/src/components/unification/Unification/LexicalUnitEdit.vue index cc2e375278f2f03d8edc323ff44050212df552ee..41aa644b53f8d5c95fb89447893c1421178ae386 100644 --- a/frontend/src/components/unification/Unification/LexicalUnitEdit.vue +++ b/frontend/src/components/unification/Unification/LexicalUnitEdit.vue @@ -690,14 +690,29 @@ Object.assign(LexicalUnitEdit, { alert(gettext("Wybierz ramę, dla której chcesz zmienić status.")); } }, + slowal_frame_status_change_with_confirmation(api_method) { + this.select_slowal_frame_req(() => { + const frame = this.active_slowal_frame; + $.ajax({ + type: 'post', + url: `/${lang}/semantics/${api_method}/${frame.id}/`, + dataType: 'json', + timeout: 60000, + }).then(() => { + show_info('Status ramy został zmieniony'); + this.$emit('refreshEntriesList'); + this.loadFrame(); + }); + }); + }, change_slowal_frame_status(status) { this.select_slowal_frame_req(() => { let frame = this.active_slowal_frame; - if (status === 'B') { + if (status === 'C') { this.setup_notes_slowal_frame_with_title_and_body("Niedopasowana jednostka (identyfikator jednostki)", "Do zatwierdzenia uznanie ramy Walentego jednostek (lista jednostek)" + "za niedopasowana do zunifikowanej ramy (identyfikator) przez (Leksykograf)."); - } else if (status === 'Z') { + } else if (status === 'B') { this.setup_notes_slowal_frame_with_title_and_body("Błędna jednostka (identyfikator jednostki)", "Do zatwierdzenia uznanie ramy Walentego jednostek (lista jednostek)" + "za niedopasowana do zunifikowanej ramy (identyfikator) przez (Leksykograf)."); } @@ -926,6 +941,22 @@ Object.assign(LexicalUnitEdit, { const readyFrames = this.frames.filter(frame => frame.status == 'G'); return readyFrames.length; }, + getSlowalVerifiedFrameCnt() { + const readyFrames = this.frames.filter(frame => frame.status == 'S'); + return readyFrames.length; + }, + createSlowalVerifiedButtonLabel() { + return 'Ukryj ' +(!this.isSuperLeksykograf() ? 'gotowe' : 'sprawdzone') + + (this.showVerifiedFrames ? '' : + !this.isSuperLeksykograf() ? (this.getSlowalReadyFrameCnt() > 0 ? ' (ukrytych: ' + this.getSlowalReadyFrameCnt() + ')' : '') : + (this.getSlowalVerifiedFrameCnt() > 0 ? ' (ukrytych: ' + this.getSlowalVerifiedFrameCnt() + ')' : '')); + }, + createSlowalContestedStatusButtonLabel() { + return this.isSuperLeksykograf() ? this.active_slowal_frame && this.active_slowal_frame.status === 'C' ? 'Potwierdź niepasująca' : 'Nowa' : 'Niepasująca'; + }, + createSlowalBadStatusButtonLabel() { + return this.isSuperLeksykograf() ? this.active_slowal_frame && this.active_slowal_frame.status === 'B' ? 'Potwierdź zła' : 'Zła' : 'Błędna'; + }, frames2lexical_units(frames) { const lexical_units = [] for (let i in frames) { @@ -1257,14 +1288,14 @@ export default LexicalUnitEdit; <div :id="'semantics-slowal-frames-pane' + (readOnly ? '-preview' : '')" class="col w-100 p-0 overflow-auto"> <table v-if="!readOnly && unified_frame.id && !isReadOnlyForSuperLeksykograf()" class="table-button-menu sticky-top" cellspacing="1"> <tr style="background-color: white;"> - <td id="wrong-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="change_slowal_frame_status('B')">{{this.isSuperLeksykograf() ? 'Zła' : 'Błędna'}}</td> - <td id="hide-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="changeShowVerifiedFrames(false)">Ukryj gotowe {{showVerifiedFrames ? '' : getSlowalReadyFrameCnt() > 0 ? '(ukrytych: ' + getSlowalReadyFrameCnt() + ')' : ''}}</td> + <td id="wrong-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="!this.isSuperLeksykograf() ? change_slowal_frame_status('B') : slowal_frame_status_change_with_confirmation('frame_confirm_invalid')">{{createSlowalBadStatusButtonLabel()}}</td> + <td id="hide-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="changeShowVerifiedFrames(false)">{{createSlowalVerifiedButtonLabel()}}</td> <td id="ready-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="slowal_frame_ready_rollback">{{ statusButtonTitle }}</td> <td id="attach-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="attachSlowalFrame">Podepnij</td> </tr> <tr style="background-color: white;"> - <td id="inccorect-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="change_slowal_frame_status('C')"> - {{this.isSuperLeksykograf() ? 'Nowa' : 'Niepasująca'}} + <td id="inccorect-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="!this.isSuperLeksykograf() ? change_slowal_frame_status('C') : slowal_frame_status_change_with_confirmation('frame_confirm_as_not_matching_unified_frame')"> + {{createSlowalContestedStatusButtonLabel()}} </td> <td id="show-slowal-frame" style="padding: 10px 15px 10px 15px; color: #000000;" @click="changeShowVerifiedFrames(true)"> Pokaż wszystkie {{this.hidden_frames.length > 0 ? '(ukrytych: ' + this.hidden_frames.length + ')' : ''}} @@ -1273,7 +1304,7 @@ export default LexicalUnitEdit; @click="extract_frame_to_preview_frame"> Przerzuć </td> - <td v-if="this.isSuperLeksykograf()" id="reject-button" @click="frame_reject_as_not_matching_unified_frame" style="padding: 10px 15px 10px 15px; color: #000000;">Zwróć</td> + <td v-if="this.isSuperLeksykograf() && this.active_slowal_frame && (this.active_slowal_frame.status === 'B' || this.active_slowal_frame.status === 'C')" id="reject-button" @click="frame_reject_as_not_matching_unified_frame" style="padding: 10px 15px 10px 15px; color: #000000;">Zwróć</td> <td v-else id="empty-2" style="padding: 10px 15px 10px 15px; color: #000000;"></td> </tr> </table>