"use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/slicedToArray"),n=require("react"),a=require("moment"),r=require("classnames"),i=require("@material-ui/core"),s=require("../../../../utils/index.js"),o=require("../../../Modal/Modal.js"),l=require("../../../PostInput/PostInput.js"),c=require("../../../IconButton/index.js"),d=require("../../../Typography.js"),u=require("../../../Icons/SendIcon.js"),m=require("../../../UserMention/utils/index.js"),p=require("../../../../constants/feed.js"),h=require("react/jsx-runtime");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=g(e),x=g(t),y=g(a),j=g(r);function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?b(Object(n),!0).forEach((function(t){f.default(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var N=i.makeStyles((function(e){return{postInput:{paddingBottom:8},filePreviewWrapper:{width:"100%",marginLeft:0,maxHeight:251},modal:{maxWidth:450,width:"100vw"},actionsAdornment:{flex:1},info:{marginTop:16},text:{color:e.palette.primary.text6},value:{color:e.palette.primary.text1},inputMain:{marginBottom:0,fontSize:"11px",color:e.palette.primary.text8},inputHelper:{display:"flex",paddingRight:5},cancelText:{cursor:"pointer"},highlightedLabel:{color:e.palette.primary.main},modalActions:{paddingTop:16},actions:{height:36},sendRow:{display:"flex"},sendIcon:{"&.Mui-disabled":{cursor:"not-allowed!important"}}}}));module.exports=function(e){var t=e.feedItem.context,a=t.id,r=t.lessons_learned,g=r.attachment,f=r.timestamp,b=r.data,w=r.data,O=w.description,C=w.cause,P=w.section,q=w.activity,I=w.md_start,T=w.tvd_start,D=e.onClose,M=e.onSave,S=e.userCompanyId,B=N(),E=n.useRef(),R=n.useState({body:O,attachment:g}),H=x.default(R,2),_=H[0],k=H[1],F=function(){M({context:{id:a,lessons_learned:{attachment:_.attachment,data:v(v({},b),{},{description:_.body})}}})};return h.jsxs(o,{open:!0,onClose:D,title:"Edit Comment",contentClassName:B.modal,actionsClassName:B.modalActions,onClick:function(e){e.stopPropagation()},actions:h.jsxs(i.Grid,{container:!0,direction:"row",justify:"space-between",alignItems:"center",className:B.actions,children:[h.jsx(i.Grid,{item:!0,children:h.jsx(i.Typography,{variant:"caption",className:j.default(B.inputMain,B.cancelText,B.highlightedLabel),"data-testid":"".concat("EditComment","_cancel"),component:"div",gutterBottom:!0,onClick:D,children:"Cancel"})}),h.jsxs(i.Grid,{item:!0,direction:"row",alignItems:"center",className:B.sendRow,children:[h.jsxs(i.Typography,{variant:"caption",className:j.default(B.inputMain,B.inputHelper),component:"div",gutterBottom:!0,children:["Press ",h.jsx(i.Typography,{variant:"caption",color:"primary",className:j.default(B.inputMain,B.highlightedLabel),children:"Enter"})," to send"]}),h.jsx(c,{onClick:F,className:B.sendIcon,"data-testid":"".concat("EditComment","_send"),disabled:!_||!_.body&&!_.attachment,children:h.jsx(u,{})})]})]}),ref:E,children:[h.jsx(l,{initialValue:{body:O,attachment:g},userCompanyId:S,onChange:k,filePreviewWrapperClass:B.filePreviewWrapper,className:B.postInput,onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||m.isSuggestionsListOpened()||(e.preventDefault(),F())},mentionStyle:p.MENTION_STYLE,suggestionsPortalHost:E.current,allowSuggestionsAboveCursor:!0}),h.jsxs("div",{className:B.info,children:[f&&h.jsxs(d.Regular14,{className:B.text,gutterBottom:!0,children:["Time:"," ",h.jsx("span",{className:B.value,children:y.default(f).format("MM/DD/YY, HH:mm")})," "]}),C&&h.jsxs(d.Regular14,{className:B.text,gutterBottom:!0,children:["Event Cause: ",h.jsx("span",{className:B.value,children:C})]}),(Number.isFinite(I)||Number.isFinite(T))&&h.jsxs(d.Regular14,{className:B.text,gutterBottom:!0,children:["MD/TVD:"," ",h.jsxs("span",{className:B.value,children:[Number.isFinite(I)?"".concat(I.fixFloat(2),"  ").concat(s.getUnitDisplay("length")):"-","/",Number.isFinite(T)?"".concat(T.fixFloat(2),"  ").concat(s.getUnitDisplay("length")):"-"]})]}),P&&h.jsxs(d.Regular14,{className:B.text,gutterBottom:!0,children:["Hole Section: ",h.jsx("span",{className:B.value,children:P})]}),q&&h.jsxs(d.Regular14,{className:B.text,gutterBottom:!0,children:["Operation: ",h.jsx("span",{className:B.value,children:q})]})]})]})};
//# sourceMappingURL=LessonsLearnedEdit.js.map
