import React from 'react';

export default ({ field1c, fieldCb, id, saveValue, editMode, editId, curBlockId, blockId }) => {
    const closeBtnHidden = (editId && fieldCb == editId) ? (!editMode ? ' hidden-1c' : (curBlockId === blockId ? '' : ' hidden-1c')) : ' hidden-1c';
    
    return (
        <>
            <button
                type="button"
                className={`user-data__close-edit-btn table-settings-btn${closeBtnHidden}`}
                id={`save-btn${id}`}
                field_type="matching"
                onClick={(e) => {
                    $(e.target).parent().parent().find('.chosen-container').each((i, item) => {
                        $(item).css('display', 'none');
                    });
                    saveValue(e);
                }}
                field_1c={field1c}
                field_cb={fieldCb}
            />
        </>
    )
};