@visns-studio/visns-components 1.8.4 → 2.0.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/.prettierrc.json +7 -0
- package/components/cms/{visns-data-grid.jsx → DataGrid.jsx} +2 -2
- package/components/cms/DropZone.jsx +161 -0
- package/components/cms/Field.jsx +747 -0
- package/components/cms/Form.jsx +475 -0
- package/components/cms/sorting/{list.jsx → List.jsx} +3 -3
- package/components/crm/{visns-async-select.jsx → AsyncSelect.jsx} +9 -9
- package/components/crm/Call.jsx +220 -0
- package/components/crm/{visns-data-grid.jsx → DataGrid.jsx} +263 -274
- package/components/crm/{visns-field.jsx → Field.jsx} +5 -5
- package/components/crm/{visns-form.jsx → Form.jsx} +302 -205
- package/components/crm/{visns-multi-select.jsx → MultiSelect.jsx} +1 -1
- package/components/crm/{visns-navigation.jsx → Navigation.jsx} +22 -18
- package/components/crm/{visns-notification.jsx → Notification.jsx} +1 -1
- package/components/crm/TableFilter.jsx +125 -0
- package/components/crm/auth/Login.jsx +158 -0
- package/components/crm/auth/Profile.jsx +163 -0
- package/components/crm/auth/Reset.jsx +87 -0
- package/components/crm/auth/Verify.jsx +162 -0
- package/components/crm/generic/GenericDetail.jsx +380 -0
- package/components/crm/generic/GenericIndex.jsx +112 -0
- package/components/crm/generic/NotificationList.jsx +64 -0
- package/index.js +37 -19
- package/package.json +6 -6
- package/components/cms/visns-dropzone.jsx +0 -161
- package/components/cms/visns-field.jsx +0 -747
- package/components/cms/visns-form.jsx +0 -475
- package/components/crm/visns-call.jsx +0 -220
- package/components/crm/visns-table-filter.jsx +0 -153
- /package/components/cms/sorting/{item.jsx → Item.jsx} +0 -0
- /package/components/crm/{visns-autocomplete.jsx → Autocomplete.jsx} +0 -0
- /package/components/crm/{visns-download.jsx → Download.jsx} +0 -0
- /package/components/crm/{visns-fetch.jsx → Fetch.jsx} +0 -0
- /package/components/crm/{visns-loader.jsx → Loader.jsx} +0 -0
- /package/components/crm/{visns-select.jsx → Select.jsx} +0 -0
- /package/components/crm/{visns-select-list.jsx → SelectList.jsx} +0 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Table from '../DataGrid';
|
|
3
|
+
|
|
4
|
+
const NotificationList = () => {
|
|
5
|
+
const ajaxSetting = {
|
|
6
|
+
url: '/ajax/notifications/table',
|
|
7
|
+
take: 25,
|
|
8
|
+
sortBy: 'id',
|
|
9
|
+
sort: 'desc',
|
|
10
|
+
where: [],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const form = {
|
|
14
|
+
primaryKey: 'id',
|
|
15
|
+
url: '/ajax/notifications',
|
|
16
|
+
create: {},
|
|
17
|
+
update: {},
|
|
18
|
+
fields: [],
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const columns = [
|
|
22
|
+
{
|
|
23
|
+
id: 'data',
|
|
24
|
+
jsonData: 'label',
|
|
25
|
+
label: 'Label',
|
|
26
|
+
type: 'json',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: 'read_at',
|
|
30
|
+
label: 'Read At',
|
|
31
|
+
type: 'datetime',
|
|
32
|
+
minWidth: 200,
|
|
33
|
+
maxWidth: 200,
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
const settings = [];
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div>
|
|
41
|
+
<div className="grid">
|
|
42
|
+
<div className="grid__row">
|
|
43
|
+
<div className="grid__full crmtitle">
|
|
44
|
+
<h1>Notifications</h1>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
<div className="grid">
|
|
49
|
+
<div className="grid__row">
|
|
50
|
+
<div className="grid__full">
|
|
51
|
+
<Table
|
|
52
|
+
ajaxSetting={ajaxSetting}
|
|
53
|
+
form={form}
|
|
54
|
+
columns={columns}
|
|
55
|
+
settings={settings}
|
|
56
|
+
/>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export default NotificationList;
|
package/index.js
CHANGED
|
@@ -1,25 +1,36 @@
|
|
|
1
1
|
/** CMS Components */
|
|
2
|
-
import CmsForm from
|
|
3
|
-
import DataGrid from
|
|
4
|
-
import DropZone from
|
|
5
|
-
import SortableList from
|
|
2
|
+
import CmsForm from './components/cms/Form';
|
|
3
|
+
import DataGrid from './components/cms/DataGrid';
|
|
4
|
+
import DropZone from './components/cms/DropZone';
|
|
5
|
+
import SortableList from './components/cms/sorting/List';
|
|
6
6
|
|
|
7
7
|
/** CRM Components */
|
|
8
|
-
import AsyncSelect from
|
|
9
|
-
import Autocomplete from
|
|
10
|
-
import Call from
|
|
11
|
-
import CustomFetch from
|
|
12
|
-
import Download from
|
|
13
|
-
import Field from
|
|
14
|
-
import Form from
|
|
15
|
-
import Loader from
|
|
16
|
-
import MultiSelect from
|
|
17
|
-
import Navigation from
|
|
18
|
-
import Notification from
|
|
19
|
-
import SelectList from
|
|
20
|
-
import Select from
|
|
21
|
-
import Table from
|
|
22
|
-
import TableFilter from
|
|
8
|
+
import AsyncSelect from './components/crm/AsyncSelect';
|
|
9
|
+
import Autocomplete from './components/crm/Autocomplete';
|
|
10
|
+
import Call from './components/crm/Call';
|
|
11
|
+
import CustomFetch from './components/crm/Fetch';
|
|
12
|
+
import Download from './components/crm/Download';
|
|
13
|
+
import Field from './components/crm/Field';
|
|
14
|
+
import Form from './components/crm/Form';
|
|
15
|
+
import Loader from './components/crm/Loader';
|
|
16
|
+
import MultiSelect from './components/crm/MultiSelect';
|
|
17
|
+
import Navigation from './components/crm/Navigation';
|
|
18
|
+
import Notification from './components/crm/Notification';
|
|
19
|
+
import SelectList from './components/crm/SelectList';
|
|
20
|
+
import Select from './components/crm/Select';
|
|
21
|
+
import Table from './components/crm/DataGrid';
|
|
22
|
+
import TableFilter from './components/crm/TableFilter';
|
|
23
|
+
|
|
24
|
+
/** Auth Specific Components */
|
|
25
|
+
import Login from './components/crm/auth/Login';
|
|
26
|
+
import Profile from './components/crm/auth/Profile';
|
|
27
|
+
import Reset from './components/crm/auth/Reset';
|
|
28
|
+
import Verify from './components/crm/auth/Verify';
|
|
29
|
+
|
|
30
|
+
/** Generic Components */
|
|
31
|
+
import GenericDetail from './components/crm/generic/GenericDetail';
|
|
32
|
+
import GenericIndex from './components/crm/generic/GenericIndex';
|
|
33
|
+
import NotificationList from './components/crm/generic/NotificationList';
|
|
23
34
|
|
|
24
35
|
export {
|
|
25
36
|
AsyncSelect,
|
|
@@ -32,13 +43,20 @@ export {
|
|
|
32
43
|
DropZone,
|
|
33
44
|
Field,
|
|
34
45
|
Form,
|
|
46
|
+
GenericDetail,
|
|
47
|
+
GenericIndex,
|
|
35
48
|
Loader,
|
|
49
|
+
Login,
|
|
36
50
|
MultiSelect,
|
|
37
51
|
Navigation,
|
|
38
52
|
Notification,
|
|
53
|
+
NotificationList,
|
|
54
|
+
Profile,
|
|
55
|
+
Reset,
|
|
39
56
|
SelectList,
|
|
40
57
|
Select,
|
|
41
58
|
SortableList,
|
|
42
59
|
Table,
|
|
43
60
|
TableFilter,
|
|
61
|
+
Verify,
|
|
44
62
|
};
|
package/package.json
CHANGED
|
@@ -4,24 +4,24 @@
|
|
|
4
4
|
"akar-icons": "^1.9.28",
|
|
5
5
|
"awesome-debounce-promise": "^2.1.0",
|
|
6
6
|
"axios": "^1.4.0",
|
|
7
|
-
"framer-motion": "^10.
|
|
8
|
-
"html-react-parser": "^4.
|
|
7
|
+
"framer-motion": "^10.13.0",
|
|
8
|
+
"html-react-parser": "^4.2.0",
|
|
9
9
|
"lodash": "^4.17.21",
|
|
10
10
|
"moment": "^2.29.4",
|
|
11
11
|
"numeral": "^2.0.6",
|
|
12
12
|
"quill-image-uploader": "^1.3.0",
|
|
13
13
|
"react-confirm-alert": "^3.0.6",
|
|
14
|
-
"react-datepicker": "^4.
|
|
14
|
+
"react-datepicker": "^4.16.0",
|
|
15
15
|
"react-dropzone": "^14.2.3",
|
|
16
16
|
"react-number-format": "^5.2.2",
|
|
17
17
|
"react-promise-tracker": "^2.1.1",
|
|
18
18
|
"react-quill": "^2.0.0",
|
|
19
|
-
"react-select": "^5.7.
|
|
19
|
+
"react-select": "^5.7.4",
|
|
20
20
|
"react-slugify": "^3.0.2",
|
|
21
21
|
"react-sortable-hoc": "^2.0.0",
|
|
22
22
|
"react-toastify": "^9.1.3",
|
|
23
23
|
"react-toggle": "^4.1.3",
|
|
24
|
-
"react-tooltip": "^5.18.
|
|
24
|
+
"react-tooltip": "^5.18.1",
|
|
25
25
|
"react-window": "^1.8.9",
|
|
26
26
|
"reactjs-popup": "^2.0.5"
|
|
27
27
|
},
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"react-dom": "^17.0.1"
|
|
35
35
|
},
|
|
36
36
|
"name": "@visns-studio/visns-components",
|
|
37
|
-
"version": "
|
|
37
|
+
"version": "2.0.0",
|
|
38
38
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
39
39
|
"main": "index.js",
|
|
40
40
|
"scripts": {
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import React, { useState, useCallback } from "react";
|
|
2
|
-
import { motion } from "framer-motion";
|
|
3
|
-
import { useDropzone } from "react-dropzone";
|
|
4
|
-
import { confirmAlert } from "react-confirm-alert";
|
|
5
|
-
import { File, TrashCan } from "akar-icons";
|
|
6
|
-
|
|
7
|
-
import "react-confirm-alert/src/react-confirm-alert.css";
|
|
8
|
-
|
|
9
|
-
import CustomFetch from "../crm/visns-fetch";
|
|
10
|
-
import { toast } from "react-toastify";
|
|
11
|
-
|
|
12
|
-
function VisnsDropZone(props) {
|
|
13
|
-
const { fetchData, files, settings } = props;
|
|
14
|
-
const [loadingProgress, setLoadingProgress] = useState(0);
|
|
15
|
-
|
|
16
|
-
const onDrop = useCallback((acceptedFiles) => {
|
|
17
|
-
acceptedFiles.forEach((a) => {
|
|
18
|
-
Vapor.store(a, {
|
|
19
|
-
progress: (progress) => {
|
|
20
|
-
setLoadingProgress(progress * 100);
|
|
21
|
-
},
|
|
22
|
-
}).then((response) => {
|
|
23
|
-
setLoadingProgress(0);
|
|
24
|
-
CustomFetch(
|
|
25
|
-
settings.url,
|
|
26
|
-
settings.method,
|
|
27
|
-
{
|
|
28
|
-
uuid: response.uuid,
|
|
29
|
-
key: response.key,
|
|
30
|
-
bucket: response.bucket,
|
|
31
|
-
filename: a.name,
|
|
32
|
-
filesize: a.size,
|
|
33
|
-
extension: response.extension,
|
|
34
|
-
...settings.data,
|
|
35
|
-
},
|
|
36
|
-
function (result) {
|
|
37
|
-
if (result.error === "") {
|
|
38
|
-
fetchData();
|
|
39
|
-
|
|
40
|
-
toast.success(
|
|
41
|
-
"File has been successfully uploaded."
|
|
42
|
-
);
|
|
43
|
-
} else {
|
|
44
|
-
toast.error(String(result.error));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
}, []);
|
|
51
|
-
|
|
52
|
-
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
|
53
|
-
onDrop,
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
const handleDownload = (id) => {
|
|
57
|
-
if (id && id > 0) {
|
|
58
|
-
window.open(`/ajax/file/download/${id}/${settings.model}`);
|
|
59
|
-
} else {
|
|
60
|
-
toast.warning("Issue with downloading the selected file.");
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const handleDelete = (e, id, name) => {
|
|
65
|
-
if (e) {
|
|
66
|
-
e.preventDefault();
|
|
67
|
-
e.stopPropagation();
|
|
68
|
-
|
|
69
|
-
if (id && id > 0) {
|
|
70
|
-
confirmAlert({
|
|
71
|
-
title: "Confirm to Delete File",
|
|
72
|
-
message: "Are you sure you want to delete " + name,
|
|
73
|
-
buttons: [
|
|
74
|
-
{
|
|
75
|
-
label: "Yes",
|
|
76
|
-
onClick: () => {
|
|
77
|
-
CustomFetch(
|
|
78
|
-
`/ajax/file/delete`,
|
|
79
|
-
"POST",
|
|
80
|
-
{
|
|
81
|
-
file_id: id,
|
|
82
|
-
},
|
|
83
|
-
function (result) {
|
|
84
|
-
if (result.error === "") {
|
|
85
|
-
fetchData();
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
label: "No",
|
|
93
|
-
onClick: () => close(),
|
|
94
|
-
},
|
|
95
|
-
],
|
|
96
|
-
});
|
|
97
|
-
} else {
|
|
98
|
-
toast.error("Issue with deleting the selected file.");
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
return (
|
|
104
|
-
<>
|
|
105
|
-
<div className="progress">
|
|
106
|
-
<motion.div
|
|
107
|
-
className="progress__bar"
|
|
108
|
-
initial={{ width: "0%" }}
|
|
109
|
-
animate={{
|
|
110
|
-
width: loadingProgress + "%",
|
|
111
|
-
}}
|
|
112
|
-
transition={{
|
|
113
|
-
duration: 1,
|
|
114
|
-
ease: [0.165, 0.84, 0.44, 1.0],
|
|
115
|
-
}}
|
|
116
|
-
/>
|
|
117
|
-
</div>
|
|
118
|
-
<section className="dropzone__container">
|
|
119
|
-
<div {...getRootProps()}>
|
|
120
|
-
<input {...getInputProps()} />
|
|
121
|
-
{isDragActive ? (
|
|
122
|
-
<p>Drop the files here ...</p>
|
|
123
|
-
) : (
|
|
124
|
-
<p>
|
|
125
|
-
Drag 'n' drop some files here, or click to select
|
|
126
|
-
files
|
|
127
|
-
</p>
|
|
128
|
-
)}
|
|
129
|
-
</div>
|
|
130
|
-
<ul className="dropzone__files">
|
|
131
|
-
{files && files.length > 0
|
|
132
|
-
? files.map((a, b) => (
|
|
133
|
-
<li
|
|
134
|
-
onClick={() => {
|
|
135
|
-
handleDownload(a.id);
|
|
136
|
-
}}
|
|
137
|
-
key={"tf-" + b}
|
|
138
|
-
>
|
|
139
|
-
<File strokeWidth={2} size={18} />
|
|
140
|
-
{a.file_name}
|
|
141
|
-
<button
|
|
142
|
-
onClick={(event) => {
|
|
143
|
-
handleDelete(
|
|
144
|
-
event,
|
|
145
|
-
a.id,
|
|
146
|
-
a.file_name
|
|
147
|
-
);
|
|
148
|
-
}}
|
|
149
|
-
>
|
|
150
|
-
<TrashCan strokeWidth={2} size={18} />
|
|
151
|
-
</button>
|
|
152
|
-
</li>
|
|
153
|
-
))
|
|
154
|
-
: null}
|
|
155
|
-
</ul>
|
|
156
|
-
</section>
|
|
157
|
-
</>
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export default VisnsDropZone;
|