UNPKG

lml-main

Version:

This is now a mono repository published into many standalone packages.

47 lines 2.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const React = require("react"); const react_redux_1 = require("react-redux"); const cosmo_redux_api_1 = require("@lml/cosmo-redux-api"); const constants_1 = require("../../constants"); const job_form_1 = require("../forms/job-form"); const actions_1 = require("../../actions"); const cosmoui_1 = require("cosmoui"); const styles = require('./job-form-modal.scss'); class JobFormModalComponent extends React.Component { constructor() { super(...arguments); this.onSubmit = (formData) => { const { job } = this.props; const { formType } = this.props.currentModal.modalProps; // console.log('SUBMIT JOB FORM', formType) // trigger a different flow depending on whether we are // creating, editing or clong a job this.props.submitJobForm(formData, formType, job); }; this.handleClose = () => { const { closeModal, currentModal } = this.props; closeModal(currentModal.modalType); }; } render() { const { job } = this.props; const { title, formType, } = this.props.currentModal.modalProps; return (React.createElement(cosmoui_1.Modal, { closeButton: true }, React.createElement(cosmoui_1.Form, { name: constants_1.JOB_FORM_KEY, onSubmit: this.onSubmit, className: styles.container }, React.createElement(cosmoui_1.Column, { fullWidth: true }, React.createElement(cosmoui_1.Header, { primary: true, className: styles.header }, title), React.createElement(job_form_1.JobForm, { job: job })), React.createElement(cosmoui_1.ButtonBar, null, React.createElement(cosmoui_1.Button, { id: `job-form-${formType}-confirm`, type: "submit" }, "Confirm"), React.createElement(cosmoui_1.Button, { id: `job-form-${formType}-cancel`, onClick: this.handleClose }, "Cancel"))))); } } const mapStateToProps = (state, ownProps) => ({ job: cosmo_redux_api_1.getJobById(state, ownProps.currentModal.modalProps.refId), }); const mapActionsToProps = { submitJobForm: actions_1.submitJobForm, }; exports.JobFormModal = react_redux_1.connect(mapStateToProps, mapActionsToProps)(JobFormModalComponent); //# sourceMappingURL=job-form-modal.js.map