import t from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/slicedToArray";import{useRef as o,useState as n}from"react";import r from"moment";import a from"classnames";import{makeStyles as i,Grid as c,Typography as s}from"@material-ui/core";import l from"../../../Modal/Modal.js";import m from"../../../PostInput/PostInput.js";import p from"../../../IconButton/index.js";import{Regular14 as d}from"../../../Typography.js";import u from"../../../Icons/SendIcon.js";import{isSuggestionsListOpened as f}from"../../../UserMention/utils/index.js";import{convertValue as h,getUnitDisplay as g}from"../../../../utils/convert.js";import{MENTION_STYLE as b}from"../../../../constants/feed.js";import{jsxs as y,jsx as v}from"react/jsx-runtime";function x(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.push.apply(o,n)}return o}function j(e){for(var o=1;o<arguments.length;o++){var n=null!=arguments[o]?arguments[o]:{};o%2?x(Object(n),!0).forEach((function(o){t(e,o,n[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):x(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var w=i((function(t){return{postInput:{paddingBottom:8},filePreviewWrapper:{width:"100%",marginLeft:0,maxHeight:251},modal:{maxWidth:450,width:"100vw"},actionsAdornment:{flex:1},info:{marginTop:16},text:{color:t.palette.primary.text6},value:{color:"#fff",paddingLeft:4},inputMain:{marginBottom:0,fontSize:"11px",color:t.palette.primary.text8},inputHelper:{display:"flex",paddingRight:5},cancelText:{cursor:"pointer"},highlightedLabel:{color:t.palette.primary.main},modalActions:{paddingTop:16},actions:{height:36},sendRow:{display:"flex"},sendIcon:{"&.Mui-disabled":{cursor:"not-allowed!important"}}}}));function N(t){var i=t.feedItem.context.hookload_broomstick_comment,x=i.body,N=i.attachment,O=i.data,P=i.data,C=P.timestamp,I=P.measuredDepth,M=P.activityLabel,k=P.hookload,D=t.onClose,B=t.onSave,S=t.userCompanyId,L=w(),H=h(+I,"length","ft"),T=h(+k,"force","klbf"),A=o(),E=n({body:x,attachment:N}),W=e(E,2),_=W[0],R=W[1],K=function(){B({context:{hookload_broomstick_comment:j(j({},_),{},{data:O})}})};return y(l,{open:!0,onClose:D,title:"Edit Comment",contentClassName:L.modal,actionsClassName:L.modalActions,onClick:function(t){t.stopPropagation()},actions:y(c,{container:!0,direction:"row",justify:"space-between",alignItems:"center",className:L.actions,children:[v(c,{item:!0,children:v(s,{variant:"caption",className:a(L.inputMain,L.cancelText,L.highlightedLabel),component:"div",gutterBottom:!0,onClick:D,children:"Cancel"})}),y(c,{item:!0,direction:"row",alignItems:"center",className:L.sendRow,children:[y(s,{variant:"caption",className:a(L.inputMain,L.inputHelper),component:"div",gutterBottom:!0,children:["Press ",v(s,{variant:"caption",color:"primary",className:a(L.inputMain,L.highlightedLabel),children:"Enter"})," to send"]}),v(p,{onClick:K,className:L.sendIcon,disabled:!_||!_.body&&!_.attachment,children:v(u,{})})]})]}),ref:A,children:[v(m,{initialValue:{body:x,attachment:N},userCompanyId:S,onChange:R,filePreviewWrapperClass:L.filePreviewWrapper,className:L.postInput,onKeyDown:function(t){"Enter"!==t.key||t.shiftKey||f()||(t.preventDefault(),K())},mentionStyle:b,suggestionsPortalHost:A.current,allowSuggestionsAboveCursor:!0}),y("div",{className:L.info,children:[Number.isFinite(I)&&y(d,{className:L.text,gutterBottom:!0,children:["Measured Depth:",v("span",{className:L.value,children:"".concat(Math.round(H).toLocaleString()," ").concat(g("length"))})]}),k&&y(d,{className:L.text,gutterBottom:!0,children:["Hookload:",v("span",{className:L.value,children:"".concat(Math.round(T).toLocaleString()," ").concat(g("force"))})]}),M&&y(d,{className:L.text,gutterBottom:!0,children:["Activity:",v("span",{className:L.value,children:M})]}),C&&y(d,{className:L.text,gutterBottom:!0,children:["Time:",v("span",{className:L.value,children:r.unix(C).format("MM/DD/YY HH:mm")})]})]})]})}export{N as default};
//# sourceMappingURL=HookloadCommentEdit.js.map
