Your IP : 216.73.216.93


Current Path : /home/users/unlimited/www/admin.medimeet.codeskitter.site/assets/
Upload File :
Current File : /home/users/unlimited/www/admin.medimeet.codeskitter.site/assets/AddMedicine-0q74ZIMD.js

import{w as j,j as s,B as f,x as a,P as p,y as M}from"./index-f5FVPPWf.js";import{h as S,u as b,M as y,b as g,a as w,c as A,g as z,d as C,F as d,e as D,f as m}from"./index.esm-CxKpqEdJ.js";import{u as F}from"./useMutation-DWP0Ot2c.js";import{u as N}from"./HasPermission-D75jcuOi.js";import{T as B,N as E}from"./Dashboard-QYea_GjR.js";import{D as P}from"./use-clickable-DJbYv-Vn.js";import{d as c,I}from"./input-aKY8cD2r.js";const T=async o=>{const e=await p(M.token,"add_prescribe_medicines",o);if(e.response!==200)throw new Error(e.message);return e};function R({isOpen:o,onClose:e}){const{hasPermission:u}=N(),{register:i,handleSubmit:l}=S(),t=b(),x=j(),n=F({mutationFn:async r=>{await T(r)},onSuccess:()=>{x.invalidateQueries("medicines"),m(t,"success","Medicine Added!"),e()},onError:r=>{m(t,"error",r.message)}}),h=r=>{n.mutate(r)};return s.jsxs(y,{isOpen:o,onClose:e,isCentered:!0,children:[s.jsx(g,{}),s.jsxs(w,{as:"form",onSubmit:l(h),children:[s.jsx(A,{fontSize:"md",children:"Add New Medicine"}),s.jsx(z,{top:3}),s.jsx(P,{}),s.jsx(C,{children:s.jsx(f,{children:u("MEDICINE_ADD")?s.jsxs(s.Fragment,{children:[" ",s.jsxs(c,{isRequired:!0,children:[s.jsx(d,{fontSize:"sm",children:"Name"}),s.jsx(I,{size:"md",name:"comment",...i("title",{required:!0})})]})," ",s.jsxs(c,{mt:3,children:[s.jsx(d,{fontSize:"sm",children:"Notes"}),s.jsx(B,{size:"md",name:"comment",...i("notes")})]})," "]}):s.jsx(E,{})})}),s.jsxs(D,{children:[s.jsx(a,{colorScheme:"gray",mr:3,onClick:e,size:"sm",children:"Close"}),s.jsx(a,{colorScheme:"blue",size:"sm",w:32,type:"submit",isLoading:n.isPending,children:"Add"})]})]})]})}export{R as A};