@axelor/aos-mobile-helpdesk 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -0
- package/lib/api/customer-api.d.ts +11 -0
- package/lib/api/customer-api.js +57 -0
- package/lib/api/customer-api.js.map +1 -0
- package/lib/api/helpdesk-config-api.d.ts +1 -0
- package/lib/api/helpdesk-config-api.js +23 -0
- package/lib/api/helpdesk-config-api.js.map +1 -0
- package/lib/api/project-api.d.ts +4 -0
- package/lib/api/project-api.js +31 -0
- package/lib/api/project-api.js.map +1 -0
- package/lib/api/ticket-api.d.ts +26 -0
- package/lib/api/ticket-api.js +99 -0
- package/lib/api/ticket-api.js.map +1 -0
- package/lib/api/timer-api.d.ts +6 -0
- package/lib/api/timer-api.js +44 -0
- package/lib/api/timer-api.js.map +1 -0
- package/lib/api/user-api.d.ts +4 -0
- package/lib/api/user-api.js +31 -0
- package/lib/api/user-api.js.map +1 -0
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +20 -0
- package/lib/components/index.js.map +1 -0
- package/lib/components/molecules/DurationFormInput/DurationFormInput.d.ts +8 -0
- package/lib/components/molecules/DurationFormInput/DurationFormInput.js +73 -0
- package/lib/components/molecules/DurationFormInput/DurationFormInput.js.map +1 -0
- package/lib/components/molecules/DurationFormInput/duration.helpers.d.ts +9 -0
- package/lib/components/molecules/DurationFormInput/duration.helpers.js +44 -0
- package/lib/components/molecules/DurationFormInput/duration.helpers.js.map +1 -0
- package/lib/components/molecules/ProgressFormInput/ProgressFormInput.d.ts +9 -0
- package/lib/components/molecules/ProgressFormInput/ProgressFormInput.js +31 -0
- package/lib/components/molecules/ProgressFormInput/ProgressFormInput.js.map +1 -0
- package/lib/components/molecules/TicketCard/TicketCard.d.ts +17 -0
- package/lib/components/molecules/TicketCard/TicketCard.js +87 -0
- package/lib/components/molecules/TicketCard/TicketCard.js.map +1 -0
- package/lib/components/molecules/index.d.ts +3 -0
- package/lib/components/molecules/index.js +21 -0
- package/lib/components/molecules/index.js.map +1 -0
- package/lib/components/templates/ContactPartnerSearchBar/ContactPartnerSearchBar.d.ts +15 -0
- package/lib/components/templates/ContactPartnerSearchBar/ContactPartnerSearchBar.js +56 -0
- package/lib/components/templates/ContactPartnerSearchBar/ContactPartnerSearchBar.js.map +1 -0
- package/lib/components/templates/CustomerSearchBar/CustomerSearchBar.d.ts +15 -0
- package/lib/components/templates/CustomerSearchBar/CustomerSearchBar.js +52 -0
- package/lib/components/templates/CustomerSearchBar/CustomerSearchBar.js.map +1 -0
- package/lib/components/templates/ProjectSearchBar/ProjectSearchBar.d.ts +15 -0
- package/lib/components/templates/ProjectSearchBar/ProjectSearchBar.js +52 -0
- package/lib/components/templates/ProjectSearchBar/ProjectSearchBar.js.map +1 -0
- package/lib/components/templates/TicketDropdownCards/DropdownGeneralView.d.ts +8 -0
- package/lib/components/templates/TicketDropdownCards/DropdownGeneralView.js +42 -0
- package/lib/components/templates/TicketDropdownCards/DropdownGeneralView.js.map +1 -0
- package/lib/components/templates/TicketDropdownCards/DropdownTimingView.d.ts +7 -0
- package/lib/components/templates/TicketDropdownCards/DropdownTimingView.js +46 -0
- package/lib/components/templates/TicketDropdownCards/DropdownTimingView.js.map +1 -0
- package/lib/components/templates/TicketDropdownCards/TicketDropdownCards.d.ts +2 -0
- package/lib/components/templates/TicketDropdownCards/TicketDropdownCards.js +51 -0
- package/lib/components/templates/TicketDropdownCards/TicketDropdownCards.js.map +1 -0
- package/lib/components/templates/TicketEditButton/TicketEditButton.d.ts +4 -0
- package/lib/components/templates/TicketEditButton/TicketEditButton.js +36 -0
- package/lib/components/templates/TicketEditButton/TicketEditButton.js.map +1 -0
- package/lib/components/templates/TicketHeader/TicketHeader.d.ts +2 -0
- package/lib/components/templates/TicketHeader/TicketHeader.js +75 -0
- package/lib/components/templates/TicketHeader/TicketHeader.js.map +1 -0
- package/lib/components/templates/TicketSearchBar/TicketSearchBar.d.ts +11 -0
- package/lib/components/templates/TicketSearchBar/TicketSearchBar.js +39 -0
- package/lib/components/templates/TicketSearchBar/TicketSearchBar.js.map +1 -0
- package/lib/components/templates/TicketTypeSearchBar/TicketTypeSearchBar.d.ts +15 -0
- package/lib/components/templates/TicketTypeSearchBar/TicketTypeSearchBar.js +52 -0
- package/lib/components/templates/TicketTypeSearchBar/TicketTypeSearchBar.js.map +1 -0
- package/lib/components/templates/TicketsStatusButton/TicketsStatusButton.d.ts +2 -0
- package/lib/components/templates/TicketsStatusButton/TicketsStatusButton.js +45 -0
- package/lib/components/templates/TicketsStatusButton/TicketsStatusButton.js.map +1 -0
- package/lib/components/templates/UserSearchBar/UserSearchBar.d.ts +15 -0
- package/lib/components/templates/UserSearchBar/UserSearchBar.js +53 -0
- package/lib/components/templates/UserSearchBar/UserSearchBar.js.map +1 -0
- package/lib/components/templates/index.d.ts +10 -0
- package/lib/components/templates/index.js +28 -0
- package/lib/components/templates/index.js.map +1 -0
- package/lib/features/customerSlice.d.ts +41 -0
- package/lib/features/customerSlice.js +85 -0
- package/lib/features/customerSlice.js.map +1 -0
- package/lib/features/helpdeskConfigSlice.d.ts +14 -0
- package/lib/features/helpdeskConfigSlice.js +49 -0
- package/lib/features/helpdeskConfigSlice.js.map +1 -0
- package/lib/features/index.d.ts +6 -0
- package/lib/features/index.js +24 -0
- package/lib/features/index.js.map +1 -0
- package/lib/features/projectSlice.d.ts +16 -0
- package/lib/features/projectSlice.js +49 -0
- package/lib/features/projectSlice.js.map +1 -0
- package/lib/features/ticketSlice.d.ts +81 -0
- package/lib/features/ticketSlice.js +175 -0
- package/lib/features/ticketSlice.js.map +1 -0
- package/lib/features/timerSlice.d.ts +26 -0
- package/lib/features/timerSlice.js +73 -0
- package/lib/features/timerSlice.js.map +1 -0
- package/lib/features/userSlice.d.ts +16 -0
- package/lib/features/userSlice.js +49 -0
- package/lib/features/userSlice.js.map +1 -0
- package/lib/hooks/use-helpdesk-header-actions.d.ts +1 -0
- package/lib/hooks/use-helpdesk-header-actions.js +35 -0
- package/lib/hooks/use-helpdesk-header-actions.js.map +1 -0
- package/lib/i18n/en.json +57 -0
- package/lib/i18n/fr.json +57 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +67 -0
- package/lib/index.js.map +1 -0
- package/lib/models/index.d.ts +3 -0
- package/lib/models/index.js +21 -0
- package/lib/models/index.js.map +1 -0
- package/lib/models/objectFields.d.ts +2 -0
- package/lib/models/objectFields.js +72 -0
- package/lib/models/objectFields.js.map +1 -0
- package/lib/models/searchFields.d.ts +2 -0
- package/lib/models/searchFields.js +46 -0
- package/lib/models/searchFields.js.map +1 -0
- package/lib/models/sortFields.d.ts +2 -0
- package/lib/models/sortFields.js +26 -0
- package/lib/models/sortFields.js.map +1 -0
- package/lib/screens/MyTeamTicketListScreen.d.ts +4 -0
- package/lib/screens/MyTeamTicketListScreen.js +124 -0
- package/lib/screens/MyTeamTicketListScreen.js.map +1 -0
- package/lib/screens/MyTicketListScreen.d.ts +4 -0
- package/lib/screens/MyTicketListScreen.js +124 -0
- package/lib/screens/MyTicketListScreen.js.map +1 -0
- package/lib/screens/TicketDetailsScreen.d.ts +4 -0
- package/lib/screens/TicketDetailsScreen.js +95 -0
- package/lib/screens/TicketDetailsScreen.js.map +1 -0
- package/lib/screens/TicketFormScreen.d.ts +5 -0
- package/lib/screens/TicketFormScreen.js +127 -0
- package/lib/screens/TicketFormScreen.js.map +1 -0
- package/lib/screens/index.d.ts +40 -0
- package/lib/screens/index.js +50 -0
- package/lib/screens/index.js.map +1 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +19 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/ticket.d.ts +53 -0
- package/lib/types/ticket.js +217 -0
- package/lib/types/ticket.js.map +1 -0
- package/lib/utils/displayers.d.ts +1 -0
- package/lib/utils/displayers.js +19 -0
- package/lib/utils/displayers.js.map +1 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Helpdesk
|
|
3
|
+
tags: Readme
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<h1 align="center">@axelor/aos-mobile-helpdesk</h1>
|
|
7
|
+
|
|
8
|
+
<div align="center">
|
|
9
|
+
<img src="https://i.imgur.com/KJAAFlT.png" width="30%"/>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
## Presentation
|
|
13
|
+
|
|
14
|
+
This package was developed for the [Axelor Open Mobile](https://github.com/axelor/axelor-mobile) application.
|
|
15
|
+
|
|
16
|
+
The purpose of this package is to link with the HELPDESK module of the [Axelor Open Suite (AOS)](https://github.com/axelor/axelor-open-suite) ERP. It provides a simplified version of a number of processes available on the webapp. This package is compatible with AOS from version 6.5.0.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
Install the library :
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
yarn add @axelor/aos-mobile-helpdesk
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Compatibility with React v18.2.x and React Native v0.68.x.
|
|
27
|
+
|
|
28
|
+
To add this package in your application, you need to add it the _modules_ props of the component `Application` from @axelor/aos-mobile-core package.
|
|
29
|
+
|
|
30
|
+
```javascript
|
|
31
|
+
import React from 'react';
|
|
32
|
+
import {Application} from '@axelor/aos-mobile-core';
|
|
33
|
+
import {HelpdeskModule} from '@axelor/aos-mobile-helpdesk';
|
|
34
|
+
|
|
35
|
+
const App = () => {
|
|
36
|
+
return <Application modules={[HelpdeskModule]} mainMenu="auth_menu_user" />;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default App;
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Developpment
|
|
43
|
+
|
|
44
|
+
This package is developed as part of the Axelor Open Mobile application. To contribute, please go to the [Github project](https://github.com/axelor/axelor-mobile) and follow the guidelines. You will also find an installation guide to help you configure your environment.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function searchCustomer({ searchValue, page }: {
|
|
2
|
+
searchValue: any;
|
|
3
|
+
page?: number;
|
|
4
|
+
}): Promise<any>;
|
|
5
|
+
export function searchCustomerContact({ searchValue, page }: {
|
|
6
|
+
searchValue: any;
|
|
7
|
+
page?: number;
|
|
8
|
+
}): Promise<any>;
|
|
9
|
+
export function getCustomer({ customerId }: {
|
|
10
|
+
customerId: any;
|
|
11
|
+
}): Promise<any>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { createStandardSearch, getSearchCriterias, createStandardFetch, } from '@axelor/aos-mobile-core';
|
|
19
|
+
const createCustomerCriteria = searchValue => {
|
|
20
|
+
return [
|
|
21
|
+
{
|
|
22
|
+
fieldName: 'isCustomer',
|
|
23
|
+
operator: '=',
|
|
24
|
+
value: true,
|
|
25
|
+
},
|
|
26
|
+
getSearchCriterias('helpdesk_customer', searchValue),
|
|
27
|
+
];
|
|
28
|
+
};
|
|
29
|
+
const createCustomerContactCriteria = searchValue => {
|
|
30
|
+
return [getSearchCriterias('helpdesk_customerContact', searchValue)];
|
|
31
|
+
};
|
|
32
|
+
export async function searchCustomer({ searchValue, page = 0 }) {
|
|
33
|
+
return createStandardSearch({
|
|
34
|
+
model: 'com.axelor.apps.base.db.Partner',
|
|
35
|
+
criteria: createCustomerCriteria(searchValue),
|
|
36
|
+
fieldKey: 'helpdesk_customer',
|
|
37
|
+
sortKey: 'helpdesk_customer',
|
|
38
|
+
page: page,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export async function searchCustomerContact({ searchValue, page = 0 }) {
|
|
42
|
+
return createStandardSearch({
|
|
43
|
+
model: 'com.axelor.apps.base.db.Partner',
|
|
44
|
+
criteria: createCustomerContactCriteria(searchValue),
|
|
45
|
+
fieldKey: 'helpdesk_customerContact',
|
|
46
|
+
sortKey: 'helpdesk_customerContact',
|
|
47
|
+
page: page,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
export async function getCustomer({ customerId }) {
|
|
51
|
+
return createStandardFetch({
|
|
52
|
+
model: 'com.axelor.apps.base.db.Partner',
|
|
53
|
+
id: customerId,
|
|
54
|
+
fieldKey: 'helpdesk_customer',
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=customer-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customer-api.js","sourceRoot":"","sources":["../../src/api/customer-api.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,sBAAsB,GAAG,WAAW,CAAC,EAAE;IAC3C,OAAO;QACL;YACE,SAAS,EAAE,YAAY;YACvB,QAAQ,EAAE,GAAG;YACb,KAAK,EAAE,IAAI;SACZ;QACD,kBAAkB,CAAC,mBAAmB,EAAE,WAAW,CAAC;KACrD,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,6BAA6B,GAAG,WAAW,CAAC,EAAE;IAClD,OAAO,CAAC,kBAAkB,CAAC,0BAA0B,EAAE,WAAW,CAAC,CAAC,CAAC;AACvE,CAAC,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EAAC,WAAW,EAAE,IAAI,GAAG,CAAC,EAAC;IAC1D,OAAO,oBAAoB,CAAC;QAC1B,KAAK,EAAE,iCAAiC;QACxC,QAAQ,EAAE,sBAAsB,CAAC,WAAW,CAAC;QAC7C,QAAQ,EAAE,mBAAmB;QAC7B,OAAO,EAAE,mBAAmB;QAC5B,IAAI,EAAE,IAAI;KACX,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,EAAC,WAAW,EAAE,IAAI,GAAG,CAAC,EAAC;IACjE,OAAO,oBAAoB,CAAC;QAC1B,KAAK,EAAE,iCAAiC;QACxC,QAAQ,EAAE,6BAA6B,CAAC,WAAW,CAAC;QACpD,QAAQ,EAAE,0BAA0B;QACpC,OAAO,EAAE,0BAA0B;QACnC,IAAI,EAAE,IAAI;KACX,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,EAAC,UAAU,EAAC;IAC5C,OAAO,mBAAmB,CAAC;QACzB,KAAK,EAAE,iCAAiC;QACxC,EAAE,EAAE,UAAU;QACd,QAAQ,EAAE,mBAAmB;KAC9B,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function fetchHelpdeskConfig(): Promise<any>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { axiosApiProvider, RouterProvider } from '@axelor/aos-mobile-core';
|
|
19
|
+
export async function fetchHelpdeskConfig() {
|
|
20
|
+
const route = await RouterProvider.get('AppHeldesk');
|
|
21
|
+
return axiosApiProvider.get({ url: route });
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=helpdesk-config-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpdesk-config-api.js","sourceRoot":"","sources":["../../src/api/helpdesk-config-api.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,gBAAgB,EAAE,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAEzE,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACvC,MAAM,KAAK,GAAG,MAAM,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAErD,OAAO,gBAAgB,CAAC,GAAG,CAAC,EAAC,GAAG,EAAE,KAAK,EAAC,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { createStandardSearch, getSearchCriterias, } from '@axelor/aos-mobile-core';
|
|
19
|
+
const createProjectCriteria = searchValue => {
|
|
20
|
+
return [getSearchCriterias('helpdesk_project', searchValue)];
|
|
21
|
+
};
|
|
22
|
+
export async function searchProject({ searchValue, page = 0 }) {
|
|
23
|
+
return createStandardSearch({
|
|
24
|
+
model: 'com.axelor.apps.project.db.Project',
|
|
25
|
+
criteria: createProjectCriteria(searchValue),
|
|
26
|
+
fieldKey: 'helpdesk_project',
|
|
27
|
+
sortKey: 'helpdesk_project',
|
|
28
|
+
page: page,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=project-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-api.js","sourceRoot":"","sources":["../../src/api/project-api.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,qBAAqB,GAAG,WAAW,CAAC,EAAE;IAC1C,OAAO,CAAC,kBAAkB,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC,CAAC;AAC/D,CAAC,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,EAAC,WAAW,EAAE,IAAI,GAAG,CAAC,EAAC;IACzD,OAAO,oBAAoB,CAAC;QAC1B,KAAK,EAAE,oCAAoC;QAC3C,QAAQ,EAAE,qBAAqB,CAAC,WAAW,CAAC;QAC5C,QAAQ,EAAE,kBAAkB;QAC5B,OAAO,EAAE,kBAAkB;QAC3B,IAAI,EAAE,IAAI;KACX,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export function searchTickets({ searchValue, userId, page, userTeam }: {
|
|
2
|
+
searchValue: any;
|
|
3
|
+
userId: any;
|
|
4
|
+
page?: number;
|
|
5
|
+
userTeam: any;
|
|
6
|
+
}): Promise<any>;
|
|
7
|
+
export function getTicket({ ticketId }: {
|
|
8
|
+
ticketId: any;
|
|
9
|
+
}): Promise<any>;
|
|
10
|
+
export function getTicketType(): Promise<any>;
|
|
11
|
+
export function searchTicketType({ searchValue, page }: {
|
|
12
|
+
searchValue: any;
|
|
13
|
+
page?: number;
|
|
14
|
+
}): Promise<any>;
|
|
15
|
+
export function updateStatusTicket({ version, dateTime, targetStatus, ticketId, }: {
|
|
16
|
+
version: any;
|
|
17
|
+
dateTime: any;
|
|
18
|
+
targetStatus: any;
|
|
19
|
+
ticketId: any;
|
|
20
|
+
}): Promise<any>;
|
|
21
|
+
export function updateTicket({ ticket }: {
|
|
22
|
+
ticket: any;
|
|
23
|
+
}): Promise<any>;
|
|
24
|
+
export function createTicket({ ticket }: {
|
|
25
|
+
ticket: any;
|
|
26
|
+
}): Promise<any>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { createStandardSearch, getSearchCriterias, createStandardFetch, axiosApiProvider, } from '@axelor/aos-mobile-core';
|
|
19
|
+
const createTicketCriteria = (searchValue, userId, userTeam) => {
|
|
20
|
+
const criteria = [getSearchCriterias('helpdesk_ticket', searchValue)];
|
|
21
|
+
if (userId != null) {
|
|
22
|
+
criteria.push({
|
|
23
|
+
fieldName: 'assignedToUser.id',
|
|
24
|
+
operator: '=',
|
|
25
|
+
value: userId,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
if (userTeam != null) {
|
|
29
|
+
criteria.push({
|
|
30
|
+
fieldName: 'assignedToUser.activeTeam',
|
|
31
|
+
operator: '=',
|
|
32
|
+
value: userTeam,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return criteria;
|
|
36
|
+
};
|
|
37
|
+
const createTicketTypeCriteria = searchValue => {
|
|
38
|
+
return [getSearchCriterias('helpdesk_ticketType', searchValue)];
|
|
39
|
+
};
|
|
40
|
+
export async function searchTickets({ searchValue, userId, page = 0, userTeam }) {
|
|
41
|
+
return createStandardSearch({
|
|
42
|
+
model: 'com.axelor.apps.helpdesk.db.Ticket',
|
|
43
|
+
criteria: createTicketCriteria(searchValue, userId, userTeam),
|
|
44
|
+
fieldKey: 'helpdesk_ticket',
|
|
45
|
+
sortKey: 'helpdesk_ticket',
|
|
46
|
+
page,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
export async function getTicket({ ticketId }) {
|
|
50
|
+
return createStandardFetch({
|
|
51
|
+
model: 'com.axelor.apps.helpdesk.db.Ticket',
|
|
52
|
+
id: ticketId,
|
|
53
|
+
fieldKey: 'helpdesk_ticket',
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
export async function getTicketType() {
|
|
57
|
+
return createStandardSearch({
|
|
58
|
+
model: 'com.axelor.apps.helpdesk.db.TicketType',
|
|
59
|
+
fieldKey: 'helpdesk_ticketType',
|
|
60
|
+
numberElementsByPage: null,
|
|
61
|
+
page: 0,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
export async function searchTicketType({ searchValue, page = 0 }) {
|
|
65
|
+
return createStandardSearch({
|
|
66
|
+
model: 'com.axelor.apps.helpdesk.db.TicketType',
|
|
67
|
+
criteria: createTicketTypeCriteria(searchValue),
|
|
68
|
+
fieldKey: 'helpdesk_ticketType',
|
|
69
|
+
sortKey: 'helpdesk_ticketType',
|
|
70
|
+
page: page,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
export async function updateStatusTicket({ version, dateTime, targetStatus, ticketId, }) {
|
|
74
|
+
return axiosApiProvider.put({
|
|
75
|
+
url: `ws/aos/ticket/${ticketId}`,
|
|
76
|
+
data: {
|
|
77
|
+
version: version,
|
|
78
|
+
dateTime: dateTime,
|
|
79
|
+
targetStatus: targetStatus,
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
export async function updateTicket({ ticket }) {
|
|
84
|
+
return axiosApiProvider.post({
|
|
85
|
+
url: '/ws/rest/com.axelor.apps.helpdesk.db.Ticket',
|
|
86
|
+
data: {
|
|
87
|
+
data: ticket,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
export async function createTicket({ ticket }) {
|
|
92
|
+
return axiosApiProvider.put({
|
|
93
|
+
url: '/ws/rest/com.axelor.apps.helpdesk.db.Ticket',
|
|
94
|
+
data: {
|
|
95
|
+
data: ticket,
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=ticket-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ticket-api.js","sourceRoot":"","sources":["../../src/api/ticket-api.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,oBAAoB,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,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>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { createStandardFetch, createStandardSearch, } from '@axelor/aos-mobile-core';
|
|
19
|
+
export async function getTimer({ timerId }) {
|
|
20
|
+
return createStandardFetch({
|
|
21
|
+
model: 'com.axelor.apps.base.db.Timer',
|
|
22
|
+
id: timerId,
|
|
23
|
+
fieldKey: 'helpdesk_timer',
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export async function searchTimerHistoryWithId({ idTimer }) {
|
|
27
|
+
if (idTimer == null) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return createStandardSearch({
|
|
31
|
+
model: 'com.axelor.apps.base.db.TimerHistory',
|
|
32
|
+
criteria: [
|
|
33
|
+
{
|
|
34
|
+
fieldName: 'timer.id',
|
|
35
|
+
operator: '=',
|
|
36
|
+
value: idTimer,
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
fieldKey: 'helpdesk_timerHistory',
|
|
40
|
+
numberElementsByPage: null,
|
|
41
|
+
page: 0,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=timer-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timer-api.js","sourceRoot":"","sources":["../../src/api/timer-api.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,EAAC,OAAO,EAAC;IACtC,OAAO,mBAAmB,CAAC;QACzB,KAAK,EAAE,+BAA+B;QACtC,EAAE,EAAE,OAAO;QACX,QAAQ,EAAE,gBAAgB;KAC3B,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,EAAC,OAAO,EAAC;IACtD,IAAI,OAAO,IAAI,IAAI,EAAE;QACnB,OAAO,IAAI,CAAC;KACb;IAED,OAAO,oBAAoB,CAAC;QAC1B,KAAK,EAAE,sCAAsC;QAC7C,QAAQ,EAAE;YACR;gBACE,SAAS,EAAE,UAAU;gBACrB,QAAQ,EAAE,GAAG;gBACb,KAAK,EAAE,OAAO;aACf;SACF;QACD,QAAQ,EAAE,uBAAuB;QACjC,oBAAoB,EAAE,IAAI;QAC1B,IAAI,EAAE,CAAC;KACR,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { createStandardSearch, getSearchCriterias, } from '@axelor/aos-mobile-core';
|
|
19
|
+
const createUserCriteria = searchValue => {
|
|
20
|
+
return [getSearchCriterias('helpdesk_user', searchValue)];
|
|
21
|
+
};
|
|
22
|
+
export async function searchUser({ searchValue, page = 0 }) {
|
|
23
|
+
return createStandardSearch({
|
|
24
|
+
model: 'com.axelor.auth.db.User',
|
|
25
|
+
criteria: createUserCriteria(searchValue),
|
|
26
|
+
fieldKey: 'helpdesk_user',
|
|
27
|
+
sortKey: 'helpdesk_user',
|
|
28
|
+
page: page,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=user-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-api.js","sourceRoot":"","sources":["../../src/api/user-api.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,kBAAkB,GAAG,WAAW,CAAC,EAAE;IACvC,OAAO,CAAC,kBAAkB,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC,CAAC;AAC5D,CAAC,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,EAAC,WAAW,EAAE,IAAI,GAAG,CAAC,EAAC;IACtD,OAAO,oBAAoB,CAAC;QAC1B,KAAK,EAAE,yBAAyB;QAChC,QAAQ,EAAE,kBAAkB,CAAC,WAAW,CAAC;QACzC,QAAQ,EAAE,eAAe;QACzB,OAAO,EAAE,eAAe;QACxB,IAAI,EAAE,IAAI;KACX,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
export * from './molecules';
|
|
19
|
+
export * from './templates';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface DurationFormInputProps {
|
|
2
|
+
style?: any;
|
|
3
|
+
titleKey?: string;
|
|
4
|
+
duration: number;
|
|
5
|
+
onChange: (value: number) => void;
|
|
6
|
+
}
|
|
7
|
+
declare const DurationFormInput: ({ style, titleKey, duration, onChange, }: DurationFormInputProps) => JSX.Element;
|
|
8
|
+
export default DurationFormInput;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import React, { useEffect, useState } from 'react';
|
|
19
|
+
import { StyleSheet } from 'react-native';
|
|
20
|
+
import { FormInput, checkNullString } from '@axelor/aos-mobile-ui';
|
|
21
|
+
import { useTranslator } from '@axelor/aos-mobile-core';
|
|
22
|
+
import { MAX_HOUR_REGEX, NEED_SPACER_REGEX, PERFECT_REGEX, SPACER, formatDuration, formatDurationFromSeconds, parseDuration, } from './duration.helpers';
|
|
23
|
+
const DurationFormInput = ({ style, titleKey = 'Helpdesk_Duration', duration, onChange, }) => {
|
|
24
|
+
const I18n = useTranslator();
|
|
25
|
+
const [formattedDuration, setFormattedDuration] = useState(formatDurationFromSeconds(duration));
|
|
26
|
+
const handleDurationChange = (value) => {
|
|
27
|
+
if (NEED_SPACER_REGEX.test(value)) {
|
|
28
|
+
handleResult(`${value.slice(0, 3)}${SPACER}${value.slice(3)}`);
|
|
29
|
+
}
|
|
30
|
+
else if (MAX_HOUR_REGEX.test(value)) {
|
|
31
|
+
handleResult(`${value}${SPACER}`);
|
|
32
|
+
}
|
|
33
|
+
else if (PERFECT_REGEX.test(value)) {
|
|
34
|
+
handleResult(value);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
handleResult(value);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const handleEndFocus = () => {
|
|
41
|
+
let hours, minutes;
|
|
42
|
+
if (checkNullString(formattedDuration)) {
|
|
43
|
+
hours = 0;
|
|
44
|
+
minutes = 0;
|
|
45
|
+
}
|
|
46
|
+
else if (formattedDuration.includes(SPACER)) {
|
|
47
|
+
const splitDuraction = formattedDuration.split(SPACER);
|
|
48
|
+
hours = parseInt(splitDuraction[0], 10);
|
|
49
|
+
minutes = splitDuraction[1] ? parseInt(splitDuraction[1], 10) : 0;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
hours = parseInt(formattedDuration, 10);
|
|
53
|
+
minutes = 0;
|
|
54
|
+
}
|
|
55
|
+
const result = formatDuration(hours, minutes);
|
|
56
|
+
handleResult(result);
|
|
57
|
+
};
|
|
58
|
+
const handleResult = (value) => {
|
|
59
|
+
setFormattedDuration(value);
|
|
60
|
+
onChange(parseDuration(value));
|
|
61
|
+
};
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
setFormattedDuration(formatDurationFromSeconds(duration ?? 0));
|
|
64
|
+
}, [duration]);
|
|
65
|
+
return (<FormInput style={[styles.input, style]} title={I18n.t(titleKey)} onChange={handleDurationChange} onEndFocus={handleEndFocus} defaultValue={formattedDuration} multiline={false} keyboardType="numeric"/>);
|
|
66
|
+
};
|
|
67
|
+
const styles = StyleSheet.create({
|
|
68
|
+
input: {
|
|
69
|
+
width: '90%',
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
export default DurationFormInput;
|
|
73
|
+
//# sourceMappingURL=DurationFormInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DurationFormInput.js","sourceRoot":"","sources":["../../../../src/components/molecules/DurationFormInput/DurationFormInput.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACjD,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,SAAS,EAAE,eAAe,EAAC,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAC,aAAa,EAAC,MAAM,yBAAyB,CAAC;AACtD,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,MAAM,EACN,cAAc,EACd,yBAAyB,EACzB,aAAa,GACd,MAAM,oBAAoB,CAAC;AAS5B,MAAM,iBAAiB,GAAG,CAAC,EACzB,KA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|
+
export declare const NB_SECONDS_IN_HOUR = 3600;
|
|
4
|
+
export declare const MAX_HOUR_REGEX: RegExp;
|
|
5
|
+
export declare const NEED_SPACER_REGEX: RegExp;
|
|
6
|
+
export declare const PERFECT_REGEX: RegExp;
|
|
7
|
+
export declare const formatDuration: (hours: number, minutes: number) => string;
|
|
8
|
+
export declare const formatDurationFromSeconds: (seconds: number) => string;
|
|
9
|
+
export declare const parseDuration: (value: string) => number;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
export const SPACER = ':';
|
|
19
|
+
export const NB_SECONDS_IN_MINUTE = 60;
|
|
20
|
+
export const NB_SECONDS_IN_HOUR = 3600;
|
|
21
|
+
export const MAX_HOUR_REGEX = /\d{3}$/g;
|
|
22
|
+
export const NEED_SPACER_REGEX = /\d{4,}$/g;
|
|
23
|
+
export const PERFECT_REGEX = /\d{3}:\d{2}$/g;
|
|
24
|
+
export const formatDuration = (hours, minutes) => {
|
|
25
|
+
const formattedHours = hours.toString().padStart(3, '0');
|
|
26
|
+
const formattedMinutes = minutes.toString().padStart(2, '0');
|
|
27
|
+
return `${formattedHours}:${formattedMinutes}`;
|
|
28
|
+
};
|
|
29
|
+
export const formatDurationFromSeconds = (seconds) => {
|
|
30
|
+
const hours = Math.floor(seconds / NB_SECONDS_IN_HOUR);
|
|
31
|
+
const minutes = Math.floor((seconds % NB_SECONDS_IN_HOUR) / NB_SECONDS_IN_MINUTE);
|
|
32
|
+
return formatDuration(hours, minutes);
|
|
33
|
+
};
|
|
34
|
+
export const parseDuration = (value) => {
|
|
35
|
+
const [hours, minutes] = value.split(':');
|
|
36
|
+
const parsedHours = parseInt(hours, 10);
|
|
37
|
+
const parsedMinutes = parseInt(minutes, 10);
|
|
38
|
+
if (isNaN(parsedHours) || isNaN(parsedMinutes)) {
|
|
39
|
+
return 0;
|
|
40
|
+
}
|
|
41
|
+
const totalSeconds = parsedHours * NB_SECONDS_IN_HOUR + parsedMinutes * NB_SECONDS_IN_MINUTE;
|
|
42
|
+
return totalSeconds;
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=duration.helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration.helpers.js","sourceRoot":"","sources":["../../../../src/components/molecules/DurationFormInput/duration.helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAC;AAC1B,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AACvC,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEvC,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC;AACxC,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAC;AAC5C,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC;AAE7C,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,OAAe,EAAE,EAAE;IAC/D,MAAM,cAAc,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACzD,MAAM,gBAAgB,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAE7D,OAAO,GAAG,cAAc,IAAI,gBAAgB,EAAE,CAAC;AACjD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,OAAe,EAAE,EAAE;IAC3D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,kBAAkB,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CACxB,CAAC,OAAO,GAAG,kBAAkB,CAAC,GAAG,oBAAoB,CACtD,CAAC;IAEF,OAAO,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAa,EAAE,EAAE;IAC7C,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1C,MAAM,WAAW,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACxC,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAE5C,IAAI,KAAK,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,aAAa,CAAC,EAAE;QAC9C,OAAO,CAAC,CAAC;KACV;IAED,MAAM,YAAY,GAChB,WAAW,GAAG,kBAAkB,GAAG,aAAa,GAAG,oBAAoB,CAAC;IAE1E,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface ProgressFormInputProps {
|
|
2
|
+
style?: any;
|
|
3
|
+
title: string;
|
|
4
|
+
readOnly?: boolean;
|
|
5
|
+
defaultValue?: number;
|
|
6
|
+
onChange: (value: any) => void;
|
|
7
|
+
}
|
|
8
|
+
declare const ProgressFormInput: ({ style, title, readOnly, defaultValue, onChange, }: ProgressFormInputProps) => JSX.Element;
|
|
9
|
+
export default ProgressFormInput;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import React, { useCallback, useMemo } from 'react';
|
|
19
|
+
import { FormIncrementInput } from '@axelor/aos-mobile-ui';
|
|
20
|
+
const ProgressFormInput = ({ style, title, readOnly = false, defaultValue = null, onChange, }) => {
|
|
21
|
+
const round = useCallback(value => {
|
|
22
|
+
return Math.round(value / 10) * 10;
|
|
23
|
+
}, []);
|
|
24
|
+
const _defaultValue = useMemo(() => round(defaultValue).toString(), [defaultValue, round]);
|
|
25
|
+
const onChangeValue = value => {
|
|
26
|
+
onChange(round(value));
|
|
27
|
+
};
|
|
28
|
+
return (<FormIncrementInput style={style} title={title} defaultFormatting={false} defaultValue={_defaultValue} onChange={onChangeValue} readOnly={readOnly} stepSize={10} maxValue={100}/>);
|
|
29
|
+
};
|
|
30
|
+
export default ProgressFormInput;
|
|
31
|
+
//# sourceMappingURL=ProgressFormInput.js.map
|