Skip to content

Commit

Permalink
feat(web-office): add modal order users
Browse files Browse the repository at this point in the history
ref:MANAGER-16713

Signed-off-by: stif59100 <[email protected]>
  • Loading branch information
stif59100 committed Feb 3, 2025
1 parent c33056a commit 72f53d6
Show file tree
Hide file tree
Showing 26 changed files with 502 additions and 62 deletions.
12 changes: 6 additions & 6 deletions packages/manager/apps/web-office/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
"dependencies": {
"@hookform/resolvers": "^3.3.4",
"@ovh-ux/manager-config": "^8.0.2",
"@ovh-ux/manager-core-api": "^0.9.0",
"@ovh-ux/manager-core-api": "^0.10.0",
"@ovh-ux/manager-core-utils": "^0.3.0",
"@ovh-ux/manager-module-order": "^0.9.3",
"@ovh-ux/manager-module-order": "^0.9.4",
"@ovh-ux/manager-react-components": "^2.7.1",
"@ovh-ux/manager-react-core-application": "^0.11.5",
"@ovh-ux/manager-react-core-application": "^0.11.6",
"@ovh-ux/manager-react-shell-client": "^0.8.5",
"@ovh-ux/manager-tailwind-config": "^0.2.1",
"@ovh-ux/request-tagger": "^0.4.0",
"@ovh-ux/shell": "^4.1.2",
"@ovhcloud/ods-components": "^18.4.1",
"@ovhcloud/ods-themes": "^18.4.1",
"@ovh-ux/shell": "^4.1.3",
"@ovhcloud/ods-components": "^18.5.0",
"@ovhcloud/ods-themes": "^18.5.0",
"@tanstack/react-query": "^5.51.21",
"@tanstack/react-table": "^8.20.1",
"element-internals-polyfill": "^1.3.10",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"dashboard_users_order_users_lastname_label": "Nom",
"dashboard_users_order_users_firstname_label": "Prénom",
"dashboard_users_order_users_login_label": "Identifiant",
"dashboard_users_order_users_type": "Type de licence",
"dashboard_users_order_users_type_placeholder": "Sélectionner",
"dashboard_users_order_users_price": "Prix",
"dashboard_users_order_users_message": "Vous serez facturé sur le nombre de licences activées dans le mois en cours.",
"dashboard_users_order_users_message_error": "Une erreur s'est produite lors de la récupération des informations. {{error}}",
"dashboard_users_order_users_message_success": "Votre demande d'ajout d'utilisateur a bien été pris en compte."
}

This file was deleted.

This file was deleted.

1 change: 1 addition & 0 deletions packages/manager/apps/web-office/src/api/_mock_/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './license';
export * from './user';
export * from './order';
export * from './price';
5 changes: 5 additions & 0 deletions packages/manager/apps/web-office/src/api/_mock_/price.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const priceMock = {
text: '7.99 €',
value: 7.99,
currencyCode: 'EUR',
};
2 changes: 2 additions & 0 deletions packages/manager/apps/web-office/src/api/_mock_/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ export const pendingTask: PendingTaskType = {
status: TaskStatusEnum.TODO,
todoDate: '2025-01-09T11:20:52+01:00',
};

export const userDomainMock = ['test.office.ovh.com'];
10 changes: 10 additions & 0 deletions packages/manager/apps/web-office/src/api/api.type.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { OvhSubsidiary } from '@ovh-ux/manager-react-components';

export enum UserStateEnum {
CREATING = 'creating',
DELETING = 'deleting',
Expand Down Expand Up @@ -26,6 +28,14 @@ export type UserParamsType = {
firstName: string;
lastName: string;
};
export type UserOrderParamsType = {
domain: string;
firstName: string;
lastName: string;
usageLocation: OvhSubsidiary;
licence: string;
login: string;
};

export type UserChangePasswordType = {
password?: string;
Expand Down
1 change: 0 additions & 1 deletion packages/manager/apps/web-office/src/api/order/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { OvhSubsidiary } from '@ovh-ux/manager-react-components';
import { order } from './type';

// GET

export const getOrderCatalog = async ({
ovhSubsidiary,
productName,
Expand Down
5 changes: 5 additions & 0 deletions packages/manager/apps/web-office/src/api/order/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ export enum OfficePrepaidPlanCodes {
OFFICE_365_ENTERPRISE = 'microsoft-365-apps-for-enterprise-pp-nce',
}

export enum OfficeUserEnum {
OFFICE_365_BUSINESS = 'officeBusiness',
OFFICE_365_PRO_PLUS = 'officeProPlus',
}

/* eslint-disable @typescript-eslint/no-namespace */
export namespace order {
export namespace cart {
Expand Down
12 changes: 12 additions & 0 deletions packages/manager/apps/web-office/src/api/price/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { v6 } from '@ovh-ux/manager-core-api';

// GET

export const getOfficePrice = async ({
officeName,
}: {
officeName: string;
}) => {
const { data } = await v6.get(`/price/license/office/${officeName}`);
return data;
};
2 changes: 2 additions & 0 deletions packages/manager/apps/web-office/src/api/price/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './api';
export * from './key';
7 changes: 7 additions & 0 deletions packages/manager/apps/web-office/src/api/price/key.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const getOfficePriceQueryKey = (officeName: string) => [
'get',
'price',
'license',
'office',
officeName,
];
22 changes: 20 additions & 2 deletions packages/manager/apps/web-office/src/api/users/api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { fetchIcebergV6, v6 } from '@ovh-ux/manager-core-api';
import { getApiPath } from '../utils/apiPath';
import { UserChangePasswordType, UserParamsType } from '../api.type';
import {
UserChangePasswordType,
UserOrderParamsType,
UserParamsType,
} from '../api.type';
import { UserNativeType } from './type';
import { useOfficeServiceType } from '@/hooks';

Expand All @@ -15,7 +19,10 @@ export const getOfficeUsers = async (
});
return data;
};

export const getOfficeUsersDomain = async (serviceName: string) => {
const { data } = await v6.get(`${getApiPath(serviceName)}domain`);
return data?.length > 0 ? data[0] : null;
};
export const getOfficeUserDetail = async (
serviceName: string,
activationEmail: string,
Expand Down Expand Up @@ -43,6 +50,17 @@ export const postUsersPassword = async (
const { data } = await v6.post(endpoint, params);
return data;
};
export const postOrderUsers = async (
serviceName: string,
params: UserOrderParamsType,
) => {
const { data } = await v6.post(`/license/office/${serviceName}/user`, {
params,
usageLocation: params.usageLocation.toLowerCase(),
});
return data;
};

// PUT

export const putOfficeUserDetail = async (
Expand Down
8 changes: 8 additions & 0 deletions packages/manager/apps/web-office/src/api/users/key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,11 @@ export const getOfficeUserDetailQueryKey = (
serviceName: string,
activationEmail: string,
) => ['get', 'license', 'office', serviceName, 'user', activationEmail];

export const getOfficeUserDomainQueryKey = (serviceName: string) => [
'get',
'license',
'office',
serviceName,
'domain',
];
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export default function DashboardPage() {
title: serviceName,
headerButton: <GuideButton items={guideItems} />,
};

return (
<BaseLayout
breadcrumb={<Breadcrumb />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export default function ModalOrderLicenses() {
}
max={300}
min={1}
className="ml-10"
/>
)}
/>
Expand Down
Loading

0 comments on commit 72f53d6

Please sign in to comment.