Merge remote-tracking branch 'origin/master' into dev_sultan
# Conflicts: # lib/presentation/home/landing_page.dartpull/11/head
|
After Width: | Height: | Size: 6.4 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 16 KiB |
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1124.14 1256.39">
|
||||
<defs>
|
||||
<style>
|
||||
.cls-1 {
|
||||
fill: #231f20;
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<path class="cls-1" d="M699.62,1113.02h0c-20.06,44.48-33.32,92.75-38.4,143.37l424.51-90.24c20.06-44.47,33.31-92.75,38.4-143.37l-424.51,90.24Z"/>
|
||||
<path class="cls-1" d="M1085.73,895.8c20.06-44.47,33.32-92.75,38.4-143.37l-330.68,70.33v-135.2l292.27-62.11c20.06-44.47,33.32-92.75,38.4-143.37l-330.68,70.27V66.13c-50.67,28.45-95.67,66.32-132.25,110.99v403.35l-132.25,28.11V0c-50.67,28.44-95.67,66.32-132.25,110.99v525.69l-295.91,62.88c-20.06,44.47-33.33,92.75-38.42,143.37l334.33-71.05v170.26l-358.3,76.14c-20.06,44.47-33.32,92.75-38.4,143.37l375.04-79.7c30.53-6.35,56.77-24.4,73.83-49.24l68.78-101.97v-.02c7.14-10.55,11.3-23.27,11.3-36.97v-149.98l132.25-28.11v270.4l424.53-90.28Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 923 B |
@ -0,0 +1,3 @@
|
||||
<svg width="12" height="14" viewBox="0 0 12 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M4.29538 1.40028C5.26048 0.48376 6.73969 0.48376 7.70478 1.40028C8.45145 2.10937 9.36634 3.0868 10.0972 4.20796C10.8249 5.32409 11.3959 6.62189 11.3959 7.96258C11.3959 10.5688 9.34991 13.2546 6.00008 13.2546C2.65026 13.2546 0.604248 10.5688 0.604248 7.96258C0.604248 6.62189 1.17529 5.32408 1.90291 4.20796C2.63382 3.0868 3.54872 2.10937 4.29538 1.40028Z" fill="#ED1C2B"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 489 B |
@ -0,0 +1,3 @@
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.729248 7.01497C0.729248 10.4782 3.53683 13.2858 7.00008 13.2858C10.4633 13.2858 13.2709 10.4782 13.2709 7.01497C13.2709 3.55172 10.4633 0.744141 7.00008 0.744141C3.53683 0.744141 0.729248 3.55172 0.729248 7.01497ZM9.72775 4.83505C9.96517 5.05263 9.98092 5.42188 9.76334 5.65929L6.555 9.15929C6.44767 9.27654 6.29658 9.34481 6.13791 9.34831C5.97866 9.35181 5.82524 9.28999 5.71266 9.17741L4.25433 7.71908C4.02624 7.49158 4.02624 7.12171 4.25433 6.89421C4.48183 6.66612 4.85167 6.66612 5.07917 6.89421L6.10699 7.92148L8.90349 4.87065C9.12107 4.63324 9.49033 4.61747 9.72775 4.83505Z" fill="#18C273"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 758 B |
@ -0,0 +1,4 @@
|
||||
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="40" height="40" rx="10" fill="#EFEFF0"/>
|
||||
<path d="M13.7111 11.5912C14.306 11.0863 15.1364 10.9755 15.8433 11.3376C16.1565 11.4981 16.3759 11.7476 16.5314 11.9451C16.6881 12.144 16.8637 12.403 17.0592 12.6911L17.0778 12.7186C17.3879 13.1757 17.2687 13.7975 16.8116 14.1076C16.3546 14.4176 15.7327 14.2984 15.4227 13.8414C15.2131 13.5324 15.0804 13.3377 14.9758 13.2025L14.9731 13.208C14.8944 13.3687 14.8007 13.5974 14.6506 13.9663L11.6352 21.375H15.5253C15.9697 21.375 16.3408 21.375 16.6454 21.3958C16.9625 21.4174 17.262 21.464 17.5524 21.5843C17.9648 21.7552 18.3254 22.022 18.6071 22.3579C18.9902 22.0555 19.474 21.875 20 21.875C20.526 21.875 21.0098 22.0555 21.3929 22.3579C21.6746 22.022 22.0352 21.7552 22.4476 21.5843C22.738 21.464 23.0375 21.4174 23.3546 21.3958C23.6592 21.375 24.0303 21.375 24.4747 21.375L28.3651 21.375L25.3498 13.9663C25.1996 13.5974 25.106 13.3687 25.0273 13.208L25.0246 13.2025C24.92 13.3377 24.7872 13.5324 24.5777 13.8414C24.2676 14.2984 23.6458 14.4176 23.1887 14.1076C22.7317 13.7975 22.6125 13.1757 22.9225 12.7186L22.9412 12.6911C23.1366 12.403 23.3123 12.144 23.4689 11.9451C23.6245 11.7476 23.8439 11.4981 24.1571 11.3376C24.8639 10.9755 25.6943 11.0863 26.2893 11.5912C26.5522 11.8143 26.712 12.1003 26.8239 12.3291C26.9364 12.5591 27.0558 12.8527 27.19 13.1823L30.6763 21.7481C30.8452 22.1631 30.7153 22.6253 30.3872 22.8962L30.2042 23.1708C29.9446 23.5602 29.8788 23.666 29.8365 23.7736C29.8121 23.8359 29.7926 23.9 29.7785 23.9654C29.7539 24.0784 29.75 24.2028 29.75 24.6708V24.708C29.75 25.3568 29.75 25.8982 29.7067 26.3372C29.6614 26.7964 29.563 27.2234 29.3137 27.6114C29.1004 27.9433 28.8183 28.2254 28.4864 28.4387C28.0984 28.688 27.6714 28.7864 27.2122 28.8317C26.7732 28.875 26.2318 28.875 25.583 28.875L24.4747 28.875C24.0303 28.875 23.6592 28.875 23.3546 28.8542C23.0375 28.8326 22.738 28.786 22.4476 28.6657C21.7738 28.3866 21.2384 27.8512 20.9593 27.1774C20.839 26.887 20.7924 26.5875 20.7708 26.2704C20.75 25.9658 20.75 25.5947 20.75 25.1503V25.0997C20.75 24.7237 20.75 24.4002 20.7626 24.125H20.75C20.75 23.7108 20.4142 23.375 20 23.375C19.5858 23.375 19.25 23.7108 19.25 24.125H19.2374C19.25 24.4002 19.25 24.7237 19.25 25.0997V25.1503C19.25 25.5947 19.25 25.9658 19.2292 26.2704C19.2076 26.5875 19.161 26.887 19.0407 27.1774C18.7616 27.8512 18.2262 28.3866 17.5524 28.6657C17.262 28.786 16.9625 28.8326 16.6454 28.8542C16.3408 28.875 15.9697 28.875 15.5253 28.875L14.417 28.875C13.7682 28.875 13.2268 28.875 12.7878 28.8317C12.3286 28.7864 11.9016 28.688 11.5136 28.4387C11.1817 28.2254 10.8996 27.9433 10.6863 27.6114C10.437 27.2234 10.3386 26.7964 10.2933 26.3372C10.25 25.8982 10.25 25.3568 10.25 24.708L10.25 24.6708C10.25 24.2028 10.2461 24.0784 10.2216 23.9654C10.2074 23.9 10.1879 23.8359 10.1635 23.7736C10.1212 23.666 10.0554 23.5602 9.79584 23.1708L9.61231 22.8955C9.38239 22.7053 9.25004 22.4209 9.25 22.1249C9.24998 21.9993 9.27378 21.8716 9.32404 21.7481L12.8103 13.1824C12.9445 12.8527 13.064 12.5591 13.1765 12.3291C13.2884 12.1003 13.4481 11.8143 13.7111 11.5912Z" fill="#8F9AA3"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.1 KiB |
@ -0,0 +1,3 @@
|
||||
<svg width="14" height="12" viewBox="0 0 14 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M4.13162 0.328148C4.73211 0.327882 5.14726 0.327698 5.51993 0.467448C6.33395 0.772701 6.69117 1.49554 6.96651 2.05271C7.04898 2.21764 7.19894 2.51724 7.24086 2.58312C7.25372 2.60466 7.29431 2.64877 7.35382 2.65293C7.43149 2.66097 7.53673 2.6615 7.72112 2.6615L9.79452 2.6615C10.3889 2.6615 10.8683 2.66149 11.2529 2.70062C11.6499 2.741 11.9942 2.82666 12.2987 3.03017C12.5376 3.18976 12.7427 3.39484 12.9023 3.63369C13.1058 3.93826 13.1914 4.28254 13.2318 4.67954C13.2709 5.06414 13.2709 5.59173 13.2709 6.18616V6.1862C13.2709 7.18938 13.2709 7.97578 13.2072 8.60193C13.1423 9.24053 13.0074 9.76079 12.7056 10.2125C12.4609 10.5787 12.1465 10.8932 11.7802 11.1379C11.3285 11.4397 10.8083 11.5745 10.1697 11.6395C9.54353 11.7032 8.75712 11.7032 7.75394 11.7032H7.7539H6.96661C5.62005 11.7032 4.56478 11.7032 3.74141 11.5925C2.89865 11.4792 2.23363 11.2427 1.71166 10.7208C1.18969 10.1988 0.95324 9.53377 0.839934 8.69101C0.729235 7.86764 0.729241 6.81237 0.729248 5.46581V5.46581L0.729248 3.62955V3.62955C0.729243 3.11695 0.729239 2.70353 0.75867 2.36966C0.788994 2.02565 0.853138 1.7246 1.00656 1.44968C1.20424 1.09545 1.49653 0.803165 1.85075 0.605486C2.12568 0.452061 2.42672 0.387917 2.77074 0.357593C3.10461 0.328162 3.61902 0.328143 4.13162 0.328148Z" fill="#2E3039"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
@ -0,0 +1,3 @@
|
||||
<svg width="180" height="178" viewBox="0 0 180 178" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path opacity="0.04" d="M38.4774 98.2239C38.4774 98.2239 45.8946 101.364 51.112 103.616L90.5471 120.856C95.2716 122.895 101.294 119.726 104.542 112.799L118.4 80.81C121.345 73.986 126.797 70.0037 131.807 71.8047L143.968 76.94C148.727 79.339 149.754 86.1791 146.821 92.9753L132.896 125.148C130.072 132.254 131.393 138.261 136.134 140.308L189.274 163.412L206.45 123.888C209.387 117.084 208.294 110.34 203.515 107.926L182.197 98.5995C177.473 96.5603 175.841 90.118 178.665 82.9984L183.199 72.263C186.464 65.3477 192.283 62.1336 197.02 64.1781L218.478 73.5107C223.49 75.3125 229.087 71.0973 232.018 64.3051L253.379 14.9559C253.379 14.9559 243.78 21.9979 232.614 17.8279L196.493 2.20009C191.785 0.168026 185.693 3.44396 182.452 10.365L168.766 42.0738C165.52 48.9853 159.683 52.3457 154.951 50.303L144.054 45.5029C139.313 43.4567 137.591 37.0251 140.392 29.9475L154.258 -2.09937C157.083 -9.20921 155.36 -15.5607 150.63 -17.6025L98.1839 -40.2105L81.1523 -0.789779C78.2129 6.02033 79.1446 12.8949 83.8997 15.3205L105.424 24.5066C110.15 26.9129 111.169 34.0162 108.245 40.7904L104.239 49.89C101.302 56.6961 95.6285 60.7106 90.6139 58.9147L69.1144 49.5762C64.0802 47.786 58.4703 51.7616 55.5387 58.5538L38.4774 98.2239ZM284.355 25.0281L213.173 189.948C208.108 200.955 194.658 205.369 182.696 200.456L14.7741 127.978C9.15358 125.627 4.63848 121.248 2.18363 115.767C-0.271212 110.286 -0.473314 104.134 1.62003 98.6103L72.9514 -66.6163C75.5422 -71.9323 80.1625 -76.0099 85.8393 -77.9904C91.5162 -79.971 97.8066 -79.7001 103.386 -77.2346L271.122 -4.75463C276.772 -2.3133 281.296 2.13931 283.759 7.68255C286.222 13.2258 286.435 19.4357 284.355 25.0281Z" fill="#EC1C2B"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
@ -0,0 +1,3 @@
|
||||
<svg width="12" height="14" viewBox="0 0 12 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.99944 0.712891C5.0187 0.712891 4.22138 1.04419 3.52597 1.40446C3.31583 1.51333 3.12062 1.62101 2.93408 1.72392C2.47765 1.9757 2.07309 2.19888 1.62884 2.34062C1.36792 2.42386 1.13679 2.49761 0.972917 2.56182C0.818673 2.62226 0.635361 2.70509 0.505299 2.84964C0.388469 2.97948 0.328448 3.12525 0.288653 3.26468C0.252527 3.39125 0.221647 3.56261 0.192023 3.727C-0.530109 7.73199 1.04897 11.5261 4.90507 13.0025C5.28409 13.1477 5.56323 13.2546 6.00136 13.2546C6.43949 13.2546 6.71861 13.1476 7.09762 13.0025C10.9536 11.5261 12.5311 7.73181 11.8088 3.72698C11.7791 3.56256 11.7482 3.39117 11.7121 3.26459C11.6723 3.12514 11.6123 2.97936 11.4954 2.84951C11.3653 2.70497 11.182 2.62217 11.0278 2.56174C10.8639 2.49755 10.6328 2.42385 10.3719 2.34065C9.92738 2.1989 9.52251 1.97569 9.06573 1.72386C8.87912 1.62098 8.68377 1.51328 8.4736 1.40446C7.77784 1.0442 6.98019 0.712891 5.99944 0.712891ZM9.11141 5.78375C9.41509 5.67619 9.57409 5.34282 9.46653 5.03914C9.35898 4.73546 9.0256 4.57646 8.72192 4.68402C8.20968 4.86544 7.72002 5.21143 7.29032 5.58828C6.85457 5.97043 6.44718 6.41409 6.10109 6.82896C5.84483 7.13613 5.61825 7.43228 5.4344 7.68355C5.26595 7.4818 5.09815 7.33435 4.93816 7.22769C4.77809 7.12098 4.57217 6.98388 4.25 6.98388C3.92783 6.98388 3.66667 7.24505 3.66667 7.56722C3.66667 7.87097 3.89883 8.12049 4.19539 8.14803C4.31441 8.15908 4.63785 8.48062 4.89492 8.99476C4.98894 9.1828 5.17687 9.3057 5.38684 9.31645C5.59675 9.3272 5.79629 9.22407 5.90904 9.04669C5.90904 9.04669 6.11214 8.74193 6.20849 8.60544C6.4016 8.33186 6.67504 7.96218 6.99695 7.57631C7.31998 7.18909 7.68465 6.79421 8.05956 6.46542C8.44051 6.13133 8.80012 5.894 9.11141 5.78375Z" fill="#18C273"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
@ -0,0 +1,4 @@
|
||||
<svg width="22" height="20" viewBox="0 0 22 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.5476 0.25C14.3866 0.249991 15.8308 0.249984 16.9694 0.378599C18.1316 0.509878 19.074 0.783621 19.8574 1.40229C20.0919 1.58749 20.3093 1.79205 20.507 2.0138C21.1732 2.76101 21.4707 3.66669 21.6124 4.77785C21.75 5.85727 21.75 7.22325 21.75 8.94725V9.05275C21.75 10.4717 21.75 11.6481 21.6733 12.6218C21.6575 12.8225 21.6496 12.9229 21.5872 12.9766C21.5249 13.0303 21.4085 13.0222 21.1757 13.0061C21.1177 13.002 21.0591 13 21 13H20.4C20.2114 13 20.1172 13 20.0586 12.9414C20 12.8828 20 12.7886 20 12.6V12C20 10.6193 18.8807 9.5 17.5 9.5C16.1193 9.5 15 10.6193 15 12V12.6C15 12.7886 15 12.8828 14.9414 12.9414C14.8828 13 14.7886 13 14.6 13H14C12.6193 13 11.5 14.1193 11.5 15.5C11.5 16.1781 11.77 16.7932 12.2083 17.2436C12.4577 17.4998 12.5824 17.6279 12.5566 17.689C12.5308 17.7501 12.3673 17.7501 12.0402 17.7501L9.45246 17.75C7.61345 17.75 6.16917 17.75 5.03058 17.6214C3.86842 17.4901 2.926 17.2164 2.14263 16.5977C1.90811 16.4125 1.69068 16.2079 1.49298 15.9862C0.826808 15.239 0.529323 14.3333 0.387626 13.2222C0.249977 12.1427 0.249987 10.7768 0.25 9.05276V8.94726C0.249987 7.22326 0.249977 5.85727 0.387626 4.77785C0.529323 3.66669 0.826808 2.76101 1.49298 2.0138C1.69068 1.79205 1.90811 1.58749 2.14263 1.40229C2.926 0.783621 3.86842 0.509878 5.03058 0.378599C6.16917 0.249984 7.61344 0.249991 9.45245 0.25H12.5476ZM8 9C8 7.34315 9.34315 6 11 6C12.6569 6 14 7.34315 14 9C14 10.6569 12.6569 12 11 12C9.34315 12 8 10.6569 8 9ZM5.5 9C5.5 8.44771 5.05229 8 4.5 8H4.49102C3.93873 8 3.49102 8.44771 3.49102 9C3.49102 9.55229 3.93873 10 4.49102 10H4.5C5.05229 10 5.5 9.55229 5.5 9Z" fill="white"/>
|
||||
<path d="M18.5 12C18.5 11.4477 18.0523 11 17.5 11C16.9477 11 16.5 11.4477 16.5 12V14.5H14C13.4477 14.5 13 14.9477 13 15.5C13 16.0523 13.4477 16.5 14 16.5H16.5V19C16.5 19.5523 16.9477 20 17.5 20C18.0523 20 18.5 19.5523 18.5 19V16.5H21C21.5523 16.5 22 16.0523 22 15.5C22 14.9477 21.5523 14.5 21 14.5H18.5V12Z" fill="white"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.0 KiB |
@ -0,0 +1,3 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M11 1C5.47715 1 1 5.47715 1 11C1 16.5228 5.47715 21 11 21C13.4013 21 15.6049 20.1536 17.3287 18.7429L21.2929 22.7071C21.6834 23.0976 22.3166 23.0976 22.7071 22.7071C23.0976 22.3166 23.0976 21.6834 22.7071 21.2929L18.7429 17.3287C20.1536 15.6049 21 13.4013 21 11C21 5.47715 16.5228 1 11 1ZM3 11C3 6.58172 6.58172 3 11 3C15.4183 3 19 6.58172 19 11C19 15.4183 15.4183 19 11 19C6.58172 19 3 15.4183 3 11Z" fill="#2E3039"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 575 B |
@ -0,0 +1,4 @@
|
||||
<svg width="22" height="16" viewBox="0 0 22 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M11 11.75C8.92893 11.75 7.25 10.0711 7.25 8C7.25 5.92893 8.92893 4.25 11 4.25C13.0711 4.25 14.75 5.92893 14.75 8C14.75 10.0711 13.0711 11.75 11 11.75ZM8.75 8C8.75 9.24264 9.75736 10.25 11 10.25C12.2426 10.25 13.25 9.24264 13.25 8C13.25 6.75736 12.2426 5.75 11 5.75C9.75736 5.75 8.75 6.75736 8.75 8Z" fill="white"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M11 0.25C8.42944 0.25 6.22595 1.38141 4.52031 2.71298C2.81313 4.04576 1.55126 5.61974 0.84541 6.60952L0.792192 6.68373C0.539036 7.03581 0.25 7.43779 0.25 8C0.25 8.56221 0.539036 8.96419 0.792192 9.31627L0.845411 9.39048C1.55126 10.3803 2.81313 11.9542 4.52031 13.287C6.22595 14.6186 8.42944 15.75 11 15.75C13.5706 15.75 15.774 14.6186 17.4797 13.287C19.1869 11.9542 20.4487 10.3803 21.1546 9.39048L21.2078 9.31626C21.461 8.96418 21.75 8.5622 21.75 8C21.75 7.43779 21.461 7.03581 21.2078 6.68373L21.1546 6.60952C20.4487 5.61974 19.1869 4.04576 17.4797 2.71298C15.774 1.38141 13.5706 0.25 11 0.25ZM2.06667 7.48045C2.72687 6.55469 3.89238 5.10618 5.44336 3.89534C6.99587 2.68331 8.88134 1.75 11 1.75C13.1187 1.75 15.0041 2.68331 16.5566 3.89534C18.1076 5.10618 19.2731 6.55469 19.9333 7.48045C20.0967 7.70947 20.1744 7.8213 20.2207 7.91032C20.2502 7.96691 20.2501 7.98242 20.25 7.99761L20.25 8L20.25 8.00239C20.2501 8.01758 20.2502 8.03309 20.2207 8.08968C20.1744 8.1787 20.0967 8.29053 19.9333 8.51955C19.2731 9.44531 18.1076 10.8938 16.5566 12.1047C15.0041 13.3167 13.1187 14.25 11 14.25C8.88134 14.25 6.99588 13.3167 5.44336 12.1047C3.89238 10.8938 2.72687 9.44531 2.06667 8.51955C1.90335 8.29053 1.82562 8.1787 1.77928 8.08968C1.74983 8.03309 1.74991 8.01758 1.74999 8.00239L1.75 8L1.74999 7.99761C1.74991 7.98242 1.74983 7.96691 1.77928 7.91032C1.82562 7.8213 1.90335 7.70947 2.06667 7.48045Z" fill="white"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.9 KiB |
@ -0,0 +1,518 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
import 'dart:io' show Platform;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/core/api_consts.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_state.dart';
|
||||
import 'package:hmg_patient_app_new/core/dependencies.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
||||
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
|
||||
import 'package:hmg_patient_app_new/services/dialog_service.dart';
|
||||
import 'package:hmg_patient_app_new/services/logger_service.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../exceptions/api_failure.dart';
|
||||
|
||||
abstract class ApiClient {
|
||||
Future<void> post(
|
||||
String endPoint, {
|
||||
required Map<String, dynamic> body,
|
||||
required Function(dynamic response, int statusCode, {int? messageStatus}) onSuccess,
|
||||
required Function(String error, int statusCode, {int? messageStatus, Failure? failureType}) onFailure,
|
||||
bool isAllowAny,
|
||||
bool isExternal,
|
||||
bool isRCService,
|
||||
bool bypassConnectionCheck,
|
||||
});
|
||||
|
||||
Future<void> get(
|
||||
String endPoint, {
|
||||
required Function(dynamic response, int statusCode) onSuccess,
|
||||
required Function(String error, int statusCode) onFailure,
|
||||
Map<String, dynamic>? queryParams,
|
||||
bool isExternal,
|
||||
bool isRCService,
|
||||
});
|
||||
|
||||
String getSessionId(String id);
|
||||
|
||||
// Future<void> simplePost(
|
||||
// String fullUrl, {
|
||||
// required Map<dynamic, dynamic> body,
|
||||
// required Map<String, String> headers,
|
||||
// required Function(dynamic response, int statusCode) onSuccess,
|
||||
// required Function(String error, int statusCode) onFailure,
|
||||
// });
|
||||
|
||||
//
|
||||
// Future<void> simpleGet(
|
||||
// String fullUrl, {
|
||||
// Function(dynamic response, int statusCode)? onSuccess,
|
||||
// Function(String error, int statusCode)? onFailure,
|
||||
// Map<String, dynamic>? queryParams,
|
||||
// Map<String, String>? headers,
|
||||
// });
|
||||
//
|
||||
// Future<void> simplePut(
|
||||
// String fullUrl, {
|
||||
// Map<String, dynamic>? body,
|
||||
// Map<String, String>? headers,
|
||||
// Function(dynamic response, int statusCode)? onSuccess,
|
||||
// Function(String error, int statusCode)? onFailure,
|
||||
// });
|
||||
//
|
||||
// Future<void> simpleDelete(
|
||||
// String fullUrl, {
|
||||
// Function(dynamic response, int statusCode)? onSuccess,
|
||||
// Function(String error, int statusCode)? onFailure,
|
||||
// Map<String, String>? queryParams,
|
||||
// Map<String, String>? headers,
|
||||
// });
|
||||
|
||||
// Future<bool> handleUnauthorized(int statusCode, {required String forUrl});
|
||||
// Future<String> generatePackagesToken();
|
||||
}
|
||||
|
||||
class ApiClientImp implements ApiClient {
|
||||
final _analytics = getIt<GAnalytics>();
|
||||
|
||||
final LoggerService loggerService;
|
||||
final AppState appState;
|
||||
final DialogService dialogService;
|
||||
|
||||
ApiClientImp({
|
||||
required this.loggerService,
|
||||
required this.dialogService,
|
||||
required this.appState,
|
||||
});
|
||||
|
||||
@override
|
||||
post(
|
||||
String endPoint, {
|
||||
required Map<String, dynamic> body,
|
||||
required Function(dynamic response, int statusCode, {int? messageStatus}) onSuccess,
|
||||
required Function(String error, int statusCode, {int? messageStatus, Failure? failureType}) onFailure,
|
||||
bool isAllowAny = false,
|
||||
bool isExternal = false,
|
||||
bool isRCService = false,
|
||||
bool bypassConnectionCheck = false,
|
||||
}) async {
|
||||
AppState appState = getIt.get<AppState>();
|
||||
String url;
|
||||
if (isExternal) {
|
||||
url = endPoint;
|
||||
} else {
|
||||
if (isRCService) {
|
||||
url = RC_BASE_URL + endPoint;
|
||||
} else {
|
||||
url = BASE_URL + endPoint;
|
||||
}
|
||||
}
|
||||
try {
|
||||
var user = appState.getAuthenticatedUser;
|
||||
Map<String, String> headers = {'Content-Type': 'application/json', 'Accept': 'application/json'};
|
||||
if (!isExternal) {
|
||||
String? token = appState.appAuthToken;
|
||||
String? languageID = (appState.postParamsObject?.languageID == 1 ? 'ar' : 'en');
|
||||
if (endPoint == ApiConsts.sendActivationCode) {
|
||||
languageID = 'en';
|
||||
}
|
||||
if (body.containsKey('SetupID')) {
|
||||
body['SetupID'] = body.containsKey('SetupID') ? body['SetupID'] ?? body[''] : SETUP_ID;
|
||||
} else {}
|
||||
|
||||
if (body.containsKey('LanguageID')) {
|
||||
if (body['LanguageID'] != null) {
|
||||
body['LanguageID'] = body['LanguageID'] == 'ar'
|
||||
? 1
|
||||
: body['LanguageID'] == 'en'
|
||||
? 2
|
||||
: body['LanguageID'];
|
||||
}
|
||||
}
|
||||
|
||||
if (body.containsKey('isDentalAllowedBackend')) {
|
||||
body['isDentalAllowedBackend'] = body.containsKey('isDentalAllowedBackend') ? body['isDentalAllowedBackend'] ?? IS_DENTAL_ALLOWED_BACKEND : IS_DENTAL_ALLOWED_BACKEND;
|
||||
}
|
||||
|
||||
//Todo: I have converted it to string
|
||||
body['DeviceTypeID'] = Platform.isIOS
|
||||
? "1"
|
||||
: await Utils.isGoogleServicesAvailable()
|
||||
? "2"
|
||||
: "3";
|
||||
|
||||
if (!body.containsKey('IsPublicRequest')) {
|
||||
// if (!body.containsKey('PatientType')) {
|
||||
if (user != null && user.patientType != null) {
|
||||
body['PatientType'] = user.patientType;
|
||||
} else {
|
||||
body['PatientType'] = PATIENT_TYPE.toString();
|
||||
}
|
||||
|
||||
if (user != null && user.patientType != null) {
|
||||
body['PatientTypeID'] = user.patientType;
|
||||
} else {
|
||||
body['PatientType'] = PATIENT_TYPE_ID.toString();
|
||||
}
|
||||
|
||||
if (user != null) {
|
||||
body['TokenID'] = body['TokenID'] ?? token;
|
||||
body['PatientID'] = body['PatientID'] ?? user.patientID;
|
||||
|
||||
body['PatientOutSA'] = body.containsKey('PatientOutSA') ? body['PatientOutSA'] ?? user.outSA : user.outSA;
|
||||
body['SessionID'] = getSessionId(body['TokenID'] ?? ""); //getSe
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// request.versionID = VERSION_ID;
|
||||
// request.channel = CHANNEL;
|
||||
// request.iPAdress = IP_ADDRESS;
|
||||
// request.generalid = GENERAL_ID;
|
||||
// request.languageID = (languageID == 'ar' ? 1 : 2);
|
||||
// request.patientOutSA = (request.zipCode == '966' || request.zipCode == '+966') ? 0 : 1;
|
||||
|
||||
// TODO : we will use all these from appState
|
||||
body['LanguageID'] = body['LanguageID'] ?? "2";
|
||||
body['VersionID'] = body['VersionID'] ?? "50.0";
|
||||
body['Channel'] = body['Channel'] ?? "3";
|
||||
body['IPAdress'] = body['IPAdress'] ?? "10.20.10.20";
|
||||
body['generalid'] = body['generalid'] ?? "Cs2020@2016\$2958";
|
||||
body['Latitude'] = body['Latitude'] ?? "0.0";
|
||||
body['Longitude'] = body['Longitude'] ?? "0.0";
|
||||
body['DeviceTypeID'] = body['DeviceTypeID'] ??
|
||||
(Platform.isIOS
|
||||
? "1"
|
||||
: await Utils.isGoogleServicesAvailable()
|
||||
? "2"
|
||||
: "3");
|
||||
body['TokenID'] = "@dm!n";
|
||||
body.removeWhere((key, value) => value == null);
|
||||
log("body: ${json.encode(body)}");
|
||||
log("uri: ${Uri.parse(url.trim())}");
|
||||
|
||||
if (await Utils.checkConnection(bypassConnectionCheck: bypassConnectionCheck)) {
|
||||
final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: headers);
|
||||
|
||||
final int statusCode = response.statusCode;
|
||||
if (statusCode < 200 || statusCode >= 400) {
|
||||
onFailure('Error While Fetching data', statusCode, failureType: StatusCodeFailure("Error While Fetching data"));
|
||||
logApiEndpointError(endPoint, 'Error While Fetching data', statusCode);
|
||||
} else {
|
||||
var parsed = json.decode(utf8.decode(response.bodyBytes));
|
||||
log("parsed: ${parsed.toString()}");
|
||||
if (isAllowAny) {
|
||||
onSuccess(parsed, statusCode);
|
||||
} else {
|
||||
if (parsed['Response_Message'] != null) {
|
||||
onSuccess(parsed, statusCode, messageStatus: parsed['MessageStatus']);
|
||||
} else {
|
||||
if (parsed['ErrorType'] == 4) {
|
||||
//TODO : handle app update
|
||||
logApiEndpointError(endPoint, parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode);
|
||||
}
|
||||
if (parsed['ErrorType'] == 2) {
|
||||
// todo: handle Logout
|
||||
logApiEndpointError(endPoint, "session logged out", statusCode);
|
||||
}
|
||||
if (isAllowAny) {
|
||||
onSuccess(parsed, statusCode, messageStatus: parsed['MessageStatus']);
|
||||
} else if (parsed['IsAuthenticated'] == null) {
|
||||
if (parsed['isSMSSent'] == true) {
|
||||
onSuccess(parsed, statusCode, messageStatus: parsed['MessageStatus']);
|
||||
} else if (parsed['MessageStatus'] == 1) {
|
||||
onSuccess(parsed, statusCode, messageStatus: parsed['MessageStatus']);
|
||||
} else if (parsed['Result'] == 'OK') {
|
||||
onSuccess(parsed, statusCode, messageStatus: parsed['MessageStatus']);
|
||||
} else {
|
||||
onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode, failureType: ServerFailure("Error While Fetching data"));
|
||||
logApiEndpointError(endPoint, parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode);
|
||||
}
|
||||
} else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) {
|
||||
onSuccess(parsed, statusCode, messageStatus: parsed['MessageStatus']);
|
||||
} else if (parsed['MessageStatus'] == 2 && parsed['IsAuthenticated']) {
|
||||
if (parsed['SameClinicApptList'] != null) {
|
||||
onSuccess(parsed, statusCode, messageStatus: parsed['MessageStatus']);
|
||||
} else {
|
||||
if (parsed['message'] == null && parsed['ErrorEndUserMessage'] == null) {
|
||||
if (parsed['ErrorSearchMsg'] == null) {
|
||||
onFailure(
|
||||
"Server Error found with no available message",
|
||||
statusCode,
|
||||
failureType: ServerFailure("Error While Fetching data"),
|
||||
);
|
||||
logApiEndpointError(endPoint, "Server Error found with no available message", statusCode);
|
||||
} else {
|
||||
onFailure(
|
||||
parsed['ErrorSearchMsg'],
|
||||
statusCode,
|
||||
failureType: ServerFailure("Error While Fetching data"),
|
||||
);
|
||||
logApiEndpointError(endPoint, parsed['ErrorSearchMsg'], statusCode);
|
||||
}
|
||||
} else {
|
||||
onFailure(
|
||||
parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
|
||||
statusCode,
|
||||
failureType: ServerFailure("Error While Fetching data"),
|
||||
);
|
||||
logApiEndpointError(endPoint, parsed['message'] ?? parsed['message'], statusCode);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (parsed['SameClinicApptList'] != null) {
|
||||
onSuccess(parsed, statusCode, messageStatus: parsed['MessageStatus']);
|
||||
} else {
|
||||
if (parsed['message'] != null) {
|
||||
onFailure(
|
||||
parsed['message'] ?? parsed['message'],
|
||||
statusCode,
|
||||
failureType: ServerFailure("Error While Fetching data"),
|
||||
);
|
||||
logApiEndpointError(endPoint, parsed['message'] ?? parsed['message'], statusCode);
|
||||
} else {
|
||||
onFailure(
|
||||
parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
|
||||
statusCode,
|
||||
failureType: ServerFailure("Error While Fetching data"),
|
||||
);
|
||||
logApiEndpointError(endPoint, parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
onFailure(
|
||||
'Please Check The Internet Connection 1',
|
||||
-1,
|
||||
failureType: ConnectivityFailure("Error While Fetching data"),
|
||||
);
|
||||
_analytics.errorTracking.log("internet_connectivity", error: "no internet available");
|
||||
}
|
||||
} catch (e) {
|
||||
loggerService.errorLogs(e.toString());
|
||||
if (e.toString().contains("ClientException")) {
|
||||
onFailure('Something went wrong, plase try again', -1, failureType: InvalidCredentials('Something went wrong, plase try again'));
|
||||
_analytics.errorTracking.log("internet_connectivity", error: "no internet available");
|
||||
} else {
|
||||
onFailure(e.toString(), -1);
|
||||
}
|
||||
_analytics.errorTracking.log(endPoint, error: "api exception: $e - API Path: $url");
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
get(String endPoint,
|
||||
{required Function(dynamic response, int statusCode) onSuccess,
|
||||
required Function(String error, int statusCode) onFailure,
|
||||
Map<String, dynamic>? queryParams,
|
||||
bool isExternal = false,
|
||||
bool isRCService = false}) async {
|
||||
String url;
|
||||
if (isExternal) {
|
||||
url = endPoint;
|
||||
} else {
|
||||
if (isRCService) {
|
||||
url = RC_BASE_URL + endPoint;
|
||||
} else {
|
||||
url = BASE_URL + endPoint;
|
||||
}
|
||||
}
|
||||
if (queryParams != null) {
|
||||
String queryString = Uri(queryParameters: queryParams).query;
|
||||
url += '?$queryString';
|
||||
}
|
||||
|
||||
debugPrint("URL : $url");
|
||||
// print("Body : ${json.encode(body)}");
|
||||
|
||||
if (await Utils.checkConnection()) {
|
||||
final response = await http.get(
|
||||
Uri.parse(url.trim()),
|
||||
headers: {'Content-Type': 'application/json', 'Accept': 'application/json'},
|
||||
);
|
||||
final int statusCode = response.statusCode;
|
||||
// print("statusCode :$statusCode");
|
||||
|
||||
if (statusCode < 200 || statusCode >= 400) {
|
||||
onFailure('Error While Fetching data', statusCode);
|
||||
logApiEndpointError(endPoint, 'Error While Fetching data', statusCode);
|
||||
} else {
|
||||
var parsed = json.decode(utf8.decode(response.bodyBytes));
|
||||
onSuccess(parsed, statusCode);
|
||||
}
|
||||
} else {
|
||||
onFailure('Please Check The Internet Connection', -1);
|
||||
_analytics.errorTracking.log("internet_connectivity", error: "no internet available");
|
||||
}
|
||||
}
|
||||
|
||||
// @override
|
||||
// simplePost(
|
||||
// String fullUrl, {
|
||||
// required Map<dynamic, dynamic> body,
|
||||
// required Map<String, String> headers,
|
||||
// required Function(dynamic response, int statusCode) onSuccess,
|
||||
// required Function(String error, int statusCode) onFailure,
|
||||
// }) async {
|
||||
// String url = fullUrl;
|
||||
// // print("URL Query String: $url");
|
||||
// // print("body: $body");
|
||||
//
|
||||
// if (await Utils.checkConnection()) {
|
||||
// headers!.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'});
|
||||
// final response = await http.post(
|
||||
// Uri.parse(url.trim()),
|
||||
// body: json.encode(body),
|
||||
// headers: headers,
|
||||
// );
|
||||
// final int statusCode = response.statusCode;
|
||||
// // print("statusCode :$statusCode");
|
||||
// if (await handleUnauthorized(statusCode, forUrl: fullUrl)) {
|
||||
// simplePost(fullUrl, onFailure: onFailure, onSuccess: onSuccess, body: body, headers: headers);
|
||||
// }
|
||||
//
|
||||
// // print(response.body.toString());
|
||||
//
|
||||
// if (statusCode < 200 || statusCode >= 400) {
|
||||
// onFailure!('Error While Fetching data', statusCode);
|
||||
// logApiFullUrlError(fullUrl, 'Error While Fetching data', statusCode);
|
||||
// } else {
|
||||
// onSuccess!(response.body.toString(), statusCode);
|
||||
// }
|
||||
// } else {
|
||||
// onFailure!('Please Check The Internet Connection', -1);
|
||||
// _analytics.errorTracking.log("internet_connectivity", error: "no internet available");
|
||||
// }
|
||||
// }
|
||||
|
||||
// simpleGet(String fullUrl,
|
||||
// {Function(dynamic response, int statusCode)? onSuccess,
|
||||
// Function(String error, int statusCode)? onFailure,
|
||||
// Map<String, dynamic>? queryParams,
|
||||
// Map<String, String>? headers}) async {
|
||||
// headers = headers ?? {};
|
||||
// String url = fullUrl;
|
||||
//
|
||||
// var haveParams = (queryParams != null);
|
||||
// if (haveParams) {
|
||||
// String queryString = Uri(queryParameters: queryParams).query;
|
||||
// url += '?$queryString';
|
||||
// // print("URL Query String: $url");
|
||||
// }
|
||||
//
|
||||
// if (await Utils.checkConnection()) {
|
||||
// headers.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'});
|
||||
// final response = await http.get(
|
||||
// Uri.parse(url.trim()),
|
||||
// headers: headers,
|
||||
// );
|
||||
//
|
||||
// final int statusCode = response.statusCode;
|
||||
// // print("statusCode :$statusCode");
|
||||
// if (await handleUnauthorized(statusCode, forUrl: fullUrl))
|
||||
// simpleGet(fullUrl, onFailure: onFailure, onSuccess: onSuccess, headers: headers, queryParams: queryParams);
|
||||
//
|
||||
// if (statusCode < 200 || statusCode >= 400) {
|
||||
// onFailure!('Error While Fetching data', statusCode);
|
||||
// logApiFullUrlError(fullUrl, 'Error While Fetching data', statusCode);
|
||||
// } else {
|
||||
// onSuccess!(response.body.toString(), statusCode);
|
||||
// }
|
||||
// } else {
|
||||
// onFailure!('Please Check The Internet Connection', -1);
|
||||
// _analytics.errorTracking.log("internet_connectivity", error: "no internet available");
|
||||
// }
|
||||
// }
|
||||
|
||||
// simplePut(String fullUrl,
|
||||
// {Map<String, dynamic>? body,
|
||||
// Map<String, String>? headers,
|
||||
// Function(dynamic response, int statusCode)? onSuccess,
|
||||
// Function(String error, int statusCode)? onFailure}) async {
|
||||
// String url = fullUrl;
|
||||
// // print("URL Query String: $url");
|
||||
//
|
||||
// if (await Utils.checkConnection()) {
|
||||
// headers!.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'});
|
||||
// final response = await http.put(
|
||||
// Uri.parse(url.trim()),
|
||||
// body: json.encode(body),
|
||||
// headers: headers,
|
||||
// );
|
||||
//
|
||||
// final int statusCode = response.statusCode;
|
||||
// // print("statusCode :$statusCode");
|
||||
// if (await handleUnauthorized(statusCode, forUrl: fullUrl))
|
||||
// simplePut(fullUrl, onFailure: onFailure, onSuccess: onSuccess, headers: headers, body: body);
|
||||
//
|
||||
// if (statusCode < 200 || statusCode >= 400) {
|
||||
// onFailure!('Error While Fetching data', statusCode);
|
||||
// logApiFullUrlError(fullUrl, 'Error While Fetching data', statusCode);
|
||||
// } else {
|
||||
// onSuccess!(response.body.toString(), statusCode);
|
||||
// }
|
||||
// } else {
|
||||
// onFailure!('Please Check The Internet Connection', -1);
|
||||
// _analytics.errorTracking.log("internet_connectivity", error: "no internet available");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// simpleDelete(String fullUrl,
|
||||
// {Function(dynamic response, int statusCode)? onSuccess,
|
||||
// Function(String error, int statusCode)? onFailure,
|
||||
// Map<String, String>? queryParams,
|
||||
// Map<String, String>? headers}) async {
|
||||
// String url = fullUrl;
|
||||
// // print("URL Query String: $url");
|
||||
//
|
||||
// var haveParams = (queryParams != null);
|
||||
// if (haveParams) {
|
||||
// String queryString = Uri(queryParameters: queryParams).query;
|
||||
// url += '?$queryString';
|
||||
// // print("URL Query String: $url");
|
||||
// }
|
||||
//
|
||||
// if (await Utils.checkConnection()) {
|
||||
// headers!.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'});
|
||||
// final response = await http.delete(
|
||||
// Uri.parse(url.trim()),
|
||||
// headers: headers,
|
||||
// );
|
||||
//
|
||||
// final int statusCode = response.statusCode;
|
||||
// // print("statusCode :$statusCode");
|
||||
// if (await handleUnauthorized(statusCode, forUrl: fullUrl))
|
||||
// simpleDelete(fullUrl, onFailure: onFailure, onSuccess: onSuccess, queryParams: queryParams, headers: headers);
|
||||
//
|
||||
// if (statusCode < 200 || statusCode >= 400) {
|
||||
// onFailure!('Error While Fetching data', statusCode);
|
||||
// logApiFullUrlError(fullUrl, 'Error While Fetching data', statusCode);
|
||||
// } else {
|
||||
// onSuccess!(response.body.toString(), statusCode);
|
||||
// }
|
||||
// } else {
|
||||
// onFailure!('Please Check The Internet Connection', -1);
|
||||
// _analytics.errorTracking.log("internet_connectivity", error: "no internet available");
|
||||
// }
|
||||
// }
|
||||
|
||||
@override
|
||||
String getSessionId(String id) {
|
||||
return id.replaceAll(RegExp('/[^a-zA-Z]'), '');
|
||||
}
|
||||
|
||||
logApiFullUrlError(String fullUrl, error, code) {
|
||||
final endpoint = Uri.parse(fullUrl).pathSegments.last;
|
||||
logApiEndpointError(endpoint, error, code);
|
||||
}
|
||||
|
||||
logApiEndpointError(String endPoint, error, code) {
|
||||
_analytics.errorTracking.log(endPoint, error: error);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,765 @@
|
||||
import 'dart:io';
|
||||
|
||||
var MAX_SMALL_SCREEN = 660;
|
||||
final OPENTOK_API_KEY = '46209962';
|
||||
// final OPENTOK_API_KEY = '47464241';
|
||||
|
||||
// PACKAGES and OFFERS
|
||||
var EXA_CART_API_BASE_URL = 'https://mdlaboratories.com/offersdiscounts';
|
||||
// var EXA_CART_API_BASE_URL = 'http://10.200.101.75:9000';
|
||||
var PACKAGES_CATEGORIES = '/api/categories';
|
||||
var PACKAGES_STORES = '/api/stores';
|
||||
var PACKAGES_TOKEN = '/api/token';
|
||||
var PACKAGES_PRODUCTS = '/api/products';
|
||||
var PACKAGES_CUSTOMER = '/api/customers';
|
||||
var PACKAGES_SHOPPING_CART = '/api/shopping_cart_items';
|
||||
var PACKAGES_ORDERS = '/api/orders';
|
||||
var PACKAGES_ORDER_HISTORY = '/api/orders/items';
|
||||
var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara';
|
||||
// var BASE_URL = 'http://10.50.100.198:2018/';
|
||||
// var BASE_URL = 'https://uat.hmgwebservices.com/';
|
||||
var BASE_URL = 'https://hmgwebservices.com/';
|
||||
// var BASE_URL = 'http://10.201.204.103/';
|
||||
// var BASE_URL = 'https://orash.cloudsolutions.com.sa/';
|
||||
// var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/';
|
||||
// var BASE_URL = 'https://vidamergeuat.cloudsolutions.com.sa/';
|
||||
|
||||
// var BASE_URL = 'https://webservices.hmg.com/';
|
||||
|
||||
// var BASE_URL = 'http://10.50.100.198:4422/';
|
||||
|
||||
// Pharmacy UAT URLs
|
||||
// var BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
|
||||
// var PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
|
||||
|
||||
// // Pharmacy Production URLs
|
||||
var BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/';
|
||||
var PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/';
|
||||
|
||||
var PHARMACY_REDIRECT_URL = 'https://bit.ly/AlhabibPharmacy';
|
||||
|
||||
// Pharmacy VidaPlus URLs
|
||||
// var BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapitest/api/';
|
||||
// var PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapitest/api/';
|
||||
|
||||
// // Pharmacy Pre-Production URLs
|
||||
// var BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapitest/api/';
|
||||
// var PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapitest/api/';
|
||||
|
||||
// RC API URL
|
||||
var RC_BASE_URL = 'https://rc.hmg.com/';
|
||||
|
||||
// var RC_BASE_URL = 'https://rc.hmg.com/test/';
|
||||
|
||||
// var RC_BASE_URL = 'https://ms.hmg.com/rc/';
|
||||
|
||||
var PING_SERVICE = 'Services/Weather.svc/REST/CheckConnectivity';
|
||||
|
||||
var GET_PROJECT = 'Services/Lists.svc/REST/GetProject';
|
||||
|
||||
///Geofencing
|
||||
var GET_GEO_ZONES = 'Services/Patients.svc/REST/GeoF_GetAllPoints';
|
||||
var LOG_GEO_ZONES = 'Services/Patients.svc/REST/GeoF_InsertPatientFileInfo';
|
||||
|
||||
// Delivery Driver
|
||||
var DRIVER_LOCATION = 'Services/Patients.svc/REST/PatientER_GetDriverLocation';
|
||||
|
||||
//weather
|
||||
var WEATHER_INDICATOR = 'Services/Weather.svc/REST/GetCityInfo';
|
||||
|
||||
var GET_PRIVILEGE = 'Services/Patients.svc/REST/Service_Privilege';
|
||||
|
||||
// Wifi Credentials
|
||||
var WIFI_CREDENTIALS = "Services/Patients.svc/Hmg_SMS_Get_By_ProjectID_And_PatientID";
|
||||
|
||||
///Doctor
|
||||
var GET_MY_DOCTOR = 'Services/Doctors.svc/REST/GetPatientDoctorAppointmentResult';
|
||||
var GET_DOCTOR_PROFILE = 'Services/Doctors.svc/REST/GetDocProfiles';
|
||||
var GET_DOCTOR_PRE_POST_IMAGES = 'Services/Doctors.svc/REST/GetDoctorPrePostImages';
|
||||
var GET_DOCTOR_RATING_NOTES = 'Services/Doctors.svc/REST/dr_GetNotesDoctorRating';
|
||||
var GET_DOCTOR_RATING_DETAILS = 'Services/Doctors.svc/REST/dr_GetDoctorRatingDetails';
|
||||
|
||||
var GET_DOCTOR_RATING = 'Services/Doctors.svc/REST/dr_GetAvgDoctorRating';
|
||||
|
||||
///Prescriptions
|
||||
// var PRESCRIPTIONS = 'Services/Patients.svc/REST/GetPrescriptionApptList';
|
||||
var PRESCRIPTIONS = 'Services/Patients.svc/REST/GetPrescriptionApptList_Async';
|
||||
|
||||
var GET_PRESCRIPTIONS_ALL_ORDERS = 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders';
|
||||
var GET_PRESCRIPTION_REPORT = 'Services/Patients.svc/REST/INP_GetPrescriptionReport';
|
||||
var SEND_PRESCRIPTION_EMAIL = 'Services/Notifications.svc/REST/SendPrescriptionEmail';
|
||||
var GET_PRESCRIPTION_REPORT_ENH = 'Services/Patients.svc/REST/GetPrescriptionReport_enh';
|
||||
|
||||
///Lab Order
|
||||
var GET_Patient_LAB_ORDERS = 'Services/Patients.svc/REST/GetPatientLabOrders';
|
||||
var GET_Patient_LAB_SPECIAL_RESULT = 'Services/Patients.svc/REST/GetPatientLabSpecialResults';
|
||||
var SEND_LAB_RESULT_EMAIL = 'Services/Notifications.svc/REST/SendLabReportEmail';
|
||||
var GET_Patient_LAB_RESULT = 'Services/Patients.svc/REST/GetPatientLabResults';
|
||||
var GET_Patient_LAB_ORDERS_RESULT = 'Services/Patients.svc/REST/GetPatientLabOrdersResults';
|
||||
var SEND_COVID_LAB_RESULT_EMAIL = 'Services/Notifications.svc/REST/GenerateCOVIDReport';
|
||||
var COVID_PASSPORT_UPDATE = 'Services/Patients.svc/REST/Covid19_Certificate_PassportUpdate';
|
||||
var GET_PATIENT_PASSPORT_NUMBER = 'Services/Patients.svc/REST/Covid19_Certificate_GetPassport';
|
||||
var SEND_LAB_RESULT_EMAIL_NEW = 'ReportsAPI/api/reports/labReport';
|
||||
|
||||
var UPDATE_WORKPLACE_NAME = 'Services/Patients.svc/REST/ActivateSickLeave_FromVida';
|
||||
var GET_SICKLEAVE_STATUS_ADMISSION_NO = 'Services/ChatBot_Service.svc/REST/GetSickLeaveStatusByAdmissionNo';
|
||||
|
||||
///
|
||||
var GET_PATIENT_ORDERS = 'Services/Patients.svc/REST/GetPatientRadOrders';
|
||||
var GET_PATIENT_LAB_ORDERS_BY_APPOINTMENT = 'Services/Patients.svc/REST/GetPatientLabResultsByAppointmentNo';
|
||||
|
||||
var GET_PATIENT_ORDERS_DETAILS = 'Services/Patients.svc/REST/Rad_UpdatePatientRadOrdersToRead';
|
||||
var GET_RAD_IMAGE_URL = 'Services/Patients.svc/Rest/GetRadImageURL';
|
||||
var SEND_RAD_REPORT_EMAIL = 'Services/Notifications.svc/REST/SendRadReportEmail';
|
||||
|
||||
///Feedback
|
||||
var SEND_FEEDBACK = 'Services/COCWS.svc/REST/InsertCOCItemInSPList';
|
||||
var GET_STATUS_FOR_COCO = 'Services/COCWS.svc/REST/GetStatusforCOC';
|
||||
// var GET_PATIENT_AppointmentHistory = 'Services'
|
||||
// '/Doctors.svc/REST/PateintHasAppoimentHistory';
|
||||
|
||||
var GET_PATIENT_AppointmentHistory = 'Services'
|
||||
'/Doctors.svc/REST/PateintHasAppoimentHistory_Async';
|
||||
|
||||
///VITAL SIGN
|
||||
var GET_PATIENT_VITAL_SIGN = 'Services/Doctors.svc/REST/Doctor_GetPatientVitalSign';
|
||||
|
||||
///Er Nearest
|
||||
var GET_NEAREST_HOSPITAL = 'Services/Patients.svc/REST/Patient_GetProjectAvgERWaitingTime';
|
||||
|
||||
///ED Online
|
||||
var ER_GET_VISUAL_TRIAGE_QUESTIONS = "services/Doctors.svc/REST/ER_GetVisualTriageQuestions";
|
||||
var ER_SAVE_TRIAGE_INFORMATION = "services/Doctors.svc/REST/ER_SaveTriageInformation";
|
||||
var ER_GetPatientPaymentInformationForERClinic = "services/Doctors.svc/REST/ER_GetPatientPaymentInformationForERClinic";
|
||||
|
||||
///Er Nearest
|
||||
var GET_AMBULANCE_REQUEST = 'Services/Patients.svc/REST/PatientER_RRT_GetAllTransportationMethod';
|
||||
var GET_PATIENT_ALL_PRES_ORDERS = 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders';
|
||||
var GET_PICK_UP_REQUEST_BY_PRES_ORDER_ID = 'Services/Patients.svc/REST/PatientER_RRT_GetPickUpRequestByPresOrderID';
|
||||
var UPDATE_PRESS_ORDER = 'Services/Patients.svc/REST/PatientER_UpdatePresOrder';
|
||||
var INSERT_ER_INERT_PRES_ORDER = 'Services/Patients.svc/REST/PatientER_InsertPresOrder';
|
||||
|
||||
/// ER RRT
|
||||
var GET_ALL_RC_TRANSPORTATION = 'api/Transportation/getalltransportation';
|
||||
var GET_ALL_TRANSPORTATIONS_RC = 'api/Transportation/getalltransportation';
|
||||
var GET_ALL_RRT_QUESTIONS = 'Services/Patients.svc/REST/PatientER_RRT_GetAllQuestions';
|
||||
var GET_RRT_SERVICE_PRICE = 'Services/Patients.svc/REST/PatientE_RealRRT_GetServicePrice';
|
||||
|
||||
var GET_ALL_TRANSPORTATIONS_ORDERS = 'api/Transportation/get';
|
||||
|
||||
var CANCEL_AMBULANCE_REQUEST = "api/Transportation/update";
|
||||
|
||||
var INSERT_TRANSPORTATION_ORDER_RC = "api/Transportation/add";
|
||||
|
||||
///FindUs
|
||||
var GET_FINDUS_REQUEST = 'Services/Lists.svc/REST/Get_HMG_Locations';
|
||||
|
||||
///LiveChat
|
||||
var GET_LIVECHAT_REQUEST = 'Services/Patients.svc/REST/GetPatientICProjects';
|
||||
|
||||
///babyInformation
|
||||
var GET_BABYINFORMATION_REQUEST = 'Services/Community.svc/REST/GetBabyByUserID';
|
||||
|
||||
///Get Baby By User ID
|
||||
var GET_BABY_BY_USER_ID = 'Services/Community.svc/REST/GetBabyByUserID';
|
||||
|
||||
///userInformation
|
||||
var GET_USERINFORMATION_REQUEST = 'Services/Community.svc/REST/GetUserInformation_New';
|
||||
|
||||
///Update email
|
||||
var UPDATE_PATENT_EMAIL = 'Services/Patients.svc/REST/UpdatePateintEmail';
|
||||
var UPDATE_PATENT_INFO = 'Services/Community.svc/REST/UpdateUserInfo_New';
|
||||
|
||||
///addNewChild
|
||||
var GET_NEWCHILD_REQUEST = 'Services/Community.svc/REST/CreateNewBaby';
|
||||
|
||||
///newUserId
|
||||
var GET_NEW_USER_REQUEST = 'Services/Community.svc/REST/CreateNewUser_New';
|
||||
|
||||
///delete Child
|
||||
var DELETE_CHILD_REQUEST = 'Services/Community.svc/REST/DeleteBaby';
|
||||
|
||||
///addNewTABLE
|
||||
var GET_TABLE_REQUEST = 'Services/Community.svc/REST/CreateVaccinationTable';
|
||||
|
||||
///BloodDenote
|
||||
var GET_CITIES_REQUEST = 'Services/Lists.svc/REST/GetAllCities';
|
||||
|
||||
///BloodDetails
|
||||
var GET_BLOOD_REQUEST = 'services/PatientVarification.svc/REST/BloodDonation_GetBloodGroupDetails';
|
||||
|
||||
var SAVE_BLOOD_REQUEST = 'Services/PatientVarification.svc/REST/BloodDonation_RegisterBloodType';
|
||||
|
||||
var GET_BLOOD_AGREEMENT = 'Services/PatientVarification.svc/REST/CheckUserAgreementForBloodDonation';
|
||||
var SAVE_BLOOD_AGREEMENT = 'Services/PatientVarification.svc/REST/AddUserAgreementForBloodDonation';
|
||||
|
||||
///Reports
|
||||
var REPORTS = 'Services/Doctors.svc/REST/GetPatientMedicalReportStatusInfo';
|
||||
var INSERT_REQUEST_FOR_MEDICAL_REPORT = 'Services/Doctors.svc/REST/InsertRequestForMedicalReport';
|
||||
var SEND_MEDICAL_REPORT_EMAIL = 'Services/Notifications.svc/REST/SendMedicalReportEmail';
|
||||
var GET_INPATIENT_ADMISSIONS = 'Services/inps.svc/REST/getAdmissionForMedicalReport';
|
||||
var GET_MEDICAL_REPORT_PDF = 'Services/inps.svc/REST/getMedicalReportPDF';
|
||||
|
||||
///Rate
|
||||
// var IS_LAST_APPOITMENT_RATED = 'Services/Doctors.svc/REST/IsLastAppoitmentRated';
|
||||
var IS_LAST_APPOITMENT_RATED = 'Services/Doctors.svc/REST/IsLastAppoitmentRated_Async';
|
||||
var GET_APPOINTMENT_DETAILS_BY_NO = 'Services/MobileNotifications.svc/REST/GetAppointmentDetailsByApptNo';
|
||||
var NEW_RATE_APPOINTMENT_URL = "Services/Doctors.svc/REST/AppointmentsRating_InsertAppointmentRate";
|
||||
var NEW_RATE_DOCTOR_URL = "Services/Doctors.svc/REST/DoctorsRating_InsertDoctorRate";
|
||||
|
||||
var GET_QR_PARKING = 'Services/SWP.svc/REST/GetQRParkingByID';
|
||||
|
||||
//URL to get clinic list
|
||||
var GET_CLINICS_LIST_URL = "Services/lists.svc/REST/GetClinicCentralized";
|
||||
var GET_CLINICS_LIST_WRT_HOSPITAL_URL = "Services/Lists.svc/REST/GetClinicFromDoctorSchedule";
|
||||
|
||||
//URL to get active appointment list
|
||||
var GET_ACTIVE_APPOINTMENTS_LIST_URL = "Services/Doctors.svc/Rest/Dr_GetAppointmentActiveNumber";
|
||||
|
||||
//URL to get projects list
|
||||
var GET_PROJECTS_LIST = 'Services/Lists.svc/REST/GetProject';
|
||||
|
||||
//URL to get doctors list
|
||||
var GET_DOCTORS_LIST_URL = "Services/Doctors.svc/REST/SearchDoctorsByTime";
|
||||
|
||||
//URL to dental doctors list
|
||||
var GET_DENTAL_DOCTORS_LIST_URL = "Services/Doctors.svc/REST/Dental_DoctorChiefComplaintMapping";
|
||||
|
||||
//URL to get doctor free slots
|
||||
var GET_DOCTOR_FREE_SLOTS = "Services/Doctors.svc/REST/GetDoctorFreeSlots";
|
||||
|
||||
//URL to insert appointment
|
||||
var INSERT_SPECIFIC_APPOINTMENT = "Services/Doctors.svc/REST/InsertSpecificAppointment";
|
||||
|
||||
//URL to get patient share
|
||||
var GET_PATIENT_SHARE = "Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNO";
|
||||
|
||||
//URL to get patient appointment history
|
||||
var GET_PATIENT_APPOINTMENT_HISTORY = "Services/Doctors.svc/REST/PateintHasAppoimentHistory";
|
||||
|
||||
var GET_OBGYNE_ORDERS_LIST = "services/Patients.svc/REST/HIS_OBGYNEProcedureGet";
|
||||
|
||||
var GET_OBGYNE_DOCTORS_LIST = "services/Doctors.svc/REST/HIS_ObgyneUltrasoundDoctors";
|
||||
|
||||
var OBGYNE_PROCEDURE_UPDATE = "services/Patients.svc/REST/HIS_OBGYNEProcedure_Update";
|
||||
|
||||
var GET_RRT_PROCEDURE_LIST = "Services/Patients.svc/REST/GetRRTProcedureDetailsListFromVida";
|
||||
|
||||
var DOCTOR_SCHEDULE_URL = 'Services/Doctors.svc/REST/GetDoctorWorkingHoursTable';
|
||||
|
||||
var SEND_REPORT_EYE_EMAIL = "Services/Notifications.svc/REST/SendGlassesPrescriptionEmail";
|
||||
|
||||
var SEND_CONTACT_LENS_PRESCRIPTION_EMAIL = "Services/Notifications.svc/REST/SendContactLensPrescriptionEmail";
|
||||
|
||||
//URL to get patient appointment curfew history
|
||||
// var GET_PATIENT_APPOINTMENT_CURFEW_HISTORY = "Services/Doctors.svc/REST/AppoimentHistoryForCurfew";
|
||||
var GET_PATIENT_APPOINTMENT_CURFEW_HISTORY = "Services/Doctors.svc/REST/AppoimentHistoryForCurfew_Async";
|
||||
|
||||
//URL to confirm appointment
|
||||
var CONFIRM_APPOINTMENT = "Services/MobileNotifications.svc/REST/ConfirmAppointment";
|
||||
|
||||
var INSERT_VIDA_REQUEST = "Services/ER_VirtualCall.svc/REST/PatientER_VidaRequestInseart";
|
||||
|
||||
//URL to cancel appointment
|
||||
var CANCEL_APPOINTMENT = "Services/Doctors.svc/REST/CancelAppointment";
|
||||
|
||||
//URL get appointment QR
|
||||
var GENERATE_QR_APPOINTMENT = "Services/Doctors.svc/REST/GenerateQRAppointmentNo";
|
||||
|
||||
//URL send email appointment QR
|
||||
var EMAIL_QR_APPOINTMENT = "Services/Notifications.svc/REST/sendEmailForOnLineCheckin";
|
||||
|
||||
//URL check payment status
|
||||
var CHECK_PAYMENT_STATUS = "Services/PayFort_Serv.svc/REST/GetRequestStatusByRequestID";
|
||||
|
||||
//URL create advance payment
|
||||
var CREATE_ADVANCE_PAYMENT = "Services/Doctors.svc/REST/CreateAdvancePayment";
|
||||
|
||||
var HIS_CREATE_ADVANCE_PAYMENT = "Services/Patients.svc/REST/HIS_CreateAdvancePayment";
|
||||
|
||||
var ER_CREATE_ADVANCE_PAYMENT = "services/Doctors.svc/REST/ER_CreateAdvancePaymentForClinic";
|
||||
|
||||
var ER_INSERT_ADVANCE_PAYMENT = "services/Doctors.svc/REST/ER_InsertEROnlinePaymentDetails";
|
||||
|
||||
var ADD_ADVANCE_NUMBER_REQUEST = 'Services/PayFort_Serv.svc/REST/AddAdvancedNumberRequest';
|
||||
|
||||
var GENERATE_ANCILLARY_ORDERS_INVOICE = 'Services/Doctors.svc/REST/AutoGenerateAncillaryOrderInvoice';
|
||||
|
||||
var IS_ALLOW_ASK_DOCTOR = 'Services/Doctors.svc/REST/GetPatientDoctorAppointmentResult';
|
||||
var GET_CALL_REQUEST_TYPE = 'Services/Doctors.svc/REST/GetCallRequestType_LOV';
|
||||
var ADD_VIDA_REQUEST = 'Services/ER_VirtualCall.svc/REST/PatientER_VidaRequestInseart';
|
||||
|
||||
var SEND_CALL_REQUEST = 'Services/Doctors.svc/REST/InsertCallInfo';
|
||||
|
||||
var GET_LIVECARE_CLINICS = 'Services/ER_VirtualCall.svc/REST/PatientER_GetClinics';
|
||||
|
||||
var GET_LIVECARE_SCHEDULE_CLINICS = 'Services/Doctors.svc/REST/PatientER_GetClinicsHaveSchedule';
|
||||
|
||||
var GET_LIVECARE_SCHEDULE_CLINIC_DOCTOR_LIST = 'Services/Doctors.svc/REST/PatientER_GetDoctorByClinicID';
|
||||
|
||||
var GET_LIVECARE_SCHEDULE_DOCTOR_TIME_SLOTS = 'Services/Doctors.svc/REST/PatientER_GetDoctorFreeSlots';
|
||||
|
||||
var INSERT_LIVECARE_SCHEDULE_APPOINTMENT = 'Services/Doctors.svc/REST/InsertSpecificAppoitmentForSchedule';
|
||||
|
||||
var GET_PATIENT_SHARE_LIVECARE = "Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNOForLiveCare";
|
||||
|
||||
var SET_ONLINE_CHECKIN_FOR_APPOINTMENT = "Services/Patients.svc/REST/SetOnlineCheckInForAppointment";
|
||||
|
||||
var GET_LIVECARE_CLINIC_TIMING = 'Services/ER_VirtualCall.svc/REST/PatientER_GetClinicsServiceTimingsSchedule';
|
||||
|
||||
var GET_ER_APPOINTMENT_FEES = 'Services/DoctorApplication.svc/REST/GetERAppointmentFees';
|
||||
var GET_ER_APPOINTMENT_TIME = 'Services/ER_VirtualCall.svc/REST/GetRestTime';
|
||||
|
||||
var CHECK_PATIENT_DERMA_PACKAGE = 'Services/OUTPs.svc/REST/getPatientPackageComponentsForOnlineCheckIn';
|
||||
|
||||
var ADD_NEW_CALL_FOR_PATIENT_ER = 'Services/DoctorApplication.svc/REST/NewCallForPatientER';
|
||||
|
||||
var GET_LIVECARE_HISTORY = 'Services/ER_VirtualCall.svc/REST/GetPatientErVirtualHistory';
|
||||
var CANCEL_LIVECARE_REQUEST = 'Services/ER_VirtualCall.svc/REST/DeleteErRequest';
|
||||
var SEND_LIVECARE_INVOICE_EMAIL = 'Services/Notifications.svc/REST/SendInvoiceForLiveCare';
|
||||
|
||||
var CHANGE_PATIENT_ER_SESSION = 'Services/DoctorApplication.svc/REST/ChangePatientERSession';
|
||||
|
||||
var APPLE_PAY_INSERT_REQUEST = 'Services/PayFort_Serv.svc/REST/PayFort_ApplePayRequestData_Insert';
|
||||
|
||||
var GET_USER_TERMS = 'Services/Patients.svc/REST/GetUserTermsAndConditions';
|
||||
|
||||
var TAMARA_REQUEST_INSERT = 'Services/PayFort_Serv.svc/REST/AddTamaraRequest';
|
||||
|
||||
var UPDATE_HEALTH_TERMS = 'services/Patients.svc/REST/UpdatePateintHealthSummaryReport';
|
||||
|
||||
var GET_PATIENT_HEALTH_STATS = 'Services/Patients.svc/REST/Med_GetTransactionsSts';
|
||||
|
||||
var SEND_CHECK_IN_NFC_REQUEST = 'Services/Patients.svc/REST/Patient_CheckAppointmentValidation_ForNFC';
|
||||
|
||||
var CHECK_SCANNED_NFC_QR_CODE = 'Services/Patients.svc/REST/Patient_ValidationMachine_ForNFC';
|
||||
|
||||
var HAS_DENTAL_PLAN = 'Services/Doctors.svc/REST/Dental_IsPatientHasOnGoingEstimation';
|
||||
|
||||
var LASER_BODY_PARTS = 'Services/Patients.svc/REST/Laser_GetBodyPartsByCategory';
|
||||
|
||||
var INSERT_COVID_QUESTIONNAIRE = 'Services/Doctors.svc/REST/COVID19_Questionnarie_Insert';
|
||||
|
||||
var UPDATE_COVID_QUESTIONNAIRE = 'Services/Doctors.svc/REST/COVID19_Questionnarie_Update';
|
||||
|
||||
var GET_PATIENT_SHARE_FOR_WALKIN_APPOINTMENT = 'Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNOForWalkIn';
|
||||
|
||||
var CAN_PAY_FOR_FOR_WALKIN_APPOINTMENT = 'Services/Doctors.svc/REST/CanPayForWalkinAppointment';
|
||||
|
||||
//URL to get medicine and pharmacies list
|
||||
var CHANNEL = 3;
|
||||
var GENERAL_ID = 'Cs2020@2016\$2958';
|
||||
var IP_ADDRESS = '10.20.10.20';
|
||||
var VERSION_ID = 18.7;
|
||||
var SETUP_ID = '91877';
|
||||
var LANGUAGE = 2;
|
||||
// var PATIENT_OUT_SA = 0;
|
||||
var SESSION_ID = 'TMRhVmkGhOsvamErw';
|
||||
var IS_DENTAL_ALLOWED_BACKEND = false;
|
||||
var PATIENT_TYPE = 1;
|
||||
var PATIENT_TYPE_ID = 1;
|
||||
var DEVICE_TOKEN = "";
|
||||
var IS_VOICE_COMMAND_CLOSED = true;
|
||||
var IS_TEXT_COMPLETED = false;
|
||||
// var DeviceTypeID = Platform.isIOS ? 1 : 2;
|
||||
// var LANGUAGE_ID = 2;
|
||||
|
||||
var GET_PHARMCY_ITEMS = "Services/Lists.svc/REST/GetPharmcyItems_Region";
|
||||
var GET_PHARMACY_LIST = "Services/Patients.svc/REST/GetPharmcyList";
|
||||
var GET_PAtIENTS_INSURANCE = "Services/Patients.svc/REST/Get_PatientInsuranceDetails";
|
||||
var GET_PAtIENTS_INSURANCE_UPDATED = "Services/Patients.svc/REST/PatientER_GetPatientInsuranceCardUpdateHistory";
|
||||
|
||||
var INSURANCE_DETAILS = "Services/Patients.svc/REST/Get_InsuranceCheckList";
|
||||
var INSURANCE_SCHEMES = "Services/Patients.svc/REST/PatientER_SchemesOfAactiveCompaniesGet";
|
||||
var UPDATE_MANUAL_INSURANCE = "Services/Patients.svc/REST/PatientER_PatientInfoForInsuranceCardUpdate";
|
||||
var INSURANCE_COMPANIES = "Services/Patients.svc/REST/PatientER_InsuranceCompanyGet";
|
||||
var GET_PATIENT_INSURANCE_DETAILS = "Services/Patients.svc/REST/PatientER_GetPatientInsuranceDetails";
|
||||
var UPLOAD_INSURANCE_CARD = 'Services/Patients.svc/REST/PatientER_PatientInfoForInsuranceCardUpdate';
|
||||
|
||||
var GET_VACCINES = "Services/Patients.svc/REST/GetDoneVaccinesByPatientID";
|
||||
var GET_VACCINES_EMAIL = "Services/Notifications.svc/REST/SendVaccinesEmail";
|
||||
var GET_PAtIENTS_INSURANCE_APPROVALS = "Services/Patients.svc/REST/GetApprovalStatus_Async";
|
||||
// var GET_PAtIENTS_INSURANCE_APPROVALS = "Services/Patients.svc/REST/GetApprovalStatus";
|
||||
var SEARCH_BOT = 'HabibiChatBotApi/BotInterface/GetVoiceCommandResponse';
|
||||
|
||||
var GET_VACCINATIONS_ITEMS = "/Services/ERP.svc/REST/GET_VACCINATIONS_ITEMS";
|
||||
var GET_VACCINATION_ONHAND = "/Services/ERP.svc/REST/GET_VACCINATION_ONHAND";
|
||||
|
||||
var GET_PATIENT_SICK_LEAVE = 'Services/Patients.svc/REST/GetPatientSickLeave';
|
||||
|
||||
var GET_PATIENT_SICK_LEAVE_STATUS = 'Services/Patients.svc/REST/GetPatientSickLeave_Status';
|
||||
|
||||
var SendSickLeaveEmail = 'Services/Notifications.svc/REST/SendSickLeaveEmail';
|
||||
|
||||
var GET_PATIENT_AdVANCE_BALANCE_AMOUNT = 'Services/Patients.svc/REST/GetPatientAdvanceBalanceAmount';
|
||||
var GET_PATIENT_INFO_BY_ID = 'Services/Doctors.svc/REST/GetPatientInfoByPatientID';
|
||||
var GET_PATIENT_INFO_BY_ID_AND_MOBILE_NUMBER = 'Services/Patients.svc/REST/AP_GetPatientInfoByPatientIDandMobileNumber';
|
||||
var SEND_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT = 'Services/Authentication.svc/REST/SendActivationCodeForAdvancePayment';
|
||||
var CHECK_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT = 'Services/Authentication.svc/REST/CheckActivationCodeForAdvancePayment';
|
||||
|
||||
var GET_COVID_DRIVETHRU_PROJECT_LIST = 'Services/Doctors.svc/REST/COVID19_ProjectDriveThroughTestingCenter';
|
||||
|
||||
var GET_COVID_DRIVETHRU_PAYMENT_INFO = 'Services/Doctors.svc/REST/COVID19_GetPatientPaymentInormation';
|
||||
|
||||
var GET_COVID_DRIVETHRU_FREE_SLOTS = 'Services/Doctors.svc/REST/COVID19_GetFreeSlots';
|
||||
|
||||
var GET_COVID_DRIVETHRU_PROCEDURES_LIST = 'Services/Doctors.svc/REST/COVID19_GetTestProcedures';
|
||||
|
||||
///Smartwatch Integration Services
|
||||
var GET_PATIENT_LAST_RECORD = 'Services/Patients.svc/REST/Med_GetPatientLastRecord';
|
||||
var INSERT_PATIENT_HEALTH_DATA = 'Services/Patients.svc/REST/Med_InsertTransactions';
|
||||
|
||||
///My Trackers
|
||||
var GET_DIABETIC_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetDiabeticResultAverage';
|
||||
var GET_DIABTEC_RESULT = 'Services/Patients.svc/REST/Patient_GetDiabtecResults';
|
||||
var ADD_DIABTEC_RESULT = 'Services/Patients.svc/REST/Patient_AddDiabtecResult';
|
||||
|
||||
var GET_BLOOD_PRESSURE_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetBloodPressureResultAverage';
|
||||
var GET_BLOOD_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_GetBloodPressureResult';
|
||||
var ADD_BLOOD_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_AddBloodPressureResult';
|
||||
|
||||
var GET_WEIGHT_PRESSURE_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResultAverage';
|
||||
var GET_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResult';
|
||||
var ADD_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_AddWeightMeasurementResult';
|
||||
|
||||
var ADD_ACTIVE_PRESCRIPTIONS_REPORT_BY_PATIENT_ID = 'Services/Patients.svc/Rest/GetActivePrescriptionReportByPatientID';
|
||||
|
||||
var GET_CALL_INFO_HOURS_RESULT = 'Services/Doctors.svc/REST/GetCallInfoHoursResult';
|
||||
var GET_CALL_REQUEST_TYPE_LOV = 'Services/Doctors.svc/REST/GetCallRequestType_LOV';
|
||||
|
||||
var GET_QUESTION_TYPES = 'Services/OUTPs.svc/REST/getQuestionsTypes';
|
||||
|
||||
var UPDATE_DIABETIC_RESULT = 'Services/Patients.svc/REST/Patient_UpdateDiabeticResult';
|
||||
|
||||
var SEND_AVERAGE_BLOOD_SUGAR_REPORT = 'Services/Notifications.svc/REST/SendAverageBloodSugarReport';
|
||||
var DEACTIVATE_DIABETIC_STATUS = 'services/Patients.svc/REST/Patient_DeactivateDiabeticStatus';
|
||||
var DEACTIVATE_BLOOD_PRESSURES_STATUS = 'services/Patients.svc/REST/Patient_DeactivateBloodPressureStatus';
|
||||
|
||||
var UPDATE_BLOOD_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_UpdateBloodPressureResult';
|
||||
var SEND_AVERAGE_BLOOD_WEIGHT_REPORT = 'Services/Notifications.svc/REST/SendAverageBodyWeightReport';
|
||||
var SEND_AVERAGE_BLOOD_PRESSURE_REPORT = 'Services/Notifications.svc/REST/SendAverageBloodPressureReport';
|
||||
|
||||
var UPDATE_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_UpdateWeightMeasurementResult';
|
||||
var DEACTIVATE_WEIGHT_PRESSURE_RESULT = 'services/Patients.svc/REST/Patient_DeactivateWeightMeasurementStatus';
|
||||
var GET_DOCTOR_RESPONSE = 'Services/Patients.svc/REST/GetDoctorResponse';
|
||||
var UPDATE_READ_STATUS = 'Services/Patients.svc/REST/UpdateReadStatus';
|
||||
|
||||
var INSERT_CALL_INFO = 'Services/Doctors.svc/REST/InsertCallInfo';
|
||||
var INSERT_APPOINTMENT_QUESTION = 'Services/OUTPs.svc/REST/insertAppointmentQuestion';
|
||||
var RATE_DOCTOR_RESPONSE = 'Services/OUTPs.svc/REST/insertAppointmentQuestionRating';
|
||||
|
||||
var GET_PATIENT_ALLERGIES = 'Services/Patients.svc/REST/GetPatientAllergies';
|
||||
|
||||
// H2O
|
||||
var H2O_GET_USER_PROGRESS = "Services/H2ORemainder.svc/REST/H2O_GetUserProgress";
|
||||
var H2O_INSERT_USER_ACTIVITY = "Services/H2ORemainder.svc/REST/H2O_InsertUserActivity";
|
||||
var H2O_GET_USER_DETAIL = "Services/H2ORemainder.svc/REST/H2O_GetUserDetails_New";
|
||||
var H2O_UPDATE_USER_DETAIL = "Services/H2ORemainder.svc/REST/H2O_UpdateUserDetails_New";
|
||||
var H2O_UNDO_USER_ACTIVITY = "Services/H2ORemainder.svc/REST/H2o_UndoUserActivity";
|
||||
//E_Referral Services
|
||||
|
||||
var GET_ALL_RELATIONSHIP_TYPES = "Services/Patients.svc/REST/GetAllRelationshipTypes";
|
||||
var SEND_ACTIVATION_CODE_FOR_E_REFERRAL = 'Services/Authentication.svc/REST/SendActivationCodeForEReferral';
|
||||
var CHECK_ACTIVATION_CODE_FOR_E_REFERRAL = 'Services/Authentication.svc/REST/CheckActivationCodeForEReferral';
|
||||
var GET_ALL_CITIES = 'services/Lists.svc/rest/GetAllCities';
|
||||
var CREATE_E_REFERRAL = "Services/Patients.svc/REST/CreateEReferral";
|
||||
var GET_E_REFERRALS = "Services/Patients.svc/REST/GetEReferrals";
|
||||
|
||||
// Encillary Orders
|
||||
|
||||
var GET_ANCILLARY_ORDERS = 'Services/Doctors.svc/REST/GetOnlineAncillaryOrderList';
|
||||
|
||||
var GET_ANCILLARY_ORDERS_DETAILS = 'Services/Doctors.svc/REST/GetOnlineAncillaryOrderProcList';
|
||||
|
||||
//Pharmacy wishlist
|
||||
// var GET_WISHLIST = "http://swd-pharapp-01:7200/api/shopping_cart_items/";
|
||||
|
||||
var GET_DOCTOR_LIST_BY_TIME = "Services/Doctors.svc/REST/SearchDoctorsByTime";
|
||||
|
||||
// pharmacy
|
||||
var PHARMACY_AUTORZIE_CUSTOMER = "AutorizeCustomer";
|
||||
var PHARMACY_VERIFY_CUSTOMER = "VerifyCustomer";
|
||||
var PHARMACY_GET_COUNTRY = "countries";
|
||||
// var PHARMACY_CREATE_CUSTOMER = "epharmacy/api/CreateCustomer";
|
||||
var PHARMACY_CREATE_CUSTOMER = "getorcreateCustomer";
|
||||
var GET_PHARMACY_BANNER = "promotionbanners";
|
||||
var GET_PHARMACY_TOP_MANUFACTURER = "topmanufacturer";
|
||||
var GET_PHARMACY_BEST_SELLER_PRODUCT = "bestsellerproducts";
|
||||
var GET_PHARMACY_PRODUCTs_BY_IDS = "productsbyids/";
|
||||
var GET_PHARMACY_PRODUCTs_BY_SKU = "productbysku/";
|
||||
var GET_CUSTOMERS_ADDRESSES = "Customers/";
|
||||
var SUBSCRIBE_PRODUCT = "subscribe?";
|
||||
var GET_ORDER = "orders?";
|
||||
var GET_ORDER_DETAILS = "orders/";
|
||||
var ADD_CUSTOMER_ADDRESS = "addcustomeraddress";
|
||||
var EDIT_CUSTOMER_ADDRESS = "editcustomeraddress";
|
||||
var DELETE_CUSTOMER_ADDRESS = "deletecustomeraddress";
|
||||
var GET_ADDRESS = "Customers/";
|
||||
var GET_Cancel_ORDER = "cancelorder/";
|
||||
var WRITE_REVIEW = "Content-Type" + "text/plain; charset=utf-8";
|
||||
var GET_SHOPPING_CART = "shopping_cart_items/";
|
||||
var GET_SHIPPING_OPTIONS = "get_shipping_option/";
|
||||
var DELETE_SHOPPING_CART = "delete_shopping_cart_items/";
|
||||
var DELETE_SHOPPING_CART_ALL = "delete_shopping_cart_item_by_customer/";
|
||||
var ORDER_SHOPPING_CART = "orders";
|
||||
var GET_LACUM_ACCOUNT_INFORMATION = "Services/Patients.svc/REST/GetLakumAccountInformation";
|
||||
var GET_LACUM_GROUP_INFORMATION = "Services/Patients.svc/REST/GetlakumInQueryInfoGrouping";
|
||||
var LACUM_ACCOUNT_ACTIVATE = "Services/Patients.svc/REST/LakumAccountActivation";
|
||||
var LACUM_ACCOUNT_DEACTIVATE = "Services/Patients.svc/REST/LakumAccountDeactivation";
|
||||
var CREATE_LAKUM_ACCOUNT = "Services/Patients.svc/REST/PHR_CreateLakumAccount";
|
||||
var TRANSFER_YAHALA_LOYALITY_POINTS = "Services/Patients.svc/REST/TransferYaHalaLoyaltyPoints";
|
||||
var LAKUM_GET_USER_TERMS_AND_CONDITIONS = "Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy";
|
||||
|
||||
// var PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList';
|
||||
var PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList_Async';
|
||||
|
||||
var GET_RECOMMENDED_PRODUCT = 'alsoProduct/';
|
||||
var GET_MOST_VIEWED_PRODUCTS = "mostview";
|
||||
var GET_NEW_PRODUCTS = "newproducts";
|
||||
|
||||
// Home Health Care
|
||||
var HHC_GET_ALL_SERVICES = "Services/Patients.svc/REST/PatientER_HHC_GetAllServices";
|
||||
var HHC_GET_ALL_CMC_SERVICES = "Services/Patients.svc/REST/PatientER_CMC_GetAllServices";
|
||||
var PATIENT_ER_UPDATE_PRES_ORDER = "Services/Patients.svc/REST/PatientER_UpdatePresOrder";
|
||||
var GET_ORDER_DETAIL_BY_ID = "Services/Patients.svc/REST/PatientER_HHC_GetTransactionsForOrder";
|
||||
var GET_CMC_ORDER_DETAIL_BY_ID = "Services/Patients.svc/REST/PatientER_CMC_GetTransactionsForOrder";
|
||||
var GET_CHECK_UP_ITEMS = "Services/Patients.svc/REST/GetCheckUpItems";
|
||||
var PUSH_NOTIFICATION_GET_ALL_NOTIFICATIONS = 'Services/MobileNotifications.svc/REST/PushNotification_GetAllNotifications';
|
||||
var PUSH_NOTIFICATION_SET_MESSAGES_FROM_POOL_AS_READ = 'Services/MobileNotifications.svc/REST/PushNotification_SetMessagesFromPoolAsRead';
|
||||
var GET_PATIENT_ALL_PRES_ORD = 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders';
|
||||
var PATIENT_ER_INSERT_PRES_ORDER = 'Services/Patients.svc/REST/PatientER_InsertPresOrder';
|
||||
var BLOOD_DONATION_REGISTER_BLOOD_TYPE = 'Services/PatientVarification.svc/REST/BloodDonation_RegisterBloodType';
|
||||
var ADD_USER_AGREEMENT_FOR_BLOOD_DONATION = 'Services/PatientVarification.svc/REST/AddUserAgreementForBloodDonation';
|
||||
|
||||
// HHC RC SERVICES
|
||||
var HHC_GET_ALL_SERVICES_RC = "api/HHC/getallhhc";
|
||||
var ADD_HHC_ORDER_RC = "api/HHC/add";
|
||||
var GET_ALL_HHC_ORDERS_RC = 'api/hhc/list';
|
||||
var UPDATE_HHC_ORDER_RC = 'api/hhc/update';
|
||||
|
||||
// CMC RC SERVICES
|
||||
var GET_ALL_CMC_SERVICES_RC = 'api/cmc/getallcmc';
|
||||
var ADD_CMC_ORDER_RC = 'api/cmc/add';
|
||||
var GET_ALL_CMC_ORDERS_RC = 'api/cmc/list';
|
||||
var UPDATE_CMC_ORDER_RC = 'api/cmc/update';
|
||||
|
||||
// RRT RC SERVICES
|
||||
var ADD_RRT_ORDER_RC = "api/rrt/add";
|
||||
var GET_ALL_RRT_ORDERS_RC = "api/rrt/list";
|
||||
var UPDATE_RRT_ORDER_RC = 'api/rrt/update';
|
||||
|
||||
// PRESCRIPTION RC SERVICES
|
||||
var ADD_PRESCRIPTION_ORDER_RC = "api/prescription/add";
|
||||
var GET_ALL_PRESCRIPTION_ORDERS_RC = "api/prescription/list";
|
||||
var GET_ALL_PRESCRIPTION_INFO_RC = "api/Prescription/info";
|
||||
var UPDATE_PRESCRIPTION_ORDER_RC = 'api/prescription/update';
|
||||
|
||||
//Pharmacy wishlist
|
||||
var GET_WISHLIST = "shopping_cart_items/";
|
||||
var DELETE_WISHLIST = "delete_shopping_cart_item_by_product?customer_id=";
|
||||
var GET_REVIEW = "customerreviews/";
|
||||
var GET_BRANDS = "manufacturer";
|
||||
var GET_TOP_BRANDS = "topmanufacturer?page=1&limit=8";
|
||||
var GET_PRODUCT_DETAIL = "products/";
|
||||
var GET_LOCATION = "Services/Patients.svc/REST/GetPharmcyListBySKU";
|
||||
var GET_SPECIFICATION = "productspecification/";
|
||||
var GET_BRAND_ITEMS = "products";
|
||||
var PHARMACY_MAKE_REVIEW = 'insertreviews';
|
||||
|
||||
// External API
|
||||
var ADD_ADDRESS_INFO = "addcustomeraddress";
|
||||
var GET_CUSTOMER_ADDRESSES = "Customers/";
|
||||
var GET_CUSTOMER_INFO = "VerifyCustomer";
|
||||
|
||||
//Pharmacy
|
||||
|
||||
var GET_PHARMACY_CATEGORISE = 'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=0';
|
||||
var GET_OFFERS_CATEGORISE = 'discountcategories';
|
||||
var GET_OFFERS_PRODUCTS = 'offerproducts/';
|
||||
var GET_CATEGORISE_PARENT = 'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=';
|
||||
var GET_PARENT_PRODUCTS = 'products?categoryid=';
|
||||
var GET_SUB_CATEGORISE = 'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=';
|
||||
var GET_SUB_PRODUCTS = 'products?categoryid=';
|
||||
var GET_FINAL_PRODUCTS =
|
||||
'products?fields=id,reviews,discount_ids,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage&CategoryId=';
|
||||
var GET_CLINIC_CATEGORY = 'Services/Doctors.svc/REST/DP_GetClinicCategory';
|
||||
var GET_DISEASE_BY_CLINIC_ID = 'Services/Doctors.svc/REST/DP_GetDiseasesByClinicID';
|
||||
var SEARCH_DOCTOR_BY_TIME = 'Services/Doctors.svc/REST/SearchDoctorsByTime';
|
||||
|
||||
var TIMER_MIN = 10;
|
||||
|
||||
var GOOGLE_API_KEY = "AIzaSyCmevVlr2Bh-c8W1VUzo8gt8JRY7n5PANw";
|
||||
|
||||
var GET_BRANDS_LIST = 'categoryManufacturer?categoryids=';
|
||||
|
||||
var GET_SEARCH_PRODUCTS =
|
||||
'searchproducts?fields=id,discount_ids,reviews,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage&search_key=';
|
||||
|
||||
var SCAN_QR_CODE = 'productbysku/';
|
||||
|
||||
var FILTERED_PRODUCTS = 'products?categoryids=';
|
||||
|
||||
var GET_DOCTOR_LIST_CALCULATION = "Services/Doctors.svc/REST/GetCallculationDoctors";
|
||||
|
||||
var GET_ALL_APPOINTMENTS_FOR_DENTAL_CLINIC = "Services/Patients.svc/REST/GetDentalAppointments";
|
||||
|
||||
var GET_DENTAL_APPOINTMENT_INVOICE = "Services/Patients.svc/REST/HIS_eInvoiceForDentalByAppointmentNo";
|
||||
|
||||
var SEND_DENTAL_APPOINTMENT_INVOICE_EMAIL = "Services/Notifications.svc/REST/SendInvoiceForDental";
|
||||
|
||||
var GET_TAMARA_PLAN = 'https://mdlaboratories.com/tamaralive/Home/GetInstallments';
|
||||
|
||||
var GET_TAMARA_PAYMENT_STATUS = 'https://mdlaboratories.com/tamaralive/api/OnlineTamara/order_status?orderid=';
|
||||
|
||||
var UPDATE_TAMARA_STATUS = 'Services/PayFort_Serv.svc/REST/Tamara_UpdateRequestStatus';
|
||||
|
||||
var MARK_APPOINTMENT_TAMARA_STATUS = 'Services/Patients.svc/REST/MarkAppointmentForTamaraPayment_FromVida';
|
||||
|
||||
var AUTO_GENERATE_INVOICE_TAMARA = 'Services/PayFort_Serv.svc/REST/Tamara_GetinfoByAppointmentNo_AutoGenerateInvoice';
|
||||
|
||||
var GET_ONESIGNAL_VOIP_TOKEN = 'https://onesignal.com/api/v1/players';
|
||||
|
||||
var CANCEL_PHARMA_LIVECARE_REQUEST = 'https://vcallapi.hmg.com/api/PharmaLiveCare/SendPaymentStatus';
|
||||
|
||||
var INSERT_FREE_SLOTS_LOGS = 'Services/Doctors.svc/Rest/InsertDoctorFreeSlotsLogs';
|
||||
|
||||
var GET_NATIONALITY = 'Services/Lists.svc/REST/GetNationality';
|
||||
|
||||
var PAYFORT_TEST_URL = 'https://sbpaymentservices.payfort.com/FortAPI/paymentApi';
|
||||
var PAYFORT_PROD_URL = 'https://paymentservices.payfort.com/FortAPI/paymentApi';
|
||||
|
||||
// Check If InPatient API
|
||||
var CHECK_IF_INPATIENT = 'Services/Patients.svc/REST/GetInPatientAdmissionInfo';
|
||||
|
||||
var CHECK_IF_PATIENT_ADMITTED = 'Services/Inps.svc/REST/checkIsPatientAdmittedOrAdmissionRequest';
|
||||
|
||||
// Get General Instructions API
|
||||
var GET_GENERAL_INSTRUCTIONS = 'Services/INPs.svc/REST/getGeneralInstructions';
|
||||
|
||||
// Get Medical Instructions API
|
||||
var GET_MEDICAL_INSTRUCTIONS = 'Services/INPs.svc/REST/getPatientAdmissionRequest';
|
||||
|
||||
var GET_INPATIENT_ADVANCE_PAYMENT_REQUESTS = 'Services/INPs.svc/REST/getInpatientAdvancePendingPayment';
|
||||
|
||||
var GET_INPATIENT_PAID_ADVANCE_PAYMENT = 'Services/INPs.svc/REST/getInpatientAdvanceHistory';
|
||||
|
||||
var GET_INPATIENT_ADVANCE_PAYMENT_LINK = 'Services/PayFort_Serv.svc/REST/InsertInPatientAdvanceDetails';
|
||||
|
||||
var INSERT_INPATIENT_ORDER = 'Services/INPs.svc/REST/Inpcp_insertOrder';
|
||||
|
||||
var INPATIENT_DISCHARGE_MEDICATIONS = 'Services/INPs.svc/REST/chekPatientHasDischargeMedicine';
|
||||
|
||||
var GET_BIRTH_NOTIFICATION = 'Services/INPs.svc/REST/getBirthNotification_bymothermrn';
|
||||
|
||||
var SAVE_BIRTH_NOTIFICATION = 'Services/INPs.svc/REST/SaveBirthNotification';
|
||||
|
||||
var INSERT_GENERAL_ADMISSION_CONSENT = 'Services/INPs.svc/REST/Inp_insertAAForGeneralAdmissionConsent';
|
||||
|
||||
//Meal Plan APIs
|
||||
var GET_ADMITTED_PATIENTS = 'Services/MOP.svc/REST/GetAdmittedPatients';
|
||||
var GET_CURRENT_WEEKID_WEEKDAY = 'Services/MOP.svc/REST/GetCurrentWeekAndDayHMGMP';
|
||||
var GET_MEALS_OF_SCHEDULE_ID = 'Services/MOP.svc/REST/GetMealsOfScheduleID_Mobile';
|
||||
var GET_MEAL_ITEMS_OF_SCHEDULE_ID = 'Services/MOP.svc/REST/GetDefaultItemsOfScheduleID';
|
||||
var PLACE_MEAL_PLAN_ORDER = 'Services/MOP.svc/REST/UpdateOrMakeNewOrder';
|
||||
|
||||
var CHECK_PATIENT_NPHIES_ELIGIBILITY = 'Services/Doctors.svc/REST/checkPatientInsuranceCompanyValidity';
|
||||
var CONVERT_PATIENT_TO_CASH = 'Services/Doctors.svc/REST/deActivateInsuranceCompany';
|
||||
|
||||
var GET_BLOOD_DONATION_PROJECTS_LIST = 'Services/OUTPs.svc/REST/BD_getProjectsHaveBDClinics';
|
||||
|
||||
var GET_BLOOD_DONATION_FREE_SLOTS = 'Services/OUTPs.svc/REST/BD_GetFreeSlots';
|
||||
|
||||
var GET_WE_CARE_TOUR_URL = 'Services/Consent.svc/Rest/Consent_VirtualJurny_Url_GetByProjectID';
|
||||
|
||||
var GET_DENTAL_INSTRUCTIONS = 'Services/OUTPs.svc/Rest/getProcedureNotification';
|
||||
|
||||
var INSERT_WALKIN_APPOINTMENT = "Services/Doctors.svc/REST/InsertWalkinAppointment";
|
||||
|
||||
//Usage Agreement APIs
|
||||
var CHECK_USAGE_AGREEMENT = "Services/Patients.svc/REST/CheckForUsageAgreement";
|
||||
var GET_USAGE_AGREEMENT = "Services/Patients.svc/REST/GetUsageAgreementText";
|
||||
var ADD_USAGE_AGREEMENT = "Services/Patients.svc/REST/AddUsageAgreement";
|
||||
|
||||
var GET_ER_ONLINE_PAYMENT_DETAILS = 'Services/OUTPs.svc/Rest/Outp_GetPatientPaymentInformationForERClinic';
|
||||
|
||||
var AUTO_GENERATE_INVOICE_ER = 'Services/OUTPs.svc/Rest/Outp_AutoGenerateInvoiceForER';
|
||||
|
||||
var CHECK_IF_PATIENT_ARRIVED_ER_ONLINE_CHECKIN = 'Services/OUTPs.svc/Rest/IsPatientArrived';
|
||||
|
||||
var CHECK_PATIENT_ER_ADVANCE_BALANCE = 'Services/OUTPs.svc/Rest/getPatientAdvanceBalanceAmountByClinic';
|
||||
|
||||
var GET_PROJECT_FROM_NFC = 'Services/OUTPs.svc/Rest/GetProjectByNFC';
|
||||
|
||||
var GET_PATIENT_OCCUPATION_LIST = 'Services/Authentication.svc/REST/GetPatientOccupation';
|
||||
|
||||
var IS_DOCTOR_AVAILABLE_BY_CALENDAR_SCHEDULE = 'Services/OUTPs.svc/REST/HIS_IsDoctorAvailableByCalendarSchedule';
|
||||
|
||||
//PAYFORT
|
||||
var getPayFortProjectDetails = "Services/PayFort_Serv.svc/REST/GetPayFortProjectDetails";
|
||||
var addPayFortApplePayResponse = "Services/PayFort_Serv.svc/REST/AddResponse";
|
||||
// var payFortEnvironment = FortEnvironment.production;
|
||||
var applePayMerchantId = "merchant.com.hmgwebservices";
|
||||
// var payFortEnvironment = FortEnvironment.test;
|
||||
// var applePayMerchantId = "merchant.com.hmgwebservices.uat";
|
||||
|
||||
|
||||
|
||||
// Auth Provider Consts
|
||||
|
||||
|
||||
const String INSERT_DEVICE_IMEI = 'Services/Patients.svc/REST/Patient_INSERTDeviceIMEI';
|
||||
const String SELECT_DEVICE_IMEI = 'Services/Patients.svc/REST/Patient_SELECTDeviceIMEIbyIMEI';
|
||||
const String CHECK_PATIENT_AUTH = 'Services/Authentication.svc/REST/CheckPatientAuthentication';
|
||||
const GET_MOBILE_INFO = 'Services/Authentication.svc/REST/GetMobileLoginInfo';
|
||||
const SEND_ACTIVATION_CODE = 'Services/Authentication.svc/REST/SendActivationCodebyOTPNotificationType';
|
||||
|
||||
const SEND_ACTIVATION_CODE_REGISTER = 'Services/Authentication.svc/REST/SendActivationCodebyOTPNotificationTypeForRegistration';
|
||||
const CHECK_ACTIVATION_CODE = 'Services/Authentication.svc/REST/CheckActivationCode';
|
||||
const CHECK_ACTIVATION_CODE_REGISTER = 'Services/Authentication.svc/REST/CheckActivationCodeForRegistration';
|
||||
|
||||
const FORGOT_PASSWORD = 'Services/Authentication.svc/REST/CheckActivationCodeForSendFileNo';
|
||||
const CHECK_PATIENT_FOR_REGISTRATION = "Services/Authentication.svc/REST/CheckPatientForRegisteration";
|
||||
|
||||
const CHECK_USER_STATUS = "Services/NHIC.svc/REST/GetPatientInfo";
|
||||
const REGISTER_USER = 'Services/Authentication.svc/REST/PatientRegistration';
|
||||
const LOGGED_IN_USER_URL = 'Services/MobileNotifications.svc/REST/Insert_PatientMobileDeviceInfo';
|
||||
|
||||
const FORGOT_PATIENT_ID = 'Services/Authentication.svc/REST/SendPatientIDSMSByMobileNumber';
|
||||
const DASHBOARD = 'Services/Patients.svc/REST/PatientDashboard';
|
||||
const PROFILE_SETTING = 'Services/Patients.svc/REST/GetPateintInfoForUpdate';
|
||||
const SAVE_SETTING = 'Services/Patients.svc/REST/UpdatePateintInfo';
|
||||
|
||||
const DEACTIVATE_ACCOUNT = 'Services/Patients.svc/REST/PatientAppleActivation_InsertUpdate';
|
||||
|
||||
|
||||
|
||||
class ApiConsts {
|
||||
static const maxSmallScreen = 660;
|
||||
|
||||
static bool isDevelopment = true;
|
||||
|
||||
// static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT
|
||||
static String baseUrl = 'https://hmgwebservices.com/'; // HIS API URL PROD
|
||||
|
||||
static String SELECT_DEVICE_IMEI = 'Services/Patients.svc/REST/Patient_SELECTDeviceIMEIbyIMEI';
|
||||
|
||||
static num VERSION_ID = 18.9;
|
||||
|
||||
static final String selectDeviceImei = 'Services/Patients.svc/REST/Patient_SELECTDeviceIMEIbyIMEI';
|
||||
static final String sendActivationCode = 'Services/Authentication.svc/REST/SendActivationCodebyOTPNotificationType';
|
||||
|
||||
|
||||
|
||||
static setBackendURLs() {
|
||||
if (isDevelopment) {
|
||||
baseUrl = "https://uat.hmgwebservices.com/";
|
||||
} else {
|
||||
baseUrl = "https://hmgwebservices.com/";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static final Map<String, String> packagesAuthHeader = {};
|
||||
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
class GenericApiModel<T> {
|
||||
final int? messageStatus;
|
||||
final String? errorMessage;
|
||||
final int? statusCode;
|
||||
final T? data;
|
||||
|
||||
GenericApiModel({
|
||||
this.messageStatus,
|
||||
this.errorMessage,
|
||||
this.statusCode,
|
||||
this.data,
|
||||
});
|
||||
|
||||
factory GenericApiModel.fromJson(
|
||||
Map<String, dynamic> json,
|
||||
T Function(Object? json)? fromJsonT,
|
||||
) {
|
||||
return GenericApiModel<T>(
|
||||
messageStatus: json['messageStatus'] as int?,
|
||||
errorMessage: json['errorMessage'] as String?,
|
||||
statusCode: json['statusCode'] as int?,
|
||||
data: fromJsonT != null ? fromJsonT(json['data']) : json['data'] as T?,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson(Object Function(T value)? toJsonT) {
|
||||
return {
|
||||
'messageStatus': messageStatus,
|
||||
'errorMessage': errorMessage,
|
||||
'statusCode': statusCode,
|
||||
'data': toJsonT != null && data != null ? toJsonT(data as T) : data,
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,91 @@
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:hmg_patient_app_new/core/api/api_client.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_state.dart';
|
||||
import 'package:injector/injector.dart';
|
||||
import 'package:hmg_patient_app_new/core/location_util.dart';
|
||||
import 'package:hmg_patient_app_new/features/authentication/authentication_repo.dart';
|
||||
import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_repo.dart';
|
||||
import 'package:hmg_patient_app_new/features/common/common_repo.dart';
|
||||
import 'package:hmg_patient_app_new/features/lab/lab_repo.dart';
|
||||
import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_repo.dart';
|
||||
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
|
||||
import 'package:hmg_patient_app_new/services/cache_service.dart';
|
||||
import 'package:hmg_patient_app_new/services/dialog_service.dart';
|
||||
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
|
||||
import 'package:hmg_patient_app_new/services/logger_service.dart';
|
||||
import 'package:hmg_patient_app_new/services/navigation_service.dart';
|
||||
import 'package:logger/web.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
GetIt getIt = GetIt.instance;
|
||||
|
||||
class AppDependencies {
|
||||
static void addDependencies() {
|
||||
Injector injector = Injector.appInstance;
|
||||
injector.registerSingleton<AppState>(() => AppState());
|
||||
static Future<void> addDependencies() async {
|
||||
Logger logger = Logger(
|
||||
printer: PrettyPrinter(
|
||||
methodCount: 2,
|
||||
errorMethodCount: 5,
|
||||
lineLength: 100,
|
||||
colors: true,
|
||||
printEmojis: true,
|
||||
),
|
||||
);
|
||||
|
||||
// Core Services
|
||||
getIt.registerLazySingleton<LoggerService>(() => LoggerServiceImp(logger: logger));
|
||||
getIt.registerLazySingleton<NavigationService>(() => NavigationService());
|
||||
getIt.registerLazySingleton<GAnalytics>(() => GAnalytics());
|
||||
getIt.registerLazySingleton<AppState>(() => AppState(navigationService: getIt()));
|
||||
getIt.registerLazySingleton<LocationUtils>(() => LocationUtils(
|
||||
isShowConfirmDialog: false,
|
||||
navigationService: getIt(),
|
||||
appState: getIt(),
|
||||
));
|
||||
getIt.registerLazySingleton<DialogService>(() => DialogServiceImp(navigationService: getIt<NavigationService>()));
|
||||
getIt.registerLazySingleton<ErrorHandlerService>(() => ErrorHandlerServiceImp(
|
||||
dialogService: getIt(),
|
||||
loggerService: getIt(),
|
||||
navigationService: getIt(),
|
||||
));
|
||||
|
||||
final sharedPreferences = await SharedPreferences.getInstance();
|
||||
getIt.registerLazySingleton<CacheService>(() => CacheServiceImp(sharedPreferences: sharedPreferences));
|
||||
getIt.registerLazySingleton<ApiClient>(() => ApiClientImp(loggerService: getIt(), dialogService: getIt(), appState: getIt()));
|
||||
|
||||
// Repositories
|
||||
getIt.registerLazySingleton<CommonRepo>(() => CommonRepoImp(loggerService: getIt()));
|
||||
getIt.registerLazySingleton<AuthenticationRepo>(() => AuthenticationRepoImp(loggerService: getIt<LoggerService>(), apiClient: getIt()));
|
||||
getIt.registerLazySingleton<BookAppointmentsRepo>(() => BookAppointmentsRepoImp(loggerService: getIt<LoggerService>(), apiClient: getIt()));
|
||||
getIt.registerLazySingleton<MyAppointmentsRepo>(() => MyAppointmentsRepoImp(loggerService: getIt<LoggerService>(), apiClient: getIt()));
|
||||
getIt.registerLazySingleton<LabRepo>(() => LabRepoImp(loggerService: getIt<LoggerService>(), apiClient: getIt()));
|
||||
|
||||
// ViewModels
|
||||
// Global/shared VMs → LazySingleton
|
||||
|
||||
getIt.registerLazySingleton<LabViewModel>(
|
||||
() => LabViewModel(
|
||||
labRepo: getIt(),
|
||||
errorHandlerService: getIt(),
|
||||
),
|
||||
);
|
||||
|
||||
getIt.registerLazySingleton<AuthenticationViewModel>(
|
||||
() => AuthenticationViewModel(
|
||||
authenticationRepo: getIt(),
|
||||
dialogService: getIt(),
|
||||
appState: getIt(),
|
||||
errorHandlerService: getIt(),
|
||||
),
|
||||
);
|
||||
|
||||
// Screen-specific VMs → Factory
|
||||
// getIt.registerFactory<BookAppointmentsViewModel>(
|
||||
// () => BookAppointmentsViewModel(
|
||||
// bookAppointmentsRepo: getIt(),
|
||||
// dialogService: getIt(),
|
||||
// errorHandlerService: getIt(),
|
||||
// ),
|
||||
// );
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,66 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
abstract class Failure extends Equatable implements Exception {
|
||||
final String message;
|
||||
|
||||
const Failure(this.message);
|
||||
}
|
||||
|
||||
class ServerFailure extends Failure {
|
||||
const ServerFailure(super.message);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [message];
|
||||
}
|
||||
|
||||
class StatusCodeFailure extends Failure {
|
||||
const StatusCodeFailure(super.message);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [message];
|
||||
}
|
||||
|
||||
class ConnectivityFailure extends Failure {
|
||||
const ConnectivityFailure(super.message);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [message];
|
||||
}
|
||||
|
||||
class LocalStorageFailure extends Failure {
|
||||
const LocalStorageFailure(super.message);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [message];
|
||||
}
|
||||
|
||||
class DataParsingFailure extends Failure {
|
||||
const DataParsingFailure(super.message);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [message];
|
||||
}
|
||||
|
||||
class UnknownFailure extends Failure {
|
||||
const UnknownFailure(super.message);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [message];
|
||||
}
|
||||
|
||||
|
||||
class DuplicateUsername extends Failure {
|
||||
const DuplicateUsername(String? message) : super(message ?? '');
|
||||
|
||||
@override
|
||||
List<Object?> get props => [message];
|
||||
}
|
||||
|
||||
class InvalidCredentials extends Failure {
|
||||
const InvalidCredentials(String? message) : super(message ?? '');
|
||||
|
||||
@override
|
||||
List<Object?> get props => [message];
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,487 @@
|
||||
import 'package:device_calendar/device_calendar.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class DateUtil {
|
||||
/// convert String To Date function
|
||||
/// [date] String we want to convert
|
||||
static DateTime convertStringToDate(String? date) {
|
||||
if (date != null) {
|
||||
const start = "/Date(";
|
||||
const end = "+0300)";
|
||||
final startIndex = date.indexOf(start);
|
||||
final endIndex = date.indexOf(end, startIndex + start.length);
|
||||
return DateTime.fromMillisecondsSinceEpoch(int.parse(
|
||||
date.substring(startIndex + start.length, endIndex),
|
||||
));
|
||||
} else {
|
||||
return DateTime.now();
|
||||
}
|
||||
}
|
||||
|
||||
static DateTime convertStringToDateSaudiTimezone(String date, int projectId) {
|
||||
if (date != null) {
|
||||
const start = "/Date(";
|
||||
const end = "+0300)";
|
||||
final startIndex = date.indexOf(start);
|
||||
final endIndex = date.indexOf(end, startIndex + start.length);
|
||||
// if (projectId == 2 || projectId == 3) {
|
||||
// return DateTime.fromMillisecondsSinceEpoch(
|
||||
// int.parse(
|
||||
// date.substring(startIndex + start.length, endIndex),
|
||||
// ),
|
||||
// isUtc: true)
|
||||
// .add(Duration(hours: 4));
|
||||
// } else {
|
||||
return DateTime.fromMillisecondsSinceEpoch(
|
||||
int.parse(
|
||||
date.substring(startIndex + start.length, endIndex),
|
||||
),
|
||||
isUtc: true)
|
||||
.add(Duration(hours: 3));
|
||||
// }
|
||||
} else {
|
||||
return DateTime.now();
|
||||
}
|
||||
}
|
||||
|
||||
static DateTime convertStringToDateNoTimeZone(String date) {
|
||||
// /Date(1585774800000+0300)/
|
||||
if (date != null) {
|
||||
const start = "/Date(";
|
||||
const end = ")";
|
||||
final startIndex = date.indexOf(start);
|
||||
final endIndex = date.indexOf(end, startIndex + start.length);
|
||||
return DateTime.fromMillisecondsSinceEpoch(
|
||||
int.parse(
|
||||
date.substring(startIndex + start.length, endIndex),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return DateTime.now();
|
||||
}
|
||||
}
|
||||
|
||||
static DateTime convertStringToDateTime(String? date) {
|
||||
if (date != null) {
|
||||
try {
|
||||
var dateT = date.split('/');
|
||||
var year = dateT[2].substring(0, 4);
|
||||
var dateP = DateTime(int.parse(year), int.parse(dateT[1]), int.parse(dateT[0]));
|
||||
return dateP;
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
|
||||
return DateTime.now();
|
||||
} else {
|
||||
return DateTime.now();
|
||||
}
|
||||
}
|
||||
|
||||
static String convertDateToString(DateTime date) {
|
||||
const start = "/Date(";
|
||||
const end = "+0300)/";
|
||||
int milliseconds = date.millisecondsSinceEpoch;
|
||||
|
||||
return start + "$milliseconds" + end;
|
||||
}
|
||||
|
||||
static String convertDateToStringLocation(DateTime date) {
|
||||
const start = "/Date(";
|
||||
const end = ")/";
|
||||
int milliseconds = date.millisecondsSinceEpoch;
|
||||
|
||||
return start + "$milliseconds" + end;
|
||||
}
|
||||
|
||||
static String convertTime(String timeStr) {
|
||||
TimeOfDay time = TimeOfDay(hour: int.parse(timeStr.split(":")[0]), minute: int.parse(timeStr.split(":")[1])); // 24-hour format time
|
||||
|
||||
int hour = time.hourOfPeriod; // get hour in 12-hour format
|
||||
String meridiem = time.period == DayPeriod.am ? "AM" : "PM"; // get AM/PM
|
||||
|
||||
String convertedTime = '$hour:${time.minute == 0 ? "00" : time.minute} $meridiem'; // create the new time string
|
||||
|
||||
return convertedTime;
|
||||
}
|
||||
|
||||
static String formatDateToDate(DateTime date, bool isArabic) {
|
||||
return DateFormat('dd MMM yyy', isArabic ? "ar_SA" : "en_US").format(date);
|
||||
}
|
||||
|
||||
static String formatDateToTime(DateTime date) {
|
||||
return DateFormat('hh:mm a').format(date);
|
||||
}
|
||||
|
||||
static String yearMonthDay(DateTime dateTime) {
|
||||
String dateFormat = '${dateTime.year}-${dateTime.month}-${dateTime.day}';
|
||||
return dateFormat;
|
||||
}
|
||||
|
||||
static String time(DateTime dateTime) {
|
||||
String dateFormat = '${dateTime.hour}:${dateTime.minute}:00';
|
||||
return dateFormat;
|
||||
}
|
||||
|
||||
static String convertDateMSToJsonDate(utc) {
|
||||
var dt = new DateTime.fromMicrosecondsSinceEpoch(utc);
|
||||
|
||||
return "/Date(" + (dt.millisecondsSinceEpoch * 1000).toString() + '+0300' + ")/";
|
||||
}
|
||||
|
||||
/// check Date
|
||||
/// [dateString] String we want to convert
|
||||
static String checkDate(DateTime checkedTime) {
|
||||
DateTime currentTime = DateTime.now();
|
||||
if ((currentTime.year == checkedTime.year) && (currentTime.month == checkedTime.month) && (currentTime.day == checkedTime.day)) {
|
||||
return "Today";
|
||||
} else if ((currentTime.year == checkedTime.year) && (currentTime.month == checkedTime.month)) {
|
||||
if ((currentTime.day - checkedTime.day) == 1) {
|
||||
return "YESTERDAY";
|
||||
} else if ((currentTime.day - checkedTime.day) == -1) {
|
||||
return "Tomorrow";
|
||||
}
|
||||
|
||||
if ((currentTime.day - checkedTime.day) <= -2) {
|
||||
return "Next Week";
|
||||
} else {
|
||||
return "Old Date";
|
||||
}
|
||||
}
|
||||
return "Old Date";
|
||||
}
|
||||
|
||||
static String getDateFormatted(String date) {
|
||||
DateTime dateObj = DateUtil.convertStringToDate(date);
|
||||
return DateUtil.getWeekDay(dateObj.weekday) + ", " + dateObj.day.toString() + " " + DateUtil.getMonth(dateObj.month) + " " + dateObj.year.toString();
|
||||
}
|
||||
|
||||
static String getISODateFormat(DateTime dateTime) {
|
||||
// 2020-04-30T00:00:00.000
|
||||
return dateTime.toIso8601String();
|
||||
}
|
||||
|
||||
/// get month by
|
||||
/// [month] convert month number in to month name
|
||||
static getMonth(int month) {
|
||||
switch (month) {
|
||||
case 1:
|
||||
return "January";
|
||||
case 2:
|
||||
return "February";
|
||||
case 3:
|
||||
return "March";
|
||||
case 4:
|
||||
return "April";
|
||||
case 5:
|
||||
return "May";
|
||||
case 6:
|
||||
return "June";
|
||||
case 7:
|
||||
return "July";
|
||||
case 8:
|
||||
return "August";
|
||||
case 9:
|
||||
return "September";
|
||||
case 10:
|
||||
return "October";
|
||||
case 11:
|
||||
return "November";
|
||||
case 12:
|
||||
return "December";
|
||||
}
|
||||
}
|
||||
|
||||
/// get month by
|
||||
/// [month] convert month number in to month name in Arabic
|
||||
static getMonthArabic(int month) {
|
||||
switch (month) {
|
||||
case 1:
|
||||
return "يناير";
|
||||
case 2:
|
||||
return " فبراير";
|
||||
case 3:
|
||||
return "مارس";
|
||||
case 4:
|
||||
return "أبريل";
|
||||
case 5:
|
||||
return "مايو";
|
||||
case 6:
|
||||
return "يونيو";
|
||||
case 7:
|
||||
return "يوليو";
|
||||
case 8:
|
||||
return "أغسطس";
|
||||
case 9:
|
||||
return "سبتمبر";
|
||||
case 10:
|
||||
return " اكتوبر";
|
||||
case 11:
|
||||
return " نوفمبر";
|
||||
case 12:
|
||||
return "ديسمبر";
|
||||
}
|
||||
}
|
||||
|
||||
static getMonthByName(String month) {
|
||||
switch (month.toLowerCase()) {
|
||||
case 'january':
|
||||
return 1;
|
||||
case 'february':
|
||||
return 2;
|
||||
case 'march':
|
||||
return 3;
|
||||
case 'april':
|
||||
return 4;
|
||||
case 'may':
|
||||
return 5;
|
||||
case 'june':
|
||||
return 6;
|
||||
case 'july':
|
||||
return 7;
|
||||
case 'august':
|
||||
return 8;
|
||||
case 'september':
|
||||
return 9;
|
||||
case 'october':
|
||||
return 10;
|
||||
case 'november':
|
||||
return 11;
|
||||
case 'december':
|
||||
return 12;
|
||||
}
|
||||
}
|
||||
|
||||
static getMonthDateTime(String month, yearName) {
|
||||
DateTime? date;
|
||||
try {
|
||||
date = DateTime(int.parse(yearName), getMonthByName(month));
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
return date ?? DateTime.now();
|
||||
}
|
||||
|
||||
/// get month by
|
||||
/// [weekDay] convert week day in int to week day name
|
||||
static getWeekDay(int weekDay) {
|
||||
switch (weekDay) {
|
||||
case 1:
|
||||
return "Monday";
|
||||
case 2:
|
||||
return "Tuesday";
|
||||
case 3:
|
||||
return "Wednesday";
|
||||
case 4:
|
||||
return "Thursday";
|
||||
case 5:
|
||||
return "Friday";
|
||||
case 6:
|
||||
return "Saturday ";
|
||||
case 7:
|
||||
return "Sunday";
|
||||
}
|
||||
}
|
||||
|
||||
/// get month by
|
||||
/// [weekDay] convert week day in int to week day name arabic
|
||||
static getWeekDayArabic(int weekDay) {
|
||||
switch (weekDay) {
|
||||
case 1:
|
||||
return "الاثنين";
|
||||
case 2:
|
||||
return "الثلاثاء";
|
||||
case 3:
|
||||
return "الاربعاء";
|
||||
case 4:
|
||||
return "الخميس";
|
||||
case 5:
|
||||
return "الجمعه";
|
||||
case 6:
|
||||
return "السبت ";
|
||||
case 7:
|
||||
return "الاحد";
|
||||
}
|
||||
}
|
||||
|
||||
static getWeekDayEnglish(int weekDay) {
|
||||
switch (weekDay) {
|
||||
case 1:
|
||||
return "Monday";
|
||||
case 2:
|
||||
return "Tuesday";
|
||||
case 3:
|
||||
return "Wednesday";
|
||||
case 4:
|
||||
return "Thursday";
|
||||
case 5:
|
||||
return "Friday";
|
||||
case 6:
|
||||
return "Saturday ";
|
||||
case 7:
|
||||
return "Sunday";
|
||||
}
|
||||
}
|
||||
|
||||
/// get data formatted like Apr 26,2020
|
||||
/// [dateTime] convert DateTime to data formatted
|
||||
static String getMonthDayYearDateFormatted(DateTime dateTime) {
|
||||
if (dateTime != null) {
|
||||
return getMonth(dateTime.month) + " " + dateTime.day.toString() + ", " + dateTime.year.toString();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/// get data formatted like Apr 26,2020
|
||||
/// [dateTime] convert DateTime to data formatted Arabic
|
||||
static String getMonthDayYearDateFormattedAr(DateTime dateTime) {
|
||||
if (dateTime != null) {
|
||||
return getMonthArabic(dateTime.month) + " " + dateTime.day.toString() + ", " + dateTime.year.toString();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/// get data formatted like Thursday, Apr 26,2020
|
||||
/// [dateTime] convert DateTime to date formatted
|
||||
static String getWeekDayMonthDayYearDateFormatted(DateTime dateTime, String lang) {
|
||||
if (dateTime != null) {
|
||||
return lang == 'en'
|
||||
? getWeekDayEnglish(dateTime.weekday) + ", " + getMonth(dateTime.month) + " " + dateTime.day.toString() + " " + dateTime.year.toString()
|
||||
: getWeekDayArabic(dateTime.weekday) + ", " + dateTime.day.toString() + " " + getMonthArabic(dateTime.month) + " " + dateTime.year.toString();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
static String getMonthDayYearLangDateFormatted(DateTime dateTime, String lang) {
|
||||
if (dateTime != null) {
|
||||
return lang == 'en'
|
||||
? getMonth(dateTime.month) + " " + dateTime.day.toString() + " " + dateTime.year.toString()
|
||||
: dateTime.day.toString() + " " + getMonthArabic(dateTime.month) + " " + dateTime.year.toString();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/// get data formatted like 26/4/2020
|
||||
static String getDayMonthYearLangDateFormatted(DateTime dateTime, String lang) {
|
||||
if (dateTime != null) {
|
||||
return lang == 'en'
|
||||
? dateTime.day.toString() + " " + getMonth(dateTime.month) + " " + dateTime.year.toString()
|
||||
: dateTime.day.toString() + " " + getMonthArabic(dateTime.month) + " " + dateTime.year.toString();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
static String getMonthYearLangDateFormatted(DateTime dateTime, String lang) {
|
||||
if (dateTime != null) {
|
||||
return lang == 'en' ? getMonth(dateTime.month) + " " + dateTime.year.toString() : getMonthArabic(dateTime.month) + " " + dateTime.year.toString();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/// get data formatted like 26/4/2020
|
||||
/// [dateTime] convert DateTime to data formatted
|
||||
static String getDayMonthYearDateFormatted(DateTime dateTime) {
|
||||
if (dateTime != null) {
|
||||
return dateTime.day.toString() + "/" + dateTime.month.toString() + "/" + dateTime.year.toString();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/// get data formatted like 26/4/2020
|
||||
/// [dateTime] convert DateTime to data formatted
|
||||
static String getDayMonthDateFormatted(DateTime dateTime) {
|
||||
if (dateTime != null) {
|
||||
return DateFormat('dd/MM').format(dateTime);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/// get data formatted like 26/4/2020
|
||||
/// [dateTime] convert DateTime to data formatted according to language
|
||||
static String getDayMonthYearDateFormattedLang(DateTime dateTime, bool isArabic) {
|
||||
if (dateTime != null) {
|
||||
return DateFormat('dd/MM/yyyy', isArabic ? "ar_SA" : "en_US").format(dateTime);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/// get data formatted like 10:30 according to lang
|
||||
static String formatDateToTimeLang(DateTime date, bool isArabic) {
|
||||
return DateFormat('HH:mm', isArabic ? "ar_SA" : "en_US").format(date);
|
||||
}
|
||||
|
||||
/// get data formatted like 26/4/2020 10:30
|
||||
/// [dateTime] convert DateTime to data formatted
|
||||
static String getDayMonthYearHourMinuteDateFormatted(DateTime dateTime) {
|
||||
if (dateTime != null) {
|
||||
return dateTime.day.toString() + "/" + dateTime.month.toString() + "/" + dateTime.year.toString() + " " + DateFormat('HH:mm').format(dateTime);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/// get data formatted like 2020-8-13 09:43:00
|
||||
/// [dateTime] convert DateTime to data formatted
|
||||
static String getYearMonthDayHourMinSecDateFormatted(DateTime dateTime) {
|
||||
if (dateTime != null) {
|
||||
return dateTime.year.toString() +
|
||||
"-" +
|
||||
dateTime.month.toString() +
|
||||
"-" +
|
||||
dateTime.day.toString() +
|
||||
" " +
|
||||
dateTime.hour.toString() +
|
||||
":" +
|
||||
dateTime.minute.toString() +
|
||||
":" +
|
||||
dateTime.second.toString();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
static String getFormattedDate(DateTime dateTime, String formattedString) {
|
||||
return DateFormat(formattedString).format(dateTime);
|
||||
}
|
||||
|
||||
static convertISODateToJsonDate(String isoDate) {
|
||||
return "/Date(" + DateFormat('mm-dd-yyy').parse(isoDate).millisecondsSinceEpoch.toString() + ")/";
|
||||
}
|
||||
|
||||
static String getDay(DayOfWeek dayOfWeek) {
|
||||
switch (dayOfWeek) {
|
||||
case DayOfWeek.Monday:
|
||||
return "Monday";
|
||||
break;
|
||||
case DayOfWeek.Tuesday:
|
||||
return "Tuesday";
|
||||
break;
|
||||
case DayOfWeek.Wednesday:
|
||||
return "Wednesday";
|
||||
break;
|
||||
case DayOfWeek.Thursday:
|
||||
return "Thursday";
|
||||
break;
|
||||
case DayOfWeek.Friday:
|
||||
return "Friday";
|
||||
break;
|
||||
case DayOfWeek.Saturday:
|
||||
return "Saturday";
|
||||
break;
|
||||
case DayOfWeek.Sunday:
|
||||
return "Sunday";
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
import 'package:hmg_patient_app_new/core/enums.dart';
|
||||
import 'package:hmg_patient_app_new/features/authentication/models/request_models/send_activation_request_model.dart';
|
||||
|
||||
class RequestUtils {
|
||||
static dynamic getCommonRequestWelcome({
|
||||
required String phoneNumber,
|
||||
required OTPTypeEnum otpTypeEnum,
|
||||
required String? deviceToken,
|
||||
required bool patientOutSA,
|
||||
required String? loginTokenID,
|
||||
required var registeredData,
|
||||
required int? patientId,
|
||||
required String nationIdText,
|
||||
required String countryCode,
|
||||
}) {
|
||||
bool fileNo = false;
|
||||
if (nationIdText.isNotEmpty) {
|
||||
fileNo = nationIdText.length < 10;
|
||||
}
|
||||
var request = SendActivationRequest();
|
||||
request.patientMobileNumber = int.parse(phoneNumber);
|
||||
request.mobileNo = '0$phoneNumber';
|
||||
request.deviceToken = deviceToken;
|
||||
request.projectOutSA = patientOutSA;
|
||||
request.loginType = otpTypeEnum.toInt();
|
||||
request.oTPSendType = otpTypeEnum.toInt(); // could map OTPTypeEnum if needed
|
||||
request.zipCode = countryCode; // or countryCode if defined elsewhere
|
||||
request.logInTokenID = loginTokenID ?? "";
|
||||
|
||||
if (registeredData != null) {
|
||||
request.searchType = registeredData.searchType ?? 1;
|
||||
request.patientID = registeredData.patientID ?? 0;
|
||||
request.patientIdentificationID = request.nationalID = registeredData.patientIdentificationID ?? '0';
|
||||
request.dob = registeredData.dob;
|
||||
request.isRegister = registeredData.isRegister;
|
||||
} else {
|
||||
if (fileNo) {
|
||||
request.patientID = patientId ?? int.parse(nationIdText);
|
||||
request.patientIdentificationID = request.nationalID = "";
|
||||
request.searchType = 2;
|
||||
} else {
|
||||
request.patientID = 0;
|
||||
request.searchType = 1;
|
||||
request.patientIdentificationID = request.nationalID = nationIdText.isNotEmpty ? nationIdText : '0';
|
||||
}
|
||||
request.isRegister = false;
|
||||
}
|
||||
|
||||
request.deviceTypeID = request.searchType;
|
||||
return request;
|
||||
}
|
||||
|
||||
static getCommonRequestAuthProvider({
|
||||
required OTPTypeEnum otpTypeEnum,
|
||||
required registeredData,
|
||||
required deviceToken,
|
||||
required mobileNumber,
|
||||
required zipCode,
|
||||
required patientOutSA,
|
||||
required loginTokenID,
|
||||
required selectedOption,
|
||||
required int? patientId,
|
||||
}) {
|
||||
var request = SendActivationRequest();
|
||||
request.patientMobileNumber = mobileNumber;
|
||||
request.mobileNo = '0$mobileNumber';
|
||||
request.deviceToken = deviceToken;
|
||||
request.projectOutSA = patientOutSA == true ? true : false;
|
||||
request.loginType = selectedOption;
|
||||
request.oTPSendType = otpTypeEnum.toInt(); //this.selectedOption == 1 ? 1 : 2;
|
||||
request.zipCode = zipCode;
|
||||
|
||||
request.logInTokenID = loginTokenID ?? "";
|
||||
|
||||
if (registeredData != null) {
|
||||
request.searchType = registeredData.searchType ?? 1;
|
||||
request.patientID = registeredData.patientID ?? 0;
|
||||
request.patientIdentificationID = request.nationalID = registeredData.patientIdentificationID ?? '0';
|
||||
request.dob = registeredData.dob;
|
||||
request.isRegister = registeredData.isRegister;
|
||||
} else {
|
||||
request.searchType = request.searchType ?? 2;
|
||||
request.patientID = patientId ?? 0;
|
||||
request.nationalID = request.nationalID ?? '0';
|
||||
request.patientIdentificationID = request.patientIdentificationID ?? '0';
|
||||
request.isRegister = false;
|
||||
}
|
||||
request.deviceTypeID = request.searchType;
|
||||
return request;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
extension NavigationExtensions on BuildContext {
|
||||
void navigateWithName(String routeName, {Object? arguments}) {
|
||||
Navigator.pushNamed(this, routeName, arguments: arguments);
|
||||
}
|
||||
|
||||
Future<void> navigateReplaceWithName(String routeName, {Object? arguments}) async {
|
||||
await Navigator.pushReplacementNamed(this, routeName, arguments: arguments);
|
||||
}
|
||||
|
||||
void navigateReplaceWithNameUntilRoute(String routeName, {Object? arguments}) {
|
||||
Navigator.pushNamedAndRemoveUntil(this, routeName, (route) => false);
|
||||
}
|
||||
|
||||
void pop() {
|
||||
Navigator.of(this).pop();
|
||||
}
|
||||
|
||||
void navigateTo(Widget page) {
|
||||
Navigator.push(this, MaterialPageRoute(builder: (context) => page));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,160 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:hmg_patient_app_new/core/api/api_client.dart';
|
||||
import 'package:hmg_patient_app_new/core/api_consts.dart';
|
||||
import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart';
|
||||
import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart';
|
||||
import 'package:hmg_patient_app_new/features/authentication/models/request_models/check_patient_authentication_request_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/check_activation_code_resp_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/select_device_by_imei.dart';
|
||||
import 'package:hmg_patient_app_new/services/logger_service.dart';
|
||||
|
||||
abstract class AuthenticationRepo {
|
||||
Future<Either<Failure, GenericApiModel<SelectDeviceByImeiRespModelElement>>> selectDeviceByImei({
|
||||
required String firebaseToken,
|
||||
});
|
||||
|
||||
Future<Either<Failure, GenericApiModel<dynamic>>> checkPatientAuthentication({
|
||||
required CheckPatientAuthenticationReq checkPatientAuthenticationReq,
|
||||
});
|
||||
|
||||
Future<Either<Failure, GenericApiModel<dynamic>>> sendActivationCodeRegister(
|
||||
{required CheckPatientAuthenticationReq checkPatientAuthenticationReq, String? languageID});
|
||||
}
|
||||
|
||||
class AuthenticationRepoImp implements AuthenticationRepo {
|
||||
final ApiClient apiClient;
|
||||
final LoggerService loggerService;
|
||||
|
||||
AuthenticationRepoImp({required this.loggerService, required this.apiClient});
|
||||
|
||||
@override
|
||||
Future<Either<Failure, GenericApiModel<SelectDeviceByImeiRespModelElement>>> selectDeviceByImei({required String firebaseToken}) async {
|
||||
final mapDevice = {"IMEI": firebaseToken};
|
||||
try {
|
||||
GenericApiModel<SelectDeviceByImeiRespModelElement>? apiResponse;
|
||||
Failure? failure;
|
||||
await apiClient.post(
|
||||
ApiConsts.selectDeviceImei,
|
||||
body: mapDevice,
|
||||
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
||||
failure = failureType;
|
||||
},
|
||||
onSuccess: (response, statusCode, {messageStatus}) {
|
||||
try {
|
||||
final list = response['Patient_SELECTDeviceIMEIbyIMEIList'];
|
||||
if (list == null || list.isEmpty) {
|
||||
throw Exception("Device list is empty");
|
||||
}
|
||||
|
||||
final model = SelectDeviceByImeiRespModelElement.fromJson(list[0] as Map<String, dynamic>);
|
||||
apiResponse = GenericApiModel<SelectDeviceByImeiRespModelElement>(
|
||||
messageStatus: messageStatus,
|
||||
statusCode: statusCode,
|
||||
errorMessage: null,
|
||||
data: model,
|
||||
);
|
||||
} catch (e) {
|
||||
failure = DataParsingFailure(e.toString());
|
||||
}
|
||||
},
|
||||
);
|
||||
if (failure != null) return Left(failure!);
|
||||
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
|
||||
return Right(apiResponse!);
|
||||
} catch (e) {
|
||||
return Left(UnknownFailure(e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<Failure, GenericApiModel<dynamic>>> checkPatientAuthentication({
|
||||
required CheckPatientAuthenticationReq checkPatientAuthenticationReq,
|
||||
String? languageID,
|
||||
}) async {
|
||||
int isOutKsa = (checkPatientAuthenticationReq.zipCode == '966' || checkPatientAuthenticationReq.zipCode == '+966') ? 0 : 1;
|
||||
//TODO : We will use all these from AppState directly in the ApiClient
|
||||
|
||||
checkPatientAuthenticationReq.versionID = VERSION_ID;
|
||||
checkPatientAuthenticationReq.channel = CHANNEL;
|
||||
checkPatientAuthenticationReq.iPAdress = IP_ADDRESS;
|
||||
checkPatientAuthenticationReq.generalid = GENERAL_ID;
|
||||
checkPatientAuthenticationReq.languageID = (languageID == 'ar' ? 1 : 2);
|
||||
checkPatientAuthenticationReq.patientOutSA = isOutKsa;
|
||||
try {
|
||||
GenericApiModel<dynamic>? apiResponse;
|
||||
Failure? failure;
|
||||
await apiClient.post(
|
||||
ApiConsts.selectDeviceImei,
|
||||
body: checkPatientAuthenticationReq.toJson(),
|
||||
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
||||
failure = failureType;
|
||||
},
|
||||
onSuccess: (response, statusCode, {messageStatus}) {
|
||||
try {
|
||||
apiResponse = GenericApiModel<dynamic>(
|
||||
messageStatus: messageStatus,
|
||||
statusCode: statusCode,
|
||||
errorMessage: null,
|
||||
data: response,
|
||||
);
|
||||
} catch (e) {
|
||||
failure = DataParsingFailure(e.toString());
|
||||
}
|
||||
},
|
||||
);
|
||||
if (failure != null) return Left(failure!);
|
||||
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
|
||||
return Right(apiResponse!);
|
||||
} catch (e) {
|
||||
return Left(UnknownFailure(e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<Failure, GenericApiModel<dynamic>>> sendActivationCodeRegister(
|
||||
{required CheckPatientAuthenticationReq checkPatientAuthenticationReq, String? languageID}) async {
|
||||
int isOutKsa = (checkPatientAuthenticationReq.zipCode == '966' || checkPatientAuthenticationReq.zipCode == '+966') ? 0 : 1;
|
||||
//TODO : We will use all these from AppState directly in the ApiClient
|
||||
|
||||
checkPatientAuthenticationReq.versionID = VERSION_ID;
|
||||
checkPatientAuthenticationReq.channel = CHANNEL;
|
||||
checkPatientAuthenticationReq.iPAdress = IP_ADDRESS;
|
||||
checkPatientAuthenticationReq.generalid = GENERAL_ID;
|
||||
checkPatientAuthenticationReq.languageID = (languageID == 'ar' ? 1 : 2);
|
||||
checkPatientAuthenticationReq.deviceTypeID = Platform.isIOS ? 1 : 2;
|
||||
checkPatientAuthenticationReq.patientOutSA = isOutKsa;
|
||||
checkPatientAuthenticationReq.isDentalAllowedBackend = false;
|
||||
|
||||
try {
|
||||
GenericApiModel<dynamic>? apiResponse;
|
||||
Failure? failure;
|
||||
await apiClient.post(
|
||||
SEND_ACTIVATION_CODE_REGISTER,
|
||||
body: checkPatientAuthenticationReq.toJson(),
|
||||
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
||||
failure = failureType;
|
||||
},
|
||||
onSuccess: (response, statusCode, {messageStatus}) {
|
||||
try {
|
||||
apiResponse = GenericApiModel<dynamic>(
|
||||
messageStatus: messageStatus,
|
||||
statusCode: statusCode,
|
||||
errorMessage: null,
|
||||
data: CheckActivationCode.fromJson(response),
|
||||
);
|
||||
} catch (e) {
|
||||
failure = DataParsingFailure(e.toString());
|
||||
}
|
||||
},
|
||||
);
|
||||
if (failure != null) return Left(failure!);
|
||||
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
|
||||
return Right(apiResponse!);
|
||||
} catch (e) {
|
||||
return Left(UnknownFailure(e.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,135 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_state.dart';
|
||||
import 'package:hmg_patient_app_new/core/enums.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/request_utils.dart';
|
||||
import 'package:hmg_patient_app_new/features/authentication/authentication_repo.dart';
|
||||
import 'package:hmg_patient_app_new/features/authentication/models/request_models/check_patient_authentication_request_model.dart';
|
||||
import 'package:hmg_patient_app_new/services/dialog_service.dart';
|
||||
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
|
||||
|
||||
class AuthenticationViewModel extends ChangeNotifier {
|
||||
AuthenticationRepo authenticationRepo;
|
||||
AppState appState;
|
||||
ErrorHandlerService errorHandlerService;
|
||||
DialogService dialogService;
|
||||
|
||||
AuthenticationViewModel({
|
||||
required this.appState,
|
||||
required this.authenticationRepo,
|
||||
required this.errorHandlerService,
|
||||
required this.dialogService,
|
||||
});
|
||||
|
||||
final TextEditingController nationalIdController = TextEditingController();
|
||||
final TextEditingController phoneNumberController = TextEditingController();
|
||||
|
||||
Future<void> selectDeviceImei({Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
||||
String firebaseToken =
|
||||
"dOGRRszQQMGe_9wA5Hx3kO:APA91bFV5IcIJXvcCXXk0tc2ddtZgWwCPq7sGSuPr-YW7iiJpQZKgFGN9GAzCVOWL8MfheaP1slE8MdxB7lczdPBGdONQ7WbMmhgHcsUCUktq-hsapGXXqc";
|
||||
final result = await authenticationRepo.selectDeviceByImei(firebaseToken: firebaseToken);
|
||||
|
||||
result.fold(
|
||||
(failure) async => await errorHandlerService.handleError(failure: failure),
|
||||
(apiResponse) {
|
||||
if (apiResponse.messageStatus == 2) {
|
||||
dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
|
||||
} else if (apiResponse.messageStatus == 1) {
|
||||
//todo: move to next api call
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// Future<void> checkUserAuthentication({Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
||||
// CheckPatientAuthenticationReq checkPatientAuthenticationReq = RequestUtils.getCommonRequestWelcome(
|
||||
// phoneNumber: '0567184134',
|
||||
// otpTypeEnum: OTPTypeEnum.sms,
|
||||
// deviceToken: 'dummyDeviceToken123',
|
||||
// patientOutSA: true,
|
||||
// loginTokenID: 'dummyLoginToken456',
|
||||
// registeredData: null,
|
||||
// patientId: 12345,
|
||||
// nationIdText: '1234567890',
|
||||
// countryCode: 'SA',
|
||||
// );
|
||||
//
|
||||
// final result = await authenticationRepo.checkPatientAuthentication(checkPatientAuthenticationReq: checkPatientAuthenticationReq);
|
||||
// result.fold(
|
||||
// (failure) async => await errorHandlerService.handleError(failure: failure),
|
||||
// (apiResponse) {
|
||||
// if (apiResponse.data['isSMSSent']) {
|
||||
// // TODO: set this in AppState
|
||||
// // sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']);
|
||||
// // loginTokenID = value['LogInTokenID'],
|
||||
// // sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, request),
|
||||
// sendActivationCode(type);
|
||||
// } else {
|
||||
// if (apiResponse.data['IsAuthenticated']) {
|
||||
// checkActivationCode(onWrongActivationCode: (String? message) {});
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
// Future<void> sendActivationCode({required OTPTypeEnum otpTypeEnum}) async {
|
||||
// var request = RequestUtils.getCommonRequestAuthProvider(
|
||||
// otpTypeEnum: otpTypeEnum,
|
||||
// registeredData: null,
|
||||
// deviceToken: "dummyLoginToken456",
|
||||
// mobileNumber: "0567184134",
|
||||
// zipCode: "SA",
|
||||
// patientOutSA: true,
|
||||
// loginTokenID: "dummyLoginToken456",
|
||||
// selectedOption: selectedOption,
|
||||
// patientId: 12345,
|
||||
// );
|
||||
//
|
||||
// request.sMSSignature = await SMSOTP.getSignature();
|
||||
// selectedOption = type;
|
||||
// // GifLoaderDialogUtils.showMyDialog(context);
|
||||
// if (healthId != null || isDubai) {
|
||||
// if (!isDubai) {
|
||||
// request.dob = dob; //isHijri == 1 ? dob : dateFormat2.format(dateFormat.parse(dob));
|
||||
// }
|
||||
// request.healthId = healthId;
|
||||
// request.isHijri = isHijri;
|
||||
// await this.apiClient.sendActivationCodeRegister(request).then((result) {
|
||||
// // GifLoaderDialogUtils.hideDialog(context);
|
||||
// if (result != null && result['isSMSSent'] == true) {
|
||||
// this.startSMSService(type);
|
||||
// }
|
||||
// }).catchError((r) {
|
||||
// GifLoaderDialogUtils.hideDialog(context);
|
||||
// context.showBottomSheet(
|
||||
// child: ExceptionBottomSheet(
|
||||
// message: r.toString(),
|
||||
// onOkPressed: () {
|
||||
// Navigator.of(context).pop();
|
||||
// },
|
||||
// ));
|
||||
// // AppToast.showErrorToast(message: r);
|
||||
// });
|
||||
// } else {
|
||||
// request.dob = "";
|
||||
// request.healthId = "";
|
||||
// request.isHijri = 0;
|
||||
// await this.authService.sendActivationCode(request).then((result) {
|
||||
// GifLoaderDialogUtils.hideDialog(context);
|
||||
// if (result != null && result['isSMSSent'] == true) {
|
||||
// this.startSMSService(type);
|
||||
// }
|
||||
// }).catchError((r) {
|
||||
// GifLoaderDialogUtils.hideDialog(context);
|
||||
// context.showBottomSheet(
|
||||
// child: ExceptionBottomSheet(
|
||||
// message: r.toString(),
|
||||
// onOkPressed: () {
|
||||
// Navigator.of(context).pop();
|
||||
// },
|
||||
// ));
|
||||
// // AppToast.showErrorToast(message: r.toString());
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@ -0,0 +1,121 @@
|
||||
// class CheckActivationCodeRegisterReq {
|
||||
// int? patientMobileNumber;
|
||||
// String? mobileNo;
|
||||
// String? deviceToken;
|
||||
// bool? projectOutSA;
|
||||
// int? loginType;
|
||||
// String? zipCode;
|
||||
// bool? isRegister;
|
||||
// String? logInTokenID;
|
||||
// int? searchType;
|
||||
// int? patientID;
|
||||
// String? nationalID;
|
||||
// String? patientIdentificationID;
|
||||
// String? activationCode;
|
||||
// bool? isSilentLogin;
|
||||
// double? versionID;
|
||||
// int? channel;
|
||||
// int? languageID;
|
||||
// String? iPAdress;
|
||||
// String? generalid;
|
||||
// int? patientOutSA;
|
||||
// dynamic sessionID;
|
||||
// bool? isDentalAllowedBackend;
|
||||
// int? deviceTypeID;
|
||||
// bool? forRegisteration;
|
||||
// String? dob;
|
||||
// int? isHijri;
|
||||
// String? healthId;
|
||||
//
|
||||
// CheckActivationCodeRegisterReq({
|
||||
// this.patientMobileNumber,
|
||||
// this.mobileNo,
|
||||
// this.deviceToken,
|
||||
// this.projectOutSA,
|
||||
// this.loginType,
|
||||
// this.zipCode,
|
||||
// this.isRegister,
|
||||
// this.logInTokenID,
|
||||
// this.searchType,
|
||||
// this.patientID,
|
||||
// this.nationalID,
|
||||
// this.patientIdentificationID,
|
||||
// this.activationCode,
|
||||
// this.isSilentLogin,
|
||||
// this.versionID,
|
||||
// this.channel,
|
||||
// this.languageID,
|
||||
// this.iPAdress,
|
||||
// this.generalid,
|
||||
// this.patientOutSA,
|
||||
// this.sessionID,
|
||||
// this.isDentalAllowedBackend,
|
||||
// this.deviceTypeID,
|
||||
// this.forRegisteration,
|
||||
// this.dob,
|
||||
// this.isHijri,
|
||||
// this.healthId,
|
||||
// });
|
||||
//
|
||||
// CheckActivationCodeRegisterReq.fromJson(Map<String, dynamic> json) {
|
||||
// patientMobileNumber = json['PatientMobileNumber'];
|
||||
// mobileNo = json['MobileNo'];
|
||||
// deviceToken = json['DeviceToken'];
|
||||
// projectOutSA = json['ProjectOutSA'];
|
||||
// loginType = json['LoginType'];
|
||||
// zipCode = json['ZipCode'];
|
||||
// isRegister = json['isRegister'];
|
||||
// logInTokenID = json['LogInTokenID'];
|
||||
// searchType = json['SearchType'];
|
||||
// patientID = json['PatientID'];
|
||||
// nationalID = json['NationalID'];
|
||||
// patientIdentificationID = json['PatientIdentificationID'];
|
||||
// activationCode = json['activationCode'];
|
||||
// isSilentLogin = json['IsSilentLogin'];
|
||||
// versionID = json['VersionID'];
|
||||
// channel = json['Channel'];
|
||||
// languageID = json['LanguageID'];
|
||||
// iPAdress = json['IPAdress'];
|
||||
// generalid = json['generalid'];
|
||||
// patientOutSA = json['PatientOutSA'];
|
||||
// sessionID = json['SessionID'];
|
||||
// isDentalAllowedBackend = json['isDentalAllowedBackend'];
|
||||
// deviceTypeID = json['DeviceTypeID'];
|
||||
// forRegisteration = json['ForRegisteration'];
|
||||
// dob = json['DOB'];
|
||||
// isHijri = json['IsHijri'];
|
||||
// healthId = json['HealthId'];
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
// data['PatientMobileNumber'] = this.patientMobileNumber;
|
||||
// data['MobileNo'] = this.mobileNo;
|
||||
// data['DeviceToken'] = this.deviceToken;
|
||||
// data['ProjectOutSA'] = this.projectOutSA;
|
||||
// data['LoginType'] = this.loginType;
|
||||
// data['ZipCode'] = this.zipCode;
|
||||
// data['isRegister'] = this.isRegister;
|
||||
// data['LogInTokenID'] = this.logInTokenID;
|
||||
// data['SearchType'] = this.searchType;
|
||||
// data['PatientID'] = this.patientID;
|
||||
// data['NationalID'] = this.nationalID;
|
||||
// data['PatientIdentificationID'] = this.patientIdentificationID;
|
||||
// data['activationCode'] = this.activationCode;
|
||||
// data['IsSilentLogin'] = this.isSilentLogin;
|
||||
// data['VersionID'] = this.versionID;
|
||||
// data['Channel'] = this.channel;
|
||||
// data['LanguageID'] = this.languageID;
|
||||
// data['IPAdress'] = this.iPAdress;
|
||||
// data['generalid'] = this.generalid;
|
||||
// data['PatientOutSA'] = this.patientOutSA;
|
||||
// data['SessionID'] = this.sessionID;
|
||||
// data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
|
||||
// data['DeviceTypeID'] = this.deviceTypeID;
|
||||
// data['ForRegisteration'] = this.forRegisteration;
|
||||
// data['DOB'] = dob;
|
||||
// data['IsHijri'] = isHijri;
|
||||
// data['HealthId'] = healthId;
|
||||
// return data;
|
||||
// }
|
||||
// }
|
||||
@ -0,0 +1,88 @@
|
||||
class CheckPatientAuthenticationReq {
|
||||
int? patientMobileNumber;
|
||||
String? zipCode;
|
||||
bool? isRegister;
|
||||
String? tokenID;
|
||||
int? searchType;
|
||||
String? patientIdentificationID;
|
||||
int? patientID;
|
||||
double? versionID;
|
||||
int? channel;
|
||||
int? languageID;
|
||||
String? iPAdress;
|
||||
String? generalid;
|
||||
int? patientOutSA;
|
||||
dynamic sessionID;
|
||||
bool? isDentalAllowedBackend;
|
||||
int? deviceTypeID;
|
||||
String? dob;
|
||||
int? isHijri;
|
||||
String? healthId;
|
||||
|
||||
CheckPatientAuthenticationReq(
|
||||
{this.patientMobileNumber,
|
||||
this.zipCode,
|
||||
this.isRegister,
|
||||
this.tokenID,
|
||||
this.searchType,
|
||||
this.patientIdentificationID,
|
||||
this.patientID,
|
||||
this.versionID,
|
||||
this.channel,
|
||||
this.languageID,
|
||||
this.iPAdress,
|
||||
this.generalid,
|
||||
this.patientOutSA,
|
||||
this.sessionID,
|
||||
this.isDentalAllowedBackend,
|
||||
this.deviceTypeID,
|
||||
this.dob,
|
||||
this.isHijri,
|
||||
this.healthId});
|
||||
|
||||
CheckPatientAuthenticationReq.fromJson(Map<String, dynamic> json) {
|
||||
patientMobileNumber = json['PatientMobileNumber'];
|
||||
zipCode = json['ZipCode'];
|
||||
isRegister = json['isRegister'];
|
||||
tokenID = json['TokenID'];
|
||||
searchType = json['SearchType'];
|
||||
patientIdentificationID = json['PatientIdentificationID'];
|
||||
patientID = json['PatientID'];
|
||||
versionID = json['VersionID'];
|
||||
channel = json['Channel'];
|
||||
languageID = json['LanguageID'];
|
||||
iPAdress = json['IPAdress'];
|
||||
generalid = json['generalid'];
|
||||
patientOutSA = json['PatientOutSA'];
|
||||
sessionID = json['SessionID'];
|
||||
isDentalAllowedBackend = json['isDentalAllowedBackend'];
|
||||
deviceTypeID = json['DeviceTypeID'];
|
||||
dob = json['dob'];
|
||||
isHijri = json['isHijri'];
|
||||
healthId = json['HealthId'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['PatientMobileNumber'] = patientMobileNumber;
|
||||
data['ZipCode'] = zipCode;
|
||||
data['isRegister'] = isRegister;
|
||||
data['TokenID'] = tokenID;
|
||||
data['SearchType'] = searchType;
|
||||
data['PatientIdentificationID'] = patientIdentificationID;
|
||||
data['PatientID'] = patientID;
|
||||
data['VersionID'] = versionID;
|
||||
data['Channel'] = channel;
|
||||
data['LanguageID'] = languageID;
|
||||
data['IPAdress'] = iPAdress;
|
||||
data['generalid'] = generalid;
|
||||
data['PatientOutSA'] = patientOutSA;
|
||||
data['SessionID'] = sessionID;
|
||||
data['isDentalAllowedBackend'] = isDentalAllowedBackend;
|
||||
data['DeviceTypeID'] = deviceTypeID;
|
||||
data['dob'] = dob;
|
||||
data['isHijri'] = isHijri;
|
||||
data['HealthId'] = healthId;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,132 @@
|
||||
class SendActivationRequest {
|
||||
int? patientMobileNumber;
|
||||
String? mobileNo;
|
||||
String? deviceToken;
|
||||
bool? projectOutSA;
|
||||
int? loginType;
|
||||
String? zipCode;
|
||||
bool? isRegister;
|
||||
String? logInTokenID;
|
||||
int? searchType;
|
||||
int? patientID;
|
||||
String? nationalID;
|
||||
String? patientIdentificationID;
|
||||
int? oTPSendType;
|
||||
int? languageID;
|
||||
double? versionID;
|
||||
int? channel;
|
||||
String? iPAdress;
|
||||
String? generalid;
|
||||
int? patientOutSA;
|
||||
dynamic sessionID;
|
||||
bool? isDentalAllowedBackend;
|
||||
int? deviceTypeID;
|
||||
String? sMSSignature;
|
||||
String? dob;
|
||||
int? isHijri;
|
||||
String? healthId;
|
||||
int? responseID;
|
||||
int? status;
|
||||
int? familyRegionID;
|
||||
bool? isPatientExcluded;
|
||||
SendActivationRequest(
|
||||
{this.patientMobileNumber,
|
||||
this.mobileNo,
|
||||
this.deviceToken,
|
||||
this.projectOutSA,
|
||||
this.loginType,
|
||||
this.zipCode,
|
||||
this.isRegister,
|
||||
this.logInTokenID,
|
||||
this.searchType,
|
||||
this.patientID,
|
||||
this.nationalID,
|
||||
this.patientIdentificationID,
|
||||
this.oTPSendType,
|
||||
this.languageID,
|
||||
this.versionID,
|
||||
this.channel,
|
||||
this.iPAdress,
|
||||
this.generalid,
|
||||
this.patientOutSA,
|
||||
this.sessionID,
|
||||
this.isDentalAllowedBackend,
|
||||
this.deviceTypeID,
|
||||
this.sMSSignature,
|
||||
this.dob,
|
||||
this.isHijri,
|
||||
this.healthId,
|
||||
this.responseID,
|
||||
this.status,
|
||||
this.familyRegionID,
|
||||
this.isPatientExcluded
|
||||
});
|
||||
|
||||
SendActivationRequest.fromJson(Map<String, dynamic> json) {
|
||||
patientMobileNumber = json['PatientMobileNumber'];
|
||||
mobileNo = json['MobileNo'];
|
||||
deviceToken = json['DeviceToken'];
|
||||
projectOutSA = json['ProjectOutSA'];
|
||||
loginType = json['LoginType'];
|
||||
zipCode = json['ZipCode'];
|
||||
isRegister = json['isRegister'];
|
||||
logInTokenID = json['LogInTokenID'];
|
||||
searchType = json['SearchType'];
|
||||
patientID = json['PatientID'];
|
||||
nationalID = json['NationalID'];
|
||||
patientIdentificationID = json['PatientIdentificationID'];
|
||||
oTPSendType = json['OTP_SendType'];
|
||||
languageID = json['LanguageID'];
|
||||
versionID = json['VersionID'];
|
||||
channel = json['Channel'];
|
||||
iPAdress = json['IPAdress'];
|
||||
generalid = json['generalid'];
|
||||
patientOutSA = json['PatientOutSA'];
|
||||
sessionID = json['SessionID'];
|
||||
isDentalAllowedBackend = json['isDentalAllowedBackend'];
|
||||
deviceTypeID = json['DeviceTypeID'];
|
||||
sMSSignature = json['SMSSignature'];
|
||||
dob = json['DOB'];
|
||||
isHijri = json['IsHijri'];
|
||||
healthId = json['HealthId'];
|
||||
responseID = json['ReponseID'];
|
||||
status = json['Status'];
|
||||
familyRegionID = json['FamilyRegionID'];
|
||||
isPatientExcluded = json['IsPatientExcluded'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['PatientMobileNumber'] = patientMobileNumber;
|
||||
data['MobileNo'] = mobileNo;
|
||||
data['DeviceToken'] = deviceToken;
|
||||
data['ProjectOutSA'] = projectOutSA;
|
||||
data['LoginType'] = loginType;
|
||||
data['ZipCode'] = zipCode;
|
||||
data['isRegister'] = isRegister;
|
||||
data['LogInTokenID'] = logInTokenID;
|
||||
data['SearchType'] = searchType;
|
||||
data['PatientID'] = patientID;
|
||||
data['NationalID'] = nationalID;
|
||||
data['PatientIdentificationID'] = patientIdentificationID;
|
||||
data['OTP_SendType'] = oTPSendType;
|
||||
data['LanguageID'] = languageID;
|
||||
data['VersionID'] = versionID;
|
||||
data['Channel'] = channel;
|
||||
data['IPAdress'] = iPAdress;
|
||||
data['generalid'] = generalid;
|
||||
data['PatientOutSA'] = patientOutSA;
|
||||
data['SessionID'] = sessionID;
|
||||
data['isDentalAllowedBackend'] = isDentalAllowedBackend;
|
||||
data['DeviceTypeID'] = deviceTypeID;
|
||||
data['SMSSignature'] = sMSSignature;
|
||||
data['DOB'] = dob;
|
||||
data['IsHijri'] = isHijri;
|
||||
data['HealthId'] = healthId;
|
||||
data['ResponseID'] = responseID;
|
||||
data['Status'] = status;
|
||||
data['FamilyRegionID'] = familyRegionID;
|
||||
data['IsPatientExcluded'] = isPatientExcluded;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,292 @@
|
||||
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
|
||||
|
||||
class AuthenticatedUser {
|
||||
String? setupID;
|
||||
int? patientType;
|
||||
int? patientID;
|
||||
String? firstName;
|
||||
String? middleName;
|
||||
String? lastName;
|
||||
String? firstNameN;
|
||||
String? middleNameN;
|
||||
String? lastNameN;
|
||||
int? relationshipID;
|
||||
int? gender;
|
||||
String? dateofBirth;
|
||||
DateTime? dateofBirthDataTime;
|
||||
dynamic dateofBirthN;
|
||||
String? nationalityID;
|
||||
dynamic phoneResi;
|
||||
dynamic phoneOffice;
|
||||
String? mobileNumber;
|
||||
dynamic faxNumber;
|
||||
String? emailAddress;
|
||||
dynamic bloodGroup;
|
||||
dynamic rHFactor;
|
||||
bool? isEmailAlertRequired;
|
||||
bool? isSMSAlertRequired;
|
||||
String? preferredLanguage;
|
||||
bool? isPrivilegedMember;
|
||||
dynamic memberID;
|
||||
dynamic expiryDate;
|
||||
dynamic isHmgEmployee;
|
||||
dynamic employeeID;
|
||||
dynamic emergencyContactName;
|
||||
dynamic emergencyContactNo;
|
||||
int? patientPayType;
|
||||
dynamic dHCCPatientRefID;
|
||||
bool? isPatientDummy;
|
||||
int? status;
|
||||
dynamic isStatusCleared;
|
||||
int? patientIdentificationType;
|
||||
String? patientIdentificationNo;
|
||||
int? projectID;
|
||||
int? infoSourceID;
|
||||
dynamic address;
|
||||
int? age;
|
||||
String? ageDesc;
|
||||
int? areaID;
|
||||
int? createdBy;
|
||||
String? genderDescription;
|
||||
dynamic iR;
|
||||
dynamic iSOCityID;
|
||||
dynamic iSOCountryID;
|
||||
List<ListPrivilege>? listPrivilege;
|
||||
dynamic marital;
|
||||
int? outSA;
|
||||
dynamic pOBox;
|
||||
bool? receiveHealthSummaryReport;
|
||||
int? sourceType;
|
||||
dynamic strDateofBirth;
|
||||
dynamic tempAddress;
|
||||
dynamic zipCode;
|
||||
dynamic isFamily;
|
||||
dynamic cRSVerificationStatus;
|
||||
// dynamic patientPayType;
|
||||
// dynamic patientType;
|
||||
// dynamic status;
|
||||
|
||||
AuthenticatedUser(
|
||||
{this.setupID,
|
||||
this.patientType,
|
||||
this.patientID,
|
||||
this.firstName,
|
||||
this.middleName,
|
||||
this.lastName,
|
||||
this.firstNameN,
|
||||
this.middleNameN,
|
||||
this.lastNameN,
|
||||
this.relationshipID,
|
||||
this.gender,
|
||||
this.dateofBirth,
|
||||
this.dateofBirthN,
|
||||
this.nationalityID,
|
||||
this.phoneResi,
|
||||
this.phoneOffice,
|
||||
this.mobileNumber,
|
||||
this.faxNumber,
|
||||
this.emailAddress,
|
||||
this.bloodGroup,
|
||||
this.rHFactor,
|
||||
this.isEmailAlertRequired,
|
||||
this.isSMSAlertRequired,
|
||||
this.preferredLanguage,
|
||||
this.isPrivilegedMember,
|
||||
this.memberID,
|
||||
this.expiryDate,
|
||||
this.isHmgEmployee,
|
||||
this.employeeID,
|
||||
this.emergencyContactName,
|
||||
this.emergencyContactNo,
|
||||
this.patientPayType,
|
||||
this.dHCCPatientRefID,
|
||||
this.isPatientDummy,
|
||||
this.status,
|
||||
this.isStatusCleared,
|
||||
this.patientIdentificationType,
|
||||
this.patientIdentificationNo,
|
||||
this.projectID,
|
||||
this.infoSourceID,
|
||||
this.address,
|
||||
this.age,
|
||||
this.ageDesc,
|
||||
this.areaID,
|
||||
this.createdBy,
|
||||
this.genderDescription,
|
||||
this.iR,
|
||||
this.iSOCityID,
|
||||
this.iSOCountryID,
|
||||
this.listPrivilege,
|
||||
this.marital,
|
||||
this.outSA,
|
||||
this.pOBox,
|
||||
this.receiveHealthSummaryReport,
|
||||
this.sourceType,
|
||||
this.strDateofBirth,
|
||||
this.tempAddress,
|
||||
this.zipCode,
|
||||
this.isFamily,
|
||||
this.cRSVerificationStatus});
|
||||
|
||||
AuthenticatedUser.fromJson(Map<String, dynamic> json) {
|
||||
setupID = json['SetupID'];
|
||||
patientType = json['PatientType'];
|
||||
patientID = json['PatientID'];
|
||||
firstName = json['FirstName'];
|
||||
middleName = json['MiddleName'];
|
||||
lastName = json['LastName'];
|
||||
firstNameN = json['FirstNameN'];
|
||||
middleNameN = json['MiddleNameN'];
|
||||
lastNameN = json['LastNameN'];
|
||||
relationshipID = json['RelationshipID'];
|
||||
gender = json['Gender'];
|
||||
dateofBirth = json['DateofBirth'];
|
||||
dateofBirthDataTime = DateUtil.convertStringToDate(json['DateofBirth']);
|
||||
dateofBirthN = json['DateofBirthN'];
|
||||
nationalityID = json['NationalityID'];
|
||||
phoneResi = json['PhoneResi'];
|
||||
phoneOffice = json['PhoneOffice'];
|
||||
mobileNumber = json['MobileNumber'];
|
||||
faxNumber = json['FaxNumber'];
|
||||
emailAddress = json['EmailAddress'];
|
||||
bloodGroup = json['BloodGroup'];
|
||||
rHFactor = json['RHFactor'];
|
||||
isEmailAlertRequired = json['IsEmailAlertRequired'];
|
||||
isSMSAlertRequired = json['IsSMSAlertRequired'];
|
||||
preferredLanguage = json['PreferredLanguage'];
|
||||
isPrivilegedMember = json['IsPrivilegedMember'];
|
||||
memberID = json['MemberID'];
|
||||
expiryDate = json['ExpiryDate'];
|
||||
isHmgEmployee = json['IsHmgEmployee'];
|
||||
employeeID = json['EmployeeID'];
|
||||
emergencyContactName = json['EmergencyContactName'];
|
||||
emergencyContactNo = json['EmergencyContactNo'];
|
||||
patientPayType = json['PatientPayType'];
|
||||
dHCCPatientRefID = json['DHCCPatientRefID'];
|
||||
isPatientDummy = json['IsPatientDummy'];
|
||||
status = json['Status'];
|
||||
isStatusCleared = json['IsStatusCleared'];
|
||||
patientIdentificationType = json['PatientIdentificationType'];
|
||||
patientIdentificationNo = json['PatientIdentificationNo'];
|
||||
projectID = json['ProjectID'];
|
||||
infoSourceID = json['InfoSourceID'];
|
||||
address = json['Address'];
|
||||
age = json['Age'];
|
||||
ageDesc = json['AgeDesc'];
|
||||
areaID = json['AreaID'];
|
||||
createdBy = json['CreatedBy'];
|
||||
genderDescription = json['GenderDescription'];
|
||||
iR = json['IR'];
|
||||
iSOCityID = json['ISOCityID'];
|
||||
iSOCountryID = json['ISOCountryID'];
|
||||
if (json['ListPrivilege'] != null) {
|
||||
listPrivilege = [];
|
||||
json['ListPrivilege'].forEach((v) {
|
||||
listPrivilege!.add(new ListPrivilege.fromJson(v));
|
||||
});
|
||||
}
|
||||
marital = json['Marital'];
|
||||
outSA = json['OutSA'];
|
||||
pOBox = json['POBox'];
|
||||
receiveHealthSummaryReport = json['ReceiveHealthSummaryReport'];
|
||||
sourceType = json['SourceType'];
|
||||
strDateofBirth = json['StrDateofBirth'];
|
||||
tempAddress = json['TempAddress'];
|
||||
zipCode = json['ZipCode'];
|
||||
isFamily = json['IsFamily'];
|
||||
cRSVerificationStatus = json['CRSVerificationStatus'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['SetupID'] = this.setupID;
|
||||
data['PatientType'] = this.patientType;
|
||||
data['PatientID'] = this.patientID;
|
||||
data['FirstName'] = this.firstName;
|
||||
data['MiddleName'] = this.middleName;
|
||||
data['LastName'] = this.lastName;
|
||||
data['FirstNameN'] = this.firstNameN;
|
||||
data['MiddleNameN'] = this.middleNameN;
|
||||
data['LastNameN'] = this.lastNameN;
|
||||
data['RelationshipID'] = this.relationshipID;
|
||||
data['Gender'] = this.gender;
|
||||
data['DateofBirth'] = this.dateofBirth;
|
||||
data['DateofBirthN'] = this.dateofBirthN;
|
||||
data['NationalityID'] = this.nationalityID;
|
||||
data['PhoneResi'] = this.phoneResi;
|
||||
data['PhoneOffice'] = this.phoneOffice;
|
||||
data['MobileNumber'] = this.mobileNumber;
|
||||
data['FaxNumber'] = this.faxNumber;
|
||||
data['EmailAddress'] = this.emailAddress;
|
||||
data['BloodGroup'] = this.bloodGroup;
|
||||
data['RHFactor'] = this.rHFactor;
|
||||
data['IsEmailAlertRequired'] = this.isEmailAlertRequired;
|
||||
data['IsSMSAlertRequired'] = this.isSMSAlertRequired;
|
||||
data['PreferredLanguage'] = this.preferredLanguage;
|
||||
data['IsPrivilegedMember'] = this.isPrivilegedMember;
|
||||
data['MemberID'] = this.memberID;
|
||||
data['ExpiryDate'] = this.expiryDate;
|
||||
data['IsHmgEmployee'] = this.isHmgEmployee;
|
||||
data['EmployeeID'] = this.employeeID;
|
||||
data['EmergencyContactName'] = this.emergencyContactName;
|
||||
data['EmergencyContactNo'] = this.emergencyContactNo;
|
||||
data['PatientPayType'] = this.patientPayType;
|
||||
data['DHCCPatientRefID'] = this.dHCCPatientRefID;
|
||||
data['IsPatientDummy'] = this.isPatientDummy;
|
||||
data['Status'] = this.status;
|
||||
data['IsStatusCleared'] = this.isStatusCleared;
|
||||
data['PatientIdentificationType'] = this.patientIdentificationType;
|
||||
data['PatientIdentificationNo'] = this.patientIdentificationNo;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['InfoSourceID'] = this.infoSourceID;
|
||||
data['Address'] = this.address;
|
||||
data['Age'] = this.age;
|
||||
data['AgeDesc'] = this.ageDesc;
|
||||
data['AreaID'] = this.areaID;
|
||||
data['CreatedBy'] = this.createdBy;
|
||||
data['GenderDescription'] = this.genderDescription;
|
||||
data['IR'] = this.iR;
|
||||
data['ISOCityID'] = this.iSOCityID;
|
||||
data['ISOCountryID'] = this.iSOCountryID;
|
||||
if (this.listPrivilege != null) {
|
||||
data['ListPrivilege'] =
|
||||
this.listPrivilege!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['Marital'] = this.marital;
|
||||
data['OutSA'] = this.outSA;
|
||||
data['POBox'] = this.pOBox;
|
||||
data['ReceiveHealthSummaryReport'] = this.receiveHealthSummaryReport;
|
||||
data['SourceType'] = this.sourceType;
|
||||
data['StrDateofBirth'] = this.strDateofBirth;
|
||||
data['TempAddress'] = this.tempAddress;
|
||||
data['ZipCode'] = this.zipCode;
|
||||
data['IsFamily'] = this.isFamily;
|
||||
data['CRSVerificationStatus'] = this.cRSVerificationStatus;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ListPrivilege {
|
||||
int? iD;
|
||||
String? serviceName;
|
||||
bool? previlege;
|
||||
dynamic region;
|
||||
|
||||
ListPrivilege({this.iD, this.serviceName, this.previlege, this.region});
|
||||
|
||||
ListPrivilege.fromJson(Map<String, dynamic> json) {
|
||||
iD = json['ID'];
|
||||
serviceName = json['ServiceName'];
|
||||
previlege = json['Previlege'];
|
||||
region = json['Region'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['ID'] = this.iD;
|
||||
data['ServiceName'] = this.serviceName;
|
||||
data['Previlege'] = this.previlege;
|
||||
data['Region'] = this.region;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,546 @@
|
||||
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/authenticated_user_resp_model.dart';
|
||||
|
||||
class CheckActivationCode {
|
||||
dynamic date;
|
||||
int? languageID;
|
||||
int? serviceName;
|
||||
dynamic time;
|
||||
dynamic androidLink;
|
||||
String? authenticationTokenID;
|
||||
dynamic data;
|
||||
bool? dataw;
|
||||
int? dietType;
|
||||
dynamic errorCode;
|
||||
dynamic errorEndUserMessage;
|
||||
dynamic errorEndUserMessageN;
|
||||
dynamic errorMessage;
|
||||
int? errorType;
|
||||
int? foodCategory;
|
||||
dynamic iOSLink;
|
||||
bool? isAuthenticated;
|
||||
int? mealOrderStatus;
|
||||
int? mealType;
|
||||
int? messageStatus;
|
||||
int? numberOfResultRecords;
|
||||
dynamic patientBlodType;
|
||||
dynamic successMsg;
|
||||
dynamic successMsgN;
|
||||
dynamic doctorInformationList;
|
||||
dynamic getAllPendingRecordsList;
|
||||
dynamic getAllSharedRecordsByStatusList;
|
||||
dynamic getResponseFileList;
|
||||
bool? isHMGPatient;
|
||||
bool? isLoginSuccessfully;
|
||||
bool? isNeedUpdateIdintificationNo;
|
||||
bool? kioskSendSMS;
|
||||
AuthenticatedUser? list;
|
||||
dynamic listAskHabibMobileLoginInfo;
|
||||
dynamic listAskHabibPatientFile;
|
||||
dynamic listMergeFiles;
|
||||
dynamic listMobileLoginInfo;
|
||||
dynamic listPatientCount;
|
||||
dynamic logInTokenID;
|
||||
dynamic mohemmPrivilegeList;
|
||||
int? pateintID;
|
||||
String? patientBloodType;
|
||||
bool? patientHasFile;
|
||||
dynamic patientMergedIDs;
|
||||
bool? patientOutSA;
|
||||
int? patientShareRequestID;
|
||||
int? patientType;
|
||||
int? projectIDOut;
|
||||
dynamic returnMessage;
|
||||
bool? sMSLoginRequired;
|
||||
dynamic servicePrivilegeList;
|
||||
dynamic sharePatientName;
|
||||
dynamic verificationCode;
|
||||
dynamic email;
|
||||
dynamic errorList;
|
||||
bool? hasFile;
|
||||
bool? isActiveCode;
|
||||
bool? isMerged;
|
||||
bool? isNeedUserAgreement;
|
||||
bool? isSMSSent;
|
||||
dynamic memberList;
|
||||
dynamic message;
|
||||
int? statusCode;
|
||||
|
||||
CheckActivationCode(
|
||||
{this.date,
|
||||
this.languageID,
|
||||
this.serviceName,
|
||||
this.time,
|
||||
this.androidLink,
|
||||
this.authenticationTokenID,
|
||||
this.data,
|
||||
this.dataw,
|
||||
this.dietType,
|
||||
this.errorCode,
|
||||
this.errorEndUserMessage,
|
||||
this.errorEndUserMessageN,
|
||||
this.errorMessage,
|
||||
this.errorType,
|
||||
this.foodCategory,
|
||||
this.iOSLink,
|
||||
this.isAuthenticated,
|
||||
this.mealOrderStatus,
|
||||
this.mealType,
|
||||
this.messageStatus,
|
||||
this.numberOfResultRecords,
|
||||
this.patientBlodType,
|
||||
this.successMsg,
|
||||
this.successMsgN,
|
||||
this.doctorInformationList,
|
||||
this.getAllPendingRecordsList,
|
||||
this.getAllSharedRecordsByStatusList,
|
||||
this.getResponseFileList,
|
||||
this.isHMGPatient,
|
||||
this.isLoginSuccessfully,
|
||||
this.isNeedUpdateIdintificationNo,
|
||||
this.kioskSendSMS,
|
||||
this.list,
|
||||
this.listAskHabibMobileLoginInfo,
|
||||
this.listAskHabibPatientFile,
|
||||
this.listMergeFiles,
|
||||
this.listMobileLoginInfo,
|
||||
this.listPatientCount,
|
||||
this.logInTokenID,
|
||||
this.mohemmPrivilegeList,
|
||||
this.pateintID,
|
||||
this.patientBloodType,
|
||||
this.patientHasFile,
|
||||
this.patientMergedIDs,
|
||||
this.patientOutSA,
|
||||
this.patientShareRequestID,
|
||||
this.patientType,
|
||||
this.projectIDOut,
|
||||
this.returnMessage,
|
||||
this.sMSLoginRequired,
|
||||
this.servicePrivilegeList,
|
||||
this.sharePatientName,
|
||||
this.verificationCode,
|
||||
this.email,
|
||||
this.errorList,
|
||||
this.hasFile,
|
||||
this.isActiveCode,
|
||||
this.isMerged,
|
||||
this.isNeedUserAgreement,
|
||||
this.isSMSSent,
|
||||
this.memberList,
|
||||
this.message,
|
||||
this.statusCode});
|
||||
|
||||
CheckActivationCode.fromJson(Map<String, dynamic> json) {
|
||||
date = json['Date'];
|
||||
languageID = json['LanguageID'];
|
||||
serviceName = json['ServiceName'];
|
||||
time = json['Time'];
|
||||
androidLink = json['AndroidLink'];
|
||||
authenticationTokenID = json['AuthenticationTokenID'];
|
||||
data = json['Data'];
|
||||
dataw = json['Dataw'];
|
||||
dietType = json['DietType'];
|
||||
errorCode = json['ErrorCode'];
|
||||
errorEndUserMessage = json['ErrorEndUserMessage'];
|
||||
errorEndUserMessageN = json['ErrorEndUserMessageN'];
|
||||
errorMessage = json['ErrorMessage'];
|
||||
errorType = json['ErrorType'];
|
||||
foodCategory = json['FoodCategory'];
|
||||
iOSLink = json['IOSLink'];
|
||||
isAuthenticated = json['IsAuthenticated'];
|
||||
mealOrderStatus = json['MealOrderStatus'];
|
||||
mealType = json['MealType'];
|
||||
messageStatus = json['MessageStatus'];
|
||||
numberOfResultRecords = json['NumberOfResultRecords'];
|
||||
patientBlodType = json['PatientBlodType'];
|
||||
successMsg = json['SuccessMsg'];
|
||||
successMsgN = json['SuccessMsgN'];
|
||||
doctorInformationList = json['DoctorInformation_List'];
|
||||
getAllPendingRecordsList = json['GetAllPendingRecordsList'];
|
||||
getAllSharedRecordsByStatusList = json['GetAllSharedRecordsByStatusList'];
|
||||
getResponseFileList = json['GetResponseFileList'];
|
||||
isHMGPatient = json['IsHMGPatient'];
|
||||
isLoginSuccessfully = json['IsLoginSuccessfully'];
|
||||
isNeedUpdateIdintificationNo = json['IsNeedUpdateIdintificationNo'];
|
||||
kioskSendSMS = json['KioskSendSMS'];
|
||||
if (json['List'] != null) {
|
||||
list = AuthenticatedUser.fromJson(json['List'][0]);
|
||||
}
|
||||
listAskHabibMobileLoginInfo = json['List_AskHabibMobileLoginInfo'];
|
||||
listAskHabibPatientFile = json['List_AskHabibPatientFile'];
|
||||
listMergeFiles = json['List_MergeFiles'];
|
||||
listMobileLoginInfo = json['List_MobileLoginInfo'];
|
||||
listPatientCount = json['List_PatientCount'];
|
||||
logInTokenID = json['LogInTokenID'];
|
||||
mohemmPrivilegeList = json['MohemmPrivilege_List'];
|
||||
pateintID = json['PateintID'];
|
||||
patientBloodType = json['PatientBloodType'];
|
||||
patientHasFile = json['PatientHasFile'];
|
||||
patientMergedIDs = json['PatientMergedIDs'];
|
||||
patientOutSA = json['PatientOutSA'];
|
||||
patientShareRequestID = json['PatientShareRequestID'];
|
||||
patientType = json['PatientType'];
|
||||
projectIDOut = json['ProjectIDOut'];
|
||||
returnMessage = json['ReturnMessage'];
|
||||
sMSLoginRequired = json['SMSLoginRequired'];
|
||||
servicePrivilegeList = json['ServicePrivilege_List'];
|
||||
sharePatientName = json['SharePatientName'];
|
||||
verificationCode = json['VerificationCode'];
|
||||
email = json['email'];
|
||||
errorList = json['errorList'];
|
||||
hasFile = json['hasFile'];
|
||||
isActiveCode = json['isActiveCode'];
|
||||
isMerged = json['isMerged'];
|
||||
isNeedUserAgreement = json['isNeedUserAgreement'];
|
||||
isSMSSent = json['isSMSSent'];
|
||||
memberList = json['memberList'];
|
||||
message = json['message'];
|
||||
statusCode = json['statusCode'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['Date'] = date;
|
||||
data['LanguageID'] = languageID;
|
||||
data['ServiceName'] = serviceName;
|
||||
data['Time'] = time;
|
||||
data['AndroidLink'] = androidLink;
|
||||
data['AuthenticationTokenID'] = authenticationTokenID;
|
||||
data['Data'] = this.data;
|
||||
data['Dataw'] = dataw;
|
||||
data['DietType'] = dietType;
|
||||
data['ErrorCode'] = errorCode;
|
||||
data['ErrorEndUserMessage'] = errorEndUserMessage;
|
||||
data['ErrorEndUserMessageN'] = errorEndUserMessageN;
|
||||
data['ErrorMessage'] = errorMessage;
|
||||
data['ErrorType'] = errorType;
|
||||
data['FoodCategory'] = foodCategory;
|
||||
data['IOSLink'] = iOSLink;
|
||||
data['IsAuthenticated'] = isAuthenticated;
|
||||
data['MealOrderStatus'] = mealOrderStatus;
|
||||
data['MealType'] = mealType;
|
||||
data['MessageStatus'] = messageStatus;
|
||||
data['NumberOfResultRecords'] = numberOfResultRecords;
|
||||
data['PatientBlodType'] = patientBlodType;
|
||||
data['SuccessMsg'] = successMsg;
|
||||
data['SuccessMsgN'] = successMsgN;
|
||||
data['DoctorInformation_List'] = doctorInformationList;
|
||||
data['GetAllPendingRecordsList'] = getAllPendingRecordsList;
|
||||
data['GetAllSharedRecordsByStatusList'] = getAllSharedRecordsByStatusList;
|
||||
data['GetResponseFileList'] = getResponseFileList;
|
||||
data['IsHMGPatient'] = isHMGPatient;
|
||||
data['IsLoginSuccessfully'] = isLoginSuccessfully;
|
||||
data['IsNeedUpdateIdintificationNo'] = isNeedUpdateIdintificationNo;
|
||||
data['KioskSendSMS'] = kioskSendSMS;
|
||||
if (list != null) {
|
||||
data['List'] = list;
|
||||
}
|
||||
data['List_AskHabibMobileLoginInfo'] = listAskHabibMobileLoginInfo;
|
||||
data['List_AskHabibPatientFile'] = listAskHabibPatientFile;
|
||||
data['List_MergeFiles'] = listMergeFiles;
|
||||
data['List_MobileLoginInfo'] = listMobileLoginInfo;
|
||||
data['List_PatientCount'] = listPatientCount;
|
||||
data['LogInTokenID'] = logInTokenID;
|
||||
data['MohemmPrivilege_List'] = mohemmPrivilegeList;
|
||||
data['PateintID'] = pateintID;
|
||||
data['PatientBloodType'] = patientBloodType;
|
||||
data['PatientHasFile'] = patientHasFile;
|
||||
data['PatientMergedIDs'] = patientMergedIDs;
|
||||
data['PatientOutSA'] = patientOutSA;
|
||||
data['PatientShareRequestID'] = patientShareRequestID;
|
||||
data['PatientType'] = patientType;
|
||||
data['ProjectIDOut'] = projectIDOut;
|
||||
data['ReturnMessage'] = returnMessage;
|
||||
data['SMSLoginRequired'] = sMSLoginRequired;
|
||||
data['ServicePrivilege_List'] = servicePrivilegeList;
|
||||
data['SharePatientName'] = sharePatientName;
|
||||
data['VerificationCode'] = verificationCode;
|
||||
data['email'] = email;
|
||||
data['errorList'] = errorList;
|
||||
data['hasFile'] = hasFile;
|
||||
data['isActiveCode'] = isActiveCode;
|
||||
data['isMerged'] = isMerged;
|
||||
data['isNeedUserAgreement'] = isNeedUserAgreement;
|
||||
data['isSMSSent'] = isSMSSent;
|
||||
data['memberList'] = memberList;
|
||||
data['message'] = message;
|
||||
data['statusCode'] = statusCode;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class List {
|
||||
String? setupID;
|
||||
int? patientType;
|
||||
int? patientID;
|
||||
String? firstName;
|
||||
String? middleName;
|
||||
String? lastName;
|
||||
String? firstNameN;
|
||||
String? middleNameN;
|
||||
String? lastNameN;
|
||||
int? relationshipID;
|
||||
int? gender;
|
||||
String? dateofBirth;
|
||||
dynamic dateofBirthN;
|
||||
String? nationalityID;
|
||||
dynamic phoneResi;
|
||||
dynamic phoneOffice;
|
||||
String? mobileNumber;
|
||||
dynamic faxNumber;
|
||||
String? emailAddress;
|
||||
dynamic bloodGroup;
|
||||
dynamic rHFactor;
|
||||
bool? isEmailAlertRequired;
|
||||
bool? isSMSAlertRequired;
|
||||
String? preferredLanguage;
|
||||
bool? isPrivilegedMember;
|
||||
dynamic memberID;
|
||||
dynamic expiryDate;
|
||||
dynamic isHmgEmployee;
|
||||
dynamic employeeID;
|
||||
dynamic emergencyContactName;
|
||||
dynamic emergencyContactNo;
|
||||
int? patientPayType;
|
||||
dynamic dHCCPatientRefID;
|
||||
bool? isPatientDummy;
|
||||
int? status;
|
||||
dynamic isStatusCleared;
|
||||
int? patientIdentificationType;
|
||||
String? patientIdentificationNo;
|
||||
int? projectID;
|
||||
int? infoSourceID;
|
||||
dynamic address;
|
||||
int? age;
|
||||
String? ageDesc;
|
||||
int? areaID;
|
||||
int? createdBy;
|
||||
String? genderDescription;
|
||||
dynamic iR;
|
||||
dynamic iSOCityID;
|
||||
dynamic iSOCountryID;
|
||||
ListPrivilege? listPrivilege;
|
||||
dynamic marital;
|
||||
int? outSA;
|
||||
dynamic pOBox;
|
||||
bool? receiveHealthSummaryReport;
|
||||
int? sourceType;
|
||||
dynamic strDateofBirth;
|
||||
dynamic tempAddress;
|
||||
dynamic zipCode;
|
||||
|
||||
List({
|
||||
this.setupID,
|
||||
this.patientType,
|
||||
this.patientID,
|
||||
this.firstName,
|
||||
this.middleName,
|
||||
this.lastName,
|
||||
this.firstNameN,
|
||||
this.middleNameN,
|
||||
this.lastNameN,
|
||||
this.relationshipID,
|
||||
this.gender,
|
||||
this.dateofBirth,
|
||||
this.dateofBirthN,
|
||||
this.nationalityID,
|
||||
this.phoneResi,
|
||||
this.phoneOffice,
|
||||
this.mobileNumber,
|
||||
this.faxNumber,
|
||||
this.emailAddress,
|
||||
this.bloodGroup,
|
||||
this.rHFactor,
|
||||
this.isEmailAlertRequired,
|
||||
this.isSMSAlertRequired,
|
||||
this.preferredLanguage,
|
||||
this.isPrivilegedMember,
|
||||
this.memberID,
|
||||
this.expiryDate,
|
||||
this.isHmgEmployee,
|
||||
this.employeeID,
|
||||
this.emergencyContactName,
|
||||
this.emergencyContactNo,
|
||||
this.patientPayType,
|
||||
this.dHCCPatientRefID,
|
||||
this.isPatientDummy,
|
||||
this.status,
|
||||
this.isStatusCleared,
|
||||
this.patientIdentificationType,
|
||||
this.patientIdentificationNo,
|
||||
this.projectID,
|
||||
this.infoSourceID,
|
||||
this.address,
|
||||
this.age,
|
||||
this.ageDesc,
|
||||
this.areaID,
|
||||
this.createdBy,
|
||||
this.genderDescription,
|
||||
this.iR,
|
||||
this.iSOCityID,
|
||||
this.iSOCountryID,
|
||||
this.listPrivilege,
|
||||
this.marital,
|
||||
this.outSA,
|
||||
this.pOBox,
|
||||
this.receiveHealthSummaryReport,
|
||||
this.sourceType,
|
||||
this.strDateofBirth,
|
||||
this.tempAddress,
|
||||
this.zipCode,
|
||||
});
|
||||
|
||||
List.fromJson(Map<String, dynamic> json) {
|
||||
setupID = json['SetupID'];
|
||||
patientType = json['PatientType'];
|
||||
patientID = json['PatientID'];
|
||||
firstName = json['FirstName'];
|
||||
middleName = json['MiddleName'];
|
||||
lastName = json['LastName'];
|
||||
firstNameN = json['FirstNameN'];
|
||||
middleNameN = json['MiddleNameN'];
|
||||
lastNameN = json['LastNameN'];
|
||||
relationshipID = json['RelationshipID'];
|
||||
gender = json['Gender'];
|
||||
dateofBirth = json['DateofBirth'];
|
||||
dateofBirthN = json['DateofBirthN'];
|
||||
nationalityID = json['NationalityID'];
|
||||
phoneResi = json['PhoneResi'];
|
||||
phoneOffice = json['PhoneOffice'];
|
||||
mobileNumber = json['MobileNumber'];
|
||||
faxNumber = json['FaxNumber'];
|
||||
emailAddress = json['EmailAddress'];
|
||||
bloodGroup = json['BloodGroup'];
|
||||
rHFactor = json['RHFactor'];
|
||||
isEmailAlertRequired = json['IsEmailAlertRequired'];
|
||||
isSMSAlertRequired = json['IsSMSAlertRequired'];
|
||||
preferredLanguage = json['PreferredLanguage'];
|
||||
isPrivilegedMember = json['IsPrivilegedMember'];
|
||||
memberID = json['MemberID'];
|
||||
expiryDate = json['ExpiryDate'];
|
||||
isHmgEmployee = json['IsHmgEmployee'];
|
||||
employeeID = json['EmployeeID'];
|
||||
emergencyContactName = json['EmergencyContactName'];
|
||||
emergencyContactNo = json['EmergencyContactNo'];
|
||||
patientPayType = json['PatientPayType'];
|
||||
dHCCPatientRefID = json['DHCCPatientRefID'];
|
||||
isPatientDummy = json['IsPatientDummy'];
|
||||
status = json['Status'];
|
||||
isStatusCleared = json['IsStatusCleared'];
|
||||
patientIdentificationType = json['PatientIdentificationType'];
|
||||
patientIdentificationNo = json['PatientIdentificationNo'];
|
||||
projectID = json['ProjectID'];
|
||||
infoSourceID = json['InfoSourceID'];
|
||||
address = json['Address'];
|
||||
age = json['Age'];
|
||||
ageDesc = json['AgeDesc'];
|
||||
areaID = json['AreaID'];
|
||||
createdBy = json['CreatedBy'];
|
||||
genderDescription = json['GenderDescription'];
|
||||
iR = json['IR'];
|
||||
iSOCityID = json['ISOCityID'];
|
||||
iSOCountryID = json['ISOCountryID'];
|
||||
if (json['ListPrivilege'] != null) {
|
||||
listPrivilege = ListPrivilege.fromJson(json['ListPrivilege']);
|
||||
}
|
||||
marital = json['Marital'];
|
||||
outSA = json['OutSA'];
|
||||
pOBox = json['POBox'];
|
||||
receiveHealthSummaryReport = json['ReceiveHealthSummaryReport'];
|
||||
sourceType = json['SourceType'];
|
||||
strDateofBirth = json['StrDateofBirth'];
|
||||
tempAddress = json['TempAddress'];
|
||||
zipCode = json['ZipCode'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['SetupID'] = setupID;
|
||||
data['PatientType'] = patientType;
|
||||
data['PatientID'] = patientID;
|
||||
data['FirstName'] = firstName;
|
||||
data['MiddleName'] = middleName;
|
||||
data['LastName'] = lastName;
|
||||
data['FirstNameN'] = firstNameN;
|
||||
data['MiddleNameN'] = middleNameN;
|
||||
data['LastNameN'] = lastNameN;
|
||||
data['RelationshipID'] = relationshipID;
|
||||
data['Gender'] = gender;
|
||||
data['DateofBirth'] = dateofBirth;
|
||||
data['DateofBirthN'] = dateofBirthN;
|
||||
data['NationalityID'] = nationalityID;
|
||||
data['PhoneResi'] = phoneResi;
|
||||
data['PhoneOffice'] = phoneOffice;
|
||||
data['MobileNumber'] = mobileNumber;
|
||||
data['FaxNumber'] = faxNumber;
|
||||
data['EmailAddress'] = emailAddress;
|
||||
data['BloodGroup'] = bloodGroup;
|
||||
data['RHFactor'] = rHFactor;
|
||||
data['IsEmailAlertRequired'] = isEmailAlertRequired;
|
||||
data['IsSMSAlertRequired'] = isSMSAlertRequired;
|
||||
data['PreferredLanguage'] = preferredLanguage;
|
||||
data['IsPrivilegedMember'] = isPrivilegedMember;
|
||||
data['MemberID'] = memberID;
|
||||
data['ExpiryDate'] = expiryDate;
|
||||
data['IsHmgEmployee'] = isHmgEmployee;
|
||||
data['EmployeeID'] = employeeID;
|
||||
data['EmergencyContactName'] = emergencyContactName;
|
||||
data['EmergencyContactNo'] = emergencyContactNo;
|
||||
data['PatientPayType'] = patientPayType;
|
||||
data['DHCCPatientRefID'] = dHCCPatientRefID;
|
||||
data['IsPatientDummy'] = isPatientDummy;
|
||||
data['Status'] = status;
|
||||
data['IsStatusCleared'] = isStatusCleared;
|
||||
data['PatientIdentificationType'] = patientIdentificationType;
|
||||
data['PatientIdentificationNo'] = patientIdentificationNo;
|
||||
data['ProjectID'] = projectID;
|
||||
data['InfoSourceID'] = infoSourceID;
|
||||
data['Address'] = address;
|
||||
data['Age'] = age;
|
||||
data['AgeDesc'] = ageDesc;
|
||||
data['AreaID'] = areaID;
|
||||
data['CreatedBy'] = createdBy;
|
||||
data['GenderDescription'] = genderDescription;
|
||||
data['IR'] = iR;
|
||||
data['ISOCityID'] = iSOCityID;
|
||||
data['ISOCountryID'] = iSOCountryID;
|
||||
if (listPrivilege != null) {
|
||||
data['ListPrivilege'] = listPrivilege;
|
||||
}
|
||||
data['Marital'] = marital;
|
||||
data['OutSA'] = outSA;
|
||||
data['POBox'] = pOBox;
|
||||
data['ReceiveHealthSummaryReport'] = receiveHealthSummaryReport;
|
||||
data['SourceType'] = sourceType;
|
||||
data['StrDateofBirth'] = strDateofBirth;
|
||||
data['TempAddress'] = tempAddress;
|
||||
data['ZipCode'] = zipCode;
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ListPrivilege {
|
||||
int? iD;
|
||||
String? serviceName;
|
||||
bool? previlege;
|
||||
dynamic region;
|
||||
|
||||
ListPrivilege({this.iD, this.serviceName, this.previlege, this.region});
|
||||
|
||||
ListPrivilege.fromJson(Map<String, dynamic> json) {
|
||||
iD = json['ID'];
|
||||
serviceName = json['ServiceName'];
|
||||
previlege = json['Previlege'];
|
||||
region = json['Region'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['ID'] = iD;
|
||||
data['ServiceName'] = serviceName;
|
||||
data['Previlege'] = previlege;
|
||||
data['Region'] = region;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
import 'dart:convert';
|
||||
|
||||
Map<String, dynamic> selectDeviceByImeiRespModelFromJson(String str) => Map<String, dynamic>.from(json.decode(str));
|
||||
|
||||
String selectDeviceByImeiRespModelToJson(Map<String, dynamic> data) => json.encode(Map<String, dynamic>.from(data));
|
||||
|
||||
class SelectDeviceByImeiRespModelElement {
|
||||
int? id;
|
||||
String? imei;
|
||||
int? logInType;
|
||||
int? patientId;
|
||||
bool? outSa;
|
||||
String? mobile;
|
||||
String? identificationNo;
|
||||
String? name;
|
||||
String? nameN;
|
||||
String? createdOn;
|
||||
String? editedOn;
|
||||
bool? biometricEnabled;
|
||||
int? patientType;
|
||||
int? preferredLanguage;
|
||||
|
||||
SelectDeviceByImeiRespModelElement({
|
||||
this.id,
|
||||
this.imei,
|
||||
this.logInType,
|
||||
this.patientId,
|
||||
this.outSa,
|
||||
this.mobile,
|
||||
this.identificationNo,
|
||||
this.name,
|
||||
this.nameN,
|
||||
this.createdOn,
|
||||
this.editedOn,
|
||||
this.biometricEnabled,
|
||||
this.patientType,
|
||||
this.preferredLanguage,
|
||||
});
|
||||
|
||||
factory SelectDeviceByImeiRespModelElement.fromJson(Map<String, dynamic> json) => SelectDeviceByImeiRespModelElement(
|
||||
id: json["ID"] as int?,
|
||||
imei: json["IMEI"] as String?,
|
||||
logInType: json["LogInType"] as int?,
|
||||
patientId: json["PatientID"] as int?,
|
||||
outSa: json["OutSA"] as bool?,
|
||||
mobile: json["Mobile"] as String?,
|
||||
identificationNo: json["IdentificationNo"] as String?,
|
||||
name: json["Name"] as String?,
|
||||
nameN: json["NameN"] as String?,
|
||||
createdOn: json["CreatedOn"] as String?,
|
||||
editedOn: json["EditedOn"] as String?,
|
||||
biometricEnabled: json["BiometricEnabled"] as bool?,
|
||||
patientType: json["PatientType"] as int?,
|
||||
preferredLanguage: json["PreferredLanguage"] as int?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"ID": id,
|
||||
"IMEI": imei,
|
||||
"LogInType": logInType,
|
||||
"PatientID": patientId,
|
||||
"OutSA": outSa,
|
||||
"Mobile": mobile,
|
||||
"IdentificationNo": identificationNo,
|
||||
"Name": name,
|
||||
"NameN": nameN,
|
||||
"CreatedOn": createdOn,
|
||||
"EditedOn": editedOn,
|
||||
"BiometricEnabled": biometricEnabled,
|
||||
"PatientType": patientType,
|
||||
"PreferredLanguage": preferredLanguage,
|
||||
};
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:hmg_patient_app_new/core/api/api_client.dart';
|
||||
import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart';
|
||||
import 'package:hmg_patient_app_new/services/logger_service.dart';
|
||||
|
||||
abstract class BookAppointmentsRepo {
|
||||
Future<Either<Failure, dynamic>> getDoctors();
|
||||
}
|
||||
|
||||
class BookAppointmentsRepoImp implements BookAppointmentsRepo {
|
||||
final ApiClient apiClient;
|
||||
final LoggerService loggerService;
|
||||
|
||||
BookAppointmentsRepoImp({required this.loggerService, required this.apiClient});
|
||||
|
||||
@override
|
||||
Future<Either<Failure, dynamic>> getDoctors() async {
|
||||
try {
|
||||
// Mock API call with delayed response
|
||||
final result = await Future.delayed(
|
||||
const Duration(seconds: 2),
|
||||
() => {
|
||||
'success': true,
|
||||
'data': [
|
||||
{
|
||||
'id': '1',
|
||||
'name': 'Dr. Ahmed Hassan',
|
||||
'specialty': 'Cardiology',
|
||||
'experience': '10 years',
|
||||
'rating': 4.8,
|
||||
'image': 'https://example.com/doctor1.jpg'
|
||||
},
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
if (result != null && result is Map && result['success'] != null && result['success'] != false) {
|
||||
return Right(result);
|
||||
} else {
|
||||
loggerService.errorLogs(result.toString());
|
||||
return Left(ServerFailure(result.toString()));
|
||||
}
|
||||
} catch (e) {
|
||||
loggerService.errorLogs(e.toString());
|
||||
return Left(ServerFailure(e.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
import 'package:hmg_patient_app_new/services/logger_service.dart';
|
||||
|
||||
abstract class CommonRepo {
|
||||
|
||||
}
|
||||
|
||||
|
||||
class CommonRepoImp implements CommonRepo {
|
||||
LoggerService loggerService;
|
||||
|
||||
CommonRepoImp({required this.loggerService});
|
||||
|
||||
}
|
||||
@ -0,0 +1,79 @@
|
||||
import 'package:hmg_patient_app_new/core/api/api_client.dart';
|
||||
import 'package:hmg_patient_app_new/core/api_consts.dart';
|
||||
import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart';
|
||||
import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:hmg_patient_app_new/features/lab/models/resp_models/patient_lab_orders_response_model.dart';
|
||||
import 'package:hmg_patient_app_new/services/logger_service.dart';
|
||||
|
||||
abstract class LabRepo {
|
||||
Future<Either<Failure, GenericApiModel<List<PatientLabOrdersResponseModel>>>> getPatientLabOrders({required String patientId});
|
||||
}
|
||||
|
||||
class LabRepoImp implements LabRepo {
|
||||
final ApiClient apiClient;
|
||||
final LoggerService loggerService;
|
||||
|
||||
LabRepoImp({required this.loggerService, required this.apiClient});
|
||||
|
||||
@override
|
||||
Future<Either<Failure, GenericApiModel<List<PatientLabOrdersResponseModel>>>> getPatientLabOrders({required String patientId}) async {
|
||||
final mapDevice = {
|
||||
"isDentalAllowedBackend": false,
|
||||
"VersionID": 50.0,
|
||||
"Channel": 3,
|
||||
"LanguageID": 2,
|
||||
"IPAdress": "10.20.10.20",
|
||||
"generalid": "Cs2020@2016\$2958",
|
||||
"Latitude": 0.0,
|
||||
"Longitude": 0.0,
|
||||
"DeviceTypeID": 1,
|
||||
"PatientType": 1,
|
||||
"PatientTypeID": 1,
|
||||
"TokenID": "@dm!n",
|
||||
"PatientID": "2663907",
|
||||
"PatientOutSA": "0",
|
||||
"SessionID": "03478TYC02N80874CTYN04883475!?"
|
||||
};
|
||||
|
||||
try {
|
||||
GenericApiModel<List<PatientLabOrdersResponseModel>>? apiResponse;
|
||||
Failure? failure;
|
||||
await apiClient.post(
|
||||
GET_Patient_LAB_ORDERS,
|
||||
body: mapDevice,
|
||||
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
||||
failure = failureType;
|
||||
},
|
||||
onSuccess: (response, statusCode, {messageStatus}) {
|
||||
try {
|
||||
final list = response['ListPLO'];
|
||||
if (list == null || list.isEmpty) {
|
||||
throw Exception("lab list is empty");
|
||||
}
|
||||
|
||||
// final labOrders = list.map((item) => PatientLabOrdersResponseModel.fromJson(item as Map<String, dynamic>)).toList();
|
||||
final labOrders = list
|
||||
.map((item) => PatientLabOrdersResponseModel.fromJson(item as Map<String, dynamic>))
|
||||
.toList()
|
||||
.cast<PatientLabOrdersResponseModel>();
|
||||
|
||||
apiResponse = GenericApiModel<List<PatientLabOrdersResponseModel>>(
|
||||
messageStatus: messageStatus,
|
||||
statusCode: statusCode,
|
||||
errorMessage: null,
|
||||
data: labOrders,
|
||||
);
|
||||
} catch (e) {
|
||||
failure = DataParsingFailure(e.toString());
|
||||
}
|
||||
},
|
||||
);
|
||||
if (failure != null) return Left(failure!);
|
||||
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
|
||||
return Right(apiResponse!);
|
||||
} catch (e) {
|
||||
return Left(UnknownFailure(e.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/features/lab/lab_repo.dart';
|
||||
import 'package:hmg_patient_app_new/features/lab/models/resp_models/patient_lab_orders_response_model.dart';
|
||||
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
|
||||
|
||||
class LabViewModel extends ChangeNotifier {
|
||||
bool isLabOrdersLoading = false;
|
||||
bool isLabResultsLoading = false;
|
||||
|
||||
LabRepo labRepo;
|
||||
ErrorHandlerService errorHandlerService;
|
||||
|
||||
List<PatientLabOrdersResponseModel> patientLabOrders = [];
|
||||
|
||||
LabViewModel({required this.labRepo, required this.errorHandlerService});
|
||||
|
||||
initLabProvider() {
|
||||
patientLabOrders.clear();
|
||||
isLabOrdersLoading = true;
|
||||
isLabResultsLoading = true;
|
||||
getPatientLabOrders();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> getPatientLabOrders({Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
||||
final result = await labRepo.getPatientLabOrders(patientId: "1231755");
|
||||
|
||||
result.fold(
|
||||
(failure) async => await errorHandlerService.handleError(failure: failure),
|
||||
(apiResponse) {
|
||||
if (apiResponse.messageStatus == 2) {
|
||||
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
|
||||
} else if (apiResponse.messageStatus == 1) {
|
||||
patientLabOrders = apiResponse.data!;
|
||||
isLabOrdersLoading = false;
|
||||
isLabResultsLoading = false;
|
||||
notifyListeners();
|
||||
if (onSuccess != null) {
|
||||
onSuccess(apiResponse);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,245 @@
|
||||
class PatientLabOrdersResponseModel {
|
||||
int? actualDoctorRate;
|
||||
dynamic? admissionDate;
|
||||
dynamic? admissionNumber;
|
||||
dynamic? appointmentDate;
|
||||
dynamic? appointmentNo;
|
||||
dynamic? appointmentTime;
|
||||
String? clinicDescription;
|
||||
String? clinicDescriptionEnglish;
|
||||
dynamic? clinicDescriptionN;
|
||||
int? clinicID;
|
||||
String? createdOn;
|
||||
num? decimalDoctorRate;
|
||||
int? doctorID;
|
||||
String? doctorImageURL;
|
||||
String? doctorName;
|
||||
String? doctorNameEnglish;
|
||||
dynamic? doctorNameN;
|
||||
int? doctorRate;
|
||||
num? doctorStarsRate;
|
||||
String? doctorTitle;
|
||||
int? gender;
|
||||
String? genderDescription;
|
||||
String? invoiceNo;
|
||||
dynamic? invoiceNoVP;
|
||||
String? invoiceType;
|
||||
bool? isActiveDoctorProfile;
|
||||
bool? isDoctorAllowVedioCall;
|
||||
bool? isDrReviewReq;
|
||||
bool? isExecludeDoctor;
|
||||
bool? isInOutPatient;
|
||||
String? isInOutPatientDescription;
|
||||
String? isInOutPatientDescriptionN;
|
||||
bool? isLiveCareAppointment;
|
||||
bool? isRead;
|
||||
bool? isSendEmail;
|
||||
String? nationalityFlagURL;
|
||||
int? noOfPatientsRate;
|
||||
String? orderDate;
|
||||
String? orderNo;
|
||||
dynamic? orderProjectID;
|
||||
String? patientID;
|
||||
String? projectID;
|
||||
String? projectName;
|
||||
dynamic? projectNameN;
|
||||
String? qR;
|
||||
String? setupID;
|
||||
List<String>? speciality;
|
||||
int? status;
|
||||
String? statusDesc;
|
||||
String? strOrderDate;
|
||||
List<TestDetails>? testDetails;
|
||||
|
||||
PatientLabOrdersResponseModel(
|
||||
{this.actualDoctorRate,
|
||||
this.admissionDate,
|
||||
this.admissionNumber,
|
||||
this.appointmentDate,
|
||||
this.appointmentNo,
|
||||
this.appointmentTime,
|
||||
this.clinicDescription,
|
||||
this.clinicDescriptionEnglish,
|
||||
this.clinicDescriptionN,
|
||||
this.clinicID,
|
||||
this.createdOn,
|
||||
this.decimalDoctorRate,
|
||||
this.doctorID,
|
||||
this.doctorImageURL,
|
||||
this.doctorName,
|
||||
this.doctorNameEnglish,
|
||||
this.doctorNameN,
|
||||
this.doctorRate,
|
||||
this.doctorStarsRate,
|
||||
this.doctorTitle,
|
||||
this.gender,
|
||||
this.genderDescription,
|
||||
this.invoiceNo,
|
||||
this.invoiceNoVP,
|
||||
this.invoiceType,
|
||||
this.isActiveDoctorProfile,
|
||||
this.isDoctorAllowVedioCall,
|
||||
this.isDrReviewReq,
|
||||
this.isExecludeDoctor,
|
||||
this.isInOutPatient,
|
||||
this.isInOutPatientDescription,
|
||||
this.isInOutPatientDescriptionN,
|
||||
this.isLiveCareAppointment,
|
||||
this.isRead,
|
||||
this.isSendEmail,
|
||||
this.nationalityFlagURL,
|
||||
this.noOfPatientsRate,
|
||||
this.orderDate,
|
||||
this.orderNo,
|
||||
this.orderProjectID,
|
||||
this.patientID,
|
||||
this.projectID,
|
||||
this.projectName,
|
||||
this.projectNameN,
|
||||
this.qR,
|
||||
this.setupID,
|
||||
this.speciality,
|
||||
this.status,
|
||||
this.statusDesc,
|
||||
this.strOrderDate,
|
||||
this.testDetails});
|
||||
|
||||
PatientLabOrdersResponseModel.fromJson(Map<String, dynamic> json) {
|
||||
actualDoctorRate = json['ActualDoctorRate'];
|
||||
admissionDate = json['AdmissionDate'];
|
||||
admissionNumber = json['AdmissionNumber'];
|
||||
appointmentDate = json['AppointmentDate'];
|
||||
appointmentNo = json['AppointmentNo'];
|
||||
appointmentTime = json['AppointmentTime'];
|
||||
clinicDescription = json['ClinicDescription'];
|
||||
clinicDescriptionEnglish = json['ClinicDescriptionEnglish'];
|
||||
clinicDescriptionN = json['ClinicDescriptionN'];
|
||||
clinicID = json['ClinicID'];
|
||||
createdOn = json['CreatedOn'];
|
||||
decimalDoctorRate = json['DecimalDoctorRate'];
|
||||
doctorID = json['DoctorID'];
|
||||
doctorImageURL = json['DoctorImageURL'];
|
||||
doctorName = json['DoctorName'];
|
||||
doctorNameEnglish = json['DoctorNameEnglish'];
|
||||
doctorNameN = json['DoctorNameN'];
|
||||
doctorRate = json['DoctorRate'];
|
||||
doctorStarsRate = json['DoctorStarsRate'];
|
||||
doctorTitle = json['DoctorTitle'];
|
||||
gender = json['Gender'];
|
||||
genderDescription = json['GenderDescription'];
|
||||
invoiceNo = json['InvoiceNo'];
|
||||
invoiceNoVP = json['InvoiceNo_VP'];
|
||||
invoiceType = json['InvoiceType'];
|
||||
isActiveDoctorProfile = json['IsActiveDoctorProfile'];
|
||||
isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall'];
|
||||
isDrReviewReq = json['IsDrReviewReq'];
|
||||
isExecludeDoctor = json['IsExecludeDoctor'];
|
||||
isInOutPatient = json['IsInOutPatient'];
|
||||
isInOutPatientDescription = json['IsInOutPatientDescription'];
|
||||
isInOutPatientDescriptionN = json['IsInOutPatientDescriptionN'];
|
||||
isLiveCareAppointment = json['IsLiveCareAppointment'];
|
||||
isRead = json['IsRead'];
|
||||
isSendEmail = json['IsSendEmail'];
|
||||
nationalityFlagURL = json['NationalityFlagURL'];
|
||||
noOfPatientsRate = json['NoOfPatientsRate'];
|
||||
orderDate = json['OrderDate'];
|
||||
orderNo = json['OrderNo'];
|
||||
orderProjectID = json['OrderProjectID'];
|
||||
patientID = json['PatientID'];
|
||||
projectID = json['ProjectID'];
|
||||
projectName = json['ProjectName'];
|
||||
projectNameN = json['ProjectNameN'];
|
||||
qR = json['QR'];
|
||||
setupID = json['SetupID'];
|
||||
speciality = json['Speciality'].cast<String>();
|
||||
status = json['Status'];
|
||||
statusDesc = json['StatusDesc'];
|
||||
strOrderDate = json['StrOrderDate'];
|
||||
if (json['TestDetails'] != dynamic) {
|
||||
testDetails = <TestDetails>[];
|
||||
json['TestDetails'].forEach((v) {
|
||||
testDetails!.add(new TestDetails.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['ActualDoctorRate'] = this.actualDoctorRate;
|
||||
data['AdmissionDate'] = this.admissionDate;
|
||||
data['AdmissionNumber'] = this.admissionNumber;
|
||||
data['AppointmentDate'] = this.appointmentDate;
|
||||
data['AppointmentNo'] = this.appointmentNo;
|
||||
data['AppointmentTime'] = this.appointmentTime;
|
||||
data['ClinicDescription'] = this.clinicDescription;
|
||||
data['ClinicDescriptionEnglish'] = this.clinicDescriptionEnglish;
|
||||
data['ClinicDescriptionN'] = this.clinicDescriptionN;
|
||||
data['ClinicID'] = this.clinicID;
|
||||
data['CreatedOn'] = this.createdOn;
|
||||
data['DecimalDoctorRate'] = this.decimalDoctorRate;
|
||||
data['DoctorID'] = this.doctorID;
|
||||
data['DoctorImageURL'] = this.doctorImageURL;
|
||||
data['DoctorName'] = this.doctorName;
|
||||
data['DoctorNameEnglish'] = this.doctorNameEnglish;
|
||||
data['DoctorNameN'] = this.doctorNameN;
|
||||
data['DoctorRate'] = this.doctorRate;
|
||||
data['DoctorStarsRate'] = this.doctorStarsRate;
|
||||
data['DoctorTitle'] = this.doctorTitle;
|
||||
data['Gender'] = this.gender;
|
||||
data['GenderDescription'] = this.genderDescription;
|
||||
data['InvoiceNo'] = this.invoiceNo;
|
||||
data['InvoiceNo_VP'] = this.invoiceNoVP;
|
||||
data['InvoiceType'] = this.invoiceType;
|
||||
data['IsActiveDoctorProfile'] = this.isActiveDoctorProfile;
|
||||
data['IsDoctorAllowVedioCall'] = this.isDoctorAllowVedioCall;
|
||||
data['IsDrReviewReq'] = this.isDrReviewReq;
|
||||
data['IsExecludeDoctor'] = this.isExecludeDoctor;
|
||||
data['IsInOutPatient'] = this.isInOutPatient;
|
||||
data['IsInOutPatientDescription'] = this.isInOutPatientDescription;
|
||||
data['IsInOutPatientDescriptionN'] = this.isInOutPatientDescriptionN;
|
||||
data['IsLiveCareAppointment'] = this.isLiveCareAppointment;
|
||||
data['IsRead'] = this.isRead;
|
||||
data['IsSendEmail'] = this.isSendEmail;
|
||||
data['NationalityFlagURL'] = this.nationalityFlagURL;
|
||||
data['NoOfPatientsRate'] = this.noOfPatientsRate;
|
||||
data['OrderDate'] = this.orderDate;
|
||||
data['OrderNo'] = this.orderNo;
|
||||
data['OrderProjectID'] = this.orderProjectID;
|
||||
data['PatientID'] = this.patientID;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['ProjectName'] = this.projectName;
|
||||
data['ProjectNameN'] = this.projectNameN;
|
||||
data['QR'] = this.qR;
|
||||
data['SetupID'] = this.setupID;
|
||||
data['Speciality'] = this.speciality;
|
||||
data['Status'] = this.status;
|
||||
data['StatusDesc'] = this.statusDesc;
|
||||
data['StrOrderDate'] = this.strOrderDate;
|
||||
if (this.testDetails != dynamic) {
|
||||
data['TestDetails'] = this.testDetails!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class TestDetails {
|
||||
String? description;
|
||||
String? testCode;
|
||||
String? testID;
|
||||
|
||||
TestDetails({this.description, this.testCode, this.testID});
|
||||
|
||||
TestDetails.fromJson(Map<String, dynamic> json) {
|
||||
description = json['Description'];
|
||||
testCode = json['TestCode'];
|
||||
testID = json['TestID'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['Description'] = this.description;
|
||||
data['TestCode'] = this.testCode;
|
||||
data['TestID'] = this.testID;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:hmg_patient_app_new/core/api/api_client.dart';
|
||||
import 'package:hmg_patient_app_new/core/exceptions/api_exception.dart';
|
||||
import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart';
|
||||
import 'package:hmg_patient_app_new/services/logger_service.dart';
|
||||
|
||||
abstract class MyAppointmentsRepo {
|
||||
Future<Either<Failure, dynamic>> getMyAppointments();
|
||||
}
|
||||
|
||||
class MyAppointmentsRepoImp implements MyAppointmentsRepo {
|
||||
final ApiClient apiClient;
|
||||
final LoggerService loggerService;
|
||||
|
||||
MyAppointmentsRepoImp({required this.loggerService, required this.apiClient});
|
||||
|
||||
@override
|
||||
Future<Either<Failure, dynamic>> getMyAppointments() async {
|
||||
try {
|
||||
// Mock API call with delayed response
|
||||
final result = await Future.delayed(
|
||||
const Duration(seconds: 2),
|
||||
() => {
|
||||
'success': true,
|
||||
'data': [
|
||||
{
|
||||
'id': '1',
|
||||
'doctorName': 'Dr. Ahmed Hassan',
|
||||
'specialty': 'Cardiology',
|
||||
'appointmentDate': '2025-09-05',
|
||||
'appointmentTime': '10:00 AM',
|
||||
'status': 'confirmed',
|
||||
'clinicName': 'HMG Hospital',
|
||||
'patientName': 'John Doe'
|
||||
},
|
||||
{
|
||||
'id': '2',
|
||||
'doctorName': 'Dr. Sarah Johnson',
|
||||
'specialty': 'Dermatology',
|
||||
'appointmentDate': '2025-09-08',
|
||||
'appointmentTime': '2:30 PM',
|
||||
'status': 'pending',
|
||||
'clinicName': 'HMG Medical Center',
|
||||
'patientName': 'John Doe'
|
||||
},
|
||||
{
|
||||
'id': '3',
|
||||
'doctorName': 'Dr. Mohamed Ali',
|
||||
'specialty': 'Pediatrics',
|
||||
'appointmentDate': '2025-08-25',
|
||||
'appointmentTime': '11:15 AM',
|
||||
'status': 'completed',
|
||||
'clinicName': 'HMG Children\'s Clinic',
|
||||
'patientName': 'John Doe'
|
||||
}
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
if (result != null && result is Map && result['success'] != null && result['success'] != false) {
|
||||
return Right(result);
|
||||
} else {
|
||||
loggerService.errorLogs(result.toString());
|
||||
return Left(ServerFailure(result.toString()));
|
||||
}
|
||||
} catch (e) {
|
||||
loggerService.errorLogs(e.toString());
|
||||
return Left(ServerFailure(e.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,127 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
|
||||
|
||||
class HabibWalletCard extends StatelessWidget {
|
||||
const HabibWalletCard({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
"My Balance".toText16(isBold: true),
|
||||
Row(
|
||||
children: [
|
||||
"View all services".toText12(color: AppColors.primaryRedColor),
|
||||
SizedBox(width: 2.h),
|
||||
Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 10.h),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 16.h),
|
||||
Container(
|
||||
// height: 150.h,
|
||||
width: double.infinity,
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||||
color: AppColors.whiteColor,
|
||||
borderRadius: 24,
|
||||
),
|
||||
child: Stack(children: [
|
||||
Positioned(
|
||||
right: 0,
|
||||
child: ClipRRect(borderRadius: BorderRadius.circular(24.0), child: Utils.buildSvgWithAssets(icon: AppAssets.habib_background_icon, width: 150.h, height: 150.h)),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.all(14.h),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
"Habib Wallet".toText15(isBold: true),
|
||||
Container(
|
||||
height: 40.h,
|
||||
width: 40.h,
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||||
color: AppColors.textColor,
|
||||
borderRadius: 8.h,
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(8.h),
|
||||
child: Utils.buildSvgWithAssets(
|
||||
icon: AppAssets.show_icon,
|
||||
width: 12.h,
|
||||
height: 12.h,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 4.h),
|
||||
Row(
|
||||
children: [
|
||||
Utils.buildSvgWithAssets(
|
||||
icon: AppAssets.saudi_riyal_icon,
|
||||
iconColor: AppColors.dividerColor,
|
||||
width: 24.h,
|
||||
height: 24.h,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
SizedBox(width: 8.h),
|
||||
"200.18".toText32(isBold: true),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 50.h),
|
||||
child: Row(
|
||||
children: [
|
||||
"View details".toText12(color: AppColors.primaryRedColor),
|
||||
SizedBox(width: 2.h),
|
||||
Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 10.h),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 150.h,
|
||||
child: Utils.getPaymentMethods(),
|
||||
),
|
||||
CustomButton(
|
||||
icon: AppAssets.recharge_icon,
|
||||
iconSize: 18.h,
|
||||
text: "Recharge",
|
||||
onPressed: () {},
|
||||
backgroundColor: AppColors.infoColor,
|
||||
borderColor: AppColors.infoColor,
|
||||
textColor: AppColors.whiteColor,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
borderRadius: 12,
|
||||
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
|
||||
height: 35.h,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
]),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,212 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
||||
import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/shimmer/movies_shimmer_widget.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class LabOrdersPage extends StatefulWidget {
|
||||
const LabOrdersPage({super.key});
|
||||
|
||||
@override
|
||||
State<LabOrdersPage> createState() => _LabOrdersPageState();
|
||||
}
|
||||
|
||||
class _LabOrdersPageState extends State<LabOrdersPage> {
|
||||
late LabViewModel labProvider;
|
||||
|
||||
int? expandedIndex;
|
||||
|
||||
// Sample data for demonstration
|
||||
final List<String> labOrders = [
|
||||
'Mohammad Al Harbi',
|
||||
'Mohammad Al Harbi',
|
||||
'Mohammad Al Harbi',
|
||||
'Mohammad Al Harbi',
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
scheduleMicrotask(() {
|
||||
labProvider.initLabProvider();
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
labProvider = Provider.of<LabViewModel>(context);
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.bgScaffoldColor,
|
||||
appBar: AppBar(
|
||||
title: const Text('Lab Results'),
|
||||
backgroundColor: AppColors.bgScaffoldColor,
|
||||
),
|
||||
body: Padding(
|
||||
padding: EdgeInsets.all(24.h),
|
||||
child: SingleChildScrollView(
|
||||
child: Consumer<LabViewModel>(
|
||||
builder: (context, model, child) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
LocaleKeys.labResults.tr(context: context).toText24(isBold: true),
|
||||
Utils.buildSvgWithAssets(icon: AppAssets.search_icon),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 16.h),
|
||||
// Build Tab Bar
|
||||
SizedBox(height: 16.h),
|
||||
// Expandable list
|
||||
ListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
itemCount: model.isLabOrdersLoading ? 5 : model.patientLabOrders.length,
|
||||
itemBuilder: (context, index) {
|
||||
final isExpanded = expandedIndex == index;
|
||||
return model.isLabOrdersLoading
|
||||
? const MoviesShimmerWidget()
|
||||
: AnimationConfiguration.staggeredList(
|
||||
position: index,
|
||||
duration: const Duration(milliseconds: 500),
|
||||
child: SlideAnimation(
|
||||
verticalOffset: 100.0,
|
||||
child: FadeInAnimation(
|
||||
child: AnimatedContainer(
|
||||
duration: Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
margin: EdgeInsets.symmetric(vertical: 8.h),
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
expandedIndex = isExpanded ? null : index;
|
||||
});
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(16.h),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
CustomButton(
|
||||
text: LocaleKeys.pending.tr(context: context),
|
||||
onPressed: () {},
|
||||
backgroundColor: getLabOrderStatusColor(model.patientLabOrders[index].status!).withOpacity(0.15),
|
||||
borderColor: getLabOrderStatusColor(model.patientLabOrders[index].status!).withOpacity(0.01),
|
||||
textColor: getLabOrderStatusColor(model.patientLabOrders[index].status!),
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w500,
|
||||
borderRadius: 8,
|
||||
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
|
||||
height: 30.h,
|
||||
),
|
||||
Icon(isExpanded ? Icons.expand_less : Icons.expand_more),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8.h),
|
||||
Row(
|
||||
children: [
|
||||
Image.network(
|
||||
model.patientLabOrders[index].doctorImageURL!,
|
||||
width: 24.h,
|
||||
height: 24.h,
|
||||
fit: BoxFit.fill,
|
||||
).circle(100),
|
||||
SizedBox(width: 4.h),
|
||||
model.patientLabOrders[index].doctorName!.toText16(isBold: true)
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8.h),
|
||||
Row(
|
||||
children: [
|
||||
CustomButton(
|
||||
text: DateUtil.formatDateToDate(DateUtil.convertStringToDate(model.patientLabOrders[index].createdOn), false),
|
||||
onPressed: () {},
|
||||
backgroundColor: AppColors.greyColor,
|
||||
borderColor: AppColors.greyColor,
|
||||
textColor: AppColors.blackColor,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
borderRadius: 8,
|
||||
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
|
||||
height: 24.h,
|
||||
),
|
||||
SizedBox(width: 8.h),
|
||||
CustomButton(
|
||||
text: model.patientLabOrders[index].clinicDescription!,
|
||||
onPressed: () {},
|
||||
backgroundColor: AppColors.greyColor,
|
||||
borderColor: AppColors.greyColor,
|
||||
textColor: AppColors.blackColor,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
borderRadius: 8,
|
||||
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
|
||||
height: 24.h,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
AnimatedCrossFade(
|
||||
firstChild: SizedBox.shrink(),
|
||||
secondChild: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 8.h),
|
||||
child: Text('Details for ${model.patientLabOrders[index].clinicDescription}'),
|
||||
),
|
||||
crossFadeState: isExpanded ? CrossFadeState.showSecond : CrossFadeState.showFirst,
|
||||
duration: Duration(milliseconds: 300),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Color getLabOrderStatusColor(num status) {
|
||||
switch (status) {
|
||||
case 44:
|
||||
return AppColors.warningColorYellow;
|
||||
case 45:
|
||||
return AppColors.warningColorYellow;
|
||||
case 16:
|
||||
return AppColors.successColor;
|
||||
case 17:
|
||||
return AppColors.successColor;
|
||||
default:
|
||||
return AppColors.greyColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
||||
|
||||
class MedicalFileCard extends StatelessWidget {
|
||||
final String label;
|
||||
|
||||
// final Color svgColor;
|
||||
final Color textColor;
|
||||
final Color backgroundColor;
|
||||
final String svgIcon;
|
||||
|
||||
MedicalFileCard({
|
||||
required this.label,
|
||||
// required this.svgColor,
|
||||
required this.textColor,
|
||||
required this.backgroundColor,
|
||||
this.svgIcon = "",
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||||
color: backgroundColor,
|
||||
borderRadius: 20,
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(8.h),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Utils.buildSvgWithAssets(icon: svgIcon, width: 30.h, height: 30.h, fit: BoxFit.contain),
|
||||
SizedBox(height: 12.h),
|
||||
label.toText11(color: textColor, isBold: true),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AuthenticationViewModel extends ChangeNotifier {
|
||||
// Add properties and methods related to authentication here
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class BottomNavigationProvider extends ChangeNotifier {
|
||||
int _currentIndex = 0;
|
||||
|
||||
int get currentIndex => _currentIndex;
|
||||
|
||||
void setIndex(int index) {
|
||||
_currentIndex = index;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,143 @@
|
||||
|
||||
import 'package:firebase_analytics/firebase_analytics.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
||||
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/authenticated_user_resp_model.dart';
|
||||
import 'package:hmg_patient_app_new/services/analytics/flows/advance_payments.dart';
|
||||
import 'package:hmg_patient_app_new/services/analytics/flows/app_nav.dart';
|
||||
import 'package:hmg_patient_app_new/services/analytics/flows/appointments.dart';
|
||||
import 'package:hmg_patient_app_new/services/analytics/flows/error_tracking.dart';
|
||||
import 'package:hmg_patient_app_new/services/analytics/flows/hamburger_menu.dart';
|
||||
import 'package:hmg_patient_app_new/services/analytics/flows/hmg_services.dart';
|
||||
import 'package:hmg_patient_app_new/services/analytics/flows/live_care.dart';
|
||||
import 'package:hmg_patient_app_new/services/analytics/flows/login_registration.dart';
|
||||
import 'package:hmg_patient_app_new/services/analytics/flows/offers_promotions.dart';
|
||||
import 'package:hmg_patient_app_new/services/analytics/flows/todo_list.dart';
|
||||
import 'package:http/http.dart' as AnalyticEvents;
|
||||
|
||||
|
||||
typedef GALogger = Function(String name, {Map<String, dynamic> parameters});
|
||||
|
||||
var _analytics = FirebaseAnalytics.instance;
|
||||
|
||||
_logger(String name, {Map<String, dynamic>? parameters}) async {
|
||||
// return;
|
||||
if (name.isNotEmpty) {
|
||||
if (name.contains(' ')) name = name.replaceAll(' ', '_');
|
||||
|
||||
// To LowerCase
|
||||
if (parameters != null && parameters.isNotEmpty) {
|
||||
parameters = parameters.map((key, value) {
|
||||
final key_ = key.toLowerCase();
|
||||
var value_ = value;
|
||||
if (value is String) value_ = value.toLowerCase();
|
||||
return MapEntry(key_, value_);
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
final safeParameters = parameters?.map((key, value) => MapEntry(key, value as Object));
|
||||
await _analytics.logEvent(
|
||||
name: name.trim().toLowerCase(),
|
||||
parameters: safeParameters,
|
||||
);
|
||||
} catch (e) {
|
||||
print('Error sending analytics event: $e');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class GAnalytics {
|
||||
static String? TREATMENT_TYPE;
|
||||
static String? APPOINTMENT_DETAIL_FLOW_TYPE;
|
||||
static String? PAYMENT_TYPE;
|
||||
|
||||
setUser(AuthenticatedUser user) async {
|
||||
try {
|
||||
_analytics.setUserProperty(name: 'user_language', value: user.preferredLanguage == '1' ? 'arabic' : 'english');
|
||||
_analytics.setUserProperty(name: 'userid', value: Utils.generateMd5Hash(user.emailAddress!));
|
||||
_analytics.setUserProperty(name: 'login_status', value: user == null ? 'guest' : 'loggedin');
|
||||
// if (await PermissionService.isLocationEnabled()) {
|
||||
// final location = await Geolocator.getCurrentPosition();
|
||||
// if (location != null && !location.isMocked) {
|
||||
// final places = await placemarkFromCoordinates(location.latitude, location.longitude,);
|
||||
// final countryCode = places.first.isoCountryCode;
|
||||
// _analytics.setUserProperty(name: 'user_country', value: countryCode);
|
||||
// }
|
||||
// } else {
|
||||
// _analytics.setUserProperty(name: 'user_country', value: "N/A");
|
||||
// }
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
// NavObserver navObserver() => NavObserver();
|
||||
final hamburgerMenu = HamburgerMenu(_logger);
|
||||
final bottomTabNavigation = AppNav(_logger);
|
||||
final hmgServices = HMGServices(_logger);
|
||||
final loginRegistration = LoginRegistration(_logger);
|
||||
final appointment = Appointment(_logger);
|
||||
final liveCare = LiveCare(_logger);
|
||||
final todoList = TodoList(_logger);
|
||||
final advancePayments = AdvancePayments(_logger);
|
||||
final offerPackages = OfferAndPromotion(_logger);
|
||||
final errorTracking = ErrorTracking(_logger);
|
||||
}
|
||||
|
||||
// // adb shell setprop debug.firebase.analytics.app com.ejada.hmg -> Android
|
||||
// class NavObserver extends RouteObserver<PageRoute<dynamic>> {
|
||||
// _sendScreenView(PageRoute route) async {
|
||||
// log(String className) {
|
||||
// var event = AnalyticEvents.get(className);
|
||||
// if (event.active != null) {
|
||||
// _analytics.setCurrentScreen(screenName: event.flutterName(), screenClassOverride: className).catchError(
|
||||
// (Object error) {
|
||||
// print('$FirebaseAnalyticsObserver: $error');
|
||||
// },
|
||||
// test: (Object error) {
|
||||
// return error is PlatformException;
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (route.settings.name != null && route.settings.name!.isNotEmpty && route.settings.name != "null") {
|
||||
// var class_ = routes[route.settings.name]!(0);
|
||||
// if (class_ != null) log(class_.toStringShort());
|
||||
// } else if (route is FadePage) {
|
||||
// var class_ = route.page;
|
||||
// if (class_ != null) log(class_.toStringShort());
|
||||
// } else if (route is MaterialPageRoute) {
|
||||
// var class_ = route.builder(route.subtreeContext!);
|
||||
// log(class_.toStringShort());
|
||||
// } else {
|
||||
// print("");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// void didPush(Route<dynamic> route, Route<dynamic>? previousRoute) {
|
||||
// super.didPush(route, previousRoute);
|
||||
// if (route is PageRoute) {
|
||||
// _sendScreenView(route);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// void didReplace({Route<dynamic>? newRoute, Route<dynamic>? oldRoute}) {
|
||||
// super.didReplace(newRoute: newRoute, oldRoute: oldRoute);
|
||||
// if (newRoute is PageRoute) {
|
||||
// _sendScreenView(newRoute);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// void didPop(Route<dynamic> route, Route<dynamic>? previousRoute) {
|
||||
// super.didPop(route, previousRoute);
|
||||
// // if (previousRoute is PageRoute && route is PageRoute) {
|
||||
// // _sendScreenView(previousRoute);
|
||||
// // }
|
||||
// }
|
||||
// }
|
||||
@ -0,0 +1,91 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
|
||||
|
||||
class AdvancePayments{
|
||||
|
||||
final GALogger logger;
|
||||
AdvancePayments(this.logger);
|
||||
|
||||
// R038
|
||||
payment_services({required String service_type}){
|
||||
logger('payment_services', parameters: {
|
||||
'service_type' : service_type
|
||||
});
|
||||
}
|
||||
|
||||
// R039
|
||||
wallet_recharge({required String service_type}){
|
||||
logger('wallet_recharge', parameters: {
|
||||
'service_type' : service_type
|
||||
});
|
||||
}
|
||||
|
||||
// R040
|
||||
wallet_payment_details(){
|
||||
logger('wallet_payment_details');
|
||||
}
|
||||
|
||||
// R041
|
||||
payment_method({required String method,type}){
|
||||
logger('payment_method', parameters: {
|
||||
'payment_method' : method,
|
||||
'payment_type' : type
|
||||
});
|
||||
}
|
||||
|
||||
// R042
|
||||
payment_confirm({required String method,type}){
|
||||
logger('payment_confirm', parameters: {
|
||||
'payment_method' : method,
|
||||
'payment_type' : type
|
||||
});
|
||||
}
|
||||
|
||||
// R043
|
||||
payment_otp_confirmation({required String method,type}){
|
||||
logger('payment_otp_confirmation', parameters: {
|
||||
'payment_method' : method,
|
||||
'payment_type' : type
|
||||
});
|
||||
}
|
||||
|
||||
// R044
|
||||
payment_confirm_card_details({required String method,type}){
|
||||
logger('payment_confirm_card_details', parameters: {
|
||||
'payment_method' : method,
|
||||
'payment_type' : type
|
||||
});
|
||||
}
|
||||
|
||||
// R045
|
||||
payment_pay({required String method,type}){
|
||||
logger('payment_pay', parameters: {
|
||||
'payment_method' : method,
|
||||
'payment_type' : type
|
||||
});
|
||||
}
|
||||
|
||||
// R046
|
||||
payment_success({required String hospital, payment_method, payment_type, txn_number, txn_amount, txn_currency}){
|
||||
logger('payment_success', parameters: {
|
||||
'payment_method' : payment_method,
|
||||
'payment_type' : payment_type,
|
||||
'hospital_name' : hospital,
|
||||
'transaction_number' : txn_number,
|
||||
'transaction_amount' : txn_amount,
|
||||
'transaction_currency' : txn_currency
|
||||
});
|
||||
}
|
||||
|
||||
payment_fail({required String hospital, payment_method, payment_type, txn_amount, txn_currency, error_type}){
|
||||
logger('payment_fail', parameters: {
|
||||
'payment_method' : payment_method,
|
||||
'payment_type' : payment_type,
|
||||
'hospital_name' : hospital,
|
||||
'transaction_amount' : txn_amount,
|
||||
'transaction_currency' : txn_currency,
|
||||
'error_type' : error_type
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
|
||||
|
||||
class AppNav{
|
||||
final name = 'app_nav';
|
||||
final GALogger logger;
|
||||
AppNav(this.logger);
|
||||
|
||||
logNavName(String value){
|
||||
logger(name, parameters: {
|
||||
'nav_name' : value
|
||||
});
|
||||
}
|
||||
|
||||
log({int? tabIndex, bool? isLoggedIn}){
|
||||
var nav_name = "";
|
||||
if(tabIndex == 1)
|
||||
nav_name = "medical file";
|
||||
if(tabIndex == 3)
|
||||
nav_name = "my family";
|
||||
if(tabIndex == 4)
|
||||
nav_name = "todo list";
|
||||
if(tabIndex == 5)
|
||||
nav_name = "help";
|
||||
|
||||
if(nav_name.isNotEmpty)
|
||||
logger(name, parameters: {
|
||||
'nav_name' : nav_name
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
|
||||
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
|
||||
|
||||
class ErrorTracking{
|
||||
|
||||
final GALogger logger;
|
||||
ErrorTracking(this.logger);
|
||||
|
||||
log(String type, {String? error}){
|
||||
logger('errors', parameters: {
|
||||
'error_type' : type ?? 'unknown',
|
||||
'error' : error ?? 'unknown',
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
|
||||
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
|
||||
|
||||
class HamburgerMenu{
|
||||
final hamburger_menu = 'hamburger_menu';
|
||||
|
||||
final GALogger logger;
|
||||
HamburgerMenu(this.logger);
|
||||
|
||||
logMenuItemClick(String value){
|
||||
logger(hamburger_menu, parameters: {
|
||||
'menu_item' : value
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
|
||||
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
|
||||
|
||||
class HMGServices{
|
||||
final hmg_services = 'hmg_services';
|
||||
|
||||
final GALogger logger;
|
||||
HMGServices(this.logger);
|
||||
logServiceName(String value){
|
||||
logger('hmg_services', parameters: {
|
||||
'services_name' : value
|
||||
});
|
||||
}
|
||||
viewAll(){
|
||||
logger('hmg_services', parameters: {
|
||||
'services_name' : 'view all services'
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,102 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
|
||||
|
||||
class LiveCare{
|
||||
|
||||
final GALogger logger;
|
||||
LiveCare(this.logger);
|
||||
|
||||
// R030.1
|
||||
livecare_immediate_consultation(){
|
||||
logger('livecare_immediate_consultation');
|
||||
}
|
||||
|
||||
// R030.2
|
||||
livecare_schedule_video_call(){
|
||||
logger('livecare_schedule_video_call');
|
||||
}
|
||||
|
||||
// R031.1
|
||||
livecare_clinic_schedule({required String clinic}){
|
||||
logger('livecare_clinic_schedule', parameters: {
|
||||
'clinic_type_online' : clinic
|
||||
});
|
||||
}
|
||||
|
||||
// R031.2
|
||||
livecare_immediate_consultation_clinic({required String clinic}){
|
||||
logger('livecare_immediate_consultation_clinic', parameters: {
|
||||
'clinic_type_online' : clinic
|
||||
});
|
||||
}
|
||||
|
||||
// R031.2
|
||||
livecare_schedule_video_call_clinic({required String clinic}){
|
||||
logger('livecare_schedule_video_call_clinic', parameters: {
|
||||
'clinic_type_online' : clinic
|
||||
});
|
||||
}
|
||||
|
||||
// R032
|
||||
livecare_immediate_consultation_TnC({required String clinic}){
|
||||
logger('livecare_immediate_consultation_tandc', parameters: {
|
||||
'clinic_type_online' : clinic
|
||||
});
|
||||
}
|
||||
|
||||
// R033
|
||||
payment_method({required String appointment_type, clinic, payment_method, payment_type}){
|
||||
logger('payment_method', parameters: {
|
||||
'appointment_type' : appointment_type,
|
||||
'clinic_type_online' : clinic,
|
||||
'payment_method' : payment_method,
|
||||
'payment_type' : payment_type
|
||||
});
|
||||
}
|
||||
|
||||
// R034
|
||||
payment_confirm({required String appointment_type, clinic, payment_method, payment_type}){
|
||||
logger('payment_confirm', parameters: {
|
||||
'appointment_type' : appointment_type,
|
||||
'clinic_type_online' : clinic,
|
||||
'payment_method' : payment_method,
|
||||
'payment_type' : payment_type
|
||||
});
|
||||
}
|
||||
|
||||
// R035
|
||||
payment_pay({required String appointment_type, clinic, hospital, payment_method, payment_type}){
|
||||
// logger('payment_pay', parameters: {
|
||||
// 'appointment_type' : appointment_type,
|
||||
// 'clinic_type_online' : clinic,
|
||||
// 'payment_method' : payment_method,
|
||||
// 'payment_type' : payment_type,
|
||||
// 'hospital_name' : hospital
|
||||
// });
|
||||
}
|
||||
|
||||
// R036
|
||||
payment_success({required String appointment_type, clinic, hospital, payment_method, payment_type, txn_number, txn_amount, txn_currency}){
|
||||
// appointment_type
|
||||
// clinic_type_online
|
||||
// payment_method
|
||||
// payment_type
|
||||
// hospital_name
|
||||
// transaction_number
|
||||
// transaction_amount
|
||||
// transaction_currency
|
||||
}
|
||||
|
||||
// R037
|
||||
livecare_immediate_consultation_payment_failed({required String appointment_type, clinic, payment_method, payment_type, txn_amount, txn_currency, error_message}){
|
||||
logger('livecare_immediate_consult_payment_fail', parameters: {
|
||||
'payment_method' : payment_method,
|
||||
'appointment_type' : appointment_type,
|
||||
'payment_type' : payment_type,
|
||||
'clinic_type_online' : clinic,
|
||||
'transaction_amount' : txn_amount,
|
||||
'transaction_currency' : txn_currency,
|
||||
'error_type' : error_message
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,156 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
|
||||
|
||||
class LoginRegistration{
|
||||
static int loginMethod = 0;
|
||||
static int verificationMethod = 0;
|
||||
|
||||
final GALogger logger;
|
||||
LoginRegistration(this.logger);
|
||||
// R004.1
|
||||
login_register_initiate(){
|
||||
logger('login_register_initiate');
|
||||
}
|
||||
|
||||
// R005.1
|
||||
visited_alhabib_group(bool value){
|
||||
// selection_type: yes/no
|
||||
logger('visited_alhabib_group', parameters: {
|
||||
'selection_type' : value ? 'yes' : 'no'
|
||||
});
|
||||
}
|
||||
|
||||
// R006.1, R007.1, R008.1, R009.1
|
||||
registration_cancel({required String step}){
|
||||
// registration_step : enter details
|
||||
// registration_step : personal info
|
||||
// registration_step : patient info
|
||||
// fourth (verification)
|
||||
logger('registration_cancel', parameters: {
|
||||
'registration_step' : step
|
||||
});
|
||||
}
|
||||
|
||||
// R006.2
|
||||
registration_enter_details(){
|
||||
logger('registration_enter_details');
|
||||
}
|
||||
|
||||
// R007.2
|
||||
registration_personal_info(){
|
||||
logger('registration_personal_info');
|
||||
}
|
||||
|
||||
// R008.2
|
||||
registration_patient_info(){
|
||||
logger('registration_patient_info');
|
||||
}
|
||||
|
||||
// R009.2
|
||||
registration_verification_option(){
|
||||
logger('registration_verification_option');
|
||||
}
|
||||
|
||||
// R010:registration_confirmation
|
||||
registration_confirmation(){
|
||||
// verification_method: by
|
||||
logger('registration_confirmation');
|
||||
}
|
||||
|
||||
registration_fail({required String errorType}){
|
||||
// verification_method: by
|
||||
logger('registration_fail', parameters: {
|
||||
'error_type' : errorType
|
||||
});
|
||||
}
|
||||
|
||||
// R011.1
|
||||
login_start({required String method}){
|
||||
logger('login_start', parameters: {
|
||||
'login_method' : method
|
||||
});
|
||||
}
|
||||
|
||||
// R011:login_verify_otp | R009:registration_verification_option
|
||||
verify_otp_method({bool forRegistration = false}){
|
||||
if(forRegistration == false)
|
||||
logger("login_verify_otp", parameters: {
|
||||
'login_method' : _getLoginMethod(),
|
||||
'verification_method' : _getVerificationMethod(),
|
||||
});
|
||||
else
|
||||
logger("registration_verification_option", parameters: {
|
||||
'verification_method' : _getVerificationMethod()
|
||||
});
|
||||
}
|
||||
|
||||
// R011:login_verify_otp | R009:registration_verification_option
|
||||
login_verfication({bool forRegistration = false}){
|
||||
if(forRegistration == false)
|
||||
logger("login_verfication", parameters: {
|
||||
'login_method' : _getLoginMethod(),
|
||||
'verification_method' : _getVerificationMethod(),
|
||||
});
|
||||
else
|
||||
logger("login_varification_register", parameters: {
|
||||
'login_method' : _getLoginMethod(),
|
||||
'verification_method' : _getVerificationMethod(),
|
||||
});
|
||||
}
|
||||
|
||||
// R011.2
|
||||
forget_file_number(){
|
||||
logger('forget_file_number');
|
||||
}
|
||||
|
||||
// R011.3
|
||||
register_now(){
|
||||
logger('register_now');
|
||||
}
|
||||
|
||||
// R012.1, R014.1
|
||||
login_successful(){
|
||||
logger('login_successful', parameters: {
|
||||
'login_method' : _getVerificationMethod()
|
||||
});
|
||||
}
|
||||
|
||||
// R012.4
|
||||
login_unsuccessful({required String method, error}){
|
||||
logger('login_unsuccessful', parameters: {
|
||||
'login_method' : method
|
||||
});
|
||||
}
|
||||
|
||||
login_fail({error}){
|
||||
logger('login_unsuccessful', parameters: {
|
||||
'login_method' : loginMethod,
|
||||
'error': error
|
||||
});
|
||||
}
|
||||
|
||||
// R013
|
||||
recover_file_number(){
|
||||
logger('recover_file_number');
|
||||
}
|
||||
|
||||
// R014.2
|
||||
login_with_other_account(){
|
||||
logger('login_with_other_account');
|
||||
}
|
||||
|
||||
|
||||
_getLoginMethod(){
|
||||
if(loginMethod == 1) return 'national id';
|
||||
if(loginMethod == 2) return 'file number';
|
||||
return 'otp';
|
||||
}
|
||||
|
||||
String _getVerificationMethod(){
|
||||
if(verificationMethod == 1) return 'sms';
|
||||
if(verificationMethod == 2) return 'fingerprint';
|
||||
if(verificationMethod == 3) return 'face id';
|
||||
if(verificationMethod == 4) return 'whatsapp';
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
|
||||
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
|
||||
|
||||
class OfferAndPromotion{
|
||||
|
||||
final GALogger logger;
|
||||
OfferAndPromotion(this.logger);
|
||||
|
||||
final offers_and_promotion = 'offers_&_promotion';
|
||||
|
||||
log(){
|
||||
logger('offers_and_promotion', parameters: {
|
||||
'promotion_name' : "offer"
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,111 @@
|
||||
|
||||
|
||||
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
|
||||
|
||||
class TodoList{
|
||||
|
||||
final GALogger logger;
|
||||
TodoList(this.logger);
|
||||
|
||||
// R047.1
|
||||
// to_do_list_pay_now(AppoitmentAllHistoryResultList appointment){
|
||||
// logger('to_do_list_pay_now', parameters: {
|
||||
// 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular',
|
||||
// 'clinic_type_online' : appointment.clinicName,
|
||||
// 'hospital_name' : appointment.projectName,
|
||||
// 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName,
|
||||
// 'payment_type' : 'appointment',
|
||||
// });
|
||||
// }
|
||||
|
||||
// // R047.2
|
||||
// to_do_list_more_details(AppoitmentAllHistoryResultList appointment){
|
||||
// logger('to_do_list_more_details', parameters: {
|
||||
// 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular',
|
||||
// 'clinic_type_online' : appointment.clinicName,
|
||||
// 'hospital_name' : appointment.projectName,
|
||||
// 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName,
|
||||
// 'payment_type' : 'appointment',
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// // R048
|
||||
// to_do_list_confirm_payment_details(AppoitmentAllHistoryResultList appointment){
|
||||
// logger('to_do_list_confirm_payment_details', parameters: {
|
||||
// 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular',
|
||||
// 'clinic_type_online' : appointment.clinicName,
|
||||
// 'hospital_name' : appointment.projectName,
|
||||
// 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName,
|
||||
// 'payment_type' : 'appointment',
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// // R048
|
||||
// to_do_list_cancel_payment_details(AppoitmentAllHistoryResultList appointment){
|
||||
// logger('to_do_list_cancel_payment_details', parameters: {
|
||||
// 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular',
|
||||
// 'clinic_type_online' : appointment.clinicName,
|
||||
// 'hospital_name' : appointment.projectName,
|
||||
// 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName,
|
||||
// 'payment_type' : 'appointment',
|
||||
// });
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// // R049.2
|
||||
// to_do_list_cancel_appointment(AppoitmentAllHistoryResultList appointment){
|
||||
// logger('to_do_list_cancel_appointment', parameters: {
|
||||
// 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular',
|
||||
// 'clinic_type_online' : appointment.clinicName,
|
||||
// 'hospital_name' : appointment.projectName,
|
||||
// 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName,
|
||||
// 'payment_type' : 'appointment',
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// // R049.3
|
||||
// to_do_list_confirm_appointment(AppoitmentAllHistoryResultList appointment){
|
||||
// logger('confirm_appointment', parameters: {
|
||||
// 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular',
|
||||
// 'flow_type' : 'todo list',
|
||||
// 'clinic_type_online' : appointment.clinicName,
|
||||
// 'hospital_name' : appointment.projectName,
|
||||
// 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName,
|
||||
// 'payment_type' : 'appointment',
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// // R050
|
||||
// to_do_list_check_in(AppoitmentAllHistoryResultList appointment){
|
||||
// logger('to_do_list_check_in', parameters: {
|
||||
// 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular',
|
||||
// 'clinic_type_online' : appointment.clinicName,
|
||||
// 'hospital_name' : appointment.projectName,
|
||||
// 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName,
|
||||
// 'payment_type' : 'appointment',
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// // R051
|
||||
// to_do_list_nfc(AppoitmentAllHistoryResultList appointment){
|
||||
// logger('to_do_list_nfc', parameters: {
|
||||
// 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular',
|
||||
// 'clinic_type_online' : appointment.clinicName,
|
||||
// 'hospital_name' : appointment.projectName,
|
||||
// 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName,
|
||||
// 'payment_type' : 'appointment',
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// // R052
|
||||
// to_do_list_nfc_cancel(AppoitmentAllHistoryResultList appointment){
|
||||
// logger('to_do_list_nfc_cancel', parameters: {
|
||||
// 'appointment_type' : appointment.isLiveCareAppointment != null ? appointment.isLiveCareAppointment! ? 'livecare' : 'regular' : 'regular',
|
||||
// 'clinic_type_online' : appointment.clinicName,
|
||||
// 'hospital_name' : appointment.projectName,
|
||||
// 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName,
|
||||
// 'payment_type' : 'appointment',
|
||||
// });
|
||||
// }
|
||||
}
|
||||
@ -1,291 +0,0 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:hmg_patient_app_new/services/api_exception.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:http/io_client.dart';
|
||||
|
||||
import '../core/app_state.dart';
|
||||
import '../core/consts.dart';
|
||||
import '../core/utils/utils.dart';
|
||||
import '../main.dart';
|
||||
|
||||
// ignore_for_file: avoid_annotating_with_dynamic
|
||||
|
||||
typedef FactoryConstructor<U> = U Function(dynamic);
|
||||
|
||||
class APIError {
|
||||
int? errorCode;
|
||||
String? errorMessage;
|
||||
|
||||
APIError(this.errorCode, this.errorMessage);
|
||||
|
||||
Map<String, dynamic> toJson() => {'errorCode': errorCode, 'errorMessage': errorMessage};
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
}
|
||||
|
||||
APIException _throwAPIException(Response response, Function retryCallBack) {
|
||||
switch (response.statusCode) {
|
||||
case 200:
|
||||
APIError? apiError;
|
||||
if (response.body != null && response.body.isNotEmpty) {
|
||||
var jsonError = jsonDecode(response.body);
|
||||
print(jsonError);
|
||||
apiError = APIError(jsonError['ErrorCode'], jsonError['ErrorMessage']);
|
||||
}
|
||||
return APIException(APIException.BAD_REQUEST, error: apiError);
|
||||
case 400:
|
||||
APIError? apiError;
|
||||
if (response.body != null && response.body.isNotEmpty) {
|
||||
var jsonError = jsonDecode(response.body);
|
||||
apiError = APIError(jsonError['ErrorCode'], jsonError['ErrorMessage']);
|
||||
}
|
||||
return APIException(APIException.BAD_REQUEST, error: apiError);
|
||||
case 401:
|
||||
return APIException(APIException.UNAUTHORIZED);
|
||||
case 403:
|
||||
return APIException(APIException.FORBIDDEN);
|
||||
case 404:
|
||||
return APIException(APIException.NOT_FOUND);
|
||||
case 500:
|
||||
return APIException(APIException.INTERNAL_SERVER_ERROR);
|
||||
case 444:
|
||||
var downloadUrl = response.headers["location"];
|
||||
return APIException(APIException.UPGRADE_REQUIRED, arguments: downloadUrl);
|
||||
default:
|
||||
return APIException(APIException.OTHER);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class IApiClient {
|
||||
Future<U> postJsonForObject<T, U>(FactoryConstructor<U> factoryConstructor, String url, T jsonObject,
|
||||
{String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0});
|
||||
|
||||
Future<Response> postJsonForResponse<T>(String url, T jsonObject, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0});
|
||||
|
||||
Future<Response> getJsonForResponse<T>(String url, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0});
|
||||
|
||||
void setHomeUrl(String url);
|
||||
}
|
||||
|
||||
class ApiClient implements IApiClient {
|
||||
// static final ApiClient _instance = ApiClient._internal();
|
||||
|
||||
// ApiClient._internal();
|
||||
|
||||
// factory ApiClient() => _instance;
|
||||
|
||||
@override
|
||||
Future<U> postJsonForObject<T, U>(FactoryConstructor<U> factoryConstructor, String url, T jsonObject,
|
||||
{String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0, bool isFormData = false}) async {
|
||||
var _headers = {'Accept': 'application/json'};
|
||||
if (headers != null && headers.isNotEmpty) {
|
||||
_headers.addAll(headers);
|
||||
}
|
||||
if (!kReleaseMode) {
|
||||
print("Url:$url");
|
||||
var bodyJson = json.encode(jsonObject);
|
||||
print("body:$bodyJson");
|
||||
}
|
||||
var response = await postJsonForResponse(url, jsonObject, token: token, queryParameters: queryParameters, headers: _headers, retryTimes: retryTimes);
|
||||
// try {
|
||||
if (!kReleaseMode) {
|
||||
logger.i("res: " + response.body);
|
||||
}
|
||||
var jsonData = jsonDecode(response.body);
|
||||
if (jsonData["IsAuthenticated"] != null) {
|
||||
AppState().setIsAuthenticated = jsonData["IsAuthenticated"];
|
||||
}
|
||||
if (jsonData["ErrorMessage"] == null) {
|
||||
return factoryConstructor(jsonData);
|
||||
} else {
|
||||
APIError? apiError;
|
||||
apiError = APIError(jsonData['ErrorCode'], jsonData['ErrorEndUserMessage']);
|
||||
throw APIException(APIException.BAD_REQUEST, error: apiError);
|
||||
}
|
||||
// } catch (ex) {
|
||||
// if (ex is APIException) {
|
||||
// rethrow;
|
||||
// } else {
|
||||
// throw APIException(APIException.BAD_RESPONSE_FORMAT, arguments: ex);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Response> postJsonForResponse<T>(String url, T jsonObject, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0}) async {
|
||||
String? requestBody;
|
||||
late Map<String, String> stringObj;
|
||||
if (jsonObject != null) {
|
||||
requestBody = jsonEncode(jsonObject);
|
||||
if (headers == null) {
|
||||
headers = {'Content-Type': 'application/json'};
|
||||
} else {
|
||||
headers['Content-Type'] = 'application/json';
|
||||
}
|
||||
}
|
||||
|
||||
return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes);
|
||||
}
|
||||
|
||||
Future<Response> _postForResponse(String url, requestBody, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0}) async {
|
||||
try {
|
||||
var _headers = <String, String>{};
|
||||
// if (token != null) {
|
||||
// _headers['Authorization'] = 'Bearer $token';
|
||||
// }
|
||||
|
||||
if (headers != null && headers.isNotEmpty) {
|
||||
_headers.addAll(headers);
|
||||
}
|
||||
if (queryParameters != null) {
|
||||
// var queryString = new Uri(queryParameters: queryParameters).query;
|
||||
var queryString = Uri(queryParameters: queryParameters.map((key, value) => MapEntry(key, value == null ? null : value.toString()))).query;
|
||||
url = url + '?' + queryString;
|
||||
}
|
||||
|
||||
// if (!kReleaseMode && url.contains("saned")) {
|
||||
if (!kReleaseMode) {
|
||||
print("Url: $url");
|
||||
print("Headers: $_headers");
|
||||
// var bodyJson = json.encode(requestBody);
|
||||
print("body: $requestBody");
|
||||
}
|
||||
|
||||
var response = await _post(Uri.parse(url), body: requestBody, headers: _headers).timeout(Duration(seconds: 120));
|
||||
|
||||
if (response.statusCode >= 200 && response.statusCode < 300) {
|
||||
return response;
|
||||
} else {
|
||||
throw _throwAPIException(response, () {
|
||||
// _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes, isAuthAPI: isAuthAPI);
|
||||
postJsonForResponse(url, requestBody);
|
||||
});
|
||||
}
|
||||
} on SocketException catch (e) {
|
||||
if (retryTimes > 0) {
|
||||
print('will retry after 3 seconds...');
|
||||
await Future.delayed(Duration(seconds: 3));
|
||||
return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
|
||||
} else {
|
||||
throw APIException(APIException.OTHER, arguments: e);
|
||||
}
|
||||
} on HttpException catch (e) {
|
||||
if (retryTimes > 0) {
|
||||
print('will retry after 3 seconds...');
|
||||
await Future.delayed(Duration(seconds: 3));
|
||||
return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
|
||||
} else {
|
||||
throw APIException(APIException.OTHER, arguments: e);
|
||||
}
|
||||
} on TimeoutException catch (e) {
|
||||
throw APIException(APIException.TIMEOUT, arguments: e);
|
||||
} on ClientException catch (e) {
|
||||
if (retryTimes > 0) {
|
||||
print('will retry after 3 seconds...');
|
||||
await Future.delayed(Duration(seconds: 3));
|
||||
return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
|
||||
} else {
|
||||
throw APIException(APIException.OTHER, arguments: e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Response> getJsonForResponse<T>(String url, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0, bool isAuthAPI = false}) async {
|
||||
logger.i("Url:$url");
|
||||
if (headers == null) {
|
||||
headers = {'Content-Type': 'application/json'};
|
||||
} else {
|
||||
headers['Content-Type'] = 'application/json';
|
||||
}
|
||||
return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes, isAuthAPI: isAuthAPI);
|
||||
}
|
||||
|
||||
Future<Response> _getForResponse(String url, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0, bool isAuthAPI = false}) async {
|
||||
try {
|
||||
var _headers = <String, String>{};
|
||||
if (token != null) {
|
||||
_headers['Authorization'] = 'Bearer $token';
|
||||
}
|
||||
|
||||
if (headers != null && headers.isNotEmpty) {
|
||||
_headers.addAll(headers);
|
||||
}
|
||||
|
||||
if (isAuthAPI) {
|
||||
String token = await Utils.getStringFromPrefs(SharedPrefsConsts.appAuthToken);
|
||||
_headers['Authorization'] = "Bearer $token";
|
||||
}
|
||||
|
||||
if (queryParameters != null) {
|
||||
var queryString = new Uri(queryParameters: queryParameters).query;
|
||||
url = url + '?' + queryString;
|
||||
}
|
||||
var response = await _get(Uri.parse(url), headers: _headers).timeout(Duration(seconds: 60));
|
||||
|
||||
if (response.statusCode >= 200 && response.statusCode < 300) {
|
||||
return response;
|
||||
} else {
|
||||
throw _throwAPIException(response, () {
|
||||
_getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes);
|
||||
});
|
||||
}
|
||||
} on SocketException catch (e) {
|
||||
if (retryTimes > 0) {
|
||||
print('will retry after 3 seconds...');
|
||||
await Future.delayed(Duration(seconds: 3));
|
||||
return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
|
||||
} else {
|
||||
throw APIException(APIException.OTHER, arguments: e);
|
||||
}
|
||||
} on HttpException catch (e) {
|
||||
if (retryTimes > 0) {
|
||||
print('will retry after 3 seconds...');
|
||||
await Future.delayed(Duration(seconds: 3));
|
||||
return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
|
||||
} else {
|
||||
throw APIException(APIException.OTHER, arguments: e);
|
||||
}
|
||||
} on TimeoutException catch (e) {
|
||||
throw APIException(APIException.TIMEOUT, arguments: e);
|
||||
} on ClientException catch (e) {
|
||||
if (retryTimes > 0) {
|
||||
print('will retry after 3 seconds...');
|
||||
await Future.delayed(Duration(seconds: 3));
|
||||
return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
|
||||
} else {
|
||||
throw APIException(APIException.OTHER, arguments: e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<Response> _get(url, {Map<String, String>? headers}) => _withClient((client) => client.get(url, headers: headers));
|
||||
|
||||
bool _certificateCheck(X509Certificate cert, String host, int port) => true;
|
||||
|
||||
Future<T> _withClient<T>(Future<T> Function(Client) fn) async {
|
||||
var httpClient = HttpClient()..badCertificateCallback = _certificateCheck;
|
||||
var client = IOClient(httpClient);
|
||||
try {
|
||||
return await fn(client);
|
||||
} finally {
|
||||
client.close();
|
||||
}
|
||||
}
|
||||
|
||||
Future<Response> _post(url, {Map<String, String>? headers, body, Encoding? encoding}) => _withClient((client) => client.post(url, headers: headers, body: body, encoding: encoding));
|
||||
|
||||
Future<Response> _put(url, {Map<String, String>? headers, body, Encoding? encoding}) => _withClient((client) => client.put(url, headers: headers, body: body, encoding: encoding));
|
||||
|
||||
@override
|
||||
void setHomeUrl(String url) {
|
||||
// TODO: implement setHomeUrl
|
||||
}
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:hmg_patient_app_new/core/app_state.dart';
|
||||
import 'package:http/http.dart';
|
||||
|
||||
import '../../core/consts.dart';
|
||||
import '../api_client.dart';
|
||||
import 'models/response_models/get_patient_last_login_details_response_model.dart';
|
||||
|
||||
class AuthenticationApiClient {
|
||||
static final AuthenticationApiClient _instance = AuthenticationApiClient._internal();
|
||||
|
||||
AuthenticationApiClient._internal();
|
||||
|
||||
factory AuthenticationApiClient() => _instance;
|
||||
|
||||
Future<GetPatientLastLoginDetailsResponseModel> getMultipleLoginUserData(String deviceIMEI) async {
|
||||
GetPatientLastLoginDetailsResponseModel getPatientLastLoginDetailsResponseModel;
|
||||
|
||||
Map<String, dynamic> request = {"IMEI": deviceIMEI};
|
||||
request.addAll(AppState().postParamsJson);
|
||||
String url = ApiConsts.baseUrl + ApiConsts.SELECT_DEVICE_IMEI;
|
||||
Response response = await ApiClient().postJsonForResponse(url, request);
|
||||
|
||||
var json = jsonDecode(response.body);
|
||||
getPatientLastLoginDetailsResponseModel = GetPatientLastLoginDetailsResponseModel.fromJson(json);
|
||||
|
||||
return getPatientLastLoginDetailsResponseModel;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
abstract class CacheService {
|
||||
|
||||
}
|
||||
|
||||
class CacheServiceImp implements CacheService {
|
||||
SharedPreferences sharedPreferences;
|
||||
|
||||
CacheServiceImp({required this.sharedPreferences});
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,79 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/route_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/services/navigation_service.dart';
|
||||
|
||||
abstract class DialogService {
|
||||
Future<void> showErrorDialog({required String message, Function()? onOkPressed});
|
||||
}
|
||||
|
||||
class DialogServiceImp implements DialogService {
|
||||
final NavigationService navigationService;
|
||||
|
||||
DialogServiceImp({required this.navigationService});
|
||||
|
||||
@override
|
||||
Future<void> showErrorDialog({required String message, Function()? onOkPressed}) async {
|
||||
final context = navigationService.navigatorKey.currentContext;
|
||||
if (context == null) return;
|
||||
|
||||
await showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: false,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
|
||||
),
|
||||
builder: (_) => _ErrorBottomSheet(message: message, onOkPressed: onOkPressed),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ErrorBottomSheet extends StatelessWidget {
|
||||
final String message;
|
||||
final Function()? onOkPressed;
|
||||
|
||||
const _ErrorBottomSheet({required this.message, this.onOkPressed});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.error_outline, color: Colors.red, size: 40),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
"Error",
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
color: Colors.red,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
message,
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
if (onOkPressed != null) {
|
||||
onOkPressed!();
|
||||
} else {
|
||||
context.pop();
|
||||
}
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.red,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
child: const Text("OK"),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:hmg_patient_app_new/core/exceptions/api_exception.dart';
|
||||
import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart';
|
||||
import 'package:hmg_patient_app_new/services/dialog_service.dart';
|
||||
import 'package:hmg_patient_app_new/services/logger_service.dart';
|
||||
import 'package:hmg_patient_app_new/services/navigation_service.dart';
|
||||
|
||||
abstract class ErrorHandlerService {
|
||||
Future<void> handleError({required Failure failure, Function() onOkPressed});
|
||||
}
|
||||
|
||||
class ErrorHandlerServiceImp implements ErrorHandlerService {
|
||||
final DialogService dialogService;
|
||||
final LoggerService loggerService;
|
||||
final NavigationService navigationService;
|
||||
|
||||
ErrorHandlerServiceImp({
|
||||
required this.dialogService,
|
||||
required this.loggerService,
|
||||
required this.navigationService,
|
||||
});
|
||||
|
||||
@override
|
||||
Future<void> handleError({required Failure failure, Function()? onOkPressed}) async {
|
||||
if (failure is APIException) {
|
||||
loggerService.errorLogs("API Exception: ${failure.message}");
|
||||
} else if (failure is ServerFailure) {
|
||||
loggerService.errorLogs("Server Failure: ${failure.message}");
|
||||
await _showDialog(failure);
|
||||
} else if (failure is DataParsingFailure) {
|
||||
loggerService.errorLogs("Data Parsing Failure: ${failure.message}");
|
||||
await _showDialog(failure, title: "Data Error");
|
||||
} else if (failure is StatusCodeFailure) {
|
||||
loggerService.errorLogs("StatusCode Failure: ${failure.message}");
|
||||
await _showDialog(failure, title: "Status Code Failure Error");
|
||||
} else if (failure is HttpException) {
|
||||
loggerService.errorLogs("Http Exception: ${failure.message}");
|
||||
await _showDialog(failure, title: "Network Error");
|
||||
} else if (failure is UnknownFailure) {
|
||||
loggerService.errorLogs("Unknown Failure: ${failure.message}");
|
||||
await _showDialog(failure, title: "Unknown Error");
|
||||
} else if (failure is InvalidCredentials) {
|
||||
loggerService.errorLogs("Invalid Credentials : ${failure.message}");
|
||||
await _showDialog(failure, title: "Unknown Error");
|
||||
} else {
|
||||
loggerService.errorLogs("Unhandled failure type: $failure");
|
||||
await _showDialog(failure, title: "Error");
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _showDialog(Failure failure, {String title = "Error", Function()? onOkPressed}) async {
|
||||
await dialogService.showErrorDialog(message: failure.message, onOkPressed: onOkPressed);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
|
||||
import 'package:logger/logger.dart';
|
||||
|
||||
abstract class LoggerService {
|
||||
|
||||
void errorLogs(String message);
|
||||
|
||||
void logInfo(String message);
|
||||
}
|
||||
|
||||
class LoggerServiceImp implements LoggerService {
|
||||
Logger logger;
|
||||
|
||||
LoggerServiceImp({required this.logger});
|
||||
|
||||
|
||||
|
||||
@override
|
||||
void errorLogs(String message) {
|
||||
logger.e(message);
|
||||
}
|
||||
|
||||
@override
|
||||
void logInfo(String message) {
|
||||
logger.i(message);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class NavigationService {
|
||||
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
|
||||
|
||||
BuildContext? get context => navigatorKey.currentContext;
|
||||
|
||||
Future<T?> push<T>(Route<T> route) {
|
||||
return navigatorKey.currentState!.push(route);
|
||||
}
|
||||
|
||||
void pop<T extends Object?>([T? result]) {
|
||||
navigatorKey.currentState!.pop(result);
|
||||
}
|
||||
}
|
||||