Commit 2604404c authored by Nipun Lakshan Perera's avatar Nipun Lakshan Perera

Code

parents
/node_modules
\ No newline at end of file
# Default ignored files
/shelf/
/workspace.xml
# CodeStream ignored files
/../../React-Admin-Template\.idea/codestream.xml
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CodeStream">
<option name="webViewContext" value="{&quot;chatProviderAccess&quot;:&quot;strict&quot;,&quot;currentTeamId&quot;:&quot;&quot;,&quot;currentStreamId&quot;:&quot;&quot;,&quot;pullRequestCheckoutBranch&quot;:false,&quot;isRepositioning&quot;:false,&quot;onboardStep&quot;:0,&quot;panelStack&quot;:[&quot;landing-redirect&quot;],&quot;hasFocus&quot;:false,&quot;channelFilter&quot;:&quot;all&quot;,&quot;channelsMuteAll&quot;:false,&quot;codemarkFileFilter&quot;:&quot;all&quot;,&quot;codemarkTypeFilter&quot;:&quot;all&quot;,&quot;codemarkTagFilter&quot;:&quot;all&quot;,&quot;codemarkBranchFilter&quot;:&quot;all&quot;,&quot;codemarkAuthorFilter&quot;:&quot;all&quot;,&quot;codemarksFileViewStyle&quot;:&quot;inline&quot;,&quot;codemarksShowArchived&quot;:false,&quot;codemarksShowResolved&quot;:false,&quot;codemarksWrapComments&quot;:false,&quot;showFeedbackSmiley&quot;:true,&quot;route&quot;:{&quot;name&quot;:&quot;newUserEntry&quot;,&quot;params&quot;:{}},&quot;spatialViewShowPRComments&quot;:false,&quot;currentPullRequestNeedsRefresh&quot;:{&quot;needsRefresh&quot;:false,&quot;providerId&quot;:&quot;&quot;,&quot;pullRequestId&quot;:&quot;&quot;},&quot;__teamless__&quot;:{&quot;selectedRegion&quot;:&quot;us&quot;},&quot;sessionStart&quot;:1668704484957}" />
</component>
</project>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/React-Admin-Template.iml" filepath="$PROJECT_DIR$/.idea/React-Admin-Template.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
"""
Django settings for app project.
Generated by 'django-admin startproject' using Django 2.2.8.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'jnbty*(xl$zl1xu63f2t9sxg3n4kl$pc75mpl$0tef)b*87&*l'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'corsheaders',
'core',
'staff',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'app.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'app.wsgi.application'
# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db1.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
AUTH_USER_MODEL = 'core.User'
CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_CREDENTIALS = True
"""app URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('api/', include('core.urls')),
path('staffapi/', include('staff.urls')),
]
"""
WSGI config for app project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings')
application = get_wsgi_application()
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class CoreConfig(AppConfig):
name = 'core'
import jwt, datetime
from rest_framework import exceptions
def create_access_token(id):
return jwt.encode({
'user_id': id,
'exp': datetime.datetime.utcnow() + datetime.timedelta(seconds=30),
'iat': datetime.datetime.utcnow()
}, 'access_secret', algorithm='HS256')
def decode_access_token(token):
try:
payload = jwt.decode(token, 'access_secret', algorithms='HS256')
return payload['user_id']
except:
raise exceptions.AuthenticationFailed('unauthenticated')
def create_refresh_token(id):
return jwt.encode({
'user_id': id,
'exp': datetime.datetime.utcnow() + datetime.timedelta(days=7),
'iat': datetime.datetime.utcnow()
}, 'refresh_secret', algorithm='HS256')
def decode_refresh_token(token):
try:
payload = jwt.decode(token, 'refresh_secret', algorithms='HS256')
return payload['user_id']
except:
raise exceptions.AuthenticationFailed('unauthenticated')
\ No newline at end of file
from rest_framework.views import exception_handler
def status_code_handler(exc, context):
response = exception_handler(exc, context)
if response is not None and response.status_code == 403:
response.status_code = 401
return response
\ No newline at end of file
# Generated by Django 3.0.8 on 2022-10-08 19:13
import django.contrib.auth.models
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0011_update_proxy_permissions'),
]
operations = [
migrations.CreateModel(
name='Appointment',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('fullName', models.CharField(max_length=100)),
('gender', models.CharField(choices=[('1', 'One'), ('2', 'Two'), ('3', 'Three')], max_length=300)),
('email', models.CharField(max_length=255)),
('doctorName', models.CharField(max_length=255)),
('appointmentTime', models.DateTimeField()),
],
),
migrations.CreateModel(
name='User',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('name', models.CharField(max_length=255)),
('email', models.CharField(max_length=255, unique=True)),
('password', models.CharField(max_length=255)),
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
],
options={
'verbose_name': 'user',
'verbose_name_plural': 'users',
'abstract': False,
},
managers=[
('objects', django.contrib.auth.models.UserManager()),
],
),
]
# Generated by Django 3.0.8 on 2022-10-08 20:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='File',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('file', models.FileField(upload_to='')),
],
),
]
# Generated by Django 3.0.8 on 2022-10-10 06:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0002_file'),
]
operations = [
migrations.CreateModel(
name='specificAppointment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('email', models.CharField(max_length=100)),
],
),
]
import email
from django.contrib.auth.models import AbstractUser
from django.db import models
class User(AbstractUser):
name = models.CharField(max_length=255)
email = models.CharField(max_length=255, unique=True)
password = models.CharField(max_length=255)
first_name = None
last_name = None
username = None
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = []
genderChoices =(
("1", "One"),
("2", "Two"),
("3", "Three"),
)
class Appointment(models.Model):
id = models.AutoField(primary_key=True)
fullName = models.CharField(max_length=100)
gender = models.CharField(max_length=300, choices=genderChoices)
email = models.CharField(max_length=255)
doctorName = models.CharField(max_length=255)
appointmentTime =models.DateTimeField()
class specificAppointment(models.Model):
email = models.CharField(max_length=100)
class File(models.Model):
file = models.FileField(blank=False, null=False)
def __str__(self):
return self.file.name
\ No newline at end of file
import easyocr
import cv2
from matplotlib import pyplot as plt
import numpy as np
def main(file):
IMAGE_PATH = file
reader = easyocr.Reader(['en'])
result = reader.readtext(IMAGE_PATH)
# print(result)
image_values = []
for x in result:
# print(x[1])
image_values.append(x[1])
final_result = []
medicines = []
final_result.append(('Date', str(image_values[4].replace('Date:', ''))))
final_result.append(('Name', str(image_values[7].replace('Your Name:', ''))))
final_result.append(('Address', str(image_values[8].replace('Address:', ''))))
final_result.append(('Medicines', image_values[9:]))
# out final result
for f in final_result:
print(f)
img = cv2.imread(IMAGE_PATH)
font = cv2.FONT_HERSHEY_SIMPLEX
# Date
top_left = tuple(result[4][0][0])
bottom_right = tuple(result[4][0][2])
date_text = result[4][1]
img = cv2.rectangle(img, top_left, bottom_right, (0, 255, 0), 5)
img = cv2.putText(img, date_text, top_left, font, 0.5, (0, 0, 0), 3, cv2.LINE_AA)
# Name
top_left = tuple(result[7][0][0])
bottom_right = tuple(result[7][0][2])
text = result[7][1]
font = cv2.FONT_HERSHEY_SIMPLEX
img = cv2.rectangle(img, top_left, bottom_right, (0, 255, 0), 5)
img = cv2.putText(img, text, top_left, font, 0.5, (0, 0, 0), 3, cv2.LINE_AA)
# Address
top_left = tuple(result[8][0][0])
bottom_right = tuple(result[8][0][2])
text = result[8][1]
font = cv2.FONT_HERSHEY_SIMPLEX
img = cv2.rectangle(img, top_left, bottom_right, (0, 255, 0), 5)
img = cv2.putText(img, text, top_left, font, 0.5, (0, 0, 0), 3, cv2.LINE_AA)
# Medicine
for i in range(9, len(result)-1):
top_left = tuple(result[i][0][0])
bottom_right = tuple(result[i][0][2])
text = result[i][1]
font = cv2.FONT_HERSHEY_SIMPLEX
img = cv2.rectangle(img, top_left, bottom_right, (0, 255, 0), 5)
img = cv2.putText(img, text, top_left, font, 0.5, (0, 0, 0), 3, cv2.LINE_AA)
return final_result
# main('new/3.jpeg')
# plt.imshow(img)
# plt.show()
from rest_framework.serializers import ModelSerializer
from .models import User,Appointment, specificAppointment
from .models import File
class UserSerializer(ModelSerializer):
class Meta:
model = User
fields = ['id', 'name', 'email', 'password']
extra_kwargs = {
'password': {'write_only': True}
}
def create(self, validated_data):
password = validated_data.pop('password', None)
instance = self.Meta.model(**validated_data)
if password is not None:
instance.set_password(password)
instance.save()
return instance
class AppointmentSerializer(ModelSerializer):
class Meta:
model = Appointment
fields = ['id', 'fullName', 'gender', 'email', 'doctorName','appointmentTime']
class SpecificAppointmentSerilaizer(ModelSerializer):
class Meta:
model = specificAppointment
fields = "__all__"
class FileSerializer(ModelSerializer):
class Meta:
model = File
fields = "__all__"
from django.test import TestCase
# Create your tests here.
from django.urls import path
from .views import RegisterAPIView, LoginAPIView, UserAPIView, RefreshAPIView, LogoutAPIView, AppointmentAPIView, FileUploadView, SpecificAppointmentAPIView
urlpatterns = [
path('register', RegisterAPIView.as_view()),
path('login', LoginAPIView.as_view()),
path('user', UserAPIView.as_view()),
path('refresh', RefreshAPIView.as_view()),
path('logout', LogoutAPIView.as_view()),
path('appointment', AppointmentAPIView.as_view()),
path('medicine', FileUploadView.as_view()),
path('specificAppointment', SpecificAppointmentAPIView.as_view())
]
from rest_framework.authentication import get_authorization_header
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.exceptions import APIException, AuthenticationFailed
from rest_framework import status
from rest_framework.parsers import FileUploadParser
from .authentication import create_access_token, create_refresh_token, decode_access_token, decode_refresh_token
from .serializers import UserSerializer,AppointmentSerializer, SpecificAppointmentSerilaizer
from .models import User,Appointment, specificAppointment
from .serializers import FileSerializer
from .predict import main
class RegisterAPIView(APIView):
def post(self, request):
serializer = UserSerializer(data=request.data)
serializer.is_valid(raise_exception=True)
serializer.save()
return Response(serializer.data)
class LoginAPIView(APIView):
def post(self, request):
user = User.objects.filter(email=request.data['email']).first()
if not user:
raise APIException('Invalid credentials!')
if not user.check_password(request.data['password']):
raise APIException('Invalid credentials!')
access_token = create_access_token(user.id)
refresh_token = create_refresh_token(user.id)
response = Response()
response.set_cookie(key='refreshToken', value=refresh_token, httponly=True)
response.data = {
'token': access_token
}
return response
class UserAPIView(APIView):
def get(self, request):
auth = get_authorization_header(request).split()
if auth and len(auth) == 2:
token = auth[1].decode('utf-8')
id = decode_access_token(token)
user = User.objects.filter(pk=id).first()
return Response(UserSerializer(user).data)
raise AuthenticationFailed('unauthenticated')
class RefreshAPIView(APIView):
def post(self, request):
refresh_token = request.COOKIES.get('refreshToken')
id = decode_refresh_token(refresh_token)
access_token = create_access_token(id)
return Response({
'token': access_token
})
class LogoutAPIView(APIView):
def post(self, _):
response = Response()
response.delete_cookie(key="refreshToken")
response.data = {
'message': 'success'
}
return response
class AppointmentAPIView(APIView):
def post(self,request):
serializer = AppointmentSerializer(data=request.data)
serializer.is_valid(raise_exception=True)
serializer.save()
return Response(serializer.data)
def checkAppointment(email,arrayValue):
a = []
for x in range(len(arrayValue)):
# print(arrayValue[0]['email'])
if email == arrayValue[x]['doctorName']:
a.append(arrayValue[x])
return a
class SpecificAppointmentAPIView(APIView):
def post(self, request, *args, **kwargs):
serializer = SpecificAppointmentSerilaizer(data=request.data)
serializer.is_valid(raise_exception=True)
snippets = Appointment.objects.all()
serializer_1 = AppointmentSerializer(snippets, many=True)
value = checkAppointment(serializer.data['email'], serializer_1.data)
return Response(value)
class FileUploadView(APIView):
parser_class = (FileUploadParser,)
def post(self, request, *args, **kwargs):
file_serializer = FileSerializer(data=request.data)
if file_serializer.is_valid():
file_serializer.save()
result=file_serializer.data
result_class = main(result['file'][1:])
return Response(result_class, status=status.HTTP_201_CREATED)
else:
return Response(file_serializer.errors, status=status.HTTP_400_BAD_REQUEST)
\ No newline at end of file
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class StaffConfig(AppConfig):
name = 'staff'
import jwt, datetime
from rest_framework import exceptions
def create_access_token(id):
return jwt.encode({
'user_id': id,
'exp': datetime.datetime.utcnow() + datetime.timedelta(seconds=30),
'iat': datetime.datetime.utcnow()
}, 'access_secret', algorithm='HS256')
def decode_access_token(token):
try:
payload = jwt.decode(token, 'access_secret', algorithms='HS256')
return payload['user_id']
except:
raise exceptions.AuthenticationFailed('unauthenticated')
def create_refresh_token(id):
return jwt.encode({
'user_id': id,
'exp': datetime.datetime.utcnow() + datetime.timedelta(days=7),
'iat': datetime.datetime.utcnow()
}, 'refresh_secret', algorithm='HS256')
def decode_refresh_token(token):
try:
payload = jwt.decode(token, 'refresh_secret', algorithms='HS256')
return payload['user_id']
except:
raise exceptions.AuthenticationFailed('unauthenticated')
\ No newline at end of file
from rest_framework.views import exception_handler
def status_code_handler(exc, context):
response = exception_handler(exc, context)
if response is not None and response.status_code == 403:
response.status_code = 401
return response
\ No newline at end of file
# Generated by Django 3.0.8 on 2022-10-10 05:47
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='labReport',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('file', models.FileField(upload_to='')),
],
),
migrations.CreateModel(
name='Salary',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('Name', models.CharField(max_length=180)),
('Qualification', models.CharField(max_length=180)),
('Experience', models.CharField(max_length=180)),
('Rating', models.CharField(max_length=180)),
('Place', models.CharField(max_length=180)),
('Profile', models.CharField(max_length=180)),
],
),
migrations.CreateModel(
name='User',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('name', models.CharField(max_length=255)),
('email', models.CharField(max_length=255, unique=True)),
('password', models.CharField(max_length=255)),
],
options={
'abstract': False,
},
),
]
This source diff could not be displayed because it is too large. You can view the blob instead.
from django.contrib.auth.models import AbstractBaseUser
from django.db import models
class User(AbstractBaseUser):
name = models.CharField(max_length=255)
email = models.CharField(max_length=255, unique=True)
password = models.CharField(max_length=255)
first_name = None
last_name = None
username = None
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = []
class labReport(models.Model):
file = models.FileField(blank=False, null=False)
def __str__(self):
return self.file.name
class Salary(models.Model):
Name = models.CharField(max_length = 180)
Qualification = models.CharField(max_length = 180)
Experience = models.CharField(max_length = 180)
Rating = models.CharField(max_length = 180)
Place = models.CharField(max_length = 180)
Profile = models.CharField(max_length = 180)
def __str__(self):
return self.Qualification
import numpy as np
import cv2
import matplotlib.pyplot as plt
import pytesseract
import re
from pytesseract import Output
import pytesseract
pytesseract.pytesseract.tesseract_cmd = r'C:\\Program Files\\Tesseract-OCR\\tesseract.exe'
def plot_gray(image):
plt.figure(figsize=(16,10))
return plt.imshow(image, cmap='Greys_r')
def plot_rgb(image):
plt.figure(figsize=(16,10))
return plt.imshow(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
def readCBC(extractedText):
lineNumberStart = extractedText.index('Complete Blood Picture (CBC)')
lineNumberEnd = extractedText.index('Differential Count')
dicts = {}
i = 0
for x in range(lineNumberStart+3, lineNumberEnd-1):
resultLine = extractedText[x].split(" ")
dicts[i] = {'name': resultLine[0], 'result': resultLine[1], 'unit' : resultLine[2], 'refRnage': resultLine[3]}
i = i+1
return dicts
def main(file_path):
file_name = file_path
image = cv2.imread(file_name, cv2.IMREAD_GRAYSCALE)
d = pytesseract.image_to_data(image, output_type=Output.DICT)
n_boxes = len(d['level'])
boxes = cv2.cvtColor(image.copy(), cv2.COLOR_BGR2RGB)
for i in range(n_boxes):
(x, y, w, h) = (d['left'][i], d['top'][i], d['width'][i], d['height'][i])
boxes = cv2.rectangle(boxes, (x, y), (x + w, y + h), (0, 255, 0), 2)
extracted_text = pytesseract.image_to_string(image)
ls = extracted_text.split("\n")
return(readCBC(ls))
# print(main("/home/aloka/Documents/medical-final year project/LabReport/lab-sample.jpg"))
\ No newline at end of file
import pickle
import pandas as pd
import numpy as np
from sklearn.preprocessing import MinMaxScaler
def PreProcess(df):
################## 'Experience' ########################
df['Experience'] = df['Experience'].astype(str).str.split(' ').map(lambda x: x[0])
df['Experience'] = df['Experience'].astype(np.int64)
########################## 'Place' #################################
###### We drop the entire row for null values of 'Place' #######
df = df.dropna(axis=0, subset=['Place'])
###### Keeping only the city in 'Place' ######
City = df['Place'].str.split(', ', n = 1, expand = True)
df['Place'] = City[1]
df.drop(df[df['Place'] == 'Sector 5, Delhi'].index, inplace = True)
df.drop(df[df['Place'].isna()].index, inplace = True)
###### Resetting index after row deletion ###+##
df = df.reset_index(drop=True)
################## 'Qualification' column #################################
idx = df.index[df['Qualification'].str.contains('|'.join(['Fellowship','MRCS','FCGP', 'FRCS', 'FWFO', 'FPFA', 'FICD']))]
df['Qualification'][idx] = 'Fellowship'
idx = df.index[df['Qualification'].str.contains('|'.join(['MD', 'M.D','MS','MDS', 'PhD', 'DNB', 'DLO','DDV',
'DDVL', 'Diploma in Dermatology']))]
df['Qualification'][idx] = 'MD'
idx = df.index[df['Qualification'].str.contains('|'.join(['MBBS', '39 years experience']))]
df['Qualification'][idx] = 'MBBS'
idx = df.index[df['Qualification'].str.contains('BDS')]
df['Qualification'][idx] = 'BDS'
idx = df.index[df['Qualification'].str.contains('|'.join(['BHMS','LCEH', 'GCEH']))]
df['Qualification'][idx] = 'BHMS'
idx = df.index[df['Qualification'].str.contains('|'.join(['BAMS', 'BSAM', 'G.A.M.S', 'DAM']))]
df['Qualification'][idx] = 'BAMS'
####################### Working on Rating #################################
## Extracting the integer from the string
df['Rating'] = df.Rating.str.extract('(\d+)')
## Fill Nan with -1 and then convert to str and integer
df['Rating'] = df['Rating'].fillna(-1).astype(str).astype(np.float64)
df['Rating'] = df['Rating'].replace(-1, np.nan)
######## Imputing mean values depending upon 'Qualification' and 'Experience' #############
for qual in list(df.Qualification.unique()):
Mean = df[(df['Qualification'] == qual) & (df['Experience'] >= 30)]['Rating'].mean()
df.loc[(df['Qualification'] == qual) & (df['Experience'] >= 30), 'Rating'] = Mean
Mean = df[(df['Qualification']== qual) & (df['Experience']>=20) & (df['Experience']<30)]['Rating'].mean()
df.loc[(df['Qualification']==qual) & (df['Experience']>=20) & (df['Experience']<30),'Rating'] = Mean
Mean = df[(df['Qualification'] == qual) & (df['Experience'] >= 10) & (df['Experience'] < 20)]['Rating'].mean()
df.loc[(df['Qualification'] == qual) & (df['Experience'] >= 10) & (df['Experience'] < 20),'Rating'] = Mean
Mean = df[(df['Qualification'] == qual) & (df['Experience'] <10)]['Rating'].mean()
df.loc[(df['Qualification'] == qual) & (df['Experience'] <10),'Rating'] = Mean
########## Fill remaining null values, if any, with 0 ################################
df['Rating'] = df['Rating'].fillna(0)
return df
def main1(list_row):
data=pd.read_csv('D:\\FYP\\Update\\app\\staff\\model\\train.csv')
data.loc[len(data)] = list_row
data_new = PreProcess(data)
x=data_new.iloc[:,:5]
x = x.astype({"Qualification":'category',"Place":'category',"Profile":'category'})
x = pd.get_dummies(x,columns = ['Qualification', 'Place', 'Profile'],prefix=['Qualification', 'Place', 'Profile'])
MM = MinMaxScaler()
x[['Experience', 'Rating']] = MM.fit_transform(x[['Experience', 'Rating']])
import pickle
filename = "D:\\FYP\\Update\\app\\staff\\model\\final_model.pkl"
loaded_model=pickle.load(open(filename, 'rb'))
return(loaded_model.predict(x.iloc[:1]))
# print(main(['BHMS, MD - Homeopathy', '24 years experience', '100%', 'Kakkanad, Ernakulam', 'Homeopath','','']))
# Sample data
from rest_framework.serializers import ModelSerializer
from .models import Salary, User
from .models import labReport
class UserSerializer(ModelSerializer):
class Meta:
model = User
fields = ['id', 'name', 'email', 'password']
extra_kwargs = {
'password': {'write_only': True}
}
def create(self, validated_data):
password = validated_data.pop('password', None)
instance = self.Meta.model(**validated_data)
if password is not None:
instance.set_password(password)
instance.save()
return instance
class LabReportSerializer(ModelSerializer):
class Meta:
model = labReport
fields = "__all__"
class salarySerializer(ModelSerializer):
class Meta:
model = Salary
fields = "__all__"
from django.test import TestCase
# Create your tests here.
from django.urls import path
from .views import RegisterAPIView, LoginAPIView, TodoListApiView, UserAPIView, RefreshAPIView, LogoutAPIView, LabReportView
urlpatterns = [
path('register', RegisterAPIView.as_view()),
path('login', LoginAPIView.as_view()),
path('user', UserAPIView.as_view()),
path('refresh', RefreshAPIView.as_view()),
path('logout', LogoutAPIView.as_view()),
path('logout', LogoutAPIView.as_view()),
path('labreport', LabReportView.as_view()),
path('salary', TodoListApiView.as_view())
]
from rest_framework.authentication import get_authorization_header
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.exceptions import APIException, AuthenticationFailed
from rest_framework.parsers import FileUploadParser
from rest_framework import status
from .authentication import create_access_token, create_refresh_token, decode_access_token, decode_refresh_token
from .serializers import UserSerializer, salarySerializer
from .models import Salary, User, labReport
from .serializers import LabReportSerializer
from .predict_Salary import main1
from .predict_LabReport import main
class RegisterAPIView(APIView):
def post(self, request):
serializer = UserSerializer(data=request.data)
serializer.is_valid(raise_exception=True)
serializer.save()
return Response(serializer.data)
class LoginAPIView(APIView):
def post(self, request):
user = User.objects.filter(email=request.data['email']).first()
if not user:
raise APIException('Invalid credentials!')
if not user.check_password(request.data['password']):
raise APIException('Invalid credentials!')
access_token = create_access_token(user.id)
refresh_token = create_refresh_token(user.id)
response = Response()
response.set_cookie(key='refreshToken', value=refresh_token, httponly=True)
response.data = {
'token': access_token
}
return response
class UserAPIView(APIView):
def get(self, request):
auth = get_authorization_header(request).split()
if auth and len(auth) == 2:
token = auth[1].decode('utf-8')
id = decode_access_token(token)
user = User.objects.filter(pk=id).first()
return Response(UserSerializer(user).data)
raise AuthenticationFailed('unauthenticated')
class RefreshAPIView(APIView):
def post(self, request):
refresh_token = request.COOKIES.get('refreshToken')
id = decode_refresh_token(refresh_token)
access_token = create_access_token(id)
return Response({
'token': access_token
})
class LogoutAPIView(APIView):
def post(self, _):
response = Response()
response.delete_cookie(key="refreshToken")
response.data = {
'message': 'success'
}
return response
class LabReportView(APIView):
parser_class = (FileUploadParser,)
def post(self, request, *args, **kwargs):
file_serializer = LabReportSerializer(data=request.data)
if file_serializer.is_valid():
file_serializer.save()
result=file_serializer.data
result_class = main(result['file'][1:])
return Response(result_class, status=status.HTTP_201_CREATED)
else:
return Response(file_serializer.errors, status=status.HTTP_400_BAD_REQUEST)
class TodoListApiView(APIView):
def post(self, request, *args, **kwargs):
serializer = salarySerializer(data=request.data)
if serializer.is_valid():
serializer.save()
# print(serializer.data)
list_value =[serializer.data['Qualification'],
serializer.data['Experience'],
serializer.data['Rating'],
serializer.data['Place'],
serializer.data['Profile'],'',''
]
result_value = main1(list_row=list_value)
return Response(result_value, status=status.HTTP_201_CREATED)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
def get(self, request, *args, **kwargs):
snippets = Salary.objects.all()
serializer = salarySerializer(snippets, many=True)
return Response(serializer.data)
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at przemek.strucinski@gmail.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
theme: jekyll-theme-cayman
\ No newline at end of file
{"ast":null,"code":"import _slicedToArray from \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\node_modules\\\\babel-preset-react-app\\\\node_modules\\\\@babel\\\\runtime/helpers/esm/slicedToArray\";\nvar _jsxFileName = \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\src\\\\components\\\\LeftMenu\\\\LeftMenu.tsx\";\nimport React, { Fragment, useState } from \"react\";\nimport { Link } from \"react-router-dom\";\n\nconst LeftMenu = () => {\n let _useState = useState(false),\n _useState2 = _slicedToArray(_useState, 2),\n leftMenuVisibility = _useState2[0],\n setLeftMenuVisibility = _useState2[1];\n\n function changeLeftMenuVisibility() {\n setLeftMenuVisibility(!leftMenuVisibility);\n }\n\n function getCollapseClass() {\n return leftMenuVisibility ? \"\" : \"collapsed\";\n }\n\n return React.createElement(Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 17\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"toggle-area\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 18\n },\n __self: this\n }, React.createElement(\"button\", {\n className: \"btn btn-primary toggle-button\",\n onClick: () => changeLeftMenuVisibility(),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 19\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-bolt\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 20\n },\n __self: this\n }))), React.createElement(\"ul\", {\n className: \"navbar-nav bg-gradient-primary-green sidebar sidebar-dark accordion \".concat(getCollapseClass()),\n id: \"collapseMenu\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 24\n },\n __self: this\n }, React.createElement(\"a\", {\n className: \"sidebar-brand d-flex align-items-center justify-content-center\",\n href: \"index.html\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 27\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"sidebar-brand-icon icon-green rotate-n-15\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 28\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-bolt\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 29\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"sidebar-brand-text\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 31\n },\n __self: this\n }, \"RyHelpProfile\")), React.createElement(\"hr\", {\n className: \"sidebar-divider my-0\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 34\n },\n __self: this\n }), React.createElement(\"li\", {\n className: \"nav-item active\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 36\n },\n __self: this\n }, React.createElement(Link, {\n className: \"nav-link\",\n to: \"Home\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 38\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-fw fa-tachometer-alt\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 39\n },\n __self: this\n }), React.createElement(\"span\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 40\n },\n __self: this\n }, \"Dashboard\"))), React.createElement(\"hr\", {\n className: \"sidebar-divider\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 44\n },\n __self: this\n }), React.createElement(\"div\", {\n className: \"sidebar-heading\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 45\n },\n __self: this\n }, \"Managment\"), React.createElement(\"li\", {\n className: \"nav-item\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 49\n },\n __self: this\n }, React.createElement(Link, {\n className: \"nav-link\",\n to: \"/products\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 50\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-fw fa-user\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 51\n },\n __self: this\n }), React.createElement(\"span\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 52\n },\n __self: this\n }, \"Doctor Profiles\"))), React.createElement(\"li\", {\n className: \"nav-item\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 56\n },\n __self: this\n }, React.createElement(Link, {\n className: \"nav-link\",\n to: \"/orders\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 57\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-fw fa-dollar-sign\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 58\n },\n __self: this\n }), React.createElement(\"span\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 59\n },\n __self: this\n }, \"Lab Reports\"))), React.createElement(\"hr\", {\n className: \"sidebar-divider\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 63\n },\n __self: this\n }), React.createElement(\"div\", {\n className: \"sidebar-heading\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 65\n },\n __self: this\n }, \"Profile\"), React.createElement(\"li\", {\n className: \"nav-item\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 70\n },\n __self: this\n }, React.createElement(Link, {\n className: \"nav-link\",\n to: \"/users\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 71\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-fw fa-user\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 72\n },\n __self: this\n }), React.createElement(\"span\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 73\n },\n __self: this\n }, \"Patients\"))), React.createElement(\"hr\", {\n className: \"sidebar-divider d-none d-md-block\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 77\n },\n __self: this\n })));\n};\n\nexport default LeftMenu;","map":{"version":3,"sources":["D:/FYP/Update/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/LeftMenu/LeftMenu.tsx"],"names":["React","Fragment","useState","Link","LeftMenu","leftMenuVisibility","setLeftMenuVisibility","changeLeftMenuVisibility","getCollapseClass"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,QAA1B,QAA0C,OAA1C;AACA,SAASC,IAAT,QAAqB,kBAArB;;AAEA,MAAMC,QAAkB,GAAG,MAAM;AAAA,kBAEqBF,QAAQ,CAAC,KAAD,CAF7B;AAAA;AAAA,MAExBG,kBAFwB;AAAA,MAEJC,qBAFI;;AAI7B,WAASC,wBAAT,GAAoC;AAChCD,IAAAA,qBAAqB,CAAC,CAACD,kBAAF,CAArB;AACH;;AAED,WAASG,gBAAT,GAA4B;AACxB,WAAQH,kBAAD,GAAuB,EAAvB,GAA4B,WAAnC;AACH;;AAED,SACI,oBAAC,QAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAK,IAAA,SAAS,EAAC,aAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAQ,IAAA,SAAS,EAAC,+BAAlB;AAAkD,IAAA,OAAO,EAAE,MAAME,wBAAwB,EAAzF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAG,IAAA,SAAS,EAAC,aAAb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADJ,CADJ,CADJ,EAOI;AAAI,IAAA,SAAS,gFAAyEC,gBAAgB,EAAzF,CAAb;AACI,IAAA,EAAE,EAAC,cADP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAGI;AAAG,IAAA,SAAS,EAAC,gEAAb;AAA8E,IAAA,IAAI,EAAC,YAAnF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAK,IAAA,SAAS,EAAC,2CAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAG,IAAA,SAAS,EAAC,aAA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,KACI;AAAG,IAAA,SAAS,EAAC,0BAAb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADJ,EAEI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAFJ,CADJ,CAhCJ,EAuCI;AAAI,IAAA,SAAS,EAAC,iBAAd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAvCJ,EAyCI;AAAK,IAAA,SAAS,EAAC,iBAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAzCJ,EA8CI;AAAI,IAAA,SAAS,EAAC,UAAd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI,oBAAC,IAAD;AAAM,IAAA,SAAS,EAAC,UAAhB;AAA2B,IAAA,EAAE,UAA7B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAG,IAAA,SAAS,EAAC,mBAAb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADJ,EAEI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAFJ,CADJ,CA9CJ,EAqDI;AAAI,IAAA,SAAS,EAAC,mCAAd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IArDJ,CAPJ,CADJ;AAiEH,CA7ED;;AA+EA,eAAeJ,QAAf","sourcesContent":["import React, { Fragment, useState } from \"react\";\nimport { Link } from \"react-router-dom\";\n\nconst LeftMenu: React.FC = () => {\n\n let [leftMenuVisibility, setLeftMenuVisibility] = useState(false);\n\n function changeLeftMenuVisibility() {\n setLeftMenuVisibility(!leftMenuVisibility);\n }\n\n function getCollapseClass() {\n return (leftMenuVisibility) ? \"\" : \"collapsed\";\n }\n\n return (\n <Fragment>\n <div className=\"toggle-area\">\n <button className=\"btn btn-primary toggle-button\" onClick={() => changeLeftMenuVisibility()}>\n <i className=\"fas fa-bolt\"></i>\n </button>\n </div>\n\n <ul className={`navbar-nav bg-gradient-primary-green sidebar sidebar-dark accordion ${getCollapseClass()}`}\n id=\"collapseMenu\">\n\n <a className=\"sidebar-brand d-flex align-items-center justify-content-center\" href=\"index.html\">\n <div className=\"sidebar-brand-icon icon-green rotate-n-15\">\n <i className=\"fas fa-bolt\"></i>\n </div>\n <div className=\"sidebar-brand-text\">RyHelpProfile</div>\n </a>\n\n <hr className=\"sidebar-divider my-0\" />\n\n <li className=\"nav-item active\">\n\n <Link className=\"nav-link\" to=\"Home\">\n <i className=\"fas fa-fw fa-tachometer-alt\"></i>\n <span>Dashboard</span>\n </Link>\n </li>\n\n <hr className=\"sidebar-divider\" />\n <div className=\"sidebar-heading\">\n Managment\n </div>\n\n <li className=\"nav-item\">\n <Link className=\"nav-link\" to={`/products`}>\n <i className=\"fas fa-fw fa-user\"></i>\n <span>Doctor Profiles</span>\n </Link>\n </li>\n\n <li className=\"nav-item\">\n <Link className=\"nav-link\" to={`/orders`}>\n <i className=\"fas fa-fw fa-dollar-sign\"></i>\n <span>Lab Reports</span>\n </Link>\n </li>\n \n <hr className=\"sidebar-divider\" />\n\n <div className=\"sidebar-heading\">\n Profile\n </div>\n\n\n <li className=\"nav-item\">\n <Link className=\"nav-link\" to={`/users`}>\n <i className=\"fas fa-fw fa-user\"></i>\n <span>Patients</span>\n </Link>\n </li>\n\n <hr className=\"sidebar-divider d-none d-md-block\" />\n </ul>\n </Fragment>\n );\n};\n\nexport default LeftMenu;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"'use strict';\n\nvar URL = require('url-parse');\n\nvar debug = function () {};\n\nif (process.env.NODE_ENV !== 'production') {\n debug = require('debug')('sockjs-client:utils:url');\n}\n\nmodule.exports = {\n getOrigin: function (url) {\n if (!url) {\n return null;\n }\n\n var p = new URL(url);\n\n if (p.protocol === 'file:') {\n return null;\n }\n\n var port = p.port;\n\n if (!port) {\n port = p.protocol === 'https:' ? '443' : '80';\n }\n\n return p.protocol + '//' + p.hostname + ':' + port;\n },\n isOriginEqual: function (a, b) {\n var res = this.getOrigin(a) === this.getOrigin(b);\n debug('same', a, b, res);\n return res;\n },\n isSchemeEqual: function (a, b) {\n return a.split(':')[0] === b.split(':')[0];\n },\n addPath: function (url, path) {\n var qs = url.split('?');\n return qs[0] + path + (qs[1] ? '?' + qs[1] : '');\n },\n addQuery: function (url, q) {\n return url + (url.indexOf('?') === -1 ? '?' + q : '&' + q);\n }\n};","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"import isPlainObject from './isPlainObject';\nimport warning from './warning';\nexport default function verifyPlainObject(value, displayName, methodName) {\n if (!isPlainObject(value)) {\n warning(methodName + \"() in \" + displayName + \" must return a plain object. Instead received \" + value + \".\");\n }\n}","map":null,"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"import _defineProperty from \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/defineProperty\";\nimport _slicedToArray from \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/slicedToArray\";\nvar _jsxFileName = \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Orders/OrderForm.tsx\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nimport React, { useState, Fragment } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { addOrder } from \"../../store/actions/orders.actions\";\nimport { addNotification } from \"../../store/actions/notifications.action\";\nimport { clearSelectedProduct, changeProductAmount } from \"../../store/actions/products.action\";\nimport axios from 'axios';\n\nconst OrderForm = () => {\n const dispatch = useDispatch();\n const selectedProduct = useSelector(state => state.products.selectedProduct);\n const orders = useSelector(state => state.orders.orders);\n\n const _useState = useState(null),\n _useState2 = _slicedToArray(_useState, 2),\n selectedFile = _useState2[0],\n setSelectedFile = _useState2[1];\n\n const initialFormState = {\n name: {\n error: \"\",\n value: \"\"\n },\n product: {\n error: \"\",\n value: null\n },\n amount: {\n error: \"\",\n value: 0\n },\n totalPrice: {\n error: \"\",\n value: 0\n }\n };\n\n const _useState3 = useState(initialFormState),\n _useState4 = _slicedToArray(_useState3, 2),\n formState = _useState4[0],\n setFormState = _useState4[1];\n\n function hasAmountChanged(model) {\n let totalPrice = formState.totalPrice.value;\n\n if (selectedProduct) {\n totalPrice = selectedProduct.price * model.value;\n }\n\n setFormState(_objectSpread({}, formState, {\n amount: {\n error: model.error,\n value: model.value\n },\n totalPrice: {\n error: model.error,\n value: totalPrice\n }\n }));\n }\n\n function hasFormValueChanged(model) {\n setFormState(_objectSpread({}, formState, {\n [model.field]: {\n error: model.error,\n value: model.value\n }\n }));\n }\n\n function resetForm() {\n setFormState(initialFormState);\n }\n\n function saveOrder(e) {\n e.preventDefault();\n\n if (isFormInvalid()) {\n return;\n }\n\n saveForm(formState);\n }\n\n function saveForm(formState) {\n if (selectedProduct) {\n if (selectedProduct.amount < formState.amount.value) {\n alert(\"Not enough products in warehouse\");\n return;\n }\n\n formState.product.value = selectedProduct;\n dispatch(addOrder({\n id: 0,\n name: formState.name.value,\n amount: formState.amount.value,\n totalPrice: formState.totalPrice.value,\n product: formState.product.value\n }));\n dispatch(addNotification(\"Order added\", \"Order \".concat(formState.name.value, \" added by you\")));\n dispatch(clearSelectedProduct());\n dispatch(changeProductAmount(selectedProduct.id, formState.amount.value));\n resetForm();\n }\n }\n\n function isFormInvalid() {\n return formState.amount.error || formState.totalPrice.error || formState.name.error || formState.product.error || !formState.name.value || !selectedProduct;\n }\n\n function getDisabledClass() {\n let isError = isFormInvalid();\n return isError ? \"disabled\" : \"\";\n }\n\n const handleFileSelect = selectorFiles => {\n console.log(selectorFiles[0]);\n setSelectedFile(selectorFiles[0]);\n axios.post('http://127.0.0.1:8000/staffapi/salary', selectorFiles[0]).then(response => console.log(response.data));\n };\n\n return React.createElement(Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 101\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card shadow mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 102\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card-header py-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 103\n },\n __self: this\n }, React.createElement(\"h6\", {\n className: \"m-0 font-weight-bold text-green\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 104\n },\n __self: this\n }, \"Upload\")), React.createElement(\"div\", {\n className: \"card-body\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 106\n },\n __self: this\n }, React.createElement(\"form\", {\n onSubmit: saveOrder,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 107\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 108\n },\n __self: this\n }, React.createElement(\"input\", {\n type: \"file\",\n onChange: e => handleFileSelect(e.target.files),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 109\n },\n __self: this\n }))))));\n};\n\nexport default OrderForm;","map":{"version":3,"sources":["/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Orders/OrderForm.tsx"],"names":["React","useState","Fragment","useDispatch","useSelector","addOrder","addNotification","clearSelectedProduct","changeProductAmount","axios","OrderForm","dispatch","selectedProduct","state","products","orders","selectedFile","setSelectedFile","initialFormState","name","error","value","product","amount","totalPrice","formState","setFormState","hasAmountChanged","model","price","hasFormValueChanged","field","resetForm","saveOrder","e","preventDefault","isFormInvalid","saveForm","alert","id","getDisabledClass","isError","handleFileSelect","selectorFiles","console","log","post","then","response","data","target","files"],"mappings":";;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAAqCC,QAArC,QAA+D,OAA/D;AAKA,SAASC,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AACA,SAASC,QAAT,QAAyB,oCAAzB;AACA,SAASC,eAAT,QAAgC,0CAAhC;AACA,SAASC,oBAAT,EAA+BC,mBAA/B,QAA0D,qCAA1D;AAGA,OAAOC,KAAP,MAAkB,OAAlB;;AAEA,MAAMC,SAAmB,GAAG,MAAM;AAC9B,QAAMC,QAAuB,GAAGR,WAAW,EAA3C;AACA,QAAMS,eAAgC,GAAGR,WAAW,CAAES,KAAD,IAAuBA,KAAK,CAACC,QAAN,CAAeF,eAAvC,CAApD;AACA,QAAMG,MAAgB,GAAGX,WAAW,CAAES,KAAD,IAAuBA,KAAK,CAACE,MAAN,CAAaA,MAArC,CAApC;;AAH8B,oBAIUd,QAAQ,CAAC,IAAD,CAJlB;AAAA;AAAA,QAIvBe,YAJuB;AAAA,QAITC,eAJS;;AAK9B,QAAMC,gBAAiC,GAAG;AACtCC,IAAAA,IAAI,EAAE;AAAEC,MAAAA,KAAK,EAAE,EAAT;AAAaC,MAAAA,KAAK,EAAE;AAApB,KADgC;AAEtCC,IAAAA,OAAO,EAAE;AAAEF,MAAAA,KAAK,EAAE,EAAT;AAAaC,MAAAA,KAAK,EAAE;AAApB,KAF6B;AAGtCE,IAAAA,MAAM,EAAE;AAAEH,MAAAA,KAAK,EAAE,EAAT;AAAaC,MAAAA,KAAK,EAAE;AAApB,KAH8B;AAItCG,IAAAA,UAAU,EAAE;AAAEJ,MAAAA,KAAK,EAAE,EAAT;AAAaC,MAAAA,KAAK,EAAE;AAApB;AAJ0B,GAA1C;;AAL8B,qBAYIpB,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CAAC,CAAD,CAAd,CAAf;AACAlC,IAAAA,KAAK,CAACqC,IAAN,CAAW,uCAAX,EAAoDH,aAAa,CAAC,CAAD,CAAjE,EACCI,IADD,CACMC,QAAQ,IAAIJ,OAAO,CAACC,GAAR,CAAYG,QAAQ,CAACC,IAArB,CADlB;AAEH,GALD;;AAOA,SACI,oBAAC,QAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAK,IAAA,SAAS,EAAC,kBAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAK,IAAA,SAAS,EAAC,kBAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAI,IAAA,SAAS,EAAC,iCAAd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cADJ,CADJ,EAII;AAAK,IAAA,SAAS,EAAC,WAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAM,IAAA,QAAQ,EAAEhB,SAAhB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAK,IAAA,SAAS,EAAC,UAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAO,IAAA,IAAI,EAAC,MAAZ;AAAmB,IAAA,QAAQ,EAAGC,CAAD,IAAOQ,gBAAgB,CAACR,CAAC,CAACgB,MAAF,CAASC,KAAV,CAApD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADJ,CADJ,CADJ,CAJJ,CADJ,CADJ;AA+CH,CArID;;AAuIA,eAAezC,SAAf","sourcesContent":["import React, { useState, FormEvent, Fragment, Dispatch } from \"react\";\nimport { IProduct } from \"../../store/models/product.interface\";\nimport TextInput from \"../../common/components/TextInput\";\nimport NumberInput from \"../../common/components/NumberInput\";\nimport { OnChangeModel, IOrderFormState } from \"../../common/types/Form.types\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { addOrder } from \"../../store/actions/orders.actions\";\nimport { addNotification } from \"../../store/actions/notifications.action\";\nimport { clearSelectedProduct, changeProductAmount } from \"../../store/actions/products.action\";\nimport { IOrder } from \"../../store/models/order.interface\";\nimport { IStateType } from \"../../store/models/root.interface\";\nimport axios from 'axios'\n\nconst OrderForm: React.FC = () => {\n const dispatch: Dispatch<any> = useDispatch();\n const selectedProduct: IProduct | null = useSelector((state: IStateType) => state.products.selectedProduct);\n const orders: IOrder[] = useSelector((state: IStateType) => state.orders.orders);\n const [selectedFile, setSelectedFile] = useState(null);\n const initialFormState: IOrderFormState = {\n name: { error: \"\", value: \"\" },\n product: { error: \"\", value: null },\n amount: { error: \"\", value: 0 },\n totalPrice: { error: \"\", value: 0 },\n };\n\n const [formState, setFormState] = useState(initialFormState);\n\n function hasAmountChanged(model: OnChangeModel): void {\n let totalPrice: number = formState.totalPrice.value;\n if (selectedProduct) {\n totalPrice = selectedProduct.price * (model.value as number);\n }\n\n setFormState({\n ...formState,\n amount: { error: model.error, value: model.value as number },\n totalPrice: { error: model.error, value: totalPrice }\n });\n\n }\n\n function hasFormValueChanged(model: OnChangeModel): void {\n setFormState({ ...formState, [model.field]: { error: model.error, value: model.value } });\n }\n\n function resetForm(): void {\n setFormState(initialFormState);\n }\n\n function saveOrder(e: FormEvent<HTMLFormElement>): void {\n e.preventDefault();\n if (isFormInvalid()) {\n return;\n }\n\n saveForm(formState);\n }\n\n function saveForm(formState: IOrderFormState): void {\n if (selectedProduct) {\n if (selectedProduct.amount < formState.amount.value) {\n alert(\"Not enough products in warehouse\");\n return;\n }\n\n formState.product.value = selectedProduct;\n dispatch(addOrder({\n id: 0,\n name: formState.name.value,\n amount: formState.amount.value,\n totalPrice: formState.totalPrice.value,\n product: formState.product.value as IProduct\n }));\n\n dispatch(addNotification(\"Order added\", `Order ${formState.name.value} added by you`));\n dispatch(clearSelectedProduct());\n dispatch(changeProductAmount(selectedProduct.id, formState.amount.value));\n resetForm();\n }\n }\n\n function isFormInvalid(): boolean {\n return (formState.amount.error || formState.totalPrice.error\n || formState.name.error || formState.product.error || !formState.name.value\n || !selectedProduct) as boolean;\n }\n\n function getDisabledClass(): string {\n let isError: boolean = isFormInvalid();\n return isError ? \"disabled\" : \"\";\n }\n\n const handleFileSelect = (selectorFiles:any) => {\n console.log(selectorFiles[0])\n setSelectedFile(selectorFiles[0])\n axios.post('http://127.0.0.1:8000/staffapi/salary', selectorFiles[0])\n .then(response => console.log(response.data));\n }\n\n return (\n <Fragment>\n <div className=\"card shadow mb-4\">\n <div className=\"card-header py-3\">\n <h6 className=\"m-0 font-weight-bold text-green\">Upload</h6>\n </div>\n <div className=\"card-body\">\n <form onSubmit={saveOrder}>\n <div className=\"form-row\">\n <input type=\"file\" onChange={(e) => handleFileSelect(e.target.files)}/>\n {/* <div className=\"form-group col-md-12\">\n <TextInput id=\"input_name\"\n value={formState.name.value}\n field=\"name\"\n onChange={hasFormValueChanged}\n required={true}\n maxLength={20}\n label=\"Name\"\n placeholder=\"Name\" />\n </div>\n <div className=\"form-group col-md-6\">\n <NumberInput id=\"input_amount\"\n value={formState.amount.value}\n field=\"amount\"\n onChange={hasAmountChanged}\n max={1000}\n min={0}\n label=\"Amount\" />\n </div>\n\n <div className=\"form-group col-md-6\">\n <NumberInput id=\"input_totalPrice\"\n value={formState.totalPrice.value}\n field=\"totalPrice\"\n onChange={hasFormValueChanged}\n max={1000}\n min={0}\n label=\"Price\" />\n </div> */}\n </div>\n {/* <button className=\"btn btn-danger\" onClick={() => resetForm()}>Reset</button> */}\n {/* <button type=\"submit\" className={`btn btn-success left-margin ${getDisabledClass()}`}>Create</button> */}\n </form>\n </div>\n </div>\n </Fragment>\n );\n};\n\nexport default OrderForm;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/scheduler-tracing.production.min.js');\n} else {\n module.exports = require('./cjs/scheduler-tracing.development.js');\n}","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"import _defineProperty from \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/defineProperty\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nimport { ADD_ADMIN, REMOVE_ADMIN } from \"../actions/users.action\";\nconst initialState = {\n users: [{\n id: 1,\n firstName: \"John\",\n lastName: \"Smith\",\n email: \"jsmith@em.pl\"\n }, {\n id: 2,\n firstName: \"Jannice\",\n lastName: \"Bing\",\n email: \"ohmy@fr.pl\"\n }],\n admins: [{\n id: 3,\n firstName: \"Jannet\",\n lastName: \"Crock\",\n email: \"jcrock@em.pl\"\n }]\n};\n\nfunction userReducer(state = initialState, action) {\n switch (action.type) {\n case ADD_ADMIN:\n {\n return _objectSpread({}, state, {\n users: state.users.filter(x => x.id !== action.user.id),\n admins: [...state.admins, action.user]\n });\n }\n\n case REMOVE_ADMIN:\n {\n return _objectSpread({}, state, {\n admins: state.admins.filter(x => x.id !== action.user.id),\n users: [...state.users, action.user]\n });\n }\n\n default:\n return state;\n }\n}\n\nexport default userReducer;","map":{"version":3,"sources":["/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/store/reducers/users.reducer.ts"],"names":["ADD_ADMIN","REMOVE_ADMIN","initialState","users","id","firstName","lastName","email","admins","userReducer","state","action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AC,GAAGO,KAAK,CAACP,KAAV,EAAiBQ,MAAM,CAACI,IAAxB;AAAnF;AACH;;AACD;AACI,aAAOL,KAAP;AARR;AAUH;;AAED,eAAeD,WAAf","sourcesContent":["import { IUserState, IActionBase } from \"../models/root.interface\";\nimport { ADD_ADMIN, REMOVE_ADMIN } from \"../actions/users.action\";\n\nconst initialState: IUserState = {\n users: [\n { id: 1, firstName: \"John\", lastName: \"Smith\", email: \"jsmith@em.pl\", },\n { id: 2, firstName: \"Jannice\", lastName: \"Bing\", email: \"ohmy@fr.pl\" }\n ],\n admins: [\n { id: 3, firstName: \"Jannet\", lastName: \"Crock\", email: \"jcrock@em.pl\" },\n ]\n};\n\nfunction userReducer(state: IUserState = initialState, action: IActionBase): IUserState {\n switch (action.type) {\n case ADD_ADMIN: {\n return { ...state, users: state.users.filter(x=>x.id !== action.user.id), admins: [...state.admins, action.user]};\n }\n case REMOVE_ADMIN: {\n return { ...state, admins: state.admins.filter(x=>x.id !== action.user.id), users: [...state.users, action.user]};\n }\n default:\n return state;\n }\n}\n\nexport default userReducer;"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"import _defineProperty from \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\node_modules\\\\babel-preset-react-app\\\\node_modules\\\\@babel\\\\runtime/helpers/esm/defineProperty\";\nimport _slicedToArray from \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\node_modules\\\\babel-preset-react-app\\\\node_modules\\\\@babel\\\\runtime/helpers/esm/slicedToArray\";\nvar _jsxFileName = \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\src\\\\components\\\\Prescription\\\\OrderForm.tsx\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nimport React, { useState, Fragment } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { addNotification } from \"../../store/actions/notifications.action\";\n\nconst OrderForm = () => {\n const dispatch = useDispatch();\n const selectedProduct = useSelector(state => state.products.selectedProduct);\n const orders = useSelector(state => state.orders.orders);\n\n const _useState = useState(\"\"),\n _useState2 = _slicedToArray(_useState, 2),\n selectedFile = _useState2[0],\n setSelectedFile = _useState2[1];\n\n const initialFormState = {\n name: {\n error: \"\",\n value: \"\"\n },\n result: {\n error: \"\",\n value: 0\n },\n unit: {\n error: \"\",\n value: \"\"\n },\n refRange: {\n error: \"\",\n value: \"\"\n },\n product: {\n error: \"\",\n value: null\n },\n amount: {\n error: \"\",\n value: 0\n },\n totalPrice: {\n error: \"\",\n value: 0\n }\n };\n\n const _useState3 = useState(initialFormState),\n _useState4 = _slicedToArray(_useState3, 2),\n formState = _useState4[0],\n setFormState = _useState4[1];\n\n function hasAmountChanged(model) {\n let totalPrice = formState.totalPrice.value;\n\n if (selectedProduct) {\n totalPrice = selectedProduct.price * model.value;\n }\n\n setFormState(_objectSpread({}, formState, {\n amount: {\n error: model.error,\n value: model.value\n },\n totalPrice: {\n error: model.error,\n value: totalPrice\n }\n }));\n }\n\n function hasFormValueChanged(model) {\n setFormState(_objectSpread({}, formState, {\n [model.field]: {\n error: model.error,\n value: model.value\n }\n }));\n }\n\n function resetForm() {\n setFormState(initialFormState);\n }\n\n function saveOrder(e) {\n e.preventDefault();\n\n if (isFormInvalid()) {\n return;\n }\n\n saveForm(formState);\n }\n\n function saveForm(formState) {\n if (selectedProduct) {\n if (selectedProduct.amount < formState.amount.value) {\n alert(\"Not enough products in warehouse\");\n return;\n }\n\n formState.product.value = selectedProduct; // dispatch(addOrder({\n // id: 0,\n // name: formState.name.value,\n // amount: formState.amount.value,\n // totalPrice: formState.totalPrice.value,\n // product: formState.product.value as IProduct\n // }));\n // dispatch(addNotification(\"Order added\", `Order ${formState.name.value} added by you`));\n // dispatch(clearSelectedProduct());\n // dispatch(changeProductAmount(selectedProduct.id, formState.amount.value));\n\n resetForm();\n }\n }\n\n function isFormInvalid() {\n return formState.amount.error || formState.totalPrice.error || formState.name.error || formState.product.error || !formState.name.value || !selectedProduct;\n }\n\n function getDisabledClass() {\n let isError = isFormInvalid();\n return isError ? \"disabled\" : \"\";\n }\n\n const handleFileSelect = selectorFiles => {\n console.log(selectorFiles[0]);\n setSelectedFile(selectorFiles[0]);\n };\n\n const Send = () => {\n const formData = new FormData();\n\n if (selectedFile != \"\") {\n // formData.append(\"file\", selectedFile);\n // axios.post('http://127.0.0.1:8000/staffapi/labreport', formData, {headers: {\"Content-type\": \"multipart/form-date\"}})\n // .then(response => {\n // for (var key in response.data) {\n // if (response.data.hasOwnProperty(key)) {\n // console.log(key + \" -> \" + response.data[key]);\n // dispatch(addOrder({\n // id: parseInt(key),\n // name: response.data[key].name,\n // result: response.data[key].result,\n // unit: response.data[key].unit,\n // refRange: response.data[key].refRnage,\n // product: null,\n // amount: 0,\n // totalPrice: 0,\n // }));\n // // dispatch(addNotification(\"Order added\", `Order ${formState.name.value} added by you`));\n // dispatch(clearSelectedProduct());\n // // dispatch(changeProductAmount(selectedProduct.id, formState.amount.value));\n // }\n // }\n // });\n dispatch(addNotification(\"Sent\", \"Prescription sent to nearest Lab\"));\n }\n };\n\n return React.createElement(Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 135\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card shadow mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 136\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card-header py-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 137\n },\n __self: this\n }, React.createElement(\"h6\", {\n className: \"m-0 font-weight-bold text-green\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 138\n },\n __self: this\n }, \"Upload\")), React.createElement(\"div\", {\n className: \"card-body\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 140\n },\n __self: this\n }, React.createElement(\"form\", {\n onSubmit: saveOrder,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 141\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 142\n },\n __self: this\n }, React.createElement(\"input\", {\n type: \"file\",\n onChange: e => handleFileSelect(e.target.files),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 143\n },\n __self: this\n }), React.createElement(\"button\", {\n onClick: Send,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 144\n },\n __self: this\n }, \"Send\"))))));\n};\n\nexport default OrderForm;","map":{"version":3,"sources":["D:/FYP/Update/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Prescription/OrderForm.tsx"],"names":["React","useState","Fragment","useDispatch","useSelector","addNotification","OrderForm","dispatch","selectedProduct","state","products","orders","selectedFile","setSelectedFile","initialFormState","name","error","value","result","unit","refRange","product","amount","totalPrice","formState","setFormState","hasAmountChanged","model","price","hasFormValueChanged","field","resetForm","saveOrder","e","preventDefault","isFormInvalid","saveForm","alert","getDisabledClass","isError","handleFileSelect","selectorFiles","console","log","Send","formData","FormData","target","files"],"mappings":";;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAAqCC,QAArC,QAA+D,OAA/D;AAKA,SAASC,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AAEA,SAASC,eAAT,QAAgC,0CAA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S,EAAC,WAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAM,IAAA,QAAQ,EAAE2B,SAAhB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAK,IAAA,SAAS,EAAC,UAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAO,IAAA,IAAI,EAAC,MAAZ;AAAmB,IAAA,QAAQ,EAAGC,CAAD,IAAOO,gBAAgB,CAACP,CAAC,CAACc,MAAF,CAASC,KAAV,CAApD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADJ,EAEI;AAAQ,IAAA,OAAO,EAAEJ,IAAjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAFJ,CADJ,CADJ,CAJJ,CADJ,CADJ;AAgDH,CAxKD;;AA0KA,eAAetC,SAAf","sourcesContent":["import React, { useState, FormEvent, Fragment, Dispatch } from \"react\";\nimport { IProduct } from \"../../store/models/product.interface\";\nimport TextInput from \"../../common/components/TextInput\";\nimport NumberInput from \"../../common/components/NumberInput\";\nimport { OnChangeModel, IOrderFormState } from \"../../common/types/Form.types\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { addOrder } from \"../../store/actions/orders.actions\";\nimport { addNotification } from \"../../store/actions/notifications.action\";\nimport { clearSelectedProduct, changeProductAmount } from \"../../store/actions/products.action\";\nimport { IOrder } from \"../../store/models/order.interface\";\nimport { IStateType } from \"../../store/models/root.interface\";\nimport axios from 'axios'\n\nconst OrderForm: React.FC = () => {\n const dispatch: Dispatch<any> = useDispatch();\n const selectedProduct: IProduct | null = useSelector((state: IStateType) => state.products.selectedProduct);\n const orders: IOrder[] = useSelector((state: IStateType) => state.orders.orders);\n const [selectedFile, setSelectedFile] = useState(\"\");\n\n const initialFormState: IOrderFormState = {\n name: { error: \"\", value: \"\" },\n result: { error: \"\", value: 0 },\n unit: { error: \"\", value: \"\" },\n refRange: { error: \"\", value: \"\" },\n product: { error: \"\", value: null },\n amount: { error: \"\", value: 0 },\n totalPrice: { error: \"\", value: 0 },\n };\n\n const [formState, setFormState] = useState(initialFormState);\n\n function hasAmountChanged(model: OnChangeModel): void {\n let totalPrice: number = formState.totalPrice.value;\n if (selectedProduct) {\n totalPrice = selectedProduct.price * (model.value as number);\n }\n\n setFormState({\n ...formState,\n amount: { error: model.error, value: model.value as number },\n totalPrice: { error: model.error, value: totalPrice }\n });\n\n }\n\n function hasFormValueChanged(model: OnChangeModel): void {\n setFormState({ ...formState, [model.field]: { error: model.error, value: model.value } });\n }\n\n function resetForm(): void {\n setFormState(initialFormState);\n }\n\n function saveOrder(e: FormEvent<HTMLFormElement>): void {\n e.preventDefault();\n if (isFormInvalid()) {\n return;\n }\n\n saveForm(formState);\n }\n\n function saveForm(formState: IOrderFormState): void {\n if (selectedProduct) {\n if (selectedProduct.amount < formState.amount.value) {\n alert(\"Not enough products in warehouse\");\n return;\n }\n\n formState.product.value = selectedProduct;\n // dispatch(addOrder({\n // id: 0,\n // name: formState.name.value,\n // amount: formState.amount.value,\n // totalPrice: formState.totalPrice.value,\n // product: formState.product.value as IProduct\n // }));\n\n // dispatch(addNotification(\"Order added\", `Order ${formState.name.value} added by you`));\n // dispatch(clearSelectedProduct());\n // dispatch(changeProductAmount(selectedProduct.id, formState.amount.value));\n resetForm();\n }\n }\n\n function isFormInvalid(): boolean {\n return (formState.amount.error || formState.totalPrice.error\n || formState.name.error || formState.product.error || !formState.name.value\n || !selectedProduct) as boolean;\n }\n\n function getDisabledClass(): string {\n let isError: boolean = isFormInvalid();\n return isError ? \"disabled\" : \"\";\n }\n\n const handleFileSelect = (selectorFiles:any) => {\n console.log(selectorFiles[0])\n setSelectedFile(selectorFiles[0])\n }\n\n const Send = () => {\n const formData = new FormData();\n if(selectedFile != \"\")\n {\n // formData.append(\"file\", selectedFile);\n // axios.post('http://127.0.0.1:8000/staffapi/labreport', formData, {headers: {\"Content-type\": \"multipart/form-date\"}})\n // .then(response => {\n // for (var key in response.data) {\n // if (response.data.hasOwnProperty(key)) {\n // console.log(key + \" -> \" + response.data[key]);\n // dispatch(addOrder({\n // id: parseInt(key),\n // name: response.data[key].name,\n // result: response.data[key].result,\n // unit: response.data[key].unit,\n // refRange: response.data[key].refRnage,\n // product: null,\n // amount: 0,\n // totalPrice: 0,\n // }));\n \n // // dispatch(addNotification(\"Order added\", `Order ${formState.name.value} added by you`));\n // dispatch(clearSelectedProduct());\n // // dispatch(changeProductAmount(selectedProduct.id, formState.amount.value));\n // }\n // }\n // });\n dispatch(addNotification(\"Sent\", `Prescription sent to nearest Lab`));\n }\n \n }\n\n return (\n <Fragment>\n <div className=\"card shadow mb-4\">\n <div className=\"card-header py-3\">\n <h6 className=\"m-0 font-weight-bold text-green\">Upload</h6>\n </div>\n <div className=\"card-body\">\n <form onSubmit={saveOrder}>\n <div className=\"form-row\">\n <input type=\"file\" onChange={(e) => handleFileSelect(e.target.files)}/>\n <button onClick={Send}>Send</button>\n {/* <div className=\"form-group col-md-12\">\n <TextInput id=\"input_name\"\n value={formState.name.value}\n field=\"name\"\n onChange={hasFormValueChanged}\n required={true}\n maxLength={20}\n label=\"Name\"\n placeholder=\"Name\" />\n </div>\n <div className=\"form-group col-md-6\">\n <NumberInput id=\"input_amount\"\n value={formState.amount.value}\n field=\"amount\"\n onChange={hasAmountChanged}\n max={1000}\n min={0}\n label=\"Amount\" />\n </div>\n\n <div className=\"form-group col-md-6\">\n <NumberInput id=\"input_totalPrice\"\n value={formState.totalPrice.value}\n field=\"totalPrice\"\n onChange={hasFormValueChanged}\n max={1000}\n min={0}\n label=\"Price\" />\n </div> */}\n </div>\n {/* <button className=\"btn btn-danger\" onClick={() => resetForm()}>Reset</button> */}\n {/* <button type=\"submit\" className={`btn btn-success left-margin ${getDisabledClass()}`}>Create</button> */}\n </form>\n </div>\n </div>\n </Fragment>\n );\n};\n\nexport default OrderForm;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n'use strict';\n\nvar stringifyPrimitive = function (v) {\n switch (typeof v) {\n case 'string':\n return v;\n\n case 'boolean':\n return v ? 'true' : 'false';\n\n case 'number':\n return isFinite(v) ? v : '';\n\n default:\n return '';\n }\n};\n\nmodule.exports = function (obj, sep, eq, name) {\n sep = sep || '&';\n eq = eq || '=';\n\n if (obj === null) {\n obj = undefined;\n }\n\n if (typeof obj === 'object') {\n return map(objectKeys(obj), function (k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n\n if (isArray(obj[k])) {\n return map(obj[k], function (v) {\n return ks + encodeURIComponent(stringifyPrimitive(v));\n }).join(sep);\n } else {\n return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n }\n }).join(sep);\n }\n\n if (!name) return '';\n return encodeURIComponent(stringifyPrimitive(name)) + eq + encodeURIComponent(stringifyPrimitive(obj));\n};\n\nvar isArray = Array.isArray || function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};\n\nfunction map(xs, f) {\n if (xs.map) return xs.map(f);\n var res = [];\n\n for (var i = 0; i < xs.length; i++) {\n res.push(f(xs[i], i));\n }\n\n return res;\n}\n\nvar objectKeys = Object.keys || function (obj) {\n var res = [];\n\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);\n }\n\n return res;\n};","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"export default function symbolObservablePonyfill(root) {\n var result;\n var Symbol = root.Symbol;\n\n if (typeof Symbol === 'function') {\n if (Symbol.observable) {\n result = Symbol.observable;\n } else {\n result = Symbol('observable');\n Symbol.observable = result;\n }\n } else {\n result = '@@observable';\n }\n\n return result;\n}\n;","map":null,"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/App.tsx\";\nimport React from \"react\";\nimport \"./App.css\";\nimport \"./styles/sb-admin-2.min.css\";\nimport { BrowserRouter as Router, Switch, Route } from \"react-router-dom\";\nimport Login from \"./components/Account/Login\";\nimport SignUp from \"./components/Account/Signup\";\nimport Admin from \"./components/Admin/Admin\";\n\nconst App = () => {\n return React.createElement(\"div\", {\n className: \"App\",\n id: \"wrapper\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 13\n },\n __self: this\n }, React.createElement(Router, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 14\n },\n __self: this\n }, React.createElement(Switch, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 15\n },\n __self: this\n }, React.createElement(Route, {\n path: \"/\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 19\n },\n __self: this\n }, React.createElement(Admin, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 19\n },\n __self: this\n })), React.createElement(Route, {\n path: \"/Login\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 20\n },\n __self: this\n }, React.createElement(Login, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 20\n },\n __self: this\n })), React.createElement(Route, {\n path: \"/SignUp\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 21\n },\n __self: this\n }, React.createElement(SignUp, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 21\n },\n __self: this\n })))));\n};\n\nexport default App;","map":{"version":3,"sources":["/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/App.tsx"],"names":["React","BrowserRouter","Router","Switch","Route","Login","SignUp","Admin","App"],"mappings":";AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAO,WAAP;AACA,OAAO,6BAAP;AACA,SAASC,aAAa,IAAIC,MAA1B,EAAkCC,MAAlC,EAA0CC,KAA1C,QAAwD,kBAAxD;AACA,OAAOC,KAAP,MAAkB,4BAAlB;AACA,OAAOC,MAAP,MAAmB,6BAAnB;AACA,OAAOC,KAAP,MAAkB,0BAAlB;;AAIA,MAAMC,GAAa,GAAG,MAAM;AAC1B,SACE;AAAK,IAAA,SAAS,EAAC,KAAf;AAAqB,IAAA,EAAE,EAAC,SAAxB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACE,oBAAC,MAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACE,oBAAC,MAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAIE,oBAAC,KAAD;AAAO,IAAA,IAAI,EAAC,GAAZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAgB,oBAAC,KAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAhB,CAJF,EAKE,oBAAC,KAAD;AAAO,IAAA,IAAI,EAAC,QAAZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAqB,oBAAC,KAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAArB,CALF,EAME,oBAAC,KAAD;AAAO,IAAA,IAAI,EAAC,SAAZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAsB,oBAAC,MAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAtB,CANF,CADF,CADF,CADF;AAgBD,CAjBD;;AAmBA,eAAeA,GAAf","sourcesContent":["import React from \"react\";\nimport \"./App.css\";\nimport \"./styles/sb-admin-2.min.css\";\nimport { BrowserRouter as Router, Switch, Route, } from \"react-router-dom\";\nimport Login from \"./components/Account/Login\";\nimport SignUp from \"./components/Account/Signup\";\nimport Admin from \"./components/Admin/Admin\";\nimport { PrivateRoute } from \"./common/components/PrivateRoute\";\nimport { AccountRoute } from \"./common/components/AccountRoute\";\n\nconst App: React.FC = () => {\n return (\n <div className=\"App\" id=\"wrapper\">\n <Router>\n <Switch>\n {/* <PrivateRoute path=\"/\">\n <Admin />\n </PrivateRoute> */}\n <Route path=\"/\"><Admin /></Route>\n <Route path=\"/Login\"><Login /></Route>\n <Route path=\"/SignUp\"><SignUp /></Route>\n {/* <AccountRoute path=\"/login\"><Login /></AccountRoute>\n <AccountRoute path=\"/signup\"><SignUp /></AccountRoute> */}\n </Switch>\n </Router>\n </div>\n );\n};\n\nexport default App;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"/* global window */\nimport ponyfill from './ponyfill.js';\nvar root;\n\nif (typeof self !== 'undefined') {\n root = self;\n} else if (typeof window !== 'undefined') {\n root = window;\n} else if (typeof global !== 'undefined') {\n root = global;\n} else if (typeof module !== 'undefined') {\n root = module;\n} else {\n root = Function('return this')();\n}\n\nvar result = ponyfill(root);\nexport default result;","map":null,"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n'use strict';\n\nvar punycode = require('punycode');\n\nvar util = require('./util');\n\nexports.parse = urlParse;\nexports.resolve = urlResolve;\nexports.resolveObject = urlResolveObject;\nexports.format = urlFormat;\nexports.Url = Url;\n\nfunction Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.host = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.query = null;\n this.pathname = null;\n this.path = null;\n this.href = null;\n} // Reference: RFC 3986, RFC 1808, RFC 2396\n// define these here so at least they only have to be\n// compiled once on the first module load.\n\n\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n portPattern = /:[0-9]*$/,\n // Special case for a simple path URL\nsimplePathPattern = /^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,\n // RFC 2396: characters reserved for delimiting URLs.\n// We actually just auto-escape these.\ndelims = ['<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t'],\n // RFC 2396: characters not allowed for various reasons.\nunwise = ['{', '}', '|', '\\\\', '^', '`'].concat(delims),\n // Allowed by RFCs, but cause of XSS attacks. Always escape these.\nautoEscape = ['\\''].concat(unwise),\n // Characters that are never ever allowed in a hostname.\n// Note that any invalid chars are also handled, but these\n// are the ones that are *expected* to be seen, so we fast-path\n// them.\nnonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),\n hostEndingChars = ['/', '?', '#'],\n hostnameMaxLen = 255,\n hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,\n hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,\n // protocols that can allow \"unsafe\" and \"unwise\" chars.\nunsafeProtocol = {\n 'javascript': true,\n 'javascript:': true\n},\n // protocols that never have a hostname.\nhostlessProtocol = {\n 'javascript': true,\n 'javascript:': true\n},\n // protocols that always contain a // bit.\nslashedProtocol = {\n 'http': true,\n 'https': true,\n 'ftp': true,\n 'gopher': true,\n 'file': true,\n 'http:': true,\n 'https:': true,\n 'ftp:': true,\n 'gopher:': true,\n 'file:': true\n},\n querystring = require('querystring');\n\nfunction urlParse(url, parseQueryString, slashesDenoteHost) {\n if (url && util.isObject(url) && url instanceof Url) return url;\n var u = new Url();\n u.parse(url, parseQueryString, slashesDenoteHost);\n return u;\n}\n\nUrl.prototype.parse = function (url, parseQueryString, slashesDenoteHost) {\n if (!util.isString(url)) {\n throw new TypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n } // Copy chrome, IE, opera backslash-handling behavior.\n // Back slashes before the query string get converted to forward slashes\n // See: https://code.google.com/p/chromium/issues/detail?id=25916\n\n\n var queryIndex = url.indexOf('?'),\n splitter = queryIndex !== -1 && queryIndex < url.indexOf('#') ? '?' : '#',\n uSplit = url.split(splitter),\n slashRegex = /\\\\/g;\n uSplit[0] = uSplit[0].replace(slashRegex, '/');\n url = uSplit.join(splitter);\n var rest = url; // trim before proceeding.\n // This is to support parse stuff like \" http://foo.com \\n\"\n\n rest = rest.trim();\n\n if (!slashesDenoteHost && url.split('#').length === 1) {\n // Try fast path regexp\n var simplePath = simplePathPattern.exec(rest);\n\n if (simplePath) {\n this.path = rest;\n this.href = rest;\n this.pathname = simplePath[1];\n\n if (simplePath[2]) {\n this.search = simplePath[2];\n\n if (parseQueryString) {\n this.query = querystring.parse(this.search.substr(1));\n } else {\n this.query = this.search.substr(1);\n }\n } else if (parseQueryString) {\n this.search = '';\n this.query = {};\n }\n\n return this;\n }\n }\n\n var proto = protocolPattern.exec(rest);\n\n if (proto) {\n proto = proto[0];\n var lowerProto = proto.toLowerCase();\n this.protocol = lowerProto;\n rest = rest.substr(proto.length);\n } // figure out if it's got a host\n // user@server is *always* interpreted as a hostname, and url\n // resolution will treat //foo/bar as host=foo,path=bar because that's\n // how the browser resolves relative URLs.\n\n\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n var slashes = rest.substr(0, 2) === '//';\n\n if (slashes && !(proto && hostlessProtocol[proto])) {\n rest = rest.substr(2);\n this.slashes = true;\n }\n }\n\n if (!hostlessProtocol[proto] && (slashes || proto && !slashedProtocol[proto])) {\n // there's a hostname.\n // the first instance of /, ?, ;, or # ends the host.\n //\n // If there is an @ in the hostname, then non-host chars *are* allowed\n // to the left of the last @ sign, unless some host-ending character\n // comes *before* the @-sign.\n // URLs are obnoxious.\n //\n // ex:\n // http://a@b@c/ => user:a@b host:c\n // http://a@b?@c => user:a host:c path:/?@c\n // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n // Review our test case against browsers more comprehensively.\n // find the first instance of any hostEndingChars\n var hostEnd = -1;\n\n for (var i = 0; i < hostEndingChars.length; i++) {\n var hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec;\n } // at this point, either we have an explicit point where the\n // auth portion cannot go past, or the last @ char is the decider.\n\n\n var auth, atSign;\n\n if (hostEnd === -1) {\n // atSign can be anywhere.\n atSign = rest.lastIndexOf('@');\n } else {\n // atSign must be in auth portion.\n // http://a@b/c@d => host:b auth:a path:/c@d\n atSign = rest.lastIndexOf('@', hostEnd);\n } // Now we have a portion which is definitely the auth.\n // Pull that off.\n\n\n if (atSign !== -1) {\n auth = rest.slice(0, atSign);\n rest = rest.slice(atSign + 1);\n this.auth = decodeURIComponent(auth);\n } // the host is the remaining to the left of the first non-host char\n\n\n hostEnd = -1;\n\n for (var i = 0; i < nonHostChars.length; i++) {\n var hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec;\n } // if we still have not hit it, then the entire thing is a host.\n\n\n if (hostEnd === -1) hostEnd = rest.length;\n this.host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd); // pull out port.\n\n this.parseHost(); // we've indicated that there is a hostname,\n // so even if it's empty, it has to be present.\n\n this.hostname = this.hostname || ''; // if hostname begins with [ and ends with ]\n // assume that it's an IPv6 address.\n\n var ipv6Hostname = this.hostname[0] === '[' && this.hostname[this.hostname.length - 1] === ']'; // validate a little.\n\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n\n for (var i = 0, l = hostparts.length; i < l; i++) {\n var part = hostparts[i];\n if (!part) continue;\n\n if (!part.match(hostnamePartPattern)) {\n var newpart = '';\n\n for (var j = 0, k = part.length; j < k; j++) {\n if (part.charCodeAt(j) > 127) {\n // we replace non-ASCII char with a temporary placeholder\n // we need this to make sure size of hostname is not\n // broken by replacing non-ASCII by nothing\n newpart += 'x';\n } else {\n newpart += part[j];\n }\n } // we test again with ASCII char only\n\n\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i);\n var notHost = hostparts.slice(i + 1);\n var bit = part.match(hostnamePartStart);\n\n if (bit) {\n validParts.push(bit[1]);\n notHost.unshift(bit[2]);\n }\n\n if (notHost.length) {\n rest = '/' + notHost.join('.') + rest;\n }\n\n this.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (this.hostname.length > hostnameMaxLen) {\n this.hostname = '';\n } else {\n // hostnames are always lower case.\n this.hostname = this.hostname.toLowerCase();\n }\n\n if (!ipv6Hostname) {\n // IDNA Support: Returns a punycoded representation of \"domain\".\n // It only converts parts of the domain name that\n // have non-ASCII characters, i.e. it doesn't matter if\n // you call it with a domain that already is ASCII-only.\n this.hostname = punycode.toASCII(this.hostname);\n }\n\n var p = this.port ? ':' + this.port : '';\n var h = this.hostname || '';\n this.host = h + p;\n this.href += this.host; // strip [ and ] from the hostname\n // the host field still retains them, though\n\n if (ipv6Hostname) {\n this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n\n if (rest[0] !== '/') {\n rest = '/' + rest;\n }\n }\n } // now rest is set to the post-host stuff.\n // chop off any delim chars.\n\n\n if (!unsafeProtocol[lowerProto]) {\n // First, make 100% sure that any \"autoEscape\" chars get\n // escaped, even if encodeURIComponent doesn't think they\n // need to be.\n for (var i = 0, l = autoEscape.length; i < l; i++) {\n var ae = autoEscape[i];\n if (rest.indexOf(ae) === -1) continue;\n var esc = encodeURIComponent(ae);\n\n if (esc === ae) {\n esc = escape(ae);\n }\n\n rest = rest.split(ae).join(esc);\n }\n } // chop off from the tail first.\n\n\n var hash = rest.indexOf('#');\n\n if (hash !== -1) {\n // got a fragment string.\n this.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n\n var qm = rest.indexOf('?');\n\n if (qm !== -1) {\n this.search = rest.substr(qm);\n this.query = rest.substr(qm + 1);\n\n if (parseQueryString) {\n this.query = querystring.parse(this.query);\n }\n\n rest = rest.slice(0, qm);\n } else if (parseQueryString) {\n // no query string, but parseQueryString still requested\n this.search = '';\n this.query = {};\n }\n\n if (rest) this.pathname = rest;\n\n if (slashedProtocol[lowerProto] && this.hostname && !this.pathname) {\n this.pathname = '/';\n } //to support http.request\n\n\n if (this.pathname || this.search) {\n var p = this.pathname || '';\n var s = this.search || '';\n this.path = p + s;\n } // finally, reconstruct the href based on what has been validated.\n\n\n this.href = this.format();\n return this;\n}; // format a parsed object into a url string\n\n\nfunction urlFormat(obj) {\n // ensure it's an object, and not a string url.\n // If it's an obj, this is a no-op.\n // this way, you can call url_format() on strings\n // to clean up potentially wonky urls.\n if (util.isString(obj)) obj = urlParse(obj);\n if (!(obj instanceof Url)) return Url.prototype.format.call(obj);\n return obj.format();\n}\n\nUrl.prototype.format = function () {\n var auth = this.auth || '';\n\n if (auth) {\n auth = encodeURIComponent(auth);\n auth = auth.replace(/%3A/i, ':');\n auth += '@';\n }\n\n var protocol = this.protocol || '',\n pathname = this.pathname || '',\n hash = this.hash || '',\n host = false,\n query = '';\n\n if (this.host) {\n host = auth + this.host;\n } else if (this.hostname) {\n host = auth + (this.hostname.indexOf(':') === -1 ? this.hostname : '[' + this.hostname + ']');\n\n if (this.port) {\n host += ':' + this.port;\n }\n }\n\n if (this.query && util.isObject(this.query) && Object.keys(this.query).length) {\n query = querystring.stringify(this.query);\n }\n\n var search = this.search || query && '?' + query || '';\n if (protocol && protocol.substr(-1) !== ':') protocol += ':'; // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.\n // unless they had them to begin with.\n\n if (this.slashes || (!protocol || slashedProtocol[protocol]) && host !== false) {\n host = '//' + (host || '');\n if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;\n } else if (!host) {\n host = '';\n }\n\n if (hash && hash.charAt(0) !== '#') hash = '#' + hash;\n if (search && search.charAt(0) !== '?') search = '?' + search;\n pathname = pathname.replace(/[?#]/g, function (match) {\n return encodeURIComponent(match);\n });\n search = search.replace('#', '%23');\n return protocol + host + pathname + search + hash;\n};\n\nfunction urlResolve(source, relative) {\n return urlParse(source, false, true).resolve(relative);\n}\n\nUrl.prototype.resolve = function (relative) {\n return this.resolveObject(urlParse(relative, false, true)).format();\n};\n\nfunction urlResolveObject(source, relative) {\n if (!source) return relative;\n return urlParse(source, false, true).resolveObject(relative);\n}\n\nUrl.prototype.resolveObject = function (relative) {\n if (util.isString(relative)) {\n var rel = new Url();\n rel.parse(relative, false, true);\n relative = rel;\n }\n\n var result = new Url();\n var tkeys = Object.keys(this);\n\n for (var tk = 0; tk < tkeys.length; tk++) {\n var tkey = tkeys[tk];\n result[tkey] = this[tkey];\n } // hash is always overridden, no matter what.\n // even href=\"\" will remove it.\n\n\n result.hash = relative.hash; // if the relative url is empty, then there's nothing left to do here.\n\n if (relative.href === '') {\n result.href = result.format();\n return result;\n } // hrefs like //foo/bar always cut to the protocol.\n\n\n if (relative.slashes && !relative.protocol) {\n // take everything except the protocol from relative\n var rkeys = Object.keys(relative);\n\n for (var rk = 0; rk < rkeys.length; rk++) {\n var rkey = rkeys[rk];\n if (rkey !== 'protocol') result[rkey] = relative[rkey];\n } //urlParse appends trailing / to urls like http://www.example.com\n\n\n if (slashedProtocol[result.protocol] && result.hostname && !result.pathname) {\n result.path = result.pathname = '/';\n }\n\n result.href = result.format();\n return result;\n }\n\n if (relative.protocol && relative.protocol !== result.protocol) {\n // if it's a known url protocol, then changing\n // the protocol does weird things\n // first, if it's not file:, then we MUST have a host,\n // and if there was a path\n // to begin with, then we MUST have a path.\n // if it is file:, then the host is dropped,\n // because that's known to be hostless.\n // anything else is assumed to be absolute.\n if (!slashedProtocol[relative.protocol]) {\n var keys = Object.keys(relative);\n\n for (var v = 0; v < keys.length; v++) {\n var k = keys[v];\n result[k] = relative[k];\n }\n\n result.href = result.format();\n return result;\n }\n\n result.protocol = relative.protocol;\n\n if (!relative.host && !hostlessProtocol[relative.protocol]) {\n var relPath = (relative.pathname || '').split('/');\n\n while (relPath.length && !(relative.host = relPath.shift()));\n\n if (!relative.host) relative.host = '';\n if (!relative.hostname) relative.hostname = '';\n if (relPath[0] !== '') relPath.unshift('');\n if (relPath.length < 2) relPath.unshift('');\n result.pathname = relPath.join('/');\n } else {\n result.pathname = relative.pathname;\n }\n\n result.search = relative.search;\n result.query = relative.query;\n result.host = relative.host || '';\n result.auth = relative.auth;\n result.hostname = relative.hostname || relative.host;\n result.port = relative.port; // to support http.request\n\n if (result.pathname || result.search) {\n var p = result.pathname || '';\n var s = result.search || '';\n result.path = p + s;\n }\n\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n }\n\n var isSourceAbs = result.pathname && result.pathname.charAt(0) === '/',\n isRelAbs = relative.host || relative.pathname && relative.pathname.charAt(0) === '/',\n mustEndAbs = isRelAbs || isSourceAbs || result.host && relative.pathname,\n removeAllDots = mustEndAbs,\n srcPath = result.pathname && result.pathname.split('/') || [],\n relPath = relative.pathname && relative.pathname.split('/') || [],\n psychotic = result.protocol && !slashedProtocol[result.protocol]; // if the url is a non-slashed url, then relative\n // links like ../.. should be able\n // to crawl up to the hostname, as well. This is strange.\n // result.protocol has already been set by now.\n // Later on, put the first path part into the host field.\n\n if (psychotic) {\n result.hostname = '';\n result.port = null;\n\n if (result.host) {\n if (srcPath[0] === '') srcPath[0] = result.host;else srcPath.unshift(result.host);\n }\n\n result.host = '';\n\n if (relative.protocol) {\n relative.hostname = null;\n relative.port = null;\n\n if (relative.host) {\n if (relPath[0] === '') relPath[0] = relative.host;else relPath.unshift(relative.host);\n }\n\n relative.host = null;\n }\n\n mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');\n }\n\n if (isRelAbs) {\n // it's absolute.\n result.host = relative.host || relative.host === '' ? relative.host : result.host;\n result.hostname = relative.hostname || relative.hostname === '' ? relative.hostname : result.hostname;\n result.search = relative.search;\n result.query = relative.query;\n srcPath = relPath; // fall through to the dot-handling below.\n } else if (relPath.length) {\n // it's relative\n // throw away the existing file, and take the new path instead.\n if (!srcPath) srcPath = [];\n srcPath.pop();\n srcPath = srcPath.concat(relPath);\n result.search = relative.search;\n result.query = relative.query;\n } else if (!util.isNullOrUndefined(relative.search)) {\n // just pull out the search.\n // like href='?foo'.\n // Put this after the other two cases because it simplifies the booleans\n if (psychotic) {\n result.hostname = result.host = srcPath.shift(); //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n\n var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;\n\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n\n result.search = relative.search;\n result.query = relative.query; //to support http.request\n\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');\n }\n\n result.href = result.format();\n return result;\n }\n\n if (!srcPath.length) {\n // no path at all. easy.\n // we've already handled the other stuff above.\n result.pathname = null; //to support http.request\n\n if (result.search) {\n result.path = '/' + result.search;\n } else {\n result.path = null;\n }\n\n result.href = result.format();\n return result;\n } // if a url ENDs in . or .., then it must get a trailing slash.\n // however, if it ends in anything else non-slashy,\n // then it must NOT get a trailing slash.\n\n\n var last = srcPath.slice(-1)[0];\n var hasTrailingSlash = (result.host || relative.host || srcPath.length > 1) && (last === '.' || last === '..') || last === ''; // strip single dots, resolve double dots to parent dir\n // if the path tries to go above the root, `up` ends up > 0\n\n var up = 0;\n\n for (var i = srcPath.length; i >= 0; i--) {\n last = srcPath[i];\n\n if (last === '.') {\n srcPath.splice(i, 1);\n } else if (last === '..') {\n srcPath.splice(i, 1);\n up++;\n } else if (up) {\n srcPath.splice(i, 1);\n up--;\n }\n } // if the path is allowed to go above the root, restore leading ..s\n\n\n if (!mustEndAbs && !removeAllDots) {\n for (; up--; up) {\n srcPath.unshift('..');\n }\n }\n\n if (mustEndAbs && srcPath[0] !== '' && (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {\n srcPath.unshift('');\n }\n\n if (hasTrailingSlash && srcPath.join('/').substr(-1) !== '/') {\n srcPath.push('');\n }\n\n var isAbsolute = srcPath[0] === '' || srcPath[0] && srcPath[0].charAt(0) === '/'; // put the host back\n\n if (psychotic) {\n result.hostname = result.host = isAbsolute ? '' : srcPath.length ? srcPath.shift() : ''; //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n\n var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;\n\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n\n mustEndAbs = mustEndAbs || result.host && srcPath.length;\n\n if (mustEndAbs && !isAbsolute) {\n srcPath.unshift('');\n }\n\n if (!srcPath.length) {\n result.pathname = null;\n result.path = null;\n } else {\n result.pathname = srcPath.join('/');\n } //to support request.http\n\n\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');\n }\n\n result.auth = relative.auth || result.auth;\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n};\n\nUrl.prototype.parseHost = function () {\n var host = this.host;\n var port = portPattern.exec(host);\n\n if (port) {\n port = port[0];\n\n if (port !== ':') {\n this.port = port.substr(1);\n }\n\n host = host.substr(0, host.length - port.length);\n }\n\n if (host) this.hostname = host;\n};","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"'use strict';\n\nif (global.crypto && global.crypto.getRandomValues) {\n module.exports.randomBytes = function (length) {\n var bytes = new Uint8Array(length);\n global.crypto.getRandomValues(bytes);\n return bytes;\n };\n} else {\n module.exports.randomBytes = function (length) {\n var bytes = new Array(length);\n\n for (var i = 0; i < length; i++) {\n bytes[i] = Math.floor(Math.random() * 256);\n }\n\n return bytes;\n };\n}","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"// shim for using process in browser\nvar process = module.exports = {}; // cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\n\nfunction defaultClearTimeout() {\n throw new Error('clearTimeout has not been defined');\n}\n\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n})();\n\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n } // if setTimeout wasn't available but was latter defined\n\n\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch (e) {\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch (e) {\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n}\n\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n } // if clearTimeout wasn't available but was latter defined\n\n\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e) {\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e) {\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n}\n\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n\n draining = false;\n\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n var len = queue.length;\n\n while (len) {\n currentQueue = queue;\n queue = [];\n\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n\n queueIndex = -1;\n len = queue.length;\n }\n\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n\n queue.push(new Item(fun, args));\n\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n}; // v8 likes predictible objects\n\n\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\n\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\n\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\n\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) {\n return [];\n};\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () {\n return '/';\n};\n\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\n\nprocess.umask = function () {\n return 0;\n};","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"import React, { Component } from 'react';\nimport _inheritsLoose from '@babel/runtime/helpers/inheritsLoose';\nimport PropTypes from 'prop-types';\nimport gud from 'gud';\nimport warning from 'tiny-warning';\nvar MAX_SIGNED_31_BIT_INT = 1073741823;\n\nfunction objectIs(x, y) {\n if (x === y) {\n return x !== 0 || 1 / x === 1 / y;\n } else {\n return x !== x && y !== y;\n }\n}\n\nfunction createEventEmitter(value) {\n var handlers = [];\n return {\n on: function on(handler) {\n handlers.push(handler);\n },\n off: function off(handler) {\n handlers = handlers.filter(function (h) {\n return h !== handler;\n });\n },\n get: function get() {\n return value;\n },\n set: function set(newValue, changedBits) {\n value = newValue;\n handlers.forEach(function (handler) {\n return handler(value, changedBits);\n });\n }\n };\n}\n\nfunction onlyChild(children) {\n return Array.isArray(children) ? children[0] : children;\n}\n\nfunction createReactContext(defaultValue, calculateChangedBits) {\n var _Provider$childContex, _Consumer$contextType;\n\n var contextProp = '__create-react-context-' + gud() + '__';\n\n var Provider =\n /*#__PURE__*/\n function (_Component) {\n _inheritsLoose(Provider, _Component);\n\n function Provider() {\n var _this;\n\n _this = _Component.apply(this, arguments) || this;\n _this.emitter = createEventEmitter(_this.props.value);\n return _this;\n }\n\n var _proto = Provider.prototype;\n\n _proto.getChildContext = function getChildContext() {\n var _ref;\n\n return _ref = {}, _ref[contextProp] = this.emitter, _ref;\n };\n\n _proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {\n if (this.props.value !== nextProps.value) {\n var oldValue = this.props.value;\n var newValue = nextProps.value;\n var changedBits;\n\n if (objectIs(oldValue, newValue)) {\n changedBits = 0;\n } else {\n changedBits = typeof calculateChangedBits === 'function' ? calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT;\n\n if (process.env.NODE_ENV !== 'production') {\n warning((changedBits & MAX_SIGNED_31_BIT_INT) === changedBits, 'calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: ' + changedBits);\n }\n\n changedBits |= 0;\n\n if (changedBits !== 0) {\n this.emitter.set(nextProps.value, changedBits);\n }\n }\n }\n };\n\n _proto.render = function render() {\n return this.props.children;\n };\n\n return Provider;\n }(Component);\n\n Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[contextProp] = PropTypes.object.isRequired, _Provider$childContex);\n\n var Consumer =\n /*#__PURE__*/\n function (_Component2) {\n _inheritsLoose(Consumer, _Component2);\n\n function Consumer() {\n var _this2;\n\n _this2 = _Component2.apply(this, arguments) || this;\n _this2.state = {\n value: _this2.getValue()\n };\n\n _this2.onUpdate = function (newValue, changedBits) {\n var observedBits = _this2.observedBits | 0;\n\n if ((observedBits & changedBits) !== 0) {\n _this2.setState({\n value: _this2.getValue()\n });\n }\n };\n\n return _this2;\n }\n\n var _proto2 = Consumer.prototype;\n\n _proto2.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {\n var observedBits = nextProps.observedBits;\n this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits;\n };\n\n _proto2.componentDidMount = function componentDidMount() {\n if (this.context[contextProp]) {\n this.context[contextProp].on(this.onUpdate);\n }\n\n var observedBits = this.props.observedBits;\n this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits;\n };\n\n _proto2.componentWillUnmount = function componentWillUnmount() {\n if (this.context[contextProp]) {\n this.context[contextProp].off(this.onUpdate);\n }\n };\n\n _proto2.getValue = function getValue() {\n if (this.context[contextProp]) {\n return this.context[contextProp].get();\n } else {\n return defaultValue;\n }\n };\n\n _proto2.render = function render() {\n return onlyChild(this.props.children)(this.state.value);\n };\n\n return Consumer;\n }(Component);\n\n Consumer.contextTypes = (_Consumer$contextType = {}, _Consumer$contextType[contextProp] = PropTypes.object, _Consumer$contextType);\n return {\n Provider: Provider,\n Consumer: Consumer\n };\n}\n\nvar index = React.createContext || createReactContext;\nexport default index;","map":null,"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var conversions = require('./conversions');\n\nvar route = require('./route');\n\nvar convert = {};\nvar models = Object.keys(conversions);\n\nfunction wrapRaw(fn) {\n var wrappedFn = function (args) {\n if (args === undefined || args === null) {\n return args;\n }\n\n if (arguments.length > 1) {\n args = Array.prototype.slice.call(arguments);\n }\n\n return fn(args);\n }; // preserve .conversion property if there is one\n\n\n if ('conversion' in fn) {\n wrappedFn.conversion = fn.conversion;\n }\n\n return wrappedFn;\n}\n\nfunction wrapRounded(fn) {\n var wrappedFn = function (args) {\n if (args === undefined || args === null) {\n return args;\n }\n\n if (arguments.length > 1) {\n args = Array.prototype.slice.call(arguments);\n }\n\n var result = fn(args); // we're assuming the result is an array here.\n // see notice in conversions.js; don't use box types\n // in conversion functions.\n\n if (typeof result === 'object') {\n for (var len = result.length, i = 0; i < len; i++) {\n result[i] = Math.round(result[i]);\n }\n }\n\n return result;\n }; // preserve .conversion property if there is one\n\n\n if ('conversion' in fn) {\n wrappedFn.conversion = fn.conversion;\n }\n\n return wrappedFn;\n}\n\nmodels.forEach(function (fromModel) {\n convert[fromModel] = {};\n Object.defineProperty(convert[fromModel], 'channels', {\n value: conversions[fromModel].channels\n });\n Object.defineProperty(convert[fromModel], 'labels', {\n value: conversions[fromModel].labels\n });\n var routes = route(fromModel);\n var routeModels = Object.keys(routes);\n routeModels.forEach(function (toModel) {\n var fn = routes[toModel];\n convert[fromModel][toModel] = wrapRounded(fn);\n convert[fromModel][toModel].raw = wrapRaw(fn);\n });\n});\nmodule.exports = convert;","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"'use strict';\n\nvar inherits = require('inherits'),\n EventEmitter = require('events').EventEmitter;\n\nvar debug = function () {};\n\nif (process.env.NODE_ENV !== 'production') {\n debug = require('debug')('sockjs-client:buffered-sender');\n}\n\nfunction BufferedSender(url, sender) {\n debug(url);\n EventEmitter.call(this);\n this.sendBuffer = [];\n this.sender = sender;\n this.url = url;\n}\n\ninherits(BufferedSender, EventEmitter);\n\nBufferedSender.prototype.send = function (message) {\n debug('send', message);\n this.sendBuffer.push(message);\n\n if (!this.sendStop) {\n this.sendSchedule();\n }\n}; // For polling transports in a situation when in the message callback,\n// new message is being send. If the sending connection was started\n// before receiving one, it is possible to saturate the network and\n// timeout due to the lack of receiving socket. To avoid that we delay\n// sending messages by some small time, in order to let receiving\n// connection be started beforehand. This is only a halfmeasure and\n// does not fix the big problem, but it does make the tests go more\n// stable on slow networks.\n\n\nBufferedSender.prototype.sendScheduleWait = function () {\n debug('sendScheduleWait');\n var self = this;\n var tref;\n\n this.sendStop = function () {\n debug('sendStop');\n self.sendStop = null;\n clearTimeout(tref);\n };\n\n tref = setTimeout(function () {\n debug('timeout');\n self.sendStop = null;\n self.sendSchedule();\n }, 25);\n};\n\nBufferedSender.prototype.sendSchedule = function () {\n debug('sendSchedule', this.sendBuffer.length);\n var self = this;\n\n if (this.sendBuffer.length > 0) {\n var payload = '[' + this.sendBuffer.join(',') + ']';\n this.sendStop = this.sender(this.url, payload, function (err) {\n self.sendStop = null;\n\n if (err) {\n debug('error', err);\n self.emit('close', err.code || 1006, 'Sending error: ' + err);\n self.close();\n } else {\n self.sendScheduleWait();\n }\n });\n this.sendBuffer = [];\n }\n};\n\nBufferedSender.prototype._cleanup = function () {\n debug('_cleanup');\n this.removeAllListeners();\n};\n\nBufferedSender.prototype.close = function () {\n debug('close');\n\n this._cleanup();\n\n if (this.sendStop) {\n this.sendStop();\n this.sendStop = null;\n }\n};\n\nmodule.exports = BufferedSender;","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"'use strict';\n\nvar inherits = require('inherits'),\n iframeUtils = require('../../utils/iframe'),\n urlUtils = require('../../utils/url'),\n EventEmitter = require('events').EventEmitter,\n random = require('../../utils/random');\n\nvar debug = function () {};\n\nif (process.env.NODE_ENV !== 'production') {\n debug = require('debug')('sockjs-client:receiver:htmlfile');\n}\n\nfunction HtmlfileReceiver(url) {\n debug(url);\n EventEmitter.call(this);\n var self = this;\n iframeUtils.polluteGlobalNamespace();\n this.id = 'a' + random.string(6);\n url = urlUtils.addQuery(url, 'c=' + decodeURIComponent(iframeUtils.WPrefix + '.' + this.id));\n debug('using htmlfile', HtmlfileReceiver.htmlfileEnabled);\n var constructFunc = HtmlfileReceiver.htmlfileEnabled ? iframeUtils.createHtmlfile : iframeUtils.createIframe;\n global[iframeUtils.WPrefix][this.id] = {\n start: function () {\n debug('start');\n self.iframeObj.loaded();\n },\n message: function (data) {\n debug('message', data);\n self.emit('message', data);\n },\n stop: function () {\n debug('stop');\n\n self._cleanup();\n\n self._close('network');\n }\n };\n this.iframeObj = constructFunc(url, function () {\n debug('callback');\n\n self._cleanup();\n\n self._close('permanent');\n });\n}\n\ninherits(HtmlfileReceiver, EventEmitter);\n\nHtmlfileReceiver.prototype.abort = function () {\n debug('abort');\n\n this._cleanup();\n\n this._close('user');\n};\n\nHtmlfileReceiver.prototype._cleanup = function () {\n debug('_cleanup');\n\n if (this.iframeObj) {\n this.iframeObj.cleanup();\n this.iframeObj = null;\n }\n\n delete global[iframeUtils.WPrefix][this.id];\n};\n\nHtmlfileReceiver.prototype._close = function (reason) {\n debug('_close', reason);\n this.emit('close', null, reason);\n this.removeAllListeners();\n};\n\nHtmlfileReceiver.htmlfileEnabled = false; // obfuscate to avoid firewalls\n\nvar axo = ['Active'].concat('Object').join('X');\n\nif (axo in global) {\n try {\n HtmlfileReceiver.htmlfileEnabled = !!new global[axo]('htmlfile');\n } catch (x) {// intentionally empty\n }\n}\n\nHtmlfileReceiver.enabled = HtmlfileReceiver.htmlfileEnabled || iframeUtils.iframeEnabled;\nmodule.exports = HtmlfileReceiver;","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"export let ProductModificationStatus;\n\n(function (ProductModificationStatus) {\n ProductModificationStatus[ProductModificationStatus[\"None\"] = 0] = \"None\";\n ProductModificationStatus[ProductModificationStatus[\"Create\"] = 1] = \"Create\";\n ProductModificationStatus[ProductModificationStatus[\"Edit\"] = 2] = \"Edit\";\n})(ProductModificationStatus || (ProductModificationStatus = {}));","map":{"version":3,"sources":["/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/store/models/product.interface.ts"],"names":["ProductModificationStatus"],"mappings":"AAaA,WAAYA,yBAAZ;;WAAYA,yB;AAAAA,EAAAA,yB,CAAAA,yB;AAAAA,EAAAA,yB,CAAAA,yB;AAAAA,EAAAA,yB,CAAAA,yB;GAAAA,yB,KAAAA,yB","sourcesContent":["export interface IProduct {\n id: number;\n name: string;\n qualification: number;\n experience: number;\n rating: number;\n place: string;\n profile: string\n hasExpiryDate: boolean;\n price: number;\n amount: number;\n}\n\nexport enum ProductModificationStatus {\n None = 0,\n Create = 1,\n Edit = 2\n}"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"import _slicedToArray from \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\node_modules\\\\babel-preset-react-app\\\\node_modules\\\\@babel\\\\runtime/helpers/esm/slicedToArray\";\nvar _jsxFileName = \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\src\\\\components\\\\LeftMenu\\\\LeftMenu.tsx\";\nimport React, { Fragment, useState } from \"react\";\nimport { Link } from \"react-router-dom\";\n\nconst LeftMenu = () => {\n let _useState = useState(false),\n _useState2 = _slicedToArray(_useState, 2),\n leftMenuVisibility = _useState2[0],\n setLeftMenuVisibility = _useState2[1];\n\n function changeLeftMenuVisibility() {\n setLeftMenuVisibility(!leftMenuVisibility);\n }\n\n function getCollapseClass() {\n return leftMenuVisibility ? \"\" : \"collapsed\";\n }\n\n return React.createElement(Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 17\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"toggle-area\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 18\n },\n __self: this\n }, React.createElement(\"button\", {\n className: \"btn btn-primary toggle-button\",\n onClick: () => changeLeftMenuVisibility(),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 19\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-bolt\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 20\n },\n __self: this\n }))), React.createElement(\"ul\", {\n className: \"navbar-nav bg-gradient-primary-green sidebar sidebar-dark accordion \".concat(getCollapseClass()),\n id: \"collapseMenu\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 24\n },\n __self: this\n }, React.createElement(\"a\", {\n className: \"sidebar-brand d-flex align-items-center justify-content-center\",\n href: \"index.html\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 27\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"sidebar-brand-icon icon-green rotate-n-15\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 28\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-bolt\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 29\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \" mx-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 31\n },\n __self: this\n }, \"RyHelpProfile\")), React.createElement(\"hr\", {\n className: \"sidebar-divider my-0\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 34\n },\n __self: this\n }), React.createElement(\"li\", {\n className: \"nav-item active\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 36\n },\n __self: this\n }, React.createElement(Link, {\n className: \"nav-link\",\n to: \"Home\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 38\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-fw fa-tachometer-alt\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 39\n },\n __self: this\n }), React.createElement(\"span\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 40\n },\n __self: this\n }, \"Dashboard\"))), React.createElement(\"hr\", {\n className: \"sidebar-divider\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 44\n },\n __self: this\n }), React.createElement(\"div\", {\n className: \"sidebar-heading\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 45\n },\n __self: this\n }, \"Managment\"), React.createElement(\"li\", {\n className: \"nav-item\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 49\n },\n __self: this\n }, React.createElement(Link, {\n className: \"nav-link\",\n to: \"/products\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 50\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-fw fa-user\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 51\n },\n __self: this\n }), React.createElement(\"span\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 52\n },\n __self: this\n }, \"Doctor Profiles\"))), React.createElement(\"li\", {\n className: \"nav-item\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 56\n },\n __self: this\n }, React.createElement(Link, {\n className: \"nav-link\",\n to: \"/orders\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 57\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-fw fa-dollar-sign\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 58\n },\n __self: this\n }), React.createElement(\"span\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 59\n },\n __self: this\n }, \"Lab Reports\"))), React.createElement(\"hr\", {\n className: \"sidebar-divider\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 63\n },\n __self: this\n }), React.createElement(\"div\", {\n className: \"sidebar-heading\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 65\n },\n __self: this\n }, \"Profile\"), React.createElement(\"li\", {\n className: \"nav-item\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 70\n },\n __self: this\n }, React.createElement(Link, {\n className: \"nav-link\",\n to: \"/users\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 71\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-fw fa-user\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 72\n },\n __self: this\n }), React.createElement(\"span\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 73\n },\n __self: this\n }, \"Patients\"))), React.createElement(\"hr\", {\n className: \"sidebar-divider d-none d-md-block\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 77\n },\n __self: this\n })));\n};\n\nexport default LeftMenu;","map":{"version":3,"sources":["D:/FYP/Update/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/LeftMenu/LeftMenu.tsx"],"names":["React","Fragment","useState","Link","LeftMenu","leftMenuV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FJ,CADJ,CAhCJ,EAuCI;AAAI,IAAA,SAAS,EAAC,iBAAd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAvCJ,EAyCI;AAAK,IAAA,SAAS,EAAC,iBAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAzCJ,EA8CI;AAAI,IAAA,SAAS,EAAC,UAAd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI,oBAAC,IAAD;AAAM,IAAA,SAAS,EAAC,UAAhB;AAA2B,IAAA,EAAE,UAA7B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAG,IAAA,SAAS,EAAC,mBAAb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADJ,EAEI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAFJ,CADJ,CA9CJ,EAqDI;AAAI,IAAA,SAAS,EAAC,mCAAd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IArDJ,CAPJ,CADJ;AAiEH,CA7ED;;AA+EA,eAAeJ,QAAf","sourcesContent":["import React, { Fragment, useState } from \"react\";\nimport { Link } from \"react-router-dom\";\n\nconst LeftMenu: React.FC = () => {\n\n let [leftMenuVisibility, setLeftMenuVisibility] = useState(false);\n\n function changeLeftMenuVisibility() {\n setLeftMenuVisibility(!leftMenuVisibility);\n }\n\n function getCollapseClass() {\n return (leftMenuVisibility) ? \"\" : \"collapsed\";\n }\n\n return (\n <Fragment>\n <div className=\"toggle-area\">\n <button className=\"btn btn-primary toggle-button\" onClick={() => changeLeftMenuVisibility()}>\n <i className=\"fas fa-bolt\"></i>\n </button>\n </div>\n\n <ul className={`navbar-nav bg-gradient-primary-green sidebar sidebar-dark accordion ${getCollapseClass()}`}\n id=\"collapseMenu\">\n\n <a className=\"sidebar-brand d-flex align-items-center justify-content-center\" href=\"index.html\">\n <div className=\"sidebar-brand-icon icon-green rotate-n-15\">\n <i className=\"fas fa-bolt\"></i>\n </div>\n <div className=\" mx-3\">RyHelpProfile</div>\n </a>\n\n <hr className=\"sidebar-divider my-0\" />\n\n <li className=\"nav-item active\">\n\n <Link className=\"nav-link\" to=\"Home\">\n <i className=\"fas fa-fw fa-tachometer-alt\"></i>\n <span>Dashboard</span>\n </Link>\n </li>\n\n <hr className=\"sidebar-divider\" />\n <div className=\"sidebar-heading\">\n Managment\n </div>\n\n <li className=\"nav-item\">\n <Link className=\"nav-link\" to={`/products`}>\n <i className=\"fas fa-fw fa-user\"></i>\n <span>Doctor Profiles</span>\n </Link>\n </li>\n\n <li className=\"nav-item\">\n <Link className=\"nav-link\" to={`/orders`}>\n <i className=\"fas fa-fw fa-dollar-sign\"></i>\n <span>Lab Reports</span>\n </Link>\n </li>\n \n <hr className=\"sidebar-divider\" />\n\n <div className=\"sidebar-heading\">\n Profile\n </div>\n\n\n <li className=\"nav-item\">\n <Link className=\"nav-link\" to={`/users`}>\n <i className=\"fas fa-fw fa-user\"></i>\n <span>Patients</span>\n </Link>\n </li>\n\n <hr className=\"sidebar-divider d-none d-md-block\" />\n </ul>\n </Fragment>\n );\n};\n\nexport default LeftMenu;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"/**\n * Copyright (c) 2015-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';\n\nvar _slicedToArray = require(\"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\node_modules\\\\babel-preset-react-app\\\\node_modules\\\\@babel\\\\runtime/helpers/slicedToArray\");\n\nconst chalk = require('chalk');\n\nconst friendlySyntaxErrorLabel = 'Syntax error:';\n\nfunction isLikelyASyntaxError(message) {\n return message.indexOf(friendlySyntaxErrorLabel) !== -1;\n} // Cleans up webpack error messages.\n\n\nfunction formatMessage(message) {\n let lines = message.split('\\n'); // Strip Webpack-added headers off errors/warnings\n // https://github.com/webpack/webpack/blob/master/lib/ModuleError.js\n\n lines = lines.filter(line => !/Module [A-z ]+\\(from/.test(line)); // Transform parsing error into syntax error\n // TODO: move this to our ESLint formatter?\n\n lines = lines.map(line => {\n const parsingError = /Line (\\d+):(?:(\\d+):)?\\s*Parsing error: (.+)$/.exec(line);\n\n if (!parsingError) {\n return line;\n }\n\n const _parsingError = _slicedToArray(parsingError, 4),\n errorLine = _parsingError[1],\n errorColumn = _parsingError[2],\n errorMessage = _parsingError[3];\n\n return \"\".concat(friendlySyntaxErrorLabel, \" \").concat(errorMessage, \" (\").concat(errorLine, \":\").concat(errorColumn, \")\");\n });\n message = lines.join('\\n'); // Smoosh syntax errors (commonly found in CSS)\n\n message = message.replace(/SyntaxError\\s+\\((\\d+):(\\d+)\\)\\s*(.+?)\\n/g, \"\".concat(friendlySyntaxErrorLabel, \" $3 ($1:$2)\\n\")); // Clean up export errors\n\n message = message.replace(/^.*export '(.+?)' was not found in '(.+?)'.*$/gm, \"Attempted import error: '$1' is not exported from '$2'.\");\n message = message.replace(/^.*export 'default' \\(imported as '(.+?)'\\) was not found in '(.+?)'.*$/gm, \"Attempted import error: '$2' does not contain a default export (imported as '$1').\");\n message = message.replace(/^.*export '(.+?)' \\(imported as '(.+?)'\\) was not found in '(.+?)'.*$/gm, \"Attempted import error: '$1' is not exported from '$3' (imported as '$2').\");\n lines = message.split('\\n'); // Remove leading newline\n\n if (lines.length > 2 && lines[1].trim() === '') {\n lines.splice(1, 1);\n } // Clean up file name\n\n\n lines[0] = lines[0].replace(/^(.*) \\d+:\\d+-\\d+$/, '$1'); // Cleans up verbose \"module not found\" messages for files and packages.\n\n if (lines[1] && lines[1].indexOf('Module not found: ') === 0) {\n lines = [lines[0], lines[1].replace('Error: ', '').replace('Module not found: Cannot find file:', 'Cannot find file:')];\n } // Add helpful message for users trying to use Sass for the first time\n\n\n if (lines[1] && lines[1].match(/Cannot find module.+node-sass/)) {\n lines[1] = 'To import Sass files, you first need to install node-sass.\\n';\n lines[1] += 'Run `npm install node-sass` or `yarn add node-sass` inside your workspace.';\n }\n\n lines[0] = chalk.inverse(lines[0]);\n message = lines.join('\\n'); // Internal stacks are generally useless so we strip them... with the\n // exception of stacks containing `webpack:` because they're normally\n // from user code generated by Webpack. For more information see\n // https://github.com/facebook/create-react-app/pull/1050\n\n message = message.replace(/^\\s*at\\s((?!webpack:).)*:\\d+:\\d+[\\s)]*(\\n|$)/gm, ''); // at ... ...:x:y\n\n message = message.replace(/^\\s*at\\s<anonymous>(\\n|$)/gm, ''); // at <anonymous>\n\n lines = message.split('\\n'); // Remove duplicated newlines\n\n lines = lines.filter((line, index, arr) => index === 0 || line.trim() !== '' || line.trim() !== arr[index - 1].trim()); // Reassemble the message\n\n message = lines.join('\\n');\n return message.trim();\n}\n\nfunction formatWebpackMessages(json) {\n const formattedErrors = json.errors.map(function (message) {\n return formatMessage(message, true);\n });\n const formattedWarnings = json.warnings.map(function (message) {\n return formatMessage(message, false);\n });\n const result = {\n errors: formattedErrors,\n warnings: formattedWarnings\n };\n\n if (result.errors.some(isLikelyASyntaxError)) {\n // If there are any syntax errors, show just them.\n result.errors = result.errors.filter(isLikelyASyntaxError);\n }\n\n return result;\n}\n\nmodule.exports = formatWebpackMessages;","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"'use strict';\n\nmodule.exports = function bind(fn, thisArg) {\n return function wrap() {\n var args = new Array(arguments.length);\n\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n\n return fn.apply(thisArg, args);\n };\n};","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport connectAdvanced from '../components/connectAdvanced';\nimport shallowEqual from '../utils/shallowEqual';\nimport defaultMapDispatchToPropsFactories from './mapDispatchToProps';\nimport defaultMapStateToPropsFactories from './mapStateToProps';\nimport defaultMergePropsFactories from './mergeProps';\nimport defaultSelectorFactory from './selectorFactory';\n/*\n connect is a facade over connectAdvanced. It turns its args into a compatible\n selectorFactory, which has the signature:\n\n (dispatch, options) => (nextState, nextOwnProps) => nextFinalProps\n \n connect passes its args to connectAdvanced as options, which will in turn pass them to\n selectorFactory each time a Connect component instance is instantiated or hot reloaded.\n\n selectorFactory returns a final props selector from its mapStateToProps,\n mapStateToPropsFactories, mapDispatchToProps, mapDispatchToPropsFactories, mergeProps,\n mergePropsFactories, and pure args.\n\n The resulting final props selector is called by the Connect component instance whenever\n it receives new props or store state.\n */\n\nfunction match(arg, factories, name) {\n for (var i = factories.length - 1; i >= 0; i--) {\n var result = factories[i](arg);\n if (result) return result;\n }\n\n return function (dispatch, options) {\n throw new Error(\"Invalid value of type \" + typeof arg + \" for \" + name + \" argument when connecting component \" + options.wrappedComponentName + \".\");\n };\n}\n\nfunction strictEqual(a, b) {\n return a === b;\n} // createConnect with default args builds the 'official' connect behavior. Calling it with\n// different options opens up some testing and extensibility scenarios\n\n\nexport function createConnect(_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n _ref$connectHOC = _ref.connectHOC,\n connectHOC = _ref$connectHOC === void 0 ? connectAdvanced : _ref$connectHOC,\n _ref$mapStateToPropsF = _ref.mapStateToPropsFactories,\n mapStateToPropsFactories = _ref$mapStateToPropsF === void 0 ? defaultMapStateToPropsFactories : _ref$mapStateToPropsF,\n _ref$mapDispatchToPro = _ref.mapDispatchToPropsFactories,\n mapDispatchToPropsFactories = _ref$mapDispatchToPro === void 0 ? defaultMapDispatchToPropsFactories : _ref$mapDispatchToPro,\n _ref$mergePropsFactor = _ref.mergePropsFactories,\n mergePropsFactories = _ref$mergePropsFactor === void 0 ? defaultMergePropsFactories : _ref$mergePropsFactor,\n _ref$selectorFactory = _ref.selectorFactory,\n selectorFactory = _ref$selectorFactory === void 0 ? defaultSelectorFactory : _ref$selectorFactory;\n\n return function connect(mapStateToProps, mapDispatchToProps, mergeProps, _ref2) {\n if (_ref2 === void 0) {\n _ref2 = {};\n }\n\n var _ref3 = _ref2,\n _ref3$pure = _ref3.pure,\n pure = _ref3$pure === void 0 ? true : _ref3$pure,\n _ref3$areStatesEqual = _ref3.areStatesEqual,\n areStatesEqual = _ref3$areStatesEqual === void 0 ? strictEqual : _ref3$areStatesEqual,\n _ref3$areOwnPropsEqua = _ref3.areOwnPropsEqual,\n areOwnPropsEqual = _ref3$areOwnPropsEqua === void 0 ? shallowEqual : _ref3$areOwnPropsEqua,\n _ref3$areStatePropsEq = _ref3.areStatePropsEqual,\n areStatePropsEqual = _ref3$areStatePropsEq === void 0 ? shallowEqual : _ref3$areStatePropsEq,\n _ref3$areMergedPropsE = _ref3.areMergedPropsEqual,\n areMergedPropsEqual = _ref3$areMergedPropsE === void 0 ? shallowEqual : _ref3$areMergedPropsE,\n extraOptions = _objectWithoutPropertiesLoose(_ref3, [\"pure\", \"areStatesEqual\", \"areOwnPropsEqual\", \"areStatePropsEqual\", \"areMergedPropsEqual\"]);\n\n var initMapStateToProps = match(mapStateToProps, mapStateToPropsFactories, 'mapStateToProps');\n var initMapDispatchToProps = match(mapDispatchToProps, mapDispatchToPropsFactories, 'mapDispatchToProps');\n var initMergeProps = match(mergeProps, mergePropsFactories, 'mergeProps');\n return connectHOC(selectorFactory, _extends({\n // used in error messages\n methodName: 'connect',\n // used to compute Connect's displayName from the wrapped component's displayName.\n getDisplayName: function getDisplayName(name) {\n return \"Connect(\" + name + \")\";\n },\n // if mapStateToProps is falsy, the Connect component doesn't subscribe to store state changes\n shouldHandleStateChanges: Boolean(mapStateToProps),\n // passed through to selectorFactory\n initMapStateToProps: initMapStateToProps,\n initMapDispatchToProps: initMapDispatchToProps,\n initMergeProps: initMergeProps,\n pure: pure,\n areStatesEqual: areStatesEqual,\n areOwnPropsEqual: areOwnPropsEqual,\n areStatePropsEqual: areStatePropsEqual,\n areMergedPropsEqual: areMergedPropsEqual\n }, extraOptions));\n };\n}\nexport default createConnect();","map":null,"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"'use strict';\n\nvar logObject = {};\n['log', 'debug', 'warn'].forEach(function (level) {\n var levelExists;\n\n try {\n levelExists = global.console && global.console[level] && global.console[level].apply;\n } catch (e) {// do nothing\n }\n\n logObject[level] = levelExists ? function () {\n return global.console[level].apply(global.console, arguments);\n } : level === 'log' ? function () {} : logObject.log;\n});\nmodule.exports = logObject;","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"import _defineProperty from \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/defineProperty\";\nimport _slicedToArray from \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/slicedToArray\";\nvar _jsxFileName = \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Products/ProductsForm.tsx\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nimport React, { useState, Fragment } from \"react\";\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { ProductModificationStatus } from \"../../store/models/product.interface\";\nimport TextInput from \"../../common/components/TextInput\";\nimport { editProduct, clearSelectedProduct, setModificationState, addProduct, removeProduct } from \"../../store/actions/products.action\";\nimport { addNotification } from \"../../store/actions/notifications.action\";\nimport NumberInput from \"../../common/components/NumberInput\";\nimport SelectInput from \"../../common/components/Select\";\nimport axios from \"axios\";\n\nconst ProductForm = () => {\n const dispatch = useDispatch();\n const products = useSelector(state => state.products);\n let product = products.selectedProduct;\n const isCreate = products.modificationState === ProductModificationStatus.Create;\n\n if (!product || isCreate) {\n product = {\n id: 0,\n name: \"\",\n qualification: \"\",\n experience: 0,\n rating: 0,\n place: \"\",\n profile: \"\",\n description: \"\",\n hasExpiryDate: false,\n price: 0,\n amount: 0,\n category: \"\"\n };\n }\n\n const _useState = useState({\n name: {\n error: \"\",\n value: product.name\n },\n qualification: {\n error: \"\",\n value: product.qualification\n },\n experience: {\n error: \"\",\n value: product.experience\n },\n rating: {\n error: \"\",\n value: product.rating\n },\n place: {\n error: \"\",\n value: product.place\n },\n profile: {\n error: \"\",\n value: product.profile\n },\n description: {\n error: \"\",\n value: product.description\n },\n amount: {\n error: \"\",\n value: product.amount\n },\n price: {\n error: \"\",\n value: product.price\n },\n hasExpiryDate: {\n error: \"\",\n value: product.hasExpiryDate\n },\n category: {\n error: \"\",\n value: product.category\n }\n }),\n _useState2 = _slicedToArray(_useState, 2),\n formState = _useState2[0],\n setFormState = _useState2[1];\n\n const _useState3 = useState(0),\n _useState4 = _slicedToArray(_useState3, 2),\n resState = _useState4[0],\n setresState = _useState4[1];\n\n function hasFormValueChanged(model) {\n setFormState(_objectSpread({}, formState, {\n [model.field]: {\n error: model.error,\n value: model.value\n }\n }));\n }\n\n function saveUser(e) {\n e.preventDefault();\n\n if (isFormInvalid()) {\n return;\n }\n\n let saveUserFn = isCreate ? addProduct : editProduct;\n saveForm(formState, saveUserFn);\n }\n\n function saveForm(formState, saveFn) {\n if (product) {\n if (products != null) {\n products.products.map(product => {\n console.log(product);\n dispatch(removeProduct(product.id));\n });\n } // dispatch(saveFn({\n // ...product,\n // name: formState.name.value,\n // qualification: formState.qualification.value,\n // experience: formState.experience.value,\n // rating: formState.rating.value,\n // place: formState.place.value,\n // profile: formState.profile.value,\n // description: formState.description.value,\n // }));\n\n\n const article = {\n Name: formState.name.value,\n Qualification: formState.qualification.value,\n Experience: formState.experience.value + \" years experience\",\n Rating: formState.rating.value + \"%\",\n Place: formState.place.value,\n Profile: formState.profile.value\n };\n axios.post('http://127.0.0.1:8000/staffapi/salary', article).then(response => setresState(response.data));\n axios.get(\"https://jsonplaceholder.typicode.com/users\").then(res => {\n for (let i = 0; i < res.data.length; i++) {\n product = {\n id: res.data[i].id,\n name: res.data[i].Name,\n qualification: res.data[i].Qualification,\n experience: res.data[i].Experience,\n rating: res.data[i].Rating,\n place: res.data[i].Place,\n profile: res.data[i].Profile,\n hasExpiryDate: false,\n price: 0,\n amount: 0,\n category: \"\",\n description: \"\"\n };\n console.log(product);\n dispatch(addProduct(product));\n }\n });\n dispatch(addNotification(\"Product edited\", \"Product \".concat(formState.name.value, \" edited by you\")));\n dispatch(clearSelectedProduct());\n dispatch(setModificationState(ProductModificationStatus.None)); // if(products != null){\n // products.products.map(product => {\n // console.log(product)\n // dispatch(removeProduct(product.id))\n // });\n // }\n }\n }\n\n function cancelForm() {\n dispatch(setModificationState(ProductModificationStatus.None));\n }\n\n function getDisabledClass() {\n let isError = isFormInvalid();\n return isError ? \"disabled\" : \"\";\n }\n\n function isFormInvalid() {\n return formState.qualification.error || formState.experience.error || formState.name.error || formState.rating.error || formState.place.error || formState.profile.error || !formState.name.value;\n }\n\n return React.createElement(Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 132\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"col-xl-7 col-lg-7\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 133\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card shadow mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 134\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card-header py-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 135\n },\n __self: this\n }, React.createElement(\"h6\", {\n className: \"m-0 font-weight-bold text-green\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 136\n },\n __self: this\n }, \"Product \", isCreate ? \"create\" : \"edit\")), React.createElement(\"div\", {\n className: \"card-body\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 138\n },\n __self: this\n }, React.createElement(\"form\", {\n onSubmit: saveUser,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 139\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 140\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-12\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 141\n },\n __self: this\n }, React.createElement(TextInput, {\n id: \"input_email\",\n value: formState.name.value,\n field: \"name\",\n onChange: hasFormValueChanged,\n required: true,\n maxLength: 20,\n label: \"Name\",\n placeholder: \"Name\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 142\n },\n __self: this\n }))), React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 152\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 153\n },\n __self: this\n }, React.createElement(SelectInput, {\n id: \"input_qualification\",\n field: \"qualification\",\n label: \"Qualification\",\n options: [\"BAMS\", \"MBBS\", \"BDS\", \"AFIH\"],\n required: true,\n onChange: hasFormValueChanged,\n value: formState.qualification.value,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 154\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"form-group col-md-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 164\n },\n __self: this\n }, React.createElement(SelectInput, {\n id: \"input_profile\",\n field: \"profile\",\n label: \"Profile\",\n options: [\"Ayurveda\", \"Homeopath\", \"Dentist\", \"General Medicine\"],\n required: true,\n onChange: hasFormValueChanged,\n value: formState.profile.value,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 165\n },\n __self: this\n }))), React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 176\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 177\n },\n __self: this\n }, React.createElement(NumberInput, {\n id: \"input_amount\",\n value: formState.experience.value,\n field: \"experience\",\n onChange: hasFormValueChanged,\n max: 100,\n min: 0,\n label: \"Experience\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 178\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"form-group col-md-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 186\n },\n __self: this\n }, React.createElement(NumberInput, {\n id: \"input_price\",\n value: formState.rating.value,\n field: \"rating\",\n onChange: hasFormValueChanged,\n max: 100,\n min: 0,\n label: \"Rating\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 187\n },\n __self: this\n }))), React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 196\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 197\n },\n __self: this\n }, React.createElement(SelectInput, {\n id: \"input_place\",\n field: \"place\",\n label: \"Place\",\n options: [\"Whitefield, Bangalore\", \"Bannerghatta Road, Bangalore\", \"Keelkattalai, Chennai\", \"Porur, Chennai\"],\n required: true,\n onChange: hasFormValueChanged,\n value: formState.place.value,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 198\n },\n __self: this\n }))), React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 209\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 210\n },\n __self: this\n }, React.createElement(TextInput, {\n id: \"input_description\",\n field: \"description\",\n value: formState.description.value,\n onChange: hasFormValueChanged,\n required: false,\n maxLength: 100,\n label: \"Description\",\n placeholder: \"Description\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 211\n },\n __self: this\n }))), React.createElement(\"button\", {\n className: \"btn btn-danger\",\n onClick: () => cancelForm(),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 231\n },\n __self: this\n }, \"Cancel\"), React.createElement(\"button\", {\n type: \"submit\",\n className: \"btn btn-success left-margin \".concat(getDisabledClass()),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 232\n },\n __self: this\n }, \"Save\"))))));\n};\n\nexport default ProductForm;","map":{"version":3,"sources":["/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Products/ProductsForm.tsx"],"names":["React","useState","Fragment","useSelector","useDispatch","ProductModificationStatus","TextInput","editProduct","clearSelectedProduct","setModificationState","addProduct","removeProduct","addNotification","NumberInput","SelectInput","axios","ProductForm","dispatch","products","state","product","selectedProduct","isCreate","modificationState","Create","id","name","qualification","experience","rating","place","profile","description","hasExpiryDate","price","amount","category","error","value","formState","setFormState","resState","setresState","hasFormValueChanged","model","field","saveUser","e","preventDefault","isFormInvalid","saveUserFn","saveForm","saveFn","map","console","log","article","Name","Qualification","Experience","Rating","Place","Profile","post","then","response","data","get","res","i","length","None","cancelForm","getDisabledClass","isError"],"mappings":";;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA+CC,QAA/C,QAA+D,OAA/D;AAEA,SAASC,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AACA,SAAmBC,yBAAnB,QAAoD,sCAApD;AACA,OAAOC,SAAP,MAAsB,mCAAtB;AACA,SAASC,WAAT,EAAsBC,oBAAtB,EAA4CC,oBAA5C,EAAkEC,UAAlE,EAA8EC,aAA9E,QAAmG,qCAAnG;AACA,SAASC,eAAT,QAAgC,0CAAhC;AACA,OAAOC,WAAP,MAAwB,qCAAxB;AAEA,OAAOC,WAAP,MAAwB,gCAAxB;AAEA,OAAOC,KAAP,MAA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,CAAC,uBAAD,EAA0B,8BAA1B,EAA0D,uBAA1D,EAAmF,gBAAnF,CAJX;AAKE,IAAA,QAAQ,EAAE,IALZ;AAME,IAAA,QAAQ,EAAEA,mBANZ;AAOE,IAAA,KAAK,EAAEJ,SAAS,CAACT,KAAV,CAAgBQ,KAPzB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADF,CADF,CAzDF,EAsEE;AAAK,IAAA,SAAS,EAAC,UAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACE;AAAK,IAAA,SAAS,EAAC,qBAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACE,oBAAC,SAAD;AAAW,IAAA,EAAE,EAAC,mBAAd;AACE,IAAA,KAAK,EAAG,aADV;AAEE,IAAA,KAAK,EAAEC,SAAS,CAACP,WAAV,CAAsBM,KAF/B;AAGE,IAAA,QAAQ,EAAEK,mBAHZ;AAIE,IAAA,QAAQ,EAAE,KAJZ;AAKE,IAAA,SAAS,EAAE,GALb;AAME,IAAA,KAAK,EAAC,aANR;AAOE,IAAA,WAAW,EAAC,aAPd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADF,CADF,CAtEF,EA4FE;AAAQ,IAAA,SAAS,EAAC,gBAAlB;AAAmC,IAAA,OAAO,EAAE,MAAM6B,UAAU,EAA5D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cA5FF,EA6FE;AAAQ,IAAA,IAAI,EAAC,QAAb;AAAsB,IAAA,SAAS,wCAAiCC,gBAAgB,EAAjD,CAA/B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YA7FF,CADF,CAJF,CADF,CADF,CADF;AA4GD,CAjOD;;AAmOA,eAAezD,WAAf","sourcesContent":["import React, { useState, FormEvent, Dispatch, Fragment } from \"react\";\nimport { IStateType, IProductState } from \"../../store/models/root.interface\";\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { IProduct, ProductModificationStatus } from \"../../store/models/product.interface\";\nimport TextInput from \"../../common/components/TextInput\";\nimport { editProduct, clearSelectedProduct, setModificationState, addProduct, removeProduct } from \"../../store/actions/products.action\";\nimport { addNotification } from \"../../store/actions/notifications.action\";\nimport NumberInput from \"../../common/components/NumberInput\";\nimport Checkbox from \"../../common/components/Checkbox\";\nimport SelectInput from \"../../common/components/Select\";\nimport { OnChangeModel, IProductFormState } from \"../../common/types/Form.types\";\nimport axios from \"axios\";\n\nconst ProductForm: React.FC = () => {\n const dispatch: Dispatch<any> = useDispatch();\n const products: IProductState | null = useSelector((state: IStateType) => state.products);\n let product: IProduct | null = products.selectedProduct;\n const isCreate: boolean = (products.modificationState === ProductModificationStatus.Create);\n \n if (!product || isCreate) {\n product = { id: 0, name: \"\", qualification: \"\", experience: 0, rating: 0, place: \"\", profile: \"\", description: \"\", hasExpiryDate: false, price: 0, amount: 0, category: \"\"};\n }\n\n const [formState, setFormState] = useState({\n name: { error: \"\", value: product.name },\n qualification: { error: \"\", value: product.qualification},\n experience: { error: \"\", value: product.experience},\n rating: { error: \"\", value: product.rating},\n place: { error: \"\", value: product.place},\n profile: { error: \"\", value: product.profile},\n description: { error: \"\", value: product.description},\n amount: { error: \"\", value: product.amount},\n price: { error: \"\", value: product.price},\n hasExpiryDate: { error: \"\", value: product.hasExpiryDate},\n category: { error: \"\", value: product.category},\n });\n\n const [resState, setresState] = useState(0);\n\n function hasFormValueChanged(model: OnChangeModel): void {\n setFormState({ ...formState, [model.field]: { error: model.error, value: model.value } });\n }\n\n function saveUser(e: FormEvent<HTMLFormElement>): void {\n e.preventDefault();\n if (isFormInvalid()) {\n return;\n }\n\n let saveUserFn: Function = (isCreate) ? addProduct : editProduct;\n saveForm(formState, saveUserFn);\n }\n\n function saveForm(formState: IProductFormState, saveFn: Function): void {\n if (product) {\n if(products != null){\n products.products.map(product => {\n console.log(product)\n dispatch(removeProduct(product.id))\n });\n }\n // dispatch(saveFn({\n // ...product,\n // name: formState.name.value,\n // qualification: formState.qualification.value,\n // experience: formState.experience.value,\n // rating: formState.rating.value,\n // place: formState.place.value,\n // profile: formState.profile.value,\n // description: formState.description.value,\n // }));\n const article = { Name : formState.name.value,\n Qualification: formState.qualification.value,\n Experience: formState.experience.value + \" years experience\",\n Rating: formState.rating.value + \"%\",\n Place: formState.place.value,\n Profile: formState.profile.value\n };\n axios.post('http://127.0.0.1:8000/staffapi/salary', article).then(response => setresState(response.data));\n \n axios.get(`https://jsonplaceholder.typicode.com/users`)\n .then(res => {\n for (let i = 0; i < res.data.length; i++) {\n product = {\n id: res.data[i].id,\n name: res.data[i].Name,\n qualification: res.data[i].Qualification,\n experience: res.data[i].Experience,\n rating: res.data[i].Rating,\n place: res.data[i].Place,\n profile: res.data[i].Profile,\n hasExpiryDate: false,\n price: 0,\n amount: 0,\n category: \"\",\n description: \"\"\n };\n console.log(product)\n dispatch(addProduct(product))\n }\n });\n\n dispatch(addNotification(\"Product edited\", `Product ${formState.name.value} edited by you`));\n dispatch(clearSelectedProduct());\n dispatch(setModificationState(ProductModificationStatus.None));\n // if(products != null){\n // products.products.map(product => {\n // console.log(product)\n // dispatch(removeProduct(product.id))\n // });\n // }\n \n }\n }\n\n function cancelForm(): void {\n dispatch(setModificationState(ProductModificationStatus.None));\n }\n\n function getDisabledClass(): string {\n let isError: boolean = isFormInvalid();\n return isError ? \"disabled\" : \"\";\n }\n\n function isFormInvalid(): boolean {\n return (formState.qualification.error || formState.experience.error\n || formState.name.error || formState.rating.error || formState.place.error\n || formState.profile.error || !formState.name.value) as boolean;\n}\n\n return (\n <Fragment>\n <div className=\"col-xl-7 col-lg-7\">\n <div className=\"card shadow mb-4\">\n <div className=\"card-header py-3\">\n <h6 className=\"m-0 font-weight-bold text-green\">Product {(isCreate ? \"create\" : \"edit\")}</h6>\n </div>\n <div className=\"card-body\">\n <form onSubmit={saveUser}>\n <div className=\"form-row\">\n <div className=\"form-group col-md-12\">\n <TextInput id=\"input_email\"\n value={formState.name.value}\n field=\"name\"\n onChange={hasFormValueChanged}\n required={true}\n maxLength={20}\n label=\"Name\"\n placeholder=\"Name\" />\n </div>\n </div>\n <div className=\"form-row\">\n <div className=\"form-group col-md-3\">\n <SelectInput\n id=\"input_qualification\"\n field=\"qualification\"\n label=\"Qualification\"\n options={[\"BAMS\", \"MBBS\", \"BDS\", \"AFIH\"]}\n required={true}\n onChange={hasFormValueChanged}\n value={formState.qualification.value}\n />\n </div>\n <div className=\"form-group col-md-3\">\n <SelectInput\n id=\"input_profile\"\n field=\"profile\"\n label=\"Profile\"\n options={[\"Ayurveda\", \"Homeopath\", \"Dentist\", \"General Medicine\"]}\n required={true}\n onChange={hasFormValueChanged}\n value={formState.profile.value}\n />\n </div>\n </div>\n <div className=\"form-row\">\n <div className=\"form-group col-md-3\">\n <NumberInput id=\"input_amount\"\n value={formState.experience.value}\n field=\"experience\"\n onChange={hasFormValueChanged}\n max={100}\n min={0}\n label=\"Experience\" />\n </div>\n <div className=\"form-group col-md-3\">\n <NumberInput id=\"input_price\"\n value={formState.rating.value}\n field=\"rating\"\n onChange={hasFormValueChanged}\n max={100}\n min={0}\n label=\"Rating\" />\n </div>\n </div>\n <div className=\"form-row\">\n <div className=\"form-group col-md-3\">\n <SelectInput\n id=\"input_place\"\n field=\"place\"\n label=\"Place\"\n options={[\"Whitefield, Bangalore\", \"Bannerghatta Road, Bangalore\", \"Keelkattalai, Chennai\", \"Porur, Chennai\"]}\n required={true}\n onChange={hasFormValueChanged}\n value={formState.place.value}\n />\n </div>\n </div>\n <div className=\"form-row\">\n <div className=\"form-group col-md-3\">\n <TextInput id=\"input_description\"\n field = \"description\"\n value={formState.description.value}\n onChange={hasFormValueChanged}\n required={false}\n maxLength={100}\n label=\"Description\"\n placeholder=\"Description\" />\n </div>\n </div>\n \n {/* <div className=\"form-group\">\n <Checkbox\n id=\"checkbox_expiry\"\n field=\"hasExpiryDate\"\n value={formState.hasExpiryDate.value}\n label=\"Has expiry date\"\n onChange={hasFormValueChanged}\n />\n </div> */}\n <button className=\"btn btn-danger\" onClick={() => cancelForm()}>Cancel</button>\n <button type=\"submit\" className={`btn btn-success left-margin ${getDisabledClass()}`}>Save</button>\n </form>\n </div>\n </div>\n </div>\n </Fragment>\n );\n};\n\nexport default ProductForm;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"import _defineProperty from \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/defineProperty\";\nimport _slicedToArray from \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/slicedToArray\";\nvar _jsxFileName = \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Products/ProductsForm.tsx\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nimport React, { useState, Fragment } from \"react\";\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { ProductModificationStatus } from \"../../store/models/product.interface\";\nimport TextInput from \"../../common/components/TextInput\";\nimport { editProduct, clearSelectedProduct, setModificationState, addProduct } from \"../../store/actions/products.action\";\nimport { addNotification } from \"../../store/actions/notifications.action\";\nimport NumberInput from \"../../common/components/NumberInput\";\nimport SelectInput from \"../../common/components/Select\";\n\nconst ProductForm = () => {\n const dispatch = useDispatch();\n const products = useSelector(state => state.products);\n let product = products.selectedProduct;\n const isCreate = products.modificationState === ProductModificationStatus.Create;\n\n if (!product || isCreate) {\n product = {\n id: 0,\n name: \"\",\n qualification: 0,\n experience: 0,\n rating: 0,\n place: \"\",\n profile: \"\",\n hasExpiryDate: false\n };\n }\n\n const _useState = useState({\n name: {\n error: \"\",\n value: product.name\n },\n qualification: {\n error: \"\",\n value: product.qualification\n },\n experience: {\n error: \"\",\n value: product.experience\n },\n rating: {\n error: \"\",\n value: product.rating\n },\n place: {\n error: \"\",\n value: product.place\n },\n profile: {\n error: \"\",\n value: product.profile\n }\n }),\n _useState2 = _slicedToArray(_useState, 2),\n formState = _useState2[0],\n setFormState = _useState2[1];\n\n function hasFormValueChanged(model) {\n setFormState(_objectSpread({}, formState, {\n [model.field]: {\n error: model.error,\n value: model.value\n }\n }));\n }\n\n function saveUser(e) {\n e.preventDefault();\n\n if (isFormInvalid()) {\n return;\n }\n\n let saveUserFn = isCreate ? addProduct : editProduct;\n saveForm(formState, saveUserFn);\n }\n\n function saveForm(formState, saveFn) {\n if (product) {\n dispatch(saveFn(_objectSpread({}, product, {\n name: formState.name.value,\n description: formState.description.value,\n price: formState.price.value,\n amount: formState.amount.value,\n hasExpiryDate: formState.hasExpiryDate.value,\n category: formState.category.value\n })));\n dispatch(addNotification(\"Product edited\", \"Product \".concat(formState.name.value, \" edited by you\")));\n dispatch(clearSelectedProduct());\n dispatch(setModificationState(ProductModificationStatus.None));\n }\n }\n\n function cancelForm() {\n dispatch(setModificationState(ProductModificationStatus.None));\n }\n\n function getDisabledClass() {\n let isError = isFormInvalid();\n return isError ? \"disabled\" : \"\";\n }\n\n function isFormInvalid() {\n return formState.qualification.error || formState.experience.error || formState.name.error || formState.rating.error || formState.place.error || formState.profile.error || !formState.name.value;\n }\n\n return React.createElement(Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 80\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"col-xl-7 col-lg-7\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 81\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card shadow mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 82\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card-header py-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 83\n },\n __self: this\n }, React.createElement(\"h6\", {\n className: \"m-0 font-weight-bold text-green\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 84\n },\n __self: this\n }, \"Product \", isCreate ? \"create\" : \"edit\")), React.createElement(\"div\", {\n className: \"card-body\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 86\n },\n __self: this\n }, React.createElement(\"form\", {\n onSubmit: saveUser,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 87\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 88\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-12\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 89\n },\n __self: this\n }, React.createElement(TextInput, {\n id: \"input_email\",\n value: formState.name.value,\n field: \"name\",\n onChange: hasFormValueChanged,\n required: true,\n maxLength: 20,\n label: \"Name\",\n placeholder: \"Name\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 90\n },\n __self: this\n }))), React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 100\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 101\n },\n __self: this\n }, React.createElement(SelectInput, {\n id: \"input_qualification\",\n field: \"qualification\",\n label: \"Qualification\",\n options: [\"BAMS\", \"MBBS\", \"BDS\", \"AFIH\"],\n required: true,\n onChange: hasFormValueChanged,\n value: formState.category.value,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 102\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"form-group col-md-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 112\n },\n __self: this\n }, React.createElement(SelectInput, {\n id: \"input_qualification\",\n field: \"qualification\",\n label: \"Profile\",\n options: [\"Ayurveda\", \"Homeopath\", \"Dentist\", \"General Medicine\"],\n required: true,\n onChange: hasFormValueChanged,\n value: formState.category.value,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 113\n },\n __self: this\n }))), React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 124\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 125\n },\n __self: this\n }, React.createElement(NumberInput, {\n id: \"input_amount\",\n value: formState.amount.value,\n field: \"experience\",\n onChange: hasFormValueChanged,\n max: 100,\n min: 0,\n label: \"Experience\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 126\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"form-group col-md-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 134\n },\n __self: this\n }, React.createElement(NumberInput, {\n id: \"input_price\",\n value: formState.price.value,\n field: \"rating\",\n onChange: hasFormValueChanged,\n max: 100,\n min: 0,\n label: \"Rating\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 135\n },\n __self: this\n }))), React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 144\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 145\n },\n __self: this\n }, React.createElement(TextInput, {\n id: \"input_description\",\n field: \"description\",\n value: formState.description.value,\n onChange: hasFormValueChanged,\n required: false,\n maxLength: 100,\n label: \"Description\",\n placeholder: \"Description\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 146\n },\n __self: this\n }))), React.createElement(\"button\", {\n className: \"btn btn-danger\",\n onClick: () => cancelForm(),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 166\n },\n __self: this\n }, \"Cancel\"), React.createElement(\"button\", {\n type: \"submit\",\n className: \"btn btn-success left-margin \".concat(getDisabledClass()),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 167\n },\n __self: this\n }, \"Save\"))))));\n};\n\nexport default ProductForm;","map":{"version":3,"sources":["/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Products/ProductsForm.tsx"],"names":["React","useState","Fragment","useSelector","useDispatch","ProductModificationStatus","TextInput","editProduct","clearSelectedProduct","setModificationState","addProduct","addNotification","NumberInput","SelectInput","ProductForm","dispatch","products","state","product","selectedProduct","isCreate","modificationState","Create","id","name","qualification","experience","rating","place","profile","hasExpiryDate","error","value","formState","setFormState","hasFormValueChanged","model","field","saveUser","e","preventDefault","isFormInvalid","saveUserFn","saveForm","saveFn","description","price","amount","category","None","cancelForm","getDisabledClass","isError"],"mappings":";;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA+CC,QAA/C,QAA+D,OAA/D;AAEA,SAASC,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AACA,SAAmBC,yBAAnB,QAAoD,sCAApD;AACA,OAAOC,SAAP,MAAsB,mCAAtB;AACA,SAASC,WAAT,EAAsBC,oBAAtB,EAA4CC,oBAA5C,EAAkEC,UAAlE,QAAoF,qCAApF;AACA,SAASC,eAAT,QAAgC,0CAAhC;AACA,OAAOC,WAAP,MAAwB,qCAAxB;AAEA,OAAOC,WAAP,MAAwB,gCAAxB;;AAGA,MAAMC,WAAqB,GAAG,MAAM;AAClC,QAAMC,QAAuB,GAAGX,WAAW,EAA3C;AACA,QAAMY,QAA8B,GAAGb,WAAW,CAAEc,KAAD,IAAuBA,KAAK,CAACD,QAA9B,CAAlD;AACA,MAAIE,OAAwB,GAAGF,QAAQ,CAACG,eAAxC;AACA,QAAMC,QAAiB,GAAIJ,QAAQ,CAACK,iBAAT,KAA+BhB,yBAAyB,CAACiB,MAApF;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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADF,CADF,CAzDF,EA+EE;AAAQ,IAAA,SAAS,EAAC,gBAAlB;AAAmC,IAAA,OAAO,EAAE,MAAMe,UAAU,EAA5D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cA/EF,EAgFE;AAAQ,IAAA,IAAI,EAAC,QAAb;AAAsB,IAAA,SAAS,wCAAiCC,gBAAgB,EAAjD,CAA/B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAhFF,CADF,CAJF,CADF,CADF,CADF;AA+FD,CAjKD;;AAmKA,eAAerC,WAAf","sourcesContent":["import React, { useState, FormEvent, Dispatch, Fragment } from \"react\";\nimport { IStateType, IProductState } from \"../../store/models/root.interface\";\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { IProduct, ProductModificationStatus } from \"../../store/models/product.interface\";\nimport TextInput from \"../../common/components/TextInput\";\nimport { editProduct, clearSelectedProduct, setModificationState, addProduct } from \"../../store/actions/products.action\";\nimport { addNotification } from \"../../store/actions/notifications.action\";\nimport NumberInput from \"../../common/components/NumberInput\";\nimport Checkbox from \"../../common/components/Checkbox\";\nimport SelectInput from \"../../common/components/Select\";\nimport { OnChangeModel, IProductFormState } from \"../../common/types/Form.types\";\n\nconst ProductForm: React.FC = () => {\n const dispatch: Dispatch<any> = useDispatch();\n const products: IProductState | null = useSelector((state: IStateType) => state.products);\n let product: IProduct | null = products.selectedProduct;\n const isCreate: boolean = (products.modificationState === ProductModificationStatus.Create);\n \n if (!product || isCreate) {\n product = { id: 0, name: \"\", qualification: 0, experience: 0, rating: 0, place: \"\", profile: \"\", hasExpiryDate: false};\n }\n\n const [formState, setFormState] = useState({\n name: { error: \"\", value: product.name },\n qualification: { error: \"\", value: product.qualification},\n experience: { error: \"\", value: product.experience},\n rating: { error: \"\", value: product.rating},\n place: { error: \"\", value: product.place},\n profile: { error: \"\", value: product.profile},\n });\n\n function hasFormValueChanged(model: OnChangeModel): void {\n setFormState({ ...formState, [model.field]: { error: model.error, value: model.value } });\n }\n\n function saveUser(e: FormEvent<HTMLFormElement>): void {\n e.preventDefault();\n if (isFormInvalid()) {\n return;\n }\n\n let saveUserFn: Function = (isCreate) ? addProduct : editProduct;\n saveForm(formState, saveUserFn);\n }\n\n function saveForm(formState: IProductFormState, saveFn: Function): void {\n if (product) {\n dispatch(saveFn({\n ...product,\n name: formState.name.value,\n description: formState.description.value,\n price: formState.price.value,\n amount: formState.amount.value,\n hasExpiryDate: formState.hasExpiryDate.value,\n category: formState.category.value\n }));\n\n dispatch(addNotification(\"Product edited\", `Product ${formState.name.value} edited by you`));\n dispatch(clearSelectedProduct());\n dispatch(setModificationState(ProductModificationStatus.None));\n }\n }\n\n function cancelForm(): void {\n dispatch(setModificationState(ProductModificationStatus.None));\n }\n\n function getDisabledClass(): string {\n let isError: boolean = isFormInvalid();\n return isError ? \"disabled\" : \"\";\n }\n\n function isFormInvalid(): boolean {\n return (formState.qualification.error || formState.experience.error\n || formState.name.error || formState.rating.error || formState.place.error\n || formState.profile.error || !formState.name.value) as boolean;\n}\n\n return (\n <Fragment>\n <div className=\"col-xl-7 col-lg-7\">\n <div className=\"card shadow mb-4\">\n <div className=\"card-header py-3\">\n <h6 className=\"m-0 font-weight-bold text-green\">Product {(isCreate ? \"create\" : \"edit\")}</h6>\n </div>\n <div className=\"card-body\">\n <form onSubmit={saveUser}>\n <div className=\"form-row\">\n <div className=\"form-group col-md-12\">\n <TextInput id=\"input_email\"\n value={formState.name.value}\n field=\"name\"\n onChange={hasFormValueChanged}\n required={true}\n maxLength={20}\n label=\"Name\"\n placeholder=\"Name\" />\n </div>\n </div>\n <div className=\"form-row\">\n <div className=\"form-group col-md-3\">\n <SelectInput\n id=\"input_qualification\"\n field=\"qualification\"\n label=\"Qualification\"\n options={[\"BAMS\", \"MBBS\", \"BDS\", \"AFIH\"]}\n required={true}\n onChange={hasFormValueChanged}\n value={formState.category.value}\n />\n </div>\n <div className=\"form-group col-md-3\">\n <SelectInput\n id=\"input_qualification\"\n field=\"qualification\"\n label=\"Profile\"\n options={[\"Ayurveda\", \"Homeopath\", \"Dentist\", \"General Medicine\"]}\n required={true}\n onChange={hasFormValueChanged}\n value={formState.category.value}\n />\n </div>\n </div>\n <div className=\"form-row\">\n <div className=\"form-group col-md-3\">\n <NumberInput id=\"input_amount\"\n value={formState.amount.value}\n field=\"experience\"\n onChange={hasFormValueChanged}\n max={100}\n min={0}\n label=\"Experience\" />\n </div>\n <div className=\"form-group col-md-3\">\n <NumberInput id=\"input_price\"\n value={formState.price.value}\n field=\"rating\"\n onChange={hasFormValueChanged}\n max={100}\n min={0}\n label=\"Rating\" />\n </div>\n </div>\n <div className=\"form-row\">\n <div className=\"form-group col-md-3\">\n <TextInput id=\"input_description\"\n field = \"description\"\n value={formState.description.value}\n onChange={hasFormValueChanged}\n required={false}\n maxLength={100}\n label=\"Description\"\n placeholder=\"Description\" />\n </div>\n </div>\n \n {/* <div className=\"form-group\">\n <Checkbox\n id=\"checkbox_expiry\"\n field=\"hasExpiryDate\"\n value={formState.hasExpiryDate.value}\n label=\"Has expiry date\"\n onChange={hasFormValueChanged}\n />\n </div> */}\n <button className=\"btn btn-danger\" onClick={() => cancelForm()}>Cancel</button>\n <button type=\"submit\" className={`btn btn-success left-margin ${getDisabledClass()}`}>Save</button>\n </form>\n </div>\n </div>\n </div>\n </Fragment>\n );\n};\n\nexport default ProductForm;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"import { useContext } from 'react';\nimport invariant from 'invariant';\nimport { ReactReduxContext } from '../components/Context';\n/**\n * A hook to access the value of the `ReactReduxContext`. This is a low-level\n * hook that you should usually not need to call directly.\n *\n * @returns {any} the value of the `ReactReduxContext`\n *\n * @example\n *\n * import React from 'react'\n * import { useReduxContext } from 'react-redux'\n *\n * export const CounterComponent = ({ value }) => {\n * const { store } = useReduxContext()\n * return <div>{store.getState()}</div>\n * }\n */\n\nexport function useReduxContext() {\n var contextValue = useContext(ReactReduxContext);\n invariant(contextValue, 'could not find react-redux context value; please ensure the component is wrapped in a <Provider>');\n return contextValue;\n}","map":null,"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"import _slicedToArray from \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/slicedToArray\";\nvar _jsxFileName = \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Home/Home.tsx\";\nimport React, { Fragment, useEffect, useState } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { updateCurrentPath } from \"../../store/actions/root.actions\";\nimport TopCard from \"../../common/components/TopCard\";\nimport ProductList from \"../Products/ProductsList\";\nimport OrderList from \"../Orders/OrderList\";\nimport axios from \"axios\";\n\nconst Home = () => {\n const products = useSelector(state => state.products);\n const numberItemsCount = products.products.length;\n const totalPrice = products.products.reduce((prev, next) => prev + (next.price * next.amount || 0), 0);\n const totalProductAmount = products.products.reduce((prev, next) => prev + (next.amount || 0), 0);\n const orders = useSelector(state => state.orders.orders);\n const totalSales = orders.reduce((prev, next) => prev + next.totalPrice, 0);\n const totalOrderAmount = orders.reduce((prev, next) => prev + next.amount, 0);\n const email = useSelector(state => state.account.email);\n const dispatch = useDispatch();\n dispatch(updateCurrentPath(\"home\", \"\"));\n\n const _useState = useState(0),\n _useState2 = _slicedToArray(_useState, 2),\n resState = _useState2[0],\n setresState = _useState2[1];\n\n useEffect(() => {\n var nameMatch = email.match(/^([^@]*)@/);\n var name = nameMatch ? nameMatch[1] : null;\n const article = {\n email: name\n };\n axios.post('http://127.0.0.1:8000/api/specificAppointment', article).then(response => {\n const AppList = response.data.map(A => {\n return React.createElement(\"tr\", {\n className: \"table-row\",\n key: \"order_\".concat(order.id),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 36\n },\n __self: this\n }, React.createElement(\"th\", {\n scope: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 38\n },\n __self: this\n }, order.id), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 39\n },\n __self: this\n }, order.name), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 40\n },\n __self: this\n }, order.result), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 41\n },\n __self: this\n }, order.unit), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 42\n },\n __self: this\n }, order.refRange));\n });\n setresState(response.data);\n });\n }, []);\n return React.createElement(Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 51\n },\n __self: this\n }, React.createElement(\"h1\", {\n className: \"h3 mb-2 text-gray-800\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 52\n },\n __self: this\n }, \"Dashboard\"), React.createElement(\"p\", {\n className: \"mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 53\n },\n __self: this\n }, \"Summary and overview of our doctor stuff here\"), React.createElement(\"div\", {\n className: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 55\n },\n __self: this\n }, React.createElement(TopCard, {\n title: \"PATIENT COUNT\",\n text: \"\".concat(numberItemsCount),\n icon: \"box\",\n class: \"primary\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 56\n },\n __self: this\n }), React.createElement(TopCard, {\n title: \"APPONITMEN AMOUNT\",\n text: \"\".concat(totalProductAmount),\n icon: \"warehouse\",\n class: \"danger\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 57\n },\n __self: this\n }), React.createElement(TopCard, {\n title: \"DOCTOR PRICE\",\n text: \"$\".concat(totalPrice),\n icon: \"dollar-sign\",\n class: \"success\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 58\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 61\n },\n __self: this\n }, React.createElement(TopCard, {\n title: \"EARNINGS\",\n text: totalSales.toString(),\n icon: \"donate\",\n class: \"primary\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 62\n },\n __self: this\n }), React.createElement(TopCard, {\n title: \"TOTAL REPORT\",\n text: totalOrderAmount.toString(),\n icon: \"calculator\",\n class: \"danger\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 63\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 66\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"col-xl-6 col-lg-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 68\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card shadow mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 69\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card-header py-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 70\n },\n __self: this\n }, React.createElement(\"h6\", {\n className: \"m-0 font-weight-bold text-green\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 71\n },\n __self: this\n }, \"Patient list\")), React.createElement(\"div\", {\n className: \"card-body\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 73\n },\n __self: this\n }, React.createElement(ProductList, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 74\n },\n __self: this\n })))), React.createElement(\"div\", {\n className: \"col-xl-6 col-lg-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 80\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card shadow mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 81\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card-header py-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 82\n },\n __self: this\n }, React.createElement(\"h6\", {\n className: \"m-0 font-weight-bold text-green\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 83\n },\n __self: this\n }, \"Appoiments\")), React.createElement(\"div\", {\n className: \"card-body\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 85\n },\n __self: this\n }, React.createElement(OrderList, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 86\n },\n __self: this\n }))))));\n};\n\nexport default Home;","map":{"version":3,"sources":["/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Home/Home.tsx"],"names":["React","Fragment","useEffect","useState","useDispatch","useSelector","updateCurrentPath","TopCard","ProductList","OrderList","axios","Home","products","state","numberItemsCount","length","totalPrice","reduce","prev","next","price","amount","totalProductAmount","orders","totalSales","totalOrderAmount","email","account","dispatch","resState","setresState","nameMatch","match","name","article","post","then","response","AppList","data","map","A","order","id","result","unit","refRange","toString"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAAoCC,SAApC,EAA+CC,QAA/C,QAA+D,OAA/D;AACA,SAASC,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AACA,SAASC,iBAAT,QAAkC,kCAAlC;AACA,OAAOC,OAAP,MAAoB,iCAApB;AAEA,OAAOC,WAAP,MAAwB,0BAAxB;AAEA,OAAOC,SAAP,MAAsB,qBAAtB;AACA,OAAOC,KAAP,MAAkB,OAAlB;;AAEA,MAAMC,IAAc,GAAG,MAAM;AAC3B,QAAMC,QAAuB,GAAGP,WAAW,CAAEQ,KAAD,IAAuBA,KAAK,CAACD,QAA9B,CAA3C;AACA,QAAME,gBAAwB,GAAGF,QAAQ,CAACA,QAAT,CAAkBG,MAAnD;AACA,QAAMC,UAAkB,GAAGJ,QAAQ,CAACA,QAAT,CAAkBK,MAAlB,CAAyB,CAACC,IAAD,EAAOC,IAAP,KAAgBD,IAAI,IAAKC,IAAI,CAACC,KAAL,GAAaD,IAAI,CAACE,MAAnB,IAA8B,CAAlC,CAA7C,EAAmF,CAAnF,CAA3B;AACA,QAAMC,kBAA0B,GAAGV,QAAQ,CAACA,QAAT,CAAkBK,MAAlB,CAAyB,CAACC,IAAD,EAAOC,IAAP,KAAgBD,IAAI,IAAIC,IAAI,CAACE,MAAL,IAA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IAAA,SAAS,EAAC,mBAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACE;AAAK,IAAA,SAAS,EAAC,kBAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACE;AAAK,IAAA,SAAS,EAAC,kBAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACE;AAAI,IAAA,SAAS,EAAC,iCAAd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBADF,CADF,EAIE;AAAK,IAAA,SAAS,EAAC,WAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACE,oBAAC,SAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADF,CAJF,CADF,CAdF,CAfF,CADF;AA8CD,CArFD;;AAuFA,eAAepC,IAAf","sourcesContent":["import React, { Fragment, Dispatch, useEffect, useState } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { updateCurrentPath } from \"../../store/actions/root.actions\";\nimport TopCard from \"../../common/components/TopCard\";\nimport { IProductState, IStateType } from \"../../store/models/root.interface\";\nimport ProductList from \"../Products/ProductsList\";\nimport { IOrder } from \"../../store/models/order.interface\";\nimport OrderList from \"../Orders/OrderList\";\nimport axios from \"axios\";\n\nconst Home: React.FC = () => {\n const products: IProductState = useSelector((state: IStateType) => state.products);\n const numberItemsCount: number = products.products.length;\n const totalPrice: number = products.products.reduce((prev, next) => prev + ((next.price * next.amount) || 0), 0);\n const totalProductAmount: number = products.products.reduce((prev, next) => prev + (next.amount || 0), 0);\n\n const orders: IOrder[] = useSelector((state: IStateType) => state.orders.orders);\n const totalSales: number = orders.reduce((prev, next) => prev + next.totalPrice, 0);\n const totalOrderAmount: number = orders.reduce((prev, next) => prev + next.amount, 0);\n\n const email: string = useSelector((state: IStateType) => state.account.email);\n\n const dispatch: Dispatch<any> = useDispatch();\n dispatch(updateCurrentPath(\"home\", \"\"));\n\n const [resState, setresState] = useState(0);\n\n useEffect(() => {\n var nameMatch = email.match(/^([^@]*)@/);\n var name = nameMatch ? nameMatch[1] : null;\n const article = { email : name };\n axios.post('http://127.0.0.1:8000/api/specificAppointment', article)\n .then(response => {\n const AppList: JSX.Element[] = response.data.map((A: any) => {\n return (\n <tr className={`table-row`}\n key={`order_${order.id}`}>\n <th scope=\"row\">{order.id}</th>\n <td>{order.name}</td>\n <td>{order.result}</td>\n <td>{order.unit}</td>\n <td>{order.refRange}</td>\n </tr>);\n })\n setresState(response.data)\n });\n },[]);\n\n\n return (\n <Fragment>\n <h1 className=\"h3 mb-2 text-gray-800\">Dashboard</h1>\n <p className=\"mb-4\">Summary and overview of our doctor stuff here</p>\n\n <div className=\"row\">\n <TopCard title=\"PATIENT COUNT\" text={`${numberItemsCount}`} icon=\"box\" class=\"primary\" />\n <TopCard title=\"APPONITMEN AMOUNT\" text={`${totalProductAmount}`} icon=\"warehouse\" class=\"danger\" />\n <TopCard title=\"DOCTOR PRICE\" text={`$${totalPrice}`} icon=\"dollar-sign\" class=\"success\" />\n </div>\n\n <div className=\"row\">\n <TopCard title=\"EARNINGS\" text={totalSales.toString()} icon=\"donate\" class=\"primary\" />\n <TopCard title=\"TOTAL REPORT\" text={totalOrderAmount.toString()} icon=\"calculator\" class=\"danger\" />\n </div>\n\n <div className=\"row\">\n\n <div className=\"col-xl-6 col-lg-6\">\n <div className=\"card shadow mb-4\">\n <div className=\"card-header py-3\">\n <h6 className=\"m-0 font-weight-bold text-green\">Patient list</h6>\n </div>\n <div className=\"card-body\">\n <ProductList />\n </div>\n </div>\n\n </div>\n\n <div className=\"col-xl-6 col-lg-6\">\n <div className=\"card shadow mb-4\">\n <div className=\"card-header py-3\">\n <h6 className=\"m-0 font-weight-bold text-green\">Appoiments</h6>\n </div>\n <div className=\"card-body\">\n <OrderList />\n\n </div>\n </div>\n </div>\n\n </div>\n\n </Fragment>\n );\n};\n\nexport default Home;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"import _defineProperty from \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/defineProperty\";\nimport _slicedToArray from \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/slicedToArray\";\nvar _jsxFileName = \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Orders/OrderForm.tsx\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nimport React, { useState, Fragment } from \"react\";\nimport TextInput from \"../../common/components/TextInput\";\nimport NumberInput from \"../../common/components/NumberInput\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { addOrder } from \"../../store/actions/orders.actions\";\nimport { addNotification } from \"../../store/actions/notifications.action\";\nimport { clearSelectedProduct, changeProductAmount } from \"../../store/actions/products.action\";\n\nconst OrderForm = () => {\n const dispatch = useDispatch();\n const selectedProduct = useSelector(state => state.products.selectedProduct);\n const initialFormState = {\n name: {\n error: \"\",\n value: \"\"\n },\n product: {\n error: \"\",\n value: null\n },\n amount: {\n error: \"\",\n value: 0\n },\n totalPrice: {\n error: \"\",\n value: 0\n }\n };\n\n const _useState = useState(initialFormState),\n _useState2 = _slicedToArray(_useState, 2),\n formState = _useState2[0],\n setFormState = _useState2[1];\n\n function hasAmountChanged(model) {\n let totalPrice = formState.totalPrice.value;\n\n if (selectedProduct) {\n totalPrice = selectedProduct.price * model.value;\n }\n\n setFormState(_objectSpread({}, formState, {\n amount: {\n error: model.error,\n value: model.value\n },\n totalPrice: {\n error: model.error,\n value: totalPrice\n }\n }));\n }\n\n function hasFormValueChanged(model) {\n setFormState(_objectSpread({}, formState, {\n [model.field]: {\n error: model.error,\n value: model.value\n }\n }));\n }\n\n function resetForm() {\n setFormState(initialFormState);\n }\n\n function saveOrder(e) {\n e.preventDefault();\n\n if (isFormInvalid()) {\n return;\n }\n\n saveForm(formState);\n }\n\n function saveForm(formState) {\n if (selectedProduct) {\n if (selectedProduct.amount < formState.amount.value) {\n alert(\"Not enough products in warehouse\");\n return;\n }\n\n formState.product.value = selectedProduct;\n dispatch(addOrder({\n id: 0,\n name: formState.name.value,\n amount: formState.amount.value,\n totalPrice: formState.totalPrice.value,\n product: formState.product.value\n }));\n dispatch(addNotification(\"Order added\", \"Order \".concat(formState.name.value, \" added by you\")));\n dispatch(clearSelectedProduct());\n dispatch(changeProductAmount(selectedProduct.id, formState.amount.value));\n resetForm();\n }\n }\n\n function isFormInvalid() {\n return formState.amount.error || formState.totalPrice.error || formState.name.error || formState.product.error || !formState.name.value || !selectedProduct;\n }\n\n function getDisabledClass() {\n let isError = isFormInvalid();\n return isError ? \"disabled\" : \"\";\n }\n\n return React.createElement(Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 90\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card shadow mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 91\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card-header py-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 92\n },\n __self: this\n }, React.createElement(\"h6\", {\n className: \"m-0 font-weight-bold text-green\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 93\n },\n __self: this\n }, \"Upload\")), React.createElement(\"div\", {\n className: \"card-body\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 95\n },\n __self: this\n }, React.createElement(\"form\", {\n onSubmit: saveOrder,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 96\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 97\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-12\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 98\n },\n __self: this\n }, React.createElement(TextInput, {\n id: \"input_name\",\n value: formState.name.value,\n field: \"name\",\n onChange: hasFormValueChanged,\n required: true,\n maxLength: 20,\n label: \"Name\",\n placeholder: \"Name\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 99\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"form-group col-md-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 108\n },\n __self: this\n }, React.createElement(NumberInput, {\n id: \"input_amount\",\n value: formState.amount.value,\n field: \"amount\",\n onChange: hasAmountChanged,\n max: 1000,\n min: 0,\n label: \"Amount\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 109\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"form-group col-md-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 118\n },\n __self: this\n }, React.createElement(NumberInput, {\n id: \"input_totalPrice\",\n value: formState.totalPrice.value,\n field: \"totalPrice\",\n onChange: hasFormValueChanged,\n max: 1000,\n min: 0,\n label: \"Price\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 119\n },\n __self: this\n }))), React.createElement(\"button\", {\n type: \"submit\",\n className: \"btn btn-success left-margin \".concat(getDisabledClass()),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 129\n },\n __self: this\n }, \"Create\")))));\n};\n\nexport default OrderForm;","map":{"version":3,"sources":["/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Orders/OrderForm.tsx"],"names":["React","useState","Fragment","TextInput","NumberInput","useDispatch","useSelector","addOrder","addNotification","clearSelectedProduct","changeProductAmount","OrderForm","dispatch","selectedProduct","state","products","initialFormState","name","error","value","product","amount","totalPrice","formState","setFormState","hasAmountChanged","model","price","hasFormValueChanged","field","resetForm","saveOrder","e","preventDefault","isFormInvalid","saveForm","alert","id","getDisabledClass","isError"],"mappings":";;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAAqCC,QAArC,QAA+D,OAA/D;AAEA,OAAOC,SAAP,MAAsB,mCAAtB;AACA,OAAOC,WAAP,MAAwB,qCAAxB;AAEA,SAASC,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AACA,SAASC,QAAT,QAAyB,oCAAzB;AACA,SAASC,eAAT,QAAgC,0CAAhC;AACA,SAASC,oBAAT,EAA+BC,mBAA/B,QAA0D,qCAA1D;;AAGA,MAAMC,SAAmB,GAAG,MAAM;AAC9B,QAAMC,QAAuB,GAAGP,WAAW,EAA3C;AACA,QAAMQ,eAAgC,GAAGP,WAAW,CAAEQ,KAAD,IAAuBA,KAAK,CAACC,QAAN,CAAeF,eAAvC,CAApD;AACA,QAAMG,gBAAiC,GAAG;AACtCC,IAAAA,IAAI,EAAE;AAAEC,MAAAA,KAAK,EAAE,EAAT;AAAaC,MAAAA,KAAK,EAAE;AAApB,KADgC;AAEtCC,IAAAA,OAAO,EAAE;AAAEF,MAAAA,KAAK,EAAE,EAAT;AAAaC,MAAAA,KAAK,EAAE;AAApB,KAF6B;AAGtCE,IAAAA,MAAM,EAAE;AAAEH,MAAAA,KAAK,EAAE,EAAT;AAAaC,MAAAA,KAAK,EAAE;AAApB,KAH8B;AAItCG,IAAAA,UAAU,EAAE;AAAEJ,MAAAA,KAAK,EAAE,EAAT;AAAaC,MAAAA,KAAK,EAAE;AAApB;AAJ0B,GAA1C;;AAH8B,oBAUIlB,QAAQ,CAACe,gBAAD,CAVZ;AAAA;AAAA,QAUvBO,SAVuB;AAAA,QAUZC,YAVY;;AAY9B,WAASC,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;AAEI,IAAA,KAAK,EAAC,YAFV;AAGI,IAAA,QAAQ,EAAES,mBAHd;AAII,IAAA,GAAG,EAAE,IAJT;AAKI,IAAA,GAAG,EAAE,CALT;AAMI,IAAA,KAAK,EAAC,OANV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADJ,CArBJ,CADJ,EAiCI;AAAQ,IAAA,IAAI,EAAC,QAAb;AAAsB,IAAA,SAAS,wCAAiCU,gBAAgB,EAAjD,CAA/B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAjCJ,CADJ,CAJJ,CADJ,CADJ;AA8CH,CA3HD;;AA6HA,eAAe3B,SAAf","sourcesContent":["import React, { useState, FormEvent, Fragment, Dispatch } from \"react\";\nimport { IProduct } from \"../../store/models/product.interface\";\nimport TextInput from \"../../common/components/TextInput\";\nimport NumberInput from \"../../common/components/NumberInput\";\nimport { OnChangeModel, IOrderFormState } from \"../../common/types/Form.types\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { addOrder } from \"../../store/actions/orders.actions\";\nimport { addNotification } from \"../../store/actions/notifications.action\";\nimport { clearSelectedProduct, changeProductAmount } from \"../../store/actions/products.action\";\nimport { IStateType } from \"../../store/models/root.interface\";\n\nconst OrderForm: React.FC = () => {\n const dispatch: Dispatch<any> = useDispatch();\n const selectedProduct: IProduct | null = useSelector((state: IStateType) => state.products.selectedProduct);\n const initialFormState: IOrderFormState = {\n name: { error: \"\", value: \"\" },\n product: { error: \"\", value: null },\n amount: { error: \"\", value: 0 },\n totalPrice: { error: \"\", value: 0 },\n };\n\n const [formState, setFormState] = useState(initialFormState);\n\n function hasAmountChanged(model: OnChangeModel): void {\n let totalPrice: number = formState.totalPrice.value;\n if (selectedProduct) {\n totalPrice = selectedProduct.price * (model.value as number);\n }\n\n setFormState({\n ...formState,\n amount: { error: model.error, value: model.value as number },\n totalPrice: { error: model.error, value: totalPrice }\n });\n\n }\n\n function hasFormValueChanged(model: OnChangeModel): void {\n setFormState({ ...formState, [model.field]: { error: model.error, value: model.value } });\n }\n\n function resetForm(): void {\n setFormState(initialFormState);\n }\n\n function saveOrder(e: FormEvent<HTMLFormElement>): void {\n e.preventDefault();\n if (isFormInvalid()) {\n return;\n }\n\n saveForm(formState);\n }\n\n function saveForm(formState: IOrderFormState): void {\n if (selectedProduct) {\n if (selectedProduct.amount < formState.amount.value) {\n alert(\"Not enough products in warehouse\");\n return;\n }\n\n formState.product.value = selectedProduct;\n dispatch(addOrder({\n id: 0,\n name: formState.name.value,\n amount: formState.amount.value,\n totalPrice: formState.totalPrice.value,\n product: formState.product.value as IProduct\n }));\n\n dispatch(addNotification(\"Order added\", `Order ${formState.name.value} added by you`));\n dispatch(clearSelectedProduct());\n dispatch(changeProductAmount(selectedProduct.id, formState.amount.value));\n resetForm();\n }\n }\n\n function isFormInvalid(): boolean {\n return (formState.amount.error || formState.totalPrice.error\n || formState.name.error || formState.product.error || !formState.name.value\n || !selectedProduct) as boolean;\n }\n\n function getDisabledClass(): string {\n let isError: boolean = isFormInvalid();\n return isError ? \"disabled\" : \"\";\n }\n\n return (\n <Fragment>\n <div className=\"card shadow mb-4\">\n <div className=\"card-header py-3\">\n <h6 className=\"m-0 font-weight-bold text-green\">Upload</h6>\n </div>\n <div className=\"card-body\">\n <form onSubmit={saveOrder}>\n <div className=\"form-row\">\n <div className=\"form-group col-md-12\">\n <TextInput id=\"input_name\"\n value={formState.name.value}\n field=\"name\"\n onChange={hasFormValueChanged}\n required={true}\n maxLength={20}\n label=\"Name\"\n placeholder=\"Name\" />\n </div>\n <div className=\"form-group col-md-6\">\n <NumberInput id=\"input_amount\"\n value={formState.amount.value}\n field=\"amount\"\n onChange={hasAmountChanged}\n max={1000}\n min={0}\n label=\"Amount\" />\n </div>\n\n <div className=\"form-group col-md-6\">\n <NumberInput id=\"input_totalPrice\"\n value={formState.totalPrice.value}\n field=\"totalPrice\"\n onChange={hasFormValueChanged}\n max={1000}\n min={0}\n label=\"Price\" />\n </div>\n </div>\n {/* <button className=\"btn btn-danger\" onClick={() => resetForm()}>Reset</button> */}\n <button type=\"submit\" className={`btn btn-success left-margin ${getDisabledClass()}`}>Create</button>\n </form>\n </div>\n </div>\n </Fragment>\n );\n};\n\nexport default OrderForm;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/TopMenu/TopMenu.tsx\";\nimport React from \"react\";\nimport TopMenuAccount from \"./TopMenuAccount\";\nimport \"./TopMenu.css\";\nimport { useSelector } from \"react-redux\";\n\nconst TopMenu = () => {\n const page = useSelector(state => state.root.page);\n return React.createElement(\"nav\", {\n className: \"navbar navbar-expand navbar-light bg-custom-dark topbar mb-4 static-top shadow\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 11\n },\n __self: this\n }, React.createElement(\"ol\", {\n className: \"breadcrumb dark-breadcrumb\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 12\n },\n __self: this\n }, React.createElement(\"li\", {\n className: \"breadcrumb-item\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 13\n },\n __self: this\n }, React.createElement(\"a\", {\n href: \"# \",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 13\n },\n __self: this\n }, page ? page.area : null)), React.createElement(\"li\", {\n className: \"breadcrumb-item\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 14\n },\n __self: this\n }, React.createElement(\"a\", {\n href: \"# \",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 14\n },\n __self: this\n }, page ? page.subArea : null))), React.createElement(\"ul\", {\n className: \"navbar-nav ml-auto\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 17\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"topbar-divider d-none d-sm-block\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 18\n },\n __self: this\n }), React.createElement(TopMenuAccount, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 19\n },\n __self: this\n })));\n};\n\nexport default TopMenu;","map":{"version":3,"sources":["/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/TopMenu/TopMenu.tsx"],"names":["React","TopMenuAccount","useSelector","TopMenu","page","state","root","area","subArea"],"mappings":";AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,cAAP,MAA2B,kBAA3B;AACA,OAAO,eAAP;AACA,SAASC,WAAT,QAA4B,aAA5B;;AAGA,MAAMC,OAAiB,GAAG,MAAM;AAC9B,QAAMC,IAAwB,GAAGF,WAAW,CAAEG,KAAD,IAAuBA,KAAK,CAACC,IAAN,CAAWF,IAAnC,CAA5C;AAEA,SACE;AAAK,IAAA,SAAS,EAAC,gFAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACE;AAAI,IAAA,SAAS,EAAC,4BAAd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACE;AAAI,IAAA,SAAS,EAAC,iBAAd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAgC;AAAG,IAAA,IAAI,EAAC,IAAR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAcA,IAAI,GAAGA,IAAI,CAACG,IAAR,GAAe,IAAjC,CAAhC,CADF,EAEE;AAAI,IAAA,SAAS,EAAC,iBAAd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAgC;AAAG,IAAA,IAAI,EAAC,IAAR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAcH,IAAI,GAAGA,IAAI,CAACI,OAAR,GAAkB,IAApC,CAAhC,CAFF,CADF,EAME;AAAI,IAAA,SAAS,EAAC,oBAAd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACE;AAAK,IAAA,SAAS,EAAC,kCAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADF,EAEE,oBAAC,cAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAFF,CANF,CADF;AAaD,CAhBD;;AAkBA,eAAeL,OAAf","sourcesContent":["import React from \"react\";\nimport TopMenuAccount from \"./TopMenuAccount\";\nimport \"./TopMenu.css\";\nimport { useSelector } from \"react-redux\";\nimport { IStateType, IRootPageStateType } from \"../../store/models/root.interface\";\n\nconst TopMenu: React.FC = () => {\n const page: IRootPageStateType = useSelector((state: IStateType) => state.root.page);\n\n return (\n <nav className=\"navbar navbar-expand navbar-light bg-custom-dark topbar mb-4 static-top shadow\">\n <ol className=\"breadcrumb dark-breadcrumb\">\n <li className=\"breadcrumb-item\"><a href=\"# \">{page ? page.area : null}</a></li>\n <li className=\"breadcrumb-item\"><a href=\"# \">{page ? page.subArea : null}</a></li>\n </ol>\n\n <ul className=\"navbar-nav ml-auto\">\n <div className=\"topbar-divider d-none d-sm-block\"></div>\n <TopMenuAccount />\n </ul>\n </nav>\n );\n};\n\nexport default TopMenu;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"'use strict';\n\nmodule.exports = options => {\n options = Object.assign({\n onlyFirst: false\n }, options);\n const pattern = ['[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:[a-zA-Z\\\\d]*(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)', '(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TZcf-ntqry=><~]))'].join('|');\n return new RegExp(pattern, options.onlyFirst ? undefined : 'g');\n};","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"'use strict';\n\nvar EventEmitter = require('events').EventEmitter,\n inherits = require('inherits');\n\nfunction XHRFake()\n/* method, url, payload, opts */\n{\n var self = this;\n EventEmitter.call(this);\n this.to = setTimeout(function () {\n self.emit('finish', 200, '{}');\n }, XHRFake.timeout);\n}\n\ninherits(XHRFake, EventEmitter);\n\nXHRFake.prototype.close = function () {\n clearTimeout(this.to);\n};\n\nXHRFake.timeout = 2000;\nmodule.exports = XHRFake;","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"import _defineProperty from \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/defineProperty\";\nimport _slicedToArray from \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/slicedToArray\";\nvar _jsxFileName = \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Products/ProductsForm.tsx\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nimport React, { useState, Fragment } from \"react\";\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { ProductModificationStatus } from \"../../store/models/product.interface\";\nimport TextInput from \"../../common/components/TextInput\";\nimport { editProduct, clearSelectedProduct, setModificationState, addProduct } from \"../../store/actions/products.action\";\nimport { addNotification } from \"../../store/actions/notifications.action\";\nimport SelectInput from \"../../common/components/Select\";\n\nconst ProductForm = () => {\n const dispatch = useDispatch();\n const products = useSelector(state => state.products);\n let product = products.selectedProduct;\n const isCreate = products.modificationState === ProductModificationStatus.Create;\n\n if (!product || isCreate) {\n product = {\n id: 0,\n name: \"\",\n description: \"\",\n amount: 0,\n price: 0,\n hasExpiryDate: false,\n category: \"\"\n };\n }\n\n const _useState = useState({\n name: {\n error: \"\",\n value: product.name\n },\n description: {\n error: \"\",\n value: product.description\n },\n amount: {\n error: \"\",\n value: product.amount\n },\n price: {\n error: \"\",\n value: product.price\n },\n hasExpiryDate: {\n error: \"\",\n value: product.hasExpiryDate\n },\n category: {\n error: \"\",\n value: product.category\n }\n }),\n _useState2 = _slicedToArray(_useState, 2),\n formState = _useState2[0],\n setFormState = _useState2[1];\n\n function hasFormValueChanged(model) {\n setFormState(_objectSpread({}, formState, {\n [model.field]: {\n error: model.error,\n value: model.value\n }\n }));\n }\n\n function saveUser(e) {\n e.preventDefault();\n\n if (isFormInvalid()) {\n return;\n }\n\n let saveUserFn = isCreate ? addProduct : editProduct;\n saveForm(formState, saveUserFn);\n }\n\n function saveForm(formState, saveFn) {\n if (product) {\n dispatch(saveFn(_objectSpread({}, product, {\n name: formState.name.value,\n description: formState.description.value,\n price: formState.price.value,\n amount: formState.amount.value,\n hasExpiryDate: formState.hasExpiryDate.value,\n category: formState.category.value\n })));\n dispatch(addNotification(\"Product edited\", \"Product \".concat(formState.name.value, \" edited by you\")));\n dispatch(clearSelectedProduct());\n dispatch(setModificationState(ProductModificationStatus.None));\n }\n }\n\n function cancelForm() {\n dispatch(setModificationState(ProductModificationStatus.None));\n }\n\n function getDisabledClass() {\n let isError = isFormInvalid();\n return isError ? \"disabled\" : \"\";\n }\n\n function isFormInvalid() {\n return formState.amount.error || formState.description.error || formState.name.error || formState.price.error || formState.hasExpiryDate.error || formState.category.error || !formState.name.value || !formState.category.value;\n }\n\n return React.createElement(Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 80\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"col-xl-7 col-lg-7\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 81\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card shadow mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 82\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card-header py-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 83\n },\n __self: this\n }, React.createElement(\"h6\", {\n className: \"m-0 font-weight-bold text-green\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 84\n },\n __self: this\n }, \"Product \", isCreate ? \"create\" : \"edit\")), React.createElement(\"div\", {\n className: \"card-body\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 86\n },\n __self: this\n }, React.createElement(\"form\", {\n onSubmit: saveUser,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 87\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 88\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 89\n },\n __self: this\n }, React.createElement(TextInput, {\n id: \"input_email\",\n value: formState.name.value,\n field: \"name\",\n onChange: hasFormValueChanged,\n required: true,\n maxLength: 20,\n label: \"Name\",\n placeholder: \"Name\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 90\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"form-group col-md-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 99\n },\n __self: this\n }, React.createElement(SelectInput, {\n id: \"input_category\",\n field: \"category\",\n label: \"Category\",\n options: [\"Ayurveda\", \"Homeopath\", \"Dentist\", \"General Medicine\"],\n required: true,\n onChange: hasFormValueChanged,\n value: formState.category.value,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 100\n },\n __self: this\n }))), React.createElement(\"div\", {\n className: \"form-group\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 111\n },\n __self: this\n }, React.createElement(TextInput, {\n id: \"input_description\",\n field: \"description\",\n value: formState.description.value,\n onChange: hasFormValueChanged,\n required: false,\n maxLength: 100,\n label: \"Description\",\n placeholder: \"Description\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 112\n },\n __self: this\n })), React.createElement(\"button\", {\n className: \"btn btn-danger\",\n onClick: () => cancelForm(),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 150\n },\n __self: this\n }, \"Cancel\"), React.createElement(\"button\", {\n type: \"submit\",\n className: \"btn btn-success left-margin \".concat(getDisabledClass()),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 151\n },\n __self: this\n }, \"Save\"))))));\n};\n\nexport default ProductForm;","map":{"version":3,"sources":["/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Products/ProductsForm.tsx"],"names":["React","useState","Fragment","useSelector","useDispatch","ProductModificationStatus","TextInput","editProduct","clearSelectedProduct","setModificationState","addProduct","addNotification","SelectInput","ProductForm","dispatch","products","state","product","selectedProduct","isCreate","modificationState","Create","id","name","description","amount","price","hasExpiryDate","category","error","value","formState","setFormState","hasFormValueChanged","model","field","saveUser","e","preventDefault","isFormInvalid","saveUserFn","saveForm","saveFn","None","cancelForm","getDisabledClass","isError"],"mappings":";;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA+CC,QAA/C,QAA+D,OAA/D;AAEA,SAASC,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AACA,SAAmBC,yBAAnB,QAAoD,sCAApD;AACA,OAAOC,SAAP,MAAsB,mCAAtB;AACA,SAASC,WAAT,EAAsBC,oBAAtB,EAA4CC,oBAA5C,EAAkEC,UAAlE,QAAoF,qCAApF;AACA,SAASC,eAAT,QAAgC,0CAAhC;AAGA,OAAOC,WAAP,MAAwB,gCAAxB;;AAGA,MAAMC,WAAqB,GAAG,MAAM;AAClC,QAAMC,QAAuB,GAAGV,WAAW,EAA3C;AACA,QAAMW,QAA8B,GAAGZ,WAAW,CAAEa,KAAD,IAAuBA,KAAK,CAACD,QAA9B,CAAlD;AACA,MAAIE,OAAwB,GAAGF,QAAQ,CAACG,eAAxC;AACA,QAAMC,QAAiB,GAAIJ,QAAQ,CAACK,iBAAT,KAA+Bf,yBAAyB,CAACg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AAA,cA/DF,EAgEE;AAAQ,IAAA,IAAI,EAAC,QAAb;AAAsB,IAAA,SAAS,wCAAiCC,gBAAgB,EAAjD,CAA/B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAhEF,CADF,CAJF,CADF,CADF,CADF;AA+ED,CAjJD;;AAmJA,eAAehC,WAAf","sourcesContent":["import React, { useState, FormEvent, Dispatch, Fragment } from \"react\";\nimport { IStateType, IProductState } from \"../../store/models/root.interface\";\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { IProduct, ProductModificationStatus } from \"../../store/models/product.interface\";\nimport TextInput from \"../../common/components/TextInput\";\nimport { editProduct, clearSelectedProduct, setModificationState, addProduct } from \"../../store/actions/products.action\";\nimport { addNotification } from \"../../store/actions/notifications.action\";\nimport NumberInput from \"../../common/components/NumberInput\";\nimport Checkbox from \"../../common/components/Checkbox\";\nimport SelectInput from \"../../common/components/Select\";\nimport { OnChangeModel, IProductFormState } from \"../../common/types/Form.types\";\n\nconst ProductForm: React.FC = () => {\n const dispatch: Dispatch<any> = useDispatch();\n const products: IProductState | null = useSelector((state: IStateType) => state.products);\n let product: IProduct | null = products.selectedProduct;\n const isCreate: boolean = (products.modificationState === ProductModificationStatus.Create);\n \n if (!product || isCreate) {\n product = { id: 0, name: \"\", description: \"\", amount: 0, price: 0, hasExpiryDate: false, category: \"\" };\n }\n\n const [formState, setFormState] = useState({\n name: { error: \"\", value: product.name },\n description: { error: \"\", value: product.description },\n amount: { error: \"\", value: product.amount },\n price: { error: \"\", value: product.price },\n hasExpiryDate: { error: \"\", value: product.hasExpiryDate },\n category: { error: \"\", value: product.category }\n });\n\n function hasFormValueChanged(model: OnChangeModel): void {\n setFormState({ ...formState, [model.field]: { error: model.error, value: model.value } });\n }\n\n function saveUser(e: FormEvent<HTMLFormElement>): void {\n e.preventDefault();\n if (isFormInvalid()) {\n return;\n }\n\n let saveUserFn: Function = (isCreate) ? addProduct : editProduct;\n saveForm(formState, saveUserFn);\n }\n\n function saveForm(formState: IProductFormState, saveFn: Function): void {\n if (product) {\n dispatch(saveFn({\n ...product,\n name: formState.name.value,\n description: formState.description.value,\n price: formState.price.value,\n amount: formState.amount.value,\n hasExpiryDate: formState.hasExpiryDate.value,\n category: formState.category.value\n }));\n\n dispatch(addNotification(\"Product edited\", `Product ${formState.name.value} edited by you`));\n dispatch(clearSelectedProduct());\n dispatch(setModificationState(ProductModificationStatus.None));\n }\n }\n\n function cancelForm(): void {\n dispatch(setModificationState(ProductModificationStatus.None));\n }\n\n function getDisabledClass(): string {\n let isError: boolean = isFormInvalid();\n return isError ? \"disabled\" : \"\";\n }\n\n function isFormInvalid(): boolean {\n return (formState.amount.error || formState.description.error\n || formState.name.error || formState.price.error || formState.hasExpiryDate.error\n || formState.category.error || !formState.name.value || !formState.category.value) as boolean;\n}\n\n return (\n <Fragment>\n <div className=\"col-xl-7 col-lg-7\">\n <div className=\"card shadow mb-4\">\n <div className=\"card-header py-3\">\n <h6 className=\"m-0 font-weight-bold text-green\">Product {(isCreate ? \"create\" : \"edit\")}</h6>\n </div>\n <div className=\"card-body\">\n <form onSubmit={saveUser}>\n <div className=\"form-row\">\n <div className=\"form-group col-md-6\">\n <TextInput id=\"input_email\"\n value={formState.name.value}\n field=\"name\"\n onChange={hasFormValueChanged}\n required={true}\n maxLength={20}\n label=\"Name\"\n placeholder=\"Name\" />\n </div>\n <div className=\"form-group col-md-6\">\n <SelectInput\n id=\"input_category\"\n field=\"category\"\n label=\"Category\"\n options={[\"Ayurveda\", \"Homeopath\", \"Dentist\", \"General Medicine\"]}\n required={true}\n onChange={hasFormValueChanged}\n value={formState.category.value}\n />\n </div>\n </div>\n <div className=\"form-group\">\n <TextInput id=\"input_description\"\n field = \"description\"\n value={formState.description.value}\n onChange={hasFormValueChanged}\n required={false}\n maxLength={100}\n label=\"Description\"\n placeholder=\"Description\" />\n </div>\n {/* <div className=\"form-row\">\n <div className=\"form-group col-md-6\">\n <NumberInput id=\"input_amount\"\n value={formState.amount.value}\n field=\"amount\"\n onChange={hasFormValueChanged}\n max={1000}\n min={0}\n label=\"Amount\" />\n </div>\n <div className=\"form-group col-md-6\">\n <NumberInput id=\"input_price\"\n value={formState.price.value}\n field=\"price\"\n onChange={hasFormValueChanged}\n max={1000}\n min={0}\n label=\"Price\" />\n </div>\n </div>\n <div className=\"form-group\">\n <Checkbox\n id=\"checkbox_expiry\"\n field=\"hasExpiryDate\"\n value={formState.hasExpiryDate.value}\n label=\"Has expiry date\"\n onChange={hasFormValueChanged}\n />\n </div> */}\n <button className=\"btn btn-danger\" onClick={() => cancelForm()}>Cancel</button>\n <button type=\"submit\" className={`btn btn-success left-margin ${getDisabledClass()}`}>Save</button>\n </form>\n </div>\n </div>\n </div>\n </Fragment>\n );\n};\n\nexport default ProductForm;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"import $$observable from 'symbol-observable';\n/**\n * These are private action types reserved by Redux.\n * For any unknown actions, you must return the current state.\n * If the current state is undefined, you must return the initial state.\n * Do not reference these action types directly in your code.\n */\n\nvar randomString = function randomString() {\n return Math.random().toString(36).substring(7).split('').join('.');\n};\n\nvar ActionTypes = {\n INIT: \"@@redux/INIT\" + randomString(),\n REPLACE: \"@@redux/REPLACE\" + randomString(),\n PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {\n return \"@@redux/PROBE_UNKNOWN_ACTION\" + randomString();\n }\n};\n/**\n * @param {any} obj The object to inspect.\n * @returns {boolean} True if the argument appears to be a plain object.\n */\n\nfunction isPlainObject(obj) {\n if (typeof obj !== 'object' || obj === null) return false;\n var proto = obj;\n\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n\n return Object.getPrototypeOf(obj) === proto;\n}\n/**\n * Creates a Redux store that holds the state tree.\n * The only way to change the data in the store is to call `dispatch()` on it.\n *\n * There should only be a single store in your app. To specify how different\n * parts of the state tree respond to actions, you may combine several reducers\n * into a single reducer function by using `combineReducers`.\n *\n * @param {Function} reducer A function that returns the next state tree, given\n * the current state tree and the action to handle.\n *\n * @param {any} [preloadedState] The initial state. You may optionally specify it\n * to hydrate the state from the server in universal apps, or to restore a\n * previously serialized user session.\n * If you use `combineReducers` to produce the root reducer function, this must be\n * an object with the same shape as `combineReducers` keys.\n *\n * @param {Function} [enhancer] The store enhancer. You may optionally specify it\n * to enhance the store with third-party capabilities such as middleware,\n * time travel, persistence, etc. The only store enhancer that ships with Redux\n * is `applyMiddleware()`.\n *\n * @returns {Store} A Redux store that lets you read the state, dispatch actions\n * and subscribe to changes.\n */\n\n\nfunction createStore(reducer, preloadedState, enhancer) {\n var _ref2;\n\n if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {\n throw new Error('It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function.');\n }\n\n if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {\n enhancer = preloadedState;\n preloadedState = undefined;\n }\n\n if (typeof enhancer !== 'undefined') {\n if (typeof enhancer !== 'function') {\n throw new Error('Expected the enhancer to be a function.');\n }\n\n return enhancer(createStore)(reducer, preloadedState);\n }\n\n if (typeof reducer !== 'function') {\n throw new Error('Expected the reducer to be a function.');\n }\n\n var currentReducer = reducer;\n var currentState = preloadedState;\n var currentListeners = [];\n var nextListeners = currentListeners;\n var isDispatching = false;\n /**\n * This makes a shallow copy of currentListeners so we can use\n * nextListeners as a temporary list while dispatching.\n *\n * This prevents any bugs around consumers calling\n * subscribe/unsubscribe in the middle of a dispatch.\n */\n\n function ensureCanMutateNextListeners() {\n if (nextListeners === currentListeners) {\n nextListeners = currentListeners.slice();\n }\n }\n /**\n * Reads the state tree managed by the store.\n *\n * @returns {any} The current state tree of your application.\n */\n\n\n function getState() {\n if (isDispatching) {\n throw new Error('You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');\n }\n\n return currentState;\n }\n /**\n * Adds a change listener. It will be called any time an action is dispatched,\n * and some part of the state tree may potentially have changed. You may then\n * call `getState()` to read the current state tree inside the callback.\n *\n * You may call `dispatch()` from a change listener, with the following\n * caveats:\n *\n * 1. The subscriptions are snapshotted just before every `dispatch()` call.\n * If you subscribe or unsubscribe while the listeners are being invoked, this\n * will not have any effect on the `dispatch()` that is currently in progress.\n * However, the next `dispatch()` call, whether nested or not, will use a more\n * recent snapshot of the subscription list.\n *\n * 2. The listener should not expect to see all state changes, as the state\n * might have been updated multiple times during a nested `dispatch()` before\n * the listener is called. It is, however, guaranteed that all subscribers\n * registered before the `dispatch()` started will be called with the latest\n * state by the time it exits.\n *\n * @param {Function} listener A callback to be invoked on every dispatch.\n * @returns {Function} A function to remove this change listener.\n */\n\n\n function subscribe(listener) {\n if (typeof listener !== 'function') {\n throw new Error('Expected the listener to be a function.');\n }\n\n if (isDispatching) {\n throw new Error('You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.');\n }\n\n var isSubscribed = true;\n ensureCanMutateNextListeners();\n nextListeners.push(listener);\n return function unsubscribe() {\n if (!isSubscribed) {\n return;\n }\n\n if (isDispatching) {\n throw new Error('You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.');\n }\n\n isSubscribed = false;\n ensureCanMutateNextListeners();\n var index = nextListeners.indexOf(listener);\n nextListeners.splice(index, 1);\n };\n }\n /**\n * Dispatches an action. It is the only way to trigger a state change.\n *\n * The `reducer` function, used to create the store, will be called with the\n * current state tree and the given `action`. Its return value will\n * be considered the **next** state of the tree, and the change listeners\n * will be notified.\n *\n * The base implementation only supports plain object actions. If you want to\n * dispatch a Promise, an Observable, a thunk, or something else, you need to\n * wrap your store creating function into the corresponding middleware. For\n * example, see the documentation for the `redux-thunk` package. Even the\n * middleware will eventually dispatch plain object actions using this method.\n *\n * @param {Object} action A plain object representing “what changed”. It is\n * a good idea to keep actions serializable so you can record and replay user\n * sessions, or use the time travelling `redux-devtools`. An action must have\n * a `type` property which may not be `undefined`. It is a good idea to use\n * string constants for action types.\n *\n * @returns {Object} For convenience, the same action object you dispatched.\n *\n * Note that, if you use a custom middleware, it may wrap `dispatch()` to\n * return something else (for example, a Promise you can await).\n */\n\n\n function dispatch(action) {\n if (!isPlainObject(action)) {\n throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');\n }\n\n if (typeof action.type === 'undefined') {\n throw new Error('Actions may not have an undefined \"type\" property. ' + 'Have you misspelled a constant?');\n }\n\n if (isDispatching) {\n throw new Error('Reducers may not dispatch actions.');\n }\n\n try {\n isDispatching = true;\n currentState = currentReducer(currentState, action);\n } finally {\n isDispatching = false;\n }\n\n var listeners = currentListeners = nextListeners;\n\n for (var i = 0; i < listeners.length; i++) {\n var listener = listeners[i];\n listener();\n }\n\n return action;\n }\n /**\n * Replaces the reducer currently used by the store to calculate the state.\n *\n * You might need this if your app implements code splitting and you want to\n * load some of the reducers dynamically. You might also need this if you\n * implement a hot reloading mechanism for Redux.\n *\n * @param {Function} nextReducer The reducer for the store to use instead.\n * @returns {void}\n */\n\n\n function replaceReducer(nextReducer) {\n if (typeof nextReducer !== 'function') {\n throw new Error('Expected the nextReducer to be a function.');\n }\n\n currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.\n // Any reducers that existed in both the new and old rootReducer\n // will receive the previous state. This effectively populates\n // the new state tree with any relevant data from the old one.\n\n dispatch({\n type: ActionTypes.REPLACE\n });\n }\n /**\n * Interoperability point for observable/reactive libraries.\n * @returns {observable} A minimal observable of state changes.\n * For more information, see the observable proposal:\n * https://github.com/tc39/proposal-observable\n */\n\n\n function observable() {\n var _ref;\n\n var outerSubscribe = subscribe;\n return _ref = {\n /**\n * The minimal observable subscription method.\n * @param {Object} observer Any object that can be used as an observer.\n * The observer object should have a `next` method.\n * @returns {subscription} An object with an `unsubscribe` method that can\n * be used to unsubscribe the observable from the store, and prevent further\n * emission of values from the observable.\n */\n subscribe: function subscribe(observer) {\n if (typeof observer !== 'object' || observer === null) {\n throw new TypeError('Expected the observer to be an object.');\n }\n\n function observeState() {\n if (observer.next) {\n observer.next(getState());\n }\n }\n\n observeState();\n var unsubscribe = outerSubscribe(observeState);\n return {\n unsubscribe: unsubscribe\n };\n }\n }, _ref[$$observable] = function () {\n return this;\n }, _ref;\n } // When a store is created, an \"INIT\" action is dispatched so that every\n // reducer returns their initial state. This effectively populates\n // the initial state tree.\n\n\n dispatch({\n type: ActionTypes.INIT\n });\n return _ref2 = {\n dispatch: dispatch,\n subscribe: subscribe,\n getState: getState,\n replaceReducer: replaceReducer\n }, _ref2[$$observable] = observable, _ref2;\n}\n/**\n * Prints a warning in the console if it exists.\n *\n * @param {String} message The warning message.\n * @returns {void}\n */\n\n\nfunction warning(message) {\n /* eslint-disable no-console */\n if (typeof console !== 'undefined' && typeof console.error === 'function') {\n console.error(message);\n }\n /* eslint-enable no-console */\n\n\n try {\n // This error was thrown as a convenience so that if you enable\n // \"break on all exceptions\" in your console,\n // it would pause the execution at this line.\n throw new Error(message);\n } catch (e) {} // eslint-disable-line no-empty\n\n}\n\nfunction getUndefinedStateErrorMessage(key, action) {\n var actionType = action && action.type;\n var actionDescription = actionType && \"action \\\"\" + String(actionType) + \"\\\"\" || 'an action';\n return \"Given \" + actionDescription + \", reducer \\\"\" + key + \"\\\" returned undefined. \" + \"To ignore an action, you must explicitly return the previous state. \" + \"If you want this reducer to hold no value, you can return null instead of undefined.\";\n}\n\nfunction getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {\n var reducerKeys = Object.keys(reducers);\n var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';\n\n if (reducerKeys.length === 0) {\n return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';\n }\n\n if (!isPlainObject(inputState)) {\n return \"The \" + argumentName + \" has unexpected type of \\\"\" + {}.toString.call(inputState).match(/\\s([a-z|A-Z]+)/)[1] + \"\\\". Expected argument to be an object with the following \" + (\"keys: \\\"\" + reducerKeys.join('\", \"') + \"\\\"\");\n }\n\n var unexpectedKeys = Object.keys(inputState).filter(function (key) {\n return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];\n });\n unexpectedKeys.forEach(function (key) {\n unexpectedKeyCache[key] = true;\n });\n if (action && action.type === ActionTypes.REPLACE) return;\n\n if (unexpectedKeys.length > 0) {\n return \"Unexpected \" + (unexpectedKeys.length > 1 ? 'keys' : 'key') + \" \" + (\"\\\"\" + unexpectedKeys.join('\", \"') + \"\\\" found in \" + argumentName + \". \") + \"Expected to find one of the known reducer keys instead: \" + (\"\\\"\" + reducerKeys.join('\", \"') + \"\\\". Unexpected keys will be ignored.\");\n }\n}\n\nfunction assertReducerShape(reducers) {\n Object.keys(reducers).forEach(function (key) {\n var reducer = reducers[key];\n var initialState = reducer(undefined, {\n type: ActionTypes.INIT\n });\n\n if (typeof initialState === 'undefined') {\n throw new Error(\"Reducer \\\"\" + key + \"\\\" returned undefined during initialization. \" + \"If the state passed to the reducer is undefined, you must \" + \"explicitly return the initial state. The initial state may \" + \"not be undefined. If you don't want to set a value for this reducer, \" + \"you can use null instead of undefined.\");\n }\n\n if (typeof reducer(undefined, {\n type: ActionTypes.PROBE_UNKNOWN_ACTION()\n }) === 'undefined') {\n throw new Error(\"Reducer \\\"\" + key + \"\\\" returned undefined when probed with a random type. \" + (\"Don't try to handle \" + ActionTypes.INIT + \" or other actions in \\\"redux/*\\\" \") + \"namespace. They are considered private. Instead, you must return the \" + \"current state for any unknown actions, unless it is undefined, \" + \"in which case you must return the initial state, regardless of the \" + \"action type. The initial state may not be undefined, but can be null.\");\n }\n });\n}\n/**\n * Turns an object whose values are different reducer functions, into a single\n * reducer function. It will call every child reducer, and gather their results\n * into a single state object, whose keys correspond to the keys of the passed\n * reducer functions.\n *\n * @param {Object} reducers An object whose values correspond to different\n * reducer functions that need to be combined into one. One handy way to obtain\n * it is to use ES6 `import * as reducers` syntax. The reducers may never return\n * undefined for any action. Instead, they should return their initial state\n * if the state passed to them was undefined, and the current state for any\n * unrecognized action.\n *\n * @returns {Function} A reducer function that invokes every reducer inside the\n * passed object, and builds a state object with the same shape.\n */\n\n\nfunction combineReducers(reducers) {\n var reducerKeys = Object.keys(reducers);\n var finalReducers = {};\n\n for (var i = 0; i < reducerKeys.length; i++) {\n var key = reducerKeys[i];\n\n if (process.env.NODE_ENV !== 'production') {\n if (typeof reducers[key] === 'undefined') {\n warning(\"No reducer provided for key \\\"\" + key + \"\\\"\");\n }\n }\n\n if (typeof reducers[key] === 'function') {\n finalReducers[key] = reducers[key];\n }\n }\n\n var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same\n // keys multiple times.\n\n var unexpectedKeyCache;\n\n if (process.env.NODE_ENV !== 'production') {\n unexpectedKeyCache = {};\n }\n\n var shapeAssertionError;\n\n try {\n assertReducerShape(finalReducers);\n } catch (e) {\n shapeAssertionError = e;\n }\n\n return function combination(state, action) {\n if (state === void 0) {\n state = {};\n }\n\n if (shapeAssertionError) {\n throw shapeAssertionError;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);\n\n if (warningMessage) {\n warning(warningMessage);\n }\n }\n\n var hasChanged = false;\n var nextState = {};\n\n for (var _i = 0; _i < finalReducerKeys.length; _i++) {\n var _key = finalReducerKeys[_i];\n var reducer = finalReducers[_key];\n var previousStateForKey = state[_key];\n var nextStateForKey = reducer(previousStateForKey, action);\n\n if (typeof nextStateForKey === 'undefined') {\n var errorMessage = getUndefinedStateErrorMessage(_key, action);\n throw new Error(errorMessage);\n }\n\n nextState[_key] = nextStateForKey;\n hasChanged = hasChanged || nextStateForKey !== previousStateForKey;\n }\n\n return hasChanged ? nextState : state;\n };\n}\n\nfunction bindActionCreator(actionCreator, dispatch) {\n return function () {\n return dispatch(actionCreator.apply(this, arguments));\n };\n}\n/**\n * Turns an object whose values are action creators, into an object with the\n * same keys, but with every function wrapped into a `dispatch` call so they\n * may be invoked directly. This is just a convenience method, as you can call\n * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.\n *\n * For convenience, you can also pass an action creator as the first argument,\n * and get a dispatch wrapped function in return.\n *\n * @param {Function|Object} actionCreators An object whose values are action\n * creator functions. One handy way to obtain it is to use ES6 `import * as`\n * syntax. You may also pass a single function.\n *\n * @param {Function} dispatch The `dispatch` function available on your Redux\n * store.\n *\n * @returns {Function|Object} The object mimicking the original object, but with\n * every action creator wrapped into the `dispatch` call. If you passed a\n * function as `actionCreators`, the return value will also be a single\n * function.\n */\n\n\nfunction bindActionCreators(actionCreators, dispatch) {\n if (typeof actionCreators === 'function') {\n return bindActionCreator(actionCreators, dispatch);\n }\n\n if (typeof actionCreators !== 'object' || actionCreators === null) {\n throw new Error(\"bindActionCreators expected an object or a function, instead received \" + (actionCreators === null ? 'null' : typeof actionCreators) + \". \" + \"Did you write \\\"import ActionCreators from\\\" instead of \\\"import * as ActionCreators from\\\"?\");\n }\n\n var boundActionCreators = {};\n\n for (var key in actionCreators) {\n var actionCreator = actionCreators[key];\n\n if (typeof actionCreator === 'function') {\n boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);\n }\n }\n\n return boundActionCreators;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n keys.push.apply(keys, Object.getOwnPropertySymbols(object));\n }\n\n if (enumerableOnly) keys = keys.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(source, true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(source).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n/**\n * Composes single-argument functions from right to left. The rightmost\n * function can take multiple arguments as it provides the signature for\n * the resulting composite function.\n *\n * @param {...Function} funcs The functions to compose.\n * @returns {Function} A function obtained by composing the argument functions\n * from right to left. For example, compose(f, g, h) is identical to doing\n * (...args) => f(g(h(...args))).\n */\n\n\nfunction compose() {\n for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {\n funcs[_key] = arguments[_key];\n }\n\n if (funcs.length === 0) {\n return function (arg) {\n return arg;\n };\n }\n\n if (funcs.length === 1) {\n return funcs[0];\n }\n\n return funcs.reduce(function (a, b) {\n return function () {\n return a(b.apply(void 0, arguments));\n };\n });\n}\n/**\n * Creates a store enhancer that applies middleware to the dispatch method\n * of the Redux store. This is handy for a variety of tasks, such as expressing\n * asynchronous actions in a concise manner, or logging every action payload.\n *\n * See `redux-thunk` package as an example of the Redux middleware.\n *\n * Because middleware is potentially asynchronous, this should be the first\n * store enhancer in the composition chain.\n *\n * Note that each middleware will be given the `dispatch` and `getState` functions\n * as named arguments.\n *\n * @param {...Function} middlewares The middleware chain to be applied.\n * @returns {Function} A store enhancer applying the middleware.\n */\n\n\nfunction applyMiddleware() {\n for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {\n middlewares[_key] = arguments[_key];\n }\n\n return function (createStore) {\n return function () {\n var store = createStore.apply(void 0, arguments);\n\n var _dispatch = function dispatch() {\n throw new Error('Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');\n };\n\n var middlewareAPI = {\n getState: store.getState,\n dispatch: function dispatch() {\n return _dispatch.apply(void 0, arguments);\n }\n };\n var chain = middlewares.map(function (middleware) {\n return middleware(middlewareAPI);\n });\n _dispatch = compose.apply(void 0, chain)(store.dispatch);\n return _objectSpread2({}, store, {\n dispatch: _dispatch\n });\n };\n };\n}\n/*\n * This is a dummy function to check if the function name has been altered by minification.\n * If the function has been minified and NODE_ENV !== 'production', warn the user.\n */\n\n\nfunction isCrushed() {}\n\nif (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {\n warning('You are currently using minified code outside of NODE_ENV === \"production\". ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.');\n}\n\nexport { ActionTypes as __DO_NOT_USE__ActionTypes, applyMiddleware, bindActionCreators, combineReducers, compose, createStore };","map":null,"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\src\\\\components\\\\Orders\\\\OrderList.tsx\";\nimport React from \"react\";\nimport { useSelector } from \"react-redux\";\n\nconst OrderList = () => {\n const orders = useSelector(state => state.orders.orders);\n const orderList = orders.map(order => {\n return React.createElement(\"tr\", {\n className: \"table-row\",\n key: \"order_\".concat(order.id),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 11\n },\n __self: this\n }, React.createElement(\"th\", {\n scope: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 13\n },\n __self: this\n }, order.id), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 14\n },\n __self: this\n }, order.name), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 15\n },\n __self: this\n }, order.result), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 16\n },\n __self: this\n }, order.unit), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 17\n },\n __self: this\n }, order.refRange));\n });\n return React.createElement(\"div\", {\n className: \"table-responsive portlet\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 22\n },\n __self: this\n }, React.createElement(\"table\", {\n className: \"table\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 23\n },\n __self: this\n }, React.createElement(\"thead\", {\n className: \"thead-light\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 24\n },\n __self: this\n }, React.createElement(\"tr\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 25\n },\n __self: this\n }, React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 26\n },\n __self: this\n }, \"#\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 27\n },\n __self: this\n }, \"Name\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 28\n },\n __self: this\n }, \"Result\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 29\n },\n __self: this\n }, \"unit\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 30\n },\n __self: this\n }, \"Range\"))), React.createElement(\"tbody\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 33\n },\n __self: this\n }, orderList)));\n};\n\nexport default OrderList;","map":{"version":3,"sources":["D:/FYP/Update/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Orders/OrderList.tsx"],"names":["React","useSelector","OrderList","orders","state","orderList","map","order","id","name","result","unit","refRange"],"mappings":";AAAA,OAAOA,KAAP,MAAuB,OAAvB;AACA,SAASC,WAAT,QAA4B,aAA5B;;AAIA,MAAMC,SAAmB,GAAG,MAAM;AAC9B,QAAMC,MAAgB,GAAGF,WAAW,CAA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AAAA,YAJJ,EAKI;AAAI,IAAA,KAAK,EAAC,KAAV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aALJ,CADJ,CADJ,EAUI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACKP,SADL,CAVJ,CADJ,CADJ;AAkBH,CAjCD;;AAmCA,eAAeH,SAAf","sourcesContent":["import React, { } from \"react\";\nimport { useSelector } from \"react-redux\";\nimport { IOrder } from \"../../store/models/order.interface\";\nimport { IStateType } from \"../../store/models/root.interface\";\n\nconst OrderList: React.FC = () => {\n const orders: IOrder[] = useSelector((state: IStateType) => state.orders.orders);\n\n const orderList: JSX.Element[] = orders.map(order => {\n return (\n <tr className={`table-row`}\n key={`order_${order.id}`}>\n <th scope=\"row\">{order.id}</th>\n <td>{order.name}</td>\n <td>{order.result}</td>\n <td>{order.unit}</td>\n <td>{order.refRange}</td>\n </tr>);\n })\n\n return (\n <div className=\"table-responsive portlet\">\n <table className=\"table\">\n <thead className=\"thead-light\">\n <tr>\n <th scope=\"col\">#</th>\n <th scope=\"col\">Name</th>\n <th scope=\"col\">Result</th>\n <th scope=\"col\">unit</th>\n <th scope=\"col\">Range</th>\n </tr>\n </thead>\n <tbody>\n {orderList}\n </tbody>\n </table>\n </div>\n )\n}\n\nexport default OrderList;"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"import _defineProperty from \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/defineProperty\";\nimport _slicedToArray from \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/slicedToArray\";\nvar _jsxFileName = \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Orders/OrderForm.tsx\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nimport React, { useState, Fragment } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { addOrder } from \"../../store/actions/orders.actions\";\nimport { addNotification } from \"../../store/actions/notifications.action\";\nimport { clearSelectedProduct, changeProductAmount } from \"../../store/actions/products.action\";\nimport axios from 'axios';\n\nconst OrderForm = () => {\n const dispatch = useDispatch();\n const selectedProduct = useSelector(state => state.products.selectedProduct);\n const orders = useSelector(state => state.orders.orders);\n\n const _useState = useState(null),\n _useState2 = _slicedToArray(_useState, 2),\n selectedFile = _useState2[0],\n setSelectedFile = _useState2[1];\n\n const initialFormState = {\n name: {\n error: \"\",\n value: \"\"\n },\n product: {\n error: \"\",\n value: null\n },\n amount: {\n error: \"\",\n value: 0\n },\n totalPrice: {\n error: \"\",\n value: 0\n }\n };\n\n const _useState3 = useState(initialFormState),\n _useState4 = _slicedToArray(_useState3, 2),\n formState = _useState4[0],\n setFormState = _useState4[1];\n\n function hasAmountChanged(model) {\n let totalPrice = formState.totalPrice.value;\n\n if (selectedProduct) {\n totalPrice = selectedProduct.price * model.value;\n }\n\n setFormState(_objectSpread({}, formState, {\n amount: {\n error: model.error,\n value: model.value\n },\n totalPrice: {\n error: model.error,\n value: totalPrice\n }\n }));\n }\n\n function hasFormValueChanged(model) {\n setFormState(_objectSpread({}, formState, {\n [model.field]: {\n error: model.error,\n value: model.value\n }\n }));\n }\n\n function resetForm() {\n setFormState(initialFormState);\n }\n\n function saveOrder(e) {\n e.preventDefault();\n\n if (isFormInvalid()) {\n return;\n }\n\n saveForm(formState);\n }\n\n function saveForm(formState) {\n if (selectedProduct) {\n if (selectedProduct.amount < formState.amount.value) {\n alert(\"Not enough products in warehouse\");\n return;\n }\n\n formState.product.value = selectedProduct;\n dispatch(addOrder({\n id: 0,\n name: formState.name.value,\n amount: formState.amount.value,\n totalPrice: formState.totalPrice.value,\n product: formState.product.value\n }));\n dispatch(addNotification(\"Order added\", \"Order \".concat(formState.name.value, \" added by you\")));\n dispatch(clearSelectedProduct());\n dispatch(changeProductAmount(selectedProduct.id, formState.amount.value));\n resetForm();\n }\n }\n\n function isFormInvalid() {\n return formState.amount.error || formState.totalPrice.error || formState.name.error || formState.product.error || !formState.name.value || !selectedProduct;\n }\n\n function getDisabledClass() {\n let isError = isFormInvalid();\n return isError ? \"disabled\" : \"\";\n }\n\n const handleFileSelect = selectorFiles => {\n console.log(selectorFiles[0]);\n setSelectedFile(selectorFiles[0]);\n const formData = new FormData();\n formData.append(\"file\", selectorFiles[0]);\n axios.post('http://127.0.0.1:8000/staffapi/labreport', formData, {\n headers: {\n \"Content-type\": \"multipart/form-date\"\n }\n }).then(response => {\n for (let i = 0; i < response.data.length; i++) {\n console.log(response.data[i][String(i)]);\n }\n });\n };\n\n return React.createElement(Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 107\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card shadow mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 108\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card-header py-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 109\n },\n __self: this\n }, React.createElement(\"h6\", {\n className: \"m-0 font-weight-bold text-green\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 110\n },\n __self: this\n }, \"Upload\")), React.createElement(\"div\", {\n className: \"card-body\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 112\n },\n __self: this\n }, React.createElement(\"form\", {\n onSubmit: saveOrder,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 113\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 114\n },\n __self: this\n }, React.createElement(\"input\", {\n type: \"file\",\n onChange: e => handleFileSelect(e.target.files),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 115\n },\n __self: this\n }))))));\n};\n\nexport default OrderForm;","map":{"version":3,"sources":["/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Orders/OrderForm.tsx"],"names":["React","useState","Fragment","useDispatch","useSelector","addOrder","addNotification","clearSelectedProduct","changeProductAmount","axios","OrderForm","dispatch","selectedProduct","state","products","orders","selectedFile","setSelectedFile","initialFormState","name","error","value","product","amount","totalPrice","formState","setFormState","hasAmountChanged","model","price","hasFormValueChanged","field","resetForm","saveOrder","e","preventDefault","isFormInvalid","saveForm","alert","id","getDisabledClass","isError","handleFileSelect","selectorFiles","console","log","formData","FormData","append","post","headers","then","response","i","data","length","String","target","files"],"mappings":";;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAAqCC,QAArC,QAA+D,OAA/D;AAKA,SAASC,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AACA,SAASC,QAAT,QAAyB,oCAAzB;AACA,SAASC,eAAT,QAAgC,0CAAhC;AACA,SAASC,oBAAT,EAA+BC,mBAA/B,QAA0D,qCAA1D;AAGA,OAAOC,KAAP,MAAkB,OAAlB;;AAEA,MAAMC,SAAmB,GAAG,MAAM;AAC9B,QAAMC,QAAuB,GAAGR,WAAW,EAA3C;AACA,QAAMS,eAAgC,GAAGR,WAAW,CAAES,KAAD,IAAuBA,KAAK,CAACC,QAAN,CAAeF,eAAvC,CAApD;AACA,QAAMG,MAAgB,GAAGX,WAAW,CAAES,KAAD,IAAuBA,KAAK,CAACE,MAAN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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAK,IAAA,SAAS,EAAC,kBAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAI,IAAA,SAAS,EAAC,iCAAd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cADJ,CADJ,EAII;AAAK,IAAA,SAAS,EAAC,WAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAM,IAAA,QAAQ,EAAEpB,SAAhB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAK,IAAA,SAAS,EAAC,UAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAO,IAAA,IAAI,EAAC,MAAZ;AAAmB,IAAA,QAAQ,EAAGC,CAAD,IAAOQ,gBAAgB,CAACR,CAAC,CAACuB,MAAF,CAASC,KAAV,CAApD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADJ,CADJ,CADJ,CAJJ,CADJ,CADJ;AA+CH,CA3ID;;AA6IA,eAAehD,SAAf","sourcesContent":["import React, { useState, FormEvent, Fragment, Dispatch } from \"react\";\nimport { IProduct } from \"../../store/models/product.interface\";\nimport TextInput from \"../../common/components/TextInput\";\nimport NumberInput from \"../../common/components/NumberInput\";\nimport { OnChangeModel, IOrderFormState } from \"../../common/types/Form.types\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { addOrder } from \"../../store/actions/orders.actions\";\nimport { addNotification } from \"../../store/actions/notifications.action\";\nimport { clearSelectedProduct, changeProductAmount } from \"../../store/actions/products.action\";\nimport { IOrder } from \"../../store/models/order.interface\";\nimport { IStateType } from \"../../store/models/root.interface\";\nimport axios from 'axios'\n\nconst OrderForm: React.FC = () => {\n const dispatch: Dispatch<any> = useDispatch();\n const selectedProduct: IProduct | null = useSelector((state: IStateType) => state.products.selectedProduct);\n const orders: IOrder[] = useSelector((state: IStateType) => state.orders.orders);\n const [selectedFile, setSelectedFile] = useState(null);\n const initialFormState: IOrderFormState = {\n name: { error: \"\", value: \"\" },\n product: { error: \"\", value: null },\n amount: { error: \"\", value: 0 },\n totalPrice: { error: \"\", value: 0 },\n };\n\n const [formState, setFormState] = useState(initialFormState);\n\n function hasAmountChanged(model: OnChangeModel): void {\n let totalPrice: number = formState.totalPrice.value;\n if (selectedProduct) {\n totalPrice = selectedProduct.price * (model.value as number);\n }\n\n setFormState({\n ...formState,\n amount: { error: model.error, value: model.value as number },\n totalPrice: { error: model.error, value: totalPrice }\n });\n\n }\n\n function hasFormValueChanged(model: OnChangeModel): void {\n setFormState({ ...formState, [model.field]: { error: model.error, value: model.value } });\n }\n\n function resetForm(): void {\n setFormState(initialFormState);\n }\n\n function saveOrder(e: FormEvent<HTMLFormElement>): void {\n e.preventDefault();\n if (isFormInvalid()) {\n return;\n }\n\n saveForm(formState);\n }\n\n function saveForm(formState: IOrderFormState): void {\n if (selectedProduct) {\n if (selectedProduct.amount < formState.amount.value) {\n alert(\"Not enough products in warehouse\");\n return;\n }\n\n formState.product.value = selectedProduct;\n dispatch(addOrder({\n id: 0,\n name: formState.name.value,\n amount: formState.amount.value,\n totalPrice: formState.totalPrice.value,\n product: formState.product.value as IProduct\n }));\n\n dispatch(addNotification(\"Order added\", `Order ${formState.name.value} added by you`));\n dispatch(clearSelectedProduct());\n dispatch(changeProductAmount(selectedProduct.id, formState.amount.value));\n resetForm();\n }\n }\n\n function isFormInvalid(): boolean {\n return (formState.amount.error || formState.totalPrice.error\n || formState.name.error || formState.product.error || !formState.name.value\n || !selectedProduct) as boolean;\n }\n\n function getDisabledClass(): string {\n let isError: boolean = isFormInvalid();\n return isError ? \"disabled\" : \"\";\n }\n\n const handleFileSelect = (selectorFiles:any) => {\n console.log(selectorFiles[0])\n setSelectedFile(selectorFiles[0])\n const formData = new FormData();\n formData.append(\"file\", selectorFiles[0]);\n axios.post('http://127.0.0.1:8000/staffapi/labreport', formData, {headers: {\"Content-type\": \"multipart/form-date\"}})\n .then(response => {\n for (let i = 0; i < response.data.length; i++) {\n console.log(response.data[i][String(i)]);\n }\n });\n }\n\n return (\n <Fragment>\n <div className=\"card shadow mb-4\">\n <div className=\"card-header py-3\">\n <h6 className=\"m-0 font-weight-bold text-green\">Upload</h6>\n </div>\n <div className=\"card-body\">\n <form onSubmit={saveOrder}>\n <div className=\"form-row\">\n <input type=\"file\" onChange={(e) => handleFileSelect(e.target.files)}/>\n {/* <div className=\"form-group col-md-12\">\n <TextInput id=\"input_name\"\n value={formState.name.value}\n field=\"name\"\n onChange={hasFormValueChanged}\n required={true}\n maxLength={20}\n label=\"Name\"\n placeholder=\"Name\" />\n </div>\n <div className=\"form-group col-md-6\">\n <NumberInput id=\"input_amount\"\n value={formState.amount.value}\n field=\"amount\"\n onChange={hasAmountChanged}\n max={1000}\n min={0}\n label=\"Amount\" />\n </div>\n\n <div className=\"form-group col-md-6\">\n <NumberInput id=\"input_totalPrice\"\n value={formState.totalPrice.value}\n field=\"totalPrice\"\n onChange={hasFormValueChanged}\n max={1000}\n min={0}\n label=\"Price\" />\n </div> */}\n </div>\n {/* <button className=\"btn btn-danger\" onClick={() => resetForm()}>Reset</button> */}\n {/* <button type=\"submit\" className={`btn btn-success left-margin ${getDisabledClass()}`}>Create</button> */}\n </form>\n </div>\n </div>\n </Fragment>\n );\n};\n\nexport default OrderForm;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\nmodule.exports = ReactPropTypesSecret;","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"\"use strict\";\n\nmodule.exports = function escape(url, needQuotes) {\n if (typeof url !== 'string') {\n return url;\n } // If url is already wrapped in quotes, remove them\n\n\n if (/^['\"].*['\"]$/.test(url)) {\n url = url.slice(1, -1);\n } // Should url be wrapped?\n // See https://drafts.csswg.org/css-values-3/#urls\n\n\n if (/[\"'() \\t\\n]/.test(url) || needQuotes) {\n return '\"' + url.replace(/\"/g, '\\\\\"').replace(/\\n/g, '\\\\n') + '\"';\n }\n\n return url;\n};","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Admin/Admin.tsx\";\nimport React, { Fragment } from \"react\";\nimport LeftMenu from \"../LeftMenu/LeftMenu\";\nimport TopMenu from \"../TopMenu/TopMenu\";\nimport { Switch, Route } from \"react-router\";\nimport Users from \"../Users/Users\";\nimport Products from \"../Products/Products\";\nimport Orders from \"../Orders/Orders\";\nimport Home from \"../Home/Home\";\nimport Notifications from \"../../common/components/Notification\";\n\nconst Admin = () => {\n return React.createElement(Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 14\n },\n __self: this\n }, React.createElement(Notifications, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 15\n },\n __self: this\n }), React.createElement(LeftMenu, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 16\n },\n __self: this\n }), React.createElement(\"div\", {\n id: \"content-wrapper\",\n className: \"d-flex flex-column\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 17\n },\n __self: this\n }, React.createElement(\"div\", {\n id: \"content\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 18\n },\n __self: this\n }, React.createElement(TopMenu, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 19\n },\n __self: this\n }), React.createElement(\"div\", {\n className: \"container-fluid\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 20\n },\n __self: this\n }, React.createElement(Switch, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 21\n },\n __self: this\n }, React.createElement(Route, {\n path: \"/users\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 22\n },\n __self: this\n }, React.createElement(Users, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 22\n },\n __self: this\n })), React.createElement(Route, {\n path: \"/products\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 23\n },\n __self: this\n }, React.createElement(Products, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 23\n },\n __self: this\n })), React.createElement(Route, {\n path: \"/orders\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 24\n },\n __self: this\n }, React.createElement(Orders, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 24\n },\n __self: this\n })), React.createElement(Route, {\n path: \"/\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 25\n },\n __self: this\n }, React.createElement(Home, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 25\n },\n __self: this\n })))))));\n};\n\nexport default Admin;","map":{"version":3,"sources":["/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Admin/Admin.tsx"],"names":["React","Fragment","LeftMenu","TopMenu","Switch","Route","Users","Products","Orders","Home","Notifications","Admin"],"mappings":";AAAA,OAAOA,KAAP,IAAgBC,QAAhB,QAAgC,OAAhC;AACA,OAAOC,QAAP,MAAqB,sBAArB;AACA,OAAOC,OAAP,MAAoB,oBAApB;AACA,SAASC,MAAT,EAAiBC,KAAjB,QAA8B,cAA9B;AACA,OAAOC,KAAP,MAAkB,gBAAlB;AACA,OAAOC,QAAP,MAAqB,sBAArB;AACA,OAAOC,MAAP,MAAmB,kBAAnB;AACA,OAAOC,IAAP,MAAiB,cAAjB;AACA,OAAOC,aAAP,MAA0B,sCAA1B;;AAEA,MAAMC,KAAe,GAAG,MAAM;AAE5B,SACE,oBAAC,QAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACE,oBAAC,aAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADF,EAEE,oBAAC,QAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAFF,EAGE;AAAK,IAAA,EAAE,EAAC,iBAAR;AAA0B,IAAA,SAAS,EAAC,oBAApC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACE;AAAK,IAAA,EAAE,EAAC,SAAR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACE,oBAAC,OAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADF,EAEE;AAAK,IAAA,SAAS,EAAC,iBAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACE,oBAAC,MAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACE,oBAAC,KAAD;AAAO,IAAA,IAAI,UAAX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAuB,oBAAC,KAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAvB,CADF,EAEE,oBAAC,KAAD;AAAO,IAAA,IAAI,aAAX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAA0B,oBAAC,QAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAA1B,CAFF,EAGE,oBAAC,KAAD;AAAO,IAAA,IAAI,WAAX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAwB,oBAAC,MAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAxB,CAHF,EAIE,oBAAC,KAAD;AAAO,IAAA,IAAI,EAAC,GAAZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAgB,oBAAC,IAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAhB,CAJF,CADF,CAFF,CADF,CAHF,CADF;AAmBD,CArBD;;AAuBA,eAAeA,KAAf","sourcesContent":["import React, { Fragment } from \"react\";\nimport LeftMenu from \"../LeftMenu/LeftMenu\";\nimport TopMenu from \"../TopMenu/TopMenu\";\nimport { Switch, Route } from \"react-router\";\nimport Users from \"../Users/Users\";\nimport Products from \"../Products/Products\";\nimport Orders from \"../Orders/Orders\";\nimport Home from \"../Home/Home\";\nimport Notifications from \"../../common/components/Notification\";\n\nconst Admin: React.FC = () => {\n\n return (\n <Fragment>\n <Notifications />\n <LeftMenu />\n <div id=\"content-wrapper\" className=\"d-flex flex-column\">\n <div id=\"content\">\n <TopMenu />\n <div className=\"container-fluid\">\n <Switch>\n <Route path={`/users`}><Users /></Route>\n <Route path={`/products`}><Products /></Route>\n <Route path={`/orders`}><Orders /></Route>\n <Route path=\"/\"><Home /></Route>\n </Switch>\n </div>\n </div>\n </div>\n </Fragment>\n );\n};\n\nexport default Admin;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"import _slicedToArray from \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/slicedToArray\";\nvar _jsxFileName = \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Home/Home.tsx\";\nimport React, { Fragment, useEffect, useState } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { updateCurrentPath } from \"../../store/actions/root.actions\";\nimport TopCard from \"../../common/components/TopCard\";\nimport ProductList from \"../Products/ProductsList\";\nimport axios from \"axios\";\n\nconst Home = () => {\n const products = useSelector(state => state.products);\n const numberItemsCount = products.products.length;\n const totalPrice = products.products.reduce((prev, next) => prev + (next.price * next.amount || 0), 0);\n const totalProductAmount = products.products.reduce((prev, next) => prev + (next.amount || 0), 0);\n const orders = useSelector(state => state.orders.orders);\n const totalSales = orders.reduce((prev, next) => prev + next.totalPrice, 0);\n const totalOrderAmount = orders.reduce((prev, next) => prev + next.amount, 0);\n const email = useSelector(state => state.account.email);\n const dispatch = useDispatch();\n dispatch(updateCurrentPath(\"home\", \"\"));\n\n const _useState = useState(0),\n _useState2 = _slicedToArray(_useState, 2),\n resState = _useState2[0],\n setresState = _useState2[1];\n\n let AppList = null;\n useEffect(() => {\n var nameMatch = email.match(/^([^@]*)@/);\n var name = nameMatch ? nameMatch[1] : null;\n const article = {\n email: \"dr.rasika\"\n };\n axios.post('http://127.0.0.1:8000/api/specificAppointment', article).then(response => {\n console.log(response.data);\n AppList = response.data.map(Appointment => {\n return React.createElement(\"tr\", {\n className: \"table-row\",\n key: \"order_\".concat(Appointment.id),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 39\n },\n __self: this\n }, React.createElement(\"th\", {\n scope: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 41\n },\n __self: this\n }, Appointment.id), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 42\n },\n __self: this\n }, Appointment.fullName), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 43\n },\n __self: this\n }, Appointment.appointmentTime));\n }); // setresState(AppList)\n\n console.log(AppList);\n });\n }, []);\n return React.createElement(Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 56\n },\n __self: this\n }, React.createElement(\"h1\", {\n className: \"h3 mb-2 text-gray-800\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 57\n },\n __self: this\n }, \"Dashboard\"), React.createElement(\"p\", {\n className: \"mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 58\n },\n __self: this\n }, \"Summary and overview of our doctor stuff here\"), React.createElement(\"div\", {\n className: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 60\n },\n __self: this\n }, React.createElement(TopCard, {\n title: \"PATIENT COUNT\",\n text: \"\".concat(numberItemsCount),\n icon: \"box\",\n class: \"primary\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 61\n },\n __self: this\n }), React.createElement(TopCard, {\n title: \"APPONITMEN AMOUNT\",\n text: \"\".concat(totalProductAmount),\n icon: \"warehouse\",\n class: \"danger\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 62\n },\n __self: this\n }), React.createElement(TopCard, {\n title: \"DOCTOR PRICE\",\n text: \"$\".concat(totalPrice),\n icon: \"dollar-sign\",\n class: \"success\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 63\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 66\n },\n __self: this\n }, React.createElement(TopCard, {\n title: \"EARNINGS\",\n text: totalSales.toString(),\n icon: \"donate\",\n class: \"primary\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 67\n },\n __self: this\n }), React.createElement(TopCard, {\n title: \"TOTAL REPORT\",\n text: totalOrderAmount.toString(),\n icon: \"calculator\",\n class: \"danger\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 68\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 71\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"col-xl-6 col-lg-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 73\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card shadow mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 74\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card-header py-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 75\n },\n __self: this\n }, React.createElement(\"h6\", {\n className: \"m-0 font-weight-bold text-green\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 76\n },\n __self: this\n }, \"Patient list\")), React.createElement(\"div\", {\n className: \"card-body\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 78\n },\n __self: this\n }, React.createElement(ProductList, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 79\n },\n __self: this\n })))), React.createElement(\"div\", {\n className: \"col-xl-6 col-lg-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 85\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card shadow mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 86\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card-header py-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 87\n },\n __self: this\n }, React.createElement(\"h6\", {\n className: \"m-0 font-weight-bold text-green\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 88\n },\n __self: this\n }, \"Appoiments\")), React.createElement(\"div\", {\n className: \"card-body\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 90\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"table-responsive portlet\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 91\n },\n __self: this\n }, React.createElement(\"table\", {\n className: \"table\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 92\n },\n __self: this\n }, React.createElement(\"thead\", {\n className: \"thead-light\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 93\n },\n __self: this\n }, React.createElement(\"tr\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 94\n },\n __self: this\n }, React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 95\n },\n __self: this\n }, \"#\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 96\n },\n __self: this\n }, \"Name\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 97\n },\n __self: this\n }, \"Result\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 98\n },\n __self: this\n }, \"unit\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 99\n },\n __self: this\n }, \"Range\"))), React.createElement(\"tbody\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 102\n },\n __self: this\n }, AppList))))))));\n};\n\nexport default Home;","map":{"version":3,"sources":["/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Home/Home.tsx"],"names":["React","Fragment","useEffect","useState","useDispatch","useSelector","updateCurrentPath","TopCard","ProductList","axios","Home","products","state","numberItemsCount","length","totalPrice","reduce","prev","next","price","amount","totalProductAmount","orders","totalSales","totalOrderAmount","email","account","dispatch","resState","setresState","AppList","nameMatch","match","name","article","post","then","response","console","log","data","map","Appointment","id","fullName","appointmentTime","toString"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAAoCC,SAApC,EAA+CC,QAA/C,QAA+D,OAA/D;AACA,SAASC,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AACA,SAASC,iBAAT,QAAkC,kCAAlC;AACA,OAAOC,OAAP,MAAoB,iCAApB;AAEA,OAAOC,WAAP,MAAwB,0BAAxB;AAGA,OAAOC,KAAP,MAAkB,OAAlB;;AAEA,MAAMC,IAAc,GAAG,MAAM;AAC3B,QAAMC,QAAuB,GAAGN,WAAW,CAAEO,KAAD,IAAuBA,KAAK,CAACD,QAA9B,CAA3C;AACA,QAAME,gBAAwB,GAAGF,QAAQ,CAACA,QAAT,CAAkBG,MAAnD;AACA,QAAMC,UAAkB,GAAGJ,QAAQ,CAACA,QAAT,CAAkBK,MAAlB,CAAyB,CAACC,IAAD,EAAOC,IAAP,KAAgBD,IAAI,IAAKC,IAAI,CAACC,KAAL,GAAaD,IAAI,CAACE,MAAnB,IAA8B,CAAlC,CAA7C,EAAmF,CAAnF,CAA3B;AACA,QAAMC,kBAA0B,GAAGV,QAAQ,CAACA,QAAT,CAAkBK,MAAlB,CAAyB,CAACC,IAAD,EAAOC,IAAP,KAAgBD,IAAI,IAAIC,IAAI,CAACE,MAAL,IAAe,CAAnB,CAA7C,EAAoE,CAApE,CAAnC;AAEA,QAAME,MAAgB,GAAGjB,WAAW,CAAEO,KAAD,IAAuBA,KAAK,CAACU,MAAN,CAAaA,MAArC,CAApC;AACA,QAAMC,UAAkB,GAAGD,MAAM,CAACN,MAAP,CAAc,CAACC,IAAD,EAAOC,IAAP,KAAgBD,IAAI,GAAGC,IAAI,CAACH,UAA1C,EAAsD,CAAtD,CAA3B;AACA,QAAMS,gBAAwB,GAAGF,MAAM,CAACN,MAAP,CAAc,CAACC,IAAD,EAAOC,IAAP,KAAgBD,IAAI,GAAGC,IAAI,CAACE,MAA1C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;AAAO,IAAA,SAAS,EAAC,OAAjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAO,IAAA,SAAS,EAAC,aAAjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAI,IAAA,KAAK,EAAC,KAAV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SADJ,EAEI;AAAI,IAAA,KAAK,EAAC,KAAV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAFJ,EAGI;AAAI,IAAA,KAAK,EAAC,KAAV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAHJ,EAII;AAAI,IAAA,KAAK,EAAC,KAAV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAJJ,EAKI;AAAI,IAAA,KAAK,EAAC,KAAV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aALJ,CADJ,CADJ,EAUI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACKhB,OADL,CAVJ,CADF,CADF,CAJF,CADF,CAdF,CAfF,CADF;AA6DD,CAzGD;;AA2GA,eAAepB,IAAf","sourcesContent":["import React, { Fragment, Dispatch, useEffect, useState } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { updateCurrentPath } from \"../../store/actions/root.actions\";\nimport TopCard from \"../../common/components/TopCard\";\nimport { IProductState, IStateType } from \"../../store/models/root.interface\";\nimport ProductList from \"../Products/ProductsList\";\nimport { IOrder } from \"../../store/models/order.interface\";\nimport OrderList from \"../Orders/OrderList\";\nimport axios from \"axios\";\n\nconst Home: React.FC = () => {\n const products: IProductState = useSelector((state: IStateType) => state.products);\n const numberItemsCount: number = products.products.length;\n const totalPrice: number = products.products.reduce((prev, next) => prev + ((next.price * next.amount) || 0), 0);\n const totalProductAmount: number = products.products.reduce((prev, next) => prev + (next.amount || 0), 0);\n\n const orders: IOrder[] = useSelector((state: IStateType) => state.orders.orders);\n const totalSales: number = orders.reduce((prev, next) => prev + next.totalPrice, 0);\n const totalOrderAmount: number = orders.reduce((prev, next) => prev + next.amount, 0);\n\n const email: string = useSelector((state: IStateType) => state.account.email);\n\n const dispatch: Dispatch<any> = useDispatch();\n dispatch(updateCurrentPath(\"home\", \"\"));\n\n const [resState, setresState] = useState(0);\n\n let AppList = null \n\n useEffect(() => {\n var nameMatch = email.match(/^([^@]*)@/);\n var name = nameMatch ? nameMatch[1] : null;\n const article = { email : \"dr.rasika\" };\n axios.post('http://127.0.0.1:8000/api/specificAppointment', article)\n .then(response => {\n console.log(response.data)\n AppList = response.data.map((Appointment: any) => {\n return (\n <tr className={`table-row`}\n key={`order_${Appointment.id}`}>\n <th scope=\"row\">{Appointment.id}</th>\n <td>{Appointment.fullName}</td>\n <td>{Appointment.appointmentTime}</td>\n {/* <td>{Appointment.unit}</td>\n <td>{Appointment.refRange}</td> */}\n </tr>);\n })\n // setresState(AppList)\n console.log(AppList)\n \n });\n },[]);\n\n\n return (\n <Fragment>\n <h1 className=\"h3 mb-2 text-gray-800\">Dashboard</h1>\n <p className=\"mb-4\">Summary and overview of our doctor stuff here</p>\n\n <div className=\"row\">\n <TopCard title=\"PATIENT COUNT\" text={`${numberItemsCount}`} icon=\"box\" class=\"primary\" />\n <TopCard title=\"APPONITMEN AMOUNT\" text={`${totalProductAmount}`} icon=\"warehouse\" class=\"danger\" />\n <TopCard title=\"DOCTOR PRICE\" text={`$${totalPrice}`} icon=\"dollar-sign\" class=\"success\" />\n </div>\n\n <div className=\"row\">\n <TopCard title=\"EARNINGS\" text={totalSales.toString()} icon=\"donate\" class=\"primary\" />\n <TopCard title=\"TOTAL REPORT\" text={totalOrderAmount.toString()} icon=\"calculator\" class=\"danger\" />\n </div>\n\n <div className=\"row\">\n\n <div className=\"col-xl-6 col-lg-6\">\n <div className=\"card shadow mb-4\">\n <div className=\"card-header py-3\">\n <h6 className=\"m-0 font-weight-bold text-green\">Patient list</h6>\n </div>\n <div className=\"card-body\">\n <ProductList />\n </div>\n </div>\n\n </div>\n\n <div className=\"col-xl-6 col-lg-6\">\n <div className=\"card shadow mb-4\">\n <div className=\"card-header py-3\">\n <h6 className=\"m-0 font-weight-bold text-green\">Appoiments</h6>\n </div>\n <div className=\"card-body\">\n <div className=\"table-responsive portlet\">\n <table className=\"table\">\n <thead className=\"thead-light\">\n <tr>\n <th scope=\"col\">#</th>\n <th scope=\"col\">Name</th>\n <th scope=\"col\">Result</th>\n <th scope=\"col\">unit</th>\n <th scope=\"col\">Range</th>\n </tr>\n </thead>\n <tbody>\n {AppList}\n </tbody>\n </table>\n </div>\n\n </div>\n </div>\n </div>\n\n </div>\n\n </Fragment>\n );\n};\n\nexport default Home;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"module.exports = function (originalModule) {\n if (!originalModule.webpackPolyfill) {\n var module = Object.create(originalModule); // module.parent = undefined by default\n\n if (!module.children) module.children = [];\n Object.defineProperty(module, \"loaded\", {\n enumerable: true,\n get: function () {\n return module.l;\n }\n });\n Object.defineProperty(module, \"id\", {\n enumerable: true,\n get: function () {\n return module.i;\n }\n });\n Object.defineProperty(module, \"exports\", {\n enumerable: true\n });\n module.webpackPolyfill = 1;\n }\n\n return module;\n};","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"import { bindActionCreators } from 'redux';\nimport { wrapMapToPropsConstant, wrapMapToPropsFunc } from './wrapMapToProps';\nexport function whenMapDispatchToPropsIsFunction(mapDispatchToProps) {\n return typeof mapDispatchToProps === 'function' ? wrapMapToPropsFunc(mapDispatchToProps, 'mapDispatchToProps') : undefined;\n}\nexport function whenMapDispatchToPropsIsMissing(mapDispatchToProps) {\n return !mapDispatchToProps ? wrapMapToPropsConstant(function (dispatch) {\n return {\n dispatch: dispatch\n };\n }) : undefined;\n}\nexport function whenMapDispatchToPropsIsObject(mapDispatchToProps) {\n return mapDispatchToProps && typeof mapDispatchToProps === 'object' ? wrapMapToPropsConstant(function (dispatch) {\n return bindActionCreators(mapDispatchToProps, dispatch);\n }) : undefined;\n}\nexport default [whenMapDispatchToPropsIsFunction, whenMapDispatchToPropsIsMissing, whenMapDispatchToPropsIsObject];","map":null,"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Products/ProductsList.tsx\";\nimport React, { useEffect } from \"react\";\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { addProduct, removeProduct } from \"../../store/actions/products.action\";\nimport axios from \"axios\";\n\nfunction ProductList(props) {\n const dispatch = useDispatch();\n let product;\n const products = useSelector(state => state.products);\n useEffect(() => {\n // Update the document title using the browser API\n if (products != null) {\n products.products.map(product => {\n console.log(product);\n dispatch(removeProduct(product.id));\n });\n }\n\n axios.get(\"http://localhost:8000/staffapi/salary\").then(res => {\n for (let i = 0; i < res.data.length; i++) {\n product = {\n id: res.data[i].id,\n name: res.data[i].Name,\n qualification: res.data[i].Qualification,\n experience: res.data[i].Experience,\n rating: res.data[i].Rating,\n place: res.data[i].Place,\n profile: res.data[i].Profile,\n hasExpiryDate: false,\n price: 0,\n amount: 0,\n category: \"\",\n description: \"\"\n };\n dispatch(addProduct(product));\n }\n });\n }, []); // axios.get(`http://localhost:8000/staffapi/salary`)\n // .then(res => {\n // for (let i = 0; i < res.data.length; i++) {\n // product = {\n // id: res.data[i].id,\n // name: res.data[i].Name,\n // qualification: res.data[i].Qualification,\n // experience: res.data[i].Experience,\n // rating: res.data[i].Rating,\n // place: res.data[i].Place,\n // profile: res.data[i].Profile,\n // hasExpiryDate: false,\n // price: 0,\n // amount: 0,\n // category: \"\",\n // description: \"\"\n // };\n // console.log(product)\n // dispatch(addProduct(product))\n // }\n // });\n\n const productElements = products.products.map(product => {\n if (!product) {\n return null;\n }\n\n return React.createElement(\"tr\", {\n className: \"table-row \".concat(products.selectedProduct && products.selectedProduct.id === product.id ? \"selected\" : \"\"),\n onClick: () => {\n if (props.onSelect) props.onSelect(product);\n },\n key: \"product_\".concat(product.id),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 73\n },\n __self: this\n }, React.createElement(\"th\", {\n scope: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 78\n },\n __self: this\n }, product.id), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 79\n },\n __self: this\n }, product.name), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 80\n },\n __self: this\n }, product.qualification), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 81\n },\n __self: this\n }, product.experience), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 82\n },\n __self: this\n }, product.place));\n });\n return React.createElement(\"div\", {\n className: \"table-responsive portlet\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 88\n },\n __self: this\n }, React.createElement(\"table\", {\n className: \"table\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 89\n },\n __self: this\n }, React.createElement(\"thead\", {\n className: \"thead-light\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 90\n },\n __self: this\n }, React.createElement(\"tr\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 91\n },\n __self: this\n }, React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 92\n },\n __self: this\n }, \"#\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 93\n },\n __self: this\n }, \"Name\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 94\n },\n __self: this\n }, \"Qualification\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 95\n },\n __self: this\n }, \"Experience\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 96\n },\n __self: this\n }, \"Place\"))), React.createElement(\"tbody\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 99\n },\n __self: this\n }, productElements)));\n}\n\nexport default ProductList;","map":{"version":3,"sources":["/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Products/ProductsList.tsx"],"names":["React","useEffect","useSelector","useDispatch","addProduct","removeProduct","axios","ProductList","props","dispatch","product","products","state","map","console","log","id","get","then","res","i","data","length","name","Name","qualification","Qualification","experience","Experience","rating","Rating","place","Place","profile","Profile","hasExpiryDate","price","amount","category","description","productElements","selectedProduct","onSelect"],"mappings":";AAAA,OAAOA,KAAP,IAA0BC,SAA1B,QAA0C,OAA1C;AACA,SAASC,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AAGA,SAASC,UAAT,EAAqBC,aAArB,QAA0C,qCAA1C;AACA,OAAOC,KAAP,MAAkB,OAAlB;;AAOA,SAASC,WAAT,CAAqBC,KAArB,EAA4D;AAC1D,QAAMC,QAAuB,GAAGN,WAAW,EAA3C;AACA,MAAIO,OAAJ;AACA,QAAMC,QAAuB,GAAGT,WAAW,CAAEU,KAAD,IAAuBA,KAAK,CAACD,QAA9B,CAA3C;AAEAV,EAAAA,SAAS,CAAC,MAAM;AACd;AACA,QAAGU,QAAQ,IAAI,IAAf,EAAoB;AAClBA,MAAAA,QAAQ,CAACA,QAAT,CAAkBE,GAAlB,CAAsBH,OAAO,IAAI;AAC/BI,QAAAA,OAAO,CAACC,GAAR,CAAYL,OAAZ;AACAD,QAAAA,QAAQ,CAACJ,aAAa,CAACK,OAAO,CAACM,EAAT,CAAd,CAAR;AACD,OAHD;AAID;;AACDV,IAAAA,KAAK,CAACW,GAAN,0CACGC,IADH,CACQC,GAAG,IAAI;AACX,WAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,GAAG,CAACE,IAAJ,CAASC,MAA7B,EAAqCF,CAAC,EAAtC,EAA0C;AACxCV,QAAAA,OAAO,GAAG;AACRM,UAAAA,EAAE,EA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F,CADF,CADF,EAUE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGS,eADH,CAVF,CADF,CADF;AAmBD;;AAED,eAAejC,WAAf","sourcesContent":["import React, { Dispatch, useEffect} from \"react\";\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { IStateType, IProductState } from \"../../store/models/root.interface\";\nimport { IProduct } from \"../../store/models/product.interface\";\nimport { addProduct, removeProduct } from \"../../store/actions/products.action\";\nimport axios from \"axios\";\n\nexport type productListProps = {\n onSelect?: (product: IProduct) => void;\n children?: React.ReactNode;\n};\n\nfunction ProductList(props: productListProps): JSX.Element {\n const dispatch: Dispatch<any> = useDispatch();\n let product: IProduct \n const products: IProductState = useSelector((state: IStateType) => state.products);\n\n useEffect(() => {\n // Update the document title using the browser API\n if(products != null){\n products.products.map(product => {\n console.log(product)\n dispatch(removeProduct(product.id))\n });\n }\n axios.get(`http://localhost:8000/staffapi/salary`)\n .then(res => {\n for (let i = 0; i < res.data.length; i++) {\n product = {\n id: res.data[i].id,\n name: res.data[i].Name,\n qualification: res.data[i].Qualification,\n experience: res.data[i].Experience,\n rating: res.data[i].Rating,\n place: res.data[i].Place,\n profile: res.data[i].Profile,\n hasExpiryDate: false,\n price: 0,\n amount: 0,\n category: \"\",\n description: \"\"\n };\n dispatch(addProduct(product))\n }\n });\n },[]);\n\n // axios.get(`http://localhost:8000/staffapi/salary`)\n // .then(res => {\n // for (let i = 0; i < res.data.length; i++) {\n // product = {\n // id: res.data[i].id,\n // name: res.data[i].Name,\n // qualification: res.data[i].Qualification,\n // experience: res.data[i].Experience,\n // rating: res.data[i].Rating,\n // place: res.data[i].Place,\n // profile: res.data[i].Profile,\n // hasExpiryDate: false,\n // price: 0,\n // amount: 0,\n // category: \"\",\n // description: \"\"\n // };\n // console.log(product)\n // dispatch(addProduct(product))\n // }\n // });\n\n\n const productElements: (JSX.Element | null)[] = products.products.map(product => {\n if (!product) { return null; }\n return (<tr className={`table-row ${(products.selectedProduct && products.selectedProduct.id === product.id) ? \"selected\" : \"\"}`}\n onClick={() => {\n if(props.onSelect) props.onSelect(product);\n }}\n key={`product_${product.id}`}>\n <th scope=\"row\">{product.id}</th>\n <td>{product.name}</td>\n <td>{product.qualification}</td>\n <td>{product.experience}</td>\n <td>{product.place}</td>\n </tr>);\n });\n\n\n return (\n <div className=\"table-responsive portlet\">\n <table className=\"table\">\n <thead className=\"thead-light\">\n <tr>\n <th scope=\"col\">#</th>\n <th scope=\"col\">Name</th>\n <th scope=\"col\">Qualification</th>\n <th scope=\"col\">Experience</th>\n <th scope=\"col\">Place</th>\n </tr>\n </thead>\n <tbody>\n {productElements}\n </tbody>\n </table>\n </div>\n\n );\n}\n\nexport default ProductList;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"import _defineProperty from \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/defineProperty\";\nimport _slicedToArray from \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/slicedToArray\";\nvar _jsxFileName = \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Products/ProductsForm.tsx\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nimport React, { useState, Fragment } from \"react\";\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { ProductModificationStatus } from \"../../store/models/product.interface\";\nimport TextInput from \"../../common/components/TextInput\";\nimport { editProduct, clearSelectedProduct, setModificationState, addProduct } from \"../../store/actions/products.action\";\nimport { addNotification } from \"../../store/actions/notifications.action\";\nimport NumberInput from \"../../common/components/NumberInput\";\nimport SelectInput from \"../../common/components/Select\";\n\nconst ProductForm = () => {\n const dispatch = useDispatch();\n const products = useSelector(state => state.products);\n let product = products.selectedProduct;\n const isCreate = products.modificationState === ProductModificationStatus.Create;\n\n if (!product || isCreate) {\n product = {\n id: 0,\n name: \"\",\n description: \"\",\n amount: 0,\n price: 0,\n hasExpiryDate: false,\n category: \"\"\n };\n }\n\n const _useState = useState({\n name: {\n error: \"\",\n value: product.name\n },\n description: {\n error: \"\",\n value: product.description\n },\n amount: {\n error: \"\",\n value: product.amount\n },\n price: {\n error: \"\",\n value: product.price\n },\n hasExpiryDate: {\n error: \"\",\n value: product.hasExpiryDate\n },\n category: {\n error: \"\",\n value: product.category\n }\n }),\n _useState2 = _slicedToArray(_useState, 2),\n formState = _useState2[0],\n setFormState = _useState2[1];\n\n function hasFormValueChanged(model) {\n setFormState(_objectSpread({}, formState, {\n [model.field]: {\n error: model.error,\n value: model.value\n }\n }));\n }\n\n function saveUser(e) {\n e.preventDefault();\n\n if (isFormInvalid()) {\n return;\n }\n\n let saveUserFn = isCreate ? addProduct : editProduct;\n saveForm(formState, saveUserFn);\n }\n\n function saveForm(formState, saveFn) {\n if (product) {\n dispatch(saveFn(_objectSpread({}, product, {\n name: formState.name.value,\n description: formState.description.value,\n price: formState.price.value,\n amount: formState.amount.value,\n hasExpiryDate: formState.hasExpiryDate.value,\n category: formState.category.value\n })));\n dispatch(addNotification(\"Product edited\", \"Product \".concat(formState.name.value, \" edited by you\")));\n dispatch(clearSelectedProduct());\n dispatch(setModificationState(ProductModificationStatus.None));\n }\n }\n\n function cancelForm() {\n dispatch(setModificationState(ProductModificationStatus.None));\n }\n\n function getDisabledClass() {\n let isError = isFormInvalid();\n return isError ? \"disabled\" : \"\";\n }\n\n function isFormInvalid() {\n return formState.amount.error || formState.description.error || formState.name.error || formState.price.error || formState.hasExpiryDate.error || formState.category.error || !formState.name.value || !formState.category.value;\n }\n\n return React.createElement(Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 80\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"col-xl-7 col-lg-7\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 81\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card shadow mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 82\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card-header py-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 83\n },\n __self: this\n }, React.createElement(\"h6\", {\n className: \"m-0 font-weight-bold text-green\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 84\n },\n __self: this\n }, \"Product \", isCreate ? \"create\" : \"edit\")), React.createElement(\"div\", {\n className: \"card-body\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 86\n },\n __self: this\n }, React.createElement(\"form\", {\n onSubmit: saveUser,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 87\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 88\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 89\n },\n __self: this\n }, React.createElement(TextInput, {\n id: \"input_email\",\n value: formState.name.value,\n field: \"name\",\n onChange: hasFormValueChanged,\n required: true,\n maxLength: 20,\n label: \"Name\",\n placeholder: \"Name\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 90\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 99\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 100\n },\n __self: this\n }, React.createElement(SelectInput, {\n id: \"input_qualification\",\n field: \"qualification\",\n label: \"Qualification\",\n options: [\"BAMS\", \"MBBS\", \"BDS\", \"AFIH\"],\n required: true,\n onChange: hasFormValueChanged,\n value: formState.category.value,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 101\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"form-group col-md-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 111\n },\n __self: this\n }, React.createElement(SelectInput, {\n id: \"input_qualification\",\n field: \"qualification\",\n label: \"Profile\",\n options: [\"Ayurveda\", \"Homeopath\", \"Dentist\", \"General Medicine\"],\n required: true,\n onChange: hasFormValueChanged,\n value: formState.category.value,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 112\n },\n __self: this\n }))), React.createElement(\"div\", {\n className: \"form-group col-md-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 123\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 127\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 128\n },\n __self: this\n }, React.createElement(NumberInput, {\n id: \"input_amount\",\n value: formState.amount.value,\n field: \"experience\",\n onChange: hasFormValueChanged,\n max: 100,\n min: 0,\n label: \"Experience\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 129\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"form-group col-md-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 137\n },\n __self: this\n }, React.createElement(NumberInput, {\n id: \"input_price\",\n value: formState.price.value,\n field: \"rating\",\n onChange: hasFormValueChanged,\n max: 100,\n min: 0,\n label: \"Rating\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 138\n },\n __self: this\n }))), React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 147\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 148\n },\n __self: this\n }, React.createElement(NumberInput, {\n id: \"input_amount\",\n value: formState.amount.value,\n field: \"experience\",\n onChange: hasFormValueChanged,\n max: 100,\n min: 0,\n label: \"Experience\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 149\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"form-group col-md-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 157\n },\n __self: this\n }, React.createElement(NumberInput, {\n id: \"input_price\",\n value: formState.price.value,\n field: \"rating\",\n onChange: hasFormValueChanged,\n max: 100,\n min: 0,\n label: \"Rating\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 158\n },\n __self: this\n }))), React.createElement(\"div\", {\n className: \"form-group\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 167\n },\n __self: this\n }, React.createElement(TextInput, {\n id: \"input_description\",\n field: \"description\",\n value: formState.description.value,\n onChange: hasFormValueChanged,\n required: false,\n maxLength: 100,\n label: \"Description\",\n placeholder: \"Description\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 168\n },\n __self: this\n })), React.createElement(\"button\", {\n className: \"btn btn-danger\",\n onClick: () => cancelForm(),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 187\n },\n __self: this\n }, \"Cancel\"), React.createElement(\"button\", {\n type: \"submit\",\n className: \"btn btn-success left-margin \".concat(getDisabledClass()),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 188\n },\n __self: this\n }, \"Save\"))))));\n};\n\nexport default ProductForm;","map":{"version":3,"sources":["/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Products/ProductsForm.tsx"],"names":["React","useState","Fragment","useSelector","useDispatch","ProductModificationStatus","TextInput","editProduct","clearSelectedProduct","setModificationState","addProduct","addNotification","NumberInput","SelectInput","ProductForm","dispatch","products","state","product","selectedProduct","isCreate","modificationState","Create","id","name","description","amount","price","hasExpiryDate","category","error","value","formState","setFormState","hasFormValueChanged","model","field","saveUser","e","preventDefault","isFormInvalid","saveUserFn","saveForm","saveFn","None","cancelForm","getDisabledClass","isError"],"mappings":";;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA+CC,QAA/C,QAA+D,OAA/D;AAEA,SAASC,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AACA,SAAmBC,yBAAnB,QAAoD,sCAApD;AACA,OAAOC,SAAP,MAAsB,mCAAtB;AACA,SAASC,WAAT,EAAsBC,oBAAtB,EAA4CC,oBAA5C,EAAkEC,UAAlE,QAAoF,qCAApF;AACA,SAASC,eAAT,QAAgC,0CAAhC;AACA,OAAOC,WAAP,MAAwB,qCAAxB;AAEA,OAAOC,WAAP,MAAwB,gCAAxB;;AAGA,MAAMC,WAAqB,GAAG,MAAM;AAClC,QAAMC,QAAuB,GAAGX,WAAW,EAA3C;AACA,QAAMY,QAA8B,GAAGb,WAAW,CAAEc,KAAD,IAAuBA,KAAK,CAACD,QAA9B,CAAlD;AACA,MAAIE,OAAwB,GAAGF,QAAQ,CAACG,eAAxC;AACA,QAAMC,QAAiB,GAAIJ,QAAQ,CAACK,iBAAT,KAA+BhB,yBAAyB,CAACiB,MAApF;;AAEA,MAAI,CAACJ,OAAD,IAAYE,QAAhB,EAA0B;AACxBF,IAAAA,OAAO,GAAG;AAAEK,MAAAA,EAAE,EAAE,CAAN;AAASC,MAAAA,IAAI,EAAE,EAAf;AAAmBC,MAAAA,WAAW,EAAE,EAAhC;AAAoCC,MAAAA,MAAM,EAAE,CAA5C;AAA+CC,MAAAA,KAAK,EAAE,CAAtD;AAAyDC,MAAAA,aAAa,EAAE,KAAxE;AAA+EC,MAAAA,QAAQ,EAAE;AAAzF,KAAV;AACD;;AARiC,oBAUA5B,QAAQ,CAAC;AAC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IAAA,GAAG,EAAE,GAJP;AAKE,IAAA,GAAG,EAAE,CALP;AAME,IAAA,KAAK,EAAC,QANR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADF,CAVF,CA5DF,EAgFE;AAAK,IAAA,SAAS,EAAC,YAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACE,oBAAC,SAAD;AAAW,IAAA,EAAE,EAAC,mBAAd;AACA,IAAA,KAAK,EAAG,aADR;AAEE,IAAA,KAAK,EAAEF,SAAS,CAACP,WAAV,CAAsBM,KAF/B;AAGE,IAAA,QAAQ,EAAEG,mBAHZ;AAIE,IAAA,QAAQ,EAAE,KAJZ;AAKE,IAAA,SAAS,EAAE,GALb;AAME,IAAA,KAAK,EAAC,aANR;AAOE,IAAA,WAAW,EAAC,aAPd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADF,CAhFF,EAoGE;AAAQ,IAAA,SAAS,EAAC,gBAAlB;AAAmC,IAAA,OAAO,EAAE,MAAMW,UAAU,EAA5D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cApGF,EAqGE;AAAQ,IAAA,IAAI,EAAC,QAAb;AAAsB,IAAA,SAAS,wCAAiCC,gBAAgB,EAAjD,CAA/B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YArGF,CADF,CAJF,CADF,CADF,CADF;AAoHD,CAtLD;;AAwLA,eAAehC,WAAf","sourcesContent":["import React, { useState, FormEvent, Dispatch, Fragment } from \"react\";\nimport { IStateType, IProductState } from \"../../store/models/root.interface\";\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { IProduct, ProductModificationStatus } from \"../../store/models/product.interface\";\nimport TextInput from \"../../common/components/TextInput\";\nimport { editProduct, clearSelectedProduct, setModificationState, addProduct } from \"../../store/actions/products.action\";\nimport { addNotification } from \"../../store/actions/notifications.action\";\nimport NumberInput from \"../../common/components/NumberInput\";\nimport Checkbox from \"../../common/components/Checkbox\";\nimport SelectInput from \"../../common/components/Select\";\nimport { OnChangeModel, IProductFormState } from \"../../common/types/Form.types\";\n\nconst ProductForm: React.FC = () => {\n const dispatch: Dispatch<any> = useDispatch();\n const products: IProductState | null = useSelector((state: IStateType) => state.products);\n let product: IProduct | null = products.selectedProduct;\n const isCreate: boolean = (products.modificationState === ProductModificationStatus.Create);\n \n if (!product || isCreate) {\n product = { id: 0, name: \"\", description: \"\", amount: 0, price: 0, hasExpiryDate: false, category: \"\" };\n }\n\n const [formState, setFormState] = useState({\n name: { error: \"\", value: product.name },\n description: { error: \"\", value: product.description },\n amount: { error: \"\", value: product.amount },\n price: { error: \"\", value: product.price },\n hasExpiryDate: { error: \"\", value: product.hasExpiryDate },\n category: { error: \"\", value: product.category }\n });\n\n function hasFormValueChanged(model: OnChangeModel): void {\n setFormState({ ...formState, [model.field]: { error: model.error, value: model.value } });\n }\n\n function saveUser(e: FormEvent<HTMLFormElement>): void {\n e.preventDefault();\n if (isFormInvalid()) {\n return;\n }\n\n let saveUserFn: Function = (isCreate) ? addProduct : editProduct;\n saveForm(formState, saveUserFn);\n }\n\n function saveForm(formState: IProductFormState, saveFn: Function): void {\n if (product) {\n dispatch(saveFn({\n ...product,\n name: formState.name.value,\n description: formState.description.value,\n price: formState.price.value,\n amount: formState.amount.value,\n hasExpiryDate: formState.hasExpiryDate.value,\n category: formState.category.value\n }));\n\n dispatch(addNotification(\"Product edited\", `Product ${formState.name.value} edited by you`));\n dispatch(clearSelectedProduct());\n dispatch(setModificationState(ProductModificationStatus.None));\n }\n }\n\n function cancelForm(): void {\n dispatch(setModificationState(ProductModificationStatus.None));\n }\n\n function getDisabledClass(): string {\n let isError: boolean = isFormInvalid();\n return isError ? \"disabled\" : \"\";\n }\n\n function isFormInvalid(): boolean {\n return (formState.amount.error || formState.description.error\n || formState.name.error || formState.price.error || formState.hasExpiryDate.error\n || formState.category.error || !formState.name.value || !formState.category.value) as boolean;\n}\n\n return (\n <Fragment>\n <div className=\"col-xl-7 col-lg-7\">\n <div className=\"card shadow mb-4\">\n <div className=\"card-header py-3\">\n <h6 className=\"m-0 font-weight-bold text-green\">Product {(isCreate ? \"create\" : \"edit\")}</h6>\n </div>\n <div className=\"card-body\">\n <form onSubmit={saveUser}>\n <div className=\"form-row\">\n <div className=\"form-group col-md-6\">\n <TextInput id=\"input_email\"\n value={formState.name.value}\n field=\"name\"\n onChange={hasFormValueChanged}\n required={true}\n maxLength={20}\n label=\"Name\"\n placeholder=\"Name\" />\n </div>\n <div className=\"form-row\">\n <div className=\"form-group col-md-6\">\n <SelectInput\n id=\"input_qualification\"\n field=\"qualification\"\n label=\"Qualification\"\n options={[\"BAMS\", \"MBBS\", \"BDS\", \"AFIH\"]}\n required={true}\n onChange={hasFormValueChanged}\n value={formState.category.value}\n />\n </div>\n <div className=\"form-group col-md-6\">\n <SelectInput\n id=\"input_qualification\"\n field=\"qualification\"\n label=\"Profile\"\n options={[\"Ayurveda\", \"Homeopath\", \"Dentist\", \"General Medicine\"]}\n required={true}\n onChange={hasFormValueChanged}\n value={formState.category.value}\n />\n </div>\n </div>\n <div className=\"form-group col-md-6\">\n \n </div>\n </div>\n <div className=\"form-row\">\n <div className=\"form-group col-md-6\">\n <NumberInput id=\"input_amount\"\n value={formState.amount.value}\n field=\"experience\"\n onChange={hasFormValueChanged}\n max={100}\n min={0}\n label=\"Experience\" />\n </div>\n <div className=\"form-group col-md-6\">\n <NumberInput id=\"input_price\"\n value={formState.price.value}\n field=\"rating\"\n onChange={hasFormValueChanged}\n max={100}\n min={0}\n label=\"Rating\" />\n </div>\n </div>\n <div className=\"form-row\">\n <div className=\"form-group col-md-6\">\n <NumberInput id=\"input_amount\"\n value={formState.amount.value}\n field=\"experience\"\n onChange={hasFormValueChanged}\n max={100}\n min={0}\n label=\"Experience\" />\n </div>\n <div className=\"form-group col-md-6\">\n <NumberInput id=\"input_price\"\n value={formState.price.value}\n field=\"rating\"\n onChange={hasFormValueChanged}\n max={100}\n min={0}\n label=\"Rating\" />\n </div>\n </div>\n <div className=\"form-group\">\n <TextInput id=\"input_description\"\n field = \"description\"\n value={formState.description.value}\n onChange={hasFormValueChanged}\n required={false}\n maxLength={100}\n label=\"Description\"\n placeholder=\"Description\" />\n </div>\n \n {/* <div className=\"form-group\">\n <Checkbox\n id=\"checkbox_expiry\"\n field=\"hasExpiryDate\"\n value={formState.hasExpiryDate.value}\n label=\"Has expiry date\"\n onChange={hasFormValueChanged}\n />\n </div> */}\n <button className=\"btn btn-danger\" onClick={() => cancelForm()}>Cancel</button>\n <button type=\"submit\" className={`btn btn-success left-margin ${getDisabledClass()}`}>Save</button>\n </form>\n </div>\n </div>\n </div>\n </Fragment>\n );\n};\n\nexport default ProductForm;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\src\\\\index.tsx\";\nimport React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport \"./index.css\";\nimport App from \"./App\";\nimport * as serviceWorker from \"./serviceWorker\";\nimport \"../node_modules/bootstrap/dist/css/bootstrap.min.css\";\nimport \"@fortawesome/fontawesome-free/css/all.min.css\";\nimport { Provider } from \"react-redux\";\nimport store from \"./store/store\";\nReactDOM.render(React.createElement(Provider, {\n store: store,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 13\n },\n __self: this\n}, React.createElement(App, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 13\n },\n __self: this\n})), document.getElementById('root')); // f you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n// learn more about service workers: https://bit.ly/CRA-PWA\n\nserviceWorker.unregister();","map":{"version":3,"sources":["D:/FYP/Update/FinalYearProject/Frontend/Patient/React-Admin-Template/src/index.tsx"],"names":["React","ReactDOM","App","serviceWorker","Provider","store","render","document","getElementById","unregister"],"mappings":";AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,QAAP,MAAqB,WAArB;AACA,OAAO,aAAP;AACA,OAAOC,GAAP,MAAgB,OAAhB;AACA,OAAO,KAAKC,aAAZ,MAA+B,iBAA/B;AACA,OAAO,sDAAP;AACA,OAAO,+CAAP;AACA,SAAQC,QAAR,QAAuB,aAAvB;AACA,OAAOC,KAAP,MAAkB,eAAlB;AAIAJ,QAAQ,CAACK,MAAT,CAAgB,oBAAC,QAAD;AAAU,EAAA,KAAK,EAAED,KAAjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAAwB,oBAAC,GAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAxB,CAAhB,EAA4DE,QAAQ,CAACC,cAAT,CAAwB,MAAxB,CAA5D,E,CAEA;AACA;AACA;;AACAL,aAAa,CAACM,UAAd","sourcesContent":["import React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport \"./index.css\";\nimport App from \"./App\";\nimport * as serviceWorker from \"./serviceWorker\";\nimport \"../node_modules/bootstrap/dist/css/bootstrap.min.css\";\nimport \"@fortawesome/fontawesome-free/css/all.min.css\";\nimport {Provider} from \"react-redux\";\nimport store from \"./store/store\";\n\n\n\nReactDOM.render(<Provider store={store}><App /></Provider>, document.getElementById('root'));\n\n// f you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n// learn more about service workers: https://bit.ly/CRA-PWA\nserviceWorker.unregister();\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"'use strict';\n\nvar URL = require('url-parse');\n\nvar debug = function () {};\n\nif (process.env.NODE_ENV !== 'production') {\n debug = require('debug')('sockjs-client:utils:url');\n}\n\nmodule.exports = {\n getOrigin: function (url) {\n if (!url) {\n return null;\n }\n\n var p = new URL(url);\n\n if (p.protocol === 'file:') {\n return null;\n }\n\n var port = p.port;\n\n if (!port) {\n port = p.protocol === 'https:' ? '443' : '80';\n }\n\n return p.protocol + '//' + p.hostname + ':' + port;\n },\n isOriginEqual: function (a, b) {\n var res = this.getOrigin(a) === this.getOrigin(b);\n debug('same', a, b, res);\n return res;\n },\n isSchemeEqual: function (a, b) {\n return a.split(':')[0] === b.split(':')[0];\n },\n addPath: function (url, path) {\n var qs = url.split('?');\n return qs[0] + path + (qs[1] ? '?' + qs[1] : '');\n },\n addQuery: function (url, q) {\n return url + (url.indexOf('?') === -1 ? '?' + q : '&' + q);\n }\n};","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\src\\\\components\\\\Orders\\\\Orders.tsx\";\nimport React, { Fragment } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { updateCurrentPath } from \"../../store/actions/root.actions\";\nimport OrderList from \"./OrderList\";\nimport OrderForm from \"./OrderForm\";\nimport { changeSelectedProduct, clearSelectedProduct } from \"../../store/actions/products.action\";\n\nconst Orders = () => {\n const dispatch = useDispatch();\n const orders = useSelector(state => state.orders.orders);\n const totalSales = orders.reduce((prev, next) => prev + next.totalPrice, 0);\n const totalAmount = orders.reduce((prev, next) => prev + next.amount, 0);\n dispatch(updateCurrentPath(\"orders\", \"list\"));\n dispatch(clearSelectedProduct());\n\n function selectProduct(product) {\n dispatch(changeSelectedProduct(product));\n }\n\n return React.createElement(Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 26\n },\n __self: this\n }, React.createElement(\"h1\", {\n className: \"h3 mb-2 text-gray-800\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 27\n },\n __self: this\n }, \"Lab Reports\"), React.createElement(\"p\", {\n className: \"mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 28\n },\n __self: this\n }, \"Reports here\"), React.createElement(\"div\", {\n className: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 35\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"col-xl-12 col-lg-12\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 36\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card shadow mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 37\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card-header py-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 38\n },\n __self: this\n }, React.createElement(\"h6\", {\n className: \"m-0 font-weight-bold text-green\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 39\n },\n __self: this\n }, \"Report Results\"), React.createElement(\"div\", {\n className: \"header-buttons\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 40\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"card-body\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 43\n },\n __self: this\n }, React.createElement(OrderList, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 44\n },\n __self: this\n }))))), React.createElement(\"div\", {\n className: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 50\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"col-md-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 51\n },\n __self: this\n }, React.createElement(OrderForm, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 52\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"col-md-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 54\n },\n __self: this\n })));\n};\n\nexport default Orders;","map":{"version":3,"sources":["D:/FYP/Update/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Orders/Orders.tsx"],"names":["React","Fragment","useDispatch","useSelector","updateCurrentPath","OrderList","OrderForm","changeSelectedProduct","clearSelectedProduct","Orders","dispatch","orders","state","totalSales","reduce","prev","next","totalPrice","totalAmount","amount","selectProduct","product"],"mappings":";AAAA,OAAOA,KAAP,IAAgBC,QAAhB,QAA0C,OAA1C;AACA,SAASC,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AACA,SAASC,iBAAT,QAAkC,kCAAlC;AAEA,OAAOC,SAAP,MAAsB,aAAtB;AAEA,OAAOC,SAAP,MAAs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;AAAA,KACI;AAAI,IAAA,SAAS,EAAC,iCAAd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBADJ,EAEI;AAAK,IAAA,SAAS,EAAC,gBAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAFJ,CADJ,EAMI;AAAK,IAAA,SAAS,EAAC,WAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI,oBAAC,SAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADJ,CANJ,CADJ,CADJ,CATJ,EAwBI;AAAK,IAAA,SAAS,EAAC,KAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAK,IAAA,SAAS,EAAC,UAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI,oBAAC,SAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADJ,CADJ,EAII;AAAK,IAAA,SAAS,EAAC,UAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAJJ,CAxBJ,CADJ;AAmCH,CA/CD;;AAiDA,eAAeZ,MAAf","sourcesContent":["import React, { Fragment, Dispatch } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { updateCurrentPath } from \"../../store/actions/root.actions\";\nimport { IOrder } from \"../../store/models/order.interface\";\nimport OrderList from \"./OrderList\";\nimport TopCard from \"../../common/components/TopCard\";\nimport OrderForm from \"./OrderForm\";\nimport ProductList from \"../Products/ProductsList\";\nimport { IProduct } from \"../../store/models/product.interface\";\nimport { changeSelectedProduct, clearSelectedProduct } from \"../../store/actions/products.action\";\nimport { IStateType } from \"../../store/models/root.interface\";\n\nconst Orders: React.FC = () => {\n const dispatch: Dispatch<any> = useDispatch();\n const orders: IOrder[] = useSelector((state: IStateType) => state.orders.orders);\n const totalSales: number = orders.reduce((prev, next) => prev + next.totalPrice, 0);\n const totalAmount: number = orders.reduce((prev, next) => prev + next.amount, 0);\n dispatch(updateCurrentPath(\"orders\", \"list\"));\n dispatch(clearSelectedProduct());\n\n function selectProduct(product: IProduct): void {\n dispatch(changeSelectedProduct(product));\n }\n\n return (\n <Fragment>\n <h1 className=\"h3 mb-2 text-gray-800\">Lab Reports</h1>\n <p className=\"mb-4\">Reports here</p>\n\n {/* <div className=\"row\">\n <TopCard title=\"TOTAL SALES\" text={totalSales.toString()} icon=\"donate\" class=\"primary\" />\n <TopCard title=\"TOTAL AMOUNT\" text={totalAmount.toString()} icon=\"calculator\" class=\"danger\" />\n </div> */}\n\n <div className=\"row\">\n <div className=\"col-xl-12 col-lg-12\">\n <div className=\"card shadow mb-4\">\n <div className=\"card-header py-3\">\n <h6 className=\"m-0 font-weight-bold text-green\">Report Results</h6>\n <div className=\"header-buttons\">\n </div>\n </div>\n <div className=\"card-body\">\n <OrderList />\n </div>\n </div>\n </div>\n </div>\n\n <div className=\"row\">\n <div className=\"col-md-6\">\n <OrderForm />\n </div>\n <div className=\"col-md-6\">\n \n </div>\n </div>\n </Fragment>\n )\n}\n\nexport default Orders;"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"'use strict';\n\nmodule.exports = function isCancel(value) {\n return !!(value && value.__CANCEL__);\n};","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"import _slicedToArray from \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\node_modules\\\\babel-preset-react-app\\\\node_modules\\\\@babel\\\\runtime/helpers/esm/slicedToArray\";\nvar _jsxFileName = \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\src\\\\components\\\\LeftMenu\\\\LeftMenu.tsx\";\nimport React, { Fragment, useState } from \"react\";\nimport { Link } from \"react-router-dom\";\n\nconst LeftMenu = () => {\n let _useState = useState(false),\n _useState2 = _slicedToArray(_useState, 2),\n leftMenuVisibility = _useState2[0],\n setLeftMenuVisibility = _useState2[1];\n\n function changeLeftMenuVisibility() {\n setLeftMenuVisibility(!leftMenuVisibility);\n }\n\n function getCollapseClass() {\n return leftMenuVisibility ? \"\" : \"collapsed\";\n }\n\n return React.createElement(Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 17\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"toggle-area\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 18\n },\n __self: this\n }, React.createElement(\"button\", {\n className: \"btn btn-primary toggle-button\",\n onClick: () => changeLeftMenuVisibility(),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 19\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-bolt\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 20\n },\n __self: this\n }))), React.createElement(\"ul\", {\n className: \"navbar-nav bg-gradient-primary-green sidebar sidebar-dark accordion \".concat(getCollapseClass()),\n id: \"collapseMenu\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 24\n },\n __self: this\n }, React.createElement(\"a\", {\n className: \"sidebar-brand d-flex align-items-center justify-content-center\",\n href: \"index.html\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 27\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"sidebar-brand-icon icon-green rotate-n-15\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 28\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-bolt\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 29\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"sidebar-brand-text mx-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 31\n },\n __self: this\n }, \"HMS \", React.createElement(\"sup\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 31\n },\n __self: this\n }, \"Doctor\"))), React.createElement(\"hr\", {\n className: \"sidebar-divider my-0\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 34\n },\n __self: this\n }), React.createElement(\"li\", {\n className: \"nav-item active\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 36\n },\n __self: this\n }, React.createElement(Link, {\n className: \"nav-link\",\n to: \"Home\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 38\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-fw fa-tachometer-alt\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 39\n },\n __self: this\n }), React.createElement(\"span\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 40\n },\n __self: this\n }, \"Dashboard\"))), React.createElement(\"hr\", {\n className: \"sidebar-divider\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 44\n },\n __self: this\n }), React.createElement(\"div\", {\n className: \"sidebar-heading\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 45\n },\n __self: this\n }, \"Managment\"), React.createElement(\"li\", {\n className: \"nav-item\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 49\n },\n __self: this\n }, React.createElement(Link, {\n className: \"nav-link\",\n to: \"/products\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 50\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-fw fa-warehouse\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 51\n },\n __self: this\n }), React.createElement(\"span\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 52\n },\n __self: this\n }, \"Doctor Profiles\"))), React.createElement(\"li\", {\n className: \"nav-item\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 56\n },\n __self: this\n }, React.createElement(Link, {\n className: \"nav-link\",\n to: \"/orders\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 57\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-fw fa-dollar-sign\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 58\n },\n __self: this\n }), React.createElement(\"span\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 59\n },\n __self: this\n }, \"Rescrpitions\"))), React.createElement(\"hr\", {\n className: \"sidebar-divider\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 63\n },\n __self: this\n }), React.createElement(\"div\", {\n className: \"sidebar-heading\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 65\n },\n __self: this\n }, \"Profile\"), React.createElement(\"li\", {\n className: \"nav-item\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 70\n },\n __self: this\n }, React.createElement(Link, {\n className: \"nav-link\",\n to: \"/users\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 71\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-fw fa-user\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 72\n },\n __self: this\n }), React.createElement(\"span\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 73\n },\n __self: this\n }, \"Patients\"))), React.createElement(\"hr\", {\n className: \"sidebar-divider d-none d-md-block\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 77\n },\n __self: this\n })));\n};\n\nexport default LeftMenu;","map":{"version":3,"sources":["D:/FYP/Update/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/LeftMenu/LeftMenu.tsx"],"names":["React","Fragment","useState","Link","LeftMenu","leftMenuVisibility","setLeftMenuVisibility","changeLeftMenuVisibility","getCollapseClass"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,QAA1B,QAA0C,OAA1C;AACA,SAASC,IAAT,QAAqB,kBAArB;;AAEA,MAAMC,QAAkB,GAAG,MAAM;AAAA,kBAEqBF,QAAQ,CAAC,KAAD,CAF7B;AAAA;AAAA,MAExBG,kBAFwB;AAAA,MAEJC,qBAFI;;AAI7B,WAASC,wBAAT,GAAoC;AAChCD,IAAAA,qBAAqB,CAAC,CAACD,kBAAF,CAArB;AACH;;AAED,WAASG,gBAAT,GAA4B;AACxB,WAAQH,kBAAD,GAAuB,EAAvB,GAA4B,WAAnC;AACH;;AAED,SACI,oBAAC,QAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAK,IAAA,SAAS,EAAC,aAAf;AAAA;AAAA;AAAA;AAAA;AAAA;A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,EAqDI;AAAI,IAAA,SAAS,EAAC,mCAAd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IArDJ,CAPJ,CADJ;AAiEH,CA7ED;;AA+EA,eAAeJ,QAAf","sourcesContent":["import React, { Fragment, useState } from \"react\";\nimport { Link } from \"react-router-dom\";\n\nconst LeftMenu: React.FC = () => {\n\n let [leftMenuVisibility, setLeftMenuVisibility] = useState(false);\n\n function changeLeftMenuVisibility() {\n setLeftMenuVisibility(!leftMenuVisibility);\n }\n\n function getCollapseClass() {\n return (leftMenuVisibility) ? \"\" : \"collapsed\";\n }\n\n return (\n <Fragment>\n <div className=\"toggle-area\">\n <button className=\"btn btn-primary toggle-button\" onClick={() => changeLeftMenuVisibility()}>\n <i className=\"fas fa-bolt\"></i>\n </button>\n </div>\n\n <ul className={`navbar-nav bg-gradient-primary-green sidebar sidebar-dark accordion ${getCollapseClass()}`}\n id=\"collapseMenu\">\n\n <a className=\"sidebar-brand d-flex align-items-center justify-content-center\" href=\"index.html\">\n <div className=\"sidebar-brand-icon icon-green rotate-n-15\">\n <i className=\"fas fa-bolt\"></i>\n </div>\n <div className=\"sidebar-brand-text mx-3\">HMS <sup>Doctor</sup></div>\n </a>\n\n <hr className=\"sidebar-divider my-0\" />\n\n <li className=\"nav-item active\">\n\n <Link className=\"nav-link\" to=\"Home\">\n <i className=\"fas fa-fw fa-tachometer-alt\"></i>\n <span>Dashboard</span>\n </Link>\n </li>\n\n <hr className=\"sidebar-divider\" />\n <div className=\"sidebar-heading\">\n Managment\n </div>\n\n <li className=\"nav-item\">\n <Link className=\"nav-link\" to={`/products`}>\n <i className=\"fas fa-fw fa-warehouse\"></i>\n <span>Doctor Profiles</span>\n </Link>\n </li>\n\n <li className=\"nav-item\">\n <Link className=\"nav-link\" to={`/orders`}>\n <i className=\"fas fa-fw fa-dollar-sign\"></i>\n <span>Rescrpitions</span>\n </Link>\n </li>\n \n <hr className=\"sidebar-divider\" />\n\n <div className=\"sidebar-heading\">\n Profile\n </div>\n\n\n <li className=\"nav-item\">\n <Link className=\"nav-link\" to={`/users`}>\n <i className=\"fas fa-fw fa-user\"></i>\n <span>Patients</span>\n </Link>\n </li>\n\n <hr className=\"sidebar-divider d-none d-md-block\" />\n </ul>\n </Fragment>\n );\n};\n\nexport default LeftMenu;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"/*!\n * Determine if an object is a Buffer\n *\n * @author Feross Aboukhadijeh <https://feross.org>\n * @license MIT\n */\nmodule.exports = function isBuffer(obj) {\n return obj != null && obj.constructor != null && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj);\n};","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"module.exports = global.EventSource;","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"'use strict';\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n * @returns {Function}\n */\n\nmodule.exports = function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n};","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Products/ProductsList.tsx\";\nimport React from \"react\";\nimport { useSelector } from \"react-redux\";\n\nfunction ProductList(props) {\n const products = useSelector(state => state.products);\n const productElements = products.products.map(product => {\n if (!product) {\n return null;\n }\n\n return React.createElement(\"tr\", {\n className: \"table-row \".concat(products.selectedProduct && products.selectedProduct.id === product.id ? \"selected\" : \"\"),\n onClick: () => {\n if (props.onSelect) props.onSelect(product);\n },\n key: \"product_\".concat(product.id),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 16\n },\n __self: this\n }, React.createElement(\"th\", {\n scope: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 21\n },\n __self: this\n }, product.id), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 22\n },\n __self: this\n }, product.name), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 23\n },\n __self: this\n }, product.qualification), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 24\n },\n __self: this\n }, product.experience), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 25\n },\n __self: this\n }, product.place));\n });\n return React.createElement(\"div\", {\n className: \"table-responsive portlet\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 31\n },\n __self: this\n }, React.createElement(\"table\", {\n className: \"table\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 32\n },\n __self: this\n }, React.createElement(\"thead\", {\n className: \"thead-light\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 33\n },\n __self: this\n }, React.createElement(\"tr\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 34\n },\n __self: this\n }, React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 35\n },\n __self: this\n }, \"#\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 36\n },\n __self: this\n }, \"Name\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 37\n },\n __self: this\n }, \"Qualification\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 38\n },\n __self: this\n }, \"Experience\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 39\n },\n __self: this\n }, \"Place\"))), React.createElement(\"tbody\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 42\n },\n __self: this\n }, productElements)));\n}\n\nexport default ProductList;","map":{"version":3,"sources":["/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Products/ProductsList.tsx"],"names":["React","useSelector","ProductList","props","products","state","productElements","map","product","selectedProduct","id","onSelect","name","qualification","experience","place"],"mappings":";AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,WAAT,QAA4B,aAA5B;;AASA,SAASC,WAAT,CAAqBC,KAArB,EAA4D;AAC1D,QAAMC,QAAuB,GAAGH,WAAW,CAAEI,KAAD,IAAuBA,KAAK,CAACD,QAA9B,CAA3C;AAEA,QAAME,eAAuC,GAAGF,QAAQ,CAACA,QAAT,CAAkBG,GAAlB,CAAsBC,OAAO,IAAI;AAC/E,QAAI,CAACA,OAAL,EAAc;AAAE,aAAO,IAAP;AAAc;;AAC9B,WAAQ;AAAI,MAAA,SAAS,sBAAgBJ,QAAQ,CAACK,eAAT,IAA4BL,QAAQ,CAACK,eAAT,CAAyBC,EAAzB,KAAgCF,OAAO,CAACE,EAArE,GAA2E,UAA3E,GAAwF,EAAvG,CAAb;AACN,MAAA,OAAO,EAAE,MAAM;AACb,YAAGP,KAAK,CAACQ,QAAT,EAAmBR,KAAK,CAACQ,QAAN,CAAeH,OAAf;AACpB,OAHK;AAIN,MAAA,GAAG,oBAAaA,OAAO,CAACE,EAArB,CAJG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAKN;AAAI,MAAA,KAAK,EAAC,KAAV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAiBF,OAAO,CAACE,EAAzB,CALM,EAMN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAKF,OAAO,CAACI,IAAb,CANM,EAON;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAKJ,OAAO,CAACK,aAAb,CAPM,EAQN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAKL,OAAO,CAACM,UAAb,CARM,EASN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAKN,OAAO,CAACO,KAAb,CATM,CAAR;AAWD,GAb+C,CAAhD;AAgBA,SACE;AAAK,IAAA,SAAS,EAAC,0BAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACE;AAAO,IAAA,SAAS,EAAC,OAAjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACE;AAAO,IAAA,SAAS,EAAC,aAAjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACE;AAAI,IAAA,KAAK,EAAC,KAAV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SADF,EAEE;AAAI,IAAA,KAAK,EAAC,KAAV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAFF,EAGE;AAAI,IAAA,KAAK,EAAC,KAAV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAHF,EAIE;AAAI,IAAA,KAAK,EAAC,KAAV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAJF,EAKE;AAAI,IAAA,KAAK,EAAC,KAAV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aALF,CADF,CADF,EAUE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGT,eADH,CAVF,CADF,CADF;AAmBD;;AAED,eAAeJ,WAAf","sourcesContent":["import React from \"react\";\nimport { useSelector } from \"react-redux\";\nimport { IStateType, IProductState } from \"../../store/models/root.interface\";\nimport { IProduct } from \"../../store/models/product.interface\";\n\nexport type productListProps = {\n onSelect?: (product: IProduct) => void;\n children?: React.ReactNode;\n};\n\nfunction ProductList(props: productListProps): JSX.Element {\n const products: IProductState = useSelector((state: IStateType) => state.products);\n\n const productElements: (JSX.Element | null)[] = products.products.map(product => {\n if (!product) { return null; }\n return (<tr className={`table-row ${(products.selectedProduct && products.selectedProduct.id === product.id) ? \"selected\" : \"\"}`}\n onClick={() => {\n if(props.onSelect) props.onSelect(product);\n }}\n key={`product_${product.id}`}>\n <th scope=\"row\">{product.id}</th>\n <td>{product.name}</td>\n <td>{product.qualification}</td>\n <td>{product.experience}</td>\n <td>{product.place}</td>\n </tr>);\n });\n\n\n return (\n <div className=\"table-responsive portlet\">\n <table className=\"table\">\n <thead className=\"thead-light\">\n <tr>\n <th scope=\"col\">#</th>\n <th scope=\"col\">Name</th>\n <th scope=\"col\">Qualification</th>\n <th scope=\"col\">Experience</th>\n <th scope=\"col\">Place</th>\n </tr>\n </thead>\n <tbody>\n {productElements}\n </tbody>\n </table>\n </div>\n\n );\n}\n\nexport default ProductList;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"import _extends from '@babel/runtime/helpers/esm/extends';\nimport resolvePathname from 'resolve-pathname';\nimport valueEqual from 'value-equal';\nimport warning from 'tiny-warning';\nimport invariant from 'tiny-invariant';\n\nfunction addLeadingSlash(path) {\n return path.charAt(0) === '/' ? path : '/' + path;\n}\n\nfunction stripLeadingSlash(path) {\n return path.charAt(0) === '/' ? path.substr(1) : path;\n}\n\nfunction hasBasename(path, prefix) {\n return path.toLowerCase().indexOf(prefix.toLowerCase()) === 0 && '/?#'.indexOf(path.charAt(prefix.length)) !== -1;\n}\n\nfunction stripBasename(path, prefix) {\n return hasBasename(path, prefix) ? path.substr(prefix.length) : path;\n}\n\nfunction stripTrailingSlash(path) {\n return path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path;\n}\n\nfunction parsePath(path) {\n var pathname = path || '/';\n var search = '';\n var hash = '';\n var hashIndex = pathname.indexOf('#');\n\n if (hashIndex !== -1) {\n hash = pathname.substr(hashIndex);\n pathname = pathname.substr(0, hashIndex);\n }\n\n var searchIndex = pathname.indexOf('?');\n\n if (searchIndex !== -1) {\n search = pathname.substr(searchIndex);\n pathname = pathname.substr(0, searchIndex);\n }\n\n return {\n pathname: pathname,\n search: search === '?' ? '' : search,\n hash: hash === '#' ? '' : hash\n };\n}\n\nfunction createPath(location) {\n var pathname = location.pathname,\n search = location.search,\n hash = location.hash;\n var path = pathname || '/';\n if (search && search !== '?') path += search.charAt(0) === '?' ? search : \"?\" + search;\n if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : \"#\" + hash;\n return path;\n}\n\nfunction createLocation(path, state, key, currentLocation) {\n var location;\n\n if (typeof path === 'string') {\n // Two-arg form: push(path, state)\n location = parsePath(path);\n location.state = state;\n } else {\n // One-arg form: push(location)\n location = _extends({}, path);\n if (location.pathname === undefined) location.pathname = '';\n\n if (location.search) {\n if (location.search.charAt(0) !== '?') location.search = '?' + location.search;\n } else {\n location.search = '';\n }\n\n if (location.hash) {\n if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash;\n } else {\n location.hash = '';\n }\n\n if (state !== undefined && location.state === undefined) location.state = state;\n }\n\n try {\n location.pathname = decodeURI(location.pathname);\n } catch (e) {\n if (e instanceof URIError) {\n throw new URIError('Pathname \"' + location.pathname + '\" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.');\n } else {\n throw e;\n }\n }\n\n if (key) location.key = key;\n\n if (currentLocation) {\n // Resolve incomplete/relative pathname relative to current location.\n if (!location.pathname) {\n location.pathname = currentLocation.pathname;\n } else if (location.pathname.charAt(0) !== '/') {\n location.pathname = resolvePathname(location.pathname, currentLocation.pathname);\n }\n } else {\n // When there is no prior location and pathname is empty, set it to /\n if (!location.pathname) {\n location.pathname = '/';\n }\n }\n\n return location;\n}\n\nfunction locationsAreEqual(a, b) {\n return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash && a.key === b.key && valueEqual(a.state, b.state);\n}\n\nfunction createTransitionManager() {\n var prompt = null;\n\n function setPrompt(nextPrompt) {\n process.env.NODE_ENV !== \"production\" ? warning(prompt == null, 'A history supports only one prompt at a time') : void 0;\n prompt = nextPrompt;\n return function () {\n if (prompt === nextPrompt) prompt = null;\n };\n }\n\n function confirmTransitionTo(location, action, getUserConfirmation, callback) {\n // TODO: If another transition starts while we're still confirming\n // the previous one, we may end up in a weird state. Figure out the\n // best way to handle this.\n if (prompt != null) {\n var result = typeof prompt === 'function' ? prompt(location, action) : prompt;\n\n if (typeof result === 'string') {\n if (typeof getUserConfirmation === 'function') {\n getUserConfirmation(result, callback);\n } else {\n process.env.NODE_ENV !== \"production\" ? warning(false, 'A history needs a getUserConfirmation function in order to use a prompt message') : void 0;\n callback(true);\n }\n } else {\n // Return false from a transition hook to cancel the transition.\n callback(result !== false);\n }\n } else {\n callback(true);\n }\n }\n\n var listeners = [];\n\n function appendListener(fn) {\n var isActive = true;\n\n function listener() {\n if (isActive) fn.apply(void 0, arguments);\n }\n\n listeners.push(listener);\n return function () {\n isActive = false;\n listeners = listeners.filter(function (item) {\n return item !== listener;\n });\n };\n }\n\n function notifyListeners() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n listeners.forEach(function (listener) {\n return listener.apply(void 0, args);\n });\n }\n\n return {\n setPrompt: setPrompt,\n confirmTransitionTo: confirmTransitionTo,\n appendListener: appendListener,\n notifyListeners: notifyListeners\n };\n}\n\nvar canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);\n\nfunction getConfirmation(message, callback) {\n callback(window.confirm(message)); // eslint-disable-line no-alert\n}\n/**\n * Returns true if the HTML5 history API is supported. Taken from Modernizr.\n *\n * https://github.com/Modernizr/Modernizr/blob/master/LICENSE\n * https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js\n * changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586\n */\n\n\nfunction supportsHistory() {\n var ua = window.navigator.userAgent;\n if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false;\n return window.history && 'pushState' in window.history;\n}\n/**\n * Returns true if browser fires popstate on hash change.\n * IE10 and IE11 do not.\n */\n\n\nfunction supportsPopStateOnHashChange() {\n return window.navigator.userAgent.indexOf('Trident') === -1;\n}\n/**\n * Returns false if using go(n) with hash history causes a full page reload.\n */\n\n\nfunction supportsGoWithoutReloadUsingHash() {\n return window.navigator.userAgent.indexOf('Firefox') === -1;\n}\n/**\n * Returns true if a given popstate event is an extraneous WebKit event.\n * Accounts for the fact that Chrome on iOS fires real popstate events\n * containing undefined state when pressing the back button.\n */\n\n\nfunction isExtraneousPopstateEvent(event) {\n return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1;\n}\n\nvar PopStateEvent = 'popstate';\nvar HashChangeEvent = 'hashchange';\n\nfunction getHistoryState() {\n try {\n return window.history.state || {};\n } catch (e) {\n // IE 11 sometimes throws when accessing window.history.state\n // See https://github.com/ReactTraining/history/pull/289\n return {};\n }\n}\n/**\n * Creates a history object that uses the HTML5 history API including\n * pushState, replaceState, and the popstate event.\n */\n\n\nfunction createBrowserHistory(props) {\n if (props === void 0) {\n props = {};\n }\n\n !canUseDOM ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Browser history needs a DOM') : invariant(false) : void 0;\n var globalHistory = window.history;\n var canUseHistory = supportsHistory();\n var needsHashChangeListener = !supportsPopStateOnHashChange();\n var _props = props,\n _props$forceRefresh = _props.forceRefresh,\n forceRefresh = _props$forceRefresh === void 0 ? false : _props$forceRefresh,\n _props$getUserConfirm = _props.getUserConfirmation,\n getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm,\n _props$keyLength = _props.keyLength,\n keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;\n var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : '';\n\n function getDOMLocation(historyState) {\n var _ref = historyState || {},\n key = _ref.key,\n state = _ref.state;\n\n var _window$location = window.location,\n pathname = _window$location.pathname,\n search = _window$location.search,\n hash = _window$location.hash;\n var path = pathname + search + hash;\n process.env.NODE_ENV !== \"production\" ? warning(!basename || hasBasename(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path \"' + path + '\" to begin with \"' + basename + '\".') : void 0;\n if (basename) path = stripBasename(path, basename);\n return createLocation(path, state, key);\n }\n\n function createKey() {\n return Math.random().toString(36).substr(2, keyLength);\n }\n\n var transitionManager = createTransitionManager();\n\n function setState(nextState) {\n _extends(history, nextState);\n\n history.length = globalHistory.length;\n transitionManager.notifyListeners(history.location, history.action);\n }\n\n function handlePopState(event) {\n // Ignore extraneous popstate events in WebKit.\n if (isExtraneousPopstateEvent(event)) return;\n handlePop(getDOMLocation(event.state));\n }\n\n function handleHashChange() {\n handlePop(getDOMLocation(getHistoryState()));\n }\n\n var forceNextPop = false;\n\n function handlePop(location) {\n if (forceNextPop) {\n forceNextPop = false;\n setState();\n } else {\n var action = 'POP';\n transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {\n if (ok) {\n setState({\n action: action,\n location: location\n });\n } else {\n revertPop(location);\n }\n });\n }\n }\n\n function revertPop(fromLocation) {\n var toLocation = history.location; // TODO: We could probably make this more reliable by\n // keeping a list of keys we've seen in sessionStorage.\n // Instead, we just default to 0 for keys we don't know.\n\n var toIndex = allKeys.indexOf(toLocation.key);\n if (toIndex === -1) toIndex = 0;\n var fromIndex = allKeys.indexOf(fromLocation.key);\n if (fromIndex === -1) fromIndex = 0;\n var delta = toIndex - fromIndex;\n\n if (delta) {\n forceNextPop = true;\n go(delta);\n }\n }\n\n var initialLocation = getDOMLocation(getHistoryState());\n var allKeys = [initialLocation.key]; // Public interface\n\n function createHref(location) {\n return basename + createPath(location);\n }\n\n function push(path, state) {\n process.env.NODE_ENV !== \"production\" ? warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;\n var action = 'PUSH';\n var location = createLocation(path, state, createKey(), history.location);\n transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {\n if (!ok) return;\n var href = createHref(location);\n var key = location.key,\n state = location.state;\n\n if (canUseHistory) {\n globalHistory.pushState({\n key: key,\n state: state\n }, null, href);\n\n if (forceRefresh) {\n window.location.href = href;\n } else {\n var prevIndex = allKeys.indexOf(history.location.key);\n var nextKeys = allKeys.slice(0, prevIndex + 1);\n nextKeys.push(location.key);\n allKeys = nextKeys;\n setState({\n action: action,\n location: location\n });\n }\n } else {\n process.env.NODE_ENV !== \"production\" ? warning(state === undefined, 'Browser history cannot push state in browsers that do not support HTML5 history') : void 0;\n window.location.href = href;\n }\n });\n }\n\n function replace(path, state) {\n process.env.NODE_ENV !== \"production\" ? warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;\n var action = 'REPLACE';\n var location = createLocation(path, state, createKey(), history.location);\n transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {\n if (!ok) return;\n var href = createHref(location);\n var key = location.key,\n state = location.state;\n\n if (canUseHistory) {\n globalHistory.replaceState({\n key: key,\n state: state\n }, null, href);\n\n if (forceRefresh) {\n window.location.replace(href);\n } else {\n var prevIndex = allKeys.indexOf(history.location.key);\n if (prevIndex !== -1) allKeys[prevIndex] = location.key;\n setState({\n action: action,\n location: location\n });\n }\n } else {\n process.env.NODE_ENV !== \"production\" ? warning(state === undefined, 'Browser history cannot replace state in browsers that do not support HTML5 history') : void 0;\n window.location.replace(href);\n }\n });\n }\n\n function go(n) {\n globalHistory.go(n);\n }\n\n function goBack() {\n go(-1);\n }\n\n function goForward() {\n go(1);\n }\n\n var listenerCount = 0;\n\n function checkDOMListeners(delta) {\n listenerCount += delta;\n\n if (listenerCount === 1 && delta === 1) {\n window.addEventListener(PopStateEvent, handlePopState);\n if (needsHashChangeListener) window.addEventListener(HashChangeEvent, handleHashChange);\n } else if (listenerCount === 0) {\n window.removeEventListener(PopStateEvent, handlePopState);\n if (needsHashChangeListener) window.removeEventListener(HashChangeEvent, handleHashChange);\n }\n }\n\n var isBlocked = false;\n\n function block(prompt) {\n if (prompt === void 0) {\n prompt = false;\n }\n\n var unblock = transitionManager.setPrompt(prompt);\n\n if (!isBlocked) {\n checkDOMListeners(1);\n isBlocked = true;\n }\n\n return function () {\n if (isBlocked) {\n isBlocked = false;\n checkDOMListeners(-1);\n }\n\n return unblock();\n };\n }\n\n function listen(listener) {\n var unlisten = transitionManager.appendListener(listener);\n checkDOMListeners(1);\n return function () {\n checkDOMListeners(-1);\n unlisten();\n };\n }\n\n var history = {\n length: globalHistory.length,\n action: 'POP',\n location: initialLocation,\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n goBack: goBack,\n goForward: goForward,\n block: block,\n listen: listen\n };\n return history;\n}\n\nvar HashChangeEvent$1 = 'hashchange';\nvar HashPathCoders = {\n hashbang: {\n encodePath: function encodePath(path) {\n return path.charAt(0) === '!' ? path : '!/' + stripLeadingSlash(path);\n },\n decodePath: function decodePath(path) {\n return path.charAt(0) === '!' ? path.substr(1) : path;\n }\n },\n noslash: {\n encodePath: stripLeadingSlash,\n decodePath: addLeadingSlash\n },\n slash: {\n encodePath: addLeadingSlash,\n decodePath: addLeadingSlash\n }\n};\n\nfunction stripHash(url) {\n var hashIndex = url.indexOf('#');\n return hashIndex === -1 ? url : url.slice(0, hashIndex);\n}\n\nfunction getHashPath() {\n // We can't use window.location.hash here because it's not\n // consistent across browsers - Firefox will pre-decode it!\n var href = window.location.href;\n var hashIndex = href.indexOf('#');\n return hashIndex === -1 ? '' : href.substring(hashIndex + 1);\n}\n\nfunction pushHashPath(path) {\n window.location.hash = path;\n}\n\nfunction replaceHashPath(path) {\n window.location.replace(stripHash(window.location.href) + '#' + path);\n}\n\nfunction createHashHistory(props) {\n if (props === void 0) {\n props = {};\n }\n\n !canUseDOM ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Hash history needs a DOM') : invariant(false) : void 0;\n var globalHistory = window.history;\n var canGoWithoutReload = supportsGoWithoutReloadUsingHash();\n var _props = props,\n _props$getUserConfirm = _props.getUserConfirmation,\n getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm,\n _props$hashType = _props.hashType,\n hashType = _props$hashType === void 0 ? 'slash' : _props$hashType;\n var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : '';\n var _HashPathCoders$hashT = HashPathCoders[hashType],\n encodePath = _HashPathCoders$hashT.encodePath,\n decodePath = _HashPathCoders$hashT.decodePath;\n\n function getDOMLocation() {\n var path = decodePath(getHashPath());\n process.env.NODE_ENV !== \"production\" ? warning(!basename || hasBasename(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path \"' + path + '\" to begin with \"' + basename + '\".') : void 0;\n if (basename) path = stripBasename(path, basename);\n return createLocation(path);\n }\n\n var transitionManager = createTransitionManager();\n\n function setState(nextState) {\n _extends(history, nextState);\n\n history.length = globalHistory.length;\n transitionManager.notifyListeners(history.location, history.action);\n }\n\n var forceNextPop = false;\n var ignorePath = null;\n\n function locationsAreEqual$$1(a, b) {\n return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash;\n }\n\n function handleHashChange() {\n var path = getHashPath();\n var encodedPath = encodePath(path);\n\n if (path !== encodedPath) {\n // Ensure we always have a properly-encoded hash.\n replaceHashPath(encodedPath);\n } else {\n var location = getDOMLocation();\n var prevLocation = history.location;\n if (!forceNextPop && locationsAreEqual$$1(prevLocation, location)) return; // A hashchange doesn't always == location change.\n\n if (ignorePath === createPath(location)) return; // Ignore this change; we already setState in push/replace.\n\n ignorePath = null;\n handlePop(location);\n }\n }\n\n function handlePop(location) {\n if (forceNextPop) {\n forceNextPop = false;\n setState();\n } else {\n var action = 'POP';\n transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {\n if (ok) {\n setState({\n action: action,\n location: location\n });\n } else {\n revertPop(location);\n }\n });\n }\n }\n\n function revertPop(fromLocation) {\n var toLocation = history.location; // TODO: We could probably make this more reliable by\n // keeping a list of paths we've seen in sessionStorage.\n // Instead, we just default to 0 for paths we don't know.\n\n var toIndex = allPaths.lastIndexOf(createPath(toLocation));\n if (toIndex === -1) toIndex = 0;\n var fromIndex = allPaths.lastIndexOf(createPath(fromLocation));\n if (fromIndex === -1) fromIndex = 0;\n var delta = toIndex - fromIndex;\n\n if (delta) {\n forceNextPop = true;\n go(delta);\n }\n } // Ensure the hash is encoded properly before doing anything else.\n\n\n var path = getHashPath();\n var encodedPath = encodePath(path);\n if (path !== encodedPath) replaceHashPath(encodedPath);\n var initialLocation = getDOMLocation();\n var allPaths = [createPath(initialLocation)]; // Public interface\n\n function createHref(location) {\n var baseTag = document.querySelector('base');\n var href = '';\n\n if (baseTag && baseTag.getAttribute('href')) {\n href = stripHash(window.location.href);\n }\n\n return href + '#' + encodePath(basename + createPath(location));\n }\n\n function push(path, state) {\n process.env.NODE_ENV !== \"production\" ? warning(state === undefined, 'Hash history cannot push state; it is ignored') : void 0;\n var action = 'PUSH';\n var location = createLocation(path, undefined, undefined, history.location);\n transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {\n if (!ok) return;\n var path = createPath(location);\n var encodedPath = encodePath(basename + path);\n var hashChanged = getHashPath() !== encodedPath;\n\n if (hashChanged) {\n // We cannot tell if a hashchange was caused by a PUSH, so we'd\n // rather setState here and ignore the hashchange. The caveat here\n // is that other hash histories in the page will consider it a POP.\n ignorePath = path;\n pushHashPath(encodedPath);\n var prevIndex = allPaths.lastIndexOf(createPath(history.location));\n var nextPaths = allPaths.slice(0, prevIndex + 1);\n nextPaths.push(path);\n allPaths = nextPaths;\n setState({\n action: action,\n location: location\n });\n } else {\n process.env.NODE_ENV !== \"production\" ? warning(false, 'Hash history cannot PUSH the same path; a new entry will not be added to the history stack') : void 0;\n setState();\n }\n });\n }\n\n function replace(path, state) {\n process.env.NODE_ENV !== \"production\" ? warning(state === undefined, 'Hash history cannot replace state; it is ignored') : void 0;\n var action = 'REPLACE';\n var location = createLocation(path, undefined, undefined, history.location);\n transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {\n if (!ok) return;\n var path = createPath(location);\n var encodedPath = encodePath(basename + path);\n var hashChanged = getHashPath() !== encodedPath;\n\n if (hashChanged) {\n // We cannot tell if a hashchange was caused by a REPLACE, so we'd\n // rather setState here and ignore the hashchange. The caveat here\n // is that other hash histories in the page will consider it a POP.\n ignorePath = path;\n replaceHashPath(encodedPath);\n }\n\n var prevIndex = allPaths.indexOf(createPath(history.location));\n if (prevIndex !== -1) allPaths[prevIndex] = path;\n setState({\n action: action,\n location: location\n });\n });\n }\n\n function go(n) {\n process.env.NODE_ENV !== \"production\" ? warning(canGoWithoutReload, 'Hash history go(n) causes a full page reload in this browser') : void 0;\n globalHistory.go(n);\n }\n\n function goBack() {\n go(-1);\n }\n\n function goForward() {\n go(1);\n }\n\n var listenerCount = 0;\n\n function checkDOMListeners(delta) {\n listenerCount += delta;\n\n if (listenerCount === 1 && delta === 1) {\n window.addEventListener(HashChangeEvent$1, handleHashChange);\n } else if (listenerCount === 0) {\n window.removeEventListener(HashChangeEvent$1, handleHashChange);\n }\n }\n\n var isBlocked = false;\n\n function block(prompt) {\n if (prompt === void 0) {\n prompt = false;\n }\n\n var unblock = transitionManager.setPrompt(prompt);\n\n if (!isBlocked) {\n checkDOMListeners(1);\n isBlocked = true;\n }\n\n return function () {\n if (isBlocked) {\n isBlocked = false;\n checkDOMListeners(-1);\n }\n\n return unblock();\n };\n }\n\n function listen(listener) {\n var unlisten = transitionManager.appendListener(listener);\n checkDOMListeners(1);\n return function () {\n checkDOMListeners(-1);\n unlisten();\n };\n }\n\n var history = {\n length: globalHistory.length,\n action: 'POP',\n location: initialLocation,\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n goBack: goBack,\n goForward: goForward,\n block: block,\n listen: listen\n };\n return history;\n}\n\nfunction clamp(n, lowerBound, upperBound) {\n return Math.min(Math.max(n, lowerBound), upperBound);\n}\n/**\n * Creates a history object that stores locations in memory.\n */\n\n\nfunction createMemoryHistory(props) {\n if (props === void 0) {\n props = {};\n }\n\n var _props = props,\n getUserConfirmation = _props.getUserConfirmation,\n _props$initialEntries = _props.initialEntries,\n initialEntries = _props$initialEntries === void 0 ? ['/'] : _props$initialEntries,\n _props$initialIndex = _props.initialIndex,\n initialIndex = _props$initialIndex === void 0 ? 0 : _props$initialIndex,\n _props$keyLength = _props.keyLength,\n keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;\n var transitionManager = createTransitionManager();\n\n function setState(nextState) {\n _extends(history, nextState);\n\n history.length = history.entries.length;\n transitionManager.notifyListeners(history.location, history.action);\n }\n\n function createKey() {\n return Math.random().toString(36).substr(2, keyLength);\n }\n\n var index = clamp(initialIndex, 0, initialEntries.length - 1);\n var entries = initialEntries.map(function (entry) {\n return typeof entry === 'string' ? createLocation(entry, undefined, createKey()) : createLocation(entry, undefined, entry.key || createKey());\n }); // Public interface\n\n var createHref = createPath;\n\n function push(path, state) {\n process.env.NODE_ENV !== \"production\" ? warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;\n var action = 'PUSH';\n var location = createLocation(path, state, createKey(), history.location);\n transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {\n if (!ok) return;\n var prevIndex = history.index;\n var nextIndex = prevIndex + 1;\n var nextEntries = history.entries.slice(0);\n\n if (nextEntries.length > nextIndex) {\n nextEntries.splice(nextIndex, nextEntries.length - nextIndex, location);\n } else {\n nextEntries.push(location);\n }\n\n setState({\n action: action,\n location: location,\n index: nextIndex,\n entries: nextEntries\n });\n });\n }\n\n function replace(path, state) {\n process.env.NODE_ENV !== \"production\" ? warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;\n var action = 'REPLACE';\n var location = createLocation(path, state, createKey(), history.location);\n transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {\n if (!ok) return;\n history.entries[history.index] = location;\n setState({\n action: action,\n location: location\n });\n });\n }\n\n function go(n) {\n var nextIndex = clamp(history.index + n, 0, history.entries.length - 1);\n var action = 'POP';\n var location = history.entries[nextIndex];\n transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {\n if (ok) {\n setState({\n action: action,\n location: location,\n index: nextIndex\n });\n } else {\n // Mimic the behavior of DOM histories by\n // causing a render after a cancelled POP.\n setState();\n }\n });\n }\n\n function goBack() {\n go(-1);\n }\n\n function goForward() {\n go(1);\n }\n\n function canGo(n) {\n var nextIndex = history.index + n;\n return nextIndex >= 0 && nextIndex < history.entries.length;\n }\n\n function block(prompt) {\n if (prompt === void 0) {\n prompt = false;\n }\n\n return transitionManager.setPrompt(prompt);\n }\n\n function listen(listener) {\n return transitionManager.appendListener(listener);\n }\n\n var history = {\n length: entries.length,\n action: 'POP',\n location: entries[index],\n index: index,\n entries: entries,\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n goBack: goBack,\n goForward: goForward,\n canGo: canGo,\n block: block,\n listen: listen\n };\n return history;\n}\n\nexport { createBrowserHistory, createHashHistory, createMemoryHistory, createLocation, locationsAreEqual, parsePath, createPath };","map":null,"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"import Provider from './components/Provider';\nimport connectAdvanced from './components/connectAdvanced';\nimport { ReactReduxContext } from './components/Context';\nimport connect from './connect/connect';\nimport { useDispatch, createDispatchHook } from './hooks/useDispatch';\nimport { useSelector, createSelectorHook } from './hooks/useSelector';\nimport { useStore, createStoreHook } from './hooks/useStore';\nimport { setBatch } from './utils/batch';\nimport { unstable_batchedUpdates as batch } from './utils/reactBatchedUpdates';\nimport shallowEqual from './utils/shallowEqual';\nsetBatch(batch);\nexport { Provider, connectAdvanced, ReactReduxContext, connect, batch, useDispatch, createDispatchHook, useSelector, createSelectorHook, useStore, createStoreHook, shallowEqual };","map":null,"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Products/ProductsList.tsx\";\nimport React from \"react\";\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { addProduct } from \"../../store/actions/products.action\";\nimport axios from \"axios\";\n\nfunction ProductList(props) {\n const dispatch = useDispatch();\n let product;\n const products = useSelector(state => state.products);\n axios.get(\"http://localhost:8000/staffapi/salary\").then(res => {\n for (let i = 0; i < res.data.length; i++) {\n product = {\n id: res.data[i].id,\n name: res.data[i].Name,\n qualification: res.data[i].Qualification,\n experience: res.data[i].Experience,\n rating: res.data[i].Rating,\n place: res.data[i].Place,\n profile: res.data[i].Profile,\n hasExpiryDate: false,\n price: 0,\n amount: 0,\n category: \"\",\n description: \"\"\n };\n console.log(product);\n dispatch(addProduct(product));\n }\n });\n const productElements = products.products.map(product => {\n if (!product) {\n return null;\n }\n\n return React.createElement(\"tr\", {\n className: \"table-row \".concat(products.selectedProduct && products.selectedProduct.id === product.id ? \"selected\" : \"\"),\n onClick: () => {\n if (props.onSelect) props.onSelect(product);\n },\n key: \"product_\".concat(product.id),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 43\n },\n __self: this\n }, React.createElement(\"th\", {\n scope: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 48\n },\n __self: this\n }, product.id), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 49\n },\n __self: this\n }, product.name), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 50\n },\n __self: this\n }, product.qualification), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 51\n },\n __self: this\n }, product.experience), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 52\n },\n __self: this\n }, product.place));\n });\n return React.createElement(\"div\", {\n className: \"table-responsive portlet\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 58\n },\n __self: this\n }, React.createElement(\"table\", {\n className: \"table\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 59\n },\n __self: this\n }, React.createElement(\"thead\", {\n className: \"thead-light\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 60\n },\n __self: this\n }, React.createElement(\"tr\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 61\n },\n __self: this\n }, React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 62\n },\n __self: this\n }, \"#\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 63\n },\n __self: this\n }, \"Name\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 64\n },\n __self: this\n }, \"Qualification\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 65\n },\n __self: this\n }, \"Experience\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 66\n },\n __self: this\n }, \"Place\"))), React.createElement(\"tbody\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 69\n },\n __self: this\n }, productElements)));\n}\n\nexport default ProductList;","map":{"version":3,"sources":["/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Products/ProductsList.tsx"],"names":["React","useSelector","useDispatch","addProduct","axios","ProductList","props","dispatch","product","products","state","get","then","res","i","data","length","id","name","Name","qualification","Qualification","experience","Experience","rating","Rating","place","Place","profile","Profile","hasExpiryDate","price","amount","category","description","console","log","productElements","map","selectedProduct","onSelect"],"mappings":";AAAA,OAAOA,KAAP,MAA+D,OAA/D;AACA,SAASC,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AAGA,SAAkEC,UAAlE,QAAmG,qCAAnG;AACA,OAAOC,KAAP,MAAkB,OAAlB;;AAOA,SAASC,WAAT,CAAqBC,KAArB,EAA4D;AAC1D,QAAMC,QAAuB,GAAGL,WAAW,EAA3C;AACA,MAAIM,OAAJ;AACA,QA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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAHF,EAIE;AAAI,IAAA,KAAK,EAAC,KAAV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAJF,EAKE;AAAI,IAAA,KAAK,EAAC,KAAV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aALF,CADF,CADF,EAUE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGW,eADH,CAVF,CADF,CADF;AAmBD;;AAED,eAAehC,WAAf","sourcesContent":["import React, { Fragment, Dispatch, useState, useEffect } from \"react\";\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { IStateType, IProductState } from \"../../store/models/root.interface\";\nimport { IProduct } from \"../../store/models/product.interface\";\nimport { editProduct, clearSelectedProduct, setModificationState, addProduct, removeProduct } from \"../../store/actions/products.action\";\nimport axios from \"axios\";\n\nexport type productListProps = {\n onSelect?: (product: IProduct) => void;\n children?: React.ReactNode;\n};\n\nfunction ProductList(props: productListProps): JSX.Element {\n const dispatch: Dispatch<any> = useDispatch();\n let product: IProduct \n const products: IProductState = useSelector((state: IStateType) => state.products);\n\n axios.get(`http://localhost:8000/staffapi/salary`)\n .then(res => {\n for (let i = 0; i < res.data.length; i++) {\n product = {\n id: res.data[i].id,\n name: res.data[i].Name,\n qualification: res.data[i].Qualification,\n experience: res.data[i].Experience,\n rating: res.data[i].Rating,\n place: res.data[i].Place,\n profile: res.data[i].Profile,\n hasExpiryDate: false,\n price: 0,\n amount: 0,\n category: \"\",\n description: \"\"\n };\n console.log(product)\n dispatch(addProduct(product))\n }\n });\n\n\n const productElements: (JSX.Element | null)[] = products.products.map(product => {\n if (!product) { return null; }\n return (<tr className={`table-row ${(products.selectedProduct && products.selectedProduct.id === product.id) ? \"selected\" : \"\"}`}\n onClick={() => {\n if(props.onSelect) props.onSelect(product);\n }}\n key={`product_${product.id}`}>\n <th scope=\"row\">{product.id}</th>\n <td>{product.name}</td>\n <td>{product.qualification}</td>\n <td>{product.experience}</td>\n <td>{product.place}</td>\n </tr>);\n });\n\n\n return (\n <div className=\"table-responsive portlet\">\n <table className=\"table\">\n <thead className=\"thead-light\">\n <tr>\n <th scope=\"col\">#</th>\n <th scope=\"col\">Name</th>\n <th scope=\"col\">Qualification</th>\n <th scope=\"col\">Experience</th>\n <th scope=\"col\">Place</th>\n </tr>\n </thead>\n <tbody>\n {productElements}\n </tbody>\n </table>\n </div>\n\n );\n}\n\nexport default ProductList;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"\"use strict\";\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n createDebug.debug = createDebug;\n createDebug.default = createDebug;\n createDebug.coerce = coerce;\n createDebug.disable = disable;\n createDebug.enable = enable;\n createDebug.enabled = enabled;\n createDebug.humanize = require('ms');\n Object.keys(env).forEach(function (key) {\n createDebug[key] = env[key];\n });\n /**\n * Active `debug` instances.\n */\n\n createDebug.instances = [];\n /**\n * The currently active debug mode names, and names to skip.\n */\n\n createDebug.names = [];\n createDebug.skips = [];\n /**\n * Map of special \"%n\" handling functions, for the debug \"format\" argument.\n *\n * Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n */\n\n createDebug.formatters = {};\n /**\n * Selects a color for a debug namespace\n * @param {String} namespace The namespace string for the for the debug instance to be colored\n * @return {Number|String} An ANSI color code for the given namespace\n * @api private\n */\n\n function selectColor(namespace) {\n var hash = 0;\n\n for (var i = 0; i < namespace.length; i++) {\n hash = (hash << 5) - hash + namespace.charCodeAt(i);\n hash |= 0; // Convert to 32bit integer\n }\n\n return createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n }\n\n createDebug.selectColor = selectColor;\n /**\n * Create a debugger with the given `namespace`.\n *\n * @param {String} namespace\n * @return {Function}\n * @api public\n */\n\n function createDebug(namespace) {\n var prevTime;\n\n function debug() {\n // Disabled?\n if (!debug.enabled) {\n return;\n }\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var self = debug; // Set `diff` timestamp\n\n var curr = Number(new Date());\n var ms = curr - (prevTime || curr);\n self.diff = ms;\n self.prev = prevTime;\n self.curr = curr;\n prevTime = curr;\n args[0] = createDebug.coerce(args[0]);\n\n if (typeof args[0] !== 'string') {\n // Anything else let's inspect with %O\n args.unshift('%O');\n } // Apply any `formatters` transformations\n\n\n var index = 0;\n args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {\n // If we encounter an escaped % then don't increase the array index\n if (match === '%%') {\n return match;\n }\n\n index++;\n var formatter = createDebug.formatters[format];\n\n if (typeof formatter === 'function') {\n var val = args[index];\n match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`\n\n args.splice(index, 1);\n index--;\n }\n\n return match;\n }); // Apply env-specific formatting (colors, etc.)\n\n createDebug.formatArgs.call(self, args);\n var logFn = self.log || createDebug.log;\n logFn.apply(self, args);\n }\n\n debug.namespace = namespace;\n debug.enabled = createDebug.enabled(namespace);\n debug.useColors = createDebug.useColors();\n debug.color = selectColor(namespace);\n debug.destroy = destroy;\n debug.extend = extend; // Debug.formatArgs = formatArgs;\n // debug.rawLog = rawLog;\n // env-specific initialization logic for debug instances\n\n if (typeof createDebug.init === 'function') {\n createDebug.init(debug);\n }\n\n createDebug.instances.push(debug);\n return debug;\n }\n\n function destroy() {\n var index = createDebug.instances.indexOf(this);\n\n if (index !== -1) {\n createDebug.instances.splice(index, 1);\n return true;\n }\n\n return false;\n }\n\n function extend(namespace, delimiter) {\n return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n }\n /**\n * Enables a debug mode by namespaces. This can include modes\n * separated by a colon and wildcards.\n *\n * @param {String} namespaces\n * @api public\n */\n\n\n function enable(namespaces) {\n createDebug.save(namespaces);\n createDebug.names = [];\n createDebug.skips = [];\n var i;\n var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n var len = split.length;\n\n for (i = 0; i < len; i++) {\n if (!split[i]) {\n // ignore empty strings\n continue;\n }\n\n namespaces = split[i].replace(/\\*/g, '.*?');\n\n if (namespaces[0] === '-') {\n createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));\n } else {\n createDebug.names.push(new RegExp('^' + namespaces + '$'));\n }\n }\n\n for (i = 0; i < createDebug.instances.length; i++) {\n var instance = createDebug.instances[i];\n instance.enabled = createDebug.enabled(instance.namespace);\n }\n }\n /**\n * Disable debug output.\n *\n * @api public\n */\n\n\n function disable() {\n createDebug.enable('');\n }\n /**\n * Returns true if the given mode name is enabled, false otherwise.\n *\n * @param {String} name\n * @return {Boolean}\n * @api public\n */\n\n\n function enabled(name) {\n if (name[name.length - 1] === '*') {\n return true;\n }\n\n var i;\n var len;\n\n for (i = 0, len = createDebug.skips.length; i < len; i++) {\n if (createDebug.skips[i].test(name)) {\n return false;\n }\n }\n\n for (i = 0, len = createDebug.names.length; i < len; i++) {\n if (createDebug.names[i].test(name)) {\n return true;\n }\n }\n\n return false;\n }\n /**\n * Coerce `val`.\n *\n * @param {Mixed} val\n * @return {Mixed}\n * @api private\n */\n\n\n function coerce(val) {\n if (val instanceof Error) {\n return val.stack || val.message;\n }\n\n return val;\n }\n\n createDebug.enable(createDebug.load());\n return createDebug;\n}\n\nmodule.exports = setup;","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"import _defineProperty from \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/defineProperty\";\nimport _slicedToArray from \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/slicedToArray\";\nvar _jsxFileName = \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Products/ProductsForm.tsx\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nimport React, { useState, Fragment } from \"react\";\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { ProductModificationStatus } from \"../../store/models/product.interface\";\nimport TextInput from \"../../common/components/TextInput\";\nimport { editProduct, clearSelectedProduct, setModificationState, addProduct } from \"../../store/actions/products.action\";\nimport { addNotification } from \"../../store/actions/notifications.action\";\nimport NumberInput from \"../../common/components/NumberInput\";\nimport SelectInput from \"../../common/components/Select\";\nimport axios from \"axios\";\n\nconst ProductForm = () => {\n const dispatch = useDispatch();\n const products = useSelector(state => state.products);\n let product = products.selectedProduct;\n const isCreate = products.modificationState === ProductModificationStatus.Create;\n\n if (!product || isCreate) {\n product = {\n id: 0,\n name: \"\",\n qualification: \"\",\n experience: 0,\n rating: 0,\n place: \"\",\n profile: \"\",\n description: \"\",\n hasExpiryDate: false,\n price: 0,\n amount: 0,\n category: \"\"\n };\n }\n\n const _useState = useState({\n name: {\n error: \"\",\n value: product.name\n },\n qualification: {\n error: \"\",\n value: product.qualification\n },\n experience: {\n error: \"\",\n value: product.experience\n },\n rating: {\n error: \"\",\n value: product.rating\n },\n place: {\n error: \"\",\n value: product.place\n },\n profile: {\n error: \"\",\n value: product.profile\n },\n description: {\n error: \"\",\n value: product.description\n },\n amount: {\n error: \"\",\n value: product.amount\n },\n price: {\n error: \"\",\n value: product.price\n },\n hasExpiryDate: {\n error: \"\",\n value: product.hasExpiryDate\n },\n category: {\n error: \"\",\n value: product.category\n }\n }),\n _useState2 = _slicedToArray(_useState, 2),\n formState = _useState2[0],\n setFormState = _useState2[1];\n\n const _useState3 = useState(0),\n _useState4 = _slicedToArray(_useState3, 2),\n resState = _useState4[0],\n setresState = _useState4[1];\n\n function hasFormValueChanged(model) {\n setFormState(_objectSpread({}, formState, {\n [model.field]: {\n error: model.error,\n value: model.value\n }\n }));\n }\n\n function saveUser(e) {\n e.preventDefault();\n\n if (isFormInvalid()) {\n return;\n }\n\n let saveUserFn = isCreate ? addProduct : editProduct;\n saveForm(formState, saveUserFn);\n }\n\n function saveForm(formState, saveFn) {\n if (product) {\n dispatch(saveFn(_objectSpread({}, product, {\n name: formState.name.value,\n qualification: formState.qualification.value,\n experience: formState.experience.value,\n rating: formState.rating.value,\n place: formState.place.value,\n profile: formState.profile.value,\n description: formState.description.value\n })));\n dispatch(addNotification(\"Product edited\", \"Product \".concat(formState.name.value, \" edited by you\")));\n dispatch(clearSelectedProduct());\n dispatch(setModificationState(ProductModificationStatus.None));\n const article = {\n Name: formState.name.value,\n Qualification: formState.qualification.value,\n Experience: formState.experience.value + \" years experience\",\n Rating: formState.rating.value + \"%\",\n Place: formState.place.value,\n Profile: formState.profile.value\n };\n axios.post('http://127.0.0.1:8000/staffapi/salary', article).then(response => setresState(response.data)); // if(products != null){\n // products.products.map(product => {\n // removeProduct(product.id)\n // });\n // }\n }\n }\n\n function cancelForm() {\n dispatch(setModificationState(ProductModificationStatus.None));\n }\n\n function getDisabledClass() {\n let isError = isFormInvalid();\n return isError ? \"disabled\" : \"\";\n }\n\n function isFormInvalid() {\n return formState.qualification.error || formState.experience.error || formState.name.error || formState.rating.error || formState.place.error || formState.profile.error || !formState.name.value;\n }\n\n return React.createElement(Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 104\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"col-xl-7 col-lg-7\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 105\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card shadow mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 106\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card-header py-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 107\n },\n __self: this\n }, React.createElement(\"h6\", {\n className: \"m-0 font-weight-bold text-green\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 108\n },\n __self: this\n }, \"Product \", isCreate ? \"create\" : \"edit\")), React.createElement(\"div\", {\n className: \"card-body\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 110\n },\n __self: this\n }, React.createElement(\"form\", {\n onSubmit: saveUser,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 111\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 112\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-12\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 113\n },\n __self: this\n }, React.createElement(TextInput, {\n id: \"input_email\",\n value: formState.name.value,\n field: \"name\",\n onChange: hasFormValueChanged,\n required: true,\n maxLength: 20,\n label: \"Name\",\n placeholder: \"Name\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 114\n },\n __self: this\n }))), React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 124\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 125\n },\n __self: this\n }, React.createElement(SelectInput, {\n id: \"input_qualification\",\n field: \"qualification\",\n label: \"Qualification\",\n options: [\"BAMS\", \"MBBS\", \"BDS\", \"AFIH\"],\n required: true,\n onChange: hasFormValueChanged,\n value: formState.qualification.value,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 126\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"form-group col-md-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 136\n },\n __self: this\n }, React.createElement(SelectInput, {\n id: \"input_profile\",\n field: \"profile\",\n label: \"Profile\",\n options: [\"Ayurveda\", \"Homeopath\", \"Dentist\", \"General Medicine\"],\n required: true,\n onChange: hasFormValueChanged,\n value: formState.profile.value,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 137\n },\n __self: this\n }))), React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 148\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 149\n },\n __self: this\n }, React.createElement(NumberInput, {\n id: \"input_amount\",\n value: formState.experience.value,\n field: \"experience\",\n onChange: hasFormValueChanged,\n max: 100,\n min: 0,\n label: \"Experience\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 150\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"form-group col-md-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 158\n },\n __self: this\n }, React.createElement(NumberInput, {\n id: \"input_price\",\n value: formState.rating.value,\n field: \"rating\",\n onChange: hasFormValueChanged,\n max: 100,\n min: 0,\n label: \"Rating\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 159\n },\n __self: this\n }))), React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 168\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 169\n },\n __self: this\n }, React.createElement(SelectInput, {\n id: \"input_place\",\n field: \"place\",\n label: \"Place\",\n options: [\"Whitefield, Bangalore\", \"Bannerghatta Road, Bangalore\", \"Keelkattalai, Chennai\", \"Porur, Chennai\"],\n required: true,\n onChange: hasFormValueChanged,\n value: formState.place.value,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 170\n },\n __self: this\n }))), React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 181\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 182\n },\n __self: this\n }, React.createElement(TextInput, {\n id: \"input_description\",\n field: \"description\",\n value: formState.description.value,\n onChange: hasFormValueChanged,\n required: false,\n maxLength: 100,\n label: \"Description\",\n placeholder: \"Description\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 183\n },\n __self: this\n }))), React.createElement(\"button\", {\n className: \"btn btn-danger\",\n onClick: () => cancelForm(),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 203\n },\n __self: this\n }, \"Cancel\"), React.createElement(\"button\", {\n type: \"submit\",\n className: \"btn btn-success left-margin \".concat(getDisabledClass()),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 204\n },\n __self: this\n }, \"Save\"))))));\n};\n\nexport default ProductForm;","map":{"version":3,"sources":["/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Products/ProductsForm.tsx"],"names":["React","useState","Fragment","useSelector","useDispatch","ProductModificationStatus","TextInput","editProduct","clearSelectedProduct","setModificationState","addProduct","addNotification","NumberInput","SelectInput","axios","ProductForm","dispatch","products","state","product","selectedProduct","isCreate","modificationState","Create","id","name","qualification","experience","rating","place","profile","description","hasExpiryDate","price","amount","category","error","value","formState","setFormState","resState","setresState","hasFormValueChanged","model","field","saveUser","e","preventDefault","isFormInvalid","saveUserFn","saveForm","saveFn","None","article","Name","Qualification","Experience","Rating","Place","Profile","post","then","response","data","cancelForm","getDisabledClass","isError"],"mappings":";;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA+CC,QAA/C,QAA+D,OAA/D;AAEA,SAASC,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AACA,SAAmBC,yBAAnB,QAAoD,sCAApD;AACA,OAAOC,SAAP,MAAsB,mCAAtB;AACA,SAASC,WAAT,EAAsBC,oBAA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AAC,aAPd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADF,CADF,CAtEF,EA4FE;AAAQ,IAAA,SAAS,EAAC,gBAAlB;AAAmC,IAAA,OAAO,EAAE,MAAMsB,UAAU,EAA5D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cA5FF,EA6FE;AAAQ,IAAA,IAAI,EAAC,QAAb;AAAsB,IAAA,SAAS,wCAAiCC,gBAAgB,EAAjD,CAA/B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YA7FF,CADF,CAJF,CADF,CADF,CADF;AA4GD,CArMD;;AAuMA,eAAelD,WAAf","sourcesContent":["import React, { useState, FormEvent, Dispatch, Fragment } from \"react\";\nimport { IStateType, IProductState } from \"../../store/models/root.interface\";\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { IProduct, ProductModificationStatus } from \"../../store/models/product.interface\";\nimport TextInput from \"../../common/components/TextInput\";\nimport { editProduct, clearSelectedProduct, setModificationState, addProduct, removeProduct } from \"../../store/actions/products.action\";\nimport { addNotification } from \"../../store/actions/notifications.action\";\nimport NumberInput from \"../../common/components/NumberInput\";\nimport Checkbox from \"../../common/components/Checkbox\";\nimport SelectInput from \"../../common/components/Select\";\nimport { OnChangeModel, IProductFormState } from \"../../common/types/Form.types\";\nimport axios from \"axios\";\n\nconst ProductForm: React.FC = () => {\n const dispatch: Dispatch<any> = useDispatch();\n const products: IProductState | null = useSelector((state: IStateType) => state.products);\n let product: IProduct | null = products.selectedProduct;\n const isCreate: boolean = (products.modificationState === ProductModificationStatus.Create);\n \n if (!product || isCreate) {\n product = { id: 0, name: \"\", qualification: \"\", experience: 0, rating: 0, place: \"\", profile: \"\", description: \"\", hasExpiryDate: false, price: 0, amount: 0, category: \"\"};\n }\n\n const [formState, setFormState] = useState({\n name: { error: \"\", value: product.name },\n qualification: { error: \"\", value: product.qualification},\n experience: { error: \"\", value: product.experience},\n rating: { error: \"\", value: product.rating},\n place: { error: \"\", value: product.place},\n profile: { error: \"\", value: product.profile},\n description: { error: \"\", value: product.description},\n amount: { error: \"\", value: product.amount},\n price: { error: \"\", value: product.price},\n hasExpiryDate: { error: \"\", value: product.hasExpiryDate},\n category: { error: \"\", value: product.category},\n });\n\n const [resState, setresState] = useState(0);\n\n function hasFormValueChanged(model: OnChangeModel): void {\n setFormState({ ...formState, [model.field]: { error: model.error, value: model.value } });\n }\n\n function saveUser(e: FormEvent<HTMLFormElement>): void {\n e.preventDefault();\n if (isFormInvalid()) {\n return;\n }\n\n let saveUserFn: Function = (isCreate) ? addProduct : editProduct;\n saveForm(formState, saveUserFn);\n }\n\n function saveForm(formState: IProductFormState, saveFn: Function): void {\n if (product) {\n dispatch(saveFn({\n ...product,\n name: formState.name.value,\n qualification: formState.qualification.value,\n experience: formState.experience.value,\n rating: formState.rating.value,\n place: formState.place.value,\n profile: formState.profile.value,\n description: formState.description.value,\n }));\n\n dispatch(addNotification(\"Product edited\", `Product ${formState.name.value} edited by you`));\n dispatch(clearSelectedProduct());\n dispatch(setModificationState(ProductModificationStatus.None));\n const article = { Name : formState.name.value,\n Qualification: formState.qualification.value,\n Experience: formState.experience.value + \" years experience\",\n Rating: formState.rating.value + \"%\",\n Place: formState.place.value,\n Profile: formState.profile.value\n };\n axios.post('http://127.0.0.1:8000/staffapi/salary', article).then(response => setresState(response.data));\n \n // if(products != null){\n // products.products.map(product => {\n // removeProduct(product.id)\n // });\n // }\n \n }\n }\n\n function cancelForm(): void {\n dispatch(setModificationState(ProductModificationStatus.None));\n }\n\n function getDisabledClass(): string {\n let isError: boolean = isFormInvalid();\n return isError ? \"disabled\" : \"\";\n }\n\n function isFormInvalid(): boolean {\n return (formState.qualification.error || formState.experience.error\n || formState.name.error || formState.rating.error || formState.place.error\n || formState.profile.error || !formState.name.value) as boolean;\n}\n\n return (\n <Fragment>\n <div className=\"col-xl-7 col-lg-7\">\n <div className=\"card shadow mb-4\">\n <div className=\"card-header py-3\">\n <h6 className=\"m-0 font-weight-bold text-green\">Product {(isCreate ? \"create\" : \"edit\")}</h6>\n </div>\n <div className=\"card-body\">\n <form onSubmit={saveUser}>\n <div className=\"form-row\">\n <div className=\"form-group col-md-12\">\n <TextInput id=\"input_email\"\n value={formState.name.value}\n field=\"name\"\n onChange={hasFormValueChanged}\n required={true}\n maxLength={20}\n label=\"Name\"\n placeholder=\"Name\" />\n </div>\n </div>\n <div className=\"form-row\">\n <div className=\"form-group col-md-3\">\n <SelectInput\n id=\"input_qualification\"\n field=\"qualification\"\n label=\"Qualification\"\n options={[\"BAMS\", \"MBBS\", \"BDS\", \"AFIH\"]}\n required={true}\n onChange={hasFormValueChanged}\n value={formState.qualification.value}\n />\n </div>\n <div className=\"form-group col-md-3\">\n <SelectInput\n id=\"input_profile\"\n field=\"profile\"\n label=\"Profile\"\n options={[\"Ayurveda\", \"Homeopath\", \"Dentist\", \"General Medicine\"]}\n required={true}\n onChange={hasFormValueChanged}\n value={formState.profile.value}\n />\n </div>\n </div>\n <div className=\"form-row\">\n <div className=\"form-group col-md-3\">\n <NumberInput id=\"input_amount\"\n value={formState.experience.value}\n field=\"experience\"\n onChange={hasFormValueChanged}\n max={100}\n min={0}\n label=\"Experience\" />\n </div>\n <div className=\"form-group col-md-3\">\n <NumberInput id=\"input_price\"\n value={formState.rating.value}\n field=\"rating\"\n onChange={hasFormValueChanged}\n max={100}\n min={0}\n label=\"Rating\" />\n </div>\n </div>\n <div className=\"form-row\">\n <div className=\"form-group col-md-3\">\n <SelectInput\n id=\"input_place\"\n field=\"place\"\n label=\"Place\"\n options={[\"Whitefield, Bangalore\", \"Bannerghatta Road, Bangalore\", \"Keelkattalai, Chennai\", \"Porur, Chennai\"]}\n required={true}\n onChange={hasFormValueChanged}\n value={formState.place.value}\n />\n </div>\n </div>\n <div className=\"form-row\">\n <div className=\"form-group col-md-3\">\n <TextInput id=\"input_description\"\n field = \"description\"\n value={formState.description.value}\n onChange={hasFormValueChanged}\n required={false}\n maxLength={100}\n label=\"Description\"\n placeholder=\"Description\" />\n </div>\n </div>\n \n {/* <div className=\"form-group\">\n <Checkbox\n id=\"checkbox_expiry\"\n field=\"hasExpiryDate\"\n value={formState.hasExpiryDate.value}\n label=\"Has expiry date\"\n onChange={hasFormValueChanged}\n />\n </div> */}\n <button className=\"btn btn-danger\" onClick={() => cancelForm()}>Cancel</button>\n <button type=\"submit\" className={`btn btn-success left-margin ${getDisabledClass()}`}>Save</button>\n </form>\n </div>\n </div>\n </div>\n </Fragment>\n );\n};\n\nexport default ProductForm;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"'use strict';\n\nvar utils = require('./../utils');\n\nvar transformData = require('./transformData');\n\nvar isCancel = require('../cancel/isCancel');\n\nvar defaults = require('../defaults');\n\nvar isAbsoluteURL = require('./../helpers/isAbsoluteURL');\n\nvar combineURLs = require('./../helpers/combineURLs');\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\n\n\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n}\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\n\n\nmodule.exports = function dispatchRequest(config) {\n throwIfCancellationRequested(config); // Support baseURL config\n\n if (config.baseURL && !isAbsoluteURL(config.url)) {\n config.url = combineURLs(config.baseURL, config.url);\n } // Ensure headers exist\n\n\n config.headers = config.headers || {}; // Transform request data\n\n config.data = transformData(config.data, config.headers, config.transformRequest); // Flatten headers\n\n config.headers = utils.merge(config.headers.common || {}, config.headers[config.method] || {}, config.headers || {});\n utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function cleanHeaderConfig(method) {\n delete config.headers[method];\n });\n var adapter = config.adapter || defaults.adapter;\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config); // Transform response data\n\n response.data = transformData(response.data, response.headers, config.transformResponse);\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config); // Transform response data\n\n if (reason && reason.response) {\n reason.response.data = transformData(reason.response.data, reason.response.headers, config.transformResponse);\n }\n }\n\n return Promise.reject(reason);\n });\n};","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"module.exports = function (originalModule) {\n if (!originalModule.webpackPolyfill) {\n var module = Object.create(originalModule); // module.parent = undefined by default\n\n if (!module.children) module.children = [];\n Object.defineProperty(module, \"loaded\", {\n enumerable: true,\n get: function () {\n return module.l;\n }\n });\n Object.defineProperty(module, \"id\", {\n enumerable: true,\n get: function () {\n return module.i;\n }\n });\n Object.defineProperty(module, \"exports\", {\n enumerable: true\n });\n module.webpackPolyfill = 1;\n }\n\n return module;\n};","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"module.exports = Array.isArray || function (arr) {\n return Object.prototype.toString.call(arr) == '[object Array]';\n};","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"'use strict';\n/**\n * A `Cancel` is an object that is thrown when an operation is canceled.\n *\n * @class\n * @param {string=} message The message.\n */\n\nfunction Cancel(message) {\n this.message = message;\n}\n\nCancel.prototype.toString = function toString() {\n return 'Cancel' + (this.message ? ': ' + this.message : '');\n};\n\nCancel.prototype.__CANCEL__ = true;\nmodule.exports = Cancel;","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"import _slicedToArray from \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\node_modules\\\\babel-preset-react-app\\\\node_modules\\\\@babel\\\\runtime/helpers/esm/slicedToArray\";\nvar _jsxFileName = \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\src\\\\components\\\\LeftMenu\\\\LeftMenu.tsx\";\nimport React, { Fragment, useState } from \"react\";\nimport { Link } from \"react-router-dom\";\n\nconst LeftMenu = () => {\n let _useState = useState(false),\n _useState2 = _slicedToArray(_useState, 2),\n leftMenuVisibility = _useState2[0],\n setLeftMenuVisibility = _useState2[1];\n\n function changeLeftMenuVisibility() {\n setLeftMenuVisibility(!leftMenuVisibility);\n }\n\n function getCollapseClass() {\n return leftMenuVisibility ? \"\" : \"collapsed\";\n }\n\n return React.createElement(Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 17\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"toggle-area\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 18\n },\n __self: this\n }, React.createElement(\"button\", {\n className: \"btn btn-primary toggle-button\",\n onClick: () => changeLeftMenuVisibility(),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 19\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-bolt\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 20\n },\n __self: this\n }))), React.createElement(\"ul\", {\n className: \"navbar-nav bg-gradient-primary-green sidebar sidebar-dark accordion \".concat(getCollapseClass()),\n id: \"collapseMenu\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 24\n },\n __self: this\n }, React.createElement(\"a\", {\n className: \"sidebar-brand d-flex align-items-center justify-content-center\",\n href: \"index.html\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 27\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"sidebar-brand-icon icon-green rotate-n-15\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 28\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-bolt\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 29\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"sidebar-brand-text mx-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 31\n },\n __self: this\n }, \"RyHelpProfile\")), React.createElement(\"hr\", {\n className: \"sidebar-divider my-0\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 34\n },\n __self: this\n }), React.createElement(\"li\", {\n className: \"nav-item active\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 36\n },\n __self: this\n }, React.createElement(Link, {\n className: \"nav-link\",\n to: \"Home\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 38\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-fw fa-tachometer-alt\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 39\n },\n __self: this\n }), React.createElement(\"span\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 40\n },\n __self: this\n }, \"Dashboard\"))), React.createElement(\"hr\", {\n className: \"sidebar-divider\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 44\n },\n __self: this\n }), React.createElement(\"div\", {\n className: \"sidebar-heading\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 45\n },\n __self: this\n }, \"Managment\"), React.createElement(\"li\", {\n className: \"nav-item\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 49\n },\n __self: this\n }, React.createElement(Link, {\n className: \"nav-link\",\n to: \"/products\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 50\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-fw fa-user\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 51\n },\n __self: this\n }), React.createElement(\"span\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 52\n },\n __self: this\n }, \"Doctor Profiles\"))), React.createElement(\"li\", {\n className: \"nav-item\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 56\n },\n __self: this\n }, React.createElement(Link, {\n className: \"nav-link\",\n to: \"/orders\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 57\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-fw fa-dollar-sign\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 58\n },\n __self: this\n }), React.createElement(\"span\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 59\n },\n __self: this\n }, \"Lab Reports\"))), React.createElement(\"hr\", {\n className: \"sidebar-divider\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 63\n },\n __self: this\n }), React.createElement(\"div\", {\n className: \"sidebar-heading\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 65\n },\n __self: this\n }, \"Profile\"), React.createElement(\"li\", {\n className: \"nav-item\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 70\n },\n __self: this\n }, React.createElement(Link, {\n className: \"nav-link\",\n to: \"/users\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 71\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-fw fa-user\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 72\n },\n __self: this\n }), React.createElement(\"span\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 73\n },\n __self: this\n }, \"Patients\"))), React.createElement(\"hr\", {\n className: \"sidebar-divider d-none d-md-block\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 77\n },\n __self: this\n })));\n};\n\nexport default LeftMenu;","map":{"version":3,"sources":["D:/FYP/Update/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/LeftMenu/LeftMenu.tsx"],"names":["React","Fragment","useState","Link","LeftMenu","leftMenuVisibility","setLeftMenuVisibility","changeLeftMenuVisibility","getCollapseClass"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,QAA1B,QAA0C,OAA1C;AACA,SAASC,IAAT,QAAqB,kBAArB;;AAEA,MAAMC,QAAkB,GAAG,MAAM;AAAA,kBAEqBF,QAAQ,CAAC,KAAD,CAF7B;AAAA;AAAA,MAExBG,kBAFwB;AAAA,MAEJC,qBAFI;;AAI7B,WAASC,wBAAT,GAAoC;AAChCD,IAAAA,qBAAqB,CAAC,CAACD,kBAAF,CAArB;AACH;;AAED,WAASG,gBAAT,GAA4B;AACxB,WAAQH,kBAAD,GAAuB,EAAvB,GAA4B,WAAnC;AACH;;AAED,SACI,oBAAC,QAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAK,IAAA,SAAS,EAAC,aAAf;AAAA;AAAA;AAA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CAAd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IArDJ,CAPJ,CADJ;AAiEH,CA7ED;;AA+EA,eAAeJ,QAAf","sourcesContent":["import React, { Fragment, useState } from \"react\";\nimport { Link } from \"react-router-dom\";\n\nconst LeftMenu: React.FC = () => {\n\n let [leftMenuVisibility, setLeftMenuVisibility] = useState(false);\n\n function changeLeftMenuVisibility() {\n setLeftMenuVisibility(!leftMenuVisibility);\n }\n\n function getCollapseClass() {\n return (leftMenuVisibility) ? \"\" : \"collapsed\";\n }\n\n return (\n <Fragment>\n <div className=\"toggle-area\">\n <button className=\"btn btn-primary toggle-button\" onClick={() => changeLeftMenuVisibility()}>\n <i className=\"fas fa-bolt\"></i>\n </button>\n </div>\n\n <ul className={`navbar-nav bg-gradient-primary-green sidebar sidebar-dark accordion ${getCollapseClass()}`}\n id=\"collapseMenu\">\n\n <a className=\"sidebar-brand d-flex align-items-center justify-content-center\" href=\"index.html\">\n <div className=\"sidebar-brand-icon icon-green rotate-n-15\">\n <i className=\"fas fa-bolt\"></i>\n </div>\n <div className=\"sidebar-brand-text mx-3\">RyHelpProfile</div>\n </a>\n\n <hr className=\"sidebar-divider my-0\" />\n\n <li className=\"nav-item active\">\n\n <Link className=\"nav-link\" to=\"Home\">\n <i className=\"fas fa-fw fa-tachometer-alt\"></i>\n <span>Dashboard</span>\n </Link>\n </li>\n\n <hr className=\"sidebar-divider\" />\n <div className=\"sidebar-heading\">\n Managment\n </div>\n\n <li className=\"nav-item\">\n <Link className=\"nav-link\" to={`/products`}>\n <i className=\"fas fa-fw fa-user\"></i>\n <span>Doctor Profiles</span>\n </Link>\n </li>\n\n <li className=\"nav-item\">\n <Link className=\"nav-link\" to={`/orders`}>\n <i className=\"fas fa-fw fa-dollar-sign\"></i>\n <span>Lab Reports</span>\n </Link>\n </li>\n \n <hr className=\"sidebar-divider\" />\n\n <div className=\"sidebar-heading\">\n Profile\n </div>\n\n\n <li className=\"nav-item\">\n <Link className=\"nav-link\" to={`/users`}>\n <i className=\"fas fa-fw fa-user\"></i>\n <span>Patients</span>\n </Link>\n </li>\n\n <hr className=\"sidebar-divider d-none d-md-block\" />\n </ul>\n </Fragment>\n );\n};\n\nexport default LeftMenu;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"function createThunkMiddleware(extraArgument) {\n return function (_ref) {\n var dispatch = _ref.dispatch,\n getState = _ref.getState;\n return function (next) {\n return function (action) {\n if (typeof action === 'function') {\n return action(dispatch, getState, extraArgument);\n }\n\n return next(action);\n };\n };\n };\n}\n\nvar thunk = createThunkMiddleware();\nthunk.withExtraArgument = createThunkMiddleware;\nexport default thunk;","map":null,"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"import { ReactReduxContext } from '../components/Context';\nimport { useStore as useDefaultStore, createStoreHook } from './useStore';\n/**\n * Hook factory, which creates a `useDispatch` hook bound to a given context.\n *\n * @param {Function} [context=ReactReduxContext] Context passed to your `<Provider>`.\n * @returns {Function} A `useDispatch` hook bound to the specified context.\n */\n\nexport function createDispatchHook(context) {\n if (context === void 0) {\n context = ReactReduxContext;\n }\n\n var useStore = context === ReactReduxContext ? useDefaultStore : createStoreHook(context);\n return function useDispatch() {\n var store = useStore();\n return store.dispatch;\n };\n}\n/**\n * A hook to access the redux `dispatch` function.\n *\n * @returns {any|function} redux store's `dispatch` function\n *\n * @example\n *\n * import React, { useCallback } from 'react'\n * import { useDispatch } from 'react-redux'\n *\n * export const CounterComponent = ({ value }) => {\n * const dispatch = useDispatch()\n * const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), [])\n * return (\n * <div>\n * <span>{value}</span>\n * <button onClick={increaseCounter}>Increase counter</button>\n * </div>\n * )\n * }\n */\n\nexport var useDispatch = createDispatchHook();","map":null,"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"import _slicedToArray from \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\node_modules\\\\babel-preset-react-app\\\\node_modules\\\\@babel\\\\runtime/helpers/esm/slicedToArray\";\nvar _jsxFileName = \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\src\\\\common\\\\components\\\\NumberInput.tsx\";\nimport React, { useState } from \"react\";\n\nfunction NumberInput(props) {\n const _useState = useState(false),\n _useState2 = _slicedToArray(_useState, 2),\n touched = _useState2[0],\n setTouch = _useState2[1];\n\n const _useState3 = useState(\"\"),\n _useState4 = _slicedToArray(_useState3, 2),\n error = _useState4[0],\n setError = _useState4[1];\n\n const _useState5 = useState(\"\"),\n _useState6 = _slicedToArray(_useState5, 2),\n htmlClass = _useState6[0],\n setHtmlClass = _useState6[1];\n\n const _useState7 = useState(0),\n _useState8 = _slicedToArray(_useState7, 2),\n setValue = _useState8[1];\n\n function onValueChanged(event) {\n let elementValue = isNaN(Number(event.target.value)) ? 0 : Number(event.target.value);\n let error = \"\",\n validClass = \"\";\n\n if (!error) {\n var _ref = props.max != null && elementValue > props.max ? [\"Value can't be higher than \".concat(props.max, \" \"), \"is-invalid\"] : [\"\", \"is-valid\"];\n\n var _ref2 = _slicedToArray(_ref, 2);\n\n error = _ref2[0];\n validClass = _ref2[1];\n }\n\n if (!error) {\n var _ref3 = props.min != null && elementValue < props.min ? [\"Value can't be lower than \".concat(props.min, \" \"), \"is-invalid\"] : [\"\", \"is-valid\"];\n\n var _ref4 = _slicedToArray(_ref3, 2);\n\n error = _ref4[0];\n validClass = _ref4[1];\n }\n\n props.onChange({\n value: elementValue,\n error: error,\n touched: touched,\n field: props.field\n });\n setTouch(true);\n setError(error);\n setHtmlClass(validClass);\n setValue(elementValue);\n }\n\n return React.createElement(\"div\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 34\n },\n __self: this\n }, React.createElement(\"label\", {\n htmlFor: props.id.toString(),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 35\n },\n __self: this\n }, props.label), React.createElement(\"input\", {\n value: props.value,\n type: \"number\",\n onChange: onValueChanged,\n className: \"form-control \".concat(props.inputClass, \" \").concat(htmlClass),\n id: \"id_\".concat(props.label),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 36\n },\n __self: this\n }), error ? React.createElement(\"div\", {\n className: \"invalid-feedback\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 43\n },\n __self: this\n }, error) : null);\n}\n\nexport default NumberInput;","map":{"version":3,"sources":["D:/FYP/Update/FinalYearProject/Frontend/Patient/React-Admin-Template/src/common/components/NumberInput.tsx"],"names":["React","useState","NumberInput","props","touched","setTouch","error","setError","htmlClass","setHtmlClass","setValue","onValueChanged","event","elementValue","isNaN","Number","target","value","validClass","max","min","onChange","field","id","toString","label","inputClass"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,QAA6C,OAA7C;;AAGA,SAASC,WAAT,CAAqBC,KAArB,EAA2D;AAAA,oBAC3BF,QAAQ,CAAC,KAAD,CADmB;AAAA;AAAA,QAChDG,OADgD;AAAA,QACvCC,QADuC;;AAAA,qBAE7BJ,QAAQ,CAAC,EAAD,CAFqB;AAAA;AAAA,QAEhDK,KAFgD;AAAA,QAEzCC,QAFyC;;AAAA,qBAGrBN,QAAQ,CAAC,EAAD,CAHa;AAAA;AAAA,QAGhDO,SAHgD;AAAA,QAGrCC,YAHqC;;AAAA,qBAIlCR,QAAQ,CAAC,CAAD,CAJ0B;AAAA;AAAA,QAI9CS,QAJ8C;;AAOvD,WAASC,cAAT,CAAwBC,KAAxB,EAAoE;AAChE,QAAIC,YAAoB,GAAIC,KAAK,CAACC,MAAM,CAACH,KAAK,CAACI,MAAN,CAAaC,KAAd,CAAP,CAAN,GAAsC,CAAtC,GAA0CF,MAAM,CAACH,KAAK,CAACI,MAAN,CAAaC,KAAd,CAA3E;AADgE,QAE3DX,KAF2D,GAErC,EAFqC;AAAA,QAEpDY,UAFoD,GAEjC,EAFiC;;AAIhE,QAAI,CAACZ,KAAL,EAAY;AAAA,iB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A,EAAE,eAAQL,KAAK,CAACsB,KAAd,CALN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAFJ,EAQKnB,KAAK,GACF;AAAK,IAAA,SAAS,EAAC,kBAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACKA,KADL,CADE,GAGO,IAXjB,CADJ;AAgBH;;AAED,eAAeJ,WAAf","sourcesContent":["import React, { useState, ChangeEvent } from \"react\";\nimport { NumberInputProps } from \"../types/NumberInput.types\";\n\nfunction NumberInput(props: NumberInputProps): JSX.Element {\n const [touched, setTouch] = useState(false);\n const [error, setError] = useState(\"\");\n const [htmlClass, setHtmlClass] = useState(\"\");\n const [, setValue] = useState(0);\n\n\n function onValueChanged(event: ChangeEvent<HTMLInputElement>): void {\n let elementValue: number = (isNaN(Number(event.target.value))) ? 0 : Number(event.target.value);\n let [error, validClass] = [\"\", \"\"];\n\n if (!error) {\n [error, validClass] = ((props.max != null) && elementValue > (props.max)) ?\n [`Value can't be higher than ${props.max} `, \"is-invalid\"] : [\"\", \"is-valid\"];\n }\n\n if (!error) {\n [error, validClass] = ((props.min != null) && elementValue < (props.min)) ?\n [`Value can't be lower than ${props.min} `, \"is-invalid\"] : [\"\", \"is-valid\"];\n }\n\n props.onChange({ value: elementValue, error: error, touched: touched, field: props.field });\n\n setTouch(true);\n setError(error);\n setHtmlClass(validClass);\n setValue(elementValue);\n }\n\n return (\n <div>\n <label htmlFor={props.id.toString()}>{props.label}</label>\n <input\n value={props.value}\n type=\"number\"\n onChange={onValueChanged}\n className={`form-control ${props.inputClass} ${htmlClass}`}\n id={`id_${props.label}`}/>\n {error ?\n <div className=\"invalid-feedback\">\n {error}\n </div> : null\n }\n </div>\n );\n}\n\nexport default NumberInput;"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"import _slicedToArray from \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\node_modules\\\\babel-preset-react-app\\\\node_modules\\\\@babel\\\\runtime/helpers/esm/slicedToArray\";\nvar _jsxFileName = \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\src\\\\components\\\\LeftMenu\\\\LeftMenu.tsx\";\nimport React, { Fragment, useState } from \"react\";\nimport { Link } from \"react-router-dom\";\n\nconst LeftMenu = () => {\n let _useState = useState(false),\n _useState2 = _slicedToArray(_useState, 2),\n leftMenuVisibility = _useState2[0],\n setLeftMenuVisibility = _useState2[1];\n\n function changeLeftMenuVisibility() {\n setLeftMenuVisibility(!leftMenuVisibility);\n }\n\n function getCollapseClass() {\n return leftMenuVisibility ? \"\" : \"collapsed\";\n }\n\n return React.createElement(Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 17\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"toggle-area\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 18\n },\n __self: this\n }, React.createElement(\"button\", {\n className: \"btn btn-primary toggle-button\",\n onClick: () => changeLeftMenuVisibility(),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 19\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-bolt\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 20\n },\n __self: this\n }))), React.createElement(\"ul\", {\n className: \"navbar-nav bg-gradient-primary-green sidebar sidebar-dark accordion \".concat(getCollapseClass()),\n id: \"collapseMenu\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 24\n },\n __self: this\n }, React.createElement(\"a\", {\n className: \"sidebar-brand d-flex align-items-center justify-content-center\",\n href: \"index.html\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 27\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"sidebar-brand-text mx-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 31\n },\n __self: this\n }, \"RyHealthProfile\")), React.createElement(\"hr\", {\n className: \"sidebar-divider my-0\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 34\n },\n __self: this\n }), React.createElement(\"li\", {\n className: \"nav-item active\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 36\n },\n __self: this\n }, React.createElement(Link, {\n className: \"nav-link\",\n to: \"Home\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 38\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-fw fa-tachometer-alt\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 39\n },\n __self: this\n }), React.createElement(\"span\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 40\n },\n __self: this\n }, \"Dashboard\"))), React.createElement(\"hr\", {\n className: \"sidebar-divider\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 44\n },\n __self: this\n }), React.createElement(\"div\", {\n className: \"sidebar-heading\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 45\n },\n __self: this\n }, \"Managment\"), React.createElement(\"li\", {\n className: \"nav-item\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 49\n },\n __self: this\n }, React.createElement(Link, {\n className: \"nav-link\",\n to: \"/products\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 50\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-fw fa-user\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 51\n },\n __self: this\n }), React.createElement(\"span\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 52\n },\n __self: this\n }, \"Doctor Profiles\"))), React.createElement(\"li\", {\n className: \"nav-item\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 56\n },\n __self: this\n }, React.createElement(Link, {\n className: \"nav-link\",\n to: \"/orders\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 57\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-fw fa-dollar-sign\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 58\n },\n __self: this\n }), React.createElement(\"span\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 59\n },\n __self: this\n }, \"Lab Reports\"))), React.createElement(\"hr\", {\n className: \"sidebar-divider\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 63\n },\n __self: this\n }), React.createElement(\"div\", {\n className: \"sidebar-heading\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 65\n },\n __self: this\n }, \"Profile\"), React.createElement(\"li\", {\n className: \"nav-item\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 70\n },\n __self: this\n }, React.createElement(Link, {\n className: \"nav-link\",\n to: \"/users\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 71\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-fw fa-user\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 72\n },\n __self: this\n }), React.createElement(\"span\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 73\n },\n __self: this\n }, \"Patients\"))), React.createElement(\"hr\", {\n className: \"sidebar-divider d-none d-md-block\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 77\n },\n __self: this\n })));\n};\n\nexport default LeftMenu;","map":{"version":3,"sources":["D:/FYP/Update/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/LeftMenu/LeftMenu.tsx"],"names":["React","Fragment","useState","Link","LeftMenu","leftMenuVisibility","setLeftMenuVisibility","changeLeftMenuVisibility","getCollapseClass"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,QAA1B,QAA0C,OAA1C;AACA,SAASC,IAAT,QAAqB,kBAArB;;AAEA,MAAMC,QAAkB,GAAG,MAAM;AAAA,kBAEqBF,QAAQ,CAAC,KAAD,CAF7B;AAAA;AAAA,MAExBG,kBAFwB;AAAA,MAEJC,qBAFI;;AAI7B,WAASC,wBAAT,GAAoC;AAChCD,IAAAA,qBAAqB,CAAC,CAACD,kBAAF,CAArB;AACH;;AAED,WAASG,gBAAT,GAA4B;AACxB,WAAQH,kBAAD,GAAuB,EAAvB,GAA4B,WAAnC;AACH;;AAED,SACI,oBAAC,QAAD;AAAA;AAAA;AAAA;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AAeJ,QAAf","sourcesContent":["import React, { Fragment, useState } from \"react\";\nimport { Link } from \"react-router-dom\";\n\nconst LeftMenu: React.FC = () => {\n\n let [leftMenuVisibility, setLeftMenuVisibility] = useState(false);\n\n function changeLeftMenuVisibility() {\n setLeftMenuVisibility(!leftMenuVisibility);\n }\n\n function getCollapseClass() {\n return (leftMenuVisibility) ? \"\" : \"collapsed\";\n }\n\n return (\n <Fragment>\n <div className=\"toggle-area\">\n <button className=\"btn btn-primary toggle-button\" onClick={() => changeLeftMenuVisibility()}>\n <i className=\"fas fa-bolt\"></i>\n </button>\n </div>\n\n <ul className={`navbar-nav bg-gradient-primary-green sidebar sidebar-dark accordion ${getCollapseClass()}`}\n id=\"collapseMenu\">\n\n <a className=\"sidebar-brand d-flex align-items-center justify-content-center\" href=\"index.html\">\n {/* <div className=\"sidebar-brand-icon icon-green rotate-n-15\">\n <i className=\"fas fa-bolt\"></i>\n </div> */}\n <div className=\"sidebar-brand-text mx-3\">RyHealthProfile</div>\n </a>\n\n <hr className=\"sidebar-divider my-0\" />\n\n <li className=\"nav-item active\">\n\n <Link className=\"nav-link\" to=\"Home\">\n <i className=\"fas fa-fw fa-tachometer-alt\"></i>\n <span>Dashboard</span>\n </Link>\n </li>\n\n <hr className=\"sidebar-divider\" />\n <div className=\"sidebar-heading\">\n Managment\n </div>\n\n <li className=\"nav-item\">\n <Link className=\"nav-link\" to={`/products`}>\n <i className=\"fas fa-fw fa-user\"></i>\n <span>Doctor Profiles</span>\n </Link>\n </li>\n\n <li className=\"nav-item\">\n <Link className=\"nav-link\" to={`/orders`}>\n <i className=\"fas fa-fw fa-dollar-sign\"></i>\n <span>Lab Reports</span>\n </Link>\n </li>\n \n <hr className=\"sidebar-divider\" />\n\n <div className=\"sidebar-heading\">\n Profile\n </div>\n\n\n <li className=\"nav-item\">\n <Link className=\"nav-link\" to={`/users`}>\n <i className=\"fas fa-fw fa-user\"></i>\n <span>Patients</span>\n </Link>\n </li>\n\n <hr className=\"sidebar-divider d-none d-md-block\" />\n </ul>\n </Fragment>\n );\n};\n\nexport default LeftMenu;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"'use strict';\n\nvar createError = require('./createError');\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n */\n\n\nmodule.exports = function settle(resolve, reject, response) {\n var validateStatus = response.config.validateStatus;\n\n if (!validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(createError('Request failed with status code ' + response.status, response.config, null, response.request, response));\n }\n};","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"'use strict';\n\nvar Cancel = require('./Cancel');\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @class\n * @param {Function} executor The executor function.\n */\n\n\nfunction CancelToken(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n var resolvePromise;\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n var token = this;\n executor(function cancel(message) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new Cancel(message);\n resolvePromise(token.reason);\n });\n}\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\n\n\nCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n};\n/**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\n\n\nCancelToken.source = function source() {\n var cancel;\n var token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token: token,\n cancel: cancel\n };\n};\n\nmodule.exports = CancelToken;","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"import _defineProperty from \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/defineProperty\";\nimport _slicedToArray from \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/slicedToArray\";\nvar _jsxFileName = \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Products/ProductsForm.tsx\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nimport React, { useState, Fragment } from \"react\";\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { ProductModificationStatus } from \"../../store/models/product.interface\";\nimport TextInput from \"../../common/components/TextInput\";\nimport { editProduct, clearSelectedProduct, setModificationState, addProduct } from \"../../store/actions/products.action\";\nimport { addNotification } from \"../../store/actions/notifications.action\";\nimport NumberInput from \"../../common/components/NumberInput\";\nimport SelectInput from \"../../common/components/Select\";\n\nconst ProductForm = () => {\n const dispatch = useDispatch();\n const products = useSelector(state => state.products);\n let product = products.selectedProduct;\n const isCreate = products.modificationState === ProductModificationStatus.Create;\n\n if (!product || isCreate) {\n product = {\n id: 0,\n name: \"\",\n description: \"\",\n amount: 0,\n price: 0,\n hasExpiryDate: false,\n category: \"\"\n };\n }\n\n const _useState = useState({\n name: {\n error: \"\",\n value: product.name\n },\n description: {\n error: \"\",\n value: product.description\n },\n amount: {\n error: \"\",\n value: product.amount\n },\n price: {\n error: \"\",\n value: product.price\n },\n hasExpiryDate: {\n error: \"\",\n value: product.hasExpiryDate\n },\n category: {\n error: \"\",\n value: product.category\n }\n }),\n _useState2 = _slicedToArray(_useState, 2),\n formState = _useState2[0],\n setFormState = _useState2[1];\n\n function hasFormValueChanged(model) {\n setFormState(_objectSpread({}, formState, {\n [model.field]: {\n error: model.error,\n value: model.value\n }\n }));\n }\n\n function saveUser(e) {\n e.preventDefault();\n\n if (isFormInvalid()) {\n return;\n }\n\n let saveUserFn = isCreate ? addProduct : editProduct;\n saveForm(formState, saveUserFn);\n }\n\n function saveForm(formState, saveFn) {\n if (product) {\n dispatch(saveFn(_objectSpread({}, product, {\n name: formState.name.value,\n description: formState.description.value,\n price: formState.price.value,\n amount: formState.amount.value,\n hasExpiryDate: formState.hasExpiryDate.value,\n category: formState.category.value\n })));\n dispatch(addNotification(\"Product edited\", \"Product \".concat(formState.name.value, \" edited by you\")));\n dispatch(clearSelectedProduct());\n dispatch(setModificationState(ProductModificationStatus.None));\n }\n }\n\n function cancelForm() {\n dispatch(setModificationState(ProductModificationStatus.None));\n }\n\n function getDisabledClass() {\n let isError = isFormInvalid();\n return isError ? \"disabled\" : \"\";\n }\n\n function isFormInvalid() {\n return formState.amount.error || formState.description.error || formState.name.error || formState.price.error || formState.hasExpiryDate.error || formState.category.error || !formState.name.value || !formState.category.value;\n }\n\n return React.createElement(Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 80\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"col-xl-7 col-lg-7\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 81\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card shadow mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 82\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card-header py-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 83\n },\n __self: this\n }, React.createElement(\"h6\", {\n className: \"m-0 font-weight-bold text-green\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 84\n },\n __self: this\n }, \"Product \", isCreate ? \"create\" : \"edit\")), React.createElement(\"div\", {\n className: \"card-body\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 86\n },\n __self: this\n }, React.createElement(\"form\", {\n onSubmit: saveUser,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 87\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 88\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-12\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 89\n },\n __self: this\n }, React.createElement(TextInput, {\n id: \"input_email\",\n value: formState.name.value,\n field: \"name\",\n onChange: hasFormValueChanged,\n required: true,\n maxLength: 20,\n label: \"Name\",\n placeholder: \"Name\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 90\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 99\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 100\n },\n __self: this\n }, React.createElement(SelectInput, {\n id: \"input_qualification\",\n field: \"qualification\",\n label: \"Qualification\",\n options: [\"BAMS\", \"MBBS\", \"BDS\", \"AFIH\"],\n required: true,\n onChange: hasFormValueChanged,\n value: formState.category.value,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 101\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"form-group col-md-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 111\n },\n __self: this\n }, React.createElement(SelectInput, {\n id: \"input_qualification\",\n field: \"qualification\",\n label: \"Profile\",\n options: [\"Ayurveda\", \"Homeopath\", \"Dentist\", \"General Medicine\"],\n required: true,\n onChange: hasFormValueChanged,\n value: formState.category.value,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 112\n },\n __self: this\n }))), React.createElement(\"div\", {\n className: \"form-group col-md-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 123\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 127\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 128\n },\n __self: this\n }, React.createElement(NumberInput, {\n id: \"input_amount\",\n value: formState.amount.value,\n field: \"experience\",\n onChange: hasFormValueChanged,\n max: 100,\n min: 0,\n label: \"Experience\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 129\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"form-group col-md-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 137\n },\n __self: this\n }, React.createElement(NumberInput, {\n id: \"input_price\",\n value: formState.price.value,\n field: \"rating\",\n onChange: hasFormValueChanged,\n max: 100,\n min: 0,\n label: \"Rating\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 138\n },\n __self: this\n }))), React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 147\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-group col-md-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 148\n },\n __self: this\n }, React.createElement(NumberInput, {\n id: \"input_amount\",\n value: formState.amount.value,\n field: \"experience\",\n onChange: hasFormValueChanged,\n max: 100,\n min: 0,\n label: \"Experience\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 149\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"form-group col-md-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 157\n },\n __self: this\n }, React.createElement(NumberInput, {\n id: \"input_price\",\n value: formState.price.value,\n field: \"rating\",\n onChange: hasFormValueChanged,\n max: 100,\n min: 0,\n label: \"Rating\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 158\n },\n __self: this\n }))), React.createElement(\"div\", {\n className: \"form-group\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 167\n },\n __self: this\n }, React.createElement(TextInput, {\n id: \"input_description\",\n field: \"description\",\n value: formState.description.value,\n onChange: hasFormValueChanged,\n required: false,\n maxLength: 100,\n label: \"Description\",\n placeholder: \"Description\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 168\n },\n __self: this\n })), React.createElement(\"button\", {\n className: \"btn btn-danger\",\n onClick: () => cancelForm(),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 187\n },\n __self: this\n }, \"Cancel\"), React.createElement(\"button\", {\n type: \"submit\",\n className: \"btn btn-success left-margin \".concat(getDisabledClass()),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 188\n },\n __self: this\n }, \"Save\"))))));\n};\n\nexport default ProductForm;","map":{"version":3,"sources":["/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Products/ProductsForm.tsx"],"names":["React","useState","Fragment","useSelector","useDispatch","ProductModificationStatus","TextInput","editProduct","clearSelectedProduct","setModificationState","addProduct","addNotification","NumberInput","SelectInput","ProductForm","dispatch","products","state","product","selectedProduct","isCreate","modificationState","Create","id","name","description","amount","price","hasExpiryDate","category","error","value","formState","setFormState","hasFormValueChanged","model","field","saveUser","e","preventDefault","isFormInvalid","saveUserFn","saveForm","saveFn","None","cancelForm","getDisabledClass","isError"],"mappings":";;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA+CC,QAA/C,QAA+D,OAA/D;AAEA,SAASC,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AACA,SAAmBC,yBAAnB,QAAoD,sCAApD;AACA,OAAOC,SAAP,MAAsB,mCAAtB;AACA,SAASC,WAAT,EAAsBC,oBAAtB,EAA4CC,oBAA5C,EAAkEC,UAAlE,QAAoF,qCAApF;AACA,SAASC,eAAT,QAAgC,0CAAhC;AACA,OAAOC,WAAP,MAAwB,qCAAxB;AAEA,OAAOC,WAAP,MAAwB,gCAAxB;;AAGA,MAAMC,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AAE,MAAMW,UAAU,EAA5D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cApGF,EAqGE;AAAQ,IAAA,IAAI,EAAC,QAAb;AAAsB,IAAA,SAAS,wCAAiCC,gBAAgB,EAAjD,CAA/B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YArGF,CADF,CAJF,CADF,CADF,CADF;AAoHD,CAtLD;;AAwLA,eAAehC,WAAf","sourcesContent":["import React, { useState, FormEvent, Dispatch, Fragment } from \"react\";\nimport { IStateType, IProductState } from \"../../store/models/root.interface\";\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { IProduct, ProductModificationStatus } from \"../../store/models/product.interface\";\nimport TextInput from \"../../common/components/TextInput\";\nimport { editProduct, clearSelectedProduct, setModificationState, addProduct } from \"../../store/actions/products.action\";\nimport { addNotification } from \"../../store/actions/notifications.action\";\nimport NumberInput from \"../../common/components/NumberInput\";\nimport Checkbox from \"../../common/components/Checkbox\";\nimport SelectInput from \"../../common/components/Select\";\nimport { OnChangeModel, IProductFormState } from \"../../common/types/Form.types\";\n\nconst ProductForm: React.FC = () => {\n const dispatch: Dispatch<any> = useDispatch();\n const products: IProductState | null = useSelector((state: IStateType) => state.products);\n let product: IProduct | null = products.selectedProduct;\n const isCreate: boolean = (products.modificationState === ProductModificationStatus.Create);\n \n if (!product || isCreate) {\n product = { id: 0, name: \"\", description: \"\", amount: 0, price: 0, hasExpiryDate: false, category: \"\" };\n }\n\n const [formState, setFormState] = useState({\n name: { error: \"\", value: product.name },\n description: { error: \"\", value: product.description },\n amount: { error: \"\", value: product.amount },\n price: { error: \"\", value: product.price },\n hasExpiryDate: { error: \"\", value: product.hasExpiryDate },\n category: { error: \"\", value: product.category }\n });\n\n function hasFormValueChanged(model: OnChangeModel): void {\n setFormState({ ...formState, [model.field]: { error: model.error, value: model.value } });\n }\n\n function saveUser(e: FormEvent<HTMLFormElement>): void {\n e.preventDefault();\n if (isFormInvalid()) {\n return;\n }\n\n let saveUserFn: Function = (isCreate) ? addProduct : editProduct;\n saveForm(formState, saveUserFn);\n }\n\n function saveForm(formState: IProductFormState, saveFn: Function): void {\n if (product) {\n dispatch(saveFn({\n ...product,\n name: formState.name.value,\n description: formState.description.value,\n price: formState.price.value,\n amount: formState.amount.value,\n hasExpiryDate: formState.hasExpiryDate.value,\n category: formState.category.value\n }));\n\n dispatch(addNotification(\"Product edited\", `Product ${formState.name.value} edited by you`));\n dispatch(clearSelectedProduct());\n dispatch(setModificationState(ProductModificationStatus.None));\n }\n }\n\n function cancelForm(): void {\n dispatch(setModificationState(ProductModificationStatus.None));\n }\n\n function getDisabledClass(): string {\n let isError: boolean = isFormInvalid();\n return isError ? \"disabled\" : \"\";\n }\n\n function isFormInvalid(): boolean {\n return (formState.amount.error || formState.description.error\n || formState.name.error || formState.price.error || formState.hasExpiryDate.error\n || formState.category.error || !formState.name.value || !formState.category.value) as boolean;\n}\n\n return (\n <Fragment>\n <div className=\"col-xl-7 col-lg-7\">\n <div className=\"card shadow mb-4\">\n <div className=\"card-header py-3\">\n <h6 className=\"m-0 font-weight-bold text-green\">Product {(isCreate ? \"create\" : \"edit\")}</h6>\n </div>\n <div className=\"card-body\">\n <form onSubmit={saveUser}>\n <div className=\"form-row\">\n <div className=\"form-group col-md-12\">\n <TextInput id=\"input_email\"\n value={formState.name.value}\n field=\"name\"\n onChange={hasFormValueChanged}\n required={true}\n maxLength={20}\n label=\"Name\"\n placeholder=\"Name\" />\n </div>\n <div className=\"form-row\">\n <div className=\"form-group col-md-6\">\n <SelectInput\n id=\"input_qualification\"\n field=\"qualification\"\n label=\"Qualification\"\n options={[\"BAMS\", \"MBBS\", \"BDS\", \"AFIH\"]}\n required={true}\n onChange={hasFormValueChanged}\n value={formState.category.value}\n />\n </div>\n <div className=\"form-group col-md-6\">\n <SelectInput\n id=\"input_qualification\"\n field=\"qualification\"\n label=\"Profile\"\n options={[\"Ayurveda\", \"Homeopath\", \"Dentist\", \"General Medicine\"]}\n required={true}\n onChange={hasFormValueChanged}\n value={formState.category.value}\n />\n </div>\n </div>\n <div className=\"form-group col-md-6\">\n \n </div>\n </div>\n <div className=\"form-row\">\n <div className=\"form-group col-md-6\">\n <NumberInput id=\"input_amount\"\n value={formState.amount.value}\n field=\"experience\"\n onChange={hasFormValueChanged}\n max={100}\n min={0}\n label=\"Experience\" />\n </div>\n <div className=\"form-group col-md-6\">\n <NumberInput id=\"input_price\"\n value={formState.price.value}\n field=\"rating\"\n onChange={hasFormValueChanged}\n max={100}\n min={0}\n label=\"Rating\" />\n </div>\n </div>\n <div className=\"form-row\">\n <div className=\"form-group col-md-6\">\n <NumberInput id=\"input_amount\"\n value={formState.amount.value}\n field=\"experience\"\n onChange={hasFormValueChanged}\n max={100}\n min={0}\n label=\"Experience\" />\n </div>\n <div className=\"form-group col-md-6\">\n <NumberInput id=\"input_price\"\n value={formState.price.value}\n field=\"rating\"\n onChange={hasFormValueChanged}\n max={100}\n min={0}\n label=\"Rating\" />\n </div>\n </div>\n <div className=\"form-group\">\n <TextInput id=\"input_description\"\n field = \"description\"\n value={formState.description.value}\n onChange={hasFormValueChanged}\n required={false}\n maxLength={100}\n label=\"Description\"\n placeholder=\"Description\" />\n </div>\n \n {/* <div className=\"form-group\">\n <Checkbox\n id=\"checkbox_expiry\"\n field=\"hasExpiryDate\"\n value={formState.hasExpiryDate.value}\n label=\"Has expiry date\"\n onChange={hasFormValueChanged}\n />\n </div> */}\n <button className=\"btn btn-danger\" onClick={() => cancelForm()}>Cancel</button>\n <button type=\"submit\" className={`btn btn-success left-margin ${getDisabledClass()}`}>Save</button>\n </form>\n </div>\n </div>\n </div>\n </Fragment>\n );\n};\n\nexport default ProductForm;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/common/components/Notification.tsx\";\nimport React from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { removeNotification } from \"../../store/actions/notifications.action\";\n\nconst Notifications = () => {\n const dispatch = useDispatch();\n const notifications = useSelector(state => state.notifications.notifications);\n\n function closeNotification(id) {\n dispatch(removeNotification(id));\n }\n\n const notificationList = notifications.map(notification => {\n return React.createElement(\"div\", {\n className: \"toast\",\n key: \"notification_\".concat(notification.id),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 18\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"toast-header\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 19\n },\n __self: this\n }, React.createElement(\"i\", {\n className: \"fas fa-fw fa-bell\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 20\n },\n __self: this\n }), React.createElement(\"strong\", {\n className: \"mr-auto\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 21\n },\n __self: this\n }, notification.title), React.createElement(\"small\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 22\n },\n __self: this\n }, notification.date.toLocaleTimeString(navigator.language, {\n hour: '2-digit',\n minute: '2-digit'\n })), React.createElement(\"button\", {\n type: \"button\",\n className: \"ml-2 mb-1 close\",\n \"data-dismiss\": \"toast\",\n \"aria-label\": \"Close\",\n onClick: () => closeNotification(notification.id),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 23\n },\n __self: this\n }, React.createElement(\"span\", {\n \"aria-hidden\": \"true\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 28\n },\n __self: this\n }, \"\\xD7\"))), React.createElement(\"div\", {\n className: \"toast-body\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 31\n },\n __self: this\n }, notification.text));\n });\n return React.createElement(\"div\", {\n className: \"toast-wrapper\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 39\n },\n __self: this\n }, notificationList);\n};\n\nexport default Notifications;","map":{"version":3,"sources":["/home/aloka/Documents/medical-final year project/FinalYearProject/Frontend/Patient/React-Admin-Template/src/common/components/Notification.tsx"],"names":["React","useDispatch","useSelector","removeNotification","Notifications","dispatch","notifications","state","closeNotification","id","notificationList","map","notification","title","date","toLocaleTimeString","navigator","language","hour","minute","text"],"mappings":";AAAA,OAAOA,KAAP,MAAgC,OAAhC;AACA,SAASC,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AAGA,SAASC,kBAAT,QAAmC,0CAAnC;;AAEA,MAAMC,aAAuB,GAAG,MAAM;AACpC,QAAMC,QAAuB,GAAGJ,WAAW,EAA3C;AACA,QAAMK,aAA8B,GAAGJ,WAAW,CAAEK,KAAD,IACjDA,KAAK,CAACD,aAAN,CAAoBA,aAD4B,CAAlD;;AAGA,WAASE,iBAAT,CAA2BC,EAA3B,EAAuC;AACrCJ,IAAAA,QAAQ,CAACF,kBAAkB,CAACM,EAAD,CAAnB,CAAR;AACD;;AAED,QAAMC,gBAAgB,GAAGJ,aAAa,CAACK,GAAd,CAAkBC,YAAY,IAAI;AACzD,WACE;AAAK,MAAA,SAAS,EAAC,OAAf;AAAuB,MAAA,GAAG,yBAAkBA,YAAY,CAACH,EAA/B,CAA1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OACE;AAAK,MAAA,SAAS,EAAC,cAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OACE;AAAG,MAAA,SAAS,EAAC,mBAAb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MADF,EAEE;AAAQ,MAAA,SAAS,EAAC,SAAlB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAA6BG,YAAY,CAACC,KAA1C,CAFF,EAGE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAQD,YAAY,CAACE,IAAb,CAAkBC,kBAAlB,CAAqCC,SAAS,CAACC,QAA/C,EAAyD;AAAEC,MAAAA,IAAI,EAAE,SAAR;AAAmBC,MAAAA,MAAM,EAAE;AAA3B,KAAzD,CAAR,CAHF,EAIE;AAAQ,MAAA,IAAI,EAAC,QAAb;AACE,MAAA,SAAS,EAAC,iBADZ;AAEE,sBAAa,OAFf;AAGE,oBAAW,OAHb;AAIE,MAAA,OAAO,EAAE,MAAMX,iBAAiB,CAACI,YAAY,CAACH,EAAd,CAJlC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAKE;AAAM,qBAAY,MAAlB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cALF,CAJF,CADF,EAaE;AAAK,MAAA,SAAS,EAAC,YAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OACGG,YAAY,CAACQ,IADhB,CAbF,CADF;AAmBD,GApBwB,CAAzB;AAsBA,SACE;AAAK,IAAA,SAAS,EAAC,eAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGV,gBADH,CADF;AAKD,CApCD;;AAsCA,eAAeN,aAAf","sourcesContent":["import React, { Dispatch } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { IStateType } from \"../../store/models/root.interface\";\nimport { INotification } from \"../../store/models/notification.interface\";\nimport { removeNotification } from \"../../store/actions/notifications.action\";\n\nconst Notifications: React.FC = () => {\n const dispatch: Dispatch<any> = useDispatch();\n const notifications: INotification[] = useSelector((state: IStateType) =>\n state.notifications.notifications);\n\n function closeNotification(id: number) {\n dispatch(removeNotification(id));\n }\n\n const notificationList = notifications.map(notification => {\n return (\n <div className=\"toast\" key={`notification_${notification.id}`}>\n <div className=\"toast-header\">\n <i className=\"fas fa-fw fa-bell\"></i>\n <strong className=\"mr-auto\">{notification.title}</strong>\n <small>{notification.date.toLocaleTimeString(navigator.language, { hour: '2-digit', minute: '2-digit' })}</small>\n <button type=\"button\"\n className=\"ml-2 mb-1 close\"\n data-dismiss=\"toast\"\n aria-label=\"Close\"\n onClick={() => closeNotification(notification.id)}>\n <span aria-hidden=\"true\">&times;</span>\n </button>\n </div>\n <div className=\"toast-body\">\n {notification.text}\n </div>\n </div>\n )\n });\n\n return (\n <div className=\"toast-wrapper\">\n {notificationList}\n </div>\n );\n};\n\nexport default Notifications;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"'use strict';\n\nconst ansiRegex = require('ansi-regex');\n\nconst stripAnsi = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string;\n\nmodule.exports = stripAnsi;\nmodule.exports.default = stripAnsi;","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"import _slicedToArray from \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\node_modules\\\\babel-preset-react-app\\\\node_modules\\\\@babel\\\\runtime/helpers/esm/slicedToArray\";\nvar _jsxFileName = \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\src\\\\components\\\\Home\\\\Home.tsx\";\nimport React, { Fragment, useEffect, useState } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { updateCurrentPath } from \"../../store/actions/root.actions\";\nimport TopCard from \"../../common/components/TopCard\";\nimport ProductList from \"../Products/ProductsList\";\nimport axios from \"axios\";\n\nconst Home = () => {\n const products = useSelector(state => state.products);\n const numberItemsCount = products.products.length;\n const totalPrice = products.products.reduce((prev, next) => prev + (next.price * next.amount || 0), 0);\n const totalProductAmount = products.products.reduce((prev, next) => prev + (next.amount || 0), 0);\n const orders = useSelector(state => state.orders.orders);\n const totalSales = orders.reduce((prev, next) => prev + next.totalPrice, 0);\n const totalOrderAmount = orders.reduce((prev, next) => prev + next.amount, 0);\n const email = useSelector(state => state.account.email);\n const dispatch = useDispatch();\n dispatch(updateCurrentPath(\"home\", \"\"));\n\n const _useState = useState(0),\n _useState2 = _slicedToArray(_useState, 2),\n resState = _useState2[0],\n setresState = _useState2[1];\n\n const _useState3 = useState(0),\n _useState4 = _slicedToArray(_useState3, 2),\n appState = _useState4[0],\n setappState = _useState4[1];\n\n let AppList = null;\n useEffect(() => {\n var nameMatch = email.match(/^([^@]*)@/);\n var name = nameMatch ? nameMatch[1] : null;\n const article = {\n email: \"dr.rasika\"\n };\n axios.post('http://127.0.0.1:8000/api/specificAppointment', article).then(response => {\n AppList = response.data.map(Appointment => {\n return React.createElement(\"tr\", {\n className: \"table-row\",\n key: \"order_\".concat(Appointment.id),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 39\n },\n __self: this\n }, React.createElement(\"th\", {\n scope: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 41\n },\n __self: this\n }, Appointment.id), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 42\n },\n __self: this\n }, Appointment.fullName), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 43\n },\n __self: this\n }, Appointment.appointmentTime));\n });\n setappState(response.data.length);\n setresState(AppList);\n });\n }, []);\n return React.createElement(Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 53\n },\n __self: this\n }, React.createElement(\"h1\", {\n className: \"h3 mb-2 text-gray-800\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 54\n },\n __self: this\n }, \"Dashboard\"), React.createElement(\"p\", {\n className: \"mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 55\n },\n __self: this\n }, \"Summary and overview of our doctor stuff here\"), React.createElement(\"div\", {\n className: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 57\n },\n __self: this\n }, React.createElement(TopCard, {\n title: \"DOCTORS COUNT\",\n text: \"\".concat(numberItemsCount),\n icon: \"box\",\n class: \"primary\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 58\n },\n __self: this\n }), React.createElement(TopCard, {\n title: \"APPONITMENT COUNT\",\n text: \"\".concat(appState),\n icon: \"warehouse\",\n class: \"danger\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 59\n },\n __self: this\n }), React.createElement(TopCard, {\n title: \"DOCTOR PRICE\",\n text: \"$\".concat(totalPrice),\n icon: \"dollar-sign\",\n class: \"success\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 60\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 63\n },\n __self: this\n }, React.createElement(TopCard, {\n title: \"EARNINGS\",\n text: totalSales.toString(),\n icon: \"donate\",\n class: \"primary\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 64\n },\n __self: this\n }), React.createElement(TopCard, {\n title: \"TOTAL REPORT\",\n text: totalOrderAmount.toString(),\n icon: \"calculator\",\n class: \"danger\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 65\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 68\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"col-xl-6 col-lg-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 70\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card shadow mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 71\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card-header py-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 72\n },\n __self: this\n }, React.createElement(\"h6\", {\n className: \"m-0 font-weight-bold text-green\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 73\n },\n __self: this\n }, \"Patient list\")), React.createElement(\"div\", {\n className: \"card-body\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 75\n },\n __self: this\n }, React.createElement(ProductList, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 76\n },\n __self: this\n })))), React.createElement(\"div\", {\n className: \"col-xl-6 col-lg-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 82\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card shadow mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 83\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card-header py-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 84\n },\n __self: this\n }, React.createElement(\"h6\", {\n className: \"m-0 font-weight-bold text-green\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 85\n },\n __self: this\n }, \"Appoiments\")), React.createElement(\"div\", {\n className: \"card-body\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 87\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"table-responsive portlet\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 88\n },\n __self: this\n }, React.createElement(\"table\", {\n className: \"table\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 89\n },\n __self: this\n }, React.createElement(\"thead\", {\n className: \"thead-light\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 90\n },\n __self: this\n }, React.createElement(\"tr\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 91\n },\n __self: this\n }, React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 92\n },\n __self: this\n }, \"#\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 93\n },\n __self: this\n }, \"Name\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 94\n },\n __self: this\n }, \"Time\"))), React.createElement(\"tbody\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 99\n },\n __self: this\n }, resState))))))));\n};\n\nexport default Home;","map":{"version":3,"sources":["D:/FYP/Update/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Home/Home.tsx"],"names":["React","Fragment","useEffect","useState","useDispatch","useSelector","updateCurrentPath","TopCard","ProductList","axios","Home","products","state","numberItemsCount","length","totalPrice","reduce","prev","next","price","amount","totalProductAmount","orders","totalSales","totalOrderAmount","email","account","dispatch","resState","setresState","appState","setappState","AppList","nameMatch","match","name","article","post","then","response","data","map","Appointment","id","fullName","appointmentTime","toString"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAAoCC,SAApC,EAA+CC,QAA/C,QAA+D,OAA/D;AACA,SAASC,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AACA,SAASC,iBAAT,QAAkC,kCAAlC;AACA,OAA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AA;AAAA;AAAA;AAAA;AAAA,KACI;AAAI,IAAA,KAAK,EAAC,KAAV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SADJ,EAEI;AAAI,IAAA,KAAK,EAAC,KAAV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAFJ,EAGI;AAAI,IAAA,KAAK,EAAC,KAAV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAHJ,CADJ,CADJ,EAUI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACKlB,QADL,CAVJ,CADF,CADF,CAJF,CADF,CAdF,CAfF,CADF;AA6DD,CAtGD;;AAwGA,eAAelB,IAAf","sourcesContent":["import React, { Fragment, Dispatch, useEffect, useState } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { updateCurrentPath } from \"../../store/actions/root.actions\";\nimport TopCard from \"../../common/components/TopCard\";\nimport { IProductState, IStateType } from \"../../store/models/root.interface\";\nimport ProductList from \"../Products/ProductsList\";\nimport { IOrder } from \"../../store/models/order.interface\";\nimport OrderList from \"../Orders/OrderList\";\nimport axios from \"axios\";\n\nconst Home: React.FC = () => {\n const products: IProductState = useSelector((state: IStateType) => state.products);\n const numberItemsCount: number = products.products.length;\n const totalPrice: number = products.products.reduce((prev, next) => prev + ((next.price * next.amount) || 0), 0);\n const totalProductAmount: number = products.products.reduce((prev, next) => prev + (next.amount || 0), 0);\n\n const orders: IOrder[] = useSelector((state: IStateType) => state.orders.orders);\n const totalSales: number = orders.reduce((prev, next) => prev + next.totalPrice, 0);\n const totalOrderAmount: number = orders.reduce((prev, next) => prev + next.amount, 0);\n\n const email: string = useSelector((state: IStateType) => state.account.email);\n\n const dispatch: Dispatch<any> = useDispatch();\n dispatch(updateCurrentPath(\"home\", \"\"));\n\n const [resState, setresState] = useState(0);\n const [appState, setappState] = useState(0);\n\n let AppList = null \n\n useEffect(() => {\n var nameMatch = email.match(/^([^@]*)@/);\n var name = nameMatch ? nameMatch[1] : null;\n const article = { email : \"dr.rasika\" };\n axios.post('http://127.0.0.1:8000/api/specificAppointment', article)\n .then(response => {\n AppList = response.data.map((Appointment: any) => {\n return (\n <tr className={`table-row`}\n key={`order_${Appointment.id}`}>\n <th scope=\"row\">{Appointment.id}</th>\n <td>{Appointment.fullName}</td>\n <td>{Appointment.appointmentTime}</td>\n </tr>);\n })\n setappState(response.data.length)\n setresState(AppList)\n });\n },[]);\n\n\n return (\n <Fragment>\n <h1 className=\"h3 mb-2 text-gray-800\">Dashboard</h1>\n <p className=\"mb-4\">Summary and overview of our doctor stuff here</p>\n\n <div className=\"row\">\n <TopCard title=\"DOCTORS COUNT\" text={`${numberItemsCount}`} icon=\"box\" class=\"primary\" />\n <TopCard title=\"APPONITMENT COUNT\" text={`${appState}`} icon=\"warehouse\" class=\"danger\" />\n <TopCard title=\"DOCTOR PRICE\" text={`$${totalPrice}`} icon=\"dollar-sign\" class=\"success\" />\n </div>\n\n <div className=\"row\">\n <TopCard title=\"EARNINGS\" text={totalSales.toString()} icon=\"donate\" class=\"primary\" />\n <TopCard title=\"TOTAL REPORT\" text={totalOrderAmount.toString()} icon=\"calculator\" class=\"danger\" />\n </div>\n\n <div className=\"row\">\n\n <div className=\"col-xl-6 col-lg-6\">\n <div className=\"card shadow mb-4\">\n <div className=\"card-header py-3\">\n <h6 className=\"m-0 font-weight-bold text-green\">Patient list</h6>\n </div>\n <div className=\"card-body\">\n <ProductList />\n </div>\n </div>\n\n </div>\n\n <div className=\"col-xl-6 col-lg-6\">\n <div className=\"card shadow mb-4\">\n <div className=\"card-header py-3\">\n <h6 className=\"m-0 font-weight-bold text-green\">Appoiments</h6>\n </div>\n <div className=\"card-body\">\n <div className=\"table-responsive portlet\">\n <table className=\"table\">\n <thead className=\"thead-light\">\n <tr>\n <th scope=\"col\">#</th>\n <th scope=\"col\">Name</th>\n <th scope=\"col\">Time</th>\n {/* <th scope=\"col\">unit</th>\n <th scope=\"col\">Range</th> */}\n </tr>\n </thead>\n <tbody>\n {resState}\n </tbody>\n </table>\n </div>\n\n </div>\n </div>\n </div>\n\n </div>\n\n </Fragment>\n );\n};\n\nexport default Home;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"import _slicedToArray from \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\node_modules\\\\babel-preset-react-app\\\\node_modules\\\\@babel\\\\runtime/helpers/esm/slicedToArray\";\nvar _jsxFileName = \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\src\\\\components\\\\Home\\\\Home.tsx\";\nimport React, { Fragment, useEffect, useState } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { updateCurrentPath } from \"../../store/actions/root.actions\";\nimport TopCard from \"../../common/components/TopCard\";\nimport ProductList from \"../Products/ProductsList\";\nimport axios from \"axios\";\n\nconst Home = () => {\n const products = useSelector(state => state.products);\n const numberItemsCount = products.products.length;\n const totalPrice = products.products.reduce((prev, next) => prev + (next.price * next.amount || 0), 0);\n const totalProductAmount = products.products.reduce((prev, next) => prev + (next.amount || 0), 0);\n const orders = useSelector(state => state.orders.orders);\n const totalSales = orders.reduce((prev, next) => prev + next.totalPrice, 0);\n const totalOrderAmount = orders.reduce((prev, next) => prev + next.amount, 0);\n const email = useSelector(state => state.account.email);\n const dispatch = useDispatch();\n dispatch(updateCurrentPath(\"home\", \"\"));\n\n const _useState = useState(0),\n _useState2 = _slicedToArray(_useState, 2),\n resState = _useState2[0],\n setresState = _useState2[1];\n\n let AppList = null;\n useEffect(() => {\n var nameMatch = email.match(/^([^@]*)@/);\n var name = nameMatch ? nameMatch[1] : null;\n const article = {\n email: \"dr.rasika\"\n };\n axios.post('http://127.0.0.1:8000/api/specificAppointment', article).then(response => {\n AppList = response.data.map(Appointment => {\n return React.createElement(\"tr\", {\n className: \"table-row\",\n key: \"order_\".concat(Appointment.id),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 38\n },\n __self: this\n }, React.createElement(\"th\", {\n scope: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 40\n },\n __self: this\n }, Appointment.id), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 41\n },\n __self: this\n }, Appointment.fullName), React.createElement(\"td\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 42\n },\n __self: this\n }, Appointment.appointmentTime));\n });\n setresState(AppList);\n });\n }, []);\n return React.createElement(Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 51\n },\n __self: this\n }, React.createElement(\"h1\", {\n className: \"h3 mb-2 text-gray-800\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 52\n },\n __self: this\n }, \"Dashboard\"), React.createElement(\"p\", {\n className: \"mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 53\n },\n __self: this\n }, \"Summary and overview of our doctor stuff here\"), React.createElement(\"div\", {\n className: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 55\n },\n __self: this\n }, React.createElement(TopCard, {\n title: \"PATIENT COUNT\",\n text: \"\".concat(numberItemsCount),\n icon: \"box\",\n class: \"primary\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 56\n },\n __self: this\n }), React.createElement(TopCard, {\n title: \"APPONITMEN AMOUNT\",\n text: \"\".concat(totalProductAmount),\n icon: \"warehouse\",\n class: \"danger\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 57\n },\n __self: this\n }), React.createElement(TopCard, {\n title: \"DOCTOR PRICE\",\n text: \"$\".concat(totalPrice),\n icon: \"dollar-sign\",\n class: \"success\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 58\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 61\n },\n __self: this\n }, React.createElement(TopCard, {\n title: \"EARNINGS\",\n text: totalSales.toString(),\n icon: \"donate\",\n class: \"primary\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 62\n },\n __self: this\n }), React.createElement(TopCard, {\n title: \"TOTAL REPORT\",\n text: totalOrderAmount.toString(),\n icon: \"calculator\",\n class: \"danger\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 63\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 66\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"col-xl-6 col-lg-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 68\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card shadow mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 69\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card-header py-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 70\n },\n __self: this\n }, React.createElement(\"h6\", {\n className: \"m-0 font-weight-bold text-green\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 71\n },\n __self: this\n }, \"Patient list\")), React.createElement(\"div\", {\n className: \"card-body\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 73\n },\n __self: this\n }, React.createElement(ProductList, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 74\n },\n __self: this\n })))), React.createElement(\"div\", {\n className: \"col-xl-6 col-lg-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 80\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card shadow mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 81\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card-header py-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 82\n },\n __self: this\n }, React.createElement(\"h6\", {\n className: \"m-0 font-weight-bold text-green\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 83\n },\n __self: this\n }, \"Appoiments\")), React.createElement(\"div\", {\n className: \"card-body\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 85\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"table-responsive portlet\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 86\n },\n __self: this\n }, React.createElement(\"table\", {\n className: \"table\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 87\n },\n __self: this\n }, React.createElement(\"thead\", {\n className: \"thead-light\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 88\n },\n __self: this\n }, React.createElement(\"tr\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 89\n },\n __self: this\n }, React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 90\n },\n __self: this\n }, \"#\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 91\n },\n __self: this\n }, \"Name\"), React.createElement(\"th\", {\n scope: \"col\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 92\n },\n __self: this\n }, \"Time\"))), React.createElement(\"tbody\", {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 97\n },\n __self: this\n }, resState))))))));\n};\n\nexport default Home;","map":{"version":3,"sources":["D:/FYP/Update/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Home/Home.tsx"],"names":["React","Fragment","useEffect","useState","useDispatch","useSelector","updateCurrentPath","TopCard","ProductList","axios","Home","products","state","numberItemsCount","length","totalPrice","reduce","prev","next","price","amount","totalProductAmount","orders","totalSales","totalOrderAmount","email","account","dispatch","resState","setresState","AppList","nameMatch","match","name","article","post","then","response","data","map","Appointment","id","fullName","appointmentTime","toString"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAAoCC,SAApC,EAA+CC,QAA/C,QAA+D,OAA/D;AACA,SAASC,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AACA,SAASC,iBAAT,QAAkC,kCAAlC;AACA,OAAOC,OAAP,MAAoB,iCAApB;AAEA,OAAOC,WAAP,MAAwB,0BAAxB;AAGA,OAAOC,KAAP,MAAkB,OAAlB;;AAEA,MAAMC,IAAc,GAAG,MAAM;AAC3B,QAAMC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AA;AAAA;AAAA,KACKhB,QADL,CAVJ,CADF,CADF,CAJF,CADF,CAdF,CAfF,CADF;AA6DD,CApGD;;AAsGA,eAAelB,IAAf","sourcesContent":["import React, { Fragment, Dispatch, useEffect, useState } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { updateCurrentPath } from \"../../store/actions/root.actions\";\nimport TopCard from \"../../common/components/TopCard\";\nimport { IProductState, IStateType } from \"../../store/models/root.interface\";\nimport ProductList from \"../Products/ProductsList\";\nimport { IOrder } from \"../../store/models/order.interface\";\nimport OrderList from \"../Orders/OrderList\";\nimport axios from \"axios\";\n\nconst Home: React.FC = () => {\n const products: IProductState = useSelector((state: IStateType) => state.products);\n const numberItemsCount: number = products.products.length;\n const totalPrice: number = products.products.reduce((prev, next) => prev + ((next.price * next.amount) || 0), 0);\n const totalProductAmount: number = products.products.reduce((prev, next) => prev + (next.amount || 0), 0);\n\n const orders: IOrder[] = useSelector((state: IStateType) => state.orders.orders);\n const totalSales: number = orders.reduce((prev, next) => prev + next.totalPrice, 0);\n const totalOrderAmount: number = orders.reduce((prev, next) => prev + next.amount, 0);\n\n const email: string = useSelector((state: IStateType) => state.account.email);\n\n const dispatch: Dispatch<any> = useDispatch();\n dispatch(updateCurrentPath(\"home\", \"\"));\n\n const [resState, setresState] = useState(0);\n\n let AppList = null \n\n useEffect(() => {\n var nameMatch = email.match(/^([^@]*)@/);\n var name = nameMatch ? nameMatch[1] : null;\n const article = { email : \"dr.rasika\" };\n axios.post('http://127.0.0.1:8000/api/specificAppointment', article)\n .then(response => {\n AppList = response.data.map((Appointment: any) => {\n return (\n <tr className={`table-row`}\n key={`order_${Appointment.id}`}>\n <th scope=\"row\">{Appointment.id}</th>\n <td>{Appointment.fullName}</td>\n <td>{Appointment.appointmentTime}</td>\n </tr>);\n })\n setresState(AppList)\n });\n },[]);\n\n\n return (\n <Fragment>\n <h1 className=\"h3 mb-2 text-gray-800\">Dashboard</h1>\n <p className=\"mb-4\">Summary and overview of our doctor stuff here</p>\n\n <div className=\"row\">\n <TopCard title=\"PATIENT COUNT\" text={`${numberItemsCount}`} icon=\"box\" class=\"primary\" />\n <TopCard title=\"APPONITMEN AMOUNT\" text={`${totalProductAmount}`} icon=\"warehouse\" class=\"danger\" />\n <TopCard title=\"DOCTOR PRICE\" text={`$${totalPrice}`} icon=\"dollar-sign\" class=\"success\" />\n </div>\n\n <div className=\"row\">\n <TopCard title=\"EARNINGS\" text={totalSales.toString()} icon=\"donate\" class=\"primary\" />\n <TopCard title=\"TOTAL REPORT\" text={totalOrderAmount.toString()} icon=\"calculator\" class=\"danger\" />\n </div>\n\n <div className=\"row\">\n\n <div className=\"col-xl-6 col-lg-6\">\n <div className=\"card shadow mb-4\">\n <div className=\"card-header py-3\">\n <h6 className=\"m-0 font-weight-bold text-green\">Patient list</h6>\n </div>\n <div className=\"card-body\">\n <ProductList />\n </div>\n </div>\n\n </div>\n\n <div className=\"col-xl-6 col-lg-6\">\n <div className=\"card shadow mb-4\">\n <div className=\"card-header py-3\">\n <h6 className=\"m-0 font-weight-bold text-green\">Appoiments</h6>\n </div>\n <div className=\"card-body\">\n <div className=\"table-responsive portlet\">\n <table className=\"table\">\n <thead className=\"thead-light\">\n <tr>\n <th scope=\"col\">#</th>\n <th scope=\"col\">Name</th>\n <th scope=\"col\">Time</th>\n {/* <th scope=\"col\">unit</th>\n <th scope=\"col\">Range</th> */}\n </tr>\n </thead>\n <tbody>\n {resState}\n </tbody>\n </table>\n </div>\n\n </div>\n </div>\n </div>\n\n </div>\n\n </Fragment>\n );\n};\n\nexport default Home;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"/**\n * Helpers.\n */\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function (val, options) {\n options = options || {};\n var type = typeof val;\n\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n\n throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));\n};\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\n\nfunction parse(str) {\n str = String(str);\n\n if (str.length > 100) {\n return;\n }\n\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);\n\n if (!match) {\n return;\n }\n\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n\n default:\n return undefined;\n }\n}\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n\n return ms + 'ms';\n}\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n\n return ms + ' ms';\n}\n/**\n * Pluralization helper.\n */\n\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"'use strict';\n\nvar inherits = require('inherits'),\n AjaxBasedTransport = require('./lib/ajax-based'),\n EventSourceReceiver = require('./receiver/eventsource'),\n XHRCorsObject = require('./sender/xhr-cors'),\n EventSourceDriver = require('eventsource');\n\nfunction EventSourceTransport(transUrl) {\n if (!EventSourceTransport.enabled()) {\n throw new Error('Transport created when disabled');\n }\n\n AjaxBasedTransport.call(this, transUrl, '/eventsource', EventSourceReceiver, XHRCorsObject);\n}\n\ninherits(EventSourceTransport, AjaxBasedTransport);\n\nEventSourceTransport.enabled = function () {\n return !!EventSourceDriver;\n};\n\nEventSourceTransport.transportName = 'eventsource';\nEventSourceTransport.roundTrips = 2;\nmodule.exports = EventSourceTransport;","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"import { wrapMapToPropsConstant, wrapMapToPropsFunc } from './wrapMapToProps';\nexport function whenMapStateToPropsIsFunction(mapStateToProps) {\n return typeof mapStateToProps === 'function' ? wrapMapToPropsFunc(mapStateToProps, 'mapStateToProps') : undefined;\n}\nexport function whenMapStateToPropsIsMissing(mapStateToProps) {\n return !mapStateToProps ? wrapMapToPropsConstant(function () {\n return {};\n }) : undefined;\n}\nexport default [whenMapStateToPropsIsFunction, whenMapStateToPropsIsMissing];","map":null,"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"'use strict';\n\nconst escapeStringRegexp = require('escape-string-regexp');\n\nconst ansiStyles = require('ansi-styles');\n\nconst stdoutColor = require('supports-color').stdout;\n\nconst template = require('./templates.js');\n\nconst isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); // `supportsColor.level` → `ansiStyles.color[name]` mapping\n\nconst levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; // `color-convert` models to exclude from the Chalk API due to conflicts and such\n\nconst skipModels = new Set(['gray']);\nconst styles = Object.create(null);\n\nfunction applyOptions(obj, options) {\n options = options || {}; // Detect level if not set manually\n\n const scLevel = stdoutColor ? stdoutColor.level : 0;\n obj.level = options.level === undefined ? scLevel : options.level;\n obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;\n}\n\nfunction Chalk(options) {\n // We check for this.template here since calling `chalk.constructor()`\n // by itself will have a `this` of a previously constructed chalk object\n if (!this || !(this instanceof Chalk) || this.template) {\n const chalk = {};\n applyOptions(chalk, options);\n\n chalk.template = function () {\n const args = [].slice.call(arguments);\n return chalkTag.apply(null, [chalk.template].concat(args));\n };\n\n Object.setPrototypeOf(chalk, Chalk.prototype);\n Object.setPrototypeOf(chalk.template, chalk);\n chalk.template.constructor = Chalk;\n return chalk.template;\n }\n\n applyOptions(this, options);\n} // Use bright blue on Windows as the normal blue color is illegible\n\n\nif (isSimpleWindowsTerm) {\n ansiStyles.blue.open = '\\u001B[94m';\n}\n\nfor (const key of Object.keys(ansiStyles)) {\n ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');\n styles[key] = {\n get() {\n const codes = ansiStyles[key];\n return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);\n }\n\n };\n}\n\nstyles.visible = {\n get() {\n return build.call(this, this._styles || [], true, 'visible');\n }\n\n};\nansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g');\n\nfor (const model of Object.keys(ansiStyles.color.ansi)) {\n if (skipModels.has(model)) {\n continue;\n }\n\n styles[model] = {\n get() {\n const level = this.level;\n return function () {\n const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);\n const codes = {\n open,\n close: ansiStyles.color.close,\n closeRe: ansiStyles.color.closeRe\n };\n return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);\n };\n }\n\n };\n}\n\nansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g');\n\nfor (const model of Object.keys(ansiStyles.bgColor.ansi)) {\n if (skipModels.has(model)) {\n continue;\n }\n\n const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);\n styles[bgModel] = {\n get() {\n const level = this.level;\n return function () {\n const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);\n const codes = {\n open,\n close: ansiStyles.bgColor.close,\n closeRe: ansiStyles.bgColor.closeRe\n };\n return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);\n };\n }\n\n };\n}\n\nconst proto = Object.defineProperties(() => {}, styles);\n\nfunction build(_styles, _empty, key) {\n const builder = function () {\n return applyStyle.apply(builder, arguments);\n };\n\n builder._styles = _styles;\n builder._empty = _empty;\n const self = this;\n Object.defineProperty(builder, 'level', {\n enumerable: true,\n\n get() {\n return self.level;\n },\n\n set(level) {\n self.level = level;\n }\n\n });\n Object.defineProperty(builder, 'enabled', {\n enumerable: true,\n\n get() {\n return self.enabled;\n },\n\n set(enabled) {\n self.enabled = enabled;\n }\n\n }); // See below for fix regarding invisible grey/dim combination on Windows\n\n builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; // `__proto__` is used because we must return a function, but there is\n // no way to create a function with a different prototype\n\n builder.__proto__ = proto; // eslint-disable-line no-proto\n\n return builder;\n}\n\nfunction applyStyle() {\n // Support varags, but simply cast to string in case there's only one arg\n const args = arguments;\n const argsLen = args.length;\n let str = String(arguments[0]);\n\n if (argsLen === 0) {\n return '';\n }\n\n if (argsLen > 1) {\n // Don't slice `arguments`, it prevents V8 optimizations\n for (let a = 1; a < argsLen; a++) {\n str += ' ' + args[a];\n }\n }\n\n if (!this.enabled || this.level <= 0 || !str) {\n return this._empty ? '' : str;\n } // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,\n // see https://github.com/chalk/chalk/issues/58\n // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.\n\n\n const originalDim = ansiStyles.dim.open;\n\n if (isSimpleWindowsTerm && this.hasGrey) {\n ansiStyles.dim.open = '';\n }\n\n for (const code of this._styles.slice().reverse()) {\n // Replace any instances already present with a re-opening code\n // otherwise only the part of the string until said closing code\n // will be colored, and the rest will simply be 'plain'.\n str = code.open + str.replace(code.closeRe, code.open) + code.close; // Close the styling before a linebreak and reopen\n // after next line to fix a bleed issue on macOS\n // https://github.com/chalk/chalk/pull/92\n\n str = str.replace(/\\r?\\n/g, \"\".concat(code.close, \"$&\").concat(code.open));\n } // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue\n\n\n ansiStyles.dim.open = originalDim;\n return str;\n}\n\nfunction chalkTag(chalk, strings) {\n if (!Array.isArray(strings)) {\n // If chalk() was called by itself or with a string,\n // return the string itself as a string.\n return [].slice.call(arguments, 1).join(' ');\n }\n\n const args = [].slice.call(arguments, 2);\n const parts = [strings.raw[0]];\n\n for (let i = 1; i < strings.length; i++) {\n parts.push(String(args[i - 1]).replace(/[{}\\\\]/g, '\\\\$&'));\n parts.push(String(strings.raw[i]));\n }\n\n return template(chalk, parts.join(''));\n}\n\nObject.defineProperties(Chalk.prototype, styles);\nmodule.exports = Chalk(); // eslint-disable-line new-cap\n\nmodule.exports.supportsColor = stdoutColor;\nmodule.exports.default = module.exports; // For TypeScript","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\src\\\\components\\\\Orders\\\\Orders.tsx\";\nimport React, { Fragment } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { updateCurrentPath } from \"../../store/actions/root.actions\";\nimport OrderList from \"./OrderList\";\nimport OrderForm from \"./OrderForm\";\nimport ProductList from \"../Products/ProductsList\";\nimport { changeSelectedProduct, clearSelectedProduct } from \"../../store/actions/products.action\";\n\nconst Orders = () => {\n const dispatch = useDispatch();\n const orders = useSelector(state => state.orders.orders);\n const totalSales = orders.reduce((prev, next) => prev + next.totalPrice, 0);\n const totalAmount = orders.reduce((prev, next) => prev + next.amount, 0);\n dispatch(updateCurrentPath(\"orders\", \"list\"));\n dispatch(clearSelectedProduct());\n\n function selectProduct(product) {\n dispatch(changeSelectedProduct(product));\n }\n\n return React.createElement(Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 26\n },\n __self: this\n }, React.createElement(\"h1\", {\n className: \"h3 mb-2 text-gray-800\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 27\n },\n __self: this\n }, \"Lab Reports\"), React.createElement(\"p\", {\n className: \"mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 28\n },\n __self: this\n }, \"Reports here\"), React.createElement(\"div\", {\n className: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 35\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"col-xl-12 col-lg-12\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 36\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card shadow mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 37\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card-header py-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 38\n },\n __self: this\n }, React.createElement(\"h6\", {\n className: \"m-0 font-weight-bold text-green\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 39\n },\n __self: this\n }, \"Report Results\"), React.createElement(\"div\", {\n className: \"header-buttons\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 40\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"card-body\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 43\n },\n __self: this\n }, React.createElement(OrderList, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 44\n },\n __self: this\n }))))), React.createElement(\"div\", {\n className: \"row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 50\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"col-md-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 51\n },\n __self: this\n }, React.createElement(OrderForm, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 52\n },\n __self: this\n })), React.createElement(\"div\", {\n className: \"col-md-6\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 54\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card card-bottom-list shadow mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 55\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card-header py-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 56\n },\n __self: this\n }, React.createElement(\"h6\", {\n className: \"m-0 font-weight-bold text-green\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 57\n },\n __self: this\n }, \"Doctors list\")), React.createElement(ProductList, {\n onSelect: selectProduct,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 59\n },\n __self: this\n })))));\n};\n\nexport default Orders;","map":{"version":3,"sources":["D:/FYP/Update/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Orders/Orders.tsx"],"names":["React","Fragment","useDispatch","useSelector","updateCurrentPath","OrderList","OrderForm","ProductList","changeSelectedProduct","clearSelectedProduct","Orders","dispatch","orders","state","totalSales","reduce","prev","next","totalPrice","totalAmount","amount","selectProduct","product"],"mappings":";AAAA,OAAOA,KAAP,IAAgBC,QAAhB,QAA0C,OAA1C;AACA,SAASC,WAAT,EAAsBC,WAAtB,QAAyC,aAA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AK,IAAA,SAAS,EAAC,kBAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAK,IAAA,SAAS,EAAC,kBAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAI,IAAA,SAAS,EAAC,iCAAd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBADJ,EAEI;AAAK,IAAA,SAAS,EAAC,gBAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAFJ,CADJ,EAMI;AAAK,IAAA,SAAS,EAAC,WAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI,oBAAC,SAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADJ,CANJ,CADJ,CADJ,CATJ,EAwBI;AAAK,IAAA,SAAS,EAAC,KAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAK,IAAA,SAAS,EAAC,UAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI,oBAAC,SAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADJ,CADJ,EAII;AAAK,IAAA,SAAS,EAAC,UAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAK,IAAA,SAAS,EAAC,mCAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAK,IAAA,SAAS,EAAC,kBAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAI,IAAA,SAAS,EAAC,iCAAd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBADJ,CADJ,EAII,oBAAC,WAAD;AACI,IAAA,QAAQ,EAAED,aADd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAJJ,CADJ,CAJJ,CAxBJ,CADJ;AA0CH,CAtDD;;AAwDA,eAAeX,MAAf","sourcesContent":["import React, { Fragment, Dispatch } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { updateCurrentPath } from \"../../store/actions/root.actions\";\nimport { IOrder } from \"../../store/models/order.interface\";\nimport OrderList from \"./OrderList\";\nimport TopCard from \"../../common/components/TopCard\";\nimport OrderForm from \"./OrderForm\";\nimport ProductList from \"../Products/ProductsList\";\nimport { IProduct } from \"../../store/models/product.interface\";\nimport { changeSelectedProduct, clearSelectedProduct } from \"../../store/actions/products.action\";\nimport { IStateType } from \"../../store/models/root.interface\";\n\nconst Orders: React.FC = () => {\n const dispatch: Dispatch<any> = useDispatch();\n const orders: IOrder[] = useSelector((state: IStateType) => state.orders.orders);\n const totalSales: number = orders.reduce((prev, next) => prev + next.totalPrice, 0);\n const totalAmount: number = orders.reduce((prev, next) => prev + next.amount, 0);\n dispatch(updateCurrentPath(\"orders\", \"list\"));\n dispatch(clearSelectedProduct());\n\n function selectProduct(product: IProduct): void {\n dispatch(changeSelectedProduct(product));\n }\n\n return (\n <Fragment>\n <h1 className=\"h3 mb-2 text-gray-800\">Lab Reports</h1>\n <p className=\"mb-4\">Reports here</p>\n\n {/* <div className=\"row\">\n <TopCard title=\"TOTAL SALES\" text={totalSales.toString()} icon=\"donate\" class=\"primary\" />\n <TopCard title=\"TOTAL AMOUNT\" text={totalAmount.toString()} icon=\"calculator\" class=\"danger\" />\n </div> */}\n\n <div className=\"row\">\n <div className=\"col-xl-12 col-lg-12\">\n <div className=\"card shadow mb-4\">\n <div className=\"card-header py-3\">\n <h6 className=\"m-0 font-weight-bold text-green\">Report Results</h6>\n <div className=\"header-buttons\">\n </div>\n </div>\n <div className=\"card-body\">\n <OrderList />\n </div>\n </div>\n </div>\n </div>\n\n <div className=\"row\">\n <div className=\"col-md-6\">\n <OrderForm />\n </div>\n <div className=\"col-md-6\">\n <div className=\"card card-bottom-list shadow mb-4\">\n <div className=\"card-header py-3\">\n <h6 className=\"m-0 font-weight-bold text-green\">Doctors list</h6>\n </div>\n <ProductList\n onSelect={selectProduct}\n />\n </div>\n </div>\n </div>\n </Fragment>\n )\n}\n\nexport default Orders;"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n'use strict'; // If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function (qs, sep, eq, options) {\n sep = sep || '&';\n eq = eq || '=';\n var obj = {};\n\n if (typeof qs !== 'string' || qs.length === 0) {\n return obj;\n }\n\n var regexp = /\\+/g;\n qs = qs.split(sep);\n var maxKeys = 1000;\n\n if (options && typeof options.maxKeys === 'number') {\n maxKeys = options.maxKeys;\n }\n\n var len = qs.length; // maxKeys <= 0 means that we should not limit keys count\n\n if (maxKeys > 0 && len > maxKeys) {\n len = maxKeys;\n }\n\n for (var i = 0; i < len; ++i) {\n var x = qs[i].replace(regexp, '%20'),\n idx = x.indexOf(eq),\n kstr,\n vstr,\n k,\n v;\n\n if (idx >= 0) {\n kstr = x.substr(0, idx);\n vstr = x.substr(idx + 1);\n } else {\n kstr = x;\n vstr = '';\n }\n\n k = decodeURIComponent(kstr);\n v = decodeURIComponent(vstr);\n\n if (!hasOwnProperty(obj, k)) {\n obj[k] = v;\n } else if (isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\n\nvar isArray = Array.isArray || function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\nmodule.exports = ReactPropTypesSecret;","map":null,"metadata":{},"sourceType":"script"}
\ No newline at end of file
{"ast":null,"code":"import _defineProperty from \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\node_modules\\\\babel-preset-react-app\\\\node_modules\\\\@babel\\\\runtime/helpers/esm/defineProperty\";\nimport _slicedToArray from \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\node_modules\\\\babel-preset-react-app\\\\node_modules\\\\@babel\\\\runtime/helpers/esm/slicedToArray\";\nvar _jsxFileName = \"D:\\\\FYP\\\\Update\\\\FinalYearProject\\\\Frontend\\\\Patient\\\\React-Admin-Template\\\\src\\\\components\\\\Orders\\\\OrderForm.tsx\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nimport React, { useState, Fragment } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { addOrder } from \"../../store/actions/orders.actions\";\nimport { clearSelectedProduct } from \"../../store/actions/products.action\";\nimport axios from 'axios';\n\nconst OrderForm = () => {\n const dispatch = useDispatch();\n const selectedProduct = useSelector(state => state.products.selectedProduct);\n const orders = useSelector(state => state.orders.orders);\n\n const _useState = useState(null),\n _useState2 = _slicedToArray(_useState, 2),\n selectedFile = _useState2[0],\n setSelectedFile = _useState2[1];\n\n const initialFormState = {\n name: {\n error: \"\",\n value: \"\"\n },\n result: {\n error: \"\",\n value: 0\n },\n unit: {\n error: \"\",\n value: \"\"\n },\n refRange: {\n error: \"\",\n value: \"\"\n },\n product: {\n error: \"\",\n value: null\n },\n amount: {\n error: \"\",\n value: 0\n },\n totalPrice: {\n error: \"\",\n value: 0\n }\n };\n\n const _useState3 = useState(initialFormState),\n _useState4 = _slicedToArray(_useState3, 2),\n formState = _useState4[0],\n setFormState = _useState4[1];\n\n function hasAmountChanged(model) {\n let totalPrice = formState.totalPrice.value;\n\n if (selectedProduct) {\n totalPrice = selectedProduct.price * model.value;\n }\n\n setFormState(_objectSpread({}, formState, {\n amount: {\n error: model.error,\n value: model.value\n },\n totalPrice: {\n error: model.error,\n value: totalPrice\n }\n }));\n }\n\n function hasFormValueChanged(model) {\n setFormState(_objectSpread({}, formState, {\n [model.field]: {\n error: model.error,\n value: model.value\n }\n }));\n }\n\n function resetForm() {\n setFormState(initialFormState);\n }\n\n function saveOrder(e) {\n e.preventDefault();\n\n if (isFormInvalid()) {\n return;\n }\n\n saveForm(formState);\n }\n\n function saveForm(formState) {\n if (selectedProduct) {\n if (selectedProduct.amount < formState.amount.value) {\n alert(\"Not enough products in warehouse\");\n return;\n }\n\n formState.product.value = selectedProduct; // dispatch(addOrder({\n // id: 0,\n // name: formState.name.value,\n // amount: formState.amount.value,\n // totalPrice: formState.totalPrice.value,\n // product: formState.product.value as IProduct\n // }));\n // dispatch(addNotification(\"Order added\", `Order ${formState.name.value} added by you`));\n // dispatch(clearSelectedProduct());\n // dispatch(changeProductAmount(selectedProduct.id, formState.amount.value));\n\n resetForm();\n }\n }\n\n function isFormInvalid() {\n return formState.amount.error || formState.totalPrice.error || formState.name.error || formState.product.error || !formState.name.value || !selectedProduct;\n }\n\n function getDisabledClass() {\n let isError = isFormInvalid();\n return isError ? \"disabled\" : \"\";\n }\n\n const handleFileSelect = selectorFiles => {\n console.log(selectorFiles[0]);\n setSelectedFile(selectorFiles[0]);\n const formData = new FormData();\n formData.append(\"file\", selectorFiles[0]);\n axios.post('http://127.0.0.1:8000/staffapi/labreport', formData, {\n headers: {\n \"Content-type\": \"multipart/form-date\"\n }\n }).then(response => {\n for (var key in response.data) {\n if (response.data.hasOwnProperty(key)) {\n console.log(key + \" -> \" + response.data[key]);\n dispatch(addOrder({\n id: parseInt(key),\n name: response.data[key].name,\n result: response.data[key].result,\n unit: response.data[key].unit,\n refRange: response.data[key].refRnage,\n product: null,\n amount: 0,\n totalPrice: 0\n })); // dispatch(addNotification(\"Order added\", `Order ${formState.name.value} added by you`));\n\n dispatch(clearSelectedProduct()); // dispatch(changeProductAmount(selectedProduct.id, formState.amount.value));\n }\n }\n });\n };\n\n return React.createElement(Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 127\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card shadow mb-4\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 128\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"card-header py-3\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 129\n },\n __self: this\n }, React.createElement(\"h6\", {\n className: \"m-0 font-weight-bold text-green\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 130\n },\n __self: this\n }, \"Upload\")), React.createElement(\"div\", {\n className: \"card-body\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 132\n },\n __self: this\n }, React.createElement(\"form\", {\n onSubmit: saveOrder,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 133\n },\n __self: this\n }, React.createElement(\"div\", {\n className: \"form-row\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 134\n },\n __self: this\n }, React.createElement(\"input\", {\n type: \"file\",\n onChange: e => handleFileSelect(e.target.files),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 135\n },\n __self: this\n }))))));\n};\n\nexport default OrderForm;","map":{"version":3,"sources":["D:/FYP/Update/FinalYearProject/Frontend/Patient/React-Admin-Template/src/components/Orders/OrderForm.tsx"],"names":["React","useState","Fragment","useDispatch","useSelector","addOrder","clearSelectedProduct","axios","OrderForm","dispatch","selectedProduct","state","products","orders","selectedFile","setSelectedFile","initialFormState","name","error","value","result","unit","refRange","product","amount","totalPrice","formState","setFormState","hasAmountChanged","model","price","hasFormValueChanged","field","resetForm","saveOrder","e","preventDefault","isFormInvalid","saveForm","alert","getDisabledClass","isError","handleFileSelect","selectorFiles","console","log","formData","FormData","append","post","headers","then","response","key","data","hasOwnProperty","id","parseInt","refRnage","target","files"],"mappings":";;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAAqCC,QAArC,QAA+D,OAA/D;AAKA,SAASC,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AACA,SAASC,QAAT,QAAyB,oCAAzB;AAEA,SAASC,oBAAT,QAA0D,qCAA1D;AAGA,OAAOC,KAAP,MAAkB,OAAlB;;AAEA,MAAMC,SAAmB,GAAG,MAAM;AAC9B,QAAMC,QAAuB,GAAGN,WAAW,EAA3C;AACA,QAAMO,eAAgC,GAAGN,WAAW,CAAEO,KAAD,IAAuBA,KA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,EAAmBjC,MAHb;AAIdC,YAAAA,IAAI,EAAE+B,QAAQ,CAACE,IAAT,CAAcD,GAAd,EAAmBhC,IAJX;AAKdC,YAAAA,QAAQ,EAAE8B,QAAQ,CAACE,IAAT,CAAcD,GAAd,EAAmBK,QALf;AAMdnC,YAAAA,OAAO,EAAE,IANK;AAOdC,YAAAA,MAAM,EAAE,CAPM;AAQdC,YAAAA,UAAU,EAAE;AARE,WAAD,CAAT,CAAR,CAFmC,CAanC;;AACAhB,UAAAA,QAAQ,CAACH,oBAAoB,EAArB,CAAR,CAdmC,CAenC;AACH;AACJ;AACJ,KArBD;AAsBH,GA3BD;;AA6BA,SACI,oBAAC,QAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAK,IAAA,SAAS,EAAC,kBAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAK,IAAA,SAAS,EAAC,kBAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAI,IAAA,SAAS,EAAC,iCAAd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cADJ,CADJ,EAII;AAAK,IAAA,SAAS,EAAC,WAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAM,IAAA,QAAQ,EAAE4B,SAAhB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAK,IAAA,SAAS,EAAC,UAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACI;AAAO,IAAA,IAAI,EAAC,MAAZ;AAAmB,IAAA,QAAQ,EAAGC,CAAD,IAAOO,gBAAgB,CAACP,CAAC,CAACwB,MAAF,CAASC,KAAV,CAApD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADJ,CADJ,CADJ,CAJJ,CADJ,CADJ;AA+CH,CA/JD;;AAiKA,eAAepD,SAAf","sourcesContent":["import React, { useState, FormEvent, Fragment, Dispatch } from \"react\";\nimport { IProduct } from \"../../store/models/product.interface\";\nimport TextInput from \"../../common/components/TextInput\";\nimport NumberInput from \"../../common/components/NumberInput\";\nimport { OnChangeModel, IOrderFormState } from \"../../common/types/Form.types\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { addOrder } from \"../../store/actions/orders.actions\";\nimport { addNotification } from \"../../store/actions/notifications.action\";\nimport { clearSelectedProduct, changeProductAmount } from \"../../store/actions/products.action\";\nimport { IOrder } from \"../../store/models/order.interface\";\nimport { IStateType } from \"../../store/models/root.interface\";\nimport axios from 'axios'\n\nconst OrderForm: React.FC = () => {\n const dispatch: Dispatch<any> = useDispatch();\n const selectedProduct: IProduct | null = useSelector((state: IStateType) => state.products.selectedProduct);\n const orders: IOrder[] = useSelector((state: IStateType) => state.orders.orders);\n const [selectedFile, setSelectedFile] = useState(null);\n\n const initialFormState: IOrderFormState = {\n name: { error: \"\", value: \"\" },\n result: { error: \"\", value: 0 },\n unit: { error: \"\", value: \"\" },\n refRange: { error: \"\", value: \"\" },\n product: { error: \"\", value: null },\n amount: { error: \"\", value: 0 },\n totalPrice: { error: \"\", value: 0 },\n };\n\n const [formState, setFormState] = useState(initialFormState);\n\n function hasAmountChanged(model: OnChangeModel): void {\n let totalPrice: number = formState.totalPrice.value;\n if (selectedProduct) {\n totalPrice = selectedProduct.price * (model.value as number);\n }\n\n setFormState({\n ...formState,\n amount: { error: model.error, value: model.value as number },\n totalPrice: { error: model.error, value: totalPrice }\n });\n\n }\n\n function hasFormValueChanged(model: OnChangeModel): void {\n setFormState({ ...formState, [model.field]: { error: model.error, value: model.value } });\n }\n\n function resetForm(): void {\n setFormState(initialFormState);\n }\n\n function saveOrder(e: FormEvent<HTMLFormElement>): void {\n e.preventDefault();\n if (isFormInvalid()) {\n return;\n }\n\n saveForm(formState);\n }\n\n function saveForm(formState: IOrderFormState): void {\n if (selectedProduct) {\n if (selectedProduct.amount < formState.amount.value) {\n alert(\"Not enough products in warehouse\");\n return;\n }\n\n formState.product.value = selectedProduct;\n // dispatch(addOrder({\n // id: 0,\n // name: formState.name.value,\n // amount: formState.amount.value,\n // totalPrice: formState.totalPrice.value,\n // product: formState.product.value as IProduct\n // }));\n\n // dispatch(addNotification(\"Order added\", `Order ${formState.name.value} added by you`));\n // dispatch(clearSelectedProduct());\n // dispatch(changeProductAmount(selectedProduct.id, formState.amount.value));\n resetForm();\n }\n }\n\n function isFormInvalid(): boolean {\n return (formState.amount.error || formState.totalPrice.error\n || formState.name.error || formState.product.error || !formState.name.value\n || !selectedProduct) as boolean;\n }\n\n function getDisabledClass(): string {\n let isError: boolean = isFormInvalid();\n return isError ? \"disabled\" : \"\";\n }\n\n const handleFileSelect = (selectorFiles:any) => {\n console.log(selectorFiles[0])\n setSelectedFile(selectorFiles[0])\n const formData = new FormData();\n formData.append(\"file\", selectorFiles[0]);\n axios.post('http://127.0.0.1:8000/staffapi/labreport', formData, {headers: {\"Content-type\": \"multipart/form-date\"}})\n .then(response => {\n for (var key in response.data) {\n if (response.data.hasOwnProperty(key)) {\n console.log(key + \" -> \" + response.data[key]);\n dispatch(addOrder({\n id: parseInt(key),\n name: response.data[key].name,\n result: response.data[key].result,\n unit: response.data[key].unit,\n refRange: response.data[key].refRnage,\n product: null,\n amount: 0,\n totalPrice: 0,\n }));\n \n // dispatch(addNotification(\"Order added\", `Order ${formState.name.value} added by you`));\n dispatch(clearSelectedProduct());\n // dispatch(changeProductAmount(selectedProduct.id, formState.amount.value));\n }\n }\n });\n }\n\n return (\n <Fragment>\n <div className=\"card shadow mb-4\">\n <div className=\"card-header py-3\">\n <h6 className=\"m-0 font-weight-bold text-green\">Upload</h6>\n </div>\n <div className=\"card-body\">\n <form onSubmit={saveOrder}>\n <div className=\"form-row\">\n <input type=\"file\" onChange={(e) => handleFileSelect(e.target.files)}/>\n {/* <div className=\"form-group col-md-12\">\n <TextInput id=\"input_name\"\n value={formState.name.value}\n field=\"name\"\n onChange={hasFormValueChanged}\n required={true}\n maxLength={20}\n label=\"Name\"\n placeholder=\"Name\" />\n </div>\n <div className=\"form-group col-md-6\">\n <NumberInput id=\"input_amount\"\n value={formState.amount.value}\n field=\"amount\"\n onChange={hasAmountChanged}\n max={1000}\n min={0}\n label=\"Amount\" />\n </div>\n\n <div className=\"form-group col-md-6\">\n <NumberInput id=\"input_totalPrice\"\n value={formState.totalPrice.value}\n field=\"totalPrice\"\n onChange={hasFormValueChanged}\n max={1000}\n min={0}\n label=\"Price\" />\n </div> */}\n </div>\n {/* <button className=\"btn btn-danger\" onClick={() => resetForm()}>Reset</button> */}\n {/* <button type=\"submit\" className={`btn btn-success left-margin ${getDisabledClass()}`}>Create</button> */}\n </form>\n </div>\n </div>\n </Fragment>\n );\n};\n\nexport default OrderForm;\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"// Default to a dummy \"batch\" implementation that just runs the callback\nfunction defaultNoopBatch(callback) {\n callback();\n}\n\nvar batch = defaultNoopBatch; // Allow injecting another batching function later\n\nexport var setBatch = function setBatch(newBatch) {\n return batch = newBatch;\n}; // Supply a getter just to skip dealing with ESM bindings\n\nexport var getBatch = function getBatch() {\n return batch;\n};","map":null,"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var isProduction = process.env.NODE_ENV === 'production';\n\nfunction warning(condition, message) {\n if (!isProduction) {\n if (condition) {\n return;\n }\n\n var text = \"Warning: \" + message;\n\n if (typeof console !== 'undefined') {\n console.warn(text);\n }\n\n try {\n throw Error(text);\n } catch (x) {}\n }\n}\n\nexport default warning;","map":null,"metadata":{},"sourceType":"module"}
\ No newline at end of file
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# @babel/core
> Babel compiler core.
See our website [@babel/core](https://babeljs.io/docs/en/next/babel-core.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20core%22+is%3Aopen) associated with this package.
## Install
Using npm:
```sh
npm install --save-dev @babel/core
```
or using yarn:
```sh
yarn add @babel/core --dev
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.makeStrongCache = makeStrongCache;
exports.makeWeakCache = makeWeakCache;
exports.assertSimpleType = assertSimpleType;
function makeStrongCache(handler) {
return makeCachedFunction(new Map(), handler);
}
function makeWeakCache(handler) {
return makeCachedFunction(new WeakMap(), handler);
}
function makeCachedFunction(callCache, handler) {
return function cachedFunction(arg, data) {
let cachedValue = callCache.get(arg);
if (cachedValue) {
for (const _ref of cachedValue) {
const {
value,
valid
} = _ref;
if (valid(data)) return value;
}
}
const cache = new CacheConfigurator(data);
const value = handler(arg, cache);
if (!cache.configured()) cache.forever();
cache.deactivate();
switch (cache.mode()) {
case "forever":
cachedValue = [{
value,
valid: () => true
}];
callCache.set(arg, cachedValue);
break;
case "invalidate":
cachedValue = [{
value,
valid: cache.validator()
}];
callCache.set(arg, cachedValue);
break;
case "valid":
if (cachedValue) {
cachedValue.push({
value,
valid: cache.validator()
});
} else {
cachedValue = [{
value,
valid: cache.validator()
}];
callCache.set(arg, cachedValue);
}
}
return value;
};
}
class CacheConfigurator {
constructor(data) {
this._active = true;
this._never = false;
this._forever = false;
this._invalidate = false;
this._configured = false;
this._pairs = [];
this._data = data;
}
simple() {
return makeSimpleConfigurator(this);
}
mode() {
if (this._never) return "never";
if (this._forever) return "forever";
if (this._invalidate) return "invalidate";
return "valid";
}
forever() {
if (!this._active) {
throw new Error("Cannot change caching after evaluation has completed.");
}
if (this._never) {
throw new Error("Caching has already been configured with .never()");
}
this._forever = true;
this._configured = true;
}
never() {
if (!this._active) {
throw new Error("Cannot change caching after evaluation has completed.");
}
if (this._forever) {
throw new Error("Caching has already been configured with .forever()");
}
this._never = true;
this._configured = true;
}
using(handler) {
if (!this._active) {
throw new Error("Cannot change caching after evaluation has completed.");
}
if (this._never || this._forever) {
throw new Error("Caching has already been configured with .never or .forever()");
}
this._configured = true;
const key = handler(this._data);
this._pairs.push([key, handler]);
return key;
}
invalidate(handler) {
if (!this._active) {
throw new Error("Cannot change caching after evaluation has completed.");
}
if (this._never || this._forever) {
throw new Error("Caching has already been configured with .never or .forever()");
}
this._invalidate = true;
this._configured = true;
const key = handler(this._data);
this._pairs.push([key, handler]);
return key;
}
validator() {
const pairs = this._pairs;
return data => pairs.every(([key, fn]) => key === fn(data));
}
deactivate() {
this._active = false;
}
configured() {
return this._configured;
}
}
function makeSimpleConfigurator(cache) {
function cacheFn(val) {
if (typeof val === "boolean") {
if (val) cache.forever();else cache.never();
return;
}
return cache.using(() => assertSimpleType(val()));
}
cacheFn.forever = () => cache.forever();
cacheFn.never = () => cache.never();
cacheFn.using = cb => cache.using(() => assertSimpleType(cb()));
cacheFn.invalidate = cb => cache.invalidate(() => assertSimpleType(cb()));
return cacheFn;
}
function assertSimpleType(value) {
if (value != null && typeof value !== "string" && typeof value !== "boolean" && typeof value !== "number") {
throw new Error("Cache keys must be either string, boolean, number, null, or undefined.");
}
return value;
}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createCachedDescriptors = createCachedDescriptors;
exports.createUncachedDescriptors = createUncachedDescriptors;
exports.createDescriptor = createDescriptor;
var _files = require("./files");
var _item = require("./item");
var _caching = require("./caching");
function isEqualDescriptor(a, b) {
return a.name === b.name && a.value === b.value && a.options === b.options && a.dirname === b.dirname && a.alias === b.alias && a.ownPass === b.ownPass && (a.file && a.file.request) === (b.file && b.file.request) && (a.file && a.file.resolved) === (b.file && b.file.resolved);
}
function createCachedDescriptors(dirname, options, alias) {
const {
plugins,
presets,
passPerPreset
} = options;
return {
options,
plugins: plugins ? () => createCachedPluginDescriptors(plugins, dirname)(alias) : () => [],
presets: presets ? () => createCachedPresetDescriptors(presets, dirname)(alias)(!!passPerPreset) : () => []
};
}
function createUncachedDescriptors(dirname, options, alias) {
let plugins;
let presets;
return {
options,
plugins: () => {
if (!plugins) {
plugins = createPluginDescriptors(options.plugins || [], dirname, alias);
}
return plugins;
},
presets: () => {
if (!presets) {
presets = createPresetDescriptors(options.presets || [], dirname, alias, !!options.passPerPreset);
}
return presets;
}
};
}
const PRESET_DESCRIPTOR_CACHE = new WeakMap();
const createCachedPresetDescriptors = (0, _caching.makeWeakCache)((items, cache) => {
const dirname = cache.using(dir => dir);
return (0, _caching.makeStrongCache)(alias => (0, _caching.makeStrongCache)(passPerPreset => createPresetDescriptors(items, dirname, alias, passPerPreset).map(desc => loadCachedDescriptor(PRESET_DESCRIPTOR_CACHE, desc))));
});
const PLUGIN_DESCRIPTOR_CACHE = new WeakMap();
const createCachedPluginDescriptors = (0, _caching.makeWeakCache)((items, cache) => {
const dirname = cache.using(dir => dir);
return (0, _caching.makeStrongCache)(alias => createPluginDescriptors(items, dirname, alias).map(desc => loadCachedDescriptor(PLUGIN_DESCRIPTOR_CACHE, desc)));
});
const DEFAULT_OPTIONS = {};
function loadCachedDescriptor(cache, desc) {
const {
value,
options = DEFAULT_OPTIONS
} = desc;
if (options === false) return desc;
let cacheByOptions = cache.get(value);
if (!cacheByOptions) {
cacheByOptions = new WeakMap();
cache.set(value, cacheByOptions);
}
let possibilities = cacheByOptions.get(options);
if (!possibilities) {
possibilities = [];
cacheByOptions.set(options, possibilities);
}
if (possibilities.indexOf(desc) === -1) {
const matches = possibilities.filter(possibility => isEqualDescriptor(possibility, desc));
if (matches.length > 0) {
return matches[0];
}
possibilities.push(desc);
}
return desc;
}
function createPresetDescriptors(items, dirname, alias, passPerPreset) {
return createDescriptors("preset", items, dirname, alias, passPerPreset);
}
function createPluginDescriptors(items, dirname, alias) {
return createDescriptors("plugin", items, dirname, alias);
}
function createDescriptors(type, items, dirname, alias, ownPass) {
const descriptors = items.map((item, index) => createDescriptor(item, dirname, {
type,
alias: `${alias}$${index}`,
ownPass: !!ownPass
}));
assertNoDuplicates(descriptors);
return descriptors;
}
function createDescriptor(pair, dirname, {
type,
alias,
ownPass
}) {
const desc = (0, _item.getItemDescriptor)(pair);
if (desc) {
return desc;
}
let name;
let options;
let value = pair;
if (Array.isArray(value)) {
if (value.length === 3) {
[value, options, name] = value;
} else {
[value, options] = value;
}
}
let file = undefined;
let filepath = null;
if (typeof value === "string") {
if (typeof type !== "string") {
throw new Error("To resolve a string-based item, the type of item must be given");
}
const resolver = type === "plugin" ? _files.loadPlugin : _files.loadPreset;
const request = value;
({
filepath,
value
} = resolver(value, dirname));
file = {
request,
resolved: filepath
};
}
if (!value) {
throw new Error(`Unexpected falsy value: ${String(value)}`);
}
if (typeof value === "object" && value.__esModule) {
if (value.default) {
value = value.default;
} else {
throw new Error("Must export a default export when using ES6 modules.");
}
}
if (typeof value !== "object" && typeof value !== "function") {
throw new Error(`Unsupported format: ${typeof value}. Expected an object or a function.`);
}
if (filepath !== null && typeof value === "object" && value) {
throw new Error(`Plugin/Preset files are not allowed to export objects, only functions. In ${filepath}`);
}
return {
name,
alias: filepath || alias,
value,
options,
dirname,
ownPass,
file
};
}
function assertNoDuplicates(items) {
const map = new Map();
for (const item of items) {
if (typeof item.value !== "function") continue;
let nameMap = map.get(item.value);
if (!nameMap) {
nameMap = new Set();
map.set(item.value, nameMap);
}
if (nameMap.has(item.name)) {
throw new Error([`Duplicate plugin/preset detected.`, `If you'd like to use two separate instances of a plugin,`, `they need separate names, e.g.`, ``, ` plugins: [`, ` ['some-plugin', {}],`, ` ['some-plugin', {}, 'some unique name'],`, ` ]`].join("\n"));
}
nameMap.add(item.name);
}
}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.findConfigUpwards = findConfigUpwards;
exports.findPackageData = findPackageData;
exports.findRelativeConfig = findRelativeConfig;
exports.findRootConfig = findRootConfig;
exports.loadConfig = loadConfig;
exports.resolvePlugin = resolvePlugin;
exports.resolvePreset = resolvePreset;
exports.loadPlugin = loadPlugin;
exports.loadPreset = loadPreset;
function findConfigUpwards(rootDir) {
return null;
}
function findPackageData(filepath) {
return {
filepath,
directories: [],
pkg: null,
isPackage: false
};
}
function findRelativeConfig(pkgData, envName, caller) {
return {
pkg: null,
config: null,
ignore: null
};
}
function findRootConfig(dirname, envName, caller) {
return null;
}
function loadConfig(name, dirname, envName, caller) {
throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`);
}
function resolvePlugin(name, dirname) {
return null;
}
function resolvePreset(name, dirname) {
return null;
}
function loadPlugin(name, dirname) {
throw new Error(`Cannot load plugin ${name} relative to ${dirname} in a browser`);
}
function loadPreset(name, dirname) {
throw new Error(`Cannot load preset ${name} relative to ${dirname} in a browser`);
}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = loadFullConfig;
var _util = require("./util");
var context = _interopRequireWildcard(require("../index"));
var _plugin = _interopRequireDefault(require("./plugin"));
var _item = require("./item");
var _configChain = require("./config-chain");
function _traverse() {
const data = _interopRequireDefault(require("@babel/traverse"));
_traverse = function () {
return data;
};
return data;
}
var _caching = require("./caching");
var _options = require("./validation/options");
var _plugins = require("./validation/plugins");
var _configApi = _interopRequireDefault(require("./helpers/config-api"));
var _partial = _interopRequireDefault(require("./partial"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function loadFullConfig(inputOpts) {
const result = (0, _partial.default)(inputOpts);
if (!result) {
return null;
}
const {
options,
context
} = result;
const optionDefaults = {};
const passes = [[]];
try {
const {
plugins,
presets
} = options;
if (!plugins || !presets) {
throw new Error("Assertion failure - plugins and presets exist");
}
const ignored = function recurseDescriptors(config, pass) {
const plugins = config.plugins.reduce((acc, descriptor) => {
if (descriptor.options !== false) {
acc.push(loadPluginDescriptor(descriptor, context));
}
return acc;
}, []);
const presets = config.presets.reduce((acc, descriptor) => {
if (descriptor.options !== false) {
acc.push({
preset: loadPresetDescriptor(descriptor, context),
pass: descriptor.ownPass ? [] : pass
});
}
return acc;
}, []);
if (presets.length > 0) {
passes.splice(1, 0, ...presets.map(o => o.pass).filter(p => p !== pass));
for (const _ref of presets) {
const {
preset,
pass
} = _ref;
if (!preset) return true;
const ignored = recurseDescriptors({
plugins: preset.plugins,
presets: preset.presets
}, pass);
if (ignored) return true;
preset.options.forEach(opts => {
(0, _util.mergeOptions)(optionDefaults, opts);
});
}
}
if (plugins.length > 0) {
pass.unshift(...plugins);
}
}({
plugins: plugins.map(item => {
const desc = (0, _item.getItemDescriptor)(item);
if (!desc) {
throw new Error("Assertion failure - must be config item");
}
return desc;
}),
presets: presets.map(item => {
const desc = (0, _item.getItemDescriptor)(item);
if (!desc) {
throw new Error("Assertion failure - must be config item");
}
return desc;
})
}, passes[0]);
if (ignored) return null;
} catch (e) {
if (!/^\[BABEL\]/.test(e.message)) {
e.message = `[BABEL] ${context.filename || "unknown"}: ${e.message}`;
}
throw e;
}
const opts = optionDefaults;
(0, _util.mergeOptions)(opts, options);
opts.plugins = passes[0];
opts.presets = passes.slice(1).filter(plugins => plugins.length > 0).map(plugins => ({
plugins
}));
opts.passPerPreset = opts.presets.length > 0;
return {
options: opts,
passes: passes
};
}
const loadDescriptor = (0, _caching.makeWeakCache)(({
value,
options,
dirname,
alias
}, cache) => {
if (options === false) throw new Error("Assertion failure");
options = options || {};
let item = value;
if (typeof value === "function") {
const api = Object.assign({}, context, {}, (0, _configApi.default)(cache));
try {
item = value(api, options, dirname);
} catch (e) {
if (alias) {
e.message += ` (While processing: ${JSON.stringify(alias)})`;
}
throw e;
}
}
if (!item || typeof item !== "object") {
throw new Error("Plugin/Preset did not return an object.");
}
if (typeof item.then === "function") {
throw new Error(`You appear to be using an async plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, ` + `you may need to upgrade your @babel/core version.`);
}
return {
value: item,
options,
dirname,
alias
};
});
function loadPluginDescriptor(descriptor, context) {
if (descriptor.value instanceof _plugin.default) {
if (descriptor.options) {
throw new Error("Passed options to an existing Plugin instance will not work.");
}
return descriptor.value;
}
return instantiatePlugin(loadDescriptor(descriptor, context), context);
}
const instantiatePlugin = (0, _caching.makeWeakCache)(({
value,
options,
dirname,
alias
}, cache) => {
const pluginObj = (0, _plugins.validatePluginObject)(value);
const plugin = Object.assign({}, pluginObj);
if (plugin.visitor) {
plugin.visitor = _traverse().default.explode(Object.assign({}, plugin.visitor));
}
if (plugin.inherits) {
const inheritsDescriptor = {
name: undefined,
alias: `${alias}$inherits`,
value: plugin.inherits,
options,
dirname
};
const inherits = cache.invalidate(data => loadPluginDescriptor(inheritsDescriptor, data));
plugin.pre = chain(inherits.pre, plugin.pre);
plugin.post = chain(inherits.post, plugin.post);
plugin.manipulateOptions = chain(inherits.manipulateOptions, plugin.manipulateOptions);
plugin.visitor = _traverse().default.visitors.merge([inherits.visitor || {}, plugin.visitor || {}]);
}
return new _plugin.default(plugin, options, alias);
});
const validateIfOptionNeedsFilename = (options, descriptor) => {
if (options.test || options.include || options.exclude) {
const formattedPresetName = descriptor.name ? `"${descriptor.name}"` : "/* your preset */";
throw new Error([`Preset ${formattedPresetName} requires a filename to be set when babel is called directly,`, `\`\`\``, `babel.transform(code, { filename: 'file.ts', presets: [${formattedPresetName}] });`, `\`\`\``, `See https://babeljs.io/docs/en/options#filename for more information.`].join("\n"));
}
};
const validatePreset = (preset, context, descriptor) => {
if (!context.filename) {
const {
options
} = preset;
validateIfOptionNeedsFilename(options, descriptor);
if (options.overrides) {
options.overrides.forEach(overrideOptions => validateIfOptionNeedsFilename(overrideOptions, descriptor));
}
}
};
const loadPresetDescriptor = (descriptor, context) => {
const preset = instantiatePreset(loadDescriptor(descriptor, context));
validatePreset(preset, context, descriptor);
return (0, _configChain.buildPresetChain)(preset, context);
};
const instantiatePreset = (0, _caching.makeWeakCache)(({
value,
dirname,
alias
}) => {
return {
options: (0, _options.validate)("preset", value),
alias,
dirname
};
});
function chain(a, b) {
const fns = [a, b].filter(Boolean);
if (fns.length <= 1) return fns[0];
return function (...args) {
for (const fn of fns) {
fn.apply(this, args);
}
};
}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.loadOptions = loadOptions;
Object.defineProperty(exports, "default", {
enumerable: true,
get: function () {
return _full.default;
}
});
Object.defineProperty(exports, "loadPartialConfig", {
enumerable: true,
get: function () {
return _partial.loadPartialConfig;
}
});
var _full = _interopRequireDefault(require("./full"));
var _partial = require("./partial");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function loadOptions(opts) {
const config = (0, _full.default)(opts);
return config ? config.options : null;
}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = loadPrivatePartialConfig;
exports.loadPartialConfig = loadPartialConfig;
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
var _plugin = _interopRequireDefault(require("./plugin"));
var _util = require("./util");
var _item = require("./item");
var _configChain = require("./config-chain");
var _environment = require("./helpers/environment");
var _options = require("./validation/options");
var _files = require("./files");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function resolveRootMode(rootDir, rootMode) {
switch (rootMode) {
case "root":
return rootDir;
case "upward-optional":
{
const upwardRootDir = (0, _files.findConfigUpwards)(rootDir);
return upwardRootDir === null ? rootDir : upwardRootDir;
}
case "upward":
{
const upwardRootDir = (0, _files.findConfigUpwards)(rootDir);
if (upwardRootDir !== null) return upwardRootDir;
throw Object.assign(new Error(`Babel was run with rootMode:"upward" but a root could not ` + `be found when searching upward from "${rootDir}"`), {
code: "BABEL_ROOT_NOT_FOUND",
dirname: rootDir
});
}
default:
throw new Error(`Assertion failure - unknown rootMode value`);
}
}
function loadPrivatePartialConfig(inputOpts) {
if (inputOpts != null && (typeof inputOpts !== "object" || Array.isArray(inputOpts))) {
throw new Error("Babel options must be an object, null, or undefined");
}
const args = inputOpts ? (0, _options.validate)("arguments", inputOpts) : {};
const {
envName = (0, _environment.getEnv)(),
cwd = ".",
root: rootDir = ".",
rootMode = "root",
caller
} = args;
const absoluteCwd = _path().default.resolve(cwd);
const absoluteRootDir = resolveRootMode(_path().default.resolve(absoluteCwd, rootDir), rootMode);
const context = {
filename: typeof args.filename === "string" ? _path().default.resolve(cwd, args.filename) : undefined,
cwd: absoluteCwd,
root: absoluteRootDir,
envName,
caller
};
const configChain = (0, _configChain.buildRootChain)(args, context);
if (!configChain) return null;
const options = {};
configChain.options.forEach(opts => {
(0, _util.mergeOptions)(options, opts);
});
options.babelrc = false;
options.configFile = false;
options.passPerPreset = false;
options.envName = context.envName;
options.cwd = context.cwd;
options.root = context.root;
options.filename = typeof context.filename === "string" ? context.filename : undefined;
options.plugins = configChain.plugins.map(descriptor => (0, _item.createItemFromDescriptor)(descriptor));
options.presets = configChain.presets.map(descriptor => (0, _item.createItemFromDescriptor)(descriptor));
return {
options,
context,
ignore: configChain.ignore,
babelrc: configChain.babelrc,
config: configChain.config
};
}
function loadPartialConfig(inputOpts) {
const result = loadPrivatePartialConfig(inputOpts);
if (!result) return null;
const {
options,
babelrc,
ignore,
config
} = result;
(options.plugins || []).forEach(item => {
if (item.value instanceof _plugin.default) {
throw new Error("Passing cached plugin instances is not supported in " + "babel.loadPartialConfig()");
}
});
return new PartialConfig(options, babelrc ? babelrc.filepath : undefined, ignore ? ignore.filepath : undefined, config ? config.filepath : undefined);
}
class PartialConfig {
constructor(options, babelrc, ignore, config) {
this.options = options;
this.babelignore = ignore;
this.babelrc = babelrc;
this.config = config;
Object.freeze(this);
}
hasFilesystemConfig() {
return this.babelrc !== undefined || this.config !== undefined;
}
}
Object.freeze(PartialConfig.prototype);
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.mergeOptions = mergeOptions;
function mergeOptions(target, source) {
for (const k of Object.keys(source)) {
if (k === "parserOpts" && source.parserOpts) {
const parserOpts = source.parserOpts;
const targetObj = target.parserOpts = target.parserOpts || {};
mergeDefaultFields(targetObj, parserOpts);
} else if (k === "generatorOpts" && source.generatorOpts) {
const generatorOpts = source.generatorOpts;
const targetObj = target.generatorOpts = target.generatorOpts || {};
mergeDefaultFields(targetObj, generatorOpts);
} else {
const val = source[k];
if (val !== undefined) target[k] = val;
}
}
}
function mergeDefaultFields(target, source) {
for (const k of Object.keys(source)) {
const val = source[k];
if (val !== undefined) target[k] = val;
}
}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Plugin = Plugin;
Object.defineProperty(exports, "File", {
enumerable: true,
get: function () {
return _file.default;
}
});
Object.defineProperty(exports, "buildExternalHelpers", {
enumerable: true,
get: function () {
return _buildExternalHelpers.default;
}
});
Object.defineProperty(exports, "resolvePlugin", {
enumerable: true,
get: function () {
return _files.resolvePlugin;
}
});
Object.defineProperty(exports, "resolvePreset", {
enumerable: true,
get: function () {
return _files.resolvePreset;
}
});
Object.defineProperty(exports, "version", {
enumerable: true,
get: function () {
return _package.version;
}
});
Object.defineProperty(exports, "getEnv", {
enumerable: true,
get: function () {
return _environment.getEnv;
}
});
Object.defineProperty(exports, "tokTypes", {
enumerable: true,
get: function () {
return _parser().tokTypes;
}
});
Object.defineProperty(exports, "traverse", {
enumerable: true,
get: function () {
return _traverse().default;
}
});
Object.defineProperty(exports, "template", {
enumerable: true,
get: function () {
return _template().default;
}
});
Object.defineProperty(exports, "createConfigItem", {
enumerable: true,
get: function () {
return _item.createConfigItem;
}
});
Object.defineProperty(exports, "loadPartialConfig", {
enumerable: true,
get: function () {
return _config.loadPartialConfig;
}
});
Object.defineProperty(exports, "loadOptions", {
enumerable: true,
get: function () {
return _config.loadOptions;
}
});
Object.defineProperty(exports, "transform", {
enumerable: true,
get: function () {
return _transform.transform;
}
});
Object.defineProperty(exports, "transformSync", {
enumerable: true,
get: function () {
return _transform.transformSync;
}
});
Object.defineProperty(exports, "transformAsync", {
enumerable: true,
get: function () {
return _transform.transformAsync;
}
});
Object.defineProperty(exports, "transformFile", {
enumerable: true,
get: function () {
return _transformFile.transformFile;
}
});
Object.defineProperty(exports, "transformFileSync", {
enumerable: true,
get: function () {
return _transformFile.transformFileSync;
}
});
Object.defineProperty(exports, "transformFileAsync", {
enumerable: true,
get: function () {
return _transformFile.transformFileAsync;
}
});
Object.defineProperty(exports, "transformFromAst", {
enumerable: true,
get: function () {
return _transformAst.transformFromAst;
}
});
Object.defineProperty(exports, "transformFromAstSync", {
enumerable: true,
get: function () {
return _transformAst.transformFromAstSync;
}
});
Object.defineProperty(exports, "transformFromAstAsync", {
enumerable: true,
get: function () {
return _transformAst.transformFromAstAsync;
}
});
Object.defineProperty(exports, "parse", {
enumerable: true,
get: function () {
return _parse.parse;
}
});
Object.defineProperty(exports, "parseSync", {
enumerable: true,
get: function () {
return _parse.parseSync;
}
});
Object.defineProperty(exports, "parseAsync", {
enumerable: true,
get: function () {
return _parse.parseAsync;
}
});
exports.types = exports.OptionManager = exports.DEFAULT_EXTENSIONS = void 0;
var _file = _interopRequireDefault(require("./transformation/file/file"));
var _buildExternalHelpers = _interopRequireDefault(require("./tools/build-external-helpers"));
var _files = require("./config/files");
var _package = require("../package.json");
var _environment = require("./config/helpers/environment");
function _types() {
const data = _interopRequireWildcard(require("@babel/types"));
_types = function () {
return data;
};
return data;
}
Object.defineProperty(exports, "types", {
enumerable: true,
get: function () {
return _types();
}
});
function _parser() {
const data = require("@babel/parser");
_parser = function () {
return data;
};
return data;
}
function _traverse() {
const data = _interopRequireDefault(require("@babel/traverse"));
_traverse = function () {
return data;
};
return data;
}
function _template() {
const data = _interopRequireDefault(require("@babel/template"));
_template = function () {
return data;
};
return data;
}
var _item = require("./config/item");
var _config = require("./config");
var _transform = require("./transform");
var _transformFile = require("./transform-file");
var _transformAst = require("./transform-ast");
var _parse = require("./parse");
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es", ".mjs"]);
exports.DEFAULT_EXTENSIONS = DEFAULT_EXTENSIONS;
class OptionManager {
init(opts) {
return (0, _config.loadOptions)(opts);
}
}
exports.OptionManager = OptionManager;
function Plugin(alias) {
throw new Error(`The (${alias}) Babel 5 plugin is being run with an unsupported Babel version.`);
}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.parseSync = parseSync;
exports.parseAsync = parseAsync;
exports.parse = void 0;
var _config = _interopRequireDefault(require("./config"));
var _normalizeFile = _interopRequireDefault(require("./transformation/normalize-file"));
var _normalizeOpts = _interopRequireDefault(require("./transformation/normalize-opts"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const parse = function parse(code, opts, callback) {
if (typeof opts === "function") {
callback = opts;
opts = undefined;
}
if (callback === undefined) return parseSync(code, opts);
const config = (0, _config.default)(opts);
if (config === null) {
return null;
}
const cb = callback;
process.nextTick(() => {
let ast = null;
try {
const cfg = (0, _config.default)(opts);
if (cfg === null) return cb(null, null);
ast = (0, _normalizeFile.default)(cfg.passes, (0, _normalizeOpts.default)(cfg), code).ast;
} catch (err) {
return cb(err);
}
cb(null, ast);
});
};
exports.parse = parse;
function parseSync(code, opts) {
const config = (0, _config.default)(opts);
if (config === null) {
return null;
}
return (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code).ast;
}
function parseAsync(code, opts) {
return new Promise((res, rej) => {
parse(code, opts, (err, result) => {
if (err == null) res(result);else rej(err);
});
});
}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function helpers() {
const data = _interopRequireWildcard(require("@babel/helpers"));
helpers = function () {
return data;
};
return data;
}
function _generator() {
const data = _interopRequireDefault(require("@babel/generator"));
_generator = function () {
return data;
};
return data;
}
function _template() {
const data = _interopRequireDefault(require("@babel/template"));
_template = function () {
return data;
};
return data;
}
function t() {
const data = _interopRequireWildcard(require("@babel/types"));
t = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
const buildUmdWrapper = replacements => _template().default`
(function (root, factory) {
if (typeof define === "function" && define.amd) {
define(AMD_ARGUMENTS, factory);
} else if (typeof exports === "object") {
factory(COMMON_ARGUMENTS);
} else {
factory(BROWSER_ARGUMENTS);
}
})(UMD_ROOT, function (FACTORY_PARAMETERS) {
FACTORY_BODY
});
`(replacements);
function buildGlobal(whitelist) {
const namespace = t().identifier("babelHelpers");
const body = [];
const container = t().functionExpression(null, [t().identifier("global")], t().blockStatement(body));
const tree = t().program([t().expressionStatement(t().callExpression(container, [t().conditionalExpression(t().binaryExpression("===", t().unaryExpression("typeof", t().identifier("global")), t().stringLiteral("undefined")), t().identifier("self"), t().identifier("global"))]))]);
body.push(t().variableDeclaration("var", [t().variableDeclarator(namespace, t().assignmentExpression("=", t().memberExpression(t().identifier("global"), namespace), t().objectExpression([])))]));
buildHelpers(body, namespace, whitelist);
return tree;
}
function buildModule(whitelist) {
const body = [];
const refs = buildHelpers(body, null, whitelist);
body.unshift(t().exportNamedDeclaration(null, Object.keys(refs).map(name => {
return t().exportSpecifier(t().cloneNode(refs[name]), t().identifier(name));
})));
return t().program(body, [], "module");
}
function buildUmd(whitelist) {
const namespace = t().identifier("babelHelpers");
const body = [];
body.push(t().variableDeclaration("var", [t().variableDeclarator(namespace, t().identifier("global"))]));
buildHelpers(body, namespace, whitelist);
return t().program([buildUmdWrapper({
FACTORY_PARAMETERS: t().identifier("global"),
BROWSER_ARGUMENTS: t().assignmentExpression("=", t().memberExpression(t().identifier("root"), namespace), t().objectExpression([])),
COMMON_ARGUMENTS: t().identifier("exports"),
AMD_ARGUMENTS: t().arrayExpression([t().stringLiteral("exports")]),
FACTORY_BODY: body,
UMD_ROOT: t().identifier("this")
})]);
}
function buildVar(whitelist) {
const namespace = t().identifier("babelHelpers");
const body = [];
body.push(t().variableDeclaration("var", [t().variableDeclarator(namespace, t().objectExpression([]))]));
const tree = t().program(body);
buildHelpers(body, namespace, whitelist);
body.push(t().expressionStatement(namespace));
return tree;
}
function buildHelpers(body, namespace, whitelist) {
const getHelperReference = name => {
return namespace ? t().memberExpression(namespace, t().identifier(name)) : t().identifier(`_${name}`);
};
const refs = {};
helpers().list.forEach(function (name) {
if (whitelist && whitelist.indexOf(name) < 0) return;
const ref = refs[name] = getHelperReference(name);
const {
nodes
} = helpers().get(name, getHelperReference, ref);
body.push(...nodes);
});
return refs;
}
function _default(whitelist, outputType = "global") {
let tree;
const build = {
global: buildGlobal,
module: buildModule,
umd: buildUmd,
var: buildVar
}[outputType];
if (build) {
tree = build(whitelist);
} else {
throw new Error(`Unsupported output type ${outputType}`);
}
return (0, _generator().default)(tree).code;
}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.transformFromAstSync = transformFromAstSync;
exports.transformFromAstAsync = transformFromAstAsync;
exports.transformFromAst = void 0;
var _config = _interopRequireDefault(require("./config"));
var _transformation = require("./transformation");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const transformFromAst = function transformFromAst(ast, code, opts, callback) {
if (typeof opts === "function") {
callback = opts;
opts = undefined;
}
if (callback === undefined) return transformFromAstSync(ast, code, opts);
const cb = callback;
process.nextTick(() => {
let cfg;
try {
cfg = (0, _config.default)(opts);
if (cfg === null) return cb(null, null);
} catch (err) {
return cb(err);
}
if (!ast) return cb(new Error("No AST given"));
(0, _transformation.runAsync)(cfg, code, ast, cb);
});
};
exports.transformFromAst = transformFromAst;
function transformFromAstSync(ast, code, opts) {
const config = (0, _config.default)(opts);
if (config === null) return null;
if (!ast) throw new Error("No AST given");
return (0, _transformation.runSync)(config, code, ast);
}
function transformFromAstAsync(ast, code, opts) {
return new Promise((res, rej) => {
transformFromAst(ast, code, opts, (err, result) => {
if (err == null) res(result);else rej(err);
});
});
}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.transformFileSync = transformFileSync;
exports.transformFileAsync = transformFileAsync;
exports.transformFile = void 0;
const transformFile = function transformFile(filename, opts, callback) {
if (typeof opts === "function") {
callback = opts;
}
callback(new Error("Transforming files is not supported in browsers"), null);
};
exports.transformFile = transformFile;
function transformFileSync() {
throw new Error("Transforming files is not supported in browsers");
}
function transformFileAsync() {
return Promise.reject(new Error("Transforming files is not supported in browsers"));
}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.transformFileSync = transformFileSync;
exports.transformFileAsync = transformFileAsync;
exports.transformFile = void 0;
function _fs() {
const data = _interopRequireDefault(require("fs"));
_fs = function () {
return data;
};
return data;
}
var _config = _interopRequireDefault(require("./config"));
var _transformation = require("./transformation");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
({});
const transformFile = function transformFile(filename, opts, callback) {
let options;
if (typeof opts === "function") {
callback = opts;
opts = undefined;
}
if (opts == null) {
options = {
filename
};
} else if (opts && typeof opts === "object") {
options = Object.assign({}, opts, {
filename
});
}
process.nextTick(() => {
let cfg;
try {
cfg = (0, _config.default)(options);
if (cfg === null) return callback(null, null);
} catch (err) {
return callback(err);
}
const config = cfg;
_fs().default.readFile(filename, "utf8", function (err, code) {
if (err) return callback(err, null);
(0, _transformation.runAsync)(config, code, null, callback);
});
});
};
exports.transformFile = transformFile;
function transformFileSync(filename, opts) {
let options;
if (opts == null) {
options = {
filename
};
} else if (opts && typeof opts === "object") {
options = Object.assign({}, opts, {
filename
});
}
const config = (0, _config.default)(options);
if (config === null) return null;
return (0, _transformation.runSync)(config, _fs().default.readFileSync(filename, "utf8"));
}
function transformFileAsync(filename, opts) {
return new Promise((res, rej) => {
transformFile(filename, opts, (err, result) => {
if (err == null) res(result);else rej(err);
});
});
}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.transformSync = transformSync;
exports.transformAsync = transformAsync;
exports.transform = void 0;
var _config = _interopRequireDefault(require("./config"));
var _transformation = require("./transformation");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const transform = function transform(code, opts, callback) {
if (typeof opts === "function") {
callback = opts;
opts = undefined;
}
if (callback === undefined) return transformSync(code, opts);
const cb = callback;
process.nextTick(() => {
let cfg;
try {
cfg = (0, _config.default)(opts);
if (cfg === null) return cb(null, null);
} catch (err) {
return cb(err);
}
(0, _transformation.runAsync)(cfg, code, null, cb);
});
};
exports.transform = transform;
function transformSync(code, opts) {
const config = (0, _config.default)(opts);
if (config === null) return null;
return (0, _transformation.runSync)(config, code);
}
function transformAsync(code, opts) {
return new Promise((res, rej) => {
transform(code, opts, (err, result) => {
if (err == null) res(result);else rej(err);
});
});
}
\ No newline at end of file
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../acorn/bin/acorn" "$@"
else
exec node "$basedir/../acorn/bin/acorn" "$@"
fi
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../acorn/bin/acorn" $args
} else {
& "$basedir/node$exe" "$basedir/../acorn/bin/acorn" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../acorn/bin/acorn" $args
} else {
& "node$exe" "$basedir/../acorn/bin/acorn" $args
}
$ret=$LASTEXITCODE
}
exit $ret
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../mime/cli.js" "$@"
else
exec node "$basedir/../mime/cli.js" "$@"
fi
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\mime\cli.js" %*
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../mime/cli.js" $args
} else {
& "$basedir/node$exe" "$basedir/../mime/cli.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../mime/cli.js" $args
} else {
& "node$exe" "$basedir/../mime/cli.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "react-template",
"version": "0.1.0",
"private": true,
"dependencies": {
"@types/jest": "24.0.18",
"@types/node": "12.7.12",
"@types/react": "16.9.5",
"@types/react-dom": "16.9.1",
"@types/react-redux": "^7.1.4",
"@types/react-router-dom": "^5.1.0",
"@types/redux-thunk": "^2.1.0",
"axios": "^0.19.0",
"bootstrap": "^4.3.1",
"react": "^16.10.2",
"react-dom": "^16.10.2",
"react-fontawesome": "^1.6.1",
"react-redux": "^7.1.1",
"react-router-dom": "^5.1.2",
"react-scripts": "^3.2.0",
"reactjs-popup": "^1.5.0",
"redux": "^4.0.4",
"redux-thunk": "^2.3.0",
"typescript": "^3.7.0-beta"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@fortawesome/fontawesome-free": "^5.11.2"
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="logo192.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<title>RyHealthProfile</title>
</head>
<body id="page-top">
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
# https://www.robotstxt.org/robotstxt.html
User-agent: *
body {
color: darkslategray;
}
.popup-modal-content {
width : 300px !important;
box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15) !important;
}
.popup-title {
height : 40px;
position : absolute;
width : 100%;
left : 0px;
background-color: whitesmoke;
top : 0px;
text-align : center;
padding-top : 5px;
color : black;
}
.popup-content {
margin-top : 40px;
padding-top: 10px;
width : 100%;
text-align : center;
}
.popup-modal {
height: 70px;
}
.left-margin {
margin-left: 10px;
}
.toast-wrapper {
position: fixed;
top : 80px;
right : 30px;
z-index: 100 !important;
}
.toast {
opacity: 0.95 !important;
width: 250px;
}
.toast-header {
color: dodgerblue !important;
}
.card-bottom-list {
max-height: 303px;
}
.bg-login-image {
background: url("./assets/login.png") !important;
background-position: center !important;
background-size: cover !important;
}
.bg-gradient-primary-green {
background-image: linear-gradient(180deg,#0e1e24 10%, #00c6b6 100%);
background-size: cover;
}
.icon-green {
color: seagreen;
}
.bg-custom-dark {
background-color: #0e1e24;
}
.dark-breadcrumb {
background-color: #0e1e24 !important;
margin-top: 15px !important;
}
li a {
color: cadetblue;
}
.cadet {
color: cadetblue;
}
.text-green {
color: cadetblue !important;
font-family: sans-serif !important;
}
.toggle-area {
display:none;
}
.collapsed {
display:block;
}
.toggle-button {
background-color: #0e1e24 !important;
border-color: #0e1e24 !important;
width: 40px;
color: seagreen !important;
}
@media (max-width: 380px) {
.collapsed {
display:none !important;
}
.toggle-area {
position: fixed;
bottom: 2%;
left:2%;
z-index: 200 !important;
display: block;
}
}
\ No newline at end of file
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<App />, div);
ReactDOM.unmountComponentAtNode(div);
});
import React from "react";
import "./App.css";
import "./styles/sb-admin-2.min.css";
import { BrowserRouter as Router, Switch, Route, } from "react-router-dom";
import Login from "./components/Account/Login";
import SignUp from "./components/Account/Signup";
import Admin from "./components/Admin/Admin";
import { PrivateRoute } from "./common/components/PrivateRoute";
import { AccountRoute } from "./common/components/AccountRoute";
const App: React.FC = () => {
return (
<div className="App" id="wrapper">
<Router>
<Switch>
{/* <PrivateRoute path="/">
<Admin />
</PrivateRoute> */}
{/* */}
<Route path="/Login"><Login /></Route>
<Route path="/SignUp"><SignUp /></Route>
<Route path="/"><Admin /></Route>
{/* <AccountRoute path="/login"><Login /></AccountRoute>
<AccountRoute path="/signup"><SignUp /></AccountRoute> */}
</Switch>
</Router>
</div>
);
};
export default App;
import { Route, Redirect, RouteProps } from "react-router";
import React from "react";
import { useSelector } from "react-redux";
import { IStateType } from "../../store/models/root.interface";
import { IAccount } from "../../store/models/account.interface";
import Login from "../../components/Account/Login";
export function AccountRoute({ children, ...rest }: RouteProps): JSX.Element {
const account: IAccount = useSelector((state: IStateType) => state.account);
return (
<Route
{...rest}
render={() =>
account.email ? (
<Redirect
to={{
pathname: "/admin/home"
}}
/>
) : <Login />
}
/>
);
}
\ No newline at end of file
import React, { useState, ChangeEvent } from "react";
import { CheckboxProps } from "../types/Checkbox.types";
function Checkbox(props: CheckboxProps): JSX.Element {
const [touched, setTouch] = useState(false);
const [error, setError] = useState("");
const [htmlClass, setHtmlClass] = useState("");
const [, setValue] = useState(false);
function onValueChanged(event: ChangeEvent<HTMLInputElement>): void {
let [error, validClass, elementValue] = ["", "", event.target.checked];
[error, validClass] = (!elementValue && props.required) ?
["Value has to be checked", "is-invalid"] : ["", "is-valid"];
props.onChange({ value: elementValue, error: error, touched: touched, field: props.field });
setTouch(true);
setError(error);
setHtmlClass(validClass);
setValue(elementValue);
}
return (
<div className="form-check">
<input
className={`form-check-input ${props.inputClass ? props.inputClass : ""} ${htmlClass}`}
type="checkbox"
id={`id_${props.label}`}
checked={props.value}
onChange={onValueChanged} />
<label className="form-check-label" htmlFor={props.id.toString()}>
{props.label}
</label>
{error ?
<div className="invalid-feedback">
{error}
</div> : null
}
</div>
);
}
export default Checkbox;
\ No newline at end of file
import React, { Dispatch } from "react";
import { useDispatch, useSelector } from "react-redux";
import { IStateType } from "../../store/models/root.interface";
import { INotification } from "../../store/models/notification.interface";
import { removeNotification } from "../../store/actions/notifications.action";
const Notifications: React.FC = () => {
const dispatch: Dispatch<any> = useDispatch();
const notifications: INotification[] = useSelector((state: IStateType) =>
state.notifications.notifications);
function closeNotification(id: number) {
dispatch(removeNotification(id));
}
const notificationList = notifications.map(notification => {
return (
<div className="toast" key={`notification_${notification.id}`}>
<div className="toast-header">
<i className="fas fa-fw fa-bell"></i>
<strong className="mr-auto">{notification.title}</strong>
<small>{notification.date.toLocaleTimeString(navigator.language, { hour: '2-digit', minute: '2-digit' })}</small>
<button type="button"
className="ml-2 mb-1 close"
data-dismiss="toast"
aria-label="Close"
onClick={() => closeNotification(notification.id)}>
<span aria-hidden="true">&times;</span>
</button>
</div>
<div className="toast-body">
{notification.text}
</div>
</div>
)
});
return (
<div className="toast-wrapper">
{notificationList}
</div>
);
};
export default Notifications;
import React, { useState, ChangeEvent } from "react";
import { NumberInputProps } from "../types/NumberInput.types";
function NumberInput(props: NumberInputProps): JSX.Element {
const [touched, setTouch] = useState(false);
const [error, setError] = useState("");
const [htmlClass, setHtmlClass] = useState("");
const [, setValue] = useState(0);
function onValueChanged(event: ChangeEvent<HTMLInputElement>): void {
let elementValue: number = (isNaN(Number(event.target.value))) ? 0 : Number(event.target.value);
let [error, validClass] = ["", ""];
if (!error) {
[error, validClass] = ((props.max != null) && elementValue > (props.max)) ?
[`Value can't be higher than ${props.max} `, "is-invalid"] : ["", "is-valid"];
}
if (!error) {
[error, validClass] = ((props.min != null) && elementValue < (props.min)) ?
[`Value can't be lower than ${props.min} `, "is-invalid"] : ["", "is-valid"];
}
props.onChange({ value: elementValue, error: error, touched: touched, field: props.field });
setTouch(true);
setError(error);
setHtmlClass(validClass);
setValue(elementValue);
}
return (
<div>
<label htmlFor={props.id.toString()}>{props.label}</label>
<input
value={props.value}
type="number"
onChange={onValueChanged}
className={`form-control ${props.inputClass} ${htmlClass}`}
id={`id_${props.label}`}/>
{error ?
<div className="invalid-feedback">
{error}
</div> : null
}
</div>
);
}
export default NumberInput;
\ No newline at end of file
import { Route, RouteProps } from "react-router";
import React from "react";
import { useSelector } from "react-redux";
import { IStateType } from "../../store/models/root.interface";
import { IAccount } from "../../store/models/account.interface";
import Login from "../../components/Account/Login";
export function PrivateRoute({ children, ...rest }: RouteProps): JSX.Element {
const account: IAccount = useSelector((state: IStateType) => state.account);
return (
<Route
{...rest}
render={() =>
account.email ? (
children
) : <Login/>
}
/>
);
}
\ No newline at end of file
import React, { useState, ChangeEvent, Fragment } from "react";
import { SelectProps } from "../types/Select.types";
function SelectInput(props: SelectProps): JSX.Element {
const [touched, setTouch] = useState(false);
const [error, setError] = useState("");
const [htmlClass, setHtmlClass] = useState("");
const [value, setValue] = useState(props.value);
function onValueChanged(event: ChangeEvent<HTMLSelectElement>): void {
let [error, validClass, elementValue] = ["", "", event.target.value];
[error, validClass] = (!elementValue && props.required) ?
["Value has to be selected", "is-invalid"] : ["", "is-valid"];
props.onChange({ value: elementValue, error: error, touched: touched, field: props.field });
setTouch(true);
setError(error);
setHtmlClass(validClass);
setValue(elementValue);
}
const getOptions: (JSX.Element | null)[] = props.options.map(option => {
return (
<option key={option} value={`${option}`}>{option}</option>
)
});
return (
<Fragment>
<label htmlFor={`${props.id}`}>{props.label}</label>
<select
value={value}
id={`${props.id}`}
className={`form-control ${props.inputClass ? props.inputClass : ""} ${htmlClass}`}
onChange={onValueChanged}>
<option value="">Choose...</option>
{getOptions}
</select>
{error ?
<div className="invalid-feedback">
{error}
</div> : null
}
</Fragment>
);
}
export default SelectInput;
\ No newline at end of file
import React, { useState, ChangeEvent } from "react";
import { TextInputProps } from "../types/TextInput.types";
function TextInput(props: TextInputProps): JSX.Element {
const [touched, setTouch] = useState(false);
const [error, setError] = useState("");
const [htmlClass, setHtmlClass] = useState("");
const [, setValue] = useState("");
function onValueChanged(event: ChangeEvent<HTMLInputElement>): void {
let [error, validClass, elementValue] = ["", "", event.target.value];
[error, validClass] = (!elementValue && props.required) ?
["Value cannot be empty", "is-invalid"] : ["", "is-valid"];
if (!error) {
[error, validClass] = (props.maxLength && elementValue && elementValue.length > (props.maxLength)) ?
[`Value can't have more than ${props.maxLength} characters`, "is-invalid"] : ["", "is-valid"];
}
props.onChange({ value: elementValue, error: error, touched: touched, field: props.field });
setTouch(true);
setError(error);
setHtmlClass(validClass);
setValue(elementValue);
}
return (
<div>
<label htmlFor={props.id.toString()}>{props.label}</label>
<input
value={props.value}
type={props.type}
onChange={onValueChanged}
className={`form-control ${props.inputClass} ${htmlClass}`}
id={`id_${props.label}`}
placeholder={props.placeholder} />
{error ?
<div className="invalid-feedback">
{error}
</div> : null
}
</div>
);
}
export default TextInput;
\ No newline at end of file
import React, { PropsWithChildren, ReactElement } from "react";
import { ICardProperties } from "../types/TopCard.types";
function TopCard(props: PropsWithChildren<ICardProperties>): ReactElement {
return (
<div className="col-xl-3 col-md-6 mb-4">
<div className={`card border-left-${props.class} shadow h-100 py-2 `}>
<div className="card-body">
<div className="row no-gutters align-items-center">
<div className="col mr-2">
<div className="text-xs font-weight-bold text-green text-uppercase mb-1">{props.title}</div>
<div className="h5 mb-0 font-weight-bold text-gray-800">{props.text}</div>
</div>
<div className="col-auto">
<i className={`fas fa-${props.icon} fa-2x text-gray-300`}></i>
</div>
</div>
</div>
</div>
</div>
);
}
export default TopCard;
export type CheckboxProps = {
required?: boolean,
onChange: Function,
id: string,
label: string,
value: boolean,
inputClass?: string,
field: string
};
export type OnChangeCheckboxModel = {
value: boolean,
error: string,
touched: boolean
};
\ No newline at end of file
import { IProduct } from "../../store/models/product.interface";
export type OnChangeModel = {
value: string | number | boolean,
error: string,
touched: boolean,
field: string
};
export interface IFormStateField<T> {error: string, value: T};
export interface IProductFormState {
qualification: IFormStateField<string>;
experience: IFormStateField<number>;
rating: IFormStateField<number>;
place: IFormStateField<string>;
profile: IFormStateField<string>;
name: IFormStateField<string>;
description: IFormStateField<string>;
amount: IFormStateField<number>;
price: IFormStateField<number>;
hasExpiryDate: IFormStateField<boolean>;
category: IFormStateField<string>;
}
export interface IOrderFormState {
name: IFormStateField<string>;
product: IFormStateField<IProduct | null>;
amount: IFormStateField<number>;
totalPrice: IFormStateField<number>;
result: IFormStateField<number>;
unit: IFormStateField<string>;
refRange: IFormStateField<string>;
};
\ No newline at end of file
export type NumberInputProps = {
onChange: Function,
id: string,
label: string,
value: number,
max?: number,
min?: number,
inputClass?: string,
field: string
};
export type OnChangeNumberModel = {
value: number,
error: string,
touched: boolean
};
\ No newline at end of file
export type SelectProps = {
required?: boolean,
onChange: Function,
id: string,
label: string,
value: string,
inputClass?: string,
options: string[],
field: string
};
\ No newline at end of file
export type TextInputProps = {
required: boolean,
onChange: Function,
id: string,
label: string,
placeholder: string,
value: string,
type?: string,
maxLength: number,
inputClass?: string,
field: string
};
\ No newline at end of file
export interface ICardProperties {
text: string;
title: string;
icon: string;
class: string;
}
import React, { useState, FormEvent, Dispatch } from "react";
import { useHistory } from "react-router";
import { OnChangeModel } from "../../common/types/Form.types";
import { useDispatch } from "react-redux";
import { login } from "../../store/actions/account.actions";
import TextInput from "../../common/components/TextInput";
import axios from 'axios';
const Login: React.FC = () => {
const dispatch: Dispatch<any> = useDispatch();
const history = useHistory();
const [formState, setFormState] = useState({
email: { error: "", value: "" },
password: { error: "", value: "" }
});
function hasFormValueChanged(model: OnChangeModel): void {
setFormState({ ...formState, [model.field]: { error: model.error, value: model.value } });
}
function submit(e: FormEvent<HTMLFormElement>): void {
e.preventDefault();
if(isFormInvalid()) { return; }
const formData = new FormData();
formData.append("email", formState.email.value);
formData.append("password", formState.password.value);
axios.post('http://127.0.0.1:8000/staffapi/login', formData, {headers: {"Content-type": "multipart/form-date"}})
.then(response => {
console.log(response.data)
if(response.data.hasOwnProperty("token"))
{ dispatch(login(formState.email.value));
history.push('/')
}
});
}
function isFormInvalid() {
return (formState.email.error || formState.password.error
|| !formState.email.value || !formState.password.value);
}
function getDisabledClass(): string {
let isError: boolean = isFormInvalid() as boolean;
return isError ? "disabled" : "";
}
return (
<div className="container">
<div className="row justify-content-center">
<div className="col-xl-10 col-lg-12 col-md-9">
<div className="card o-hidden border-0 shadow-lg my-5">
<div className="card-body p-0">
<div className="row">
<div className="col-lg-6 d-none d-lg-block bg-login-image"></div>
<div className="col-lg-6">
<div className="p-5">
<div className="text-center">
<h1 className="h4 text-gray-900 mb-4">Welcome!</h1>
</div>
<form className="user" onSubmit={submit}>
<div className="form-group">
<TextInput id="input_email"
field="email"
value={formState.email.value}
onChange={hasFormValueChanged}
required={true}
maxLength={100}
label="Email"
placeholder="Email" />
</div>
<div className="form-group">
<TextInput id="input_password"
field="password"
value={formState.password.value}
onChange={hasFormValueChanged}
required={true}
maxLength={100}
type="password"
label="Password"
placeholder="Password" />
</div>
<div className="form-group">
<div className="custom-control custom-checkbox small">
<input type="checkbox" className="custom-control-input" id="customCheck" />
<label className="custom-control-label"
htmlFor="customCheck">Remember Me</label>
</div>
</div>
<button
className={`btn btn-primary btn-user btn-block ${getDisabledClass()}`}
type="submit">
Login
</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
);
};
export default Login;
import React, { useState, FormEvent, Dispatch } from "react";
import { useHistory } from "react-router";
import { OnChangeModel } from "../../common/types/Form.types";
import { useDispatch } from "react-redux";
import { login } from "../../store/actions/account.actions";
import TextInput from "../../common/components/TextInput";
import axios from 'axios';
const SignUp: React.FC = () => {
const dispatch: Dispatch<any> = useDispatch();
const history = useHistory();
const [formState, setFormState] = useState({
name: { error: "", value: "" },
email: { error: "", value: "" },
password: { error: "", value: "" }
});
function hasFormValueChanged(model: OnChangeModel): void {
setFormState({ ...formState, [model.field]: { error: model.error, value: model.value } });
}
function submit(e: FormEvent<HTMLFormElement>): void {
e.preventDefault();
if(isFormInvalid()) { return; }
const formData = new FormData();
formData.append("name", formState.name.value);
formData.append("email", formState.email.value);
formData.append("password", formState.password.value);
axios.post('http://127.0.0.1:8000/staffapi/register', formData, {headers: {"Content-type": "multipart/form-date"}})
.then(response => {
console.log(response.data)
if(response.data.hasOwnProperty("name"))
{ history.push('/Login')}
});
// dispatch(login(formState.email.value));
}
function isFormInvalid() {
return (formState.email.error || formState.password.error
|| !formState.email.value || !formState.password.value);
}
function getDisabledClass(): string {
let isError: boolean = isFormInvalid() as boolean;
return isError ? "disabled" : "";
}
return (
<div className="container">
<div className="row justify-content-center">
<div className="col-xl-10 col-lg-12 col-md-9">
<div className="card o-hidden border-0 shadow-lg my-5">
<div className="card-body p-0">
<div className="row">
<div className="col-lg-6 d-none d-lg-block bg-login-image"></div>
<div className="col-lg-6">
<div className="p-5">
<div className="text-center">
<h1 className="h4 text-gray-900 mb-4">Registration</h1>
</div>
<form className="user" onSubmit={submit}>
<div className="form-group">
<TextInput id="input_name"
field="name"
value={formState.name.value}
onChange={hasFormValueChanged}
required={true}
maxLength={100}
label="Name"
placeholder="Name" />
</div>
<div className="form-group">
<TextInput id="input_email"
field="email"
value={formState.email.value}
onChange={hasFormValueChanged}
required={true}
maxLength={100}
label="Email"
placeholder="Email" />
</div>
<div className="form-group">
<TextInput id="input_password"
field="password"
value={formState.password.value}
onChange={hasFormValueChanged}
required={true}
maxLength={100}
type="password"
label="Password"
placeholder="Password" />
</div>
{/* <div className="form-group">
<div className="custom-control custom-checkbox small">
<input type="checkbox" className="custom-control-input" id="customCheck" />
<label className="custom-control-label"
htmlFor="customCheck">Remember Me</label>
</div>
</div> */}
<button
className={`btn btn-primary btn-user btn-block ${getDisabledClass()}`}
type="submit">
SignUp
</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
);
};
export default SignUp;
import React, { Fragment } from "react";
import LeftMenu from "../LeftMenu/LeftMenu";
import TopMenu from "../TopMenu/TopMenu";
import { Switch, Route } from "react-router";
import Users from "../Users/Users";
import Products from "../Products/Products";
import Orders from "../Orders/Orders";
import Prescription from "../Prescription/Prescription";
import Home from "../Home/Home";
import Notifications from "../../common/components/Notification";
const Admin: React.FC = () => {
return (
<Fragment>
<Notifications />
<LeftMenu />
<div id="content-wrapper" className="d-flex flex-column">
<div id="content">
<TopMenu />
<div className="container-fluid">
<Switch>
<Route path={`/patients`}><Users /></Route>
<Route path={`/doctors`}><Products /></Route>
<Route path={`/reports`}><Orders /></Route>
<Route path={`/prescription`}><Prescription /></Route>
<Route path="/"><Home /></Route>
</Switch>
</div>
</div>
</div>
</Fragment>
);
};
export default Admin;
import React, { Fragment, Dispatch, useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { updateCurrentPath } from "../../store/actions/root.actions";
import TopCard from "../../common/components/TopCard";
import { IProductState, IStateType } from "../../store/models/root.interface";
import ProductList from "../Products/ProductsList";
import { IOrder } from "../../store/models/order.interface";
import OrderList from "../Orders/OrderList";
import axios from "axios";
const Home: React.FC = () => {
const products: IProductState = useSelector((state: IStateType) => state.products);
const numberItemsCount: number = products.products.length;
const totalPrice: number = products.products.reduce((prev, next) => prev + ((next.price * next.amount) || 0), 0);
const totalProductAmount: number = products.products.reduce((prev, next) => prev + (next.amount || 0), 0);
const orders: IOrder[] = useSelector((state: IStateType) => state.orders.orders);
const totalSales: number = orders.reduce((prev, next) => prev + next.totalPrice, 0);
const totalOrderAmount: number = orders.reduce((prev, next) => prev + next.amount, 0);
const email: string = useSelector((state: IStateType) => state.account.email);
const dispatch: Dispatch<any> = useDispatch();
dispatch(updateCurrentPath("home", ""));
const [resState, setresState] = useState(0);
const [appState, setappState] = useState(0);
let AppList = null
useEffect(() => {
var nameMatch = email.match(/^([^@]*)@/);
var name = nameMatch ? nameMatch[1] : null;
const article = { email : "dr.rasika" };
axios.post('http://127.0.0.1:8000/api/specificAppointment', article)
.then(response => {
AppList = response.data.map((Appointment: any) => {
return (
<tr className={`table-row`}
key={`order_${Appointment.id}`}>
<th scope="row">{Appointment.id}</th>
<td>{Appointment.fullName}</td>
<td>{Appointment.appointmentTime}</td>
</tr>);
})
setappState(response.data.length)
setresState(AppList)
});
},[]);
return (
<Fragment>
<h1 className="h3 mb-2 text-gray-800">Dashboard</h1>
<p className="mb-4">Summary and overview of our doctor stuff here</p>
<div className="row">
<TopCard title="DOCTORS COUNT" text={`${numberItemsCount}`} icon="box" class="primary" />
<TopCard title="APPONITMENT COUNT" text={`${appState}`} icon="warehouse" class="danger" />
<TopCard title="DOCTOR PRICE" text={`$${totalPrice}`} icon="dollar-sign" class="success" />
</div>
{/* <div className="row">
<TopCard title="EARNINGS" text={totalSales.toString()} icon="donate" class="primary" />
<TopCard title="TOTAL REPORT" text={totalOrderAmount.toString()} icon="calculator" class="danger" />
</div> */}
<div className="row">
<div className="col-xl-6 col-lg-6">
<div className="card shadow mb-4">
<div className="card-header py-3">
<h6 className="m-0 font-weight-bold text-green">Patient list</h6>
</div>
<div className="card-body">
<ProductList />
</div>
</div>
</div>
<div className="col-xl-6 col-lg-6">
<div className="card shadow mb-4">
<div className="card-header py-3">
<h6 className="m-0 font-weight-bold text-green">Appoiments</h6>
</div>
<div className="card-body">
<div className="table-responsive portlet">
<table className="table">
<thead className="thead-light">
<tr>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">Time</th>
{/* <th scope="col">unit</th>
<th scope="col">Range</th> */}
</tr>
</thead>
<tbody>
{resState}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</Fragment>
);
};
export default Home;
import React, { Fragment, useState } from "react";
import { Link } from "react-router-dom";
const LeftMenu: React.FC = () => {
let [leftMenuVisibility, setLeftMenuVisibility] = useState(false);
function changeLeftMenuVisibility() {
setLeftMenuVisibility(!leftMenuVisibility);
}
function getCollapseClass() {
return (leftMenuVisibility) ? "" : "collapsed";
}
return (
<Fragment>
<div className="toggle-area">
<button className="btn btn-primary toggle-button" onClick={() => changeLeftMenuVisibility()}>
<i className="fas fa-bolt"></i>
</button>
</div>
<ul className={`navbar-nav bg-gradient-primary-green sidebar sidebar-dark accordion ${getCollapseClass()}`}
id="collapseMenu">
<a className="sidebar-brand d-flex align-items-center justify-content-center" href="index.html">
{/* <div className="sidebar-brand-icon icon-green rotate-n-15">
<i className="fas fa-bolt"></i>
</div> */}
<div className="sidebar-brand-text mx-3">RyHealthProfile</div>
</a>
<hr className="sidebar-divider my-0" />
<li className="nav-item active">
<Link className="nav-link" to="Home">
<i className="fas fa-fw fa-tachometer-alt"></i>
<span>Dashboard</span>
</Link>
</li>
<hr className="sidebar-divider" />
<div className="sidebar-heading">
Managment
</div>
<li className="nav-item">
<Link className="nav-link" to={`/doctors`}>
<i className="fas fa-fw fa-user"></i>
<span>Doctor Profiles</span>
</Link>
</li>
<li className="nav-item">
<Link className="nav-link" to={`/reports`}>
<i className="fas fa-book-open"></i>
<span>Lab Reports</span>
</Link>
</li>
<li className="nav-item">
<Link className="nav-link" to={`/prescription`}>
<i className="fas fa-book-open"></i>
<span>Prescription</span>
</Link>
</li>
<hr className="sidebar-divider" />
<div className="sidebar-heading">
Profile
</div>
<li className="nav-item">
<Link className="nav-link" to={`/patients`}>
<i className="fas fa-fw fa-user"></i>
<span>Patients</span>
</Link>
</li>
<hr className="sidebar-divider d-none d-md-block" />
</ul>
</Fragment>
);
};
export default LeftMenu;
import React, { useState, FormEvent, Fragment, Dispatch } from "react";
import { IProduct } from "../../store/models/product.interface";
import TextInput from "../../common/components/TextInput";
import NumberInput from "../../common/components/NumberInput";
import { OnChangeModel, IOrderFormState } from "../../common/types/Form.types";
import { useDispatch, useSelector } from "react-redux";
import { addOrder } from "../../store/actions/orders.actions";
import { addNotification } from "../../store/actions/notifications.action";
import { clearSelectedProduct, changeProductAmount } from "../../store/actions/products.action";
import { IOrder } from "../../store/models/order.interface";
import { IStateType } from "../../store/models/root.interface";
import axios from 'axios'
const OrderForm: React.FC = () => {
const dispatch: Dispatch<any> = useDispatch();
const selectedProduct: IProduct | null = useSelector((state: IStateType) => state.products.selectedProduct);
const orders: IOrder[] = useSelector((state: IStateType) => state.orders.orders);
const [selectedFile, setSelectedFile] = useState("");
const initialFormState: IOrderFormState = {
name: { error: "", value: "" },
result: { error: "", value: 0 },
unit: { error: "", value: "" },
refRange: { error: "", value: "" },
product: { error: "", value: null },
amount: { error: "", value: 0 },
totalPrice: { error: "", value: 0 },
};
const [formState, setFormState] = useState(initialFormState);
function hasAmountChanged(model: OnChangeModel): void {
let totalPrice: number = formState.totalPrice.value;
if (selectedProduct) {
totalPrice = selectedProduct.price * (model.value as number);
}
setFormState({
...formState,
amount: { error: model.error, value: model.value as number },
totalPrice: { error: model.error, value: totalPrice }
});
}
function hasFormValueChanged(model: OnChangeModel): void {
setFormState({ ...formState, [model.field]: { error: model.error, value: model.value } });
}
function resetForm(): void {
setFormState(initialFormState);
}
function saveOrder(e: FormEvent<HTMLFormElement>): void {
e.preventDefault();
if (isFormInvalid()) {
return;
}
saveForm(formState);
}
function saveForm(formState: IOrderFormState): void {
if (selectedProduct) {
if (selectedProduct.amount < formState.amount.value) {
alert("Not enough products in warehouse");
return;
}
formState.product.value = selectedProduct;
// dispatch(addOrder({
// id: 0,
// name: formState.name.value,
// amount: formState.amount.value,
// totalPrice: formState.totalPrice.value,
// product: formState.product.value as IProduct
// }));
// dispatch(addNotification("Order added", `Order ${formState.name.value} added by you`));
// dispatch(clearSelectedProduct());
// dispatch(changeProductAmount(selectedProduct.id, formState.amount.value));
resetForm();
}
}
function isFormInvalid(): boolean {
return (formState.amount.error || formState.totalPrice.error
|| formState.name.error || formState.product.error || !formState.name.value
|| !selectedProduct) as boolean;
}
function getDisabledClass(): string {
let isError: boolean = isFormInvalid();
return isError ? "disabled" : "";
}
const handleFileSelect = (selectorFiles:any) => {
console.log(selectorFiles[0])
setSelectedFile(selectorFiles[0])
// const formData = new FormData();
// formData.append("file", selectedFile);
// axios.post('http://127.0.0.1:8000/staffapi/labreport', formData, {headers: {"Content-type": "multipart/form-date"}})
// .then(response => {
// for (var key in response.data) {
// if (response.data.hasOwnProperty(key)) {
// console.log(key + " -> " + response.data[key]);
// dispatch(addOrder({
// id: parseInt(key),
// name: response.data[key].name,
// result: response.data[key].result,
// unit: response.data[key].unit,
// refRange: response.data[key].refRnage,
// product: null,
// amount: 0,
// totalPrice: 0,
// }));
// // dispatch(addNotification("Order added", `Order ${formState.name.value} added by you`));
// dispatch(clearSelectedProduct());
// // dispatch(changeProductAmount(selectedProduct.id, formState.amount.value));
// }
// }
// });
}
const Send = () => {
const formData = new FormData();
if(selectedFile != "")
{
formData.append("file", selectedFile);
axios.post('http://127.0.0.1:8000/staffapi/labreport', formData, {headers: {"Content-type": "multipart/form-date"}})
.then(response => {
for (var key in response.data) {
if (response.data.hasOwnProperty(key)) {
console.log(key + " -> " + response.data[key]);
dispatch(addOrder({
id: parseInt(key),
name: response.data[key].name,
result: response.data[key].result,
unit: response.data[key].unit,
refRange: response.data[key].refRnage,
product: null,
amount: 0,
totalPrice: 0,
}));
// dispatch(addNotification("Order added", `Order ${formState.name.value} added by you`));
dispatch(clearSelectedProduct());
// dispatch(changeProductAmount(selectedProduct.id, formState.amount.value));
}
}
});
// dispatch(addNotification("Sent", `Prescription sent to nearest Lab`));
}
}
return (
<Fragment>
<div className="card shadow mb-4">
<div className="card-header py-3">
<h6 className="m-0 font-weight-bold text-green">Upload</h6>
</div>
<div className="card-body">
<form onSubmit={saveOrder}>
<div className="form-row">
<input type="file" onChange={(e) => handleFileSelect(e.target.files)}/>
<button onClick={Send}>Send</button>
{/* <div className="form-group col-md-12">
<TextInput id="input_name"
value={formState.name.value}
field="name"
onChange={hasFormValueChanged}
required={true}
maxLength={20}
label="Name"
placeholder="Name" />
</div>
<div className="form-group col-md-6">
<NumberInput id="input_amount"
value={formState.amount.value}
field="amount"
onChange={hasAmountChanged}
max={1000}
min={0}
label="Amount" />
</div>
<div className="form-group col-md-6">
<NumberInput id="input_totalPrice"
value={formState.totalPrice.value}
field="totalPrice"
onChange={hasFormValueChanged}
max={1000}
min={0}
label="Price" />
</div> */}
</div>
{/* <button className="btn btn-danger" onClick={() => resetForm()}>Reset</button> */}
{/* <button type="submit" className={`btn btn-success left-margin ${getDisabledClass()}`}>Create</button> */}
</form>
</div>
</div>
</Fragment>
);
};
export default OrderForm;
import React, { } from "react";
import { useSelector } from "react-redux";
import { IOrder } from "../../store/models/order.interface";
import { IStateType } from "../../store/models/root.interface";
const OrderList: React.FC = () => {
const orders: IOrder[] = useSelector((state: IStateType) => state.orders.orders);
const orderList: JSX.Element[] = orders.map(order => {
return (
<tr className={`table-row`}
key={`order_${order.id}`}>
<th scope="row">{order.id}</th>
<td>{order.name}</td>
<td>{order.result}</td>
<td>{order.unit}</td>
<td>{order.refRange}</td>
</tr>);
})
return (
<div className="table-responsive portlet">
<table className="table">
<thead className="thead-light">
<tr>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">Result</th>
<th scope="col">unit</th>
<th scope="col">Range</th>
</tr>
</thead>
<tbody>
{orderList}
</tbody>
</table>
</div>
)
}
export default OrderList;
\ No newline at end of file
import React, { Fragment, Dispatch } from "react";
import { useDispatch, useSelector } from "react-redux";
import { updateCurrentPath } from "../../store/actions/root.actions";
import { IOrder } from "../../store/models/order.interface";
import OrderList from "./OrderList";
import TopCard from "../../common/components/TopCard";
import OrderForm from "./OrderForm";
import ProductList from "../Products/ProductsList";
import { IProduct } from "../../store/models/product.interface";
import { changeSelectedProduct, clearSelectedProduct } from "../../store/actions/products.action";
import { IStateType } from "../../store/models/root.interface";
const Orders: React.FC = () => {
const dispatch: Dispatch<any> = useDispatch();
const orders: IOrder[] = useSelector((state: IStateType) => state.orders.orders);
const totalSales: number = orders.reduce((prev, next) => prev + next.totalPrice, 0);
const totalAmount: number = orders.reduce((prev, next) => prev + next.amount, 0);
dispatch(updateCurrentPath("orders", "list"));
dispatch(clearSelectedProduct());
function selectProduct(product: IProduct): void {
dispatch(changeSelectedProduct(product));
}
return (
<Fragment>
<h1 className="h3 mb-2 text-gray-800">Lab Reports</h1>
<p className="mb-4">Reports here</p>
{/* <div className="row">
<TopCard title="TOTAL SALES" text={totalSales.toString()} icon="donate" class="primary" />
<TopCard title="TOTAL AMOUNT" text={totalAmount.toString()} icon="calculator" class="danger" />
</div> */}
<div className="row">
<div className="col-md-6">
<OrderForm />
</div>
<div className="col-md-6">
</div>
</div>
<div className="row">
<div className="col-xl-12 col-lg-12">
<div className="card shadow mb-4">
<div className="card-header py-3">
<h6 className="m-0 font-weight-bold text-green">Report Results</h6>
<div className="header-buttons">
</div>
</div>
<div className="card-body">
<OrderList />
</div>
</div>
</div>
</div>
</Fragment>
)
}
export default Orders;
\ No newline at end of file
import React, { useState, FormEvent, Fragment, Dispatch } from "react";
import { IProduct } from "../../store/models/product.interface";
import TextInput from "../../common/components/TextInput";
import NumberInput from "../../common/components/NumberInput";
import { OnChangeModel, IOrderFormState } from "../../common/types/Form.types";
import { useDispatch, useSelector } from "react-redux";
import { addOrder } from "../../store/actions/orders.actions";
import { addNotification } from "../../store/actions/notifications.action";
import { clearSelectedProduct, changeProductAmount } from "../../store/actions/products.action";
import { IOrder } from "../../store/models/order.interface";
import { IStateType } from "../../store/models/root.interface";
import axios from 'axios'
const OrderForm: React.FC = () => {
const dispatch: Dispatch<any> = useDispatch();
const selectedProduct: IProduct | null = useSelector((state: IStateType) => state.products.selectedProduct);
const orders: IOrder[] = useSelector((state: IStateType) => state.orders.orders);
const [selectedFile, setSelectedFile] = useState("");
const initialFormState: IOrderFormState = {
name: { error: "", value: "" },
result: { error: "", value: 0 },
unit: { error: "", value: "" },
refRange: { error: "", value: "" },
product: { error: "", value: null },
amount: { error: "", value: 0 },
totalPrice: { error: "", value: 0 },
};
const [formState, setFormState] = useState(initialFormState);
function hasAmountChanged(model: OnChangeModel): void {
let totalPrice: number = formState.totalPrice.value;
if (selectedProduct) {
totalPrice = selectedProduct.price * (model.value as number);
}
setFormState({
...formState,
amount: { error: model.error, value: model.value as number },
totalPrice: { error: model.error, value: totalPrice }
});
}
function hasFormValueChanged(model: OnChangeModel): void {
setFormState({ ...formState, [model.field]: { error: model.error, value: model.value } });
}
function resetForm(): void {
setFormState(initialFormState);
}
function saveOrder(e: FormEvent<HTMLFormElement>): void {
e.preventDefault();
if (isFormInvalid()) {
return;
}
saveForm(formState);
}
function saveForm(formState: IOrderFormState): void {
if (selectedProduct) {
if (selectedProduct.amount < formState.amount.value) {
alert("Not enough products in warehouse");
return;
}
formState.product.value = selectedProduct;
// dispatch(addOrder({
// id: 0,
// name: formState.name.value,
// amount: formState.amount.value,
// totalPrice: formState.totalPrice.value,
// product: formState.product.value as IProduct
// }));
// dispatch(addNotification("Order added", `Order ${formState.name.value} added by you`));
// dispatch(clearSelectedProduct());
// dispatch(changeProductAmount(selectedProduct.id, formState.amount.value));
resetForm();
}
}
function isFormInvalid(): boolean {
return (formState.amount.error || formState.totalPrice.error
|| formState.name.error || formState.product.error || !formState.name.value
|| !selectedProduct) as boolean;
}
function getDisabledClass(): string {
let isError: boolean = isFormInvalid();
return isError ? "disabled" : "";
}
const handleFileSelect = (selectorFiles:any) => {
console.log(selectorFiles[0])
setSelectedFile(selectorFiles[0])
}
const Send = () => {
const formData = new FormData();
if(selectedFile != "")
{
// formData.append("file", selectedFile);
// axios.post('http://127.0.0.1:8000/staffapi/labreport', formData, {headers: {"Content-type": "multipart/form-date"}})
// .then(response => {
// for (var key in response.data) {
// if (response.data.hasOwnProperty(key)) {
// console.log(key + " -> " + response.data[key]);
// dispatch(addOrder({
// id: parseInt(key),
// name: response.data[key].name,
// result: response.data[key].result,
// unit: response.data[key].unit,
// refRange: response.data[key].refRnage,
// product: null,
// amount: 0,
// totalPrice: 0,
// }));
// // dispatch(addNotification("Order added", `Order ${formState.name.value} added by you`));
// dispatch(clearSelectedProduct());
// // dispatch(changeProductAmount(selectedProduct.id, formState.amount.value));
// }
// }
// });
dispatch(addNotification("Sent", `Prescription sent to nearest Lab`));
}
}
return (
<Fragment>
<div className="card shadow mb-4">
<div className="card-header py-3">
<h6 className="m-0 font-weight-bold text-green">Upload</h6>
</div>
<div className="card-body">
<form onSubmit={saveOrder}>
<div className="form-row">
<input type="file" onChange={(e) => handleFileSelect(e.target.files)}/>
<button onClick={Send}>Send</button>
{/* <div className="form-group col-md-12">
<TextInput id="input_name"
value={formState.name.value}
field="name"
onChange={hasFormValueChanged}
required={true}
maxLength={20}
label="Name"
placeholder="Name" />
</div>
<div className="form-group col-md-6">
<NumberInput id="input_amount"
value={formState.amount.value}
field="amount"
onChange={hasAmountChanged}
max={1000}
min={0}
label="Amount" />
</div>
<div className="form-group col-md-6">
<NumberInput id="input_totalPrice"
value={formState.totalPrice.value}
field="totalPrice"
onChange={hasFormValueChanged}
max={1000}
min={0}
label="Price" />
</div> */}
</div>
{/* <button className="btn btn-danger" onClick={() => resetForm()}>Reset</button> */}
{/* <button type="submit" className={`btn btn-success left-margin ${getDisabledClass()}`}>Create</button> */}
</form>
</div>
</div>
</Fragment>
);
};
export default OrderForm;
import React, { } from "react";
import { useSelector } from "react-redux";
import { IOrder } from "../../store/models/order.interface";
import { IStateType } from "../../store/models/root.interface";
const OrderList: React.FC = () => {
const orders: IOrder[] = useSelector((state: IStateType) => state.orders.orders);
const orderList: JSX.Element[] = orders.map(order => {
return (
<tr className={`table-row`}
key={`order_${order.id}`}>
<th scope="row">{order.id}</th>
<td>{order.name}</td>
<td>{order.result}</td>
<td>{order.unit}</td>
<td>{order.refRange}</td>
</tr>);
})
return (
<div className="table-responsive portlet">
<table className="table">
<thead className="thead-light">
<tr>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">Result</th>
<th scope="col">unit</th>
<th scope="col">Range</th>
</tr>
</thead>
<tbody>
{orderList}
</tbody>
</table>
</div>
)
}
export default OrderList;
\ No newline at end of file
import React, { Fragment, Dispatch } from "react";
import { useDispatch, useSelector } from "react-redux";
import { updateCurrentPath } from "../../store/actions/root.actions";
import { IOrder } from "../../store/models/order.interface";
import OrderList from "./OrderList";
import TopCard from "../../common/components/TopCard";
import OrderForm from "./OrderForm";
import ProductList from "../Products/ProductsList";
import { IProduct } from "../../store/models/product.interface";
import { changeSelectedProduct, clearSelectedProduct } from "../../store/actions/products.action";
import { IStateType } from "../../store/models/root.interface";
const Prescription: React.FC = () => {
const dispatch: Dispatch<any> = useDispatch();
const orders: IOrder[] = useSelector((state: IStateType) => state.orders.orders);
const totalSales: number = orders.reduce((prev, next) => prev + next.totalPrice, 0);
const totalAmount: number = orders.reduce((prev, next) => prev + next.amount, 0);
dispatch(updateCurrentPath("orders", "list"));
dispatch(clearSelectedProduct());
function selectProduct(product: IProduct): void {
dispatch(changeSelectedProduct(product));
}
return (
<Fragment>
<h1 className="h3 mb-2 text-gray-800">Prescription</h1>
<p className="mb-4">Prescription here</p>
{/* <div className="row">
<TopCard title="TOTAL SALES" text={totalSales.toString()} icon="donate" class="primary" />
<TopCard title="TOTAL AMOUNT" text={totalAmount.toString()} icon="calculator" class="danger" />
</div> */}
<div className="row">
<div className="col-md-6">
<OrderForm />
</div>
<div className="col-md-6">
</div>
</div>
{/* <div className="row">
<div className="col-xl-12 col-lg-12">
<div className="card shadow mb-4">
<div className="card-header py-3">
<h6 className="m-0 font-weight-bold text-green">Report Results</h6>
<div className="header-buttons">
</div>
</div>
<div className="card-body">
<OrderList />
</div>
</div>
</div>
</div> */}
</Fragment>
)
}
export default Prescription;
\ No newline at end of file
.header-buttons {
position: absolute;
right: 10px;
top: 8px;
}
.btn-green {
background-color: cadetblue !important;
border-color: cadetblue !important;
margin-right: 3px;
width: 40px;
}
.btn-blue {
background-color: lightblue !important;
border-color: lightblue !important;
margin-right: 3px;
width: 40px;
}
.btn-red {
background-color: indianred !important;
border-color: indianred !important;
margin-right: 3px;
width: 40px;
}
.table-row {
cursor: pointer;
}
.selected {
background-color:lavender;
}
\ No newline at end of file
import React, { Fragment, Dispatch, useState, useEffect } from "react";
import ProductList from "./ProductsList";
import ProductForm from "./ProductsForm";
import TopCard from "../../common/components/TopCard";
import "./Products.css";
import { useDispatch, useSelector } from "react-redux";
import { updateCurrentPath } from "../../store/actions/root.actions";
import { IProductState, IStateType, IRootPageStateType } from "../../store/models/root.interface";
import Popup from "reactjs-popup";
import { removeProduct, clearSelectedProduct, setModificationState,
changeSelectedProduct } from "../../store/actions/products.action";
import { addNotification } from "../../store/actions/notifications.action";
import { ProductModificationStatus, IProduct } from "../../store/models/product.interface";
const Products: React.FC = () => {
const dispatch: Dispatch<any> = useDispatch();
const products: IProductState = useSelector((state: IStateType) => state.products);
const path: IRootPageStateType = useSelector((state: IStateType) => state.root.page);
const numberItemsCount: number = products.products.length;
const totalPrice: number = products.products.reduce((prev, next) => prev + next.price, 0);
const totalAmount: number = products.products.reduce((prev, next) => prev + (next.amount || 0), 0);
const [popup, setPopup] = useState(false);
useEffect(() => {
dispatch(clearSelectedProduct());
dispatch(updateCurrentPath("products", "list"));
}, [path.area, dispatch]);
function onProductSelect(product: IProduct): void {
dispatch(changeSelectedProduct(product));
dispatch(setModificationState(ProductModificationStatus.None));
}
function onProductRemove() {
if(products.selectedProduct) {
setPopup(true);
}
}
return (
<Fragment>
<h1 className="h3 mb-2 text-gray-800">Doctor Profile Managment</h1>
<p className="mb-4">Profiles here</p>
<div className="row">
<TopCard title="DOCTORS COUNT" text={`${numberItemsCount}`} icon="box" class="primary" />
{/* <TopCard title="AMOUNT" text={`${totalAmount}`} icon="warehouse" class="danger" /> */}
<TopCard title="DOCTOR'S FEE" text={`$${totalPrice}`} icon="dollar-sign" class="success" />
</div>
<div className="row">
<div className="col-xl-12 col-lg-12">
<div className="card shadow mb-4">
<div className="card-header py-3">
<h6 className="m-0 font-weight-bold text-green">List of Doctors</h6>
<div className="header-buttons">
<button className="btn btn-success btn-green" onClick={() =>
dispatch(setModificationState(ProductModificationStatus.Create))}>
<i className="fas fa fa-plus"></i>
</button>
<button className="btn btn-success btn-blue" onClick={() =>
dispatch(setModificationState(ProductModificationStatus.Edit))}>
<i className="fas fa fa-pen"></i>
</button>
<button className="btn btn-success btn-red" onClick={() => onProductRemove()}>
<i className="fas fa fa-times"></i>
</button>
</div>
</div>
<div className="card-body">
<ProductList
onSelect={onProductSelect}
/>
</div>
</div>
</div>
{((products.modificationState === ProductModificationStatus.Create)
|| (products.modificationState === ProductModificationStatus.Edit && products.selectedProduct)) ?
<ProductForm /> : null}
</div>
<Popup
className="popup-modal"
open={popup}
onClose={() => setPopup(false)}
closeOnDocumentClick
>
<div className="popup-modal">
<div className="popup-title">
Are you sure?
</div>
<div className="popup-content">
<button type="button"
className="btn btn-danger"
onClick={() => {
if (!products.selectedProduct) {
return;
}
dispatch(addNotification("Product removed", `Product ${products.selectedProduct.name} was removed`));
dispatch(removeProduct(products.selectedProduct.id));
dispatch(clearSelectedProduct());
setPopup(false);
}}>Remove
</button>
</div>
</div>
</Popup>
</Fragment >
);
};
export default Products;
import React, { useState, FormEvent, Dispatch, Fragment } from "react";
import { IStateType, IProductState } from "../../store/models/root.interface";
import { useSelector, useDispatch } from "react-redux";
import { IProduct, ProductModificationStatus } from "../../store/models/product.interface";
import TextInput from "../../common/components/TextInput";
import { editProduct, clearSelectedProduct, setModificationState, addProduct, removeProduct } from "../../store/actions/products.action";
import { addNotification } from "../../store/actions/notifications.action";
import NumberInput from "../../common/components/NumberInput";
import Checkbox from "../../common/components/Checkbox";
import SelectInput from "../../common/components/Select";
import { OnChangeModel, IProductFormState } from "../../common/types/Form.types";
import axios from "axios";
const ProductForm: React.FC = () => {
const dispatch: Dispatch<any> = useDispatch();
const products: IProductState | null = useSelector((state: IStateType) => state.products);
let product: IProduct | null = products.selectedProduct;
const isCreate: boolean = (products.modificationState === ProductModificationStatus.Create);
if (!product || isCreate) {
product = { id: 0, name: "", qualification: "", experience: 0, rating: 0, place: "", profile: "", description: "", hasExpiryDate: false, price: 0, amount: 0, category: ""};
}
const [formState, setFormState] = useState({
name: { error: "", value: product.name },
qualification: { error: "", value: product.qualification},
experience: { error: "", value: product.experience},
rating: { error: "", value: product.rating},
place: { error: "", value: product.place},
profile: { error: "", value: product.profile},
description: { error: "", value: product.description},
amount: { error: "", value: product.amount},
price: { error: "", value: product.price},
hasExpiryDate: { error: "", value: product.hasExpiryDate},
category: { error: "", value: product.category},
});
const [resState, setresState] = useState(0);
function hasFormValueChanged(model: OnChangeModel): void {
setFormState({ ...formState, [model.field]: { error: model.error, value: model.value } });
}
function saveUser(e: FormEvent<HTMLFormElement>): void {
e.preventDefault();
if (isFormInvalid()) {
return;
}
let saveUserFn: Function = (isCreate) ? addProduct : editProduct;
saveForm(formState, saveUserFn);
}
function saveForm(formState: IProductFormState, saveFn: Function): void {
if (product) {
if(products != null){
products.products.map(product => {
dispatch(removeProduct(product.id))
});
}
// dispatch(saveFn({
// ...product,
// name: formState.name.value,
// qualification: formState.qualification.value,
// experience: formState.experience.value,
// rating: formState.rating.value,
// place: formState.place.value,
// profile: formState.profile.value,
// description: formState.description.value,
// }));
const article = { Name : formState.name.value,
Qualification: formState.qualification.value,
Experience: formState.experience.value + " years experience",
Rating: formState.rating.value + "%",
Place: formState.place.value,
Profile: formState.profile.value
};
axios.post('http://127.0.0.1:8000/staffapi/salary', article)
.then(response => {
console.log(response.data)
axios.get(`http://localhost:8000/staffapi/salary`)
.then(res => {
for (let i = 0; i < res.data.length; i++) {
product = {
id: res.data[i].id,
name: res.data[i].Name,
qualification: res.data[i].Qualification,
experience: res.data[i].Experience,
rating: res.data[i].Rating,
place: res.data[i].Place,
profile: res.data[i].Profile,
hasExpiryDate: false,
price: 0,
amount: 0,
category: "",
description: ""
};
if(i == res.data.length-1){
console.log(response.data)
product.price = response.data
}
dispatch(addProduct(product))
}
});
});
dispatch(addNotification("Product edited", `Product ${formState.name.value} edited by you`));
dispatch(clearSelectedProduct());
dispatch(setModificationState(ProductModificationStatus.None));
// if(products != null){
// products.products.map(product => {
// console.log(product)
// dispatch(removeProduct(product.id))
// });
// }
}
}
function cancelForm(): void {
dispatch(setModificationState(ProductModificationStatus.None));
}
function getDisabledClass(): string {
let isError: boolean = isFormInvalid();
return isError ? "disabled" : "";
}
function isFormInvalid(): boolean {
return (formState.qualification.error || formState.experience.error
|| formState.name.error || formState.rating.error || formState.place.error
|| formState.profile.error || !formState.name.value) as boolean;
}
return (
<Fragment>
<div className="col-xl-7 col-lg-7">
<div className="card shadow mb-4">
<div className="card-header py-3">
<h6 className="m-0 font-weight-bold text-green">Product {(isCreate ? "create" : "edit")}</h6>
</div>
<div className="card-body">
<form onSubmit={saveUser}>
<div className="form-row">
<div className="form-group col-md-12">
<TextInput id="input_email"
value={formState.name.value}
field="name"
onChange={hasFormValueChanged}
required={true}
maxLength={20}
label="Name"
placeholder="Name" />
</div>
</div>
<div className="form-row">
<div className="form-group col-md-3">
<SelectInput
id="input_qualification"
field="qualification"
label="Qualification"
options={["BAMS", "MBBS", "BDS", "AFIH"]}
required={true}
onChange={hasFormValueChanged}
value={formState.qualification.value}
/>
</div>
<div className="form-group col-md-3">
<SelectInput
id="input_profile"
field="profile"
label="Profile"
options={["Ayurveda", "Homeopath", "Dentist", "General Medicine"]}
required={true}
onChange={hasFormValueChanged}
value={formState.profile.value}
/>
</div>
</div>
<div className="form-row">
<div className="form-group col-md-3">
<NumberInput id="input_amount"
value={formState.experience.value}
field="experience"
onChange={hasFormValueChanged}
max={100}
min={0}
label="Experience" />
</div>
<div className="form-group col-md-3">
<NumberInput id="input_price"
value={formState.rating.value}
field="rating"
onChange={hasFormValueChanged}
max={100}
min={0}
label="Rating" />
</div>
</div>
<div className="form-row">
<div className="form-group col-md-3">
<SelectInput
id="input_place"
field="place"
label="Place"
options={["Whitefield, Bangalore", "Bannerghatta Road, Bangalore", "Keelkattalai, Chennai", "Porur, Chennai"]}
required={true}
onChange={hasFormValueChanged}
value={formState.place.value}
/>
</div>
</div>
<div className="form-row">
<div className="form-group col-md-3">
<TextInput id="input_description"
field = "description"
value={formState.description.value}
onChange={hasFormValueChanged}
required={false}
maxLength={100}
label="Description"
placeholder="Description" />
</div>
</div>
{/* <div className="form-group">
<Checkbox
id="checkbox_expiry"
field="hasExpiryDate"
value={formState.hasExpiryDate.value}
label="Has expiry date"
onChange={hasFormValueChanged}
/>
</div> */}
<button className="btn btn-danger" onClick={() => cancelForm()}>Cancel</button>
<button type="submit" className={`btn btn-success left-margin ${getDisabledClass()}`}>Save</button>
</form>
</div>
</div>
</div>
</Fragment>
);
};
export default ProductForm;
import React, { Dispatch, useEffect} from "react";
import { useSelector, useDispatch } from "react-redux";
import { IStateType, IProductState } from "../../store/models/root.interface";
import { IProduct } from "../../store/models/product.interface";
import { addProduct, removeProduct } from "../../store/actions/products.action";
import axios from "axios";
export type productListProps = {
onSelect?: (product: IProduct) => void;
children?: React.ReactNode;
};
function ProductList(props: productListProps): JSX.Element {
const dispatch: Dispatch<any> = useDispatch();
let product: IProduct
const products: IProductState = useSelector((state: IStateType) => state.products);
useEffect(() => {
// Update the document title using the browser API
if(products != null){
products.products.map(product => {
// console.log(product)
dispatch(removeProduct(product.id))
});
}
axios.get(`http://localhost:8000/staffapi/salary`)
.then(res => {
for (let i = 0; i < res.data.length; i++) {
product = {
id: res.data[i].id,
name: res.data[i].Name,
qualification: res.data[i].Qualification,
experience: res.data[i].Experience,
rating: res.data[i].Rating,
place: res.data[i].Place,
profile: res.data[i].Profile,
hasExpiryDate: false,
price: 0,
amount: 0,
category: "",
description: ""
};
dispatch(addProduct(product))
}
});
},[]);
// axios.get(`http://localhost:8000/staffapi/salary`)
// .then(res => {
// for (let i = 0; i < res.data.length; i++) {
// product = {
// id: res.data[i].id,
// name: res.data[i].Name,
// qualification: res.data[i].Qualification,
// experience: res.data[i].Experience,
// rating: res.data[i].Rating,
// place: res.data[i].Place,
// profile: res.data[i].Profile,
// hasExpiryDate: false,
// price: 0,
// amount: 0,
// category: "",
// description: ""
// };
// console.log(product)
// dispatch(addProduct(product))
// }
// });
const productElements: (JSX.Element | null)[] = products.products.map(product => {
if (!product) { return null; }
return (<tr className={`table-row ${(products.selectedProduct && products.selectedProduct.id === product.id) ? "selected" : ""}`}
onClick={() => {
if(props.onSelect) props.onSelect(product);
}}
key={`product_${product.id}`}>
<th scope="row">{product.id}</th>
<td>{product.name}</td>
<td>{product.qualification}</td>
<td>{product.experience}</td>
<td>{product.place}</td>
</tr>);
});
return (
<div className="table-responsive portlet">
<table className="table">
<thead className="thead-light">
<tr>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">Qualification</th>
<th scope="col">Experience</th>
<th scope="col">Place</th>
</tr>
</thead>
<tbody>
{productElements}
</tbody>
</table>
</div>
);
}
export default ProductList;
.white-breadcrumb {
background-color: white !important;
margin-top: 15px !important;
}
.portlet {
max-height: 350px;
}
\ No newline at end of file
import React from "react";
import TopMenuAccount from "./TopMenuAccount";
import "./TopMenu.css";
import { useSelector } from "react-redux";
import { IStateType, IRootPageStateType } from "../../store/models/root.interface";
const TopMenu: React.FC = () => {
const page: IRootPageStateType = useSelector((state: IStateType) => state.root.page);
return (
<nav className="navbar navbar-expand navbar-light bg-custom-dark topbar mb-4 static-top shadow">
{/* <ol className="breadcrumb dark-breadcrumb">
<li className="breadcrumb-item"><a href="# ">{page ? page.area : null}</a></li>
<li className="breadcrumb-item"><a href="# ">{page ? page.subArea : null}</a></li>
</ol> */}
<ul className="navbar-nav ml-auto">
<div className="topbar-divider d-none d-sm-block"></div>
<TopMenuAccount />
</ul>
</nav>
);
};
export default TopMenu;
import React, { useState, Dispatch } from "react";
import { useDispatch, useSelector } from "react-redux";
import { logout } from "../../store/actions/account.actions";
import { IStateType } from "../../store/models/root.interface";
function TopMenuAccount(): JSX.Element {
const dispatch: Dispatch<any> = useDispatch();
const email: string = useSelector((state: IStateType) => state.account.email);
const [isShow, setShow] = useState(false);
return (
<li className="nav-item dropdown no-arrow">
<a className="nav-link dropdown-toggle"
onClick={() => {
setShow(!isShow);
}}
href="# "
id="userDropdown"
role="button"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false">
<span className="mr-2 d-none d-lg-inline small cadet">{email}</span>
<img className="img-profile rounded-circle" alt=""
src="https://source.unsplash.com/QAB-WJcbgJk/60x60" />
</a>
<div className={`dropdown-menu dropdown-menu-right shadow animated--grow-in ${(isShow) ? "show" : ""}`}
aria-labelledby="userDropdown">
<a className="dropdown-item"
onClick={() => dispatch(logout())}
href="# "
data-toggle="modal"
data-target="#logoutModal">
<i className="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"></i>
Logout
</a>
</div>
</li>
);
};
export default TopMenuAccount;
import React, { Fragment, Dispatch } from "react";
import TopCard from "../../common/components/TopCard";
import { IUser } from "../../store/models/user.interface";
import { useDispatch, useSelector } from "react-redux";
import { IStateType } from "../../store/models/root.interface";
import { addAdmin, removeAdmin } from "../../store/actions/users.action";
import { updateCurrentPath } from "../../store/actions/root.actions";
const Users: React.FC = () => {
const dispatch: Dispatch<any> = useDispatch();
dispatch(updateCurrentPath("user", "list"));
const users: IUser[] = useSelector((state: IStateType) => state.users.users);
const admins: IUser[] = useSelector((state: IStateType) => state.users.admins);
function setUserAdmin(user: IUser): void {
dispatch(addAdmin(user));
}
function setUserNotAdmin(admin: IUser): void {
dispatch(removeAdmin(admin));
}
const userElements: JSX.Element[] = users.map(user => {
return (
<tr className={`table-row`}
key={`user_${user.id}`}>
<th scope="row">{user.id}</th>
<td>{user.firstName}</td>
<td>{user.lastName}</td>
<td>{user.email}</td>
<td><button className="btn btn-success" onClick={() => setUserAdmin(user)}>Set patient</button> </td>
</tr>);
});
const adminElements: JSX.Element[] = admins.map(admin => {
return (
<tr className={`table-row`}
key={`user_${admin.id}`}>
<th scope="row">{admin.id}</th>
<td>{admin.firstName}</td>
<td>{admin.lastName}</td>
<td>{admin.email}</td>
<td><button className="btn btn-danger" onClick={() => setUserNotAdmin(admin)}>Revert patient8</button> </td>
</tr>);
});
return (
<Fragment>
<h1 className="h3 mb-2 text-gray-800">Users</h1>
<p className="mb-4">Users here</p>
<div className="row">
<TopCard title="ADMINS" text={admins.length.toString()} icon="user-tie" class="primary" />
<TopCard title="USER" text={users.length.toString()} icon="user" class="danger" />
</div>
<div className="row">
<div className="col-xl-12 col-lg-12">
<div className="card shadow mb-4">
<div className="card-header py-3">
<h6 className="m-0 font-weight-bold text-green">Approve Patient List</h6>
<div className="header-buttons">
</div>
</div>
<div className="card-body">
<div className="table-responsive portlet">
<table className="table">
<thead className="thead-light">
<tr>
<th scope="col">#</th>
<th scope="col">First name</th>
<th scope="col">Last name</th>
<th scope="col">Email</th>
<th scope="col">Admin</th>
</tr>
</thead>
<tbody>
{adminElements}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div className="row">
<div className="col-xl-12 col-lg-12">
<div className="card shadow mb-4">
<div className="card-header py-3">
<h6 className="m-0 font-weight-bold text-green">Patient List</h6>
<div className="header-buttons">
</div>
</div>
<div className="card-body">
<div className="table-responsive portlet">
<table className="table">
<thead className="thead-light">
<tr>
<th scope="col">#</th>
<th scope="col">First name</th>
<th scope="col">Last name</th>
<th scope="col">Email</th>
<th scope="col">Admin</th>
</tr>
</thead>
<tbody>
{userElements}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</Fragment >
);
};
export default Users;
@import url('https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i');
body {
margin: 0;
font-family: Nunito, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: darkslategray !important;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
import * as serviceWorker from "./serviceWorker";
import "../node_modules/bootstrap/dist/css/bootstrap.min.css";
import "@fortawesome/fontawesome-free/css/all.min.css";
import {Provider} from "react-redux";
import store from "./store/store";
ReactDOM.render(<Provider store={store}><App /></Provider>, document.getElementById('root'));
// f you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 170.96 159.93"><defs><style>.cls-1{fill:#09d3ac;}</style></defs><path class="cls-1" d="M141.35,73.27c0-6.89-8.11-13-20.58-16.73,3-12.67,1.69-22.75-4.28-26.16a9.55,9.55,0,0,0-4.79-1.2c-5.57,0-12.61,3.89-19.72,10.62-7.11-6.68-14.13-10.55-19.69-10.55a9.46,9.46,0,0,0-4.86,1.22c-5.94,3.42-7.17,13.44-4.21,26.05-12.41,3.71-20.48,9.77-20.5,16.63s8.12,13,20.59,16.72c-3,12.68-1.7,22.75,4.28,26.16a9.41,9.41,0,0,0,4.78,1.2c5.58,0,12.62-3.89,19.73-10.62,7.1,6.68,14.12,10.55,19.69,10.55a9.59,9.59,0,0,0,4.86-1.22c5.94-3.42,7.16-13.44,4.21-26C133.27,86.18,141.34,80.12,141.35,73.27ZM96.56,42.06c8.19-7.33,13.31-8.12,15.13-8.12h0a4.71,4.71,0,0,1,2.42.58c2.86,1.63,4,7.38,3.09,15a56.73,56.73,0,0,1-1,5.79,97.7,97.7,0,0,0-12.58-2.07,98.47,98.47,0,0,0-8.24-10.08C95.75,42.79,96.15,42.42,96.56,42.06ZM71.77,78.94c.78,1.5,1.61,3,2.47,4.51S76,86.49,77,88c-2.71-.39-5.34-.88-7.84-1.46C69.86,84,70.75,81.5,71.77,78.94ZM69,59.9c2.53-.59,5.18-1.08,7.93-1.46-1,1.48-1.86,3-2.76,4.59s-1.69,3-2.46,4.52Q70.18,63.65,69,59.9Zm5.21,13.34q1.86-3.93,4.09-7.86c1.5-2.62,3.11-5.17,4.77-7.61,2.91-.22,5.91-.34,9-.33s6,.12,8.89.35c1.66,2.42,3.25,5,4.75,7.55s2.88,5.22,4.12,7.83c-1.23,2.62-2.6,5.25-4.08,7.85s-3.11,5.18-4.77,7.62c-2.91.23-5.91.34-9,.34s-6-.13-8.89-.36c-1.66-2.42-3.26-4.94-4.76-7.55S75.5,75.85,74.25,73.24Zm32.86-14.77c2.72.38,5.35.87,7.84,1.45-.74,2.47-1.62,5-2.64,7.55-.79-1.5-1.61-3-2.48-4.51S108,59.93,107.11,58.47Zm2.76,24.92q1.29-2.27,2.46-4.53c1,2.6,2,5.16,2.7,7.66-2.52.59-5.17,1.07-7.92,1.45Q108.52,85.75,109.87,83.39ZM92,46.56c1.8,1.92,3.57,4,5.3,6.23-1.71-.07-3.46-.12-5.23-.12s-3.58,0-5.33.12C88.45,50.57,90.2,48.48,92,46.56Zm-22.18-12A4.82,4.82,0,0,1,72.29,34a13.11,13.11,0,0,1,5.19,1.31,39.07,39.07,0,0,1,10,6.78l1.17,1.07a98.49,98.49,0,0,0-8.16,10,98.88,98.88,0,0,0-12.65,2.06c-.44-1.94-.8-3.84-1-5.67C65.8,42,67,36.24,69.81,34.6ZM64.53,85.26a58.75,58.75,0,0,1-5.54-2c-7.1-3-11.5-6.85-11.5-10.14S51.91,66,59,63.05a57.63,57.63,0,0,1,5.44-1.94A97.93,97.93,0,0,0,69,73.25,98.72,98.72,0,0,0,64.53,85.26Zm23,19.1c-8.19,7.33-13.31,8.11-15.14,8.11a4.69,4.69,0,0,1-2.42-.58c-2.86-1.63-4-7.38-3.09-15a56.07,56.07,0,0,1,1-5.78,99.51,99.51,0,0,0,12.58,2.06,97.17,97.17,0,0,0,8.24,10.08Zm4.57-4.51c-1.8-1.92-3.57-4-5.31-6.23,1.72.08,3.47.12,5.24.12s3.58,0,5.33-.11C95.63,95.85,93.87,97.93,92.09,99.85Zm22.18,12a4.82,4.82,0,0,1-2.48.59c-1.82,0-7-.8-15.16-8.1l-1.17-1.07a98.44,98.44,0,0,0,8.15-10,97,97,0,0,0,12.66-2.06c.44,1.94.79,3.84,1,5.67C118.27,104.42,117.12,110.18,114.27,111.81Zm10.8-28.44c-1.71.7-3.52,1.35-5.44,1.93a98.54,98.54,0,0,0-4.57-12.14,98.1,98.1,0,0,0,4.49-12,58.75,58.75,0,0,1,5.54,2c7.09,3,11.5,6.85,11.49,10.14S132.17,80.42,125.07,83.37ZM92,82.39a9.18,9.18,0,1,0-9.17-9.19A9.17,9.17,0,0,0,92,82.39ZM31,17.88V128.53H153.07V17.88ZM148.3,123.77H35.78V22.65H148.3Zm-85-33.9c-3,12.68-1.7,22.75,4.28,26.16a9.41,9.41,0,0,0,4.78,1.2c5.58,0,12.62-3.89,19.73-10.62,7.1,6.68,14.12,10.55,19.69,10.55a9.59,9.59,0,0,0,4.86-1.22c5.94-3.42,7.16-13.44,4.21-26,12.41-3.72,20.48-9.78,20.49-16.63s-8.11-13-20.58-16.73c3-12.67,1.69-22.75-4.28-26.16a9.55,9.55,0,0,0-4.79-1.2c-5.57,0-12.61,3.89-19.72,10.62-7.11-6.68-14.13-10.55-19.69-10.55a9.46,9.46,0,0,0-4.86,1.22c-5.94,3.42-7.17,13.44-4.21,26.05-12.41,3.71-20.48,9.77-20.5,16.63S50.84,86.13,63.31,89.87Zm24.21,14.49c-8.19,7.33-13.31,8.11-15.14,8.11a4.69,4.69,0,0,1-2.42-.58c-2.86-1.63-4-7.38-3.09-15a56.07,56.07,0,0,1,1-5.78,99.51,99.51,0,0,0,12.58,2.06,97.17,97.17,0,0,0,8.24,10.08Zm24.79-36.89c-.79-1.5-1.61-3-2.48-4.51s-1.8-3-2.72-4.49c2.72.38,5.35.87,7.84,1.45C114.21,62.39,113.33,64.92,112.31,67.47Zm2.72,19c-2.52.59-5.17,1.07-7.92,1.45q1.41-2.22,2.76-4.58t2.46-4.53C113.37,81.46,114.28,84,115,86.52Zm-5.21-13.35c-1.23,2.62-2.6,5.25-4.08,7.85s-3.11,5.18-4.77,7.62c-2.91.23-5.91.34-9,.34s-6-.13-8.89-.36c-1.66-2.42-3.26-4.94-4.76-7.55s-2.87-5.22-4.12-7.83q1.86-3.93,4.09-7.86c1.5-2.62,3.11-5.17,4.77-7.61,2.91-.22,5.91-.34,9-.33s6,.12,8.89.35c1.66,2.42,3.25,5,4.75,7.55S108.58,70.56,109.82,73.17ZM77,88c-2.71-.39-5.34-.88-7.84-1.46.74-2.46,1.63-5,2.65-7.55.78,1.5,1.61,3,2.47,4.51S76,86.49,77,88ZM74.21,63c-.87,1.5-1.69,3-2.46,4.52Q70.18,63.65,69,59.9c2.53-.59,5.18-1.08,7.93-1.46C76,59.92,75.11,61.45,74.21,63ZM92.09,99.85c-1.8-1.92-3.57-4-5.31-6.23,1.72.08,3.47.12,5.24.12s3.58,0,5.33-.11C95.63,95.85,93.87,97.93,92.09,99.85Zm22.18,12a4.82,4.82,0,0,1-2.48.59c-1.82,0-7-.8-15.16-8.1l-1.17-1.07a98.44,98.44,0,0,0,8.15-10,97,97,0,0,0,12.66-2.06c.44,1.94.79,3.84,1,5.67C118.27,104.42,117.12,110.18,114.27,111.81Zm5.28-50.66a58.75,58.75,0,0,1,5.54,2c7.09,3,11.5,6.85,11.49,10.14s-4.41,7.16-11.51,10.11c-1.71.7-3.52,1.35-5.44,1.93a98.54,98.54,0,0,0-4.57-12.14A98.1,98.1,0,0,0,119.55,61.15Zm-23-19.09c8.19-7.33,13.31-8.12,15.13-8.12h0a4.71,4.71,0,0,1,2.42.58c2.86,1.63,4,7.38,3.09,15a56.73,56.73,0,0,1-1,5.79,97.7,97.7,0,0,0-12.58-2.07,98.47,98.47,0,0,0-8.24-10.08C95.75,42.79,96.15,42.42,96.56,42.06ZM92,46.56c1.8,1.92,3.57,4,5.3,6.23-1.71-.07-3.46-.12-5.23-.12s-3.58,0-5.33.12C88.45,50.57,90.2,48.48,92,46.56Zm-22.18-12A4.82,4.82,0,0,1,72.29,34a13.11,13.11,0,0,1,5.19,1.31,39.07,39.07,0,0,1,10,6.78l1.17,1.07a98.49,98.49,0,0,0-8.16,10,98.88,98.88,0,0,0-12.65,2.06c-.44-1.94-.8-3.84-1-5.67C65.8,42,67,36.24,69.81,34.6ZM59,63.05a57.63,57.63,0,0,1,5.44-1.94A97.93,97.93,0,0,0,69,73.25a98.72,98.72,0,0,0-4.49,12,58.75,58.75,0,0,1-5.54-2c-7.1-3-11.5-6.85-11.5-10.14S51.91,66,59,63.05Zm33,1a9.18,9.18,0,1,0,9.17,9.19A9.17,9.17,0,0,0,92,64Zm0,0a9.18,9.18,0,1,0,9.17,9.19A9.17,9.17,0,0,0,92,64Zm0,0a9.18,9.18,0,1,0,9.17,9.19A9.17,9.17,0,0,0,92,64Zm49.35,9.24c0-6.89-8.11-13-20.58-16.73,3-12.67,1.69-22.75-4.28-26.16a9.55,9.55,0,0,0-4.79-1.2c-5.57,0-12.61,3.89-19.72,10.62-7.11-6.68-14.13-10.55-19.69-10.55a9.46,9.46,0,0,0-4.86,1.22c-5.94,3.42-7.17,13.44-4.21,26.05-12.41,3.71-20.48,9.77-20.5,16.63s8.12,13,20.59,16.72c-3,12.68-1.7,22.75,4.28,26.16a9.41,9.41,0,0,0,4.78,1.2c5.58,0,12.62-3.89,19.73-10.62,7.1,6.68,14.12,10.55,19.69,10.55a9.59,9.59,0,0,0,4.86-1.22c5.94-3.42,7.16-13.44,4.21-26C133.27,86.18,141.34,80.12,141.35,73.27ZM96.56,42.06c8.19-7.33,13.31-8.12,15.13-8.12h0a4.71,4.71,0,0,1,2.42.58c2.86,1.63,4,7.38,3.09,15a56.73,56.73,0,0,1-1,5.79,97.7,97.7,0,0,0-12.58-2.07,98.47,98.47,0,0,0-8.24-10.08C95.75,42.79,96.15,42.42,96.56,42.06ZM71.77,78.94c.78,1.5,1.61,3,2.47,4.51S76,86.49,77,88c-2.71-.39-5.34-.88-7.84-1.46C69.86,84,70.75,81.5,71.77,78.94ZM69,59.9c2.53-.59,5.18-1.08,7.93-1.46-1,1.48-1.86,3-2.76,4.59s-1.69,3-2.46,4.52Q70.18,63.65,69,59.9Zm5.21,13.34q1.86-3.93,4.09-7.86c1.5-2.62,3.11-5.17,4.77-7.61,2.91-.22,5.91-.34,9-.33s6,.12,8.89.35c1.66,2.42,3.25,5,4.75,7.55s2.88,5.22,4.12,7.83c-1.23,2.62-2.6,5.25-4.08,7.85s-3.11,5.18-4.77,7.62c-2.91.23-5.91.34-9,.34s-6-.13-8.89-.36c-1.66-2.42-3.26-4.94-4.76-7.55S75.5,75.85,74.25,73.24Zm32.86-14.77c2.72.38,5.35.87,7.84,1.45-.74,2.47-1.62,5-2.64,7.55-.79-1.5-1.61-3-2.48-4.51S108,59.93,107.11,58.47Zm2.76,24.92q1.29-2.27,2.46-4.53c1,2.6,2,5.16,2.7,7.66-2.52.59-5.17,1.07-7.92,1.45Q108.52,85.75,109.87,83.39ZM92,46.56c1.8,1.92,3.57,4,5.3,6.23-1.71-.07-3.46-.12-5.23-.12s-3.58,0-5.33.12C88.45,50.57,90.2,48.48,92,46.56Zm-22.18-12A4.82,4.82,0,0,1,72.29,34a13.11,13.11,0,0,1,5.19,1.31,39.07,39.07,0,0,1,10,6.78l1.17,1.07a98.49,98.49,0,0,0-8.16,10,98.88,98.88,0,0,0-12.65,2.06c-.44-1.94-.8-3.84-1-5.67C65.8,42,67,36.24,69.81,34.6ZM64.53,85.26a58.75,58.75,0,0,1-5.54-2c-7.1-3-11.5-6.85-11.5-10.14S51.91,66,59,63.05a57.63,57.63,0,0,1,5.44-1.94A97.93,97.93,0,0,0,69,73.25,98.72,98.72,0,0,0,64.53,85.26Zm23,19.1c-8.19,7.33-13.31,8.11-15.14,8.11a4.69,4.69,0,0,1-2.42-.58c-2.86-1.63-4-7.38-3.09-15a56.07,56.07,0,0,1,1-5.78,99.51,99.51,0,0,0,12.58,2.06,97.17,97.17,0,0,0,8.24,10.08Zm4.57-4.51c-1.8-1.92-3.57-4-5.31-6.23,1.72.08,3.47.12,5.24.12s3.58,0,5.33-.11C95.63,95.85,93.87,97.93,92.09,99.85Zm22.18,12a4.82,4.82,0,0,1-2.48.59c-1.82,0-7-.8-15.16-8.1l-1.17-1.07a98.44,98.44,0,0,0,8.15-10,97,97,0,0,0,12.66-2.06c.44,1.94.79,3.84,1,5.67C118.27,104.42,117.12,110.18,114.27,111.81Zm10.8-28.44c-1.71.7-3.52,1.35-5.44,1.93a98.54,98.54,0,0,0-4.57-12.14,98.1,98.1,0,0,0,4.49-12,58.75,58.75,0,0,1,5.54,2c7.09,3,11.5,6.85,11.49,10.14S132.17,80.42,125.07,83.37ZM92,82.39a9.18,9.18,0,1,0-9.17-9.19A9.17,9.17,0,0,0,92,82.39Zm-69.32,54.5V26.2L17.89,31V141.66H139.94l4.78-4.77Z"/></svg>
\ No newline at end of file
/// <reference types="react-scripts" />
// This optional code is used to register a service worker.
// register() is not called by default.
// This lets the app load faster on subsequent visits in production, and gives
// it offline capabilities. However, it also means that developers (and users)
// will only see deployed updates on subsequent visits to a page, after all the
// existing tabs open on the page have been closed, since previously cached
// resources are updated in the background.
// To learn more about the benefits of this model and instructions on how to
// opt-in, read https://bit.ly/CRA-PWA
const isLocalhost = Boolean(
window.location.hostname === 'localhost' ||
// [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' ||
// 127.0.0.1/8 is considered localhost for IPv4.
window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
)
);
type Config = {
onSuccess?: (registration: ServiceWorkerRegistration) => void;
onUpdate?: (registration: ServiceWorkerRegistration) => void;
};
export function register(config?: Config) {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(
(process as { env: { [key: string]: string } }).env.PUBLIC_URL,
window.location.href
);
if (publicUrl.origin !== window.location.origin) {
// Our service worker won't work if PUBLIC_URL is on a different origin
// from what our page is served on. This might happen if a CDN is used to
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
return;
}
window.addEventListener('load', () => {
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
if (isLocalhost) {
// This is running on localhost. Let's check if a service worker still exists or not.
checkValidServiceWorker(swUrl, config);
// Add some additional logging to localhost, pointing developers to the
// service worker/PWA documentation.
navigator.serviceWorker.ready.then(() => {
console.log(
'This web app is being served cache-first by a service ' +
'worker. To learn more, visit https://bit.ly/CRA-PWA'
);
});
} else {
// Is not localhost. Just register service worker
registerValidSW(swUrl, config);
}
});
}
}
function registerValidSW(swUrl: string, config?: Config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
registration.onupdatefound = () => {
const installingWorker = registration.installing;
if (installingWorker == null) {
return;
}
installingWorker.onstatechange = () => {
if (installingWorker.state === 'installed') {
if (navigator.serviceWorker.controller) {
// At this point, the updated precached content has been fetched,
// but the previous service worker will still serve the older
// content until all client tabs are closed.
console.log(
'New content is available and will be used when all ' +
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
);
// Execute callback
if (config && config.onUpdate) {
config.onUpdate(registration);
}
} else {
// At this point, everything has been precached.
// It's the perfect time to display a
// "Content is cached for offline use." message.
console.log('Content is cached for offline use.');
// Execute callback
if (config && config.onSuccess) {
config.onSuccess(registration);
}
}
}
};
};
})
.catch(error => {
console.error('Error during service worker registration:', error);
});
}
function checkValidServiceWorker(swUrl: string, config?: Config) {
// Check if the service worker can be found. If it can't reload the page.
fetch(swUrl)
.then(response => {
// Ensure service worker exists, and that we really are getting a JS file.
const contentType = response.headers.get('content-type');
if (
response.status === 404 ||
(contentType != null && contentType.indexOf('javascript') === -1)
) {
// No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then(registration => {
registration.unregister().then(() => {
window.location.reload();
});
});
} else {
// Service worker found. Proceed as normal.
registerValidSW(swUrl, config);
}
})
.catch(() => {
console.log(
'No internet connection found. App is running in offline mode.'
);
});
}
export function unregister() {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then(registration => {
registration.unregister();
});
}
}
export const LOG_IN: string = "LOG_IN";
export const LOG_OUT: string = "LOG_OUT";
export function login(email: string): ILogInActionType {
return { type: LOG_IN, email: email };
}
export function logout(): ILogOutActionType {
return { type: LOG_OUT};
}
interface ILogInActionType { type: string, email: string };
interface ILogOutActionType { type: string };
export const ADD_NOTIFICATION: string = "ADD_NOTIFICATION";
export const REMOVE_NOTIFICATION: string = "REMOVE_NOTIFICATION";
export function addNotification(title: string, text: string): IAddNotificationActionType {
return { type: ADD_NOTIFICATION, text: text, title: title };
}
export function removeNotification(id: number): IRemoveNotificationActionType {
return { type: REMOVE_NOTIFICATION, id: id };
}
interface IAddNotificationActionType { type: string, text: string, title: string };
interface IRemoveNotificationActionType { type: string, id: number };
import { IOrder } from "../models/order.interface";
export const ADD_ORDER: string = "ADD_ORDER";
export function addOrder(order: IOrder): IAddOrderActionType {
return { type: ADD_ORDER, order: order };
}
interface IAddOrderActionType { type: string, order: IOrder };
import { IProduct, ProductModificationStatus } from "../models/product.interface";
export const ADD_PRODUCT: string = "ADD_PRODUCT";
export const EDIT_PRODUCT: string = "EDIT_PRODUCT";
export const REMOVE_PRODUCT: string = "REMOVE_PRODUCT";
export const CHANGE_PRODUCT_AMOUNT: string = "CHANGE_PRODUCT_AMOUNT";
export const CHANGE_PRODUCT_PENDING_EDIT: string = "CHANGE_PRODUCT_PENDING_EDIT";
export const CLEAR_PRODUCT_PENDING_EDIT: string = "CLEAR_PRODUCT_PENDING_EDIT";
export const SET_MODIFICATION_STATE: string = "SET_MODIFICATION_STATE";
export function addProduct(product: IProduct): IAddProductActionType {
return { type: ADD_PRODUCT, product: product };
}
export function editProduct(product: IProduct): IEditProductActionType {
return { type: EDIT_PRODUCT, product: product };
}
export function removeProduct(id: number): IRemoveProductActionType {
return { type: REMOVE_PRODUCT, id: id };
}
export function changeProductAmount(id: number, amount: number): IChangeProductAmountType {
return { type: CHANGE_PRODUCT_AMOUNT, id: id, amount: amount };
}
export function changeSelectedProduct(product: IProduct): IChangeSelectedProductActionType {
return { type: CHANGE_PRODUCT_PENDING_EDIT, product: product };
}
export function clearSelectedProduct(): IClearSelectedProductActionType {
return { type: CLEAR_PRODUCT_PENDING_EDIT };
}
export function setModificationState(value: ProductModificationStatus): ISetModificationStateActionType {
return { type: SET_MODIFICATION_STATE, value: value };
}
interface IAddProductActionType { type: string, product: IProduct };
interface IEditProductActionType { type: string, product: IProduct };
interface IRemoveProductActionType { type: string, id: number };
interface IChangeSelectedProductActionType { type: string, product: IProduct };
interface IClearSelectedProductActionType { type: string };
interface ISetModificationStateActionType { type: string, value: ProductModificationStatus};
interface IChangeProductAmountType {type: string, id: number, amount: number};
\ No newline at end of file
export const UPDATE_CURRENT_PATH: string = "UPDATE_CURRENT_PATH";
export function updateCurrentPath(area: string, subArea: string): IUpdateCurrentPathActionType {
return { type: UPDATE_CURRENT_PATH, area: area, subArea: subArea };
}
interface IUpdateCurrentPathActionType { type: string, area: string, subArea: string };
\ No newline at end of file
import { IUser } from "../models/user.interface";
export const ADD_ADMIN: string = "ADD_ADMIN";
export const REMOVE_ADMIN: string = "REMOVE_ADMIN";
export function addAdmin(user: IUser): IAddAdminActionType {
return { type: ADD_ADMIN, user: user };
}
export function removeAdmin(user: IUser): IRemoveAdminActionType {
return { type: REMOVE_ADMIN, user: user };
}
interface IAddAdminActionType { type: string, user: IUser };
interface IRemoveAdminActionType { type: string, user: IUser };
export interface IAccount {
email: string;
}
\ No newline at end of file
export interface INotification {
id: number,
date: Date,
title: string,
text: string
}
\ No newline at end of file
import { IProduct } from "./product.interface";
export interface IOrder {
id: number;
name: string;
result: number;
unit: string;
refRange: string;
product: IProduct | null;
amount: number;
totalPrice: number;
}
\ No newline at end of file
export interface IProduct {
id: number;
name: string;
qualification: string;
experience: number;
rating: number;
place: string;
profile: string
description: string;
hasExpiryDate: boolean;
price: number;
amount: number;
category: string;
}
export enum ProductModificationStatus {
None = 0,
Create = 1,
Edit = 2
}
\ No newline at end of file
import { IProduct, ProductModificationStatus } from "./product.interface";
import { INotification } from "./notification.interface";
import { IUser } from "./user.interface";
import { IOrder } from "./order.interface";
import { IAccount } from "./account.interface";
export interface IRootPageStateType {
area: string;
subArea: string;
}
export interface IRootStateType {
page: IRootPageStateType;
}
export interface IStateType {
root: IRootStateType;
products: IProductState;
notifications: INotificationState;
users: IUserState;
orders: IOrdersState;
account: IAccount;
}
export interface IProductState {
products: IProduct[];
selectedProduct: IProduct | null;
modificationState: ProductModificationStatus;
}
export interface IActionBase {
type: string;
[prop: string]: any;
}
export interface IOrdersState {
orders: IOrder[];
}
export interface INotificationState {
notifications: INotification[];
}
export interface IUserState {
users: IUser[];
admins: IUser[];
}
\ No newline at end of file
export interface IUser {
id: number;
firstName: string;
lastName: string;
email: string;
}
\ No newline at end of file
import { IActionBase } from "../models/root.interface";
import { IAccount } from "../models/account.interface";
import { LOG_IN, LOG_OUT } from "../actions/account.actions";
const initialState: IAccount = {
email: "admin@react-template.pl"
};
function accountReducer(state: IAccount = initialState, action: IActionBase): IAccount {
switch (action.type) {
case LOG_IN: {
return { ...state, email: (action.email)};
}
case LOG_OUT: {
return { ...state, email: ""};
}
default:
return state;
}
}
export default accountReducer;
\ No newline at end of file
import { IActionBase, INotificationState } from "../models/root.interface";
import { ADD_NOTIFICATION, REMOVE_NOTIFICATION } from "../actions/notifications.action";
const initialState: INotificationState = {
notifications: [{id: 1, date: new Date(), text: "Hello new user", title: "Welcome"}]
};
function notificationReducer(state: INotificationState = initialState, action: IActionBase): INotificationState {
switch (action.type) {
case ADD_NOTIFICATION: {
let maxId: number= Math.max.apply(Math, state.notifications.map(o => o.id));
if(maxId === -Infinity) { maxId = 0; }
let newItem = {
id: maxId + 1,
date: new Date(),
title: action.title,
text: action.text
};
return {...state, notifications: [...state.notifications, newItem]};
}
case REMOVE_NOTIFICATION: {
return {...state, notifications: state.notifications
.filter(Notification => Notification.id !== action.id)};
}
default:
return state;
}
}
export default notificationReducer;
\ No newline at end of file
import { IOrdersState, IActionBase } from "../models/root.interface";
import { ADD_ORDER } from "../actions/orders.actions";
const initialState: IOrdersState = {
orders: [
// {
// id: 1,
// name: "Apple order",
// amount: 12,
// totalPrice: 100,
// product: {
// id: 2, name: "Apple", description: "This is Apple and it is healthy",
// amount: 5, price: 2, hasExpiryDate: true, category: "Fruit"
// },
// },
// {
// id: 2,
// name: "Straw order",
// amount: 7,
// totalPrice: 7,
// product: {
// id: 3, name: "Straw", description: "This is Straw and you can use it for your drink",
// amount: 100, price: 1, hasExpiryDate: false, category: "Kitchen"
// },
// }
]
};
function orderReducer(state: IOrdersState = initialState, action: IActionBase): IOrdersState {
switch (action.type) {
case ADD_ORDER: {
let maxId: number = Math.max.apply(Math, state.orders.map((o) => { return o.id; }));
if(maxId === -Infinity) { maxId = 0; }
return {...state, orders: [...state.orders, {...action.order, id: maxId + 1}]};
}
default:
return state;
}
}
export default orderReducer;
\ No newline at end of file
import { IProductState, IActionBase } from "../models/root.interface";
import { ADD_PRODUCT, CHANGE_PRODUCT_PENDING_EDIT, EDIT_PRODUCT, REMOVE_PRODUCT,
CLEAR_PRODUCT_PENDING_EDIT, SET_MODIFICATION_STATE, CHANGE_PRODUCT_AMOUNT} from "../actions/products.action";
import { IProduct, ProductModificationStatus } from "../models/product.interface";
const initialState: IProductState = {
modificationState: ProductModificationStatus.None,
selectedProduct: null,
products: [
// {
// id: 1, name: "Chocolate", description: "This is Chocolate and it is Sweet",
// amount: 10, price: 4, hasExpiryDate: true, category: "Sweet"
// },
// {
// id: 2, name: "Apple", description: "This is Apple and it is healthy",
// amount: 5, price: 2, hasExpiryDate: true, category: "Fruit"
// },
// {
// id: 3, name: "Straw", description: "This is Straw and you can use it for your drink",
// amount: 100, price: 1, hasExpiryDate: false, category: "Kitchen"
// },
// {
// id: 4, name: "Spoon", description: "This is Spoon and it is useful while eating",
// amount: 3, price: 2, hasExpiryDate: false, category: "Kitchen"
// },
// {
// id: 5, name: "Sugar", description: "This is Sugar and it is to make your life sweet",
// amount: 15, price: 5, hasExpiryDate: true, category: "Sweet"
// }
]
};
function productsReducer(state: IProductState = initialState, action: IActionBase): IProductState {
switch (action.type) {
case ADD_PRODUCT: {
let maxId: number = state.products.length //Math.max.apply(Math, state.products.map(function(o) { return o.id; }));
action.product.id = state.products.length+1;
return { ...state, products: [...state.products, action.product]};
}
case EDIT_PRODUCT: {
const foundIndex: number = state.products.findIndex(pr => pr.id === action.product.id);
let products: IProduct[] = state.products;
products[foundIndex] = action.product;
return { ...state, products: products };
}
case REMOVE_PRODUCT: {
return { ...state, products: state.products.filter(pr => pr.id !== action.id) };
}
case CHANGE_PRODUCT_PENDING_EDIT: {
return { ...state, selectedProduct: action.product };
}
case CLEAR_PRODUCT_PENDING_EDIT: {
return { ...state, selectedProduct: null };
}
case SET_MODIFICATION_STATE: {
return { ...state, modificationState: action.value };
}
case CHANGE_PRODUCT_AMOUNT: {
const foundIndex: number = state.products.findIndex(pr => pr.id === action.id);
let products: IProduct[] = state.products;
products[foundIndex].amount = products[foundIndex].amount - action.amount;
return { ...state, products: products };
}
default:
return state;
}
}
export default productsReducer;
\ No newline at end of file
import { combineReducers, Reducer } from "redux";
import { UPDATE_CURRENT_PATH } from "../actions/root.actions";
import { IRootStateType, IActionBase, IStateType } from "../models/root.interface";
import productsReducer from "./products.reducer";
import notificationReducer from "./notification.reducer";
import userReducer from "./users.reducer";
import orderReducer from "./order.reducer";
import accountReducer from "./account.reducer";
const initialState: IRootStateType = {
page: {area: "home", subArea: ""}
};
function rootReducer(state: IRootStateType = initialState, action: IActionBase): IRootStateType {
switch (action.type) {
case UPDATE_CURRENT_PATH:
return { ...state, page: {area: action.area, subArea: action.subArea}};
default:
return state;
}
}
const rootReducers: Reducer<IStateType> = combineReducers({root: rootReducer,
products: productsReducer,
notifications: notificationReducer,
users: userReducer,
orders: orderReducer,
account: accountReducer
});
export default rootReducers;
\ No newline at end of file
import { IUserState, IActionBase } from "../models/root.interface";
import { ADD_ADMIN, REMOVE_ADMIN } from "../actions/users.action";
const initialState: IUserState = {
users: [
{ id: 1, firstName: "John", lastName: "Smith", email: "jsmith@em.pl", },
{ id: 2, firstName: "Jannice", lastName: "Bing", email: "ohmy@fr.pl" }
],
admins: [
{ id: 3, firstName: "Jannet", lastName: "Crock", email: "jcrock@em.pl" },
]
};
function userReducer(state: IUserState = initialState, action: IActionBase): IUserState {
switch (action.type) {
case ADD_ADMIN: {
return { ...state, users: state.users.filter(x=>x.id !== action.user.id), admins: [...state.admins, action.user]};
}
case REMOVE_ADMIN: {
return { ...state, admins: state.admins.filter(x=>x.id !== action.user.id), users: [...state.users, action.user]};
}
default:
return state;
}
}
export default userReducer;
\ No newline at end of file
import { createStore, applyMiddleware, Store } from "redux";
import thunkMiddleware from "redux-thunk";
import rootReducers from "./reducers/root.reducer";
const store: Store = createStore(rootReducers, applyMiddleware(
thunkMiddleware
));
store.subscribe(() => {});
export default store;
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react"
},
"include": [
"src"
]
}
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment