@@ -96,7 +96,7 @@ const props = defineProps({
9696 },
9797});
9898
99- const emit = defineEmits ([' change' , ' set-errors' , ' set' ]);
99+ const emit = defineEmits ([' change' , ' set-errors' , ' set' , ' set-field-required ' ]);
100100const {t } = useLocalize ();
101101
102102const availableIssues = ref ([]);
@@ -184,12 +184,11 @@ const showIssueDropdown = computed(() => {
184184 return option? .isPublished !== null ;
185185});
186186
187- // TODO : need it ?
188- // dynamic isRequired based on selection and props.isRequired
187+ // dynamic isRequired based on selection and `props.isRequired`
189188const 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)
193192 const selectedOption = assignmentOptions .value .find (
194193 (opt ) => opt .value === selectedAssignmentType .value ,
195194 );
@@ -204,8 +203,6 @@ const shouldFetchPublishedIssues = computed(() => {
204203 return option? .isPublished ;
205204});
206205
207- // TODO : need this ?
208- // better validation logic
209206const isValid = computed (() => {
210207 // If no assignment type selected, not valid
211208 if (! selectedAssignmentType .value ) {
@@ -232,18 +229,13 @@ const publicationStatus = computed(() => {
232229 return option? .status || null ;
233230});
234231
235- // TODO : need this ?
236232// validation error messages
237233const validationErrors = computed (() => {
238234 if (! isValid .value ) {
239235 // If assignment type requires issue but none selected
240236 if (isIssueSelectionRequired .value && ! selectedIssueId .value ) {
241237 return [t (' publication.assignToIssue.validation.issueRequired' )];
242238 }
243- // If no assignment type selected
244- if (! selectedAssignmentType .value ) {
245- return [t (' publication.assignToIssue.validation.assignmentRequired' )];
246- }
247239 }
248240 return [];
249241});
@@ -263,7 +255,7 @@ watch(
263255 selectedAssignmentType,
264256 () => {
265257 // Trigger validation update when assignment type changes
266- // This ensures validationErrors computed property updates
258+ // which ensures validationErrors computed property updates
267259 },
268260 {immediate: true },
269261);
@@ -292,15 +284,8 @@ const onIssueChange = (fieldName, propName, newValue) => {
292284const emitValue = () => {
293285 if (props .isPhpForm ) {
294286 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 );
304289 }
305290 } else {
306291 const value = {
@@ -310,16 +295,6 @@ const emitValue = () => {
310295 isValid: isValid .value ,
311296 };
312297
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-
323298 emit (' change' , props .name , ' value' , value);
324299 }
325300};
@@ -405,10 +380,10 @@ watch(
405380
406381 emitValue (); // emit the value change
407382 },
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
409384);
410385
411- // ✅ NEW: Function to emit initial required state
386+ // emit initial required state
412387const emitInitialRequiredState = () => {
413388 // Determine if field is currently required based on initial values
414389 let isCurrentlyRequired = true ; // Default to required
@@ -453,12 +428,13 @@ onMounted(async () => {
453428.pkpFormGroup -- issueSelection {
454429 border: 1px solid #ddd;
455430 border- radius: 2px ;
431+ padding- left: 0rem ;
432+ padding- right: 0rem ;
456433
457434 .pkpFormGroup__heading {
458- border- bottom: 1px solid #ddd;
435+ border- bottom: 0 . 1rem solid #ddd;
459436 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 ;
462438 float: none;
463439 width: 100 % ;
464440 padding- inline- end: 2rem ;
@@ -468,6 +444,8 @@ onMounted(async () => {
468444 float: none;
469445 width: 100 % ;
470446 padding- inline- start: 0 ;
447+ padding- left: 2rem ! important;
448+ padding- right: 2rem ! important;
471449
472450 > * + * {
473451 margin- top: 1 .5rem ;
0 commit comments