@@ -15,7 +15,6 @@ import { SubmissionObject } from '@dspace/core/submission/models/submission-obje
1515import { WorkspaceitemSectionUploadObject } from '@dspace/core/submission/models/workspaceitem-section-upload.model' ;
1616import { WorkspaceitemSectionUploadFileObject } from '@dspace/core/submission/models/workspaceitem-section-upload-file.model' ;
1717import { SubmissionJsonPatchOperationsService } from '@dspace/core/submission/submission-json-patch-operations.service' ;
18- import { VocabularyEntry } from '@dspace/core/submission/vocabularies/models/vocabulary-entry.model' ;
1918import { dateToISOFormat } from '@dspace/shared/utils/date.util' ;
2019import {
2120 hasNoValue ,
@@ -50,7 +49,6 @@ import {
5049import { DynamicCustomSwitchModel } from 'src/app/shared/form/builder/ds-dynamic-form-ui/models/custom-switch/custom-switch.model' ;
5150
5251import { BtnDisabledDirective } from '../../../../../shared/btn-disabled.directive' ;
53- import { DynamicScrollableDropdownModel } from '../../../../../shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.model' ;
5452import { FormBuilderService } from '../../../../../shared/form/builder/form-builder.service' ;
5553import { FormComponent } from '../../../../../shared/form/form.component' ;
5654import { FormService } from '../../../../../shared/form/form.service' ;
@@ -255,8 +253,6 @@ implements OnInit, OnDestroy {
255253 onChange ( event : DynamicFormControlEvent ) {
256254 if ( event . model . id === 'name' ) {
257255 this . setOptions ( event . model , event . control ) ;
258- } else if ( event . model . id === 'dc_type' ) {
259- this . hideOrShowAudioVideoMetadata ( event . model , event . control ) ;
260256 }
261257 }
262258
@@ -295,40 +291,12 @@ implements OnInit, OnDestroy {
295291 }
296292 }
297293
298- /**
299- * Shows or hides metadata fields related to audio/video accessibility based on the selected media type.
300- *
301- * The selected value can come from:
302- * - `control.value.value` when triggered by a form control change event, or
303- * - `model.value.value` when evaluated from an already initialized model (e.g. on component init).
304- *
305- * @param model - The dynamic form model for the `dc_type` field.
306- * @param control - The reactive form control that emitted the change event (can be `null` during initialization).
307- */
308- hideOrShowAudioVideoMetadata ( model : DynamicFormControlModel , control : UntypedFormControl ) {
309- const selectedMediaType = control ?. value ?. value ?? ( ( model as DynamicScrollableDropdownModel ) ?. value as unknown as VocabularyEntry ) ?. value ;
310- const shouldShowAudioMetadata = selectedMediaType ?. toLowerCase ( ) . includes ( 'audio' ) ;
311- const shouldShowVideoMetadata = selectedMediaType ?. toLowerCase ( ) . includes ( 'video' ) ;
312- const audioTranscriptModel : any = this . formBuilderService . findById ( 'dspace_bitstream_transcript' , this . formModel ) ;
313- const videoDescriptionModel : any = this . formBuilderService . findById ( 'dspace_bitstream_textalternative' , this . formModel ) ;
314- if ( audioTranscriptModel ) {
315- audioTranscriptModel . hidden = ! shouldShowAudioMetadata ;
316- }
317- if ( videoDescriptionModel ) {
318- videoDescriptionModel . hidden = ! shouldShowVideoMetadata ;
319- }
320- }
321-
322294 /**
323295 * Dispatch form model init
324296 */
325297 ngOnInit ( ) {
326298 if ( this . fileData && this . formId ) {
327299 this . formModel = this . buildFileEditForm ( ) ;
328- const mediaTypeModel : any = this . formBuilderService . findById ( 'dc_type' , this . formModel ) ;
329- if ( mediaTypeModel ) {
330- this . hideOrShowAudioVideoMetadata ( mediaTypeModel , null ) ;
331- }
332300 this . cdr . detectChanges ( ) ;
333301 }
334302 }
0 commit comments