@visns-studio/visns-components 3.9.4 → 3.9.5

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.
@@ -0,0 +1,99 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { useParams } from 'react-router-dom';
3
+ import dayjs from 'dayjs';
4
+ import Breadcrumb from '../Breadcrumb';
5
+ import CustomFetch from '../Fetch';
6
+
7
+ const AuditLog = ({ userProfile }) => {
8
+ const routeParams = useParams();
9
+ const [data, setData] = useState({});
10
+
11
+ const fetchData = async () => {
12
+ const res = await CustomFetch(
13
+ `/ajax/audits/${routeParams.dataId}`,
14
+ 'GET'
15
+ );
16
+
17
+ setData(res.data);
18
+ };
19
+
20
+ useEffect(() => {
21
+ fetchData();
22
+ }, [routeParams.dataId]);
23
+
24
+ return (
25
+ <div>
26
+ <div className="grid">
27
+ <div className="grid__row">
28
+ <div className="grid__full crmtitle">
29
+ <Breadcrumb
30
+ data={data}
31
+ page={{
32
+ title: 'Audit Logs',
33
+ previousUrl: '/auditLogs',
34
+ titleKey: 'id',
35
+ }}
36
+ />
37
+ </div>
38
+ </div>
39
+ </div>
40
+ <div className="grid">
41
+ <div className="grid__subrow">
42
+ <div className="grid__full">
43
+ <div className="gridtxt">
44
+ <ul className="customer__overview">
45
+ <li>
46
+ <strong>User:</strong>
47
+ {` ${data?.user?.name}`}
48
+ </li>
49
+ <li>
50
+ <strong>Created At:</strong>
51
+ {` ${
52
+ data?.created_at
53
+ ? dayjs(data.created_at).format(
54
+ 'MM-DD-YYYY hh:mm A'
55
+ )
56
+ : ''
57
+ }`}
58
+ </li>
59
+ <li>
60
+ <strong>IP Address:</strong>
61
+ {` ${data?.ip_address}`}
62
+ </li>
63
+ <li>
64
+ <strong>URL:</strong>
65
+ {` ${data?.url}`}
66
+ </li>
67
+ <li className="fw-grid-item notecolor">
68
+ <strong>Old Value(s):</strong>
69
+ <br />
70
+ <pre>
71
+ {JSON.stringify(
72
+ data?.old_values,
73
+ null,
74
+ 4
75
+ )}
76
+ </pre>
77
+ </li>
78
+ <li className="fw-grid-item notecolor">
79
+ <strong>New Value(s):</strong>
80
+ <br />
81
+
82
+ <pre>
83
+ {JSON.stringify(
84
+ data?.new_values,
85
+ null,
86
+ 4
87
+ )}
88
+ </pre>
89
+ </li>
90
+ </ul>
91
+ </div>
92
+ </div>
93
+ </div>
94
+ </div>
95
+ </div>
96
+ );
97
+ };
98
+
99
+ export default AuditLog;
@@ -13,6 +13,7 @@ const AuditLogs = () => {
13
13
  form: {
14
14
  primaryKey: 'id',
15
15
  url: '/ajax/audits',
16
+ createDisable: true,
16
17
  create: {},
17
18
  update: {},
18
19
  fields: [],
@@ -23,26 +24,46 @@ const AuditLogs = () => {
23
24
  label: 'User',
24
25
  type: 'relation',
25
26
  nameFrom: 'name',
27
+ link: {
28
+ url: '/auditLogs/',
29
+ key: 'id',
30
+ },
26
31
  },
27
32
  {
28
- id: 'old_values',
33
+ id: 'formatted_old_values',
29
34
  label: 'Old Values',
30
35
  type: 'text',
36
+ link: {
37
+ url: '/auditLogs/',
38
+ key: 'id',
39
+ },
31
40
  },
32
41
  {
33
- id: 'new_values',
42
+ id: 'formatted_new_values',
34
43
  label: 'New Values',
35
44
  type: 'text',
45
+ link: {
46
+ url: '/auditLogs/',
47
+ key: 'id',
48
+ },
36
49
  },
37
50
  {
38
51
  id: 'url',
39
52
  label: 'URL',
40
53
  type: 'text',
54
+ link: {
55
+ url: '/auditLogs/',
56
+ key: 'id',
57
+ },
41
58
  },
42
59
  {
43
60
  id: 'ip_address',
44
61
  label: 'IP Address',
45
62
  type: 'text',
63
+ link: {
64
+ url: '/auditLogs/',
65
+ key: 'id',
66
+ },
46
67
  },
47
68
  {
48
69
  id: 'created_at',
@@ -50,6 +71,10 @@ const AuditLogs = () => {
50
71
  type: 'datetime',
51
72
  minWidth: 200,
52
73
  maxWidth: 200,
74
+ link: {
75
+ url: '/auditLogs/',
76
+ key: 'id',
77
+ },
53
78
  },
54
79
  ],
55
80
  settings: [],
package/index.js CHANGED
@@ -34,6 +34,7 @@ import CmsIndex from './components/cms/generic/CmsIndex';
34
34
  import CmsSort from './components/cms/generic/CmsSort';
35
35
 
36
36
  /** CRM Generic Components */
37
+ import AuditLog from './components/crm/generic/AuditLog';
37
38
  import AuditLogs from './components/crm/generic/AuditLogs';
38
39
  import GenericAuth from './components/crm/generic/GenericAuth';
39
40
  import GenericDetail from './components/crm/generic/GenericDetail';
@@ -46,6 +47,7 @@ import NotificationList from './components/crm/generic/NotificationList';
46
47
 
47
48
  export {
48
49
  AsyncSelect,
50
+ AuditLog,
49
51
  AuditLogs,
50
52
  Autocomplete,
51
53
  Breadcrumb,
package/package.json CHANGED
@@ -11,6 +11,7 @@
11
11
  "array-move": "^4.0.0",
12
12
  "awesome-debounce-promise": "^2.1.0",
13
13
  "axios": "^1.6.8",
14
+ "dayjs": "^1.11.11",
14
15
  "file-saver": "^2.0.5",
15
16
  "framer-motion": "^11.1.8",
16
17
  "html-react-parser": "^5.1.10",
@@ -54,7 +55,7 @@
54
55
  "react-dom": "^17.0.1"
55
56
  },
56
57
  "name": "@visns-studio/visns-components",
57
- "version": "3.9.4",
58
+ "version": "3.9.5",
58
59
  "description": "Various packages to assist in the development of our Custom Applications.",
59
60
  "main": "index.js",
60
61
  "scripts": {