@visns-studio/visns-components 4.1.3 → 4.1.4
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/components/crm/Form.jsx
CHANGED
|
@@ -468,6 +468,29 @@ function Form({
|
|
|
468
468
|
}
|
|
469
469
|
};
|
|
470
470
|
|
|
471
|
+
const handleSort = async (e) => {
|
|
472
|
+
try {
|
|
473
|
+
if (e) {
|
|
474
|
+
e.preventDefault();
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
const url = formSettings.sortButton.url;
|
|
478
|
+
const method = 'POST';
|
|
479
|
+
|
|
480
|
+
const res = await CustomFetch(url, method, {
|
|
481
|
+
id: formData[formSettings.primaryKey],
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
if (res.data.error === '') {
|
|
485
|
+
toast.success('Files successfully sorted by name.');
|
|
486
|
+
|
|
487
|
+
fetchData();
|
|
488
|
+
}
|
|
489
|
+
} catch (err) {
|
|
490
|
+
console.info(err);
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
|
|
471
494
|
const handleSubmit = async (e) => {
|
|
472
495
|
try {
|
|
473
496
|
if (e) {
|
|
@@ -1255,8 +1278,14 @@ function Form({
|
|
|
1255
1278
|
</button>
|
|
1256
1279
|
)}
|
|
1257
1280
|
|
|
1258
|
-
{formSettings.hasOwnProperty('
|
|
1259
|
-
formSettings.
|
|
1281
|
+
{formSettings.hasOwnProperty('sortButton') &&
|
|
1282
|
+
formSettings.sortButton.url ? (
|
|
1283
|
+
<button className="btn" onClick={handleSort}>
|
|
1284
|
+
{formSettings.sortButton.label
|
|
1285
|
+
? formSettings.sortButton.label
|
|
1286
|
+
: 'Sort'}
|
|
1287
|
+
</button>
|
|
1288
|
+
) : (
|
|
1260
1289
|
<button className="btn" onClick={handleSubmit}>
|
|
1261
1290
|
{formSettings?.save?.button?.label
|
|
1262
1291
|
? formSettings.save.button.label
|
package/package.json
CHANGED