@visns-studio/visns-components 4.1.3 → 4.1.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.
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,14 +1278,20 @@ function Form({
|
|
|
1255
1278
|
</button>
|
|
1256
1279
|
)}
|
|
1257
1280
|
|
|
1258
|
-
{formSettings.hasOwnProperty('
|
|
1259
|
-
formSettings.
|
|
1260
|
-
<button className="btn" onClick={
|
|
1261
|
-
{formSettings
|
|
1262
|
-
? formSettings.
|
|
1263
|
-
: '
|
|
1281
|
+
{formSettings.hasOwnProperty('sortButton') &&
|
|
1282
|
+
formSettings.sortButton.url ? (
|
|
1283
|
+
<button className="btn" onClick={handleSort}>
|
|
1284
|
+
{formSettings.sortButton.label
|
|
1285
|
+
? formSettings.sortButton.label
|
|
1286
|
+
: 'Sort'}
|
|
1264
1287
|
</button>
|
|
1265
|
-
)}
|
|
1288
|
+
) : null}
|
|
1289
|
+
|
|
1290
|
+
<button className="btn" onClick={handleSubmit}>
|
|
1291
|
+
{formSettings?.save?.button?.label
|
|
1292
|
+
? formSettings.save.button.label
|
|
1293
|
+
: 'Save'}
|
|
1294
|
+
</button>
|
|
1266
1295
|
</div>
|
|
1267
1296
|
</div>
|
|
1268
1297
|
);
|
package/package.json
CHANGED