PageSourceSearch

https://docosan.com/_next/static/chunks/pages/providers/prescription-eaf92234f01013b0.js

js docosan.com collected 2026-10-01 15:18:28 UTC 66,404 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3695],{598:function(e,n,t){"use strict";t.r(n),t.d(n,{PrescriptionProviderPage:function(){return e$},default:function(){return e0}});var r=t(59499),i=t(16835),o=t(67294),a=t(11163),s=t(65242),l=t(14890),c=t(12783),d=t(41139),u=t(39568),p=t(63238),m=t(98708),h=t(79937),f=t(24742),g=t(18330),x=t(84979),v=t(41658);t(17997);var b=t(50029),w=t(27812),j=t(87794),y=t.n(j),_=t(14001),N=t(96486);t(34607),t(44345),t(19318);var O=t(5199),k=t(42283),S=t(46338),D=t(92814),P=t(26203),C=t(46020),I=t.n(C),E=t(55519),A=t(30381),L=t.n(A),Z=t(77163),M=t(53749),X=c.ZP.div.withConfig({componentId:"sc-7or2fb-0"})(function(e){var n=e.theme;return'\n  .prescription-header {\n    padding: 15px 19px;\n    border-bottom: 1px solid #AEAEAE;\n    justify-content: space-between;\n    align-items: center;\n    max-height: 76px;\n    .template-title {\n      font-size: 24px;\n      font-weight: bold;\n      color: #4D4D4D;\n    }\n    .note {\n      font-size: 16px;\n      color: #072D60;\n      font-style: italic;\n    }\n  }\n  .prescription-body {\n    height: calc(100vh - 223px);\n    overflow-x: hidden;\n    overflow-y: scroll;\n  }\n  .main-template {\n    font-size: 16px;\n    .group-section {\n      position: relative;\n      border: 1px solid #AEAEAE;\n      border-radius: 4px;\n      padding: 16px 16px 8px;\n      margin: 16px 19px;\n      background: #ffffff;\n    }\n    .group-title {\n      position: absolute;\n      top: -12px;\n      left: 16px;\n      padding: 0 8px;\n      background: #ffffff;\n      color: #072D60;\n      font-weight: 600;\n    }\n    /* Unified label/input widths for alignment */\n    .rx-input-row { width: 100%; align-items: center; }\n    .rx-label {\n      flex: 0 0 25%;\n      max-width: 25%;\n      padding-right: 8px;\n      display: flex;\n      align-items: center;\n      white-space: nowrap;\n    }\n    .rx-input {\n      flex: 0 0 75%;\n      max-width: 75%;\n      display: block;\n    }\n    /* Compact vertical rhythm across the screen */\n    .row { margin-top: 6px; margin-bottom: 6px; }\n    .m-1 { margin: 6px !important; }\n    label, b, p { margin-bottom: 2px; }\n    * { line-height: 1.2; }\n\n    @media (max-width: 767.98px) {\n      .rx-label, .rx-input { flex: 0 0 100%; max-width: 100%; }\n    }\n    input, textarea {\n      width: 100%;\n      border: none;\n      border-bottom: 1px solid #AEAEAE;\n      padding-bottom: 0;\n      max-width: 100%;\n      flex: 0 0 100%;\n      min-height: 32px;\n      &:focus-visible {\n        outline: none;\n      }\n      &::placeholder {\n        font-style: italic;\n        color: #B3BECE; /* lighter hint text */\n      }\n      &.input-label, &.textare-label {\n        border-bottom: none;\n        overflow: hidden;\n        flex: 0 0 100%;\n        max-width: 100%;\n      }\n    }\n    .react-calendar {\n      .react-calendar__tile--active {\n        background: #70BDE9;\n      }\n      .react-calendar__tile--now {\n        background: #FFC455;\n      }\n    }\n    .react-date-picker__inputGroup__input {\n      border: none;\n    }\n    .star-require {\n      color: #D62D68;\n    }\n    .field-name {\n      color: #000000;\n      flex: 0 0 auto;\n      max-width: 100%;\n    }\n    .small-field {\n      .field-name {\n        flex: 0 0 auto;\n        max-width: 100%;\n      }\n      input {\n        max-width: 100%;\n      }\n    }\n    .special-field {\n        input {\n          text-align: center;\n        }\n      }\n    .other-field {\n      .field-name {\n        flex: 0 0 auto;\n        max-width: 100%;\n      }\n      input, textarea {\n        max-width: 100%;\n      }\n    }\n    .error-msg {\n      font-size: 12px;\n      color: #D62D68;\n    }\n    .patient-info {\n      padding: 19px;\n      border-bottom: 1px solid #AEAEAE;\n      .react-select-gender {\n        width: 140px;\n        margin-bottom: 6px;\n        input, textarea {\n          min-height: 22px;\n        }\n      }\n    }\n    .prescription-info {\n      padding: 19px;\n      // border-bottom: 1px solid #AEAEAE;\n      .react-date-picker__clear-button {\n        svg {width: 14px;}\n\n      }\n      .prescription-table {\n        .table-wrapper {\n          // margin: 20px -20px;\n          position: relative;\n          width: 100%;\n          // overflow: auto;\n        }\n        .oveflow-unset {\n          overflow: unset;\n          &:after { \n            content: "";\n            background: #fff;\n            width: 19px;\n            position: absolute;\n            top: 0;\n            right: -2%;\n            height: 100%;\n          }\n        }\n        .oveflow-auto {\n          overflow: auto;\n        }\n        .table-detail {\n          height: 100%;\n          input, textarea {\n            padding: 6px;\n            width: calc(100% - 30px);\n            border-bottom: none;\n            flex: 0 0 100%;\n            max-width: 100%;\n            // height: 43px;\n            &.input-value {\n              border-bottom: none;\n            }\n          }\n          input {\n            max-width: 200px;\n            height: 100%;\n          }\n          thead {\n            tr {\n              background-color: #A9E0D3;\n              color: #000000;\n            }\n          }\n\n          th {\n            padding: 6px;\n            border-color: #B3BECE;\n            border-width: 1px;\n          }\n          td {\n            padding: 0px;\n            border: 1px solid #dee2e6;\n            vertical-align: middle;\n            text-align: center;\n            // max-width: 200px;\n            input, textarea {\n              width: 100%;\n              max-width: 100%;\n              min-width: 100px;\n              text-overflow: ellipsis;\n              border: none;\n              background: transparent;\n              &:focus-visible {\n                outline: none;\n                border: 1px solid #B3BECE !important;\n              }\n            }\n            input {\n              // max-width: 200px;\n            }\n            textarea {\n              width: fit-content;\n              display: flex;\n              overflow: hidden;\n            }\n            &.error {\n              input, textarea {border: 1px solid #D62D68 !important;}\n              .react-select-unit {border: 1px solid #D62D68 !important;}\n            }\n          }\n        }\n      }\n    }\n    .assign-doctor {\n      flex: 0 0 35%;\n    }\n    .box-sign {\n      display: grid;\n      justify-content: center;\n      img {\n        object-fit: scale-down;\n        margin: auto;\n      }\n    }\n    .note-msg {\n      // color: #D62D68;\n      color: '.concat(n.palette.common.text.main,'\n      font-size: 14px;\n      font-style: italic;\n    }\n    .add-field {\n      color: #072D60;\n      font-weight: 500;\n    }\n    .note-for-patient {\n      input, textarea {\n        width: 100%;\n      }\n    }\n    .react-select-doctor {\n      flex: 0 0 100%;\n      max-width: 100%;\n      &:focus-visible {\n        outline: none;\n      }\n    }\n    .react-select-unit {\n      flex: 0 0 100%;\n      max-width: 100%;\n    }\n    .react-select-diagnose input {\n      width: 100% !important;\n    }\n    .selected-diagnose-item {\n      margin: 10px 0 4px;\n      padding: 4px 19px 4px 10px;\n      background: #F5F5F5;\n      border: 0.5px solid #B3BECE;\n      color: #4D4D4D;\n      border-radius: 32px;\n      position: relative;\n      white-space: nowrap;\n      overflow: hidden;\n      text-overflow: ellipsis;\n      svg {\n        position: absolute;\n        right: 10px;\n        top: 50%;\n        transform: translateY(-50%);\n      }\n    }\n    .template-footer {\n      border-top: 1px solid #AEAEAE;\n      justify-content: space-between;\n      align-items: center;\n      padding: 19px;\n      max-height: 93px;\n      .btn-blue-secondary {\n        color: #fff;\n        padding: 14px 25px;\n      }\n      .btn-save-prescription {\n        color: #072D60;\n        border: 1px solid #072D60;\n        padding: 14px 25px;\n        margin-right: 19px;\n      }\n    }\n  }\n  \n  .react-autosuggest__container {\n    display: flex;\n    flex: 1 auto;\n    height: 100%;\n    min-width: 300px;\n    text-align: start;\n    input {\n      border-bottom: none !important;\n      text-overflow: ellipsis;\n    }\n    .react-autosuggest__suggestions-container {\n      position: absolute;\n      top: 105%;\n      left: 0;\n      width: 100%;\n      cursor: pointer;\n      max-height: 250px;\n    }\n  }\n  \n  // .react-autosuggest__input--focused {\n  //   background: red;\n  // }\n  .wfc {\n    // width: fit-content !important;\n  }\n  .pore {\n    position: relative;\n  }\n  .h43 {\n    height: 43px;\n  }\n  .h32 {\n    height: 32px;\n    padding: 5px 6px;\n  }\n  .height100 {\n    height: 100%;\n  }\n  textarea {\n    overflow: hidden;\n  }\n  @media screen and (max-width: 823px) {\n    .prescription-header {\n      max-height: 85px;\n      min-height: 85px;\n      display: block !important;\n      .template-title {\n        margin-bottom: 0;\n      }\n      .note {\n        justify-content: start;\n        display: flex;\n        margin: 0\n      }\n    }\n    .prescription-body {\n      height: calc(100vh - 245px);\n    }  \n\n    .template-footer {\n      display: block !important;\n      max-height: 110px !important;\n      min-height: 110px !important;\n    }\n    .box-btn {\n      display: flex;\n      justify-content: end;\n    }\n  }\n  @media screen and (max-width: 767px) {\n    .box-row-end-body {\n      display: block !important;\n    }\n    .assign-doctor {\n      margin-top: 19px !important;\n      display: grid;\n    }\n    .react-autosuggest__container {\n      max-width: 250px;\n      min-width: 250px;\n      // .react-autosuggest__suggestions-container {\n      //   top: calc(100% - 44px);
1\n      //   left: 9%;\n      //   width: 70%;\n      // }\n    }\n    .pore, .table-wrapper {\n      // position: unset !important;\n    }\n    .prescription-table {\n      position: relative;\n      .table-wrapper {\n        position: relative;\n        width: 100%;\n        margin: 0;\n      }\n      \n      .oveflow-unset {\n        overflow: unset;\n        &:after { \n          content: "";\n          background: #fff;\n          width: 19px;\n          position: absolute;\n          top: -1% !important;\n          right: -5% !important;\n          height: 110% !important;\n        }\n      }\n    }\n    .wfc {\n      width: fit-content !important;\n    }\n  }\n  \n  @media screen and (max-width: 647px) {\n    .prescription-header {\n      max-height: 91px !important;\n      min-height: 91px !important;\n    }\n  }\n  @media screen and (max-width: 414px) {\n    .template-footer {\n      max-height: 110px !important;\n      min-height: 110px !important;\n      position: absolute;\n      bottom: 0;\n      left: 0;\n      width: 100%;\n      .box-btn {\n        justify-content: center;\n      }\n    }\n    .prescription-body {\n      height: calc(100vh - 261px) !important;\n    }\n  }\n  \n  @media screen and (max-width: 386px) {\n    .template-footer {\n      max-height: 130px !important;\n      min-height: 130px !important;\n    }\n    .prescription-body {\n      height: calc(100vh - 290px) !important;\n    }\n  }\n  \n  @media screen and (max-width: 375px) {\n    .prescription-body {\n      height: calc(100vh - 280px) !important;\n    }\n  }\n  @media screen and (max-width: 320px) {\n    .prescription-header {\n      max-height: 115px !important;\n      min-height: 115px !important;\n      display: grid !important;\n    }\n    .prescription-body {\n      height: calc(100vh - 305px) !important;\n    }\n  }\n  .react-autosuggest__suggestions-container--open {\n    ul.react-autosuggest__suggestions-list {\n      list-style-type: none;\n      padding-left: 0;\n      margin: 0;\n    }\n\n    font-weight: 300;\n    font-size: 16px;\n    background: rgb(255, 255, 255);\n    z-index: 9;\n    max-height: 500px;\n    overflow: hidden auto;\n    border: none;\n    box-shadow: rgb(0 0 0 / 30%) 0px 0px 10px 2px;\n    padding: 5px 0;\n    border-radius: 0 0 5px 5px;\n    ::-webkit-scrollbar {\n      width: 0.25rem;\n    }\n    ::-webkit-scrollbar-track {\n      box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);\n      border-radius: 5px;\n    }\n    ::-webkit-scrollbar-thumb {\n      background-color: darkgrey;\n      border-radius: 5px;\n    }\n    &::-webkit-scrollbar-thumb:hover {\n      width: 1rem;\n      box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);\n    }\n\n    .react-autosuggest__suggestions-list {\n      list-style-type: none;\n      padding-left: 0;\n\n      .react-autosuggest__suggestion {\n        color: #333333;\n        &:hover { \n          background-color: #4AC0A4;\n        }\n\n        &:not(:last-child) {\n          border-bottom: 1px solid #b3bece;\n        }\n      }\n    }\n    \n    .react-autosuggest__suggestions {\n      margin: 0 !important;\n    }\n    .patient-focus__item {\n      padding: 5px;\n      margin-left: 19px !important;\n      // align-items: start\n    }\n  }\n\n  @media screen and (max-width: 575.98px) {\n    .main-template {\n      .patient-info {\n        .row:first-of-type {\n          :not(div:nth-child(2)) {\n            .field-name {\n              flex: 0 0 45%;\n              max-width: 45%;\n            }\n\n            input {\n              max-width: 55%;\n              flex: 0 0 55%;\n            }\n          }\n\n          div:nth-child(5) {\n            .field-name {\n              align-self: flex-start;\n            }\n\n            textarea {\n              width: 100%;\n            }\n          }\n        }\n\n        .row:last-of-type > div > div:first-child {\n          .input-label {\n            flex: 0 0 30%;\n            max-width: 30%;\n          }\n\n          input:last-child {\n            max-width: 70%;\n            flex: 0 0 70%;\n          }\n        }\n      }\n\n      .prescription-info {\n        .prescription-table {\n          .table-wrapper {\n            position: relative;\n            width: 100%;\n            // overflow-x: auto;\n            margin: 0;\n            ::-webkit-scrollbar {\n              width: 0.25rem;\n              height: 0.25rem;\n            }\n            ::-webkit-scrollbar-track {\n              box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);\n            }\n            ::-webkit-scrollbar-thumb {\n              background-color: darkgrey;\n            }\n          }\n        }\n      }\n    }\n\n    .react-select-unit {\n      & div {\n        padding: 0;\n      }\n\n      & div + div {\n        width: 70px;\n      }\n    }\n  }\n\n  @media screen and (max-width: 374.98px) {\n    .main-template {\n      .patient-info {\n        .row:last-of-type {\n          .input-label {\n            max-width: 35%;\n            flex: 0 0 35%;\n          }\n\n          input {\n            max-width: 65%;\n            flex: 0 0 65%;\n          }\n        }\n      }\n    }\n  }\n')}),q=t(676),T={BLANK:"Blank",DENTAL:"Dental",PEDIATRIC:"Pediatric",OPHTHALMOLOLOGY:"Ophthalmolology"},V=[{value:"Male",label:"Male"},{value:"Female",label:"Female"},{value:"Other",label:"Other"}],J=[{value:"Nam",label:"Nam"},{value:"Nữ",label:"Nữ"},{value:"Kh\xe1c",label:"Kh\xe1c"}],F=t(1852),B=t(61692),R=t(58808),G=t.n(R),H=t(85893);function Y(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,r)}return t}function U(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};
1n%2?Y(Object(t),!0).forEach(function(n){(0,r.Z)(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Y(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}var z=function(e){var n=e.name,t=e.isNewItem,r=e.setValue,i=(e.getValues,e.dataSuggestions),a=e.className,s=(e.t,e.index),l=e.value,c=e.onFocus,d=e.handleSearch,u=e.onKeyDown,p=e.isLoading,m=e.clearErrors,h=e.onChange,f=(e.setIsLoading,e.onItemSelected),g=(0,o.useRef)();(0,o.useEffect)(function(){if(t){var e;null===(e=g.current)||void 0===e||e.focus()}},[t]);var x=(0,o.useState)([]),v=x[0],b=x[1],w=(0,o.useState)(!1),j=w[0],y=w[1],_=(0,o.useState)(""),N=(_[0],_[1]);(0,o.useEffect)(function(){p?b([""]):b(i.map(function(e){return e.name}))},[i,p]),(0,o.useEffect)(function(){if(!(0,B.Ew)(l)&&!0!==j){var e=setTimeout(function(){d(l)},500);return m("prescription[".concat(s,"].name")),function(){return clearTimeout(e)}}},[l,j]);var O=function(e,n){var t=n.newValue;return e.preventDefault(),e.stopPropagation(),["ArrowDown","ArrowUp","Enter"].includes(e.key)||(N(t||""),h(t||"")),t||""},k=function(e){e.value},S=function(e,n){var t=n.isHighlighted;return!0===p?(0,H.jsx)("div",{className:"patient-focus__item",children:(0,H.jsx)("div",{className:"name",children:"Đang tải..."})}):(null==i?void 0:i.length)<=0||(0,B.le)(e)?(0,H.jsx)("div",{className:"patient-focus__item",children:(0,H.jsx)("div",{className:"name",children:"Dữ liệu trống"})}):(0,H.jsx)(Q,{highlighted:t,children:(0,H.jsx)("div",{className:"name",children:e})})},D=function(e){return r("prescription[".concat(s,"].unit"),null==e?void 0:e.unit,{shouldValidate:!0}),null==e?void 0:e.short_name},P=function(e,n){var t=n.suggestion;n.suggestionValue,n.index,n.method,e.preventDefault(),y(!0);var r=i.findIndex(function(e){return e.name===t});-1!=r&&f(i[r])};return(0,H.jsx)(G(),{id:"prescription[".concat(s,"].name"),suggestions:!0==!p&&v,onSuggestionsFetchRequested:k,renderSuggestionsContainer:function(e){var n=e.containerProps,t=e.children;e.query;var r=t&&o.Children.count(t)>0;return(0,H.jsx)(W,U(U({},n),{},{isOpen:r,children:t}))},renderSuggestion:S,inputProps:{value:null!=l?l:"",ref:function(e){return g.current=e},onChange:O,onKeyDown:u,onFocus:c,name:n,placeholder:"Nhập t\xean thuốc...",className:a},getSuggestionValue:D,onSuggestionSelected:P,className:a,shouldRenderSuggestions:function(e){return!0}})},Q=c.ZP.div.withConfig({componentId:"sc-1qqz1sf-0"})(["padding:8px 12px;cursor:pointer;border-radius:4px;transition:background-color 0.2s ease,color 0.2s ease;&:hover{background-color:#4ac0a4;}",""],function(e){return e.highlighted&&"\n        background-color: #4ac0a4;\n        color: white;\n      "}),K=(0,c.F4)(["from{opacity:0;transform:translateY(-8px);}to{opacity:1;transform:translateY(0);}"]),W=c.ZP.div.withConfig({componentId:"sc-1qqz1sf-1"})(["position:absolute;z-index:10;background:white;border:1px solid #ccc;border-radius:4px;width:100%;",""],function(e){return e.isOpen&&(0,c.iv)(["opacity:0;transform:translateY(-8px);animation:"," 0.5s ease forwards;"],K)}),ee=t(94184),en=t.n(ee),et=t(98132),er=t(5444),ei=t(58877),eo=t.n(ei);function ea(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,r)}return t}function es(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ea(Object(t),!0).forEach(function(n){(0,r.Z)(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ea(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}var el=c.ZP.div.withConfig({componentId:"sc-12g7klm-0"})(function(e){var n=e.theme;return"\n  padding: 20px 15px;\n  padding-bottom: 0px;\n  .row {\n    padding-bottom: 40px;\n    border-bottom: 1px solid ".concat(n.palette.common.other.bordersOrDividers,";\n    display: grid;\n    grid-template-columns: repeat(2, 1fr);\n    p {\n      margin-bottom: 0.5rem;\n    }\n    .row-1 {\n      display: block;\n      margin: auto; \n      button {\n        padding: 12px;\n        min-width: auto;\n      }\n    }\n    .img {\n      width: 250px;\n      height: 100px;\n      display: flex;\n      justify-content: center;\n      align-items: center;\n      border: 1px solid ").concat(n.palette.common.other.bordersOrDivi
1ders,";\n      img {\n        width: 248px;\n        height: 98px;\n        object-fit: scale-down;\n      }\n    }\n    .row-2 {\n      margin: auto; \n      .canvas {\n        background: #fff;\n        border: 1px solid ").concat(n.palette.common.other.bordersOrDividers,";\n        width: 250px;\n        height: 100px\n        display: block;\n      }\n      .box-canvas {\n        position: relative;\n        width: 300px;\n        .img { \n          margin-left: 0 !important;\n        }\n      }\n      .icon-clean {\n        color: ").concat(n.palette.common.primary.green,"\n        position: absolute;\n        top: 0%;\n        right: 0% !important;\n        transform: translate(-50%, 50%);\n        cursor: pointer;\n      }\n      .icon-undo {\n        color: ").concat(n.palette.common.primary.green,"\n        position: absolute;\n        top: 0%;\n        right: 10% !important;\n        transform: translate(-50%, 50%);\n        cursor: pointer;\n      }\n    }\n    ").concat(n.breakpoints.down("md")," {\n      grid-template-columns: 1fr;\n      .row-1 {\n        margin: auto !important;\n        padding-bottom: 30px\n      }\n    }\n  }\n  .row-apply {\n    margin-top: 1rem !important;\n    gap: 10px;\n  }\n  @media screen and (max-width: 767px) {\n    .row {\n      padding-bottom: 0px;\n    }\n  }\n  ").concat(n.breakpoints.down("md")," {\n    padding: 0\n  }\n")}),ec=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return(null==e?void 0:e.length)>10?"".concat(e.replace(/(\.pdf|\.jpg|\.jpeg|\.png|\.doc|\.docx|\.PDF|\.JPG|\.JPEG|\.PNG|\.DOC|\.DOCX)/g,"").substr(0,n),"..."):"".concat(null==e?void 0:e.replace(/(\.pdf|\.jpg|\.jpeg|\.png|\.doc|\.docx|\.PDF|\.JPG|\.JPEG|\.PNG|\.DOC|\.DOCX)/g,"").substr(0,n),".")},ed=function(e){if(e)return 0>e.indexOf("https")&&0>e.indexOf("static")?[h.eG.api.url,e].join("/"):e};function eu(e){var n=e.t,t=e.selfInfo,r=e.doctorId,s=e.renderMessenger,l=e.handleClose,c=e.signatures,d=e.handleSetDoctorListApterChangeSignature,u=e.getDoctorClinic,p=e.width,m=e.height,f=(0,o.useState)(null),g=f[0],x=f[1],v=(0,o.useState)(null),w=v[0],j=v[1],_=(0,o.useState)(),N=_[0],k=_[1],S=(0,o.useRef)(null),C=(0,o.useState)(null),I=C[0],E=C[1],A=(0,o.useRef)(null),L=(0,o.useState)(!1),Z=L[0],M=L[1],X=(0,o.useState)(null),q=X[0],T=X[1],V=(0,O.fP)(["name"]),J=(0,i.Z)(V,2),F=J[0];J[1];var R=(0,a.useRouter)().query,G=(0,o.useState)(!1),Y=G[0],U=G[1];(0,o.useEffect)(function(){var e=document.getElementsByTagName("canvas")[0];e.width=p,e.height=m;var n=null!==c?ed(c):null;T(n),(0,B.Ew)(n)||M(!0)},[t,c]);var z,Q=function(e){A.current.click()},K=null==N?void 0:N.substring((null==N?void 0:N.indexOf("."))+1),W=function(){var e,n,t,r,i=null==S?void 0:null===(e=S.current)||void 0===e?void 0:e.getTrimmedCanvas().toDataURL("image/png");fetch(i).then(function(e){return e.arrayBuffer()}).then(function(e){return new File([e],"doctorSignature.png",{type:"image/png"})}).then(function(e){E(e)}),j(null),x(null)},ee=(z=(0,b.Z)(y().mark(function e(n){var t,i,o,a,c,p,m,f,g,x,v,b,_,N;return y().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(null===I&&(0,B.Ew)(w))){e.next=2;break}return e.abrupt("return",l&&l());case 2:return t={},!0===Z?(E(I),t=I):(j(w),t=w),e.prev=4,i={doctor_id:r,file:t},o={useFormData:!0},e.next=9,et.Z.post(h.eG.api.doctor.uploadSignature,i,void 0,o,{headers:{Authorization:"Bearer "+F.access_token}});case 9:if(!(200!==(a=e.sent).data.code)){e.next=15;break}return s(n,"error",a.data.error.message),e.abrupt("return");case 15:return l&&l(),s(n,"success"),m={id:null==R?void 0:R.id},e.next=20,u(m,null==F?void 0:F.access_token);case 20:if(!((null==(f=e.sent)?void 0:null===(c=f.payload)||void 0===c?void 0:null===(p=c.data)||void 0===p?void 0:p.code)!==200)){e.next=25;break}return e.abrupt("return");case 25:N=es(es({},JSON.parse(localStorage.getItem("dataApt"))),{},{doctorList:null==f?void 0:null===(g=f.payload)||void 0===g?void 0:null===(x=g.data)||void 0===x?void 0:x.data}),localStorage.setItem("dataApt",JSON.stringify(N)),d&&d(null==f?void 0:null===(v=f.payload)||void 0===v?void 0:null===(b=v.data)||void 0===b?void 0:b.data);case 29:e.next=34;break;case 31:e.prev=31,e.t0=e.catch(4),e.t0&&e.t0.data&&e.t0.data.error&&s(n,"error",res.data.error.message);case 34:case"end":return e.stop()}},e,null,[[4,31]])})),function(e){return z.apply(this,arguments)}),en=function(){l&&l()},ei=function(){var e;null==S||null===(e=S.current)||void 0===e||e.clear(),E(""),M(!1),U(!1),T(null)},ea=function(){var e,n,t,r=null==S?void 0:null===(e=S.current)||void 0===e?void 0:e.toData();r&&(r.pop(),null==S||null===(t=S.current)||void 0===t||t.fromData(r),W()),null!=S&&null!==(n=S.current)&&void 0!==n&&n.isEmpty()&&(U(!1),M(!1))};return(0,H.jsx)(H.Fragment,{children:(0,H.jsxs)(el,{children:[(0,H.jsxs)("div",{className:"row",children:[(0,H.jsxs)("div",{className:"row-1",children:[(0,H.jsx)("p",{children:n("providers:upload_signature")}),(0,H.jsx)("div",{className:"img",children:g&&(0,H.jsx)("img",{src:g})}),(0,H.jsxs)("div",{className:"d-flex align-items-center mt-2",children:[(0,H.jsx)(er.Z,{innerText:n("providers:choose_file"),onClick:Q,c
1olor:"outline"}),(0,H.jsx)("input",{type:"file",accept:"image/*",ref:A,onChange:function(e){var n,t,r,i,o,a;x(null===(n=URL)||void 0===n?void 0:n.createObjectURL(null==e?void 0:null===(t=e.target)||void 0===t?void 0:t.files[0])),j(null==e?void 0:null===(r=e.target)||void 0===r?void 0:r.files[0]),k(null==e?void 0:null===(i=e.target)||void 0===i?void 0:null===(o=i.files[0])||void 0===o?void 0:o.name),null==S||null===(a=S.current)||void 0===a||a.clear(),E(null),M(!1),U(!1),T(null)},style:{display:"none"}}),N&&(0,H.jsx)("span",{className:"ml-2",children:ec(N)+K})]})]}),(0,H.jsxs)("div",{className:"row-2",children:[(0,H.jsx)("p",{children:n("providers:draw_signature")}),(0,H.jsxs)("div",{className:"box-canvas",children:[(0,B.Ew)(q)?(0,H.jsx)(eo(),{canvasProps:{className:"canvas"},ref:S,onEnd:function(e){x(null),k(null),M(!0),W(),U(!0)},crossorigin:"anonymous"}):(0,H.jsx)("div",{className:"img",children:q&&(0,H.jsx)("img",{src:q})}),!0===Y&&(0,H.jsx)(D.G,{icon:P.X7o,onClick:ea,className:"icon-undo"}),!0===Z&&(0,H.jsx)(D.G,{icon:P.xf2,onClick:ei,className:"icon-clean"})]}),(0,H.jsx)("div",{style:{height:"48px"}})]})]}),(0,H.jsxs)("div",{className:"m-auto mt-2 d-flex align-items-center justify-content-center row-apply",children:[(0,H.jsx)(er.Z,{onClick:en,color:"text-only-pink",innerText:n("providers:cancel")}),(0,H.jsx)(er.Z,{onClick:ee,color:"outline",innerText:n("providers:apply")})]})]})})}var ep=_.u_.Header,em=_.u_.Body;_.u_.Footer;var eh=(0,c.ZP)(ep).withConfig({componentId:"sc-10uday0-0"})(["",";color:"," border-bottom:1px solid ",";"],function(e){return e.theme.typography.h2},function(e){return e.theme.palette.common.primary.navy},function(e){return e.theme.palette.common.other.bordersOrDividers}),ef=(0,c.ZP)(em).withConfig({componentId:"sc-10uday0-1"})(["width:100%;overflow:auto;padding:1rem 0;::-webkit-scrollbar{width:0.25rem;}::-webkit-scrollbar-track{box-shadow:inset 0 0 6px rgba(0,0,0,0.3);}::-webkit-scrollbar-thumb{background-color:darkgrey;}.img-responsive{display:block;max-width:100%;max-height:100%;margin:0 auto;object-fit:cover;}.img{width:300px !important;height:150px!important;img{width:250px!important;height:100px!important;}}.canvas{width:300px!important;height:150px !important;}.icon-clean{right:-18% !important;}@media screen and (max-width:767px){padding:1rem;}"]),eg=o.forwardRef(function(e,n){var t=e.t,r=e.selfInfo,i=e.doctorId,a=e.renderMessenger,s=e.signatures,l=e.handleSetDoctorListApterChangeSignature,c=e.getDoctorClinic,d=e.selectDoctor,u=(0,o.useState)(function(){return!1}),p=u[0],m=u[1],h=function(){return m(!1)};return(0,o.useImperativeHandle)(n,function(){return{handleClose:function(){h()},handleShow:function(){m(!0)}}}),(0,H.jsxs)(_.u_,{className:"confirm-modal pr-0",show:p,onHide:h,backdrop:"static",centered:!0,size:"xl",children:[(0,H.jsxs)(eh,{closeButton:!0,children:[" ",t("providers:signature_name_doctor",{name:null==d?void 0:d.label})," "]}),(0,H.jsx)(ef,{children:(0,H.jsx)(eu,{t:t,selfInfo:r,doctorId:i,renderMessenger:a,handleClose:h,signatures:s,handleSetDoctorListApterChangeSignature:function(e){return l(e)},getDoctorClinic:c,width:300,height:150})})]})}),ex=t(3187),ev=t(42526),eb=t(22920),ew=t(59457),ej=t(28599),ey=t(25675),e_=t.n(ey),eN=t(60966);function eO(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,r)}return t}function ek(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?eO(Object(t),!0).forEach(function(n){(0,r.Z)(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):eO(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}var eS=function(e){var n=e.label,t=e.renderLabel,r=e.fieldName,i=e.defaultValue,o=e.inputStyle,a=e.rules,s=e.placeholder,l=e.control,c=e.errorMessage,d=(e.labelCol16,e.maxLength);(0,S.$G)().t;var u=!!n||"function"==typeof t;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)("div",{className:"rx-input-row d-flex flex-wrap align-items-center",children:[u&&(0,H.jsx)("div",{className:"rx-label mb-1 mb-md-0",children:n?(0,H.jsx)("div",{className:"d-flex align-items-center",children:(0,H.jsxs)("b",{className:"mb-0",children:[n,":"]})}):t&&"function"==typeof t?(0,H.jsx)("div",{className:"d-flex align-items-center",children:(0,H.jsx)("b",{className:"mb-0",children:t()})}):null}),(0,H.jsx)("div",{className:"rx-input ".concat(u?"":"w-100"),children:(0,H.jsx)(k.Qr,{control:l,name:r,defaultValue:null!=i?i:"",rules:a,render:function(e){return e.name,e.onChange,e.value,(0,H.jsx)(eN._T,ek(ek({},e),{},{defaultValue:i,error:!!c,placeholder:s,maxLength:d,className:"form-control ".concat(c?"is-invalid":""),style:ek({borderBottom:"none",boxShadow:"none"},o||{})}))}})})]}),(0,H.jsx)(eN.Bc,{isVisible:!!c,children:c})]})},eD=function(e){var n,t,r,i,a,s,l,c,d=e.dataInfo,u=e.control,p=e.setValue,m=e.errors,h=(0,S.$G)().t,f=(0,o.useState)(!1),g=f[0],x=f[1],v=(0,o.useState)(""),b=v[0],w=v[1];(0,o.useEffect)(function(){if(!g&&null!=d&&d.clinicInfo){p("clinicName",(null==d?void 0:null===(e=d.clinicInfo)||void 0===e?void 0:e.name)||"Ph\xf2ng kh\xe1m DiaB"),p("clinicAddress",(null==d?void 0:null===(n=d.clinicInfo)||void 0===n?void 0:n.address)||"L17-11 Tầng 17, T\xf2a nh\xe0 Vincom Center, 72 L\xea Th\xe1nh T\xf4n, P. Bến Ngh\xe9, Q. 1, TPHCM"),p("clinicPhone",null==d?void 0:null===(t=d.clinicInfo)||void 0===t?void 0:t.phone),null!=d&&d.clinicId?null==d||d.clinicId:null==d||null===(r=d.clinicInfo)||void 0===r||r.clinic_id,p("clinicNumber","11176/HCM-GPHĐ");var e,n,t,r,i=new Date,o=String(i.getFullYear()).slice(-2),a=String(i.getMonth()+1).padStart(2,"0"),s=String(i.getDate()).padStart(2,"0"),l=String(i.getHours()).padStart(2,"0"),c=String(i.getMinutes()).padStart(2,"0"),u="".concat(o).concat(a).concat(s).concat(l).concat(c);p("clinicCode",u),w(u),x(!0)}},[d,g]);var j=function(){return(0,H.jsxs)(H.Fragment,{children:[h("providers:phone"),": ",(0,H.jsx)("span",{className:"star-require",children:"*"})]})};return(0,H.jsxs)(_.X2,{className:"m-1",children:[(0,H.jsxs)(_.JX,{md:5,children:[(0,H.jsx)(eS,{fieldName:"
1clinicName",inputStyle:{width:"100%",textTransform:"uppercase"},defaultValue:(null==d?void 0:null===(n=d.clinicInfo)||void 0===n?void 0:n.name)||"Ph\xf2ng kh\xe1m DiaB",rules:{required:h("common:errors.empty")},placeholder:h("providers:placeholder_partner_field"),control:u,errorMessage:null==m?void 0:null===(t=m.clinicName)||void 0===t?void 0:t.message}),(0,H.jsx)(eS,{fieldName:"clinicAddress",inputStyle:{width:"100%"},defaultValue:(null==d?void 0:null===(r=d.clinicInfo)||void 0===r?void 0:r.address)||"L17-11 Tầng 17, T\xf2a nh\xe0 Vincom Center, 72 L\xea Th\xe1nh T\xf4n, P. Bến Ngh\xe9, Q. 1, TPHCM",rules:{required:h("common:errors.empty")},placeholder:h("providers:placeholder_partner_field"),control:u,errorMessage:null==m?void 0:null===(i=m.clinicAddress)||void 0===i?void 0:i.message}),(0,H.jsx)(eS,{renderLabel:j,fieldName:"clinicPhone",defaultValue:null==d?void 0:null===(a=d.clinicInfo)||void 0===a?void 0:a.phone,rules:{required:h("common:errors.empty"),pattern:{value:/^(?:\d{10}|\+84\d{9})$/,message:h("providers:phone_number_validate_error")}},placeholder:h("providers:enter_phone_number"),control:u,errorMessage:null==m?void 0:null===(s=m.clinicPhone)||void 0===s?void 0:s.message})]}),(0,H.jsxs)(_.JX,{md:4,className:"text-center",children:[(0,H.jsx)("p",{className:"mt-2",children:(0,H.jsx)("strong",{children:"ĐƠN THUỐC"})}),(0,H.jsx)(e_(),{src:"/static/barcode.png",alt:"qr code",layout:"fixed",width:150,height:70})]}),(0,H.jsx)(_.JX,{md:2,children:(0,H.jsxs)(eN.FV,{children:[(0,H.jsx)(eS,{fieldName:"clinicNumber",label:"Số",defaultValue:"11176/HCM-GPHĐ",rules:{required:h("common:errors.empty")},placeholder:h("providers:enter_prescription_code"),control:u,errorMessage:null==m?void 0:null===(l=m.clinicNumber)||void 0===l?void 0:l.message}),(0,H.jsx)(eS,{fieldName:"clinicCode",label:"MS",defaultValue:b,rules:{required:h("common:errors.empty")},placeholder:h("providers:enter_code"),control:u,errorMessage:null==m?void 0:null===(c=m.clinicCode)||void 0===c?void 0:c.message})]})})]})};function eP(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,r)}return t}function eC(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?eP(Object(t),!0).forEach(function(n){(0,r.Z)(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):eP(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}var eI=function(e){var n,t,r,i,o,a,s=e.selfInfo,l=e.dataInfo,c=e.gender,d=e.control,u=(e.value,e.setValue),p=e.errors,m=e.isMobile,h=(0,S.$G)().t,f=function(){return(0,H.jsxs)(H.Fragment,{children:[h("providers:patient_name"),": ",(0,H.jsx)("span",{className:"star-require",children:"*"})]})},g=function(){return(0,H.jsxs)(H.Fragment,{children:[h("providers:phone_number_shorthand_label"),": ",(0,H.jsx)("span",{className:"star-require",children:"*"})]})};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(_.X2,{className:"m-1",style:{display:"flex"},children:[(0,H.jsx)(_.JX,{md:6,children:(0,H.jsx)(eS,{control:d,renderLabel:f,fieldName:"patientName",defaultValue:null==l?void 0:l.patientName,rules:{required:h("providers:error_name_is_required")},placeholder:h("patient:placeholder_name"),errorMessage:null==p?void 0:null===(n=p.patientName)||void 0===n?void 0:n.message,inputStyle:{maxWidth:"100%"},maxLength:50})}),(0,H.jsx)(_.JX,{md:3,children:(0,H.jsx)(eS,{label:h("providers:age"),fieldName:"patientAge",defaultValue:null==l?void 0:l.age,placeholder:h("providers:age"),control:d,errorMessage:null==p?void 0:null===(t=p.patientAge)||void 0===t?void 0:t.message})})]}),(0,H.jsxs)(_.X2,{className:"m-1",style:{display:"flex"},children:[(0,H.jsxs)(_.JX,{md:6,children:[(0,H.jsx)(eS,{label:"Họ t\xean người gi\xe1m hộ",fieldName:"patientParent",placeholder:h("patient:placeholder_name"),control:d,maxLength:50}),(0,H.jsx)("div",{className:"note-msg",children:"d\xe0nh cho trẻ dưới 72 th\xe1ng tuổi"})]}),(0,H.jsx)(_.JX,{md:3,children:(0,H.jsxs)("div",{className:"rx-input-row d-flex align-items-center",children:[(0,H.jsx)("div",{className:"rx-label",children:(0,H.jsx)("b",{children:"Giới t\xednh:"})}),(0,H.jsx)("div",{className:"rx-input",children:(0,H.jsx)(k.Qr,{control:d,name:"patientGender",render:function(e){return e.field,(0,H.jsx)(E.ZP,{value:c,options:(null==s?void 0:s.language)=="en"?V:J,getOptionLabel:function(e){return e.label},getOptionValue:function(e){return e.value},onChange:function(e){u("gender",e.label)},className:"react-select-gender custom-scroll",styles:{container:function(e){return eC(eC({},e),{},{width:"60%"})},option:function(e,n){return eC(eC({},e),{},{backgroundColor:n.isSelected?"#4ac0a4":n.isFocused?"#6fbce8":"white",color:n.isSelected||n.isFocused?"white":"black",cursor:"pointer",padding:"8px 12px",transition:"background-color 0.2s ease"})},control:function(e,n){return eC(eC({},e),{},{borderColor:n.isFocused?"#80d2bf":"#ccc",boxShadow:n.isFocused?"0 0 0 1px #007bff":"none","&:hover":{borderColor:"#007bff"}})}}})}})})]})}),(0,H.jsx)(_.JX,{md:3,children:(0,H.jsx)(eS,{renderLabel:g,fieldName:"patientPhone",defaultValue:null==l?void 0:l.phoneNumber,rules:{required:h("common:errors.empty"),pattern:{value:/^(?:\d{10}|\+84\d{9})$/,message:h("providers:phone_number_validate_error")}},placeholder:h("providers:enter_phone_number"),control:d,errorMessage:null==p?void 0:null===(r=p.patientPhone)||void 0===r?void 0:r.message,maxLength:15})})]}),(0,H.jsx)(_.X2,{md:12,className:"m-1",style:{display:"flex"},children:(0,H.jsxs)(_.JX,{children:[(0,H.jsxs)("b",{children:[h("providers:address"),":"]}),(0,H.jsx)("div",{className:"m-1"}),(0,H.jsx)(k.Qr,{control:d,name:"patientAddress",defaultValue:(null==l?void 0:l.address)||(null==l?void 0:null===(i=l.specialInfo)||void 0===i?void 0:i.address),as:m?(0,H.jsx)("textarea",{error:!!p.address,placeholder:h("providers:address")}):(0,H.jsx)("input",{error:!!p.address,placeholder:h("providers:address")})})]})}),(0,H.jsxs)(_.X2,{className:"m-1",style:{display:"flex"},children:[(0,H.jsx)(_.JX,{md:6,children:(0,H.jsx)(eS,{control:d,label:"Số thẻ bảo hiểm y tế",fieldName:"patientInsuranceCardNumber",placeholder:"..............",errorMessage:null==p?void 0:null===(o=p.patientInsuranceCardNumber)||void 0===o?void 0:o.message})}),(0,H.jsx)(_.JX,{md:3,children:(0,H.jsx)(eS,{control:d,label:h("providers:health_code_label"),fieldName:"healthCode",placeholder:"..............",errorMessage:null==p?void 0:null===(a=p.healthCode)||void 0===a?void 0:a.message})}),(0,H.jsx)(_.JX,{md:3,children:(0,H.jsx)(eS,{control:d,label:h("providers:object"),defaultValue:h("providers:services"),fieldName:"object",placeholder:".............."})})]})]})},eE=t(22433),eA=(0,c.F4)(["0%{opacity:0;transform:translate(-50%,6px);}100%{opacity:1;transform:translate(-50%,0);}"]),eL=c.ZP.button.withConfig({componentId:"sc-1r59nrb-0"})(["position:relative;background:none;border:none;padding:0;cursor:pointer;font-size:16px;line-height:1;&:hover::after{content:attr(data-tooltip);position:absolute;bottom:125%;left:50%;transform:translateX(-50%);background:#fff;color:#333;padding:6px 10px;border-radius:6px;box-shadow:0 2px 6px rgba(0,0,0,0.15);font-size:13px;white-space:nowrap;opacity:0;pointer-events:none;animation:",' 0.25s ease forwards;}&:hover::before{content:"";position:absolute;bottom:115%;left:50%;transform:translateX(-50%);border:6px solid transparent;border-top-color:#fff;opacity:0;animation:'," 0.25s ease forwards;}"],eA,eA),eZ=function(e){var n,t,r,i,a,s,l=e.index,c=e.prescription,d=e.isNewItem,u=e.isLoading,p=e.setIsLoading,m=e.getMedicineBy,h=e.control,f=e.getValues,g=e.setValue,x=e.errors,v=e.clearErrors,b=e.removePres,w=e.dataSuggestions,j=(0,S.$G)().t,y=(0,o.useState)(""),N=y[0],O=y[1],D=function(e){g("prescription[".concat(l,"].item_id"),e.item_id),g("prescription[".concat(l,"].name"),e.name),O(e.active_ingredient),g("prescription[".concat(l,"].activeIngredient"),e.active_ingredient),g("prescription[".concat(l,"].quantity"),e.stored),g("prescription[".concat(l,"].unit"),e.unit,{shouldValidate:!1}),v("prescription[".concat(l,"].name")),v("prescription[".concat(l,"].quantity")),v("prescription[".concat(l,"].unit"))};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(_.X2,{className:"m-1 align-items-center",children:[(0,H.jsx)(_.JX,{md:1,children:(0,H.jsxs)("b",{className:"me-2",children:[l+1,"."]})}),(0,H.jsx)(_.JX,{md:6,children:(0,H.jsx)("i",{children:(0,H.jsx)(k.Qr,{control:h,name:"prescription[".concat(l,"].name"),defaultValue:c[l].name,rules:{required:j("common:errors.empty")},render:function(e){var n,t=e.name,r=e.onChange,i=e.value;return(0,H.jsx)(z,{id:"Autosuggest",isNewItem:d,ref:function(e){return medicineRefs.current[l]=e},dataSuggestions:w,t:j,index:l,name:t,onChange:r,className:(null===(n=c[l])||void 0===n?void 0:n.name)!==""?"input-value":"",setValue:g,value:i,getValues:f,handleSearch:function(e){return m(e)},onFocus:function(e){m(null!=i?i:"")},isLoading:u,setIsLoading:p,clearErrors:v,onItemSelected:D})}})})}),(0,H.jsx)(_.JX,{md:4,children:(0,H.jsx)("b",{children:N})}),(0,H.jsx)(_.JX,{md:1,className:"align-items-end",children:(0,H.jsx)(eL,{type:"button","data-tooltip":"X\xf3a khỏi đơn thuốc",onClick:function(e){return b(e)},style:{background:"none",border:"none",padding:0,cursor:"pointer"},children:"❌"})})]}),(0,H.jsxs)(_.X2,{className:"m-1",children:[(0,H.jsx)(_.JX,{md:6,children:(0,H.jsxs)(_.X2,{children:[(0,H.jsx)(_.JX,{md:3,children:(0,H.jsx)(eS,{control:h,label:j("providers:morning"),fieldName:"prescription[".concat(l,"].morning"),placeholder:"............"})}),(0,H.jsx)(_.JX,{md:3,children:(0,H.jsx)(eS,{control:h,label:j("providers:noon"),fieldName:"prescription[".concat(l,"].noon"),placeholder:"............"})}),(0,H.jsx)(_.JX,{md:3,children:(0,H.jsx)(eS,{control:h,label:j("providers:afternoon"),fieldName:"prescription[".concat(l,"].afternoon"),placeholder:"............"})}),(0,H.jsx)(_.JX,{md:3,children:(0,H.jsx)(eS,{control:h,label:j("providers:evening"),fieldName:"prescription[".concat(l,"].evening"),placeholder:"............"})})]})}),(0,H.jsx)(_.JX,{md:3,children:(0,H.jsx)(eS,{control:h,fieldName:"prescription[".concat(l,"].quality"),rules:{required:j("common:errors.empty")},placeholder:"Thời điểm v\xe0 c\xe1ch d\xf9ng...",errorMessage:null!=x&&x.prescription?null===(t=(n=[l]).quality)||void 0===t?void 0:t.message:null})}),(0,H.jsx)(_.JX,{md:3,className:"align-items-center",children:(0,H.jsxs)(_.X2,{className:"align-items-center",children:[(0,H.jsx)(_.JX,{children:(0,H.jsx)(eS,{control:h,label:j("providers:quantity_label"),fieldName:"prescription[".concat(l,"].quantity"),rules:{required:j("common:errors.empty")},placeholder:"............",errorMessage:null!=x&&x.prescription?null===(i=(r=[l]).quantity)||void 0===i?void 0:i.message:null})}),(0,H.jsx)(_.JX,{children:(0,H.jsx)(eS,{control:h,fieldName:"prescription[".concat(l,"].unit"),rules:{required:j("common:errors.empty")},placeholder:"Đơn vị",errorMessage:null!=x&&x.prescription?null===(s=(a=[l]).unit)||void 0===s?void 0:s.message:null})})]})})]})]})},eM=(0,c.F4)(["0%{left:-40%;}100%{left:140%;}"]),eX=c.ZP.label.withConfig({componentId:"eny4u5-0"})(['display:inline-flex;align-items:center;background-color:#4ac0a4;color:#fff;border-radius:16px;padding:8px 16px;cursor:pointer;font-weight:500;position:relative;overflow:hidden;transition:background-color 0.3s ease;svg{margin-right:8px;color:#fff;}&:hover{background-color:#4ac0a4;}&:after{content:"";position:absolute;top:0;left:-40%;width:30%;height:100%;background:rgba(255,255,255,0.4);transform:skewX(-20deg);}&:hover:after{animation:'," 0.8s linear forwards;}"],eM),eq=function(e){var n=e.dataSuggestions,t=e.getMedicineBy,r=e.isLoadingMedicine,i=e.setIsLoadingMedicine,a=e.fieldsPres,s=e.appendPres,l=e.removePres,c=e.control,d=e.getValues,u=e.setValue,p=e.errors,m=e.clearErrors,h=e.diagnoseList,f=e.diagnosesSelect,g=e.getListDiagnoseData,x=e.onSaveDiagnoses,v=(0,S.$G)().t;return(0,o.useEffect)(function(){Array.isArray(a)&&0!==a.length||s({no:1,name:"",morning:0,noon:0,afternoon:0,evening:0,activeIngredient:"",quantity:0,unit:""})},[s,a]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)("div",{style:{marginTop:"16px"}}),(0,H.jsx)(_.X2,{className:"m-1",style:{display:"flex"},children:(0,H.jsxs)(_.JX,{children:[(0,H.jsxs)("div",{style:{fontWeight:"bold"},children:[v("providers:diagnose"),": ",(0,H.jsx)("span",{className:"star-require",children:"*"})]}),(0,H.jsx)("div",{className:"m-1"}),(0,H.jsx)(k.Qr,{control:c,name:"diagnose",rules:{required:v("common:errors.empty")},as:(0,H.jsx)("textarea",{rows:1,error:!!p.diagnose,placeholder:v("providers:diganose_placeholder"),style:{width:"100%",resize:"none",overflow:"hidden"},onInput:function(e){e.target.style.height="auto",e.target.style.height="".concat(e.target.scrollHeight,"px")}})})]})}),(0,H.jsx)(_.X2,{className:"m-1",style:{display:"flex"},children:(0,H.jsx)(_.JX,{children:(0,H.jsx)(eE.Z,{t:v,onSaveData:x,diagnoseList:h,diagnosesSelect:f,getListDiagnoseData:g})})}),(0,H.jsx)("div",{style:{marginTop:24}}),a.map(function(e,o){return(0,H.jsx)(eZ,{index:o,prescription:a,isNewItem:e.isNewItem,isLoading:r,setIsLoading:i,getMedicineBy:t,control:c,getValues:d,setValue:u,errors:p,clearErrors:m,removePres:l,dataSuggestions:n})}),(0,H.jsx)(_.X2,{className:"m-1",style:{display:"flex"},children:(0,H.jsxs)(_.JX,{children:[(0,H.jsx)("b",{children:"Tổng loại thuốc:"})," ",(0,H.jsx)("span",{style:{marginLeft:"4px"},children:(null==a?void 0:a.length)||0})]})}),(0,H.jsx)("div",{style:{marginLeft:12,marginBottom:8},children:(0,H.jsxs)(eX,{className:"add-field pointer m-1",onClick:function(){a.length,s({no:a.length+1,name:"",morning:0,noon:0,afternoon:0,evening:0,activeIngredient:"",quantity:0,unit:"",isNewItem:!0})},children:[(0,H.jsx)(D.G,{icon:P.r8p,className:"mr-2"}),(0,H.jsx)("div",{style:{color:"#fff"},children:v("providers:add_medicine")})]})}),(0,H.jsx)("div",{style:{height:8}}),(0,H.jsx)(_.X2,{className:"m-1",style:{display:"flex"},children:(0,H.jsxs)(_.JX,{children:[(0,H.jsxs)("b",{children:[v("providers:the_doctor_advice"),": ",(0,H.jsx)("span",{className:"star-require",children:"*"})]}),(0,H.jsx)("div",{className:"m-1"}),(0,H.jsx)(k.Qr,{control:c,name:"adviceOfDoctor",rules:{required:v("common:errors.empty")},defaultValue:v("providers:default_the_doctor_advice"),as:(0,H.jsx)("textarea",{rows:3,error:!!p.adviceOfDoctor,placeholder:v("providers:placeholder_the_doctor_advice")})})]})})]})};function eT(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,r)}return t}function eV(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};
1n%2?eT(Object(t),!0).forEach(function(n){(0,r.Z)(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):eT(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}var eJ=function(e){if(e)return 0>e.indexOf("https")&&0>e.indexOf("static")?[h.ZP.api.url,e].join("/"):e},eF=function(e){var n,t=e.states,r=e.actions,s=t.selfInfo,l=t.isLoadingStoreMedicine,c=t.storeMedicineData,d=t.errorLoadStoreMedicine,u=t.activeClinic,p=(0,S.$G)(["providers","common","patient"]).t,m=(0,a.useRouter)(),f=m.push,g=(m.replace,m.query);m.asPath,m.locale;var x=(0,O.fP)(["name"]),v=(0,i.Z)(x,2),j=v[0];v[1];var C=(0,o.useRef)(),E=(0,o.useRef)(),A=(0,o.useRef)([]),M=(0,o.useRef)([]),R=(0,o.useRef)(!1),G=(0,o.useRef)(),Y=(0,o.useRef)(null),U=(0,ew.x)(function(){return ej.U.SUCCESS}),z=(0,i.Z)(U,2),Q=z[0],K=z[1],W=(0,k.cI)(),ee=(0,o.useState)(L()()),ei=ee[0],eo=ee[1],ea=(0,o.useState)(""),es=ea[0];ea[1];var el=(0,o.useState)({}),ec=el[0],ed=el[1],eu=(0,o.useState)({}),ep=eu[0],em=eu[1],eh=(0,o.useState)([]),ef=(eh[0],eh[1]),ey=(0,o.useState)([]),e_=ey[0],eN=ey[1],eO=(0,o.useState)([]),ek=eO[0],eS=eO[1],eP=(0,o.useState)([]),eC=eP[0],eE=eP[1],eA=(0,o.useState)([]),eL=eA[0],eZ=eA[1],eM=(0,o.useState)(null),eX=eM[0];eM[1];var eT=(0,o.useState)({}),eF=eT[0],eB=eT[1],eR=(0,F.useMediaQuery)({maxWidth:574.98}),eG=new Date,eH=eG.getDate(),eY=eG.getMonth()+1,eU=eG.getFullYear(),ez=(0,k.cI)({mode:"onChange"}),eQ=ez.register,e$=ez.handleSubmit,eK=ez.control,eW=ez.watch,e0=ez.setValue,e1=ez.getValues,e2=ez.clearErrors,e5=(ez.setError,ez.trigger,ez.reset),e3=ez.formState.errors,e4=(0,k.Dq)({control:eK,name:"patient"});e4.fields,e4.append;var e6=(0,k.Dq)({control:eK,name:"doctor"});e6.fields,e6.append;var e8=(0,k.Dq)({control:eK,name:"prescription"}),e9=e8.fields,e7=e8.append,ne=e8.remove,nn=(0,o.useState)([]),nt=nn[0],nr=nn[1],ni=(0,o.useState)(!1),no=ni[0],na=ni[1],ns=(0,o.useState)(!1);ns[0],ns[1];var nl=(0,o.useState)(""),nc=nl[0],nd=nl[1];(0,o.useEffect)(function(){l&&na(!0),c&&na(!1),d&&na(!1)},[l,c,d]),(0,o.useEffect)(function(){(0,B.Ew)(null==ep?void 0:ep.signature)?nd(""):nd(null==ep?void 0:ep.signature)},[s,ep,nc,ep]);var nu,np=function(e){if(e){var n=null==e?void 0:e.map(function(e){return eV(eV({},e),{},{label:e.name,value:e.id})}),t=null==n?void 0:n.filter(function(e){return e.value===ep.value});ef(n),em(t?Object.assign.apply(Object,[{}].concat((0,w.Z)(t))):null)}},nm=(nu=(0,b.Z)(y().mark(function e(n){var t,r,o;return y().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(c){e.next=2;break}return e.abrupt("return",[]);case 2:if(n){e.next=7;break}return t=Object.entries(c).map(function(e){var n,t=(0,i.Z)(e,2);return eV({name:t[0]},t[1])}),nr(t),na(!1),e.abrupt("return");case 7:r=n.toLowerCase(),o=Object.entries(c).filter(function(e){return(0,i.Z)(e,1)[0].toLowerCase().includes(r)}).map(function(e){var n,t=(0,i.Z)(e,2);return eV({name:t[0]},t[1])}),nr(o),na(!1);case 11:case"end":return e.stop()}},e)})),function(e){return nu.apply(this,arguments)});(0,o.useEffect)(function(){var e=JSON.parse(localStorage.getItem("dataApt")),n=(null==e?void 0:null===(t=e.clinicInfo)||void 0===t?void 0:t.phone)||(null==e?void 0:null===(i=e.clinicInfo)||void 0===i?void 0:i.phoneNumber);if(e){r.getStoreMedicine(null==j?void 0:j.access_token,String(e.aptId)),ed(e),e0("patientName",null==e?void 0:e.patientName),e0("gender",e.gender),e0("patientGender",e.gender),e0("clinicPhone",n),e0("phoneNumber",e.phoneNumber),e0("patientPhone",e.phoneNumber),e0("patientAge",e.age),e0("address",null===(o=e.specialInfo)||void 0===o?void 0:o.address),e0("patientAddress",null===(a=e.specialInfo)||void 0===a?void 0:a.address),e0("idNumber",null===(l=e.specialInfo)||void 0===l?void 0:l.id_card_number),eB((null==s?void 0:s.language)=="en"?V.filter(function(n){return n.value==e.gender})[0]:J.filter(function(n){return n.value==e.gender})[0]);var t,i,o,a,l,c,d=null==e?void 0:null===(c=e.doctorList)||void 0===c?void 0:c.map(function(e){return eV(eV({},e),{},{label:e.name,value:e.id})}),u=null==d?void 0:d[0];u&&em(u),e0("doctorName",null==u?void 0:u.label,{shouldDirty:!0}),eo(L()()),eS(e.selectDiagnose),e0("diagnose",e.selectDiagnose&&Array.isArray(e.selectDiagnose)&&e.selectDiagnose.length>0?e.selectDiagnose.map(function(e){return"".concat(e.value,"(").concat(null==e?void 0:e.code,")")}).join(", "):""),setTimeout(function(){document.querySelectorAll(".input-label").forEach(function(e){!function(e){if(e.value)e.style.width=(e.value.length+3)*8+"px";else{var n;e.style.width=((null===(n=e.placeholder)||void 0===n?void 0:n.length)+3)*8+"px"}}(e)})},200),e.doctorList&&d.length>0&&ef(d),!n&&e.clinicId&&r.getClinicInfo({id:e.clinicId})}else f({pathname:"/providers/calendar"});window.history&&window.history.pushState&&$(window).on("popstate",function(){var e=JSON.parse(localStorage.getItem("dataApt"));e.isCreateQuickApt&&nj(nw,e.aptId)})},[]),(0,o.useEffect)(function(){if(!(null!=ec&&ec.phone)&&null!=u&&u.phone&&!eW("clinicPhone")){var e=u.phone.replace(/\s/g,"");e0("clinicPhone",e);var n=eV(eV({},ec),{},{clinicInfo:eV(eV({},ec.clinicInfo),{},{phone:e})});ed(n)}},[u]),(0,o.useEffect)(function(){ec&&e5(ec)},[e5,ec]),(0,o.useEffect)(function(){ng()},[E]),(0,o.useEffect)(function(){nx()},[eX,A,M]);var nh,nf,ng=function(){null!=E&&E.current&&setTimeout(function(){var e;null==E||null===(e=E.current)||void 0===e||e.focus()},1e3)},nx=function(){if(eX&&null!=A&&A.current||eX&&null!=M&&M.current){var e=(null==A?void 0:A.current[eX])||(null==M?void 0:M.current[eX]);e&&(null==e||e.focus())}},nv=function(){var e,n;return ec.doctorList?null==ec?void 0:null===(n=ec.doctorList[0])||void 0===n?void 0:n.label:null==ec?void 0:null===(e=ec.clinicInfo)||void 0===e?void 0:e.name},nb=function(e,n){eW("prescription").length>0&&(nD(e,"submit"),localStorage.removeItem("dataApt"))},nw=function(){var e={id:ec.aptId};null!=e&&e.id&&f({pathname:"/providers/calendar",query:e})},nj=(nh=(0,b.Z)(y().mark(function e(){var n,t,r,i,o=arguments;return y().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=o.length>0&&void 0!==o[0]?o[0]:void 0,t=o.length>1?o[1]:void 0,r=(null==ec?void 0:ec.isCreateQuickApt)&&1*g.id==1*ec.clinicId,i={id:(null==ec?void 0:ec.aptId)||t},localStorage.removeItem("file-rx"),!(r||t)){e.next=11;break}return e.next=8,et.Z.post(h.ZP.api.doctor.deleteAptAfterQuickSendRx,i);case 8:e.sent,localStorage.setItem("dataApt",JSON.stringify(eV(eV({},ec),{},{isCreateQuickApt:!1}))),n&&n();case 11:case"end":return e.stop()}},e)})),function(){return nh.apply(this,arguments)}),ny=(nf=(0,b.Z)(y().mark(function e(n){var t;return y().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.getListDiagnosis({keyword:n},j.access_token,!0);case 2:"OK"==(t=e.sent).payload.data.success&&eN(t.payload.data.data);case 4:case"end":return e.stop()}},e)})),function(e){return nf.apply(this,arguments)});(0,o.useCallback)((0,N.debounce)(function(e){""!=e&&ny(e)},500),[]),(0,o.useCallback)((0,N.debounce)(function(e,n,t){var r=(0,w.Z)(t),i={key:e.toLowerCase().replace(/\s/g,""),label:e};r[n]?(r[n].label=e,r[n].key=e.toLowerCase().replace(/\s/g,"")):r.push(i),eE(r)},1e3),[]),(0,o.useCallback)((0,N.debounce)(function(e,n,t){var r=(0,w.Z)(t),i={key:e.toLowerCase().replace(/\s/g,""),label:e};r[n]?(r[n].label=e,r[n].key=e.toLowerCase().replace(/\s/g,"")):r.push(i),eZ(r)},1e3),[]),(0,o.useCallback)((0,N.debounce)(function(e,n,t,r){if("patient"==n){var i=(0,w.Z)(r);i[t].value=e.target.value,eE.apply(void 0,(0,w.Z)(i)),eQ("patient.".concat(t,".").concat(i[t].key),i[t].value)}else{var o=(0,w.Z)(r);o[t].value=e.target.value,eZ.apply(void 0,(0,w.Z)(o)),eQ("doctor.".concat(t,".").concat(o[t].key),o[t].value)}},1e3),[]);var n_,nN,nO=function(e,n){var t;Array.isArray(e)?t=(0,w.Z)(e):(t=(0,w.Z)(n)).filter(function(n){return n.id==e.id}).length<1&&t.push(e),eS(t),e0("diagnose",t.length>0?t.map(function(e){return"".concat(e.value,"(").concat(null==e?void 0:e.code,")")}).join(", "):"")},nk=function(e,n){var t={};return Object.keys(e).map(function(r){r&&e[r]&&(t.key=eC[n].label,t.value=e[r])}),t},nS=function(e){var n=[];return e.forEach(function(e){n.push(e.value)}),n},nD=(n_=(0,b.Z)(y().mark(function e(n,t){var i,o,a,s,l,c,d,u,m,f,g,x,v,b,w,_,N,O,k,S,D,P,C,I,E,A,Z,M,X,T,V,J,F,B,R;return y().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return I=[],E=[],(null===(i=n.patient)||void 0===i?void 0:i.length)>0&&n.patient.forEach(function(e,n){I.push(nk(e,n))}),(null===(o=n.doctor)||void 0===o?void 0:o.length)>
10&&eL.forEach(function(e,n){E.push(nk(e,n))}),A={appointment_id:null!==(a=ec.aptId)&&void 0!==a?a:"",clinicName:ec.clinicInfo.name,noteForPatient:null!==(s=n.noteForPatient)&&void 0!==s?s:n.adviceOfDoctor,prescription_number:null!==(l=n.clinicNumber)&&void 0!==l?l:"",prescription_ms:null!==(c=n.clinicCode)&&void 0!==c?c:"",clinicInfo:{name:null!==(d=null!==(u=n.clinicName)&&void 0!==u?u:ec.clinicInfo.name)&&void 0!==d?d:"",address:null!==(m=n.clinicAddress)&&void 0!==m?m:"",phone:null!==(f=n.clinicPhone)&&void 0!==f?f:""},patientInfo:{patientName:n.patientName,gender:null!==(g=n.patientGender)&&void 0!==g?g:"",age:null!==(x=null!==(v=n.patientAge)&&void 0!==v?v:n.age)&&void 0!==x?x:"",parent:null!==(b=n.patientParent)&&void 0!==b?b:"",address:null!==(w=null!==(_=n.patientAddress)&&void 0!==_?_:n.address)&&void 0!==w?w:"",patientPhone:null!==(N=n.patientPhone)&&void 0!==N?N:"",idNumber:n.idNumber?n.idNumber:"",weight:n.weight?n.weight:"",height:n.height?n.height.split("(")[0]:"",leftEye:n.leftEye?n.leftEye:"",rightEye:n.rightEye?n.rightEye:"",extraInfo:I,insuranceCardNumber:null!==(O=n.patientInsuranceCardNumber)&&void 0!==O?O:"",healthCode:null!==(k=n.healthCode)&&void 0!==k?k:"",object:null!==(S=n.object)&&void 0!==S?S:""},doctorInfo:{id:(null==ep?void 0:ep.id)||0,doctorName:ep&&ep.label?ep.label:nv(),clinicAddress:null!==(D=ec.clinicInfo)&&void 0!==D&&D.address?null===(P=ec.clinicInfo)||void 0===P?void 0:P.address:"",diagnose:null!==(C=n.diagnose)&&void 0!==C?C:nS(ek),createDate:L()(ei).format("YYYY-MM-DD"),followDate:es?L()(es).format("YYYY-MM-DD"):"",extraInfo:E,doctorId:(null==ep?void 0:ep.id)||0},prescription:n.prescription,diagnosis_appointment:ek?ek.map(function(e){return e.id}):[]},Z=ec&&ec.templateType?String(ec.templateType).toLowerCase():"blank",M={id:ec.aptId,action:t,template_type:Z,data:JSON.stringify(A)},X=[],ek.forEach(function(e){X.push(e.id)}),T=ep&&void 0!==ep.value?ep.value:0,V={appointment_id:ec.aptId,doctor_id:T==ec.clinicId?0:T,clinic_id:ec.clinicId,diagnoses:X,patient_id:ec.patientId,patient_email:ec.email,patient_name:ec.patientName,patient_phone:n.phoneNumber,repeat_day_in_week:ec.repeat_day_in_week,repeatDayInWeek:ec.repeatDayInWeek,startTime:ec.startTime,status:ec.status,isShow:ec.isShow},e.next=13,r.saveSendPrescription(M,j.access_token);case 13:if("preview"!==(J=e.sent).payload.data.data.action){e.next=18;break}return e.abrupt("return",window.open([h.ZP.api.url,J.payload.data.data.file_path].join("/"),"_blank"));case 18:if(F=(0,q.W2)(V),!(ec.selectDiagnose!==ek)){e.next=23;break}return F.clinic_id==F.doctor_id&&(F.doctor_id=0),e.next=23,r.requestUpdateAppointment(F,j.access_token);case 23:if(!localStorage.getItem("file-rx")){e.next=29;break}return B=JSON.parse(localStorage.getItem("file-rx")),R={appointment_id:ec.aptId,token:j.access_token,type:"prescription",amount:0,attachments:B},e.next=28,et.Z.post(h.ZP.api.doctor.doctorSaveUploadFile,R);case 28:e.sent;case 29:"OK"==J.payload.data.success?(eb.Am.success(p("providers:prescription_saved_successfully")||"Đơn thuốc đ\xe3 được lưu v\xe0 gửi SMS th\xe0nh c\xf4ng cho bệnh nh\xe2n!",{position:"top-right",autoClose:5e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),window.open([h.ZP.api.url,J.payload.data.data.file_path].join("/"),"_blank"),nw()):eb.Am.error(p("providers:prescription_save_failed")||"Lỗi khi lưu đơn thuốc. Vui l\xf2ng thử lại!",{position:"top-right",autoClose:5e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0});case 30:case"end":return e.stop()}},e)})),function(e,n){return n_.apply(this,arguments)}),nP=function(e){if(!e){null==C||C.current.setConfirmData({msg:p("providers:msg_leave_page"),data:{},btnYesName:p("common:ok"),btnNoName:p("common:quit"),confirmTitle:p("common:warning"),deleteModal:!0}),C.current.showModal();return}},nC=function(e,n){eW("prescription").length>0&&nD(e,"preview")},nI=(nN=(0,b.Z)(y().mark(function e(){var n,t;return y().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!G.current){e.next=10;break}return e.next=4,I()(G.current,{scale:2,useCORS:!0,allowTaint:!0,backgroundColor:"#ffffff"});case 4:n=e.sent,(t=document.createElement("a")).download="prescription_".concat(L()().format("YYYY-MM-DD_HH-mm-ss"),".png"),t.href=n.toDataURL(),t.click(),nA(null,"success");case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),nA(null,"error",p("providers:screenshot_error"));case 15:case"end":return e.stop()}},e,null,[[0,12]])})),function(){return nN.apply(this,arguments)}),nE=function(){R.current.handleShow()},nA=function(e,n,t){var r;"success"===n?(r={message:p("success"),type:ej.U.SUCCESS},nL(r)):"error"===n&&nL(r={message:t,type:ej.U.ERROR})},nL=function(e){var n=e.message,t=e.type;K(t),(0,eb.Am)((0,H.jsx)(ev.Z,{message:n,type:t}))};return(0,H.jsxs)(X,{children:[(0,H.jsxs)("div",{className:"d-flex prescription-header",children:[(0,H.jsxs)("label",{className:"template-title",children:[(0,H.jsx)(D.G,{icon:P.acZ,className:"mr-2 pointer",onClick:function(){return nP()}}),function(){switch(ec.templateType){case T.BLANK:return p("providers:blank_template");case T.DENTAL:return p("providers:dental_prescription");case T.PEDIATRIC:return p("providers:pediatric_prescription");case T.OPHTHALMOLOLOGY:return p("providers:ophthalmology_prescription")}}()]}),(0,H.jsx)("label",{className:"note",children:p("providers:click_any_information_to_edit")})]}),(0,H.jsx)("div",{className:"main-template",children:(0,H.jsxs)("form",{onSubmit:e$(nb),children:[(0,H.jsx)("div",{ref:G,children:(0,H.jsxs)(k.RV,eV(eV({},W),{},{children:[(0,H.jsxs)("div",{className:"group-section",children:[(0,H.jsx)("span",{className:"group-title",children:"Th\xf4ng tin ph\xf2ng kh\xe1m"}),(0,H.jsx)(eD,{dataInfo:ec,control:eK,setValue:e0,reset:e5,errors:e3})]}),(0,H.jsxs)("div",{className:"group-section",children:[(0,H.jsx)("span",{className:"group-title",children:"Th\xf4ng tin Bệnh nh\xe2n"}),(0,H.jsx)(eI,{selfInfo:s,dataInfo:ec,gender:eF,control:eK,setValue:e0,errors:e3,isMobile:eR})]}),(0,H.jsxs)("div",{className:"group-section",children:[(0,H.jsx)("span",{className:"group-title",children:"Th\xf4ng tin thuốc"}),(0,H.jsx)(eq,{dataSuggestions:nt,getMedicineBy:nm,isLoadingMedicine:no,setIsLoadingMedicine:na,fieldsPres:e9,appendPres:e7,removePres:ne,ƒ:!0,control:eK,getValues:e1,setValue:e0,errors:e3,clearErrors:e2,diagnoseList:e_,diagnosesSelect:ek,getListDiagnoseData:ny,onSaveDiagnoses:function(e){return nO(e,ek)}})]}),(0,H.jsx)(_.JX,{md:12,style:{display:"flex",justifyContent:"flex-end"},children:(0,H.jsxs)("div",{className:"text-center justify-content-end",style:{marginRight:"80px"},children:[(0,H.jsx)("label",{className:"mb-0 bold",children:p("providers:day_month_year",{day:eH,month:eY,year:eU})}),(0,H.jsx)("p",{children:p("providers:prescribed_by")}),(0,H.jsxs)("div",{className:"box-sign",children:[!(0,B.Ew)(nc)&&(0,H.jsx)("img",{src:eJ(nc),alt:"signature",loading:"lazy",width:"200",height:"100"}),(0,H.jsx)("label",{className:en()({"bold mt-3":!0,"mt-5":!nc}),children:(null==ep?void 0:null===(n=ep.label)||void 0===n?void 0:n.split(".")[1])||(null==ep?void 0:ep.label)})]}),(0,H.jsx)("div",{ref:Y,style:{display:"none"},children:(0,H.jsx)(er.Z,{innerText:(0,B.Ew)(nc)?p("providers:insert_signature"):p("providers:edit_signature"),color:"outline",onClick:nE})})]})}),(0,H.jsxs)(_.X2,{children:[(0,H.jsx)(_.JX,{md:4,children:(0,H.jsx)("div",{className:"m-1",children:p("providers:when_meet_doctor_bring_this_prescription")})}),(0,H.jsx)(_.JX,{md:4,children:p("providers:date_tn",{date:"".concat(eH,"/").concat(eY,"/").concat(eU)})}),(0,H.jsx)(_.JX,{md:4,children:p("providers:date_of_printing",{date:"".concat(eH,"/").concat(eY,"/").concat(eU)})})]})]}))}),(0,H.jsxs)("div",{className:"template-footer d-flex",children:[(0,H.jsx)("label",{className:"note-msg",children:p("providers:please_review_prescription")}),(0,H.jsxs)("div",{className:"box-btn",children:[(0,H.jsx)(er.Z,{innerText:p("providers:screenshot"),onClick:nI,color:"outline",className:"mr-2",icon:(0,H.jsx)(D.G,{icon:P._jT,className:"mr-1"})}),(0,H.jsx)(er.Z,{innerText:(0,B.Ew)(nc)?p("providers:insert_signature"):p("providers:edit_signature"),onClick:nE,color:"outline",className:"mr-2"}),(0,H.jsx)(er.Z,{innerText:p("providers:preview"),onClick:e$(nC),color:"outline",className:"mr-2"}),(0,H.jsx)(er.Z,{type:"submit",innerText:p("providers:save_and_send"),color:"outline",onClick:e$(nb)})]})]})]})}),(0,H.jsx)(Z.Z,{ref:C,saveEvent:nw}),(0,H.jsx)(eg,{ref:R,selfInfo:s,t:p,doctorId:null==ep?void 0:ep.id,renderMessenger
1:nA,signatures:nc,handleSetDoctorListApterChangeSignature:function(e){return np(e)},getDoctorClinic:"actions.getDoctorClinic",selectDoctor:ep}),(0,H.jsx)(ex.Z,{type:Q,autoClose:3e3,transition:eb.BW})]})},eB=function(e){return{states:{doctor:e.doctor,selfInfo:e.userAuth.selfInfo,admin:e.admin,isLoadingStoreMedicine:e.isLoadingStoreMedicine,storeMedicineData:e.doctor.storeMedicineData,errorLoadStoreMedicine:e.doctor.errorLoadStoreMedicine,activeClinic:e.booking.activeClinic}}},eR=function(e){return{actions:eV({},(0,l.DE)({getListDiagnosis:u.getListDiagnosis,saveSendPrescription:u.saveSendPrescription,requestUpdateAppointment:u.requestUpdateAppointment,getDoctorClinic:u.getDoctorClinic,getStoreMedicine:u.getStoreMedicine,getClinicInfo:M.getClinicInfo},e))}},eG=(0,l.qC)((0,s.$j)(eB,eR))(eF);function eH(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,r)}return t}function eY(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?eH(Object(t),!0).forEach(function(n){(0,r.Z)(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):eH(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}m.Z.supportsLocalStorage()&&m.Z.supportsSessionStorage();var eU=h.ZP.metas,ez=eU.og;ez.description,ez.locale,eU.seo.description;var eQ=c.ZP.div.withConfig({componentId:"oc8gge-0"})([""]);function e$(e){e.isFetching,e.isLogging,e.disconnectUser,e.getUserInfo;var n=e.selfInfo,t=e.doctor,r=e.admin,s=e.t;e.i18n;var l=(0,O.fP)(["name"]),c=(0,i.Z)(l,2);c[0],c[1],(0,a.useRouter)().query;var d=(0,o.useState)("");d[0],d[1];var u=(0,o.useState)([]);return u[0],u[1],(0,H.jsx)(f.Z,{areaFor:"providers",children:(0,H.jsx)(eQ,{children:(0,H.jsxs)(x.Z,{title:s("provider_patient_title"),authArea:!1,selfInfo:n,areaFor:"providers",children:[(0,H.jsx)(g.Z,{activeMenu:"prescription",doctor:t,admin:r,selfInfo:n}),(0,H.jsx)(v.Z,{className:"provider-content patient-view provider-setting",header:"",children:(0,H.jsx)(eG,{selfInfo:n})})]})})})}e$.displayName="PrescriptionProviderPage";var eK=function(e){return{isAuthenticated:e.userAuth.isAuthenticated,isFetching:e.userAuth.isFetching,isLogging:e.userAuth.isLogging,selfInfo:e.userAuth.selfInfo,doctor:e.doctor,admin:e.admin}},eW=function(e){return eY({},(0,l.DE)(eY(eY(eY({},d),u),p),e))},e0=(0,l.qC)((0,S.Zh)(["common","patient"]),(0,s.$j)(eK,eW))(e$)},11344:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/providers/prescription",function(){return t(598)}])}},function(e){e.O(0,[8592,1216,2888,179],function(){return e(e.s=11344)}),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.