@@ -96,7 +96,7 @@ const props = defineProps({
96
96
},
97
97
});
98
98
99
- const emit = defineEmits ([' change' , ' set-errors' , ' set' ]);
99
+ const emit = defineEmits ([' change' , ' set-errors' , ' set' , ' set-field-required ' ]);
100
100
const {t } = useLocalize ();
101
101
102
102
const availableIssues = ref ([]);
@@ -184,12 +184,11 @@ const showIssueDropdown = computed(() => {
184
184
return option? .isPublished !== null ;
185
185
});
186
186
187
- // TODO : need it ?
188
- // dynamic isRequired based on selection and props.isRequired
187
+ // dynamic isRequired based on selection and `props.isRequired`
189
188
const isIssueSelectionRequired = computed (() => {
190
- // Only require issue selection if:
191
- // 1. The field is marked as required (from PHP or JS)
192
- // 2. AND the selected assignment type actually requires an issue (isPublished !== null)
189
+ // we are only going to require issue selection if:
190
+ // 1. The field is marked as required (from PHP or JS)
191
+ // 2. AND the selected assignment type actually requires an issue (isPublished !== null)
193
192
const selectedOption = assignmentOptions .value .find (
194
193
(opt ) => opt .value === selectedAssignmentType .value ,
195
194
);
@@ -204,8 +203,6 @@ const shouldFetchPublishedIssues = computed(() => {
204
203
return option? .isPublished ;
205
204
});
206
205
207
- // TODO : need this ?
208
- // better validation logic
209
206
const isValid = computed (() => {
210
207
// If no assignment type selected, not valid
211
208
if (! selectedAssignmentType .value ) {
@@ -232,18 +229,13 @@ const publicationStatus = computed(() => {
232
229
return option? .status || null ;
233
230
});
234
231
235
- // TODO : need this ?
236
232
// validation error messages
237
233
const validationErrors = computed (() => {
238
234
if (! isValid .value ) {
239
235
// If assignment type requires issue but none selected
240
236
if (isIssueSelectionRequired .value && ! selectedIssueId .value ) {
241
237
return [t (' publication.assignToIssue.validation.issueRequired' )];
242
238
}
243
- // If no assignment type selected
244
- if (! selectedAssignmentType .value ) {
245
- return [t (' publication.assignToIssue.validation.assignmentRequired' )];
246
- }
247
239
}
248
240
return [];
249
241
});
@@ -263,7 +255,7 @@ watch(
263
255
selectedAssignmentType,
264
256
() => {
265
257
// Trigger validation update when assignment type changes
266
- // This ensures validationErrors computed property updates
258
+ // which ensures validationErrors computed property updates
267
259
},
268
260
{immediate: true },
269
261
);
@@ -292,15 +284,8 @@ const onIssueChange = (fieldName, propName, newValue) => {
292
284
const emitValue = () => {
293
285
if (props .isPhpForm ) {
294
286
if (assignmentOptions .value .length > 0 ) {
295
- // TODO: Remove this after testing
296
- // console.log('PHP Form - Emitting issueId, updating hiddenFields:', {
297
- // issueId: selectedIssueId.value, // User's issue selection
298
- // assignmentType: selectedAssignmentType.value, // User's assignment type selection
299
- // publicationStatus: publicationStatus.value, // Calculated status from user's selection
300
- // });
301
-
302
- emit (' change' , ' issueId' , ' value' , selectedIssueId .value );
303
- emit (' change' , ' prePublishStatus' , ' value' , publicationStatus .value );
287
+ emit (' change' , props .name , ' value' , selectedIssueId .value );
288
+ emit (' change' , ' status' , ' value' , publicationStatus .value );
304
289
}
305
290
} else {
306
291
const value = {
@@ -310,16 +295,6 @@ const emitValue = () => {
310
295
isValid: isValid .value ,
311
296
};
312
297
313
- // TODO: Remove this after testing
314
- // console.log('Vue Form - FieldIssueSelection emitting:', {
315
- // name: props.name,
316
- // formId: props.formId,
317
- // value: value,
318
- // assignmentType: selectedAssignmentType.value, // User's selection
319
- // selectedIssueId: selectedIssueId.value, // User's selection
320
- // publicationStatus: publicationStatus.value, // Calculated status
321
- // });
322
-
323
298
emit (' change' , props .name , ' value' , value);
324
299
}
325
300
};
@@ -405,10 +380,10 @@ watch(
405
380
406
381
emitValue (); // emit the value change
407
382
},
408
- {immediate: false }, // not run immediately since we handle it in onMounted
383
+ {immediate: false }, // not run immediately since it's been handled in onMounted
409
384
);
410
385
411
- // ✅ NEW: Function to emit initial required state
386
+ // emit initial required state
412
387
const emitInitialRequiredState = () => {
413
388
// Determine if field is currently required based on initial values
414
389
let isCurrentlyRequired = true ; // Default to required
@@ -453,12 +428,13 @@ onMounted(async () => {
453
428
.pkpFormGroup -- issueSelection {
454
429
border: 1px solid #ddd;
455
430
border- radius: 2px ;
431
+ padding- left: 0rem ;
432
+ padding- right: 0rem ;
456
433
457
434
.pkpFormGroup__heading {
458
- border- bottom: 1px solid #ddd;
435
+ border- bottom: 0 . 1rem solid #ddd;
459
436
margin: - 2rem 0rem 2rem 0rem ;
460
- padding: 1 .5rem 0rem 2rem 0rem ;
461
- border- radius: 4px 4px 0 0 ;
437
+ padding: 1 .5rem 2rem 2rem 2rem ;
462
438
float: none;
463
439
width: 100 % ;
464
440
padding- inline- end: 2rem ;
@@ -468,6 +444,8 @@ onMounted(async () => {
468
444
float: none;
469
445
width: 100 % ;
470
446
padding- inline- start: 0 ;
447
+ padding- left: 2rem ! important;
448
+ padding- right: 2rem ! important;
471
449
472
450
> * + * {
473
451
margin- top: 1 .5rem ;
0 commit comments