diff --git a/e2e/command-palette.spec.ts b/e2e/command-palette.spec.ts index 535a4900..85f5ec3f 100644 --- a/e2e/command-palette.spec.ts +++ b/e2e/command-palette.spec.ts @@ -348,7 +348,7 @@ test.describe('Command Palette', () => { const newOrgName = 'TestOrg' + Math.floor(Math.random() * 10000); // Create a new organization - await page.goto(PLAYWRIGHT_BASE_URL + '/teams/create'); + await page.goto(PLAYWRIGHT_BASE_URL + '/organizations/create'); await page.getByLabel('Organization Name').fill(newOrgName); await page.getByRole('button', { name: 'Create' }).click(); @@ -393,7 +393,7 @@ test.describe('Command Palette', () => { const newOrgName = 'GroupTestOrg' + Math.floor(Math.random() * 10000); // Create a new organization to ensure we have multiple - await page.goto(PLAYWRIGHT_BASE_URL + '/teams/create'); + await page.goto(PLAYWRIGHT_BASE_URL + '/organizations/create'); await page.getByLabel('Organization Name').fill(newOrgName); await page.getByRole('button', { name: 'Create' }).click(); await expect(page.getByTestId('dashboard_view')).toBeVisible({ timeout: 10000 }); diff --git a/e2e/organization.spec.ts b/e2e/organization.spec.ts index e8cd5029..d1b6f367 100644 --- a/e2e/organization.spec.ts +++ b/e2e/organization.spec.ts @@ -414,7 +414,7 @@ test('test that format settings persist after page reload', async ({ page }) => test.describe('Organization Create, Delete & Switch', () => { async function createOrganization(page, name: string) { - await page.goto(PLAYWRIGHT_BASE_URL + '/teams/create'); + await page.goto(PLAYWRIGHT_BASE_URL + '/organizations/create'); await page.getByLabel('Organization Name').fill(name); await Promise.all([ page.waitForResponse( @@ -440,7 +440,7 @@ test.describe('Organization Create, Delete & Switch', () => { }); test('does not create an organization when the name is empty', async ({ page }) => { - await page.goto(PLAYWRIGHT_BASE_URL + '/teams/create'); + await page.goto(PLAYWRIGHT_BASE_URL + '/organizations/create'); // The form posts to the API, which rejects the empty name with a 422. await Promise.all([ @@ -454,8 +454,7 @@ test.describe('Organization Create, Delete & Switch', () => { ]); // Validation failed, so we stay on the create form and never reach a - // dashboard. ('/teams/create' redirects to '/organizations/create', so - // assert on the form rather than the URL.) + // dashboard. Assert on the form rather than the URL. await expect(page.getByText('Organization Details')).toBeVisible(); await expect(page.getByRole('alert')).toContainText('The name field is required.'); await expect(page.getByLabel('Organization Name')).toHaveAttribute('aria-invalid', 'true'); @@ -532,7 +531,7 @@ test.describe('Organization Create, Delete & Switch', () => { test.describe('Admin Organization Settings Access', () => { test('admin can see and edit organization settings', async ({ ctx, admin }) => { - await admin.page.goto(PLAYWRIGHT_BASE_URL + '/teams/' + ctx.orgId); + await admin.page.goto(PLAYWRIGHT_BASE_URL + '/organizations/' + ctx.orgId); // Organization Name section is visible await expect( @@ -569,7 +568,7 @@ test.describe('Admin Organization Settings Access', () => { test.describe('Employee Organization Settings Restrictions', () => { test('employee can see org name but not editable settings', async ({ ctx, employee }) => { - await employee.page.goto(PLAYWRIGHT_BASE_URL + '/teams/' + ctx.orgId); + await employee.page.goto(PLAYWRIGHT_BASE_URL + '/organizations/' + ctx.orgId); // Organization Name section is visible (but inputs are disabled) await expect( diff --git a/e2e/utils/api.ts b/e2e/utils/api.ts index aff7b5d6..dc8dd312 100644 --- a/e2e/utils/api.ts +++ b/e2e/utils/api.ts @@ -641,10 +641,13 @@ export async function updateOrganizationCurrencyViaWeb( const xsrfCookie = cookies.find((c) => c.name === 'XSRF-TOKEN'); const xsrfToken = xsrfCookie ? decodeURIComponent(xsrfCookie.value) : ''; - const response = await page.request.put(`${PLAYWRIGHT_BASE_URL}/teams/${ctx.orgId}`, { - headers: { 'X-XSRF-TOKEN': xsrfToken }, - data: { name, currency }, - }); + const response = await page.request.put( + `${PLAYWRIGHT_BASE_URL}/api/v1/organizations/${ctx.orgId}`, + { + headers: { 'X-XSRF-TOKEN': xsrfToken }, + data: { name, currency }, + } + ); expect(response.status()).toBe(200); } diff --git a/resources/js/Components/OrganizationSwitcher.vue b/resources/js/Components/OrganizationSwitcher.vue index 34b9e28a..40bd2c9d 100644 --- a/resources/js/Components/OrganizationSwitcher.vue +++ b/resources/js/Components/OrganizationSwitcher.vue @@ -61,7 +61,7 @@ const switchToTeam = (organization: Organization) => { Organization Settings @@ -74,7 +74,7 @@ const switchToTeam = (organization: Organization) => { Create new organization diff --git a/resources/js/Layouts/AppLayout.vue b/resources/js/Layouts/AppLayout.vue index ab943a39..e6584d80 100644 --- a/resources/js/Layouts/AppLayout.vue +++ b/resources/js/Layouts/AppLayout.vue @@ -280,10 +280,15 @@ const page = usePage<{ v-if="canUpdateOrganization()" title="Settings" :icon="Cog6ToothIcon" - :href="route('teams.show', page.props.auth.user.current_team.id)" + :href=" + route( + 'organizations.show', + page.props.auth.user.current_team.id + ) + " :current=" route().current( - 'teams.show', + 'organizations.show', page.props.auth.user.current_team.id ) "> diff --git a/resources/js/utils/commandPaletteCommands.ts b/resources/js/utils/commandPaletteCommands.ts index fa7e5c7b..90ff8d8b 100644 --- a/resources/js/utils/commandPaletteCommands.ts +++ b/resources/js/utils/commandPaletteCommands.ts @@ -210,7 +210,7 @@ export function createNavigationCommands( icon: Cog6ToothIcon, keywords: ['settings', 'organization', 'configuration'], group: 'navigation', - action: () => navigate('teams.show', { team: currentTeamId() }), + action: () => navigate('organizations.show', { organizationId: currentTeamId() }), permission: permissions.canUpdateOrganization, priority: GROUP_PRIORITIES.navigation - 3, }, diff --git a/resources/js/ziggy.d.ts b/resources/js/ziggy.d.ts index 51625442..e4a3d47d 100644 --- a/resources/js/ziggy.d.ts +++ b/resources/js/ziggy.d.ts @@ -114,6 +114,13 @@ declare module 'ziggy-js' { 'other-browser-sessions.destroy': []; 'current-user-photo.destroy': []; 'current-user.destroy': []; + 'organizations.create': []; + 'organizations.show': [ + { + 'name': 'organizationId'; + 'required': true; + }, + ]; 'teams.create': []; 'teams.store': []; 'teams.show': [ diff --git a/resources/js/ziggy.js b/resources/js/ziggy.js index ecd7dfcb..406ebdcd 100644 --- a/resources/js/ziggy.js +++ b/resources/js/ziggy.js @@ -197,6 +197,12 @@ const Ziggy = { 'methods': ['DELETE'], }, 'current-user.destroy': { 'uri': 'user', 'methods': ['DELETE'] }, + 'organizations.create': { 'uri': 'organizations/create', 'methods': ['GET', 'HEAD'] }, + 'organizations.show': { + 'uri': 'organizations/{organizationId}', + 'methods': ['GET', 'HEAD'], + 'parameters': ['organizationId'], + }, 'teams.create': { 'uri': 'teams/create', 'methods': ['GET', 'HEAD'] }, 'teams.store': { 'uri': 'teams', 'methods': ['POST'] }, 'teams.show': {