"use strict";
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.EditRecordModal = exports.EditRecordModalCustomIsLoading = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
/* eslint-disable react/no-array-index-key -- keeping unique s3 images */
/* eslint-disable camelcase -- animation_url */
const react_1 = require("@chakra-ui/react");
const EditRecordForm_1 = require("./EditRecordForm");
const EditRecordModalCustomIsLoading = ({ title, form, onFormSubmit, onFormError, disclosure: { onClose, isOpen }, formKeys, isLoading, }) => ((0, jsx_runtime_1.jsxs)(react_1.Modal, Object.assign({ isOpen: isOpen, onClose: onClose, size: "xl" }, { children: [(0, jsx_runtime_1.jsx)(react_1.ModalOverlay, {}), (0, jsx_runtime_1.jsx)(react_1.ModalContent, { children: (0, jsx_runtime_1.jsxs)("form", Object.assign({ onSubmit: form.handleSubmit(onFormSubmit, onFormError) }, { children: [(0, jsx_runtime_1.jsx)(react_1.ModalHeader, { children: title }), (0, jsx_runtime_1.jsx)(react_1.ModalCloseButton, {}), (0, jsx_runtime_1.jsx)(react_1.ModalBody, { children: (0, jsx_runtime_1.jsx)(EditRecordForm_1.EditRecordForm, { form: form, formKeys: formKeys }) }), (0, jsx_runtime_1.jsx)(react_1.ModalFooter, { children: (0, jsx_runtime_1.jsxs)(react_1.ButtonGroup, { children: [(0, jsx_runtime_1.jsx)(react_1.Button, Object.assign({ size: "sm", variant: "ghost", onClick: () => {
                                        form.reset();
                                        onClose();
                                    } }, { children: "Cancel" })), (0, jsx_runtime_1.jsx)(react_1.Button, Object.assign({ isDisabled: !form.formState.isDirty, size: "sm", colorScheme: "green", type: "submit", isLoading: isLoading }, { children: "Save" }))] }) })] })) })] })));
exports.EditRecordModalCustomIsLoading = EditRecordModalCustomIsLoading;
const EditRecordModal = (_a) => {
    var { mutationResponse } = _a, props = __rest(_a, ["mutationResponse"]);
    return ((0, jsx_runtime_1.jsx)(exports.EditRecordModalCustomIsLoading, Object.assign({}, props, { isLoading: mutationResponse.isPending })));
};
exports.EditRecordModal = EditRecordModal;
//# sourceMappingURL=EditRecordModal.js.map