Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/frontend/app/components/program-year/new.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ export default class ProgramYearNewComponent extends Component {
return findBy(this.availableAcademicYears, 'value', this.year);
}

get noAvailableYears() {
return !this.selectedYear;
}

saveNewYear = task({ drop: true }, async () => {
await this.args.save(this.selectedYear.value);
});
Expand Down Expand Up @@ -92,6 +96,12 @@ export default class ProgramYearNewComponent extends Component {
<button
type="button"
class="done text"
title={{if
this.noAvailableYears
(t "general.canNotCreateProgramYear")
(t "general.done")
}}
disabled={{this.noAvailableYears}}
{{on "click" (perform this.saveNewYear)}}
data-test-done
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,12 @@

.buttons {
@include m.ilios-form-buttons;

button:disabled {
background-color: var(--grey);
border-color: var(--grey);
color: var(--white);
cursor: default;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,28 @@ module('Acceptance | Program - ProgramYear List', function (hooks) {
assert.ok(page.programYears.items[0].canBeRemoved);
assert.notOk(page.programYears.items[1].canBeRemoved);
});

test('save button disabled if no available academic years #7168', async function (assert) {
const currentYear = DateTime.now().year;
const programYear = await this.server.create('program-year', {
program: this.program,
startYear: currentYear,
});
await this.server.create('cohort', { programYear });
await this.server.createList('program-year-objective', 2, { programYear });
const ancestor = await this.server.create('program-year-objective');
await this.server.create('program-year-objective', { programYear, ancestor });
await page.visit({ programId: this.program.id });

await page.programYears.expandCollapse.toggle();
assert.strictEqual(page.programYears.newProgramYear.years.options.length, 10);

for (let i = 0; i < page.programYears.newProgramYear.years.options.length - 1; i++) {
assert.notOk(page.programYears.newProgramYear.done.isDisabled);
await page.programYears.newProgramYear.done.click();
await page.programYears.expandCollapse.toggle();
}

assert.ok(page.programYears.newProgramYear.done.isDisabled);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const definition = {
},
done: {
scope: '[data-test-done]',
isDisabled: property('disabled'),
},
cancel: {
scope: '[data-test-cancel]',
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/translations/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ general:
bad: Bad
badCredentials: Incorrect username or password
campusId: Campus ID
canNotCreateProgramYear: "Program year cannot be created because there are no more available academic years."
canNotContinueWithInvalidRecords: "Cannot continue with these invalid records, please fix and re-upload the file."
canNotDeleteCourse: This course cannot be deleted because it is published, scheduled, has been rolled over, or you do not have permission.
canNotDeleteCurriculumInventoryReport: This curriculum inventory report cannot be deleted because you do not have permission.
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/translations/es.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ general:
bad: Malo
badCredentials: Incorrecta contraseña o nombre de usuario
campusId: Campus ID
canNotCreateProgramYear: "No se puede crear un año del programa porque no hay más años académicos disponibles."
canNotContinueWithInvalidRecords: "No se puede continuar con estos registros no válidos, por favor, corrija y vuelva a subir el archivo."
canNotDeleteCourse: "Este curso no se puede eliminar porque está publicado, programado, tiene elementos dependientes, o no tiene permiso."
canNotDeleteCurriculumInventoryReport: "Este informe de inventario de plan de estudios no se puede eliminar porque no tiene permiso."
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/translations/fr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ general:
bad: Mal
badCredentials: "Nom d'utilisateur ou mot de passe incorrect"
campusId: Campus ID
canNotCreateProgramYear: "Année de programme ne peut être créé car il n'y a plus d'années universitaires disponibles."
canNotContinueWithInvalidRecords: "Ne peut pas continuer avec ces rapports invalides, fixez s'il vous plaît et retéléchargez le fichier."
canNotDeleteCourse: "Ce cours ne peut pas être supprimé car il est publié, planifié, a des éléments associés ou vous n’avez pas la permission."
canNotDeleteCurriculumInventoryReport: "Ce rapport d'inventaire des programmes d'études ne peut pas être supprimé car vous n’avez pas la permission."
Expand Down
Loading