Merge branch 'master' into fatima

# Conflicts:
#	lib/ui/leave_balance/add_leave_balance_screen.dart
fatima
Fatimah Alshammari 2 years ago
commit 7a5879eeb6

@ -1,23 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" width="29.557" height="29.557" viewBox="0 0 29.557 29.557">
<g id="chat_3_" data-name="chat (3)" transform="translate(0 -0.008)">
<g id="Group_8672" data-name="Group 8672" transform="translate(0 0.007)">
<g id="Group_8671" data-name="Group 8671" transform="translate(0 0)">
<path id="Path_13684" data-name="Path 13684" d="M29.348,17.685l-2.039-2.379A8.6,8.6,0,0,0,29.556,9.59c0-5.369-5.209-9.583-11.315-9.583-6.207,0-11.257,4.3-11.257,9.583,0,.133,0,.266.011.4-4.131,1.641-7,5.18-7,9.271a9.341,9.341,0,0,0,2.483,6.276L.214,28.127a.866.866,0,0,0,.652,1.436H13.046c.1,0,.4-.055.462-.061A12.95,12.95,0,0,0,21,26.322a9.481,9.481,0,0,0,3.3-7.207H28.69A.867.867,0,0,0,29.348,17.685ZM13.219,27.79c-.076.006-.337.029-.39.042H2.774l1.538-1.758a.866.866,0,0,0-.056-1.2,7.739,7.739,0,0,1-2.525-5.616c0-4.694,4.687-8.515,10.449-8.515,5.73,0,10.391,3.82,10.391,8.515C22.571,23.649,18.482,27.36,13.219,27.79ZM24.1,17.383h0C23.057,12.566,18.06,9.013,12.18,9.013a14.281,14.281,0,0,0-3.461.422c.1-4.258,4.333-7.7,9.523-7.7,5.284,0,9.583,3.522,9.583,7.851a7.016,7.016,0,0,1-2.284,5.058.866.866,0,0,0-.059,1.189l1.326,1.547Z" transform="translate(0 -0.007)" fill="#989898"/>
<svg xmlns="http://www.w3.org/2000/svg" width="24.322" height="24.322" viewBox="0 0 24.322 24.322">
<g id="chat_8_" data-name="chat (8)" transform="translate(0 -0.006)">
<g id="Group_7919" data-name="Group 7919" transform="translate(0 7.368)">
<g id="Group_7918" data-name="Group 7918">
<path id="Path_4723" data-name="Path 4723" d="M10.023,155C4.522,155,0,158.78,0,163.43a7.852,7.852,0,0,0,2.043,5.211L.176,170.775a.713.713,0,0,0,.536,1.182H10.735c4.061,0,9.31-3.5,9.31-8.526C20.045,158.78,15.523,155,10.023,155ZM5.7,164.736a1.425,1.425,0,1,1,1.425-1.425A1.427,1.427,0,0,1,5.7,164.736Zm4.323,0a1.425,1.425,0,1,1,1.425-1.425A1.427,1.427,0,0,1,10.023,164.736Zm4.323,0a1.425,1.425,0,1,1,1.425-1.425A1.427,1.427,0,0,1,14.345,164.736Z" transform="translate(0 -154.998)" fill="#818181"/>
</g>
</g>
<g id="Group_8674" data-name="Group 8674" transform="translate(5.253 17.383)">
<g id="Group_8673" data-name="Group 8673">
<path id="Path_13685" data-name="Path 13685" d="M92.729,301a1.732,1.732,0,1,0,1.732,1.732A1.734,1.734,0,0,0,92.729,301Z" transform="translate(-90.997 -300.999)" fill="#989898"/>
</g>
</g>
<g id="Group_8676" data-name="Group 8676" transform="translate(10.448 17.383)">
<g id="Group_8675" data-name="Group 8675">
<path id="Path_13686" data-name="Path 13686" d="M182.726,301a1.732,1.732,0,1,0,1.732,1.732A1.734,1.734,0,0,0,182.726,301Z" transform="translate(-180.994 -300.999)" fill="#989898"/>
</g>
</g>
<g id="Group_8678" data-name="Group 8678" transform="translate(15.644 17.383)">
<g id="Group_8677" data-name="Group 8677">
<path id="Path_13687" data-name="Path 13687" d="M272.723,301a1.732,1.732,0,1,0,1.732,1.732A1.734,1.734,0,0,0,272.723,301Z" transform="translate(-270.991 -300.999)" fill="#989898"/>
<g id="Group_7921" data-name="Group 7921" transform="translate(5.823 0.006)">
<g id="Group_7920" data-name="Group 7920" transform="translate(0 0)">
<path id="Path_4724" data-name="Path 4724" d="M140.909,14.5l-1.678-1.957a7.078,7.078,0,0,0,1.849-4.7c0-4.322-4.155-7.838-9.263-7.838-4.618,0-8.542,2.878-9.235,6.624a13.184,13.184,0,0,1,4.2-.687c6.24,0,11.366,4.358,11.441,9.738h2.144A.713.713,0,0,0,140.909,14.5Z" transform="translate(-122.583 -0.006)" fill="#818181"/>
</g>
</g>
</g>

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -1,7 +1,5 @@
<svg id="interview_3_" data-name="interview (3)" xmlns="http://www.w3.org/2000/svg" width="27.258" height="27.258" viewBox="0 0 27.258 27.258">
<path id="Path_4667" data-name="Path 4667" d="M7.663,248.55a4.22,4.22,0,1,0-5.175,0A5.07,5.07,0,0,0,0,252.918v1.711a.8.8,0,0,0,.8.8H9.352a.8.8,0,0,0,.8-.8v-1.711A5.07,5.07,0,0,0,7.663,248.55Zm-5.21-3.33a2.623,2.623,0,1,1,2.623,2.623A2.626,2.626,0,0,1,2.452,245.22Zm6.1,8.61H1.6v-.912a3.478,3.478,0,1,1,6.956,0v.912Zm0,0" transform="translate(0 -228.17)" fill="#989898"/>
<path id="Path_4668" data-name="Path 4668" d="M206.43,0H196.165A3.363,3.363,0,0,0,192.8,3.365v15.4a.8.8,0,0,0,1.278.639l3.208-2.406h9.143a3.363,3.363,0,0,0,3.365-3.365V3.365A3.363,3.363,0,0,0,206.43,0ZM208.2,13.629A1.766,1.766,0,0,1,206.43,15.4h-9.409a.8.8,0,0,0-.479.16L194.4,17.164V3.365A1.766,1.766,0,0,1,196.165,1.6H206.43A1.766,1.766,0,0,1,208.2,3.365Zm0,0" transform="translate(-182.536 0)" fill="#989898"/>
<path id="Path_4669" data-name="Path 4669" d="M266.419,80.332h-8.554a.8.8,0,1,0,0,1.6h8.554a.8.8,0,0,0,0-1.6Zm0,0" transform="translate(-243.381 -76.055)" fill="#989898"/>
<path id="Path_4670" data-name="Path 4670" d="M266.419,144.6h-8.554a.8.8,0,1,0,0,1.6h8.554a.8.8,0,0,0,0-1.6Zm0,0" transform="translate(-243.381 -136.903)" fill="#989898"/>
<path id="Path_4671" data-name="Path 4671" d="M262.142,208.867h-4.277a.8.8,0,1,0,0,1.6h4.277a.8.8,0,1,0,0-1.6Zm0,0" transform="translate(-243.381 -197.747)" fill="#989898"/>
<svg id="interview_4_" data-name="interview (4)" xmlns="http://www.w3.org/2000/svg" width="25.9" height="25.9" viewBox="0 0 25.9 25.9">
<path id="Path_4711" data-name="Path 4711" d="M205.751,0H196a3.2,3.2,0,0,0-3.2,3.2v14.63a.759.759,0,0,0,1.214.607l3.049-2.286h8.687a3.2,3.2,0,0,0,3.2-3.2V3.2A3.2,3.2,0,0,0,205.751,0Zm-5.635,12.084h-3.3a.759.759,0,1,1,0-1.518h3.3a.759.759,0,1,1,0,1.518Zm4.823-3.251h-8.128a.759.759,0,1,1,0-1.518h8.128a.759.759,0,1,1,0,1.518Zm0-3.251h-8.128a.759.759,0,1,1,0-1.518h8.128a.759.759,0,1,1,0,1.518Zm0,0" transform="translate(-183.048)" fill="#818181"/>
<path id="Path_4712" data-name="Path 4712" d="M31.6,244.575a3.587,3.587,0,1,1-3.587-3.587A3.587,3.587,0,0,1,31.6,244.575Zm0,0" transform="translate(-23.19 -228.797)" fill="#818181"/>
<path id="Path_4713" data-name="Path 4713" d="M4.823,382.8A4.823,4.823,0,0,0,0,387.627v.954a.759.759,0,0,0,.759.759H8.886a.759.759,0,0,0,.759-.759v-.954A4.823,4.823,0,0,0,4.823,382.8Zm0,0" transform="translate(0 -363.44)" fill="#818181"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1018 B

@ -1,7 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" width="25.898" height="25.9" viewBox="0 0 25.898 25.9">
<g id="home_12_" data-name="home (12)" transform="translate(-0.022)">
<path id="Path_4683" data-name="Path 4683" d="M351.362.759A.759.759,0,0,0,350.6,0h-3.251a.759.759,0,0,0-.759.759v.687l4.769,4.769Z" transform="translate(-329.039 0)" fill="#2e303a"/>
<path id="Path_4684" data-name="Path 4684" d="M25.221,11.259,14.661.7A2.391,2.391,0,0,0,11.28.7L.721,11.26A2.391,2.391,0,1,0,4.1,14.641l8.869-8.869,8.869,8.869a2.375,2.375,0,0,0,1.69.7h0a2.391,2.391,0,0,0,1.691-4.081Z" fill="#2e303a"/>
<path id="Path_4685" data-name="Path 4685" d="M65.238,156.525l-7.8,7.8a3.878,3.878,0,0,1-2.369,1.125v6.271a2.794,2.794,0,0,0,2.791,2.791H62.8a.759.759,0,0,0,.759-.759v-5.743h3.359v5.743a.759.759,0,0,0,.759.759h4.935a2.794,2.794,0,0,0,2.791-2.791v-6.271a3.879,3.879,0,0,1-2.368-1.125Z" transform="translate(-52.267 -148.607)" fill="#2e303a"/>
<g id="home_12_" data-name="home (12)" transform="translate(-0.021)">
<path id="Path_4683" data-name="Path 4683" d="M351.362.759A.759.759,0,0,0,350.6,0h-3.251a.759.759,0,0,0-.759.759v.687l4.769,4.769Z" transform="translate(-329.039 0)" fill="#818181"/>
<path id="Path_4684" data-name="Path 4684" d="M25.221,11.259,14.661.7A2.391,2.391,0,0,0,11.28.7L.721,11.26A2.391,2.391,0,1,0,4.1,14.641l8.869-8.869,8.869,8.869a2.375,2.375,0,0,0,1.69.7h0a2.391,2.391,0,0,0,1.691-4.081Z" fill="#818181"/>
<path id="Path_4685" data-name="Path 4685" d="M65.238,156.525l-7.8,7.8a3.878,3.878,0,0,1-2.369,1.125v6.271a2.794,2.794,0,0,0,2.791,2.791H62.8a.759.759,0,0,0,.759-.759v-5.743h3.359v5.743a.759.759,0,0,0,.759.759h4.935a2.794,2.794,0,0,0,2.791-2.791v-6.271a3.879,3.879,0,0,1-2.368-1.125Z" transform="translate(-52.267 -148.607)" fill="#818181"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 955 B

After

Width:  |  Height:  |  Size: 955 B

@ -1,3 +1,11 @@
<svg xmlns="http://www.w3.org/2000/svg" width="25.974" height="24.23" viewBox="0 0 25.974 24.23">
<path id="shipping_2_" data-name="shipping (2)" d="M23.959,29.714V17.886a.764.764,0,0,0-.764-.764H2.724a.764.764,0,0,0-.764.764V30.657A2.294,2.294,0,0,0,.512,34.381l3.442,4.172c2.13,2.493,4.393,2.8,7.758,2.8a25.054,25.054,0,0,0,6.694-.561l2.45-.586a2.138,2.138,0,0,0,1.737.914H23.8a2.238,2.238,0,0,0,2.175-2.291V32A2.248,2.248,0,0,0,23.959,29.714Zm-3.434,1.572-1.018-.517a6.053,6.053,0,0,0-5.309-.086,7.3,7.3,0,0,1-2,.774H8.664a2.128,2.128,0,0,0-2.125,2.125v.557l-.02-.021L4,31.381a2.327,2.327,0,0,0-.508-.416v-7.58H9.741v2.8a.764.764,0,0,0,.764.764h4.821a.764.764,0,0,0,.764-.764v-2.8h6.341v6.329A2.2,2.2,0,0,0,20.525,31.286Zm-9.256-7.9h3.293v2.037H11.269Zm11.162-1.528H16.091V18.65h6.341v3.206ZM14.563,18.65v3.206H11.269V18.65Zm-4.821,0v3.206H3.488V18.65ZM18.05,39.3a24.308,24.308,0,0,1-6.312.511c-3.158,0-4.684-.051-6.606-2.235L1.691,33.408a.773.773,0,0,1,1.182-.993L5.4,35.154a3.469,3.469,0,0,0,2.54,1.113h6.994a.764.764,0,0,0,0-1.528H8.067V33.582a.6.6,0,0,1,.6-.6H12.2a6.994,6.994,0,0,0,2.645-.917,4.533,4.533,0,0,1,3.975.063l1.6.813v5.794Zm6.4-.477a.713.713,0,0,1-.647.763H22.592a.713.713,0,0,1-.647-.763V32a.713.713,0,0,1,.647-.763H23.8a.713.713,0,0,1,.647.763Z" transform="translate(0.001 -17.122)" fill="#989898"/>
<svg xmlns="http://www.w3.org/2000/svg" width="23.893" height="22.83" viewBox="0 0 23.893 22.83">
<g id="shipping_3_" data-name="shipping (3)" transform="translate(0 -11.379)">
<path id="Path_4716" data-name="Path 4716" d="M217.941,11.378h3.429v4.135h-3.429Z" transform="translate(-207.769)" fill="#818181"/>
<path id="Path_4717" data-name="Path 4717" d="M217.941,134.067h3.429v2.121h-3.429Z" transform="translate(-207.769 -116.963)" fill="#818181"/>
<path id="Path_4718" data-name="Path 4718" d="M27.275,134.067v7.59a2.406,2.406,0,0,1,1.325.737l2.627,2.852.021.021v-.58a2.216,2.216,0,0,1,2.213-2.213H37.14a7.7,7.7,0,0,0,2.083-.806,6.3,6.3,0,0,1,5.529.089l1.06.539a2.283,2.283,0,0,1,2.152-1.644h.629v-6.584h-7.4v2.917a.8.8,0,0,1-.8.8H35.378a.8.8,0,0,1-.8-.8v-2.917Z" transform="translate(-26.002 -116.963)" fill="#818181"/>
<path id="Path_4719" data-name="Path 4719" d="M325.521,15.513h7.4V12.482a1.023,1.023,0,0,0-.917-1.1h-6.482Z" transform="translate(-310.328)" fill="#818181"/>
<path id="Path_4720" data-name="Path 4720" d="M456.823,309.24a.742.742,0,0,0-.673.794v7.113a.742.742,0,0,0,.673.795h1.257a.742.742,0,0,0,.673-.795v-7.113a.742.742,0,0,0-.673-.794Z" transform="translate(-434.861 -283.961)" fill="#818181"/>
<path id="Path_4721" data-name="Path 4721" d="M34.582,11.378H28.037a.851.851,0,0,0-.762.917v3.217h7.307Z" transform="translate(-26.002)" fill="#818181"/>
<path id="Path_4722" data-name="Path 4722" d="M1.428,319.1c-.7-.7-1.9.216-1.231,1.034l3.584,4.345A6.361,6.361,0,0,0,8.7,326.795h4.054a19.348,19.348,0,0,0,4.475-.525l2.465-.59v-6.034l-1.666-.846a4.72,4.72,0,0,0-4.139-.066l-1.417.659a3.193,3.193,0,0,1-1.337.3H7.459a.622.622,0,0,0-.622.622v1.205h7.146a.8.8,0,1,1,0,1.591H6.7a3.66,3.66,0,0,1-2.645-1.16Z" transform="translate(0 -292.586)" fill="#818181"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

@ -1,15 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" width="21.12" height="26.881" viewBox="0 0 21.12 26.881">
<g id="clipboard_5_" data-name="clipboard (5)" transform="translate(-47.037 0)">
<g id="Group_7687" data-name="Group 7687" transform="translate(47.037 0)">
<g id="Group_7686" data-name="Group 7686" transform="translate(0 0)">
<path id="Path_4672" data-name="Path 4672" d="M65.469,3.522H63.037V2.434c0-.352-.384-.512-.736-.512H60.413A2.862,2.862,0,0,0,57.565,0a2.912,2.912,0,0,0-2.848,1.92H52.861c-.352,0-.7.16-.7.512V3.522H49.725a2.72,2.72,0,0,0-2.688,2.592V24.45a2.575,2.575,0,0,0,2.688,2.432H65.469a2.575,2.575,0,0,0,2.688-2.432V6.114A2.72,2.72,0,0,0,65.469,3.522ZM53.437,3.2H55.2a.7.7,0,0,0,.608-.576,1.856,1.856,0,0,1,1.76-1.44,1.824,1.824,0,0,1,1.728,1.44.7.7,0,0,0,.64.576h1.824v2.56h-8.32ZM66.877,24.45A1.3,1.3,0,0,1,65.469,25.6H49.725a1.3,1.3,0,0,1-1.408-1.152V6.114A1.44,1.44,0,0,1,49.725,4.8h2.432V6.434a.672.672,0,0,0,.7.608H62.3a.7.7,0,0,0,.736-.608V4.8h2.432a1.44,1.44,0,0,1,1.408,1.312V24.45Z" transform="translate(-47.037 0)" fill="#989898"/>
<path id="Path_4673" data-name="Path 4673" d="M104.271,230.511a.64.64,0,0,0-.9-.032l-2.048,1.952-.864-.9a.64.64,0,0,0-.9-.032.672.672,0,0,0,0,.928l1.312,1.344a.576.576,0,0,0,.448.192.64.64,0,0,0,.448-.192l2.5-2.368a.608.608,0,0,0,.037-.859C104.3,230.535,104.283,230.523,104.271,230.511Z" transform="translate(-96.175 -216.205)" fill="#989898"/>
<path id="Path_4674" data-name="Path 4674" d="M206.548,256.034h-7.36a.64.64,0,0,0,0,1.28h7.36a.64.64,0,1,0,0-1.28Z" transform="translate(-189.268 -240.352)" fill="#989898"/>
<path id="Path_4675" data-name="Path 4675" d="M104.271,146.919a.64.64,0,0,0-.9-.032l-2.048,1.952-.864-.9a.64.64,0,0,0-.9-.032.672.672,0,0,0,0,.928l1.312,1.344a.576.576,0,0,0,.448.192.64.64,0,0,0,.448-.192l2.5-2.368a.608.608,0,0,0,.037-.859C104.3,146.943,104.283,146.931,104.271,146.919Z" transform="translate(-96.175 -137.733)" fill="#989898"/>
<path id="Path_4676" data-name="Path 4676" d="M206.548,172.442h-7.36a.64.64,0,0,0,0,1.28h7.36a.64.64,0,1,0,0-1.28Z" transform="translate(-189.268 -161.88)" fill="#989898"/>
<path id="Path_4677" data-name="Path 4677" d="M104.271,314.1a.64.64,0,0,0-.9-.032l-2.048,1.952-.864-.9a.64.64,0,0,0-.9-.032.672.672,0,0,0,0,.928l1.312,1.344a.576.576,0,0,0,.448.192.64.64,0,0,0,.448-.192l2.5-2.368a.608.608,0,0,0,.037-.859C104.3,314.126,104.283,314.114,104.271,314.1Z" transform="translate(-96.175 -294.677)" fill="#989898"/>
<path id="Path_4678" data-name="Path 4678" d="M206.548,339.626h-7.36a.64.64,0,0,0,0,1.28h7.36a.64.64,0,1,0,0-1.28Z" transform="translate(-189.268 -318.824)" fill="#989898"/>
</g>
</g>
<svg xmlns="http://www.w3.org/2000/svg" width="19.729" height="25.9" viewBox="0 0 19.729 25.9">
<g id="to-do-list_1_" data-name="to-do-list (1)" transform="translate(-61)">
<path id="Path_4714" data-name="Path 4714" d="M80.064,30.668A2.258,2.258,0,0,0,78.455,30H77.446v1.012a2.025,2.025,0,0,1-2.021,2.023h-9.1a2.025,2.025,0,0,1-2.021-2.023V30H63.3a2.278,2.278,0,0,0-2.274,2.274L61,52.1a2.275,2.275,0,0,0,2.274,2.279H78.433a2.278,2.278,0,0,0,2.274-2.274l.022-19.83A2.263,2.263,0,0,0,80.064,30.668Zm-8.942,6.92h5.385a.759.759,0,0,1,0,1.518H71.122a.759.759,0,0,1,0-1.518Zm0,5.059h5.385a.759.759,0,0,1,0,1.518H71.122a.759.759,0,0,1,0-1.518Zm0,5.059h5.407a.759.759,0,0,1,0,1.518H71.122a.759.759,0,0,1,0-1.518ZM64.664,37.618a.757.757,0,0,1,1.072,0l.412.413,1.748-1.75a.758.758,0,1,1,1.072,1.073L66.684,39.64a.757.757,0,0,1-1.072,0l-.948-.949a.759.759,0,0,1,0-1.073Zm0,5.445a.757.757,0,0,1,1.072,0l.412.413,1.748-1.75A.758.758,0,0,1,68.968,42.8l-2.284,2.286a.757.757,0,0,1-1.072,0l-.948-.949A.759.759,0,0,1,64.664,43.063Zm0,5.059a.757.757,0,0,1,1.072,0l.412.413,1.748-1.75a.758.758,0,1,1,1.072,1.073l-2.284,2.286a.757.757,0,0,1-1.072,0l-.948-.949A.759.759,0,0,1,64.664,48.122Z" transform="translate(0 -28.482)" fill="#818181"/>
<path id="Path_4715" data-name="Path 4715" d="M156.361,2.529a.506.506,0,0,0,.505.506h9.1a.506.506,0,0,0,.505-.506V.506A.506.506,0,0,0,165.962,0h-9.1a.506.506,0,0,0-.505.506Z" transform="translate(-90.537)" fill="#818181"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

@ -512,5 +512,7 @@
"youWantToLeaveMarathon": "هل أنت متأكد أنك تريد العودة؟ سوف تخرج من المسابقة.",
"ourSponsor": "راعينا:",
"startingIn": "يبدأ في",
"youAreOutOfContest": "أنت خارج المسابقة."
"youAreOutOfContest": "أنت خارج المسابقة.",
"winners": "الفائزين!!!",
"fakeLocation": ".لقد تتبعنا أنك تحاول استخدام موقع مزيف! يعتبر هذا مخالفة وقد تم إخطار الموارد البشرية"
}

@ -512,6 +512,7 @@
"youWantToLeaveMarathon": "Are you sure you want to go back? You will be out of the contest.",
"ourSponsor": "Our Sponsor:",
"startingIn": "Starting in",
"youAreOutOfContest": "You are out of the contest."
"youAreOutOfContest": "You are out of the contest.",
"winners": "WINNERS!!!",
"fakeLocation": "We traced out that you try to use a fake location! This is considered a violation, and HR has been notified."
}

@ -14,11 +14,12 @@ typedef FactoryConstructor<U> = U Function(dynamic);
class APIError {
int? errorCode;
int? errorType;
String? errorMessage;
APIError(this.errorCode, this.errorMessage);
APIError(this.errorCode, this.errorMessage, this.errorType);
Map<String, dynamic> toJson() => {'errorCode': errorCode, 'errorMessage': errorMessage};
Map<String, dynamic> toJson() => {'errorCode': errorCode, 'errorMessage': errorMessage, 'errorType': errorType,};
@override
String toString() {
@ -33,14 +34,14 @@ APIException _throwAPIException(Response response) {
if (response.body != null && response.body.isNotEmpty) {
var jsonError = jsonDecode(response.body);
print(jsonError);
apiError = APIError(jsonError['ErrorCode'], jsonError['ErrorMessage']);
apiError = APIError(jsonError['ErrorCode'], jsonError['ErrorMessage'], jsonError['ErrorType']);
}
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']);
apiError = APIError(jsonError['ErrorCode'], jsonError['ErrorMessage'], jsonError['ErrorType']);
}
return APIException(APIException.BAD_REQUEST, error: apiError);
case 401:
@ -90,7 +91,7 @@ class ApiClient {
return factoryConstructor(jsonData);
} else {
APIError? apiError;
apiError = APIError(jsonData['ErrorCode'], jsonData['ErrorEndUserMessage']);
apiError = APIError(jsonData['ErrorCode'], jsonData['ErrorEndUserMessage'], jsonData['ErrorType']);
throw APIException(APIException.BAD_REQUEST, error: apiError);
}
// } catch (ex) {

@ -2,6 +2,8 @@ import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'package:mohem_flutter_app/api/api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
@ -22,6 +24,7 @@ class ChatApiClient {
factory ChatApiClient() => _instance;
Future<user.UserAutoLoginModel> getUserLoginToken() async {
user.UserAutoLoginModel userLoginResponse = user.UserAutoLoginModel();
Response response = await ApiClient().postJsonForResponse(
"${ApiConsts.chatLoginTokenUrl}externaluserlogin",
{
@ -29,7 +32,18 @@ class ChatApiClient {
"password": "FxIu26rWIKoF8n6mpbOmAjDLphzFGmpG",
},
);
user.UserAutoLoginModel userLoginResponse = user.userAutoLoginModelFromJson(response.body);
if (!kReleaseMode) {
print("Status Code is ================" + response.statusCode.toString());
logger.i("res: " + response.body);
}
if (response.statusCode == 200) {
userLoginResponse = user.userAutoLoginModelFromJson(response.body);
} else if (response.statusCode == 501 || response.statusCode == 502 || response.statusCode == 503 || response.statusCode == 504) {
getUserLoginToken();
} else {
userLoginResponse = user.userAutoLoginModelFromJson(response.body);
Utils.showToast(userLoginResponse.errorResponses!.first.message!);
}
return userLoginResponse;
}
@ -38,33 +52,25 @@ class ChatApiClient {
"${ApiConsts.chatLoginTokenUrl}getUserWithStatusAndFavAsync/$sName/$cUserId",
token: AppState().chatDetails!.response!.token,
);
return searchUserJsonModel(response.body);
if (!kReleaseMode) {
logger.i("res: " + response.body);
}
return List<ChatUser>.from(json.decode(response.body).map((x) => ChatUser.fromJson(x)));
}
List<ChatUser> searchUserJsonModel(String str) => List<ChatUser>.from(json.decode(str).map((x) => ChatUser.fromJson(x)));
Future<ChatUserModel> getRecentChats() async {
try {
Response response = await ApiClient().getJsonForResponse(
"${ApiConsts.chatRecentUrl}getchathistorybyuserid",
token: AppState().chatDetails!.response!.token,
);
if (!kReleaseMode) {
logger.i("res: " + response.body);
}
return ChatUserModel.fromJson(
json.decode(response.body),
);
} catch (e) {
e as APIException;
if (e.message == "api_common_unauthorized") {
user.UserAutoLoginModel userLoginResponse = await ChatApiClient().getUserLoginToken();
if (userLoginResponse.response != null) {
AppState().setchatUserDetails = userLoginResponse;
getRecentChats();
} else {
Utils.showToast(
userLoginResponse.errorResponses!.first.fieldName.toString() + " Erorr",
);
}
}
throw e;
}
}
@ -74,9 +80,10 @@ class ChatApiClient {
"${ApiConsts.chatFavUser}getFavUserById/${AppState().chatDetails!.response!.id}",
token: AppState().chatDetails!.response!.token,
);
return ChatUserModel.fromJson(
json.decode(favRes.body),
);
if (!kReleaseMode) {
logger.i("res: " + favRes.body);
}
return ChatUserModel.fromJson(json.decode(favRes.body));
}
Future<Response> getSingleUserChatHistory({required int senderUID, required int receiverUID, required bool loadMore, bool isNewChat = false, required int paginationVal}) async {
@ -85,24 +92,20 @@ class ChatApiClient {
"${ApiConsts.chatSingleUserHistoryUrl}GetUserChatHistory/$senderUID/$receiverUID/$paginationVal",
token: AppState().chatDetails!.response!.token,
);
if (!kReleaseMode) {
logger.i("res: " + response.body);
}
return response;
} catch (e) {
e as APIException;
if (e.message == "api_common_unauthorized") {
user.UserAutoLoginModel userLoginResponse = await ChatApiClient().getUserLoginToken();
if (userLoginResponse.response != null) {
AppState().setchatUserDetails = userLoginResponse;
getSingleUserChatHistory(senderUID: senderUID, receiverUID: receiverUID, loadMore: loadMore, paginationVal: paginationVal);
} else {
Utils.showToast(userLoginResponse.errorResponses!.first.fieldName.toString() + " Erorr");
}
}
throw e;
}
}
Future<fav.FavoriteChatUser> favUser({required int userID, required int targetUserID}) async {
Response response = await ApiClient().postJsonForResponse("${ApiConsts.chatFavUser}addFavUser", {"targetUserId": targetUserID, "userId": userID}, token: AppState().chatDetails!.response!.token);
if (!kReleaseMode) {
logger.i("res: " + response.body);
}
fav.FavoriteChatUser favoriteChatUser = fav.FavoriteChatUser.fromRawJson(response.body);
return favoriteChatUser;
}
@ -114,20 +117,14 @@ class ChatApiClient {
{"targetUserId": targetUserID, "userId": userID},
token: AppState().chatDetails!.response!.token,
);
if (!kReleaseMode) {
logger.i("res: " + response.body);
}
fav.FavoriteChatUser favoriteChatUser = fav.FavoriteChatUser.fromRawJson(response.body);
return favoriteChatUser;
} catch (e) {
e as APIException;
if (e.message == "api_common_unauthorized") {
logger.d("Token Generated On APIIIIII");
user.UserAutoLoginModel userLoginResponse = await ChatApiClient().getUserLoginToken();
if (userLoginResponse.response != null) {
AppState().setchatUserDetails = userLoginResponse;
unFavUser(userID: userID, targetUserID: targetUserID);
} else {
Utils.showToast(userLoginResponse.errorResponses!.first.fieldName.toString() + " Erorr");
}
}
throw e;
}
}
@ -138,27 +135,45 @@ class ChatApiClient {
request.files.add(await MultipartFile.fromPath('files', file.path));
request.headers.addAll({'Authorization': 'Bearer ${AppState().chatDetails!.response!.token}'});
StreamedResponse response = await request.send();
if (!kReleaseMode) {}
return response;
}
// Download File For Chat
Future<Uint8List> downloadURL({required String fileName, required String fileTypeDescription}) async {
print(fileName);
print(fileTypeDescription);
print("${ApiConsts.chatMediaImageUploadUrl}download");
print(AppState().chatDetails!.response!.token);
Response response = await ApiClient().postJsonForResponse(
"${ApiConsts.chatMediaImageUploadUrl}download",
{"fileType": fileTypeDescription, "fileName": fileName, "fileSource": 1},
token: AppState().chatDetails!.response!.token,
);
Uint8List data = Uint8List.fromList(response.bodyBytes);
return data;
}
Future<List<ChatUserImageModel>> getUsersImages({required List<String> encryptedEmails}) async {
List<ChatUserImageModel> imagesData = [];
Response response = await ApiClient().postJsonForResponse(
"${ApiConsts.chatUserImages}images",
{"encryptedEmails": encryptedEmails, "fromClient": false},
token: AppState().chatDetails!.response!.token,
);
return chatUserImageModelFromJson(response.body);
if (!kReleaseMode) {
logger.i("res: " + response.body);
}
if (response.statusCode == 200) {
imagesData = chatUserImageModelFromJson(response.body);
} else if (response.statusCode == 500 || response.statusCode == 504) {
getUsersImages(encryptedEmails: encryptedEmails);
} else {
Utils.showToast("Something went wrong while loading images");
imagesData = [];
}
return imagesData;
}
}

@ -1,12 +1,10 @@
import 'dart:async';
import 'dart:convert';
import 'package:http/http.dart';
import 'package:mohem_flutter_app/api/api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/consts.dart';
import 'package:mohem_flutter_app/classes/date_uitl.dart';
import 'package:mohem_flutter_app/models/chat/chat_count_conversation_model.dart';
import 'package:mohem_flutter_app/models/dashboard/get_accrual_balances_list_model.dart';
import 'package:mohem_flutter_app/models/dashboard/get_attendance_tracking_list_model.dart';
import 'package:mohem_flutter_app/models/dashboard/itg_forms_model.dart';
@ -14,7 +12,6 @@ import 'package:mohem_flutter_app/models/dashboard/list_menu.dart';
import 'package:mohem_flutter_app/models/generic_response_model.dart';
import 'package:mohem_flutter_app/models/itg/itg_main_response.dart';
import 'package:mohem_flutter_app/models/itg/itg_response_model.dart';
import 'package:uuid/uuid.dart';
class DashboardApiClient {
@ -47,7 +44,6 @@ class DashboardApiClient {
Future<GenericResponseModel?> getCOCNotifications() async {
String url = "${ApiConsts.cocRest}Mohemm_ITG_ReviewerAdmin_Pending_Tasks";
Map<String, dynamic> postParams = {"Date": DateUtil.getISODateFormat(DateTime.now()), "EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel responseData = GenericResponseModel.fromJson(json);
@ -69,9 +65,7 @@ class DashboardApiClient {
String url = "${ApiConsts.erpRest}GET_ACCRUAL_BALANCES";
Map<String, dynamic> postParams = {"P_EFFECTIVE_DATE": effectiveDate};
postParams.addAll(AppState().postParamsJson);
if (empID != null && empID.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
if (empID != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = empID;
return await ApiClient().postJsonForObject((json) {
GenericResponseModel responseData = GenericResponseModel.fromJson(json);
return responseData.getAccrualBalancesList ?? [];
@ -133,6 +127,28 @@ class DashboardApiClient {
}, url, postParams);
}
//Mark Fake Location
Future<GenericResponseModel?> markFakeLocation({String lat = "0", String? long = "0", required String sourceName}) async {
String url = "${ApiConsts.swpRest}CreateIssueInfo";
var uuid = Uuid();
// Generate a v4 (random) id
Map<String, dynamic> postParams = {
"UID": uuid.v4(), //Mobile Id
"Latitude": lat,
"Longitude": long,
"QRValue": '',
"NFCValue": sourceName == 'NFC' ? sourceName : '',
"WifiValue": sourceName == 'WIFI' ? sourceName : '',
"EmployeeID": AppState().memberInformationList!.eMPLOYEENUMBER,
};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel responseData = GenericResponseModel.fromJson(json);
return responseData;
}, url, postParams);
}
//Check ITG Type
Future<MohemmItgResponseItem?> getITGPageNotification() async {
String url = "${ApiConsts.cocRest}Mohemm_ITG_GetPageNotification";
@ -183,13 +199,6 @@ class DashboardApiClient {
}, url, postParams);
}
Future<ChatUnreadCovnCountModel> getChatCount() async {
Response response = await ApiClient().getJsonForResponse(
"${ApiConsts.chatLoginTokenUrl}unreadconversationcount/${AppState().getUserName}",
);
return chatUnreadCovnCountModelFromJson(response.body);
}
// Future setAdvertisementViewed(String masterID, int advertisementId) async {
// String url = "${ApiConsts.cocRest}Mohemm_ITG_UpdateAdvertisementAsViewed";
//

@ -17,13 +17,11 @@ class LeaveBalanceApiClient {
factory LeaveBalanceApiClient() => _instance;
Future<List<GetAbsenceTransactionList>> getAbsenceTransactions(int pSelectedResopID, {String? empID}) async {
Future<List<GetAbsenceTransactionList>> getAbsenceTransactions(int pSelectedResopID, String? empID) async {
String url = "${ApiConsts.erpRest}GET_ABSENCE_TRANSACTIONS";
Map<String, dynamic> postParams = {"P_PAGE_LIMIT": 50, "P_PAGE_NUM": 1, "P_MENU_TYPE": "E", "P_SELECTED_RESP_ID": pSelectedResopID};
postParams.addAll(AppState().postParamsJson);
if (empID!.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
if (empID != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = empID;
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.getAbsenceTransactionList ?? [];
@ -34,16 +32,15 @@ class LeaveBalanceApiClient {
String url = "${ApiConsts.erpRest}GET_ABSENCE_ATTENDANCE_TYPES";
Map<String, dynamic> postParams = {};
postParams.addAll(AppState().postParamsJson);
if (empID!.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
if (empID != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = empID;
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.getAbsenceAttendanceTypesList ?? [];
}, url, postParams);
}
Future<CalculateAbsenceDuration> calculateAbsenceDuration(int pAbsenceAttendanceTypeID, String pDateStart, String pDateEnd, int pSelectedResopID, {String? empID}) async {
Future<CalculateAbsenceDuration> calculateAbsenceDuration(int pAbsenceAttendanceTypeID, String pDateStart, String pDateEnd, int pSelectedResopID, {String? empID}) async {
String url = "${ApiConsts.erpRest}CALCULATE_ABSENCE_DURATION";
Map<String, dynamic> postParams = {
"P_ABSENCE_ATTENDANCE_TYPE_ID": pAbsenceAttendanceTypeID,
@ -52,25 +49,26 @@ class LeaveBalanceApiClient {
"P_SELECTED_RESP_ID": pSelectedResopID,
"P_MENU_TYPE": "E",
"P_TIME_END": null,
"P_TIME_START": null,
"P_TIME_START": null
};
postParams.addAll(AppState().postParamsJson);
if (empID!.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
if (empID != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = empID;
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.calculateAbsenceDuration!;
}, url, postParams);
}
Future<List<GetAbsenceDffStructureList>> getAbsenceDffStructure(String pDescFlexContextCode, String pFunctionName, int pSelectedResopID, {String? empID}) async {
Future<List<GetAbsenceDffStructureList>> getAbsenceDffStructure(String pDescFlexContextCode, String pFunctionName, int pSelectedResopID, {String? empID}) async {
String url = "${ApiConsts.erpRest}GET_ABSENCE_DFF_STRUCTURE";
Map<String, dynamic> postParams = {"P_DESC_FLEX_CONTEXT_CODE": pDescFlexContextCode, "P_FUNCTION_NAME": pFunctionName, "P_MENU_TYPE": "E", "P_SELECTED_RESP_ID": pSelectedResopID};
Map<String, dynamic> postParams = {
"P_DESC_FLEX_CONTEXT_CODE": pDescFlexContextCode,
"P_FUNCTION_NAME": pFunctionName,
"P_MENU_TYPE": "E",
"P_SELECTED_RESP_ID": pSelectedResopID,
};
postParams.addAll(AppState().postParamsJson);
if (empID!.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
if (empID != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = empID;
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.getAbsenceDffStructureList ?? [];
@ -79,7 +77,7 @@ class LeaveBalanceApiClient {
Future<GenericResponseModel> validateAbsenceTransaction(
String pDescFlexContextCode, String pFunctionName, int pAbsenceAttendanceTypeID, String pReplacementUserName, String pDateStart, String pDateEnd, int pSelectedResopID, Map<String, String?> data,
{String comments = "", String? empID}) async {
{String comments = "", String? empID}) async {
String url = "${ApiConsts.erpRest}VALIDATE_ABSENCE_TRANSACTION";
Map<String, dynamic> postParams = {
"P_DESC_FLEX_CONTEXT_CODE": pDescFlexContextCode,
@ -94,13 +92,11 @@ class LeaveBalanceApiClient {
"P_SELECTED_RESP_ID": pSelectedResopID,
"P_MENU_TYPE": "E",
"P_TIME_END": null,
"P_TIME_START": null,
"P_TIME_START": null
};
postParams.addAll(data);
postParams.addAll(AppState().postParamsJson);
if (empID!.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
if (empID != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = empID;
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData;
@ -109,7 +105,7 @@ class LeaveBalanceApiClient {
Future<SumbitAbsenceTransactionList> submitAbsenceTransaction(
String pDescFlexContextCode, String pFunctionName, int pAbsenceAttendanceTypeID, String pReplacementUserName, String pDateStart, String pDateEnd, int pSelectedResopID, Map<String, String?> data,
{String comments = "", String? empID}) async {
{String comments = "", String? empID}) async {
String url = "${ApiConsts.erpRest}SUBMIT_ABSENCE_TRANSACTION";
Map<String, dynamic> postParams = {
"P_DESC_FLEX_CONTEXT_CODE": pDescFlexContextCode,
@ -124,13 +120,11 @@ class LeaveBalanceApiClient {
"P_SELECTED_RESP_ID": pSelectedResopID,
"P_MENU_TYPE": "E",
"P_TIME_END": null,
"P_TIME_START": null,
"P_TIME_START": null
};
postParams.addAll(data);
postParams.addAll(AppState().postParamsJson);
if (empID!.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
if (empID != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = empID;
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.sumbitAbsenceTransactionList!;
@ -147,18 +141,11 @@ class LeaveBalanceApiClient {
}, url, postParams);
}
Future<StartAbsenceApprovalProccess> startAbsenceApprovalProcess(int pTransactionID, String comments, int pSelectedResopID,{String? empID}) async {
Future<StartAbsenceApprovalProccess> startAbsenceApprovalProcess(int pTransactionID, String comments, int pSelectedResopID, {String? empID}) async {
String url = "${ApiConsts.erpRest}START_ABSENCE_APPROVAL_PROCESS";
Map<String, dynamic> postParams = {
"P_TRANSACTION_ID": pTransactionID,
"P_SELECTED_RESP_ID": pSelectedResopID,
"P_COMMENTS": comments,
"P_MENU_TYPE": "E",
};
Map<String, dynamic> postParams = {"P_TRANSACTION_ID": pTransactionID, "P_SELECTED_RESP_ID": pSelectedResopID, "P_COMMENTS": comments, "P_MENU_TYPE": "E"};
postParams.addAll(AppState().postParamsJson);
if (empID!.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
if (empID != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = empID;
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.startAbsenceApprovalProccess!;

@ -30,7 +30,6 @@ class MarathonApiClient {
if (marathonModel.statusCode == 200) {
if (marathonModel.data != null && marathonModel.isSuccessful == true) {
AppState().setMarathonToken = marathonModel.data["token"] ?? "";
print("bearer: ${AppState().getMarathonToken}");
return marathonModel.data["token"] ?? "";
} else {
//TODO : DO ERROR HANDLING HERE
@ -98,6 +97,7 @@ class MarathonApiClient {
if (marathonModel.statusCode == 208) {
// means participant is already in the marathon i.e already joined
//TODO: NEED TO LOOK UPON THIS
return marathonModel.data["remainingTime"];
}
@ -117,13 +117,13 @@ class MarathonApiClient {
Map<String, String?> jsonObject = <String, String?>{
"previousQuestionId": questionId,
"marathonId": marathonId,
};
};
Response response = await ApiClient().postJsonForResponse(ApiConsts.marathonNextQuestionUrl, jsonObject, token: AppState().getMarathonToken ?? await getMarathonToken());
var json = jsonDecode(response.body);
logger.i("json in NextQuestion: $json");
var data = json["data"];

@ -29,7 +29,6 @@ class MonthlyAttendanceApiClient {
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
print(responseData);
return (responseData.getTimeCardSummaryList?.length ?? 0) > 0 ? responseData.getTimeCardSummaryList!.first : null;
}, url, postParams);
}
@ -49,7 +48,6 @@ class MonthlyAttendanceApiClient {
// postParams["DeviceType"] = deviceType;
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
print(responseData.getDayHoursTypeDetailsList!.length);
return responseData.getDayHoursTypeDetailsList ?? [];
}, url, postParams);
}

@ -19,7 +19,6 @@ class MonthlyPaySlipApiClient {
String url = "${ApiConsts.erpRest}GET_PAYSLIP";
Map<String, dynamic> postParams = {"P_MENU_TYPE": "E", "P_SELECTED_RESP_ID": -999};
postParams.addAll(AppState().postParamsJson);
print(postParams);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.getPayslipList ?? [];

@ -22,12 +22,7 @@ class MyAttendanceApiClient {
String url = "${ApiConsts.erpRest}GET_EIT_TRANSACTIONS";
Map<String, dynamic> postParams = {"P_PAGE_LIMIT": 50, "P_PAGE_NUM": 1, "P_SELECTED_RESP_ID": -999, "P_MENU_TYPE": "E", "P_FUNCTION_NAME": pFunctionName};
postParams.addAll(AppState().postParamsJson);
// postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
if (empID!.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
// AppState().postParamsJson['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
print(empID);
}
if (empID != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = empID;
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.getEITTransactionList ?? [];
@ -38,9 +33,7 @@ class MyAttendanceApiClient {
String url = "${ApiConsts.erpRest}GET_EIT_DFF_STRUCTURE";
Map<String, dynamic> postParams = {"P_SELECTED_RESP_ID": -999, "P_MENU_TYPE": "E", "P_FUNCTION_NAME": pFunctionName};
postParams.addAll(AppState().postParamsJson);
if (empID!.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
if (empID != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = empID;
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData;
@ -54,16 +47,14 @@ class MyAttendanceApiClient {
"P_MENU_TYPE": "E",
"P_PAGE_LIMIT": 1000,
"P_PAGE_NUM": 1,
"P_PARENT_VALUE": empID!.isNotEmpty ? parentValue : null,
"P_PARENT_VALUE": empID != null ? parentValue : null,
"P_SEGMENT_NAME": pSegmentName,
"P_DESC_FLEX_CONTEXT_CODE": pDescFlexContextCode,
"P_DESC_FLEX_NAME": pDescFlexName,
"GetValueSetValuesTBL": list,
};
postParams.addAll(AppState().postParamsJson);
if (empID.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
if (empID != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = empID;
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.getValueSetValuesList ?? [];
@ -82,9 +73,7 @@ class MyAttendanceApiClient {
"GetValueSetValuesTBL": list,
};
postParams.addAll(AppState().postParamsJson);
if (empID != null && empID!.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
if (empID != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = empID;
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return ESERVICESDV.fromJson(responseData.getDefaultValueList!.toJson());
@ -101,9 +90,7 @@ class MyAttendanceApiClient {
"EITTransactionTBL": list,
};
postParams.addAll(AppState().postParamsJson);
if (empID!.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
if (empID != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = empID;
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData; //ESERVICESDV.fromJson(responseData.getDefaultValueList!.toJson());
@ -121,9 +108,7 @@ class MyAttendanceApiClient {
"EITTransactionTBLModel": list,
};
postParams.addAll(AppState().postParamsJson);
if (empID!.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
if (empID != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = empID;
return await ApiClient().postJsonForObject((json) {
GenericResponseModel responseData = GenericResponseModel.fromJson(json);
return responseData.submitEITTransactionList!; //ESERVICESDV.fromJson(responseData.getDefaultValueList!.toJson());

@ -64,7 +64,6 @@ class MyTeamApiClient {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
print(responseData.getDayHoursTypeDetailsList!.length);
return responseData.getDayHoursTypeDetailsList ?? [];
}, url, postParams);
}
@ -76,7 +75,6 @@ class MyTeamApiClient {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
print(responseData.getAttendanceTrackingList);
return responseData.getAttendanceTrackingList;
}, url, postParams);
}

@ -41,7 +41,6 @@ class ProfileApiClient {
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
print(responseData);
return responseData.getEmployeeContactsList ?? [];
}, url, postParams);
}
@ -258,7 +257,6 @@ class ProfileApiClient {
// "EITTransactionTBLModel": list,
};
postParams.addAll(AppState().postParamsJson);
print("postParams:$postParams");
postParams["EITTransactionTBL"] = list;
postParams["EITTransactionTBLModel"] = list;
return await ApiClient().postJsonForObject((json) {
@ -300,7 +298,6 @@ class ProfileApiClient {
// "EITTransactionTBLModel": list,
};
postParams.addAll(AppState().postParamsJson);
print("postParams:$postParams");
postParams["EITTransactionTBL"] = list;
// postParams["EITTransactionTBLModel"] = list;
return await ApiClient().postJsonForObject((json) {
@ -389,12 +386,7 @@ class ProfileApiClient {
};
postParams.addAll(AppState().postParamsJson);
print("postParam:${json.encode(postParams)}");
postParams["EITTransactionTBL"] = list;
list.forEach((element) {
print(json.encode(element));
});
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.submitContactTransactionList;

@ -46,9 +46,6 @@ class TerminationDffApiClient {
};
postParams.addAll(AppState().postParamsJson);
for (var abc in list) {
print(abc);
}
return await ApiClient().postJsonForObject((json) {
GenericResponseModel genericResponseModel = GenericResponseModel.fromJson(json);
return genericResponseModel.submitTermTransactionList!;

@ -26,6 +26,7 @@ import 'package:mohem_flutter_app/models/update_user_item_type_list.dart';
import 'package:mohem_flutter_app/models/worklist/GetRFCEmployeeList.dart';
import 'package:mohem_flutter_app/models/worklist/get_favorite_replacements_model.dart';
import 'package:mohem_flutter_app/models/worklist/hr/eit_otification_body_model.dart';
import 'package:mohem_flutter_app/models/worklist/hr/get_address_notification_body_list.dart';
import 'package:mohem_flutter_app/models/worklist/hr/get_basic_det_ntf_body_list_model.dart';
import 'package:mohem_flutter_app/models/worklist/hr/get_contact_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/worklist/hr/get_phones_notification_body_list_model.dart';
@ -156,7 +157,7 @@ class WorkListApiClient {
"P_PAGE_NUM": 1,
};
postParams.addAll(AppState().postParamsJson);
postParams["P_SELECTED_EMPLOYEE_NUMBER"] = selectedEmployeeNumber;
if (selectedEmployeeNumber != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = selectedEmployeeNumber;
return await ApiClient().postJsonForObject((json) {
GenericResponseModel responseData = GenericResponseModel.fromJson(json);
return responseData.memberInformationList![0];
@ -509,6 +510,20 @@ class WorkListApiClient {
}, url, postParams);
}
Future<List<GetAddressNotificationBodyList>?> getAddressNotificationBodyList(int? notificationId) async {
String url = "${ApiConsts.erpRest}GET_ADDRESS_NOTIFICATION_BODY";
Map<String, dynamic> postParams = {
"P_NOTIFICATION_ID": notificationId,
"P_PAGE_LIMIT": 100,
"P_PAGE_NUM": 1,
};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel responseData = GenericResponseModel.fromJson(json);
return responseData.getAddressNotificationBodyList;
}, url, postParams);
}
Future<List<GetFavoriteReplacements>?> getFavoriteReplacementWithoutImage() async {
String url = "${ApiConsts.erpRest}Mohemm_GetFavoriteReplacementsWithoutImage";
Map<String, dynamic> postParams = {};

@ -38,6 +38,7 @@ class AppState {
String? get getForgetPasswordTokenID => forgetPasswordTokenID;
//Wifi info
String? _mohemmWifiSSID;
@ -63,7 +64,7 @@ class AppState {
String? get getMarathonProjectId => _projectID;
final PostParamsModel _postParamsInitConfig = PostParamsModel(channel: 31, versionID: 5.0, mobileType: Platform.isAndroid ? "android" : "ios");
final PostParamsModel _postParamsInitConfig = PostParamsModel(channel: 31, versionID: 3.8, mobileType: Platform.isAndroid ? "android" : "ios");
void setPostParamsInitConfig() {
isAuthenticated = false;

@ -63,4 +63,5 @@ class MyColors {
static const Color darkDigitColor = Color(0xff2D2F39);
static const Color grey71Color = Color(0xff717171);
static const Color darkGrey3BColor = Color(0xff3B3B3B);
static const Color lightGreyIconColor = Color(0xff919191);
}

@ -2,8 +2,9 @@ import 'package:mohem_flutter_app/ui/marathon/widgets/question_card.dart';
class ApiConsts {
//static String baseUrl = "http://10.200.204.20:2801/"; // Local server
// static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server
static String baseUrl = "https://hmgwebservices.com"; // Live server
// static String baseUrl = "https://erptstapp.srca.org.sa"; // SRCA server
static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server
// static String baseUrl = "https://hmgwebservices.com"; // Live server
static String baseUrlServices = baseUrl + "/Services/"; // server
// static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server
static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/";
@ -27,6 +28,7 @@ class ApiConsts {
//Brain Marathon Constants
static String marathonBaseUrl = "https://marathoon.com/service/api/";
static String marathonBaseUrlServices = "https://marathoon.com/service/";
static String marathonParticipantLoginUrl = marathonBaseUrl + "auth/participantlogin";
static String marathonProjectGetUrl = marathonBaseUrl + "Project/Project_Get";
static String marathonUpcomingUrl = marathonBaseUrl + "marathon/upcoming/";

@ -6,7 +6,6 @@ class DateUtil {
///
///
static DateTime convertStringToDateMarathon(String date) {
// /Date(1585774800000+0300)/
if (date != null) {
@ -40,7 +39,30 @@ class DateUtil {
}
static DateTime convertSimpleStringDateToDate(String date) {
return DateFormat("MM/dd/yyyy hh:mm:ss").parse(date);
// print(date.toUpperCase());
return getDateTimeFromString(date.split(" ")[0], date.toUpperCase().split(" ")[1] + " " + date.toUpperCase().split(" ")[2]);
}
static DateTime getDateTimeFromString(String date, String time) {
var hours = num.parse(time.split(":")[0]);
var mins = time.split(":")[1];
var secs = time.split(":")[2].split(" ")[0];
String meridium = time.split(" ")[1];
if (meridium == "PM") {
if (hours != 12) {
hours = hours + 12;
}
}
if (meridium == "AM") {
if (hours == 12) {
hours = 00;
}
}
date = date + " $hours:$mins:$secs";
DateTime returnDate = DateFormat("MM/dd/yyyy HH:mm:ss").parse(date);
return returnDate;
}
static DateTime convertSimpleStringDateToDateddMMyyyy(String date) {

@ -9,7 +9,6 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/date_uitl.dart';
import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/exceptions/api_exception.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
@ -37,7 +36,7 @@ class Utils {
timeInSecForIosWeb: 1,
backgroundColor: Colors.black54,
textColor: Colors.white,
fontSize: 16.0);
fontSize: 13.0);
}
static dynamic getNotNullValue(List<dynamic> list, int index) {
@ -66,6 +65,7 @@ class Utils {
showDialog(
context: context,
barrierColor: Colors.black.withOpacity(0.5),
useRootNavigator: false,
builder: (BuildContext context) => LoadingDialog(),
).then((value) {
_isLoadingVisible = false;
@ -98,31 +98,38 @@ class Utils {
static void handleException(dynamic exception, cxt, Function(String)? onErrorMessage) {
String errorMessage;
if (exception is APIException) {
if (exception.message == APIException.UNAUTHORIZED) {
return;
if (exception.error.errorType != null && exception.error.errorType == 4) {
Navigator.pushNamedAndRemoveUntil(cxt, AppRoutes.appUpdateScreen, (_) => false, arguments: exception.error?.errorMessage);
} else {
if (exception is APIException) {
if (exception.message == APIException.UNAUTHORIZED) {
return;
} else {
errorMessage = exception.error?.errorMessage ?? exception.message;
}
} else {
errorMessage = exception.error?.errorMessage ?? exception.message;
errorMessage = APIException.UNKNOWN;
}
} else {
errorMessage = APIException.UNKNOWN;
}
if (onErrorMessage != null) {
onErrorMessage(errorMessage);
} else {
if (!AppState().isAuthenticated) {
showDialog(
context: cxt,
builder: (cxt) => ConfirmDialog(
message: errorMessage,
onTap: () {
Navigator.pushNamedAndRemoveUntil(cxt, AppRoutes.login, (Route<dynamic> route) => false);
},
),
);
if (onErrorMessage != null) {
onErrorMessage(errorMessage);
} else {
// showToast(errorMessage);
confirmDialog(cxt, errorMessage);
if (!AppState().isAuthenticated) {
showDialog(
context: cxt,
builder: (cxt) => ConfirmDialog(
message: errorMessage,
onTap: () {
Navigator.pushNamedAndRemoveUntil(cxt, AppRoutes.login, (Route<dynamic> route) => false);
},
),
);
} else {
if (cxt != null) {
confirmDialog(cxt, errorMessage);
} else {
showToast(errorMessage);
}
}
}
}
}
@ -307,7 +314,24 @@ class Utils {
}
static String formatDateDefault(String date) {
return DateFormat('yyyy-MM-dd').format(DateFormat('dd-MMM-yyyy').parseLoose(date));
if (date.isNotEmpty) {
if (date.toLowerCase().contains("t")) {
date = date.toLowerCase().split("t")[0];
if (!date.contains("00:00:00")) {
date = date + ' 00:00:00';
}
return date;
} else {
if (date.toLowerCase().split("-")[1].length == 3) {
return DateFormat('dd-MM-yyyy').format(DateFormat('dd-MMM-yyyy').parseLoose(date));
} else {
return DateFormat('dd-MM-yyyy').format(DateFormat('yyyy-MM-dd').parseLoose(date));
}
// return DateFormat('yyyy-MM-dd').format(DateFormat('dd-MM-yyyy').parseLoose(date));
}
} else {
return date;
}
}
static Future<DateTime> selectDate(BuildContext context, DateTime selectedDate) async {
@ -340,7 +364,6 @@ class Utils {
static void readNFc({required Function(String) onRead}) {
NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async {
print(tag.data);
var f;
if (Platform.isAndroid) {
f = MifareUltralight(tag: tag, identifier: tag.data["nfca"]["identifier"], type: 2, maxTransceiveLength: 252, timeout: 22);

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/ui/app_update_screen.dart';
import 'package:mohem_flutter_app/ui/attendance/add_vacation_rule_screen.dart';
import 'package:mohem_flutter_app/ui/attendance/monthly_attendance_screen.dart';
import 'package:mohem_flutter_app/ui/attendance/vacation_rule_screen.dart';
@ -191,6 +192,7 @@ class AppRoutes {
static const String marathonWaitingScreen = "/marathonWaitingScreen";
static const String unsafeDeviceScreen = "/unsafeDeviceScreen";
static const String appUpdateScreen = "/appUpdateScreen";
static final Map<String, WidgetBuilder> routes = {
login: (BuildContext context) => LoginScreen(),
@ -302,5 +304,6 @@ class AppRoutes {
marathonWaitingScreen: (BuildContext context) => const MarathonWaitingScreen(),
unsafeDeviceScreen: (BuildContext context) => const UnsafeDeviceScreen(),
appUpdateScreen: (BuildContext context) => const AppUpdateScreen(),
};
}

@ -102,13 +102,14 @@ extension EmailValidator on String {
decoration: isUnderLine ? TextDecoration.underline : null),
);
Widget toText16({Color? color, bool isUnderLine = false, bool isBold = false, int? maxlines}) => Text(
Widget toText16({Color? color, bool isUnderLine = false, bool isBold = false, int? maxlines, double? height}) => Text(
this,
maxLines: maxlines,
style: TextStyle(
color: color ?? MyColors.darkTextColor,
fontSize: 16,
letterSpacing: -0.64,
height: height,
fontWeight: isBold ? FontWeight.bold : FontWeight.w600,
decoration: isUnderLine ? TextDecoration.underline : null,
),

@ -58,7 +58,7 @@ extension WidgetExtensions on Widget {
),
],
),
alignment: center == true ? Alignment.center : null,
alignment: center ? Alignment.center : null,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,

@ -528,7 +528,9 @@ class CodegenLoader extends AssetLoader{
"youWantToLeaveMarathon": "هل أنت متأكد أنك تريد العودة؟ سوف تخرج من المسابقة.",
"ourSponsor": "راعينا:",
"startingIn": "يبدأ في",
"youAreOutOfContest": "أنت خارج المسابقة."
"youAreOutOfContest": "أنت خارج المسابقة.",
"winners": "الفائزين!!!",
"fakeLocation": ".لقد تتبعنا أنك تحاول استخدام موقع مزيف! يعتبر هذا مخالفة وقد تم إخطار الموارد البشرية"
};
static const Map<String,dynamic> en_US = {
"mohemm": "Mohemm",
@ -1044,7 +1046,9 @@ static const Map<String,dynamic> en_US = {
"youWantToLeaveMarathon": "Are you sure you want to go back? You will be out of the contest.",
"ourSponsor": "Our Sponsor:",
"startingIn": "Starting in",
"youAreOutOfContest": "You are out of the contest."
"youAreOutOfContest": "You are out of the contest.",
"winners": "WINNERS!!!",
"fakeLocation": "We traced out that you try to use a fake location! This is considered a violation, and HR has been notified."
};
static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": ar_SA, "en_US": en_US};
}

@ -499,5 +499,7 @@ abstract class LocaleKeys {
static const ourSponsor = 'ourSponsor';
static const startingIn = 'startingIn';
static const youAreOutOfContest = 'youAreOutOfContest';
static const winners = 'winners';
static const fakeLocation = 'fakeLocation';
}

@ -16,7 +16,6 @@ import 'package:image_picker_for_web/image_picker_for_web.dart';
import 'package:shared_preferences_web/shared_preferences_web.dart';
import 'package:url_launcher_web/url_launcher_web.dart';
import 'package:video_player_web/video_player_web.dart';
import 'package:wakelock_web/wakelock_web.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
@ -32,6 +31,5 @@ void registerPlugins(Registrar registrar) {
SharedPreferencesPlugin.registerWith(registrar);
UrlLauncherPlugin.registerWith(registrar);
VideoPlayerPlugin.registerWith(registrar);
WakelockWeb.registerWith(registrar);
registrar.registerMessageHandler();
}

@ -2,6 +2,7 @@ import 'dart:io';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:logger/logger.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/consts.dart';
@ -37,6 +38,10 @@ bool isTablet = false;
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
await EasyLocalization.ensureInitialized();
AppState().setPostParamsInitConfig();
HttpOverrides.global = MyHttpOverrides();

@ -1,8 +1,8 @@
import 'dart:convert';
ChatUnreadCovnCountModel chatUnreadCovnCountModelFromJson(String str) => ChatUnreadCovnCountModel.fromJson(json.decode(str));
// To parse this JSON data, do
//
// final chatUnreadCovnCountModel = chatUnreadCovnCountModelFromMap(jsonString);
String chatUnreadCovnCountModelToJson(ChatUnreadCovnCountModel data) => json.encode(data.toJson());
import 'dart:convert';
class ChatUnreadCovnCountModel {
ChatUnreadCovnCountModel({
@ -13,13 +13,17 @@ class ChatUnreadCovnCountModel {
int? singleChatCount;
int? groupChatCount;
factory ChatUnreadCovnCountModel.fromJson(Map<String, dynamic> json) => ChatUnreadCovnCountModel(
singleChatCount: json["singleChatCount"] == null ? null : json["singleChatCount"],
groupChatCount: json["groupChatCount"] == null ? null : json["groupChatCount"],
);
factory ChatUnreadCovnCountModel.fromJson(String str) => ChatUnreadCovnCountModel.fromMap(json.decode(str));
String toJson() => json.encode(toMap());
factory ChatUnreadCovnCountModel.fromMap(Map<String, dynamic> json) => ChatUnreadCovnCountModel(
singleChatCount: json["singleChatCount"] == null ? null : json["singleChatCount"],
groupChatCount: json["groupChatCount"] == null ? null : json["groupChatCount"],
);
Map<String, dynamic> toJson() => {
"singleChatCount": singleChatCount == null ? null : singleChatCount,
"groupChatCount": groupChatCount == null ? null : groupChatCount,
};
Map<String, dynamic> toMap() => {
"singleChatCount": singleChatCount == null ? null : singleChatCount,
"groupChatCount": groupChatCount == null ? null : groupChatCount,
};
}

@ -1,3 +1,5 @@
import 'dart:io';
class ChatUserModel {
ChatUserModel({
this.response,
@ -35,6 +37,7 @@ class ChatUser {
this.isTyping,
this.isImageLoaded,
this.isImageLoading,
this.userLocalDownlaodedImage,
});
int? id;
@ -52,24 +55,25 @@ class ChatUser {
bool? isTyping;
bool? isImageLoaded;
bool? isImageLoading;
File? userLocalDownlaodedImage;
factory ChatUser.fromJson(Map<String, dynamic> json) => ChatUser(
id: json["id"] == null ? null : json["id"],
userName: json["userName"] == null ? null : json["userName"],
email: json["email"] == null ? null : json["email"],
phone: json["phone"],
title: json["title"],
userStatus: json["userStatus"] == null ? null : json["userStatus"],
image: json["image"],
unreadMessageCount: json["unreadMessageCount"] == null ? null : json["unreadMessageCount"],
userAction: json["userAction"],
isPin: json["isPin"] == null ? null : json["isPin"],
isFav: json["isFav"] == null ? null : json["isFav"],
isAdmin: json["isAdmin"] == null ? null : json["isAdmin"],
isTyping: false,
isImageLoaded: false,
isImageLoading: true,
);
id: json["id"] == null ? null : json["id"],
userName: json["userName"] == null ? null : json["userName"],
email: json["email"] == null ? null : json["email"],
phone: json["phone"],
title: json["title"],
userStatus: json["userStatus"] == null ? null : json["userStatus"],
image: json["image"],
unreadMessageCount: json["unreadMessageCount"] == null ? null : json["unreadMessageCount"],
userAction: json["userAction"],
isPin: json["isPin"] == null ? null : json["isPin"],
isFav: json["isFav"] == null ? null : json["isFav"],
isAdmin: json["isAdmin"] == null ? null : json["isAdmin"],
isTyping: false,
isImageLoaded: false,
isImageLoading: true,
userLocalDownlaodedImage: null);
Map<String, dynamic> toJson() => {
"id": id == null ? null : id,

@ -19,6 +19,8 @@ class SingleUserChatModel {
this.targetUserName,
this.encryptedTargetUserId,
this.encryptedTargetUserName,
this.currentUserEmail,
this.targetUserEmail,
this.chatEventId,
this.fileTypeId,
this.isSeen,
@ -38,8 +40,10 @@ class SingleUserChatModel {
String? contantNo;
int? currentUserId;
String? currentUserName;
String? currentUserEmail;
int? targetUserId;
String? targetUserName;
String? targetUserEmail;
String? encryptedTargetUserId;
String? encryptedTargetUserName;
int? chatEventId;
@ -64,6 +68,8 @@ class SingleUserChatModel {
currentUserName: json["currentUserName"] == null ? null : json["currentUserName"],
targetUserId: json["targetUserId"] == null ? null : json["targetUserId"],
targetUserName: json["targetUserName"] == null ? null : json["targetUserName"],
targetUserEmail: json["targetUserEmail"] == null ? null : json["targetUserEmail"],
currentUserEmail: json["currentUserEmail"] == null ? null : json["currentUserEmail"],
encryptedTargetUserId: json["encryptedTargetUserId"] == null ? null : json["encryptedTargetUserId"],
encryptedTargetUserName: json["encryptedTargetUserName"] == null ? null : json["encryptedTargetUserName"],
chatEventId: json["chatEventId"] == null ? null : json["chatEventId"],
@ -90,6 +96,8 @@ class SingleUserChatModel {
"targetUserName": targetUserName == null ? null : targetUserName,
"encryptedTargetUserId": encryptedTargetUserId == null ? null : encryptedTargetUserId,
"encryptedTargetUserName": encryptedTargetUserName == null ? null : encryptedTargetUserName,
"currentUserEmail": currentUserEmail == null ? null : currentUserEmail,
"targetUserEmail": targetUserEmail == null ? null : targetUserEmail,
"chatEventId": chatEventId == null ? null : chatEventId,
"fileTypeId": fileTypeId,
"isSeen": isSeen == null ? null : isSeen,

@ -102,6 +102,7 @@ import 'package:mohem_flutter_app/models/validate_eit_transaction_list_model.dar
import 'package:mohem_flutter_app/models/worklist/GetRFCEmployeeList.dart';
import 'package:mohem_flutter_app/models/worklist/get_favorite_replacements_model.dart';
import 'package:mohem_flutter_app/models/worklist/hr/eit_otification_body_model.dart';
import 'package:mohem_flutter_app/models/worklist/hr/get_address_notification_body_list.dart';
import 'package:mohem_flutter_app/models/worklist/hr/get_basic_det_ntf_body_list_model.dart';
import 'package:mohem_flutter_app/models/worklist/hr/get_contact_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/worklist/hr/get_phones_notification_body_list_model.dart';
@ -163,12 +164,12 @@ class GenericResponseModel {
List<String>? getAbsenceAttachmentsList;
List<GetAbsenceAttendanceTypesList>? getAbsenceAttendanceTypesList;
List<GetAbsenceCollectionNotificationBodyList>? getAbsenceCollectionNotificationBodyList;
List<GetAddressNotificationBodyList>? getAddressNotificationBodyList;
List<GetAbsenceDffStructureList>? getAbsenceDffStructureList;
List<GetAbsenceTransactionList>? getAbsenceTransactionList;
List<GetAccrualBalancesList>? getAccrualBalancesList;
List<GetActionHistoryList>? getActionHistoryList;
List<GetAddressDffStructureList>? getAddressDffStructureList;
List<String>? getAddressNotificationBodyList;
List<GetApprovesList>? getApprovesList;
List<GetAttachementList>? getAttachementList;
GetAttendanceTracking? getAttendanceTrackingList;
@ -717,6 +718,13 @@ class GenericResponseModel {
});
}
if (json['GetAddressNotificationBodyList'] != null) {
getAddressNotificationBodyList = <GetAddressNotificationBodyList>[];
json['GetAddressNotificationBodyList'].forEach((v) {
getAddressNotificationBodyList!.add(GetAddressNotificationBodyList.fromJson(v));
});
}
if (json['GetAbsenceDffStructureList'] != null) {
getAbsenceDffStructureList = <GetAbsenceDffStructureList>[];
json['GetAbsenceDffStructureList'].forEach((v) {
@ -746,7 +754,7 @@ class GenericResponseModel {
getAddressDffStructureList!.add(GetAddressDffStructureList.fromJson(v));
});
}
getAddressNotificationBodyList = json['GetAddressNotificationBodyList'];
// getAddressNotificationBodyList = json['GetAddressNotificationBodyList'];
if (json['GetApprovesList'] != null) {
getApprovesList = <GetApprovesList>[];

@ -4,7 +4,7 @@ class GetPoItemHistoryList {
String? bUYER;
String? cLOSEDCODE;
String? cREATIONDATE;
int? dISCOUNTPERCENTAGE;
num? dISCOUNTPERCENTAGE;
int? fROMROWNUM;
int? iTEMID;
num? nETPRICE;

@ -5,7 +5,7 @@ class GetQuotationAnalysisList {
int? nOOFROWS;
String? qUOTBONUSQTY;
String? qUOTDELIVERYDATE;
int? qUOTLINETOTAL;
num? qUOTLINETOTAL;
String? qUOTMFGPARTNUM;
String? qUOTNUM;
num? qUOTQTY;

@ -1,41 +1,41 @@
class GetTimeCardSummaryList {
int? aBSENTDAYS;
num? aBSENTDAYS;
dynamic? aCTUALHRS;
dynamic? aPPROVEDTIMEBACKHRS;
int? aSSIGNMENTID;
int? aTTENDEDDAYS;
int? bUSINESSTRIP;
num? aSSIGNMENTID;
num? aTTENDEDDAYS;
num? bUSINESSTRIP;
dynamic? cOMPOFFHHRS;
dynamic? cOMPOFFNHRS;
dynamic? cOMPOFFWHRS;
dynamic? dESIREDSCHEDULEDHRS;
dynamic? eARLYOUTHRS;
dynamic? eXCESSHRS;
int? hALFDAYLEAVE;
num? hALFDAYLEAVE;
dynamic? lATEINHRS;
dynamic? lEAVESHOLIDAYSHRS;
dynamic? nONSCHEDULEDAYS;
dynamic? nOTANALYZEDDAYS;
int? oFFDAYS;
num? oFFDAYS;
dynamic? oNCALLHRS;
dynamic? pAIDLEAVE;
int? pERIODDAYS;
num? pERIODDAYS;
dynamic? pLANNEDOTHRS;
int? pUBLICHOLIDAY;
num? pUBLICHOLIDAY;
dynamic? sCHEDULEDHRS;
dynamic? sCHEDULEDONCALLHRS;
dynamic? sCHEDULEDPLANNEDOTHRS;
int? sCHEDULEDAYS;
num? sCHEDULEDAYS;
dynamic? sHORTAGEHRS;
dynamic? sHORTAGESCHEDULEHRS;
int? sICKLEAVE;
num? sICKLEAVE;
dynamic? tIMEBACKHRS;
dynamic? tIMEBACKBALANCE;
int? uNAUTHORIZEDLEAVE;
num? uNAUTHORIZEDLEAVE;
dynamic? uNCOVERDSHORTAGEHRS;
int? uNPAIDLEAVE;
num? uNPAIDLEAVE;
GetTimeCardSummaryList(
{this.aBSENTDAYS,

@ -48,7 +48,7 @@ class MemberInformationListModel {
String? nATIONALITYCODE;
String? nATIONALITYMEANING;
String? nATIONALIDENTIFIER;
String? nORMALHOURS;
dynamic? nORMALHOURS;
int? nOOFROWS;
int? oRGANIZATIONID;
String? oRGANIZATIONNAME;

@ -0,0 +1,28 @@
class GetAddressNotificationBodyList {
String? pREVSEGMENTVALUEDSP;
String? sEGMENTPROMPT;
String? sEGMENTVALUEDSP;
String? uPDATEDFLAG;
GetAddressNotificationBodyList(
{this.pREVSEGMENTVALUEDSP,
this.sEGMENTPROMPT,
this.sEGMENTVALUEDSP,
this.uPDATEDFLAG});
GetAddressNotificationBodyList.fromJson(Map<String, dynamic> json) {
pREVSEGMENTVALUEDSP = json['PREV_SEGMENT_VALUE_DSP'];
sEGMENTPROMPT = json['SEGMENT_PROMPT'];
sEGMENTVALUEDSP = json['SEGMENT_VALUE_DSP'];
uPDATEDFLAG = json['UPDATED_FLAG'];
}
Map<String, dynamic> toJson() {
Map<String, dynamic> data = new Map<String, dynamic>();
data['PREV_SEGMENT_VALUE_DSP'] = this.pREVSEGMENTVALUEDSP;
data['SEGMENT_PROMPT'] = this.sEGMENTPROMPT;
data['SEGMENT_VALUE_DSP'] = this.sEGMENTVALUEDSP;
data['UPDATED_FLAG'] = this.uPDATEDFLAG;
return data;
}
}

@ -2,13 +2,16 @@ import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
import 'package:audio_waveforms/audio_waveforms.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:http/http.dart';
import 'package:just_audio/just_audio.dart';
import 'package:just_audio/just_audio.dart' as JustAudio;
import 'package:mohem_flutter_app/api/chat/chat_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/app_permissions.dart';
import 'package:mohem_flutter_app/classes/consts.dart';
import 'package:mohem_flutter_app/classes/encryption.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
@ -20,6 +23,9 @@ import 'package:mohem_flutter_app/models/chat/get_user_login_token_model.dart' a
import 'package:mohem_flutter_app/models/chat/make_user_favotire_unfavorite_chat_model.dart' as fav;
import 'package:mohem_flutter_app/ui/landing/dashboard_screen.dart';
import 'package:mohem_flutter_app/widgets/image_picker.dart';
import 'package:open_file/open_file.dart';
import 'package:path_provider/path_provider.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:signalr_netcore/hub_connection.dart';
import 'package:signalr_netcore/signalr_client.dart';
import 'package:uuid/uuid.dart';
@ -33,6 +39,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
String chatCID = '';
bool isLoading = true;
bool isChatScreenActive = false;
int receiverID = 0;
late File selectedFile;
bool isFileSelected = false;
String sFileType = "";
@ -40,12 +47,21 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
List<SingleUserChatModel> repliedMsg = [];
List<ChatUser> favUsersList = [];
int paginationVal = 0;
bool currentUserTyping = false;
int? cTypingUserId = 0;
//Chat Home Page Counter
int chatUConvCounter = 0;
Future<void> getUserAutoLoginToken() async {
userLoginToken.UserAutoLoginModel userLoginResponse = await ChatApiClient().getUserLoginToken();
print("======================================= Chat Login Token Check =====================================");
logger.d(userLoginResponse.toJson());
print("======================================= Chat Login Token Check =====================================");
if (userLoginResponse.response != null) {
AppState().setchatUserDetails = userLoginResponse;
} else {
AppState().setchatUserDetails = userLoginResponse;
Utils.showToast(
userLoginResponse.errorResponses!.first.fieldName.toString() + " Erorr",
);
@ -57,30 +73,23 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
await chatHubConnection.start();
print("Startedddddddd");
chatHubConnection.on("OnDeliveredChatUserAsync", onMsgReceived);
chatHubConnection.on("OnGetChatConversationCount", onNewChatConversion);
}
Future<HubConnection> getHubConnection() async {
HubConnection hub;
// try {
HttpConnectionOptions httpOp = HttpConnectionOptions(skipNegotiation: false, logMessageContent: true);
hub = HubConnectionBuilder()
.withUrl(ApiConsts.chatHubConnectionUrl + "?UserId=${AppState().chatDetails!.response!.id}&source=Web&access_token=${AppState().chatDetails!.response!.token}", options: httpOp)
.withAutomaticReconnect(retryDelays: <int>[2000, 5000, 10000, 20000]).build();
// isChatHubLoding = false;
return hub;
// } catch (e) {
// getUserAutoLoginToken().whenComplete(() {
// getHubConnection();
// });
// throw e;
// }
}
void registerEvents() {
chatHubConnection.on("OnUpdateUserStatusAsync", changeStatus);
// chatHubConnection.on("OnDeliveredChatUserAsync", onMsgReceived);
// hubConnection.on("OnSeenChatUserAsync", onChatSeen);
//hubConnection.on("OnUserTypingAsync", onUserTyping);
chatHubConnection.on("OnUserTypingAsync", onUserTyping);
chatHubConnection.on("OnUserCountAsync", userCountAsync);
// hubConnection.on("OnUpdateUserChatHistoryWindowsAsync", updateChatHistoryWindow);
chatHubConnection.on("OnGetUserChatHistoryNotDeliveredAsync", chatNotDelivered);
@ -124,8 +133,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
AppState().chatDetails!.response!.id.toString(),
),
);
sort();
notifyListeners();
if (searchedChats!.isNotEmpty) {
if (searchedChats!.isNotEmpty || favUsersList.isNotEmpty) {
getUserImages();
}
}
@ -140,19 +150,12 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
if (isNewChat) userChatHistory = [];
if (!loadMore) paginationVal = 0;
isChatScreenActive = true;
// if (chatHubConnection.state != HubConnectionState.Connected) {
// getUserAutoLoginToken().whenComplete(() async {
// await buildHubConnection();
// getSingleUserChatHistory(senderUID: senderUID, receiverUID: receiverUID, loadMore: loadMore);
// });
// return;
// }
receiverID = receiverUID;
Response response = await ChatApiClient().getSingleUserChatHistory(senderUID: senderUID, receiverUID: receiverUID, loadMore: loadMore, paginationVal: paginationVal);
if (response.statusCode == 204) {
if (isNewChat) {
userChatHistory = [];
} else if (loadMore) {
// userChatHistory = [];
Utils.showToast("No More Data To Load");
}
} else {
@ -165,7 +168,11 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
}
isLoading = false;
notifyListeners();
markRead(userChatHistory, receiverUID);
if (isChatScreenActive && receiverUID == receiverID) {
markRead(userChatHistory, receiverUID);
}
generateConvId();
}
@ -177,26 +184,28 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
void markRead(List<SingleUserChatModel> data, int receiverID) {
if (data != null) {
for (SingleUserChatModel element in data!) {
if (element.isSeen != null) {
if (!element.isSeen!) {
element.isSeen = true;
dynamic data = [
{
"userChatHistoryId": element.userChatHistoryId,
"TargetUserId": element.currentUserId == receiverID ? element.currentUserId : element.targetUserId,
"isDelivered": true,
"isSeen": true,
}
];
updateUserChatHistoryStatusAsync(data);
notifyListeners();
if (AppState().chatDetails!.response!.id! == element.targetUserId) {
if (element.isSeen != null) {
if (!element.isSeen!) {
element.isSeen = true;
dynamic data = [
{
"userChatHistoryId": element.userChatHistoryId,
"TargetUserId": element.currentUserId == receiverID ? element.currentUserId : element.targetUserId,
"isDelivered": true,
"isSeen": true,
}
];
updateUserChatHistoryStatusAsync(data);
notifyListeners();
}
}
for (ChatUser element in searchedChats!) {
if (element.id == receiverID) {
element.unreadMessageCount = 0;
chatUConvCounter = 0;
}
}
}
}
for (ChatUser element in searchedChats!) {
if (element.id == receiverID) {
element.unreadMessageCount = 0;
// notifyListeners();
}
}
notifyListeners();
@ -288,14 +297,12 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
void chatNotDelivered(List<Object?>? args) {
dynamic items = args!.toList();
for (dynamic item in items[0]) {
searchedChats!.forEach(
(ChatUser element) {
if (element.id == item["currentUserId"]) {
int? val = element.unreadMessageCount ?? 0;
element.unreadMessageCount = val! + 1;
}
},
);
for (ChatUser element in searchedChats!) {
if (element.id == item["currentUserId"]) {
int? val = element.unreadMessageCount ?? 0;
element.unreadMessageCount = val! + 1;
}
}
}
notifyListeners();
}
@ -332,8 +339,11 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
temp = getSingleUserChatModel(jsonEncode(msg));
data.first.targetUserId = temp.first.currentUserId;
data.first.targetUserName = temp.first.currentUserName;
data.first.targetUserEmail = temp.first.currentUserEmail;
data.first.currentUserId = temp.first.targetUserId;
data.first.currentUserName = temp.first.targetUserName;
data.first.currentUserEmail = temp.first.targetUserEmail;
if (data.first.fileTypeId == 12 || data.first.fileTypeId == 4 || data.first.fileTypeId == 3) {
data.first.image = await ChatApiClient().downloadURL(fileName: data.first.contant!, fileTypeDescription: data.first.fileTypeResponse!.fileTypeDescription ?? "image/jpg");
}
@ -347,36 +357,59 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
}
}
}
dynamic contain = searchedChats!.where((ChatUser element) => element.id == data.first.currentUserId);
if (contain.isEmpty) {
searchedChats!.add(ChatUser(id: data.first.currentUserId, userName: data.first.currentUserName, unreadMessageCount: 0, isImageLoading: false, image: "", isImageLoaded: true, userStatus: 1));
}
if (searchedChats != null) {
dynamic contain = searchedChats!.where((ChatUser element) => element.id == data.first.currentUserId);
if (contain.isEmpty) {
List<String> emails = [];
emails.add(await EmailImageEncryption().encrypt(val: data.first.currentUserEmail!));
List<ChatUserImageModel> chatImages = await ChatApiClient().getUsersImages(encryptedEmails: emails);
searchedChats!.add(
ChatUser(
id: data.first.currentUserId,
userName: data.first.currentUserName,
unreadMessageCount: 0,
isImageLoading: false,
image: chatImages!.first.profilePicture ?? "",
isImageLoaded: true,
userStatus: 1,
isTyping: false,
userLocalDownlaodedImage: await downloadImageLocal(chatImages.first.profilePicture, data.first.currentUserId.toString()),
),
);
}
}
setMsgTune();
userChatHistory.insert(0, data.first);
if (searchedChats != null && !isChatScreenActive) {
for (ChatUser user in searchedChats!) {
if (user.id == data.first.currentUserId) {
int tempCount = user.unreadMessageCount ?? 0;
user.unreadMessageCount = tempCount + 1;
if (isChatScreenActive && data.first.currentUserId == receiverID) {
userChatHistory.insert(0, data.first);
} else {
if (searchedChats != null) {
for (ChatUser user in searchedChats!) {
if (user.id == data.first.currentUserId) {
int tempCount = user.unreadMessageCount ?? 0;
user.unreadMessageCount = tempCount + 1;
}
}
sort();
}
sort();
}
List list = [
{"userChatHistoryId": data.first.userChatHistoryId, "TargetUserId": temp.first.targetUserId, "isDelivered": true, "isSeen": isChatScreenActive ? true : false}
List<Object> list = [
{
"userChatHistoryId": data.first.userChatHistoryId,
"TargetUserId": temp.first.targetUserId,
"isDelivered": true,
"isSeen": isChatScreenActive && data.first.currentUserId == receiverID ? true : false
}
];
updateUserChatHistoryOnMsg(list);
invokeChatCounter(userId: AppState().chatDetails!.response!.id!);
notifyListeners();
}
void sort() {
searchedChats!.sort(
(ChatUser a, ChatUser b) => b.unreadMessageCount!.compareTo(
a.unreadMessageCount!,
),
(ChatUser a, ChatUser b) => b.unreadMessageCount!.compareTo(a.unreadMessageCount!),
);
}
@ -474,7 +507,6 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
required bool isImageLoaded}) async {
Uuid uuid = const Uuid();
String contentNo = uuid.v4();
String msg = message.text;
SingleUserChatModel data = SingleUserChatModel(
chatEventId: chatEventId,
@ -493,8 +525,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
fileTypeResponse: isAttachment
? FileTypeResponse(
fileTypeId: fileTypeId,
fileTypeName: getFileType(getFileExtension(selectedFile.path).toString()),
fileKind: getFileExtension(selectedFile.path),
fileTypeName: getFileExtension(selectedFile.path).toString(),
fileKind: "file",
fileName: selectedFile.path.split("/").last,
fileTypeDescription: getFileTypeDescription(getFileExtension(selectedFile.path).toString()),
)
@ -514,14 +546,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
await chatHubConnection.invoke("AddChatUserAsync", args: <Object>[json.decode(chatData)]);
}
void sendChatMessage(int targetUserId, String targetUserName, BuildContext context) async {
dynamic contain = searchedChats!.where((ChatUser element) => element.id == targetUserId);
if (contain.isEmpty) {
searchedChats!.add(
ChatUser(id: targetUserId, userName: targetUserName, unreadMessageCount: 0, isImageLoading: false, image: "", isImageLoaded: true),
);
notifyListeners();
}
void sendChatMessage(BuildContext context, {required int targetUserId, required int userStatus, required String userEmail, required String targetUserName}) async {
if (!isFileSelected && !isMsgReply) {
print("Normal Text Msg");
if (message.text == null || message.text.isEmpty) {
@ -531,6 +556,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
chatEventId: 1, fileTypeId: null, targetUserId: targetUserId, targetUserName: targetUserName, isAttachment: false, chatReplyId: null, isReply: false, isImageLoaded: false, image: null);
} // normal Text msg
if (isFileSelected && !isMsgReply) {
bool isImage = false;
print("Normal Attachment Msg");
Utils.showLoading(context);
dynamic value = await uploadAttachments(AppState().chatDetails!.response!.id.toString(), selectedFile);
@ -580,6 +606,51 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
isImageLoaded: true,
image: selectedFile.readAsBytesSync());
}
if (searchedChats != null) {
dynamic contain = searchedChats!.where((ChatUser element) => element.id == targetUserId);
if (contain.isEmpty) {
List<String> emails = [];
emails.add(await EmailImageEncryption().encrypt(val: userEmail));
List<ChatUserImageModel> chatImages = await ChatApiClient().getUsersImages(encryptedEmails: emails);
searchedChats!.add(
ChatUser(
id: targetUserId,
userName: targetUserName,
unreadMessageCount: 0,
email: userEmail,
isImageLoading: false,
image: chatImages.first.profilePicture ?? "",
isImageLoaded: true,
isTyping: false,
isFav: false,
userStatus: userStatus,
userLocalDownlaodedImage: await downloadImageLocal(chatImages.first.profilePicture, targetUserId.toString()),
),
);
notifyListeners();
}
} else {
List<String> emails = [];
emails.add(await EmailImageEncryption().encrypt(val: userEmail));
List<ChatUserImageModel> chatImages = await ChatApiClient().getUsersImages(encryptedEmails: emails);
searchedChats!.add(
ChatUser(
id: targetUserId,
userName: targetUserName,
unreadMessageCount: 0,
email: userEmail,
isImageLoading: false,
image: chatImages.first.profilePicture ?? "",
isImageLoaded: true,
isTyping: false,
isFav: false,
userStatus: userStatus,
userLocalDownlaodedImage: await downloadImageLocal(chatImages.first.profilePicture, targetUserId.toString()),
),
);
notifyListeners();
}
}
void selectImageToUpload(BuildContext context) {
@ -606,6 +677,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
String? getFileExtension(String fileName) {
try {
print("Ext: " + "." + fileName.split('.').last);
return "." + fileName.split('.').last;
} catch (e) {
return null;
@ -683,7 +755,10 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
for (ChatUser user in searchedChats!) {
if (user.id == favoriteChatUser.response!.targetUserId!) {
user.isFav = favoriteChatUser.response!.isFav;
favUsersList.add(user);
dynamic contain = favUsersList!.where((ChatUser element) => element.id == favoriteChatUser.response!.targetUserId!);
if (contain.isEmpty) {
favUsersList.add(user);
}
}
}
}
@ -711,6 +786,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
searchedChats = pChatHistory;
search.clear();
isChatScreenActive = false;
receiverID = 0;
paginationVal = 0;
message.text = '';
isFileSelected = false;
@ -721,9 +797,11 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
}
void clearAll() {
print("----------------- Disposed ---------------------------");
searchedChats = pChatHistory;
search.clear();
isChatScreenActive = false;
receiverID = 0;
paginationVal = 0;
message.text = '';
isFileSelected = false;
@ -731,16 +809,57 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
sFileType = "";
}
void disposeData() {
search.clear();
isChatScreenActive = false;
receiverID = 0;
paginationVal = 0;
message.text = '';
isFileSelected = false;
repliedMsg = [];
sFileType = "";
deleteData();
favUsersList.clear();
searchedChats!.clear();
pChatHistory!.clear();
chatHubConnection.stop();
AppState().chatDetails = null;
}
void deleteData() {
List<ChatUser> exists = [], unique = [];
if(searchedChats != null) exists.addAll(searchedChats!);
exists.addAll(favUsersList!);
Map<String, ChatUser> profileMap = {};
for (ChatUser item in exists) {
profileMap[item.email!] = item;
}
unique = profileMap.values.toList();
for (ChatUser element in unique!) {
deleteFile(element.id.toString());
}
}
void getUserImages() async {
List<String> emails = [];
for (ChatUser element in searchedChats!) {
List<ChatUser> exists = [], unique = [];
exists.addAll(searchedChats!);
exists.addAll(favUsersList!);
Map<String, ChatUser> profileMap = {};
for (ChatUser item in exists) {
profileMap[item.email!] = item;
}
unique = profileMap.values.toList();
for (ChatUser element in unique!) {
emails.add(await EmailImageEncryption().encrypt(val: element.email!));
}
List<ChatUserImageModel> chatImages = await ChatApiClient().getUsersImages(encryptedEmails: emails);
for (ChatUser user in searchedChats!) {
for (ChatUserImageModel uImage in chatImages) {
if (user.email == uImage.email) {
user.image = uImage.profilePicture ?? "";
user.userLocalDownlaodedImage = await downloadImageLocal(uImage.profilePicture, user.id.toString());
user.isImageLoading = false;
user.isImageLoaded = true;
}
@ -750,6 +869,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
for (ChatUserImageModel uImage in chatImages) {
if (favUser.email == uImage.email) {
favUser.image = uImage.profilePicture ?? "";
favUser.userLocalDownlaodedImage = await downloadImageLocal(uImage.profilePicture, favUser.id.toString());
favUser.isImageLoading = false;
favUser.isImageLoaded = true;
}
@ -759,8 +879,37 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
notifyListeners();
}
Future<File?> downloadImageLocal(String? encodedBytes, String userID) async {
File? myfile;
if (encodedBytes == null) {
return myfile;
} else {
await deleteFile(userID);
Uint8List decodedBytes = base64Decode(encodedBytes);
Directory appDocumentsDirectory = await getApplicationDocumentsDirectory(); // 1
late File imageFile = File("${appDocumentsDirectory.path}/$userID.jpg");
imageFile.writeAsBytesSync(decodedBytes);
return imageFile;
}
}
Future deleteFile(String userID) async {
Directory appDocumentsDirectory = await getApplicationDocumentsDirectory();
late File imageFile = File('${appDocumentsDirectory.path}/$userID.jpg');
if (await imageFile.exists()) {
await imageFile.delete();
}
}
Future<String> downChatMedia(Uint8List bytes, String ext) async {
String dir = (await getApplicationDocumentsDirectory()).path;
File file = File("$dir/" + DateTime.now().millisecondsSinceEpoch.toString() + "." + ext);
await file.writeAsBytes(bytes);
return file.path;
}
void setMsgTune() async {
AudioPlayer player = AudioPlayer();
JustAudio.AudioPlayer player = JustAudio.AudioPlayer();
await player.setVolume(1.0);
String audioAsset = "";
if (Platform.isAndroid) {
@ -776,4 +925,163 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
print("Error: $e");
}
}
Future<void> getChatMedia(BuildContext context, {required String fileName, required String fileTypeName, required int fileTypeID}) async {
Utils.showLoading(context);
if (fileTypeID == 1 || fileTypeID == 5 || fileTypeID == 7 || fileTypeID == 6 || fileTypeID == 8 || fileTypeID == 2) {
Uint8List encodedString = await ChatApiClient().downloadURL(fileName: fileName, fileTypeDescription: getFileTypeDescription(fileTypeName));
try {
String path = await downChatMedia(encodedString, fileTypeName ?? "");
Utils.hideLoading(context);
OpenFile.open(path);
} catch (e) {
Utils.showToast("Cannot open file.");
}
}
}
void onNewChatConversion(List<Object?>? params) {
dynamic items = params!.toList();
chatUConvCounter = items[0]["singleChatCount"] ?? 0;
notifyListeners();
}
Future invokeChatCounter({required int userId}) async {
await chatHubConnection.invoke("GetChatCounversationCount", args: [userId]);
return "";
}
void userTypingInvoke({required int currentUser, required int reciptUser}) async {
logger.d([reciptUser, currentUser]);
await chatHubConnection.invoke("UserTypingAsync", args: [reciptUser, currentUser]);
}
// Audio Recoding Work
Timer? _timer;
int _recodeDuration = 0;
bool isRecoding = false;
bool isPause = false;
bool isPlaying = false;
String? path;
String? musicFile;
late Directory appDirectory;
late RecorderController recorderController;
late PlayerController playerController;
//////// Audio Recoding Work ////////////////////
Future<void> initAudio() async {
appDirectory = await getApplicationDocumentsDirectory();
path = "${appDirectory.path}/${AppState().chatDetails!.response!.id}-${DateTime.now().microsecondsSinceEpoch}.aac";
recorderController = RecorderController()
..androidEncoder = AndroidEncoder.aac
..androidOutputFormat = AndroidOutputFormat.mpeg4
..iosEncoder = IosEncoder.kAudioFormatMPEG4AAC
..sampleRate = 8000
..bitRate = 32000;
playerController = PlayerController();
}
void disposeAudio() {
isRecoding = false;
isPlaying = false;
isPause = false;
recorderController.dispose();
playerController.dispose();
}
void startRecoding() async {
PermissionStatus status = await Permission.microphone.request();
print(status);
if (status.isDenied == true) {
startRecoding();
} else {
recorderController.reset();
await recorderController.record(path);
_recodeDuration = 0;
_startTimer();
isRecoding = !isRecoding;
notifyListeners();
}
}
void _startTimer() {
_timer?.cancel();
_timer = Timer.periodic(const Duration(seconds: 1), (Timer t) {
_recodeDuration++;
buildTimer();
notifyListeners();
});
}
Future<void> pauseRecoding() async {
isPause = true;
isPlaying = true;
recorderController.pause();
path = await recorderController.stop(false);
print(path);
File file = File(path!);
file.readAsBytesSync();
await playerController.preparePlayer(file.path, 1.0);
var tempDuration = _recodeDuration;
_recodeDuration = tempDuration;
_timer?.cancel();
notifyListeners();
}
void resumeRecoding() {
isPause = false;
isPlaying = false;
isRecoding = true;
recorderController.record(path);
_startTimer();
}
Future<void> deleteRecoding() async {
print(path);
_recodeDuration = 0;
_timer?.cancel();
// path = await recorderController.stop(false);
recorderController.reset();
print(path);
if (path != null && path!.isNotEmpty) {
File delFile = File(path!);
double fileSizeInKB = delFile.lengthSync() / 1024;
double fileSizeInMB = fileSizeInKB / 1024;
debugPrint("Deleted file size: ${delFile.lengthSync()}");
debugPrint("Deleted file size in KB: " + fileSizeInKB.toString());
debugPrint("Deleted file size in MB: " + fileSizeInMB.toString());
if (await delFile.exists()) {
delFile.delete();
}
isPause = false;
isRecoding = false;
isPlaying = false;
notifyListeners();
}
}
String buildTimer() {
String minutes = _formatNum(_recodeDuration ~/ 60);
String seconds = _formatNum(_recodeDuration % 60);
return '$minutes : $seconds';
}
String _formatNum(int number) {
String numberStr = number.toString();
if (number < 10) {
numberStr = '0' + numberStr;
}
return numberStr;
}
void playRecoding() async {
isPlaying = true;
await playerController.startPlayer(finishMode: FinishMode.stop);
}
void playOrPause() async {
playerController.playerState == PlayerState.playing ? await playerController.pausePlayer() : playRecoding();
notifyListeners();
}
}

@ -7,7 +7,6 @@ import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/main.dart';
import 'package:mohem_flutter_app/models/chat/chat_count_conversation_model.dart';
import 'package:mohem_flutter_app/models/dashboard/drawer_menu_item_model.dart';
import 'package:mohem_flutter_app/models/dashboard/get_accrual_balances_list_model.dart';
import 'package:mohem_flutter_app/models/dashboard/get_attendance_tracking_list_model.dart';
@ -20,6 +19,7 @@ import 'package:mohem_flutter_app/models/dashboard/mohemm_itg_pending_task_respo
import 'package:mohem_flutter_app/models/generic_response_model.dart';
import 'package:mohem_flutter_app/models/itg/itg_response_model.dart';
import 'package:mohem_flutter_app/models/offers_and_discounts/get_offers_list.dart';
import 'package:mohem_flutter_app/ui/landing/dashboard_screen.dart';
import 'package:mohem_flutter_app/widgets/dialogs/confirm_dialog.dart';
/// Mix-in [DiagnosticableTreeMixin] to have access to [debugFillProperties] for the devtool
@ -35,9 +35,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
bool isWorkListLoading = true;
int workListCounter = 0;
//Chat
bool isChatCounterLoding = true;
int chatUConvCounter = 0;
//Misssing Swipe
bool isMissingSwipeLoading = true;
@ -96,8 +94,6 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
accrualList = null;
leaveBalanceAccrual = null;
isChatCounterLoding = true;
chatUConvCounter = 0;
ticketBalance = 0;
isServicesMenusLoading = true;
@ -273,21 +269,6 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
MohemmItgResponseItem? res = await DashboardApiClient().getITGPageNotification();
return res;
}
void fetchChatCounts() async {
try {
ChatUnreadCovnCountModel response = await DashboardApiClient().getChatCount();
chatUConvCounter = response.singleChatCount!;
isChatCounterLoding = false;
notifyListeners();
} catch (ex) {
logger.wtf(ex);
notifyListeners();
Utils.handleException(ex, null, null);
}
}
void notify() {
notifyListeners();
}

@ -0,0 +1,56 @@
import 'dart:io';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:url_launcher/url_launcher.dart';
class AppUpdateScreen extends StatefulWidget {
const AppUpdateScreen({Key? key}) : super(key: key);
@override
State<AppUpdateScreen> createState() => _UnsafeDeviceScreenState();
}
class _UnsafeDeviceScreenState extends State<AppUpdateScreen> {
String? dynamicParams;
@override
Widget build(BuildContext context) {
dynamicParams ??= ModalRoute.of(context)!.settings.arguments as String;
return Scaffold(
body: SafeArea(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
21.height,
Center(child: Image.asset("assets/images/logos/main_mohemm_logo.png", width: 200, height: 50)),
50.height,
"Please Update Your App".toText24(isBold: true),
48.height,
dynamicParams.toString().toText14(isCenter: true).paddingOnly(left: 20.0, right: 20.0),
21.height,
DefaultButton(LocaleKeys.ok.tr(), () async {
if (Platform.isAndroid || Platform.isIOS) {
var appId = Platform.isAndroid ? 'hmg.cloudSolutions.mohem' : '1468856602';
var url = Uri.parse(
Platform.isAndroid ? "market://details?id=$appId" : "https://apps.apple.com/app/id$appId",
);
launchUrl(
url,
mode: LaunchMode.externalApplication,
);
}
}).paddingAll(24)
],
),
),
);
}
}

@ -1,17 +1,24 @@
import 'dart:convert';
import 'dart:typed_data';
import 'package:audio_waveforms/audio_waveforms.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/api/api_client.dart';
import 'package:mohem_flutter_app/api/chat/chat_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/main.dart';
import 'package:mohem_flutter_app/models/chat/get_single_user_chat_list_model.dart';
import 'package:mohem_flutter_app/provider/chat_provider_model.dart';
import 'package:mohem_flutter_app/ui/chat/chat_full_image_preview.dart';
import 'package:mohem_flutter_app/widgets/bottom_sheet.dart';
import 'package:open_file/open_file.dart';
import 'package:provider/provider.dart';
// todo: @aamir use extension methods, and use correct widgets.
@ -19,11 +26,12 @@ class ChatBubble extends StatelessWidget {
ChatBubble({Key? key, required this.dateTime, required this.cItem}) : super(key: key);
final String dateTime;
final SingleUserChatModel cItem;
bool isCurrentUser = false;
bool isSeen = false;
bool isReplied = false;
int? fileTypeID;
String? fileTypeName;
late ChatProviderModel data;
String? fileTypeDescription;
bool isDelivered = false;
@ -35,6 +43,7 @@ class ChatBubble extends StatelessWidget {
isSeen = cItem.isSeen == true ? true : false;
isReplied = cItem.userChatReplyResponse != null ? true : false;
fileTypeID = cItem.fileTypeId;
fileTypeName = cItem.fileTypeResponse != null ? cItem.fileTypeResponse!.fileTypeName : "";
fileTypeDescription = cItem.fileTypeResponse != null ? cItem.fileTypeResponse!.fileTypeDescription : "";
isDelivered = cItem.currentUserId == AppState().chatDetails!.response!.id && cItem.isDelivered == true ? true : false;
userName = AppState().chatDetails!.response!.userName == cItem.currentUserName.toString() ? "You" : cItem.currentUserName.toString();
@ -45,10 +54,11 @@ class ChatBubble extends StatelessWidget {
Size windowSize = MediaQuery.of(context).size;
screenOffset = Offset(windowSize.width / 2, windowSize.height / 2);
makeAssign();
data = Provider.of<ChatProviderModel>(context, listen: false);
return isCurrentUser ? currentUser(context) : receiptUser(context);
}
Widget currentUser(context) {
Widget currentUser(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -77,22 +87,6 @@ class ChatBubble extends StatelessWidget {
if (cItem.userChatReplyResponse != null && cItem.userChatReplyResponse!.fileTypeId == 12 ||
cItem.userChatReplyResponse!.fileTypeId == 3 ||
cItem.userChatReplyResponse!.fileTypeId == 4)
// Container(
// padding: EdgeInsets.all(0), // Border width
// decoration: BoxDecoration(color: Colors.red, borderRadius: const BorderRadius.all(Radius.circular(8))),
// child: ClipRRect(
// borderRadius: const BorderRadius.all(
// Radius.circular(8),
// ),
// child: SizedBox.fromSize(
// size: Size.fromRadius(8), // Image radius
// child: showImage(
// isReplyPreview: true,
// fileName: cItem.userChatReplyResponse!.contant!,
// fileTypeDescription: cItem.userChatReplyResponse!.fileTypeResponse!.fileTypeDescription ?? "image/jpg"),
// ),
// ),
// ),
ClipRRect(
borderRadius: BorderRadius.circular(8.0),
child: SizedBox(
@ -108,16 +102,35 @@ class ChatBubble extends StatelessWidget {
],
),
),
).paddingOnly(right: 5, bottom: 7),
).paddingOnly(bottom: 7),
if (fileTypeID == 12 || fileTypeID == 4 || fileTypeID == 3)
showImage(isReplyPreview: false, fileName: cItem.contant!, fileTypeDescription: cItem.fileTypeResponse!.fileTypeDescription).paddingOnly(right: 5).onPress(() {
showDialog(
context: context,
anchorPoint: screenOffset,
builder: (BuildContext context) => ChatImagePreviewScreen(imgTitle: cItem.contant!, img: cItem.image!),
);
}),
cItem.contant!.toText12(),
ClipRRect(
borderRadius: BorderRadius.circular(5.0),
child: SizedBox(
height: 140,
width: 227,
child: showImage(isReplyPreview: false, fileName: cItem.contant!, fileTypeDescription: cItem.fileTypeResponse!.fileTypeDescription).onPress(() {
showDialog(
context: context,
anchorPoint: screenOffset,
builder: (BuildContext context) => ChatImagePreviewScreen(imgTitle: cItem.contant!, img: cItem.image!),
);
}),
),
).paddingOnly(bottom: 4)
else
Row(
children: [
if (fileTypeID == 1 || fileTypeID == 5 || fileTypeID == 7 || fileTypeID == 6 || fileTypeID == 8
// || fileTypeID == 2
)
SvgPicture.asset(data.getType(fileTypeName ?? ""), height: 30, width: 22, alignment: Alignment.center, fit: BoxFit.cover).paddingOnly(left: 0, right: 10),
(cItem.contant ?? "").toText12().expanded,
if (fileTypeID == 1 || fileTypeID == 5 || fileTypeID == 7 || fileTypeID == 6 || fileTypeID == 8
//|| fileTypeID == 2
) const Icon(Icons.remove_red_eye, size: 16)
],
),
Align(
alignment: Alignment.centerRight,
child: Row(
@ -132,12 +145,12 @@ class ChatBubble extends StatelessWidget {
),
),
],
).paddingOnly(top: 11, left: 13, right: 7, bottom: 5).objectContainerView(disablePadding: true).paddingOnly(left: MediaQuery.of(context).size.width * 0.3);
).paddingOnly(top: 11, left: 13, right: 13, bottom: 5).objectContainerView(disablePadding: true).paddingOnly(left: MediaQuery.of(context).size.width * 0.3);
}
Widget receiptUser(BuildContext context) {
return Container(
padding: const EdgeInsets.only(top: 11, left: 13, right: 7, bottom: 5),
padding: const EdgeInsets.only(top: 11, left: 13, right: 13, bottom: 5),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
gradient: const LinearGradient(
@ -190,20 +203,41 @@ class ChatBubble extends StatelessWidget {
],
),
),
).paddingOnly(right: 5, bottom: 7),
).paddingOnly(bottom: 7),
if (fileTypeID == 12 || fileTypeID == 4 || fileTypeID == 3)
showImage(isReplyPreview: false, fileName: cItem.contant ?? "", fileTypeDescription: cItem.fileTypeResponse!.fileTypeDescription ?? "image/jpg").paddingOnly(right: 5).onPress(() {
showDialog(
context: context,
anchorPoint: screenOffset,
builder: (BuildContext context) => ChatImagePreviewScreen(imgTitle: cItem.contant ?? "", img: cItem.image!),
);
})
ClipRRect(
borderRadius: BorderRadius.circular(5.0),
child: SizedBox(
height: 140,
width: 227,
child: showImage(isReplyPreview: false, fileName: cItem.contant ?? "", fileTypeDescription: cItem.fileTypeResponse!.fileTypeDescription ?? "image/jpg").onPress(() {
showDialog(
context: context,
anchorPoint: screenOffset,
builder: (BuildContext context) => ChatImagePreviewScreen(imgTitle: cItem.contant ?? "", img: cItem.image!),
);
}),
),
).paddingOnly(bottom: 4)
else
(cItem.contant ?? "").toText12(color: Colors.white),
Row(
children: [
if (fileTypeID == 1 || fileTypeID == 5 || fileTypeID == 7 || fileTypeID == 6 || fileTypeID == 8
// || fileTypeID == 2
)
SvgPicture.asset(data.getType(fileTypeName ?? ""), height: 30, width: 22, alignment: Alignment.center, fit: BoxFit.cover).paddingOnly(left: 0, right: 10),
(cItem.contant ?? "").toText12(color: Colors.white).expanded,
if (fileTypeID == 1 || fileTypeID == 5 || fileTypeID == 7 || fileTypeID == 6 || fileTypeID == 8
//|| fileTypeID == 2
)
const Icon(Icons.remove_red_eye, color: Colors.white, size: 16)
],
),
Align(
alignment: Alignment.centerRight,
child: dateTime.toText10(color: Colors.white.withOpacity(.71)),
child: dateTime.toText10(
color: Colors.white.withOpacity(.71),
),
),
],
),
@ -211,12 +245,15 @@ class ChatBubble extends StatelessWidget {
}
Widget showImage({required bool isReplyPreview, required String fileName, required String fileTypeDescription}) {
if (isReplyPreview) {}
if (cItem.isImageLoaded! && cItem.image != null) {
return Image.memory(
cItem.image!,
height: isReplyPreview ? 32 : 140,
width: isReplyPreview ? 32 : 227,
fit: BoxFit.cover,
alignment: Alignment.center,
);
} else {
return FutureBuilder<Uint8List>(
@ -224,7 +261,7 @@ class ChatBubble extends StatelessWidget {
builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.connectionState != ConnectionState.waiting) {
if (snapshot.data == null) {
return SizedBox();
return const SizedBox();
} else {
cItem.image = snapshot.data;
cItem.isImageLoaded = true;
@ -233,6 +270,7 @@ class ChatBubble extends StatelessWidget {
height: isReplyPreview ? 32 : 140,
width: isReplyPreview ? 32 : 227,
fit: BoxFit.cover,
alignment: Alignment.center,
);
}
} else {
@ -246,3 +284,63 @@ class ChatBubble extends StatelessWidget {
}
}
}
class WaveBubble extends StatelessWidget {
final PlayerController playerController;
final VoidCallback onTap;
final bool isPlaying;
const WaveBubble({
Key? key,
required this.playerController,
required this.onTap,
required this.isPlaying,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
gradient: const LinearGradient(
transform: GradientRotation(.83),
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: <Color>[
MyColors.gradiantEndColor,
MyColors.gradiantStartColor,
],
),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
IconButton(
onPressed: onTap,
icon: Icon(isPlaying ? Icons.stop : Icons.play_arrow),
color: Colors.white,
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
),
AudioFileWaveforms(
size: Size(MediaQuery.of(context).size.width / 2, 10),
playerController: playerController,
padding: EdgeInsets.zero,
margin: EdgeInsets.zero,
playerWaveStyle: const PlayerWaveStyle(
fixedWaveColor: Colors.white,
liveWaveColor:MyColors.lightGreenColor,
showTop: true,
showBottom: true,
waveCap: StrokeCap.round,
seekLineThickness: 3,
visualizerHeight: 6,
backgroundColor: Colors.transparent
),
),
],
),
);
}
}

@ -1,6 +1,7 @@
import 'dart:async';
import 'dart:convert';
import 'package:audio_waveforms/audio_waveforms.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
@ -12,20 +13,28 @@ import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/main.dart';
import 'package:mohem_flutter_app/models/chat/call.dart';
import 'package:mohem_flutter_app/models/chat/get_search_user_chat_model.dart';
import 'package:mohem_flutter_app/models/chat/get_single_user_chat_list_model.dart';
import 'package:mohem_flutter_app/provider/chat_provider_model.dart';
import 'package:mohem_flutter_app/ui/chat/call/chat_outgoing_call_screen.dart';
import 'package:mohem_flutter_app/ui/chat/chat_bubble.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
import 'package:mohem_flutter_app/widgets/chat_app_bar_widge.dart';
import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart';
import 'package:provider/provider.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:signalr_netcore/signalr_client.dart';
import 'package:swipe_to/swipe_to.dart';
class ChatDetailedScreenParams {
ChatUser? chatUser;
bool? isNewChat;
ChatDetailedScreenParams(this.chatUser, this.isNewChat);
}
class ChatDetailScreen extends StatefulWidget {
// ignore: prefer_const_constructors_in_immutables
ChatDetailScreen({Key? key}) : super(key: key);
const ChatDetailScreen({Key? key}) : super(key: key);
@override
State<ChatDetailScreen> createState() => _ChatDetailScreenState();
@ -33,16 +42,16 @@ class ChatDetailScreen extends StatefulWidget {
class _ChatDetailScreenState extends State<ChatDetailScreen> {
final RefreshController _rc = RefreshController(initialRefresh: false);
dynamic userDetails;
late ChatProviderModel data;
ChatDetailedScreenParams? params;
void getMoreChat() async {
if (userDetails != null) {
if (params != null) {
data.paginationVal = data.paginationVal + 10;
if (userDetails != null) {
if (params != null) {
data.getSingleUserChatHistory(
senderUID: AppState().chatDetails!.response!.id!.toInt(),
receiverUID: userDetails["targetUser"].id,
receiverUID: params!.chatUser!.id!,
loadMore: true,
isNewChat: false,
);
@ -54,176 +63,275 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
_rc.loadComplete();
}
@override
void dispose() {
data.disposeAudio();
super.dispose();
}
@override
Widget build(BuildContext context) {
userDetails = ModalRoute.of(context)!.settings.arguments;
params = ModalRoute.of(context)!.settings.arguments as ChatDetailedScreenParams;
data = Provider.of<ChatProviderModel>(context, listen: false);
if (userDetails != null) {
if (params != null) {
data.getSingleUserChatHistory(
senderUID: AppState().chatDetails!.response!.id!.toInt(),
receiverUID: userDetails["targetUser"].id,
receiverUID: params!.chatUser!.id!,
loadMore: false,
isNewChat: userDetails["isNewChat"],
isNewChat: params!.isNewChat!,
);
data.initAudio();
}
return Scaffold(
backgroundColor: MyColors.backgroundColor,
appBar: AppBarWidget(
appBar: ChatAppBarWidget(
context,
title: userDetails["targetUser"].userName.toString().replaceAll(".", " ").capitalizeFirstofEach,
title: params!.chatUser!.userName.toString().replaceAll(".", " ").capitalizeFirstofEach,
showHomeButton: false,
image: userDetails["targetUser"].image == null || userDetails["targetUser"].image.isEmpty ? null : userDetails["targetUser"].image,
image: params!.chatUser!.image == null || params!.chatUser!.image.isEmpty ? null : params!.chatUser!.image,
showTyping: true,
chatUser: params!.chatUser,
actions: [
SvgPicture.asset("assets/icons/chat/call.svg", width: 21, height: 23).onPress(() {
// makeCall(callType: "AUDIO", con: hubConnection);
}),
24.width,
SvgPicture.asset("assets/icons/chat/video_call.svg", width: 21, height: 18).onPress(() {
// makeCall(callType: "VIDEO", con: hubConnection);
}),
21.width,
// SvgPicture.asset("assets/icons/chat/call.svg", width: 21, height: 23).onPress(() {
// // makeCall(callType: "AUDIO", con: hubConnection);
// }),
// 24.width,
// SvgPicture.asset("assets/icons/chat/video_call.svg", width: 21, height: 18).onPress(() {
// // makeCall(callType: "VIDEO", con: hubConnection);
// }),
// 21.width,
],
),
body: Consumer<ChatProviderModel>(
builder: (BuildContext context, ChatProviderModel m, Widget? child) {
return (m.isLoading
? ChatHomeShimmer(
isDetailedScreen: true,
)
: Column(
children: <Widget>[
SmartRefresher(
enablePullDown: false,
enablePullUp: true,
onLoading: () {
getMoreChat();
},
header: const MaterialClassicHeader(
color: MyColors.gradiantEndColor,
),
controller: _rc,
reverse: true,
child: ListView.separated(
controller: m.scrollController,
shrinkWrap: true,
physics: const BouncingScrollPhysics(),
reverse: true,
itemCount: m.userChatHistory.length,
padding: const EdgeInsets.all(21),
separatorBuilder: (cxt, index) => 8.height,
itemBuilder: (BuildContext context, int i) {
return SwipeTo(
iconColor: MyColors.lightGreenColor,
child: ChatBubble(
dateTime: m.dateFormte(m.userChatHistory[i].createdDate!),
cItem: m.userChatHistory[i],
),
onRightSwipe: () {
m.chatReply(
m.userChatHistory[i],
);
},
).onPress(() {
logger.d(jsonEncode(m.userChatHistory[i]));
});
body: SafeArea(
child: Consumer<ChatProviderModel>(
builder: (BuildContext context, ChatProviderModel m, Widget? child) {
return (m.isLoading
? ChatHomeShimmer(
isDetailedScreen: true,
)
: Column(
children: <Widget>[
SmartRefresher(
enablePullDown: false,
enablePullUp: true,
onLoading: () {
getMoreChat();
},
),
).expanded,
if (m.isMsgReply)
SizedBox(
height: 82,
child: Row(
children: <Widget>[
Container(height: 82, color: MyColors.textMixColor, width: 6),
Container(
color: MyColors.darkTextColor.withOpacity(0.10),
padding: const EdgeInsets.only(top: 11, left: 14, bottom: 14, right: 21),
child: Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
(AppState().chatDetails!.response!.userName == m.repliedMsg.first.currentUserName.toString()
? "You"
: m.repliedMsg.first.currentUserName.toString().replaceAll(".", " "))
.toText14(color: MyColors.lightGreenColor),
(m.repliedMsg.isNotEmpty ? m.repliedMsg.first.contant! : "").toText12(color: MyColors.grey71Color, maxLine: 2)
],
).expanded,
12.width,
if (m.isMsgReply && m.repliedMsg.isNotEmpty) showReplyImage(m.repliedMsg),
12.width,
const Icon(Icons.cancel, size: 23, color: MyColors.grey7BColor).onPress(m.closeMe),
],
),
).expanded,
],
header: const MaterialClassicHeader(
color: MyColors.gradiantEndColor,
),
),
if (m.isFileSelected && m.sFileType == ".png" || m.sFileType == ".jpeg" || m.sFileType == ".jpg")
SizedBox(height: 200, width: double.infinity, child: Image.file(m.selectedFile, fit: BoxFit.cover)).paddingOnly(left: 21, right: 21, top: 21),
const Divider(
height: 1,
color: MyColors.lightGreyEFColor,
),
TextField(
controller: m.message,
decoration: InputDecoration(
hintText: m.isFileSelected ? m.selectedFile.path.split("/").last : LocaleKeys.typeheretoreply.tr(),
hintStyle: TextStyle(color: m.isFileSelected ? MyColors.darkTextColor : MyColors.grey98Color, fontSize: 14),
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
errorBorder: InputBorder.none,
disabledBorder: InputBorder.none,
filled: true,
fillColor: MyColors.white,
contentPadding: const EdgeInsets.only(
left: 21,
top: 20,
bottom: 20,
controller: _rc,
reverse: true,
child: ListView.separated(
controller: m.scrollController,
shrinkWrap: true,
physics: const BouncingScrollPhysics(),
reverse: true,
itemCount: m.userChatHistory.length,
padding: const EdgeInsets.all(21),
separatorBuilder: (cxt, index) => 8.height,
itemBuilder: (BuildContext context, int i) {
return SwipeTo(
iconColor: MyColors.lightGreenColor,
child: ChatBubble(
dateTime: m.dateFormte(m.userChatHistory[i].createdDate!),
cItem: m.userChatHistory[i],
),
onRightSwipe: () {
m.chatReply(
m.userChatHistory[i],
);
},
).onPress(() async {
if (m.userChatHistory[i].fileTypeResponse != null) {
m.getChatMedia(context,
fileTypeName: m.userChatHistory[i].fileTypeResponse!.fileTypeName ?? "", fileTypeID: m.userChatHistory[i].fileTypeId!, fileName: m.userChatHistory[i].contant!);
}
});
},
),
prefixIconConstraints: const BoxConstraints(),
prefixIcon: m.sFileType.isNotEmpty
? SvgPicture.asset(m.getType(m.sFileType), height: 30, width: 22, alignment: Alignment.center, fit: BoxFit.cover).paddingOnly(left: 21, right: 15)
: null,
suffixIcon: SizedBox(
width: 100,
).expanded,
if (m.isMsgReply)
SizedBox(
height: 82,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center, // added line
children: <Widget>[
if (m.sFileType.isNotEmpty)
Row(
children: <Widget>[
const Icon(Icons.cancel, size: 15, color: MyColors.redA3Color).paddingOnly(right: 5),
("Clear").toText11(color: MyColors.redA3Color, isUnderLine: true).paddingOnly(left: 0),
Container(height: 82, color: MyColors.textMixColor, width: 6),
Container(
color: MyColors.darkTextColor.withOpacity(0.10),
padding: const EdgeInsets.only(top: 11, left: 14, bottom: 14, right: 21),
child: Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
(AppState().chatDetails!.response!.userName == m.repliedMsg.first.currentUserName.toString()
? "You"
: m.repliedMsg.first.currentUserName.toString().replaceAll(".", " "))
.toText14(color: MyColors.lightGreenColor),
(m.repliedMsg.isNotEmpty ? m.repliedMsg.first.contant! : "").toText12(color: MyColors.grey71Color, maxLine: 2)
],
).expanded,
12.width,
if (m.isMsgReply && m.repliedMsg.isNotEmpty) showReplyImage(m.repliedMsg, m),
12.width,
const Icon(Icons.cancel, size: 23, color: MyColors.grey7BColor).onPress(m.closeMe),
],
).onPress(() => m.removeAttachment()).paddingOnly(right: 25),
if (m.sFileType.isEmpty)
RotationTransition(
turns: const AlwaysStoppedAnimation(45 / 360),
child: const Icon(Icons.attach_file_rounded, size: 26, color: MyColors.grey3AColor).onPress(
() => m.selectImageToUpload(context),
),
).paddingOnly(right: 25),
SvgPicture.asset("assets/icons/chat/chat_send_icon.svg", height: 26, width: 26).onPress(
() => m.sendChatMessage(userDetails["targetUser"].id, userDetails["targetUser"].userName, context),
),
),
).expanded,
],
),
).paddingOnly(right: 21),
),
if (m.isFileSelected && m.sFileType == ".png" || m.sFileType == ".jpeg" || m.sFileType == ".jpg")
SizedBox(height: 200, width: double.infinity, child: Image.file(m.selectedFile, fit: BoxFit.cover)).paddingOnly(left: 21, right: 21, top: 21),
const Divider(
height: 1,
color: MyColors.lightGreyEFColor,
),
),
],
));
},
if (m.isRecoding)
Column(
children: <Widget>[
Row(
children: [
Text(m.buildTimer()).paddingAll(10),
if (m.isRecoding && m.isPlaying)
WaveBubble(
playerController: m.playerController,
onTap: () {
m.playOrPause();
},
isPlaying: m.playerController.playerState == PlayerState.playing)
.expanded
else
AudioWaveforms(
waveStyle: const WaveStyle(
waveColor: MyColors.lightGreenColor,
middleLineColor: Colors.transparent,
extendWaveform: true,
showBottom: true,
showTop: true,
waveThickness: 2,
showMiddleLine: false,
middleLineThickness: 0,
),
padding: const EdgeInsets.all(5),
shouldCalculateScrolledPosition: false,
margin: EdgeInsets.zero,
size: const Size(double.infinity, 30.0),
recorderController: m.recorderController,
backgroundColor: Colors.white,
).expanded,
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Icon(
Icons.delete_outlined,
size: 26,
color: MyColors.lightGreenColor,
).paddingAll(10).onPress(() {
m.deleteRecoding();
}),
if (m.isPause)
const Icon(
Icons.mic,
size: 26,
color: MyColors.lightGreenColor,
).paddingOnly(right: 15).onPress(() {
m.resumeRecoding();
}),
if (!m.isPause)
const Icon(
Icons.pause_circle_outline,
size: 26,
color: MyColors.lightGreenColor,
).paddingOnly(right: 15).onPress(() {
m.pauseRecoding();
}),
SvgPicture.asset("assets/icons/chat/chat_send_icon.svg", height: 26, width: 26)
.onPress(
() => m.sendChatMessage(context,
targetUserId: params!.chatUser!.id!,
userStatus: params!.chatUser!.userStatus ?? 0,
userEmail: params!.chatUser!.email!,
targetUserName: params!.chatUser!.userName!),
)
.paddingOnly(right: 21),
],
),
],
).objectContainerView(disablePadding: true, radius: 0),
if (!m.isRecoding)
Row(
children: [
TextField(
controller: m.message,
decoration: InputDecoration(
hintText: m.isFileSelected ? m.selectedFile.path.split("/").last : LocaleKeys.typeheretoreply.tr(),
hintStyle: TextStyle(color: m.isFileSelected ? MyColors.darkTextColor : MyColors.grey98Color, fontSize: 14),
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
errorBorder: InputBorder.none,
disabledBorder: InputBorder.none,
filled: true,
fillColor: MyColors.white,
contentPadding: const EdgeInsets.only(
left: 21,
top: 20,
bottom: 20,
),
prefixIconConstraints: const BoxConstraints(),
prefixIcon: m.sFileType.isNotEmpty
? SvgPicture.asset(m.getType(m.sFileType), height: 30, width: 22, alignment: Alignment.center, fit: BoxFit.cover).paddingOnly(left: 21, right: 15)
: null,
),
onChanged: (val) {
m.userTypingInvoke(currentUser: AppState().chatDetails!.response!.id!, reciptUser: params!.chatUser!.id!);
},
).expanded,
if (m.sFileType.isNotEmpty)
Row(
children: <Widget>[
const Icon(Icons.cancel, size: 15, color: MyColors.redA3Color).paddingOnly(right: 5),
("Clear").toText11(color: MyColors.redA3Color, isUnderLine: true).paddingOnly(left: 0),
],
).onPress(() => m.removeAttachment()).paddingOnly(right: 15),
if (m.sFileType.isEmpty)
RotationTransition(
turns: const AlwaysStoppedAnimation(45 / 360),
child: const Icon(Icons.attach_file_rounded, size: 26, color: MyColors.grey3AColor).onPress(
() => m.selectImageToUpload(context),
),
).paddingOnly(right: 15),
Icon(
Icons.mic,
color: MyColors.lightGreenColor,
).paddingOnly(right: 15).onPress(() {
m.startRecoding();
}),
SvgPicture.asset("assets/icons/chat/chat_send_icon.svg", height: 26, width: 26)
.onPress(
() => m.sendChatMessage(context,
targetUserId: params!.chatUser!.id!,
userStatus: params!.chatUser!.userStatus ?? 0,
userEmail: params!.chatUser!.email!,
targetUserName: params!.chatUser!.userName!),
)
.paddingOnly(right: 21),
],
).objectContainerView(disablePadding: true, radius: 0),
],
));
},
),
),
);
}
Widget showReplyImage(List<SingleUserChatModel> data) {
Widget showReplyImage(List<SingleUserChatModel> data, ChatProviderModel m) {
if (data.first.isImageLoaded! && data.first.image != null) {
return Container(
width: 43,
@ -232,7 +340,14 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
border: Border.all(color: MyColors.darkGrey3BColor, width: 1), borderRadius: BorderRadius.circular(10.0), image: DecorationImage(image: MemoryImage(data.first.image!), fit: BoxFit.cover)),
);
} else {
return const SizedBox();
return data.first.fileTypeResponse != null && data.first.fileTypeResponse!.fileTypeName != null
? Container(
width: 43,
height: 43,
constraints: const BoxConstraints(),
decoration: BoxDecoration(border: Border.all(color: MyColors.darkGrey3BColor, width: 1), borderRadius: BorderRadius.circular(10.0), color: Colors.white),
child: SvgPicture.asset(m.getType(data.first.fileTypeResponse!.fileTypeName ?? ""), alignment: Alignment.center, fit: BoxFit.cover).paddingOnly(left: 5, right: 5, top: 5, bottom: 5))
: const SizedBox();
}
}
@ -240,7 +355,7 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
print("================== Make call Triggered ============================");
Map<String, dynamic> json = {
"callerID": AppState().chatDetails!.response!.id!.toString(),
"callReceiverID": userDetails["targetUser"].id.toString(),
"callReceiverID": params!.chatUser!.id.toString(),
"notification_foreground": "true",
"message": "Aamir is calling",
"title": "Video Call",
@ -259,7 +374,7 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
{
"isSeen": false,
"isDelivered": false,
"targetUserId": userDetails["targetUser"].id,
"targetUserId": params!.chatUser!.id!,
"targetUserStatus": 4,
}
],

@ -30,6 +30,15 @@ class _ChatHomeState extends State<ChatHome> {
super.initState();
data = Provider.of<ChatProviderModel>(context, listen: false);
data.registerEvents();
}
@override
void dispose() {
super.dispose();
data.clearAll();
}
void fetchAgain() {
if (chatHubConnection.state != HubConnectionState.Connected) {
data.getUserAutoLoginToken().whenComplete(() async {
await data.buildHubConnection();
@ -38,18 +47,14 @@ class _ChatHomeState extends State<ChatHome> {
return;
}
if (data.searchedChats == null || data.searchedChats!.isEmpty) {
data.isLoading = true;
data.getUserRecentChats();
}
}
@override
void dispose() {
super.dispose();
data.clearAll();
}
@override
Widget build(BuildContext context) {
fetchAgain();
return Scaffold(
backgroundColor: MyColors.white,
appBar: AppBarWidget(context, title: LocaleKeys.chat.tr(), showHomeButton: true),
@ -85,7 +90,6 @@ class _ChatHomeState extends State<ChatHome> {
onPageChanged: (int pageIndex) {
setState(() {
tabIndex = pageIndex;
});
},
children: <Widget>[

@ -1,22 +1,18 @@
import 'dart:convert';
import 'dart:typed_data';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_des/flutter_des.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/encryption.dart';
import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/provider/chat_provider_model.dart';
import 'package:mohem_flutter_app/ui/chat/chat_detailed_screen.dart';
import 'package:mohem_flutter_app/widgets/bottom_sheet.dart';
import 'package:mohem_flutter_app/widgets/bottom_sheets/search_employee_bottom_sheet.dart';
import 'package:mohem_flutter_app/widgets/circular_avatar.dart';
import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart';
import 'package:provider/provider.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
@ -53,7 +49,9 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
body: Consumer<ChatProviderModel>(
builder: (BuildContext context, ChatProviderModel m, Widget? child) {
return m.isLoading
? ChatHomeShimmer(isDetailedScreen: false,)
? ChatHomeShimmer(
isDetailedScreen: false,
)
: Column(
children: <Widget>[
TextField(
@ -102,20 +100,24 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
height: 48,
width: 48,
).toShimmer().circle(30),
if (m.searchedChats![index].isImageLoaded! && m.searchedChats![index].image.isNotEmpty)
CircularAvatar(
radius: 20,
height: 48,
width: 48,
url: m.searchedChats![index].image,
isImageBase64: true,
),
if (!m.searchedChats![index].isImageLoading! && m.searchedChats![index].isImageLoaded! && m.searchedChats![index].image.isEmpty)
if (!m.searchedChats![index].isImageLoading! && m.searchedChats![index].userLocalDownlaodedImage == null)
SvgPicture.asset(
"assets/images/user.svg",
height: 48,
width: 48,
),
if (!m.searchedChats![index].isImageLoading! && m.searchedChats![index].userLocalDownlaodedImage != null)
Container(
width: 48.0,
height: 48.0,
decoration: BoxDecoration(
shape: BoxShape.circle,
image: DecorationImage(
fit: BoxFit.cover,
image: FileImage(m.searchedChats![index].userLocalDownlaodedImage!),
),
),
),
Positioned(
right: 5,
bottom: 1,
@ -128,14 +130,20 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
).circle(10),
)
],
).onPress(() {
print(jsonEncode(m.searchedChats![index]));
}),
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
(m.searchedChats![index].userName!.replaceFirst(".", " ").capitalizeFirstofEach ?? "").toText14(color: MyColors.darkTextColor).paddingOnly(left: 11, top: 13),
m.searchedChats![index].isTyping!
? 'Typing...'
.toText10(
color: MyColors.textMixColor,
)
.paddingOnly(left: 11.0)
: const SizedBox()
//(m.searchedChats![index].isTyping! ? "Typing ..." : "").toText10(color: MyColors.textMixColor).paddingOnly(left: 11, top: 0),
],
).expanded,
SizedBox(
@ -194,7 +202,7 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
Navigator.pushNamed(
context,
AppRoutes.chatDetailed,
arguments: {"targetUser": m.searchedChats![index], "isNewChat": false},
arguments: ChatDetailedScreenParams(m.searchedChats![index], false),
).then((Object? value) {
m.clearSelections();
m.notifyListeners();

@ -9,6 +9,7 @@ import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/ui/chat/chat_detailed_screen.dart';
import 'package:mohem_flutter_app/widgets/circular_avatar.dart';
import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart';
import 'package:provider/provider.dart';
@ -45,20 +46,24 @@ class ChatFavoriteUsersScreen extends StatelessWidget {
height: 48,
width: 48,
).toShimmer().circle(30),
if (m.favUsersList![index].isImageLoaded! && m.favUsersList![index].image != null && m.favUsersList![index].image.isNotEmpty)
CircularAvatar(
radius: 20,
height: 48,
width: 48,
url: m.favUsersList![index].image,
isImageBase64: true,
),
if (!m.favUsersList![index].isImageLoading! && m.favUsersList![index].isImageLoaded! && m.favUsersList![index].image.isEmpty)
if (!m.favUsersList![index].isImageLoading! && m.favUsersList![index].userLocalDownlaodedImage == null)
SvgPicture.asset(
"assets/images/user.svg",
height: 48,
width: 48,
),
if (!m.favUsersList![index].isImageLoading! && m.favUsersList![index].userLocalDownlaodedImage != null)
Container(
width: 48.0,
height: 48.0,
decoration: BoxDecoration(
shape: BoxShape.circle,
image: DecorationImage(
fit: BoxFit.cover,
image: FileImage(m.favUsersList![index].userLocalDownlaodedImage!),
),
),
),
Positioned(
right: 5,
bottom: 1,
@ -106,7 +111,7 @@ class ChatFavoriteUsersScreen extends StatelessWidget {
Navigator.pushNamed(
context,
AppRoutes.chatDetailed,
arguments: {"targetUser": m.favUsersList![index], "isNewChat": false},
arguments: ChatDetailedScreenParams(m.favUsersList![index], true),
).then(
(Object? value) {
m.clearSelections();

@ -58,7 +58,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
data = Provider.of<DashboardProviderModel>(context, listen: false);
marathonProvider = Provider.of<MarathonProvider>(context, listen: false);
cProvider = Provider.of<ChatProviderModel>(context, listen: false);
_bHubCon();
_onRefresh();
});
}
@ -72,11 +72,15 @@ class _DashboardScreenState extends State<DashboardScreen> {
void _bHubCon() {
cProvider.getUserAutoLoginToken().whenComplete(() {
cProvider.buildHubConnection();
Future.delayed(const Duration(seconds: 2), () {
cProvider.invokeChatCounter(userId: AppState().chatDetails!.response!.id!);
});
});
}
void _onRefresh() async {
data.initProvider();
_bHubCon();
// data.getITGNotification().then((value) {
// print("--------------------detail_1-----------------");
// print(value!.result!.data!.notificationMasterId);
@ -90,7 +94,6 @@ class _DashboardScreenState extends State<DashboardScreen> {
data.fetchMenuEntries();
data.getCategoryOffersListAPI(context);
marathonProvider.getMarathonDetailsFromApi();
data.fetchChatCounts();
_refreshController.refreshCompleted();
}
@ -197,7 +200,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.goodMorning.tr().toText14(color: MyColors.grey77Color),
LocaleKeys.welcomeBack.tr().toText14(color: MyColors.grey77Color),
(AppState().memberInformationList!.eMPLOYEENAME ?? "").toText24(isBold: true),
16.height,
Row(
@ -503,8 +506,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
"assets/icons/chat/chat.svg",
color: currentIndex == 4 ? MyColors.grey3AColor : MyColors.grey98Color,
).paddingAll(4),
Consumer<DashboardProviderModel>(
builder: (BuildContext cxt, DashboardProviderModel data, Widget? child) {
Consumer<ChatProviderModel>(
builder: (BuildContext cxt, ChatProviderModel data, Widget? child) {
return Positioned(
right: 0,
top: 0,
@ -538,9 +541,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
} else if (index == 3) {
Navigator.pushNamed(context, AppRoutes.itemsForSale);
} else if (index == 4) {
Navigator.pushNamed(context, AppRoutes.chat).then((Object? value) {
data.fetchChatCounts();
});
Navigator.pushNamed(context, AppRoutes.chat);
}
},
),

@ -41,8 +41,6 @@ class _TodayAttendanceScreenState extends State<TodayAttendanceScreen> {
bool isAvailable = await NfcManager.instance.isAvailable();
setState(() {
AppState().privilegeListModel!.forEach((element) {
print(element.serviceName.toString() + " " + element.previlege.toString()); // Check availability
if (element.serviceName == "enableNFC") {
if (isAvailable) if (element.previlege ?? false) isNfcEnabled = true;
} else if (element.serviceName == "enableQR") {

@ -11,6 +11,7 @@ import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/dashboard/drawer_menu_item_model.dart';
import 'package:mohem_flutter_app/provider/chat_provider_model.dart';
import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
import 'package:mohem_flutter_app/ui/dialogs/id/business_card_dialog.dart';
import 'package:mohem_flutter_app/ui/dialogs/id/employee_digital_id_dialog.dart';
@ -28,6 +29,13 @@ class AppDrawer extends StatefulWidget {
class _AppDrawerState extends State<AppDrawer> {
List<DrawerMenuItem> drawerMenuItemList = [];
late ChatProviderModel chatData;
@override
void initState() {
super.initState();
chatData = Provider.of<ChatProviderModel>(context, listen: false);
}
@override
Widget build(BuildContext context) {
@ -171,6 +179,7 @@ class _AppDrawerState extends State<AppDrawer> {
AppState().isAuthenticated = false;
AppState().isLogged = false;
AppState().setPostParamsInitConfig();
chatData.disposeData();
// SharedPreferences prefs = await SharedPreferences.getInstance();
// await prefs.clear();
Navigator.pushNamedAndRemoveUntil(context, AppRoutes.login, (Route<dynamic> route) => false, arguments: null);

@ -4,7 +4,6 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/api/leave_balance_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/date_uitl.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/routes.dart';
@ -25,8 +24,7 @@ import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart';
class AddLeaveBalanceScreen extends StatefulWidget {
final String selectedEmp;
AddLeaveBalanceScreen({this.selectedEmp = '', Key? key}) : super(key: key);
AddLeaveBalanceScreen({Key? key}) : super(key: key);
@override
_AddLeaveBalanceScreenState createState() {
@ -44,15 +42,21 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
int? totalDays;
String comment = "";
ReplacementList? selectedReplacementEmployee;
dynamic dynamicParams;
String selectedEmp = "";
String? selectedEmp;
DateTime selectedDate = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day);
@override
void initState() {
super.initState();
//getAbsenceAttendanceTypes();
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
var dynamicParam = ModalRoute.of(context)!.settings.arguments;
if (dynamicParam != null) {
selectedEmp = dynamicParam.toString();
}
getAbsenceAttendanceTypes();
});
}
void getAbsenceAttendanceTypes() async {
@ -85,7 +89,6 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
Utils.showLoading(context);
CalculateAbsenceDuration duration = await LeaveBalanceApiClient()
.calculateAbsenceDuration(selectedAbsenceType!.aBSENCEATTENDANCETYPEID!, Utils.getMonthNamedFormat(startDateTime!), Utils.getMonthNamedFormat(endDateTime!), -999, empID: selectedEmp);
totalDays = duration.pABSENCEDAYS?.toInt();
Utils.hideLoading(context);
setState(() {});
@ -95,56 +98,57 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
}
}
void validateAbsenceTransaction(selectedID) async {
void validateAbsenceTransaction(String? selectedID) async {
try {
Utils.showLoading(context);
Map<String, String?> dffDataMap = {};
for (int i = 1; i <= 20; i++) {
dffDataMap["P_ATTRIBUTE$i"] = null;
for (int dffIndex = 0; dffIndex < getabsenceDffStructureList.length; dffIndex++) {
if ("ATTRIBUTE$i" == getabsenceDffStructureList[dffIndex].aPPLICATIONCOLUMNNAME) {
if (getabsenceDffStructureList[dffIndex].fORMATTYPE == "X") {
dffDataMap["P_ATTRIBUTE$i"] =
getabsenceDffStructureList[dffIndex].eSERVICESDV!.pIDCOLUMNNAME != null ? Utils.formatDate(getabsenceDffStructureList[dffIndex].eSERVICESDV!.pIDCOLUMNNAME!) : "";
} else {
dffDataMap["P_ATTRIBUTE$i"] = getabsenceDffStructureList[dffIndex].eSERVICESDV?.pIDCOLUMNNAME;
Utils.showLoading(context);
Map<String, String?> dffDataMap = {};
for (int i = 1; i <= 20; i++) {
dffDataMap["P_ATTRIBUTE$i"] = null;
for (int dffIndex = 0; dffIndex < getabsenceDffStructureList.length; dffIndex++) {
if ("ATTRIBUTE$i" == getabsenceDffStructureList[dffIndex].aPPLICATIONCOLUMNNAME) {
if (getabsenceDffStructureList[dffIndex].fORMATTYPE == "X") {
dffDataMap["P_ATTRIBUTE$i"] =
getabsenceDffStructureList[dffIndex].eSERVICESDV!.pIDCOLUMNNAME != null ? Utils.formatDate(getabsenceDffStructureList[dffIndex].eSERVICESDV!.pIDCOLUMNNAME!) : "";
} else {
dffDataMap["P_ATTRIBUTE$i"] = getabsenceDffStructureList[dffIndex].eSERVICESDV?.pIDCOLUMNNAME;
}
break;
}
break;
}
}
}
await LeaveBalanceApiClient().validateAbsenceTransaction(
selectedAbsenceType!.dESCFLEXCONTEXTCODE!,
"HR_LOA_SS",
selectedAbsenceType!.aBSENCEATTENDANCETYPEID!,
selectedReplacementEmployee != null ? selectedReplacementEmployee!.userName! : "",
DateUtil.getFormattedDate(startDateTime!, "MM/dd/yyyy"),
DateUtil.getFormattedDate(endDateTime!, "MM/dd/yyyy"),
-999,
dffDataMap,
comments: comment,
empID: selectedEmp);
await LeaveBalanceApiClient().validateAbsenceTransaction(
selectedAbsenceType!.dESCFLEXCONTEXTCODE!,
"HR_LOA_SS",
selectedAbsenceType!.aBSENCEATTENDANCETYPEID!,
selectedReplacementEmployee != null ? selectedReplacementEmployee!.userName! : "",
DateUtil.getFormattedDate(startDateTime!, "MM/dd/yyyy"),
DateUtil.getFormattedDate(endDateTime!, "MM/dd/yyyy"),
-999,
dffDataMap,
comments: comment,
empID: selectedID);
SumbitAbsenceTransactionList submit = await LeaveBalanceApiClient().submitAbsenceTransaction(
selectedAbsenceType!.dESCFLEXCONTEXTCODE!,
"HR_LOA_SS",
selectedAbsenceType!.aBSENCEATTENDANCETYPEID!,
selectedReplacementEmployee != null ? selectedReplacementEmployee!.userName! : "",
DateUtil.getFormattedDate(startDateTime!, "MM/dd/yyyy"),
DateUtil.getFormattedDate(endDateTime!, "MM/dd/yyyy"),
-999,
dffDataMap,
comments: comment,
empID: selectedEmp);
SumbitAbsenceTransactionList submit = await LeaveBalanceApiClient().submitAbsenceTransaction(
selectedAbsenceType!.dESCFLEXCONTEXTCODE!,
"HR_LOA_SS",
selectedAbsenceType!.aBSENCEATTENDANCETYPEID!,
selectedReplacementEmployee != null ? selectedReplacementEmployee!.userName! : "",
DateUtil.getFormattedDate(startDateTime!, "MM/dd/yyyy"),
DateUtil.getFormattedDate(endDateTime!, "MM/dd/yyyy"),
-999,
dffDataMap,
comments: comment,
empID: selectedID);
Utils.hideLoading(context);
Utils.hideLoading(context);
var res = await Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, arguments: RequestSubmitScreenParams(LocaleKeys.submit.tr(), submit.pTRANSACTIONID!, "", "add_leave_balance"));
if (res != null && res == true) {
Utils.showLoading(context);
}
await LeaveBalanceApiClient().cancelHrTransaction(submit.pTRANSACTIONID!);
Utils.hideLoading(context);
var res = await Navigator.pushNamed(context, AppRoutes.requestSubmitScreen,
arguments: RequestSubmitScreenParams(LocaleKeys.submit.tr(), submit.pTRANSACTIONID!, "", "add_leave_balance", selectedEmployeeID: selectedID));
if (res != null && res == true) {
Utils.showLoading(context);
}
await LeaveBalanceApiClient().cancelHrTransaction(submit.pTRANSACTIONID!);
Utils.hideLoading(context);
} catch (ex) {
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
@ -158,16 +162,6 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
@override
Widget build(BuildContext context) {
if (dynamicParams == null) {
dynamicParams = ModalRoute.of(context)!.settings.arguments;
if (dynamicParams!= null && dynamicParams.isNotEmpty) {
AppState().postParamsJson['P_SELECTED_EMPLOYEE_NUMBER'] = dynamicParams;
selectedEmp = dynamicParams;
getAbsenceAttendanceTypes();
} else {
getAbsenceAttendanceTypes();
}
}
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBarWidget(
@ -187,13 +181,13 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
isPopup: true,
),
itemBuilder: (_) => <PopupMenuItem<int>>[
for (int i = 0; i < absenceList.length; i++) PopupMenuItem<int>(value: i, child: Text(absenceList[i].aBSENCEATTENDANCETYPENAME!)),
for (int i = 0; i < (absenceList?.length ?? 0); i++) PopupMenuItem<int>(value: i, child: Text(absenceList![i].aBSENCEATTENDANCETYPENAME!)),
],
onSelected: (int popupIndex) {
if (selectedAbsenceType == absenceList[popupIndex]) {
if (selectedAbsenceType == absenceList![popupIndex]) {
return;
}
selectedAbsenceType = absenceList[popupIndex];
selectedAbsenceType = absenceList![popupIndex];
setState(() {});
getAbsenceDffStructure();
},

@ -1,7 +1,6 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/api/leave_balance_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/routes.dart';
@ -14,8 +13,7 @@ import 'package:mohem_flutter_app/widgets/balances_dashboard_widget.dart';
import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart';
class LeaveBalance extends StatefulWidget {
final String selectedEmp;
LeaveBalance({this.selectedEmp = '', Key? key}) : super(key: key);
LeaveBalance({Key? key}) : super(key: key);
@override
_LeaveBalanceState createState() {
@ -27,13 +25,18 @@ class _LeaveBalanceState extends State<LeaveBalance> {
List<GetAbsenceTransactionList>? absenceTransList;
DateTime accrualDateTime = DateTime.now();
dynamic dynamicParams;
String selectedEmp = "";
String? employeeId;
@override
void initState() {
super.initState();
absenceTransList = [];
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
var dynamicParam = ModalRoute.of(context)!.settings.arguments;
if (dynamicParam != null) {
employeeId = dynamicParam.toString();
}
getAbsenceTransactions();
});
}
@override
@ -43,9 +46,9 @@ class _LeaveBalanceState extends State<LeaveBalance> {
void getAbsenceTransactions() async {
try {
// Utils.showLoading(context);
absenceTransList = await LeaveBalanceApiClient().getAbsenceTransactions(-999, empID: selectedEmp);
//Utils.hideLoading(context);
Utils.showLoading(context);
absenceTransList = await LeaveBalanceApiClient().getAbsenceTransactions(-999, employeeId);
Utils.hideLoading(context);
setState(() {});
} catch (ex) {
Utils.hideLoading(context);
@ -55,63 +58,53 @@ class _LeaveBalanceState extends State<LeaveBalance> {
@override
Widget build(BuildContext context) {
if (dynamicParams == null) {
dynamicParams = ModalRoute.of(context)!.settings.arguments;
if (dynamicParams!= null && dynamicParams.isNotEmpty) {
AppState().postParamsJson['P_SELECTED_EMPLOYEE_NUMBER'] = dynamicParams;
selectedEmp = dynamicParams;
getAbsenceTransactions();
} else {
getAbsenceTransactions();
}
}
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBarWidget(
context,
title: LocaleKeys.leaveBalance.tr(),
),
body: ListView(
physics: const BouncingScrollPhysics(),
padding: const EdgeInsets.all(21),
children: [
BalancesDashboardWidget(LocaleKeys.currentLeaveBalance.tr(), true, selectedEmp),
12.height,
absenceTransList == null
? const SizedBox()
: (absenceTransList!.isEmpty
? Utils.getNoDataWidget(context).paddingOnly(top: 50)
: ListView.separated(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
padding: EdgeInsets.zero,
itemBuilder: (cxt, int index) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.startDateT.tr(), absenceTransList![index].sTARTDATE ?? ""),
ItemDetailViewCol(LocaleKeys.endDateT.tr(), absenceTransList![index].eNDDATE ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.absenceType.tr(), absenceTransList![index].aBSENCETYPE ?? ""),
ItemDetailViewCol(LocaleKeys.absenceCategory.tr(), absenceTransList![index].aBSENCECATEGORY ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.days.tr(), absenceTransList![index].aBSENCEDAYS?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.hours.tr(), absenceTransList![index].aBSENCEHOURS?.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.approvalStatus.tr(), absenceTransList![index].aPPROVALSTATUS ?? ""),
ItemDetailViewCol(LocaleKeys.absenceStatus.tr(), absenceTransList![index].aBSENCESTATUS ?? ""),
isItLast: true,
),
],
).objectContainerView(),
separatorBuilder: (cxt, index) => 12.height,
itemCount: absenceTransList!.length)),
],
),
body: absenceTransList == null
? const SizedBox()
: (absenceTransList!.isEmpty
? Utils.getNoDataWidget(context).paddingOnly(top: 50)
: ListView(
physics: const BouncingScrollPhysics(),
padding: const EdgeInsets.all(21),
children: [
BalancesDashboardWidget(LocaleKeys.currentLeaveBalance.tr(), true, selectedEmp: employeeId),
12.height,
ListView.separated(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
padding: EdgeInsets.zero,
itemBuilder: (cxt, int index) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.startDateT.tr(), absenceTransList![index].sTARTDATE ?? ""),
ItemDetailViewCol(LocaleKeys.endDateT.tr(), absenceTransList![index].eNDDATE ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.absenceType.tr(), absenceTransList![index].aBSENCETYPE ?? ""),
ItemDetailViewCol(LocaleKeys.absenceCategory.tr(), absenceTransList![index].aBSENCECATEGORY ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.days.tr(), absenceTransList![index].aBSENCEDAYS?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.hours.tr(), absenceTransList![index].aBSENCEHOURS?.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.approvalStatus.tr(), absenceTransList![index].aPPROVALSTATUS ?? ""),
ItemDetailViewCol(LocaleKeys.absenceStatus.tr(), absenceTransList![index].aBSENCESTATUS ?? ""),
isItLast: true,
),
],
).objectContainerView(),
separatorBuilder: (cxt, index) => 12.height,
itemCount: absenceTransList!.length),
],
)),
floatingActionButton: Container(
height: 54,
width: 54,
@ -124,7 +117,7 @@ class _LeaveBalanceState extends State<LeaveBalance> {
),
child: const Icon(Icons.add, color: Colors.white, size: 30),
).onPress(() {
Navigator.pushNamed(context, AppRoutes.addLeaveBalance, arguments: selectedEmp ?? '');
Navigator.pushNamed(context, AppRoutes.addLeaveBalance, arguments: employeeId);
}),
);
}

@ -58,9 +58,9 @@ class _LoginScreenState extends State<LoginScreen> {
void initState() {
super.initState();
// checkFirebaseToken();
if (kReleaseMode) {
checkDeviceSafety();
}
// if (kReleaseMode) {
// checkDeviceSafety();
// }
}
void checkDeviceSafety() async {

@ -102,8 +102,8 @@ class _NewPasswordScreenState extends State<NewPasswordScreen> {
passwordConstraintsUI(LocaleKeys.minimum8Characters.tr(), password.text.length >= 8),
8.height,
passwordConstraintsUI(LocaleKeys.doNotAddRepeatingLetters.tr(), checkRepeatedChars(password.text)),
8.height,
passwordConstraintsUI(LocaleKeys.itShouldContainSpecialCharacter.tr(), checkRegEx(r'[!@#$%^&*(),.?":{}|<>]')),
// 8.height,
// passwordConstraintsUI(LocaleKeys.itShouldContainSpecialCharacter.tr(), checkRegEx(r'[!@#$%^&*(),.?":{}|<>]')),
8.height,
passwordConstraintsUI(LocaleKeys.confirmPasswordMustMatch.tr(), password.text.isNotEmpty && password.text == confirmPassword.text),
],
@ -146,11 +146,11 @@ class _NewPasswordScreenState extends State<NewPasswordScreen> {
bool hasUppercase = password.contains(RegExp(r'[A-Z]'));
bool hasDigits = password.contains(RegExp(r'[0-9]'));
bool hasLowercase = password.contains(RegExp(r'[a-z]'));
bool hasSpecialCharacters = password.contains(RegExp(r'[!@#$%^&*(),.?":{}|<>]'));
// bool hasSpecialCharacters = password.contains(RegExp(r'[!@#$%^&*(),.?":{}|<>]'));
bool hasMinLength = password.length >= minLength;
bool isMatched = password == confirmPassword.text;
return hasDigits && hasUppercase && hasLowercase && hasSpecialCharacters && hasMinLength && isMatched && checkRepeatedChars(password);
return hasDigits && hasUppercase && hasLowercase && hasMinLength && isMatched && checkRepeatedChars(password);
}
bool checkRepeatedChars(String password) {

@ -289,7 +289,7 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
width: 38,
color: isDisable ? MyColors.darkTextColor.withOpacity(0.7) : null,
),
_title.toText16()
_title.toText16(height: 20/16)
],
),
),

@ -572,7 +572,7 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
width: 38,
color: isDisable ? MyColors.darkTextColor.withOpacity(0.7) : null,
),
_title.toText16()
_title.toText16(height: 20/16)
],
),
),
@ -636,12 +636,10 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
AppState().setPrivilegeListModel = genericResponseModel!.privilegeList ?? [];
AppState().setMemberInformationListModel = genericResponseModel.memberInformationList?.first;
MemberInformationListModel.saveToPrefs(genericResponseModel.memberInformationList ?? []);
genericResponseModel.privilegeList!.forEach((element) {
print(element.serviceName.toString() + " " + element.previlege.toString()); // Check availability
});
PrivilegeListModel.saveToPrefs(genericResponseModel.privilegeList ?? []);
AppState().setMohemmWifiSSID = genericResponseModel.mohemmWifiSSID;
AppState().setMohemmWifiPassword = genericResponseModel.mohemmWifiPassword;
AppState().setMohemmWifiPassword = genericResponseModel.mohemmWifiPassword;
Utils.saveStringFromPrefs(SharedPrefsConsts.username, AppState().getUserName!);
Utils.saveStringFromPrefs(SharedPrefsConsts.password, AppState().password!);
Utils.saveStringFromPrefs(SharedPrefsConsts.mohemmWifiSSID, genericResponseModel.mohemmWifiSSID!);

@ -5,11 +5,14 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/api/marathon/marathon_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/consts.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/models/marathon/marathon_model.dart';
import 'package:mohem_flutter_app/models/marathon/question_model.dart';
import 'package:mohem_flutter_app/models/marathon/winner_model.dart';
import 'package:mohem_flutter_app/models/privilege_list_model.dart';
import 'package:mohem_flutter_app/ui/marathon/widgets/question_card.dart';
import 'package:video_player/video_player.dart';
@ -28,6 +31,14 @@ class MarathonProvider extends ChangeNotifier {
String? selectedOptionId;
int? totalQualifiers;
//TODO: THIS BUG NEEDS TO BE FIXED. NOT DONE YET
String? gapTimeImage;
String? gapTimeText;
int? gapTimeType;
bool iAmWinner = false;
bool isPrivilegedWithMarathon = false;
bool _isLoading = false;
bool get isLoading => _isLoading;
@ -94,8 +105,7 @@ class MarathonProvider extends ChangeNotifier {
late VideoPlayerController videoController;
Future<void> initializeVideoPlayer() async {
// videoController = VideoPlayerController.network(marathonDetailModel.sponsors!.first.video!)..initialize();
videoController = VideoPlayerController.network("http://clips.vorwaerts-gmbh.de/VfE_html5.mp4");
videoController = VideoPlayerController.network(ApiConsts.marathonBaseUrlServices + marathonDetailModel.sponsors!.first.video!);
await videoController.initialize();
await videoController.play();
await videoController.setVolume(1.0);
@ -164,7 +174,7 @@ class MarathonProvider extends ChangeNotifier {
oneSec,
(Timer timer) async {
// This 2 is just to show the color of answer tile for 2 seconds and then update card status
if (totalCurrentQuestionTime - currentGapTime == currentQuestion.questionTime! - 2) {
if (totalCurrentQuestionTime - currentGapTime == 1) {
getCorrectAnswerAndUpdateAnswerColor();
}
@ -173,16 +183,21 @@ class MarathonProvider extends ChangeNotifier {
updateCardStatusToAnswer();
await callSubmitOptionApi().then((bool value) async {
if (value) {
await callNextQuestionApi();
}
scheduleMicrotask(() async {
await callSubmitOptionApi().then((bool value) async {
if (value) {
await callNextQuestionApi();
}
});
});
}
if (totalCurrentQuestionTime == 0) {
gapTimeImage = currentQuestion.gapImage;
gapTimeText = currentQuestion.gapText;
gapTimeType = currentQuestion.gapType;
updateCardData();
if (currentQuestionNumber == marathonDetailModel.totalQuestions! - 1) {
if (currentQuestionNumber - 1 == marathonDetailModel.totalQuestions!) {
callGetQualifiersApi();
updateQuestionCardStatus(QuestionCardStatus.findingWinner);
timer.cancel();
@ -235,16 +250,28 @@ class MarathonProvider extends ChangeNotifier {
Future<void> callGetSelectedWinnersApi() async {
selectedWinners = await MarathonApiClient().getSelectedWinner(marathonId: marathonDetailModel.id!);
if (selectedWinners != null) {
selectedWinners!.removeWhere((WinnerModel element) {
if (element.employeeId == AppState().memberInformationList!.eMPLOYEENUMBER) {
iAmWinner = true;
return true;
} else {
return false;
}
});
}
notifyListeners();
}
// TODO: here I need to add a logic where I should call this function for Api but for the 1st question it should behave differently
// TODO: Verify the callings!!!
Future<void> callNextQuestionApi() async {
if (currentQuestionNumber < marathonDetailModel.totalQuestions!) {
if (currentQuestionNumber == 0) {
Utils.showLoading(AppRoutes.navigatorKey.currentContext!);
currentQuestion = (await MarathonApiClient().getNextQuestion(questionId: null, marathonId: marathonDetailModel.id!))!;
gapTimeImage = currentQuestion.gapImage;
gapTimeText = currentQuestion.gapText;
gapTimeType = currentQuestion.gapType;
if (Utils.isLoading) {
Utils.hideLoading(AppRoutes.navigatorKey.currentContext!);
}
@ -265,6 +292,7 @@ class MarathonProvider extends ChangeNotifier {
}
selectedOptionIndex = null;
currentQuestionNumber++;
cardContentList.add(const CardContent());
totalCurrentQuestionTime = currentQuestion.questionTime! + currentQuestion.nextQuestGap!;
currentGapTime = currentQuestion.nextQuestGap!;
@ -275,7 +303,7 @@ class MarathonProvider extends ChangeNotifier {
void populateQuestionStatusesList() {
if (marathonDetailModel.totalQuestions != null) {
for (int i = 0; i < marathonDetailModel.totalQuestions! - 1; i++) {
for (int i = 0; i < marathonDetailModel.totalQuestions!; i++) {
answerStatusesList.add(QuestionCardStatus.question);
}
notifyListeners();
@ -361,20 +389,36 @@ class MarathonProvider extends ChangeNotifier {
notifyListeners();
}
bool checkIfPrivilegedForMarathon() {
return true;
for (PrivilegeListModel element in AppState().privilegeListModel!) {
if (element.serviceName == "Marathon") {
if (element.previlege != null) {
return element.previlege!;
}
}
}
return false;
}
Future<void> getMarathonDetailsFromApi() async {
isLoading = true;
notifyListeners();
await MarathonApiClient().getMarathonToken().whenComplete(() async {
marathonDetailModel = await MarathonApiClient().getMarathonDetails();
if (marathonDetailModel.id == null) {
isUpComingMarathon = false;
notifyListeners();
return;
}
populateQuestionStatusesList();
isLoading = false;
notifyListeners();
});
isPrivilegedWithMarathon = checkIfPrivilegedForMarathon();
if (isPrivilegedWithMarathon) {
await MarathonApiClient().getMarathonToken().whenComplete(() async {
marathonDetailModel = await MarathonApiClient().getMarathonDetails();
if (marathonDetailModel.id == null) {
isUpComingMarathon = false;
isLoading = false;
notifyListeners();
return;
}
populateQuestionStatusesList();
});
}
isLoading = false;
notifyListeners();
}
Future<void> onJoinMarathonPressed(BuildContext context) async {
@ -389,9 +433,6 @@ class MarathonProvider extends ChangeNotifier {
Navigator.pushReplacementNamed(context, AppRoutes.marathonWaitingScreen);
}
} catch (e) {
if (kDebugMode) {
print("error in onJoinMarathonPressed: ${e.toString()}");
}
Utils.hideLoading(context);
Utils.confirmDialog(context, e.toString());
}

@ -6,6 +6,7 @@ import 'package:flutter_svg/svg.dart';
import 'package:lottie/lottie.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/consts.dart';
import 'package:mohem_flutter_app/classes/decorations_helper.dart';
import 'package:mohem_flutter_app/classes/lottie_consts.dart';
import 'package:mohem_flutter_app/config/routes.dart';
@ -21,6 +22,7 @@ import 'package:mohem_flutter_app/ui/marathon/widgets/marathon_qualifiers_contai
import 'package:mohem_flutter_app/ui/marathon/widgets/question_card.dart';
import 'package:mohem_flutter_app/ui/marathon/widgets/question_card_builder.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/dialogs/confirm_dialog.dart';
import 'package:provider/provider.dart';
@ -48,66 +50,86 @@ class MarathonScreen extends StatelessWidget {
width: double.infinity,
decoration: MyDecorations.shadowDecoration,
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 20),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
child: Stack(
children: <Widget>[
SizedBox(
height: 200,
child: Stack(
children: <Widget>[
Lottie.asset(MyLottieConsts.celebrate1Lottie, height: 200),
Lottie.asset(MyLottieConsts.celebrate2Lottie, height: 200),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(
height: 50,
child: Stack(
children: <Widget>[
Align(
alignment: Alignment.center,
child: SvgPicture.asset("assets/images/winner_ribbon.svg", height: 50),
),
Align(
alignment: Alignment.center,
child: LocaleKeys.winners.tr().toText32(color: MyColors.white, isBold: true, isCentered: true).paddingOnly(top: 07),
)
],
),
),
16.height,
provider.iAmWinner
? Column(
children: <Widget>[
(AppState().isArabic(context) ? AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEAr : AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEEn)!.toText22(
color: MyColors.grey3AColor,
isCentered: true,
),
8.height,
AppState().memberInformationList!.eMPLOYEENUMBER!.toText22(color: MyColors.grey57Color),
],
)
: const SizedBox(),
36.height,
if (provider.selectedWinners != null) ...<Widget>[
ListView.separated(
shrinkWrap: true,
itemCount: provider.selectedWinners!.length,
separatorBuilder: (BuildContext context, int index) {
return const Divider();
},
itemBuilder: (BuildContext context, int index) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
(AppState().isArabic(context) ? provider.selectedWinners![index].nameEn : provider.selectedWinners![index].nameEn)!.toText16(
color: MyColors.grey3AColor,
),
provider.selectedWinners!.first.employeeId!.toText16(color: MyColors.grey57Color),
],
);
},
),
],
),
),
26.height,
SizedBox(
height: 50,
child: Stack(
children: <Widget>[
Align(
alignment: Alignment.center,
child: SvgPicture.asset("assets/images/winner_ribbon.svg", height: 50),
60.height,
if (provider.marathonDetailModel.sponsors != null && provider.marathonDetailModel.sponsors!.isNotEmpty) ...<Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
"${LocaleKeys.sponsoredBy.tr()} ".toText14(color: MyColors.grey77Color),
(AppState().isArabic(context) ? provider.marathonDetailModel.sponsors!.first.nameAr ?? "" : provider.marathonDetailModel.sponsors!.first.nameEn ?? "").toText14(
color: MyColors.darkTextColor,
isBold: true,
),
],
),
Align(
alignment: Alignment.center,
child: LocaleKeys.winner.tr().toText32(color: MyColors.white, isBold: true, isCentered: true).paddingOnly(top: 07),
5.height,
Image.network(
ApiConsts.marathonBaseUrlServices + provider.marathonDetailModel.sponsors!.first.image!,
height: 50,
width: 150,
fit: BoxFit.contain,
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return const Center();
},
)
],
),
],
),
12.height,
if (provider.selectedWinners != null) ...<Widget>[
(AppState().isArabic(context) ? provider.selectedWinners!.first.nameEn : provider.selectedWinners!.first.nameEn)!.toText22(
color: MyColors.grey3AColor,
isCentered: true,
),
8.height,
provider.selectedWinners!.first.employeeId!.toText22(color: MyColors.grey57Color),
],
60.height,
if (provider.marathonDetailModel.sponsors != null && provider.marathonDetailModel.sponsors!.isNotEmpty) ...<Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
"${LocaleKeys.sponsoredBy.tr()} ".toText14(color: MyColors.grey77Color),
(AppState().isArabic(context) ? provider.marathonDetailModel.sponsors!.first.nameAr ?? "" : provider.marathonDetailModel.sponsors!.first.nameEn ?? "").toText14(
color: MyColors.darkTextColor,
isBold: true,
),
],
),
5.height,
Image.network(
provider.marathonDetailModel.sponsors!.first.image!,
height: 40,
width: 150,
fit: BoxFit.fill,
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return const Center();
},
)
],
Lottie.asset(MyLottieConsts.celebrate1Lottie),
],
),
);
@ -176,57 +198,74 @@ class MarathonScreen extends StatelessWidget {
}
},
),
body: SingleChildScrollView(
child: Column(
children: <Widget>[
20.height,
if (provider.questionCardStatus == QuestionCardStatus.findingWinner) ...<Widget>[
QualifiersContainer(provider: provider).paddingOnly(left: 21, right: 21),
] else if (provider.questionCardStatus == QuestionCardStatus.winnerFound)
...<Widget>[]
else ...<Widget>[
MarathonProgressContainer(provider: provider).paddingOnly(left: 21, right: 21),
],
if (provider.questionCardStatus == QuestionCardStatus.findingWinner) ...<Widget>[
getNameContainer(context),
body: Column(
children: <Widget>[
ListView(
children: [
20.height,
if (provider.questionCardStatus == QuestionCardStatus.findingWinner) ...<Widget>[
QualifiersContainer(provider: provider).paddingOnly(left: 21, right: 21),
] else if (provider.questionCardStatus == QuestionCardStatus.winnerFound)
...<Widget>[]
else ...<Widget>[
MarathonProgressContainer(provider: provider).paddingOnly(left: 21, right: 21),
],
if (provider.questionCardStatus == QuestionCardStatus.findingWinner) ...<Widget>[
getNameContainer(context),
],
QuestionCardBuilder(
onQuestion: (BuildContext context) => const QuestionCard(),
onCompleted: (BuildContext context) => CustomStatusWidget(
asset: Lottie.asset(MyLottieConsts.allQuestions, height: 200),
title: LocaleKeys.congrats.tr().toText22(color: MyColors.greenColor),
subTitle: LocaleKeys.allQuestionsCorrect.toText18(color: MyColors.darkTextColor, isCentered: true),
),
onCorrectAnswer: (BuildContext context) => CustomStatusWidget(
asset: getSuccessWidget(gapType: provider.gapTimeType, gapImage: provider.gapTimeImage, gapText: provider.gapTimeText),
title: LocaleKeys.congrats.tr().toText22(color: MyColors.greenColor),
subTitle: LocaleKeys.yourAnswerCorrect.tr().toText18(color: MyColors.darkTextColor, isCentered: true),
),
onWinner: (BuildContext context) => getWinnerWidget(context, provider: provider),
onWrongAnswer: (BuildContext context) => CustomStatusWidget(
asset: Image.asset(MyLottieConsts.wrongAnswerGif, height: 200),
title: LocaleKeys.oops.tr().toText22(color: MyColors.redColor),
subTitle: LocaleKeys.wrongAnswer.tr().toText18(color: MyColors.darkTextColor, isCentered: true),
),
onSkippedAnswer: (BuildContext context) => CustomStatusWidget(
asset: Image.asset(MyLottieConsts.wrongAnswerGif, height: 200),
title: LocaleKeys.oops.tr().toText22(color: MyColors.redColor),
subTitle: LocaleKeys.youMissedTheQuestion.tr().toText18(color: MyColors.darkTextColor, isCentered: true),
),
onFindingWinner: (BuildContext context) => CustomStatusWidget(
asset: Lottie.asset(MyLottieConsts.winnerLottie, height: 168),
title: LocaleKeys.fingersCrossed.tr().toText22(color: MyColors.greenColor),
subTitle: LocaleKeys.winnerSelectedRandomly.tr().toText18(color: MyColors.darkTextColor, isCentered: true),
),
questionCardStatus: provider.questionCardStatus,
).paddingOnly(top: 12, left: 21, right: 21),
],
QuestionCardBuilder(
onQuestion: (BuildContext context) => const QuestionCard(),
onCompleted: (BuildContext context) => CustomStatusWidget(
asset: Lottie.asset(MyLottieConsts.allQuestions, height: 200),
title: LocaleKeys.congrats.tr().toText22(color: MyColors.greenColor),
subTitle: LocaleKeys.allQuestionsCorrect.toText18(color: MyColors.darkTextColor, isCentered: true),
),
onCorrectAnswer: (BuildContext context) => CustomStatusWidget(
asset: getSuccessWidget(gapType: provider.currentQuestion.gapType, gapImage: provider.currentQuestion.gapImage, gapText: provider.currentQuestion.gapText),
title: LocaleKeys.congrats.tr().toText22(color: MyColors.greenColor),
subTitle: LocaleKeys.yourAnswerCorrect.toText18(color: MyColors.darkTextColor, isCentered: true),
),
onWinner: (BuildContext context) => getWinnerWidget(context, provider: provider),
onWrongAnswer: (BuildContext context) => CustomStatusWidget(
asset: Image.asset(MyLottieConsts.wrongAnswerGif, height: 200),
title: LocaleKeys.oops.tr().toText22(color: MyColors.redColor),
subTitle: LocaleKeys.wrongAnswer.tr().toText18(color: MyColors.darkTextColor, isCentered: true),
),
onSkippedAnswer: (BuildContext context) => CustomStatusWidget(
asset: Image.asset(MyLottieConsts.wrongAnswerGif, height: 200),
title: LocaleKeys.oops.tr().toText22(color: MyColors.redColor),
subTitle: LocaleKeys.youMissedTheQuestion.tr().toText18(color: MyColors.darkTextColor, isCentered: true),
),
onFindingWinner: (BuildContext context) => CustomStatusWidget(
asset: Lottie.asset(MyLottieConsts.winnerLottie, height: 168),
title: LocaleKeys.fingersCrossed.tr().toText22(color: MyColors.greenColor),
subTitle: LocaleKeys.winnerSelectedRandomly.tr().toText18(color: MyColors.darkTextColor, isCentered: true),
),
questionCardStatus: provider.questionCardStatus,
).paddingOnly(top: 12, left: 21, right: 21),
],
),
).expanded,
provider.questionCardStatus == QuestionCardStatus.winnerFound
? DefaultButton(LocaleKeys.ok.tr(), () {
provider.resetValues();
Navigator.of(context).popUntil(ModalRoute.withName(AppRoutes.dashboard));
}).insideContainer
: const SizedBox()
],
),
),
onWillPop: () {
provider.resetValues();
return Future<bool>.value(true);
showDialog(
context: context,
builder: (BuildContext context) => ConfirmDialog(
message: LocaleKeys.youWantToLeaveMarathon.tr(),
onTap: () {
provider.resetValues();
Navigator.of(context).popUntil(ModalRoute.withName(AppRoutes.dashboard));
},
),
);
return Future<bool>.value(false);
},
);
}

@ -15,9 +15,6 @@ import 'package:video_player/video_player.dart';
class SponsorVideoScreen extends StatelessWidget {
const SponsorVideoScreen({Key? key}) : super(key: key);
Future<void> onSponsorVideoClosed(BuildContext context) async {
Navigator.pop(context);
}
@override
Widget build(BuildContext context) {

@ -22,200 +22,362 @@ class MarathonBanner extends StatelessWidget {
const MarathonBanner({Key? key, required this.isMarathonUpcoming}) : super(key: key);
@override
Widget build(BuildContext context) {
MarathonProvider provider = context.read<MarathonProvider>();
return provider.marathonDetailModel.startTime != null
? Container(
decoration: MyDecorations.shadowDecoration,
height: isTablet ? MediaQuery.of(context).size.height * 0.17 : MediaQuery.of(context).size.height * 0.11,
clipBehavior: Clip.antiAlias,
child: Stack(
Widget getUnPrivilegedMarathon(BuildContext context) {
return Container(
decoration: MyDecorations.shadowDecoration,
height: isTablet ? MediaQuery.of(context).size.height * 0.17 : MediaQuery.of(context).size.height * 0.11,
clipBehavior: Clip.antiAlias,
child: Stack(
children: <Widget>[
Transform(
alignment: Alignment.center,
transform: Matrix4.rotationY(
AppState().isArabic(context) ? math.pi : 0,
),
child: SvgPicture.asset(
"assets/images/marathon_banner_bg.svg",
fit: BoxFit.fill,
width: double.infinity,
),
),
AppState().isArabic(context)
? Positioned(
right: -15,
top: -10,
child: Transform.rotate(
angle: 10,
child: Container(
width: isTablet ? 70 : 65,
height: isTablet ? 40 : 32,
color: MyColors.darkDigitColor,
),
),
)
: Positioned(
left: -20,
top: -10,
child: Transform.rotate(
angle: 15,
child: Container(
width: isTablet ? 70 : 65,
height: isTablet ? 40 : 32,
color: MyColors.darkDigitColor,
),
),
),
SizedBox(
width: double.infinity,
height: double.infinity,
child: Row(
children: <Widget>[
Transform(
alignment: Alignment.center,
transform: Matrix4.rotationY(
AppState().isArabic(context) ? math.pi : 0,
const Expanded(
flex: 3,
child: SizedBox(
width: double.infinity,
height: double.infinity,
),
child: SvgPicture.asset(
"assets/images/marathon_banner_bg.svg",
fit: BoxFit.fill,
),
Expanded(
flex: AppState().isArabic(context) ? 4 : 5,
child: SizedBox(
width: double.infinity,
height: double.infinity,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
AppState().isArabic(context) ? 0.height : 5.height,
Text(
LocaleKeys.getReadyForContest.tr(),
style: TextStyle(
fontSize: isTablet ? 20 : 11,
fontStyle: FontStyle.italic,
fontWeight: FontWeight.w600,
color: MyColors.white.withOpacity(0.83),
letterSpacing: -0.4,
),
),
Text(
LocaleKeys.brainMarathon.tr(),
style: TextStyle(
fontStyle: FontStyle.italic,
fontSize: isTablet ? 30 : 19,
fontWeight: FontWeight.bold,
color: MyColors.white.withOpacity(0.83),
height: 32 / 22,
),
),
],
).paddingOnly(
left: AppState().isArabic(context) ? 12 : 3,
right: AppState().isArabic(context) ? 3 : 12,
)
],
),
),
),
AppState().isArabic(context)
? Positioned(
right: -15,
top: -10,
child: Transform.rotate(
angle: 10,
child: Container(
width: isTablet ? 70 : 65,
height: isTablet ? 40 : 32,
color: MyColors.darkDigitColor,
),
),
)
: Positioned(
left: -20,
top: -10,
child: Transform.rotate(
angle: 15,
child: Container(
width: isTablet ? 70 : 65,
height: isTablet ? 40 : 32,
color: MyColors.darkDigitColor,
),
],
),
),
AppState().isArabic(context)
? Align(
alignment: Alignment.topRight,
child: SizedBox(
height: isTablet ? 30 : 20,
width: isTablet ? 45 : 35,
child: Transform.rotate(
angle: math.pi / 4.5,
child: Text(
LocaleKeys.brainMarathon.tr(),
textAlign: TextAlign.center,
maxLines: 2,
style: TextStyle(
color: MyColors.white,
fontWeight: FontWeight.bold,
fontSize: isTablet ? 8 : 6,
height: 1.2,
),
),
SizedBox(
width: double.infinity,
height: double.infinity,
child: Row(
children: <Widget>[
const Expanded(
flex: 3,
child: SizedBox(
width: double.infinity,
height: double.infinity,
),
),
).paddingOnly(top: 5)
: Align(
alignment: Alignment.topLeft,
child: SizedBox(
height: isTablet ? 30 : 20,
width: isTablet ? 45 : 35,
child: Transform.rotate(
angle: -math.pi / 4.5,
child: Text(
LocaleKeys.brainMarathon.tr(),
textAlign: TextAlign.center,
maxLines: 2,
style: TextStyle(
color: MyColors.kWhiteColor,
fontWeight: FontWeight.bold,
fontSize: isTablet ? 8 : 6,
height: 1.2,
),
),
Expanded(
flex: AppState().isArabic(context) ? 4 : 5,
child: SizedBox(
width: double.infinity,
height: double.infinity,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
),
),
).paddingOnly(top: 5),
Container(
height: double.infinity,
width: double.infinity,
color: Colors.black.withOpacity(0.6),
child: const Icon(
Icons.lock_rounded,
color: MyColors.lightGreyIconColor,
),
),
],
),
);
}
@override
Widget build(BuildContext context) {
MarathonProvider provider = context.read<MarathonProvider>();
return provider.isPrivilegedWithMarathon
? getUnPrivilegedMarathon(context)
: provider.marathonDetailModel.startTime != null
? Container(
decoration: MyDecorations.shadowDecoration,
height: isTablet ? MediaQuery.of(context).size.height * 0.17 : MediaQuery.of(context).size.height * 0.11,
clipBehavior: Clip.antiAlias,
child: Stack(
children: <Widget>[
Transform(
alignment: Alignment.center,
transform: Matrix4.rotationY(
AppState().isArabic(context) ? math.pi : 0,
),
child: SvgPicture.asset(
"assets/images/marathon_banner_bg.svg",
fit: BoxFit.fill,
width: double.infinity,
),
),
AppState().isArabic(context)
? Positioned(
right: -15,
top: -10,
child: Transform.rotate(
angle: 10,
child: Container(
width: isTablet ? 70 : 65,
height: isTablet ? 40 : 32,
color: MyColors.darkDigitColor,
),
),
)
: Positioned(
left: -20,
top: -10,
child: Transform.rotate(
angle: 15,
child: Container(
width: isTablet ? 70 : 65,
height: isTablet ? 40 : 32,
color: MyColors.darkDigitColor,
),
),
),
SizedBox(
width: double.infinity,
height: double.infinity,
child: Row(
children: <Widget>[
const Expanded(
flex: 3,
child: SizedBox(
width: double.infinity,
height: double.infinity,
),
),
Expanded(
flex: AppState().isArabic(context) ? 4 : 5,
child: SizedBox(
width: double.infinity,
height: double.infinity,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
AppState().isArabic(context) ? 0.height : 5.height,
Text(
LocaleKeys.getReadyForContest.tr(),
style: TextStyle(
fontSize: isTablet ? 20 : 11,
fontStyle: FontStyle.italic,
fontWeight: FontWeight.w600,
color: MyColors.white.withOpacity(0.83),
letterSpacing: -0.4,
),
),
Text(
AppState().isArabic(context) ? provider.marathonDetailModel.titleAr ?? "" : provider.marathonDetailModel.titleEn ?? "",
style: TextStyle(
fontStyle: FontStyle.italic,
fontSize: isTablet ? 30 : 19,
fontWeight: FontWeight.bold,
color: MyColors.white.withOpacity(0.83),
height: 32 / 22,
),
),
isTablet ? 10.height : 3.height,
BuildCountdownTimer(
timeToMarathon: DateTime.parse(provider.marathonDetailModel.startTime!).millisecondsSinceEpoch,
provider: provider,
screenFlag: 0,
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
AppState().isArabic(context) ? 0.height : 5.height,
Text(
LocaleKeys.getReadyForContest.tr(),
style: TextStyle(
fontSize: isTablet ? 20 : 11,
fontStyle: FontStyle.italic,
fontWeight: FontWeight.w600,
color: MyColors.white.withOpacity(0.83),
letterSpacing: -0.4,
),
),
Text(
AppState().isArabic(context) ? provider.marathonDetailModel.titleAr ?? "" : provider.marathonDetailModel.titleEn ?? "",
style: TextStyle(
fontStyle: FontStyle.italic,
fontSize: isTablet ? 30 : 19,
fontWeight: FontWeight.bold,
color: MyColors.white.withOpacity(0.83),
height: 32 / 22,
),
),
isTablet ? 10.height : 3.height,
BuildCountdownTimer(
timeToMarathon: DateTime.parse(provider.marathonDetailModel.startTime!).millisecondsSinceEpoch,
provider: provider,
screenFlag: 0,
),
],
).paddingOnly(
left: AppState().isArabic(context) ? 12 : 3,
right: AppState().isArabic(context) ? 3 : 12,
)
],
).paddingOnly(
left: AppState().isArabic(context) ? 12 : 3,
right: AppState().isArabic(context) ? 3 : 12,
)
],
),
),
),
),
],
),
],
),
),
AppState().isArabic(context)
? Align(
alignment: Alignment.topRight,
child: SizedBox(
height: isTablet ? 30 : 20,
width: isTablet ? 45 : 35,
child: Transform.rotate(
angle: math.pi / 4.5,
child: Text(
LocaleKeys.brainMarathon.tr(),
textAlign: TextAlign.center,
maxLines: 2,
style: TextStyle(
color: MyColors.white,
fontWeight: FontWeight.bold,
fontSize: isTablet ? 8 : 6,
height: 1.2,
),
AppState().isArabic(context)
? Align(
alignment: Alignment.topRight,
child: SizedBox(
height: isTablet ? 30 : 20,
width: isTablet ? 45 : 35,
child: Transform.rotate(
angle: math.pi / 4.5,
child: Text(
LocaleKeys.brainMarathon.tr(),
textAlign: TextAlign.center,
maxLines: 2,
style: TextStyle(
color: MyColors.white,
fontWeight: FontWeight.bold,
fontSize: isTablet ? 8 : 6,
height: 1.2,
),
),
),
),
),
),
).paddingOnly(top: 5)
: Align(
alignment: Alignment.topLeft,
child: SizedBox(
height: isTablet ? 30 : 20,
width: isTablet ? 45 : 35,
child: Transform.rotate(
angle: -math.pi / 4.5,
child: Text(
LocaleKeys.brainMarathon.tr(),
textAlign: TextAlign.center,
maxLines: 2,
style: TextStyle(
color: MyColors.kWhiteColor,
fontWeight: FontWeight.bold,
fontSize: isTablet ? 8 : 6,
height: 1.2,
).paddingOnly(top: 5)
: Align(
alignment: Alignment.topLeft,
child: SizedBox(
height: isTablet ? 30 : 20,
width: isTablet ? 45 : 35,
child: Transform.rotate(
angle: -math.pi / 4.5,
child: Text(
LocaleKeys.brainMarathon.tr(),
textAlign: TextAlign.center,
maxLines: 2,
style: TextStyle(
color: MyColors.kWhiteColor,
fontWeight: FontWeight.bold,
fontSize: isTablet ? 8 : 6,
height: 1.2,
),
),
),
),
).paddingOnly(top: 5),
!AppState().isArabic(context)
? Positioned(
right: 0,
bottom: 0,
child: RotatedBox(
quarterTurns: 4,
child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.whiteColor),
).paddingAll(isTablet ? 20 : 15),
)
: Positioned(
bottom: 0,
left: 0,
child: RotatedBox(
quarterTurns: 2,
child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.whiteColor),
).paddingAll(isTablet ? 20 : 15),
),
),
).paddingOnly(top: 5),
!AppState().isArabic(context)
? Positioned(
right: 0,
bottom: 0,
child: RotatedBox(
quarterTurns: 4,
child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.whiteColor),
).paddingAll(isTablet ? 20 : 15),
)
: Positioned(
bottom: 0,
left: 0,
child: RotatedBox(
quarterTurns: 2,
child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.whiteColor),
).paddingAll(isTablet ? 20 : 15),
),
],
).onPress(() async {
int remainingTimeInMinutes = DateTime.parse(provider.marathonDetailModel.startTime!).difference(DateTime.now()).inMinutes;
],
).onPress(() async {
int remainingTimeInMinutes = DateTime.parse(provider.marathonDetailModel.startTime!).difference(DateTime.now()).inMinutes;
if (remainingTimeInMinutes > 2) {
Utils.showLoading(context);
try {
await provider.initializeVideoPlayer().then((_) {
Utils.hideLoading(context);
provider.startTimerForSponsorVideo();
Navigator.pushNamed(context, AppRoutes.marathonSponsorVideoScreen);
});
} catch (e, s) {
if (kDebugMode) {
print("Error in VideoPlayer: ${e.toString()}");
if (remainingTimeInMinutes > 2) {
Utils.showLoading(context);
try {
await provider.initializeVideoPlayer().then((_) {
Utils.hideLoading(context);
provider.startTimerForSponsorVideo();
Navigator.pushNamed(context, AppRoutes.marathonSponsorVideoScreen);
});
} catch (e) {
if (kDebugMode) {
print("Error in VideoPlayer: ${e.toString()}");
}
Utils.hideLoading(context);
Navigator.pushNamed(context, AppRoutes.marathonIntroScreen);
}
} else {
Navigator.pushNamed(context, AppRoutes.marathonIntroScreen);
}
Utils.hideLoading(context);
Navigator.pushNamed(context, AppRoutes.marathonIntroScreen);
}
} else {
Navigator.pushNamed(context, AppRoutes.marathonIntroScreen);
}
}),
)
: const SizedBox();
}),
// );
)
: const SizedBox();
}
}

@ -1,16 +1,14 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/consts.dart';
import 'package:mohem_flutter_app/classes/decorations_helper.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart';
class MarathonDetailsCard extends StatelessWidget {
final MarathonProvider provider;
@ -38,16 +36,16 @@ class MarathonDetailsCard extends StatelessWidget {
)
],
),
if (provider.itsMarathonTime && provider.marathonDetailModel.sponsors != null) ...<Widget>[
if (provider.marathonDetailModel.sponsors != null) ...<Widget>[
5.height,
provider.marathonDetailModel.sponsors?.first.sponsorPrizes != null
? Row(
children: <Widget>[
"${LocaleKeys.prize.tr()} ".toText16(color: MyColors.grey77Color, isBold: true),
"${AppState().isArabic(context) ? provider.marathonDetailModel.sponsors?.first.sponsorPrizes?.first.marathonPrizeAr : provider.marathonDetailModel.sponsors?.first.sponsorPrizes?.first.marathonPrizeAr}"
.toText16(color: MyColors.greenColor, isBold: true),
],
)
children: <Widget>[
"${LocaleKeys.prize.tr()} ".toText16(color: MyColors.grey77Color, isBold: true),
"${AppState().isArabic(context) ? provider.marathonDetailModel.sponsors?.first.sponsorPrizes?.first.marathonPrizeAr : provider.marathonDetailModel.sponsors?.first.sponsorPrizes?.first.marathonPrizeAr}"
.toText16(color: MyColors.greenColor, isBold: true),
],
)
: const SizedBox(),
Row(
children: <Widget>[
@ -61,10 +59,10 @@ class MarathonDetailsCard extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.network(
provider.marathonDetailModel.sponsors!.first.image!,
height: 40,
ApiConsts.marathonBaseUrlServices + provider.marathonDetailModel.sponsors!.first.image!,
height: 50,
width: 150,
fit: BoxFit.fill,
fit: BoxFit.contain,
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return const Center();
},
@ -79,4 +77,3 @@ class MarathonDetailsCard extends StatelessWidget {
);
}
}

@ -47,20 +47,3 @@ class MarathonFooter extends StatelessWidget {
).insideContainer;
}
}
//Container(
// color: Colors.white,
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: <Widget>[
// buildNoteForDemo(),
// DefaultButton(
// LocaleKeys.joinDemoMarathon.tr(),
// () {
// provider.connectSignalrAndJoinMarathon(context);
// },
// color: MyColors.yellowColorII,
// ).insideContainer,
// ],
// ),
// );

@ -43,7 +43,8 @@ class MarathonProgressContainer extends StatelessWidget {
8.height,
Row(
children: <Widget>[
"${((provider.currentQuestionNumber / provider.marathonDetailModel.totalQuestions!) * 100).toInt()}% ${LocaleKeys.completed.tr()}".toText14(),
"${provider.currentQuestionNumber == 1 ? 0 : (((provider.currentQuestionNumber - 1) / provider.marathonDetailModel.totalQuestions!) * 100).toInt()}% ${LocaleKeys.completed.tr()}"
.toText14(),
],
),
],
@ -52,9 +53,6 @@ class MarathonProgressContainer extends StatelessWidget {
}
Color getStepColor(QuestionCardStatus status, bool isOutOfGame) {
if (isOutOfGame) {
return MyColors.redColor;
}
switch (status) {
case QuestionCardStatus.question:
return MyColors.yellowColorII;
@ -79,7 +77,7 @@ class MarathonProgressContainer extends StatelessWidget {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
for (int i = 0; i < totalQuestions - 1; i++)
for (int i = 0; i < totalQuestions; i++)
if (value <= i)
roundContainer(MyColors.lightGreyDeColor, i != 0)
else

@ -43,6 +43,7 @@ class _QualifiersContainerState extends State<QualifiersContainer> {
),
10.height,
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
widget.provider.totalQualifiers != null ? widget.provider.totalQualifiers.toString().toText30(color: MyColors.greenColor, isBold: true) : const SizedBox(),
2.width,

@ -31,13 +31,13 @@ class RequestSubmitScreenParams {
int transactionId;
String pItemId;
String approvalFlag;
String? selectedEmployeeID;
RequestSubmitScreenParams(this.title, this.transactionId, this.pItemId, this.approvalFlag);
RequestSubmitScreenParams(this.title, this.transactionId, this.pItemId, this.approvalFlag, {this.selectedEmployeeID});
}
class RequestSubmitScreen extends StatefulWidget {
final String selectedEmp;
RequestSubmitScreen({this.selectedEmp ='',Key? key}) : super(key: key);
RequestSubmitScreen({Key? key}) : super(key: key);
@override
_RequestSubmitScreenState createState() {
@ -53,7 +53,7 @@ class _RequestSubmitScreenState extends State<RequestSubmitScreen> {
List<File> attachmentFiles = [];
List<String> attachments = [];
dynamic dynamicParams;
String selectedEmp ="";
String selectedEmp = "";
@override
void initState() {
@ -64,7 +64,6 @@ class _RequestSubmitScreenState extends State<RequestSubmitScreen> {
try {
Utils.showLoading(context);
approverList = await MyAttendanceApiClient().getApproversList("SSHRMS", params!.transactionId);
Utils.hideLoading(context);
setState(() {});
} catch (ex) {
@ -123,12 +122,7 @@ class _RequestSubmitScreenState extends State<RequestSubmitScreen> {
params!.transactionId,
);
} else if (params!.approvalFlag == 'add_leave_balance') {
await LeaveBalanceApiClient().startAbsenceApprovalProcess(
params!.transactionId,
comments.text,
-999,
empID: widget.selectedEmp
);
await LeaveBalanceApiClient().startAbsenceApprovalProcess(params!.transactionId, comments.text, -999, empID: params!.selectedEmployeeID);
} else if (params!.approvalFlag == 'eit') {
await MyAttendanceApiClient().startEitApprovalProcess(
"SUBMIT",

@ -5,7 +5,6 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/api/leave_balance_api_client.dart';
import 'package:mohem_flutter_app/api/my_attendance_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
@ -44,7 +43,6 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
void getTransactionsStructure() async {
try {
Utils.showLoading(context);
genericResponseModel = await MyAttendanceApiClient().getEitDffStructure(dynamicParams!.dynamicId, dynamicParams!.selectedEmp);
dESCFLEXCONTEXTCODE = genericResponseModel!.pDESCFLEXCONTEXTCODE ?? "";
descFlexConTextTitle = genericResponseModel!.pDESCFLEXCONTEXTNAME ?? "";
@ -92,9 +90,8 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
values.add(ValidateEitTransactionModel(dATEVALUE: null, nAME: "PEI_EXTRA_INFO_ID", nUMBERVALUE: -1, tRANSACTIONNUMBER: 1, vARCHAR2VALUE: null).toJson());
values.add(ValidateEitTransactionModel(dATEVALUE: null, nAME: "PEI_OBJECT_VERSION_NUMBER", nUMBERVALUE: 0, tRANSACTIONNUMBER: 1, vARCHAR2VALUE: null).toJson());
genericResponseModel = await MyAttendanceApiClient().validateEitTransaction(dESCFLEXCONTEXTCODE, dynamicParams!.dynamicId, values, empID: dynamicParams!.selectedEmp ?? '');
SubmitEITTransactionList submitEITTransactionList =
await MyAttendanceApiClient().submitEitTransaction(dESCFLEXCONTEXTCODE, dynamicParams!.dynamicId, values, empID: dynamicParams!.selectedEmp ?? '');
genericResponseModel = await MyAttendanceApiClient().validateEitTransaction(dESCFLEXCONTEXTCODE, dynamicParams!.dynamicId, values, empID: dynamicParams!.selectedEmp);
SubmitEITTransactionList submitEITTransactionList = await MyAttendanceApiClient().submitEitTransaction(dESCFLEXCONTEXTCODE, dynamicParams!.dynamicId, values, empID: dynamicParams!.selectedEmp);
Utils.hideLoading(context);
await Navigator.pushNamed(context, AppRoutes.requestSubmitScreen,
arguments: RequestSubmitScreenParams(LocaleKeys.submit.tr(), submitEITTransactionList.pTRANSACTIONID!, submitEITTransactionList.pITEMKEY!, 'eit'));
@ -110,9 +107,9 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
String dESCFLEXCONTEXTCODE = "";
String descFlexConTextTitle = "";
Future calGetValueSetValues(GetEITDFFStructureList structureList) async {
Future calGetValueSetValues(GetEITDFFStructureList structureList, {bool showLoading = true}) async {
try {
Utils.showLoading(context);
if (showLoading) Utils.showLoading(context);
for (int i = 0; i < (structureList.cHILDSEGMENTSVSSplited?.length ?? 0); i++) {
List<Map<String, dynamic>> values = [];
String segmentId = structureList.cHILDSEGMENTSVSSplited![i];
@ -131,7 +128,7 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
.toList();
List<ESERVICESVS> eServicesResponseModel = await MyAttendanceApiClient().getValueSetValues(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values,
empID: dynamicParams!.selectedEmp ?? '', parentValue: structureList.eSERVICESDV!.pVALUECOLUMNNAME);
empID: dynamicParams!.selectedEmp, parentValue: structureList.eSERVICESDV!.pVALUECOLUMNNAME);
List<GetEITDFFStructureList> abc = genericResponseModel?.getEITDFFStructureList ?? [];
getEitDffStructureList = abc;
int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId);
@ -140,18 +137,21 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
// getEitDffStructureList = genericResponseModel?.getEITDFFStructureList ?? [];
//getEitDffStructureList = getEitDffStructureList!.where((element) => element.dISPLAYFLAG != "N").toList();
}
await Future.delayed(const Duration(seconds: 1));
Utils.hideLoading(context);
if (showLoading) {
await Future.delayed(const Duration(seconds: 1));
Utils.hideLoading(context);
}
setState(() {});
} catch (ex) {
Utils.hideLoading(context);
if (showLoading) Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
Future getDefaultValues(GetEITDFFStructureList structureList) async {
Future getDefaultValues(GetEITDFFStructureList structureList, {bool showLoading = true}) async {
try {
Utils.showLoading(context);
if (showLoading) Utils.showLoading(context);
for (int i = 0; i < (structureList.cHILDSEGMENTSDVSplited?.length ?? 0); i++) {
String segmentId = structureList.cHILDSEGMENTSDVSplited![i];
GetEITDFFStructureList? parent = getEitDffStructureList!.firstWhere((element) => element.sEGMENTNAME == segmentId);
@ -176,8 +176,7 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
GetEITDFFStructureList defaultValueCheck = getEitDffStructureList!.where((GetEITDFFStructureList element) => element.sEGMENTNAME == segmentId).toList().first;
if (defaultValueCheck.cHILDSEGMENTSDVSplited!.isNotEmpty && defaultValueCheck.rEADONLY == 'Y') {
getDefaultValues(defaultValueCheck);
Utils.hideLoading(context);
await getDefaultValues(defaultValueCheck, showLoading: false);
// GetEITDFFStructureList? parent = getEitDffStructureList!.firstWhere((element) => element.sEGMENTNAME == segmentId);
// List<Map<String, dynamic>> getSetList = getDefaultValuesIonicLogic(parent);
@ -185,19 +184,23 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
// int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId);
// getEitDffStructureList![index].eSERVICESDV = defaultValue;
} else if (defaultValueCheck.cHILDSEGMENTSVSSplited!.isNotEmpty && defaultValueCheck.rEADONLY == 'Y') {
calGetValueSetValues(defaultValueCheck);
Utils.hideLoading(context);
await calGetValueSetValues(defaultValueCheck, showLoading: false);
// Utils.hideLoading(context);
}
} else if (values.isNotEmpty) {
ESERVICESDV defaultValue = await MyAttendanceApiClient().getDefaultValue(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values);
ESERVICESDV defaultValue = await MyAttendanceApiClient().getDefaultValue(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values, empID: dynamicParams!.selectedEmp);
int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId);
getEitDffStructureList![index].eSERVICESDV = defaultValue;
}
}
await Future.delayed(const Duration(seconds: 1));
Utils.hideLoading(context);
if (showLoading) {
await Future.delayed(const Duration(seconds: 1));
Utils.hideLoading(context);
}
setState(() {});
} catch (ex) {
Utils.hideLoading(context);
if (showLoading) Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
@ -331,7 +334,7 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
idColName = val;
if (getEitDffStructureList![j].fORMATTYPE == "X") {
idColName = Utils.formatDateNew(idColName!);
idColName = Utils.formatDateDefault(idColName!);
// commenting to test
// DateTime date = DateFormat('yyyy-MM-dd').parse(idColName!);
// idColName = DateFormat('yyyy-MM-dd HH:mm:ss').format(date);
@ -425,9 +428,6 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
Widget build(BuildContext context) {
if (dynamicParams == null) {
dynamicParams = ModalRoute.of(context)!.settings.arguments as DynamicListViewParams;
if (dynamicParams!.selectedEmp.isNotEmpty) {
AppState().postParamsJson['P_SELECTED_EMPLOYEE_NUMBER'] = dynamicParams!.selectedEmp;
}
getTransactionsStructure();
}
return Scaffold(
@ -621,12 +621,15 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
).paddingOnly(bottom: 12),
itemBuilder: (_) => <PopupMenuItem<int>>[
if (model.rEADONLY != "Y")
for (int i = 0; i < model.eSERVICESVS!.length; i++) PopupMenuItem<int>(value: i, child: Column(
children: [
Text(model.eSERVICESVS![i].vALUECOLUMNNAME!),
const PopupMenuDivider(),
],
)),
for (int i = 0; i < model.eSERVICESVS!.length; i++)
PopupMenuItem<int>(
value: i,
child: Column(
children: [
Text(model.eSERVICESVS![i].vALUECOLUMNNAME!),
const PopupMenuDivider(),
],
)),
],
onSelected: (int popipIndex) async {
ESERVICESDV eservicesdv = ESERVICESDV(

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_layout_grid/flutter_layout_grid.dart';
import 'package:mohem_flutter_app/api/my_attendance_api_client.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
@ -20,9 +21,10 @@ class DynamicListViewParams {
bool isUpdate;
List<CollectionNotificationEit>? collectionNotificationList;
final String selectedEmp;
final String? selectedEmp;
DynamicListViewParams(this.title, this.dynamicId, {this.selectedEmp ='', this.uRL = 'GET_EIT_DFF_STRUCTURE', this.requestID = '', this.colsURL = '', this.isUpdate = false, this.collectionNotificationList});
DynamicListViewParams(this.title, this.dynamicId,
{this.selectedEmp, this.uRL = 'GET_EIT_DFF_STRUCTURE', this.requestID = '', this.colsURL = '', this.isUpdate = false, this.collectionNotificationList});
}
class DynamicListViewScreen extends StatefulWidget {
@ -37,6 +39,7 @@ class DynamicListViewScreen extends StatefulWidget {
class _DynamicListViewScreenState extends State<DynamicListViewScreen> {
List<GetEITTransactionList>? getEITTransactionList;
DynamicListViewParams? dynamicParams;
// String? empId;
@override
@ -51,7 +54,6 @@ class _DynamicListViewScreenState extends State<DynamicListViewScreen> {
getEITTransactionList?.forEach((element) {
element.collectionTransaction = element.collectionTransaction?.where((elemen) => elemen.dISPLAYFLAG == "Y").toList() ?? [];
});
getEITTransactionList = getEITTransactionList?.where((element) => element.collectionTransaction?.isNotEmpty ?? false).toList() ?? [];
Utils.hideLoading(context);
setState(() {});
@ -91,7 +93,7 @@ class _DynamicListViewScreenState extends State<DynamicListViewScreen> {
padding: const EdgeInsets.all(21),
children: [
// HMG_TKT_NEW_EIT_SS Id used for ticket balance dashboard
if (isTicketRequest) ...[const BalancesDashboardWidget("Current Ticket Balance", false, ""), 12.height],
if (isTicketRequest) ...[const BalancesDashboardWidget("Current Ticket Balance", false, showLoading: false), 12.height],
getEITTransactionList == null
? const SizedBox()
: (getEITTransactionList!.isEmpty
@ -99,47 +101,19 @@ class _DynamicListViewScreenState extends State<DynamicListViewScreen> {
: ListView.separated(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (cxt, int parentIndex) => getEITTransactionList![parentIndex].collectionTransaction!.isEmpty
? const SizedBox()
: GridView(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 1.0 / 0.75),
padding: const EdgeInsets.only(left: 12,right: 21,top: 12),
shrinkWrap: true,
primary: false,
physics: const ScrollPhysics(),
children: getEITWidgetsList(getEITTransactionList![parentIndex].collectionTransaction),
).objectContainerView(),
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisSize: MainAxisSize.min,
// children: [
// for (int t = 0; t < (getEITTransactionList![parentIndex].collectionTransaction ?? []).length; t++)
// if (getEITTransactionList![parentIndex].collectionTransaction![t].dISPLAYFLAG == "Y")
// // ItemDetailView(getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTPROMPT!,
// // getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTVALUEDSP ?? ""),
// // GridView(
// // gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2),
// // padding: const EdgeInsets.only(left: 21, right: 21, bottom: 21, top: 12),
// // shrinkWrap: true,
// // primary: false,
// // physics: const ScrollPhysics(),
// // children: getEITWidgetsList(getEITTransactionList![parentIndex].collectionTransaction),
// // )
// // ItemDetailViewCol(getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTPROMPT!,
// // getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTVALUEDSP ?? ""),
//
// // GridView(
// // gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2),
// // padding: const EdgeInsets.only(left: 21, right: 21, bottom: 21, top: 12),
// // shrinkWrap: true,
// // primary: false,
// // physics: const ScrollPhysics(),
// // children: getEITWidgetsList(getEITTransactionList![parentIndex].collectionTransaction),
// // )
// // ItemDetailView(getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTPROMPT!,
// // getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTVALUEDSP ?? ""),
// ],
// ).objectContainerView(),
itemBuilder: (cxt, int parentIndex) {
if (getEITTransactionList![parentIndex].collectionTransaction!.isEmpty) {
return const SizedBox();
}
int count = getEITTransactionList![parentIndex].collectionTransaction!.length;
return LayoutGrid(
columnSizes: [1.fr, 1.fr],
rowSizes: [for (int i = 0; i < (count / 2).round(); i++) auto],
columnGap: 8,
rowGap: 12,
children: getEITWidgetsList(getEITTransactionList![parentIndex].collectionTransaction),
).objectContainerView();
},
separatorBuilder: (cxt, index) => 12.height,
itemCount: getEITTransactionList!.length)),
],

@ -17,9 +17,10 @@ import 'package:provider/provider.dart';
class ServicesMenuListScreenParams {
final String title;
final List<GetMenuEntriesList> list;
final String selectedEmp;
final String? selectedEmp;
GetEmployeeSubordinatesList? getEmployeeSubordinates;
ServicesMenuListScreenParams(this.title, this.list, {this.selectedEmp =''});
ServicesMenuListScreenParams(this.title, this.list, {this.selectedEmp});
}
class ServicesMenuListScreen extends StatelessWidget {
@ -54,11 +55,12 @@ class ServicesMenuListScreen extends StatelessWidget {
}
return;
} else if (servicesMenuData.list[index].requestType == "ABSENCE") {
Navigator.pushNamed(context, AppRoutes.leaveBalance, arguments: servicesMenuData?.selectedEmp ??'');
Navigator.pushNamed(context, AppRoutes.leaveBalance, arguments: servicesMenuData.selectedEmp);
return;
}
if (servicesMenuData.list[index].requestType == "EIT") {
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(servicesMenuData.list[index].prompt!, servicesMenuData.list[index].functionName!, selectedEmp: servicesMenuData.selectedEmp));
Navigator.pushNamed(context, AppRoutes.dynamicScreen,
arguments: DynamicListViewParams(servicesMenuData.list[index].prompt!, servicesMenuData.list[index].functionName!, selectedEmp: servicesMenuData.selectedEmp));
} else {
if (servicesMenuData.list[index].requestType == "TERMINATION") {
Navigator.pushNamed(context, AppRoutes.endEmploymentScreen,

@ -38,13 +38,13 @@ class _CreateRequestState extends State<CreateRequest> {
@override
void initState() {
super.initState();
employeeSubRequest();
// employeeSubRequest();
}
void employeeSubRequest() async {
try {
Utils.showLoading(context);
getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString());
// getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString());
getMenuEntriesList = await MyTeamApiClient().employeeSubordinatesRequest(getEmployeeSubordinates?.eMPLOYEENUMBER);
homeMenus = parseMenus(getMenuEntriesList);
Utils.hideLoading(context);
@ -68,7 +68,8 @@ class _CreateRequestState extends State<CreateRequest> {
void handleOnPress(context, Menus menu) {
if (menu.menuEntry.menuEntryType == "FUNCTION") {
if (menu.menuEntry.requestType == "EIT") {
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(menu.menuEntry.prompt!, menu.menuEntry.functionName!, selectedEmp: getEmployeeSubordinates?.eMPLOYEENUMBER ?? ''));
Navigator.pushNamed(context, AppRoutes.dynamicScreen,
arguments: DynamicListViewParams(menu.menuEntry.prompt!, menu.menuEntry.functionName!, selectedEmp: getEmployeeSubordinates?.eMPLOYEENUMBER ?? ''));
} else {}
} else {
Navigator.pushNamed(context, AppRoutes.servicesMenuListScreen,
@ -79,8 +80,10 @@ class _CreateRequestState extends State<CreateRequest> {
@override
Widget build(BuildContext context) {
getEmployeeSubordinates ??= ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList;
if (getEmployeeSubordinates == null) {
getEmployeeSubordinates ??= ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList;
employeeSubRequest();
}
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBarWidget(

@ -67,23 +67,25 @@ class _EmployeeDetailsState extends State<EmployeeDetails> {
}
return Scaffold(
extendBody: true,
backgroundColor: MyColors.lightGreyEFColor,
body: Stack(children: [
getEmployeeSubordinates!.eMPLOYEEIMAGE != null ?
Container(
height: 200,
margin: EdgeInsets.only(top: 30),
decoration: BoxDecoration(image: DecorationImage(image: MemoryImage(Utils.dataFromBase64String(getEmployeeSubordinates!.eMPLOYEEIMAGE!)), fit: BoxFit.cover)),
child: new BackdropFilter(
filter: new ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
child: new Container(
decoration: new BoxDecoration(color: Colors.white.withOpacity(0.0)),
),
),
) : Container(
decoration: BoxDecoration(color: Colors.white.withOpacity(0.0)),
),
extendBody: true,
backgroundColor: MyColors.lightGreyEFColor,
body: Stack(
children: [
getEmployeeSubordinates!.eMPLOYEEIMAGE != null
? Container(
height: 200,
margin: const EdgeInsets.only(top: 30),
decoration: BoxDecoration(image: DecorationImage(image: MemoryImage(Utils.dataFromBase64String(getEmployeeSubordinates!.eMPLOYEEIMAGE!)), fit: BoxFit.cover)),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
child: Container(
decoration: BoxDecoration(color: Colors.white.withOpacity(0.0)),
),
),
)
: Container(
decoration: BoxDecoration(color: Colors.white.withOpacity(0.0)),
),
SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Column(
@ -95,15 +97,13 @@ class _EmployeeDetailsState extends State<EmployeeDetails> {
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: Icon(
Icons.arrow_back_ios,
color: Colors.white,
),
),
CircleAvatar(
radius: 18,
backgroundColor: Colors.black.withOpacity(.21),
child: const Icon(Icons.arrow_back_ios_rounded, color: Colors.white, size: 18).paddingOnly(right: 4),
).onPress(() {
Navigator.pop(context);
}),
],
),
),
@ -111,7 +111,9 @@ class _EmployeeDetailsState extends State<EmployeeDetails> {
],
),
)
]));
],
),
);
}
Widget myTeamInfo() {
@ -202,16 +204,8 @@ class _EmployeeDetailsState extends State<EmployeeDetails> {
}
Widget ProfileImage() => getEmployeeSubordinates?.eMPLOYEEIMAGE == null
? SvgPicture.asset(
"assets/images/user.svg",
height: 68,
width: 68,
)
: CircleAvatar(
radius: 68,
backgroundImage: MemoryImage(Utils.getPostBytes(getEmployeeSubordinates?.eMPLOYEEIMAGE)),
backgroundColor: Colors.black,
);
? SvgPicture.asset("assets/images/user.svg", height: 68, width: 68)
: CircleAvatar(radius: 68, backgroundImage: MemoryImage(Utils.getPostBytes(getEmployeeSubordinates?.eMPLOYEEIMAGE)), backgroundColor: Colors.black);
void setMenu() {
menu = [
@ -256,16 +250,17 @@ class _EmployeeDetailsState extends State<EmployeeDetails> {
child: Column(
children: [
Text(LocaleKeys.addFavoriteList).tr(namedArgs: {'name': '${getEmployeeSubordinates!.eMPLOYEENAME}'}),
getEmployeeSubordinates!.eMPLOYEEIMAGE == null
? SvgPicture.asset(
"assets/images/user.svg",
height: 68,
width: 68,)
: CircleAvatar(
radius: 68,
backgroundImage: MemoryImage(Utils.dataFromBase64String(getEmployeeSubordinates!.eMPLOYEEIMAGE!)),
backgroundColor: Colors.black,
),
getEmployeeSubordinates!.eMPLOYEEIMAGE == null
? SvgPicture.asset(
"assets/images/user.svg",
height: 68,
width: 68,
)
: CircleAvatar(
radius: 68,
backgroundImage: MemoryImage(Utils.dataFromBase64String(getEmployeeSubordinates!.eMPLOYEEIMAGE!)),
backgroundColor: Colors.black,
),
// Image.memory(
// Utils.getPostBytes(
// getEmployeeSubordinates!.eMPLOYEEIMAGE ?? "",

@ -15,6 +15,7 @@ import 'package:url_launcher/url_launcher.dart';
class TeamMembers extends StatefulWidget {
final String? selectedEmp;
const TeamMembers({this.selectedEmp, Key? key}) : super(key: key);
@override
@ -22,8 +23,8 @@ class TeamMembers extends StatefulWidget {
}
class _TeamMembersState extends State<TeamMembers> {
String searchEmpEmail ="";
String searchEmpName ="";
String searchEmpEmail = "";
String searchEmpName = "";
String searchEmpNo = "";
String? empId;
@ -32,14 +33,14 @@ class _TeamMembersState extends State<TeamMembers> {
void initState() {
super.initState();
employeeSubordinates();
// employeeSubordinates();
}
void employeeSubordinates() async {
try {
Utils.showLoading(context);
getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString());
getEmployeeSubordinatesList = await MyTeamApiClient().employeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString(),getEmployeeSubordinates?.eMPLOYEENUMBER);
// getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString());
getEmployeeSubordinatesList = await MyTeamApiClient().employeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString(), getEmployeeSubordinates?.eMPLOYEENUMBER);
Utils.hideLoading(context);
setState(() {});
} catch (ex) {
@ -50,82 +51,88 @@ class _TeamMembersState extends State<TeamMembers> {
@override
Widget build(BuildContext context) {
getEmployeeSubordinates ??= ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList;
if (getEmployeeSubordinates == null) {
getEmployeeSubordinates ??= ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList;
employeeSubordinates();
}
return Scaffold(
appBar: AppBarWidget(
context,
title: LocaleKeys.teamMembers.tr(),
appBar: AppBarWidget(
context,
title: LocaleKeys.teamMembers.tr(),
),
backgroundColor: MyColors.backgroundColor,
body: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Column(
children: <Widget>[
getEmployeeSubordinatesList.isEmpty
? Container(margin: const EdgeInsets.only(top: 100), child: Utils.getNoDataWidget(context))
: ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.only(top: 12),
separatorBuilder: (BuildContext cxt, int index) => 12.height,
itemCount: getEmployeeSubordinatesList.length,
itemBuilder: (BuildContext context, int index) {
var phoneNumber = Uri.parse('tel:${getEmployeeSubordinatesList[index].eMPLOYEEMOBILENUMBER}');
return InkWell(
onTap: () async {
Navigator.pushNamed(context, AppRoutes.employeeDetails, arguments: getEmployeeSubordinatesList[index]);
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
getEmployeeSubordinatesList[index].eMPLOYEEIMAGE == null
? SvgPicture.asset(
"assets/images/user.svg",
height: 34,
width: 34,
).paddingOnly(top: 4)
: Container(
height: 34,
width: 34,
child: CircleAvatar(
radius: 25,
backgroundImage: MemoryImage(Utils.dataFromBase64String(getEmployeeSubordinatesList[index].eMPLOYEEIMAGE!)),
backgroundColor: Colors.black,
).paddingOnly(top: 4),
),
9.width,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// "Present".toText13(color: MyColors.greenColor),
"${getEmployeeSubordinatesList[index].eMPLOYEENAME}".toText16(color: MyColors.grey3AColor),
"${getEmployeeSubordinatesList[index].pOSITIONNAME}".toText10(color: MyColors.grey57Color),
],
).expanded,
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
getEmployeeSubordinatesList[index].eMPLOYEEMOBILENUMBER == ""
? SvgPicture.asset("assets/images/call-disable.svg", width: 22, height: 22)
: InkWell(
onTap: () {
launchUrl(phoneNumber);
},
child: SvgPicture.asset("assets/images/call.svg", width: 22, height: 22),
),
8.height,
const Icon(
Icons.arrow_forward_outlined,
color: MyColors.grey3AColor,
size: 18,
),
],
),
],
).paddingOnly(top: 13, bottom: 13, right: 12, left: 14).objectContainerView(radius: 10, disablePadding: true),
).paddingOnly(left: 16.0, right: 16.0);
}),
],
),
backgroundColor: MyColors.backgroundColor,
body: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Column(
children: <Widget>[
getEmployeeSubordinatesList.isEmpty
? Container(
margin: const EdgeInsets.only(top: 100),
child: Utils.getNoDataWidget(context)):
ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.only(top: 12),
separatorBuilder: (BuildContext cxt,int index) => 12.height,
itemCount: getEmployeeSubordinatesList.length,
itemBuilder: (BuildContext context, int index) {
var phoneNumber = Uri.parse('tel:${getEmployeeSubordinatesList[index].eMPLOYEEMOBILENUMBER}');
return InkWell(
onTap: () async {
Navigator.pushNamed(context, AppRoutes.employeeDetails, arguments: getEmployeeSubordinatesList[index]);
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
getEmployeeSubordinatesList[index].eMPLOYEEIMAGE == null
? SvgPicture.asset("assets/images/user.svg",height: 34, width: 34, ).paddingOnly(top: 4)
: Container(
height: 34,
width: 34,
child: CircleAvatar(
radius: 25,
backgroundImage: MemoryImage(Utils.dataFromBase64String(getEmployeeSubordinatesList[index].eMPLOYEEIMAGE!)),
backgroundColor: Colors.black,
).paddingOnly(top: 4),
),
9.width,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// "Present".toText13(color: MyColors.greenColor),
"${getEmployeeSubordinatesList[index].eMPLOYEENAME}".toText16(color: MyColors.grey3AColor),
"${getEmployeeSubordinatesList[index].pOSITIONNAME}".toText10( color: MyColors.grey57Color),
],
).expanded,
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
getEmployeeSubordinatesList[index].eMPLOYEEMOBILENUMBER == ""
? SvgPicture.asset("assets/images/call-disable.svg", width: 22, height: 22)
:InkWell(
onTap: () {
launchUrl(phoneNumber);
},
child: SvgPicture.asset("assets/images/call.svg", width: 22, height: 22),
),
8.height,
const Icon(
Icons.arrow_forward_outlined,
color: MyColors.grey3AColor,
size: 18,
),
],
),
],
).paddingOnly(top: 13, bottom: 13, right: 12, left: 14).objectContainerView(radius: 10, disablePadding: true),
);
}),
],
)
));
),
);
}
}

@ -44,13 +44,12 @@ class _BasicDetailsState extends State<BasicDetails> {
super.initState();
memberInformationList = AppState().memberInformationList!;
List<GetMenuEntriesList> menuData = Provider.of<DashboardProviderModel>(context, listen: false).getMenuEntriesList!;
for( int i=0;i<menuData.length;i++) {
for (int i = 0; i < menuData.length; i++) {
menuData[i].icon == "";
print(menuData[i].requestType);
}
var filterList = menuData.where((e) => e.requestType == 'BASIC_DETAILS').toList();
if(filterList.isNotEmpty) {
if (filterList.isNotEmpty) {
menuEntries = filterList.first;
}

@ -160,7 +160,7 @@ class _ContactDetailsState extends State<ContactDetails> {
right: 1,
child: const Icon(Icons.add_location_alt_outlined, size: 20).onPress(continueDynamicForms),
),
Utils.getNoDataWidget(context).expanded,
Utils.getNoDataWidget(context),
],
).objectContainerView()
],

@ -37,7 +37,6 @@ class _DeleteFamilyMemberState extends State<DeleteFamilyMember> {
//int? relationId;
@override
void initState() {
print(widget.relationId);
super.initState();
}

@ -294,7 +294,6 @@ class _DynamicInputScreenState extends State<DynamicInputScreenAddress> {
countryCode,
effectiveDate.isEmpty ? DateFormat('dd-MMM-yyy').format(DateTime.now()) : effectiveDate,
);
print(values);
Utils.hideLoading(context);
Navigator.pushNamed(context, AppRoutes.requestSubmitScreen,

@ -21,29 +21,30 @@ class PersonalInfo extends StatelessWidget {
title: LocaleKeys.profile_personalInformation.tr(),
),
backgroundColor: MyColors.backgroundColor,
body: SizedBox(
width: MediaQuery.of(context).size.width,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: [
LocaleKeys.category.tr().toText13(color: MyColors.lightGrayColor),
(memberInformationList.eMPLOYMENTCATEGORYMEANING ?? "").toText16(),
20.height,
LocaleKeys.address.tr().toText13(color: MyColors.lightGrayColor),
(memberInformationList.lOCATIONNAME ?? "").toText16(),
20.height,
LocaleKeys.phoneNumber.tr().toText13(color: MyColors.lightGrayColor),
(memberInformationList.eMPLOYEEMOBILENUMBER ?? "").toText16(),
20.height,
LocaleKeys.businessGroup.tr().toText13(color: MyColors.lightGrayColor),
(memberInformationList.bUSINESSGROUPNAME ?? "").toText16(),
20.height,
LocaleKeys.Payroll.tr().toText13(color: MyColors.lightGrayColor),
(memberInformationList.pAYROLLNAME ?? "").toText16(),
],
).objectContainerView().paddingAll(21),
body: ListView(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: [
LocaleKeys.category.tr().toText13(color: MyColors.lightGrayColor),
(memberInformationList.eMPLOYMENTCATEGORYMEANING ?? "").toText16(),
12.height,
LocaleKeys.address.tr().toText13(color: MyColors.lightGrayColor),
(memberInformationList.lOCATIONNAME ?? "").toText16(),
12.height,
LocaleKeys.phoneNumber.tr().toText13(color: MyColors.lightGrayColor),
(memberInformationList.eMPLOYEEMOBILENUMBER ?? "").toText16(),
12.height,
LocaleKeys.businessGroup.tr().toText13(color: MyColors.lightGrayColor),
(memberInformationList.bUSINESSGROUPNAME ?? "").toText16(),
12.height,
LocaleKeys.Payroll.tr().toText13(color: MyColors.lightGrayColor),
(memberInformationList.pAYROLLNAME ?? "").toText16(),
],
).objectContainerView(center: false).paddingAll(21),
],
),
);
}

@ -1,4 +1,3 @@
import 'dart:convert';
import 'dart:io';
import 'dart:ui';
@ -76,15 +75,13 @@ class _ProfileScreenState extends State<ProfileScreen> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: const Icon(
Icons.arrow_back_ios,
color: Colors.white,
),
),
CircleAvatar(
radius: 18,
backgroundColor: Colors.black.withOpacity(.21),
child: const Icon(Icons.arrow_back_ios_rounded, color: Colors.white, size: 18).paddingOnly(right: 4),
).onPress(() {
Navigator.pop(context);
}),
InkWell(
onTap: () {
// startImageSheet();

@ -51,8 +51,8 @@ class ProfilePanel extends StatelessWidget {
: ClipOval(
child: Image.memory(
Utils.dataFromBase64String(memberInformationList.eMPLOYEEIMAGE!),
width: 75,
height: 75,
width: 68,
height: 68,
fit: BoxFit.fill,
),
);

@ -39,7 +39,6 @@ class _ItemsForSaleFragmentState extends State<ItemsForSaleFragment> {
if (gridScrollController.position.atEdge) {
bool isTop = gridScrollController.position.pixels == 0;
if (!isTop && getItemsForSaleList.length == currentPageNo * 10) {
print('At the bottom');
currentPageNo++;
getItemsForSale(currentPageNo, currentCategoryID);
}

@ -141,7 +141,7 @@ class _MyPostedAdsFragmentState extends State<MyPostedAdsFragment> {
Row(
children: [
LocaleKeys.remove.tr().toText12(color: MyColors.redColor).center.onPress(() {
updateItemForSale(employeePostedAdsList[index].itemSaleID!);
updateItemForSale(employeePostedAdsList[index]);
}).expanded,
Container(width: 1, height: 30, color: MyColors.lightGreyEFColor),
LocaleKeys.edit.tr().toText12(color: MyColors.gradiantEndColor).center.onPress(() {
@ -172,7 +172,7 @@ class _MyPostedAdsFragmentState extends State<MyPostedAdsFragment> {
);
}
void updateItemForSale(int itemSaleID) async {
void updateItemForSale(EmployeePostedAds employeePostedAds) async {
Utils.showLoading(context);
String? empNum = AppState().memberInformationList?.eMPLOYEENUMBER;
@ -180,20 +180,28 @@ class _MyPostedAdsFragmentState extends State<MyPostedAdsFragment> {
String? loginTokenID = AppState().postParamsObject?.logInTokenID;
String? tokenID = AppState().postParamsObject?.tokenID;
var request = http.MultipartRequest('POST', Uri.parse("${ApiConsts.cocRest}Mohemm_ITG_UpdateItemForSale"));
request.fields['itemSaleID'] = itemSaleID.toString();
var request = http.MultipartRequest('POST', Uri.parse("${ApiConsts.cocRest}Mohemm_ITG_UpdateItemForSaleMobile"));
request.fields['ItgItemSaleID'] = employeePostedAds.itemSaleID.toString();
request.fields['ItgCategoryID'] = employeePostedAds.categoryID.toString();
request.fields['ItgTitle'] = employeePostedAds.title!;
request.fields['ItgDescription'] = employeePostedAds.description!;
request.fields['ItgQuotePrice'] = employeePostedAds.quotePrice.toString();
request.fields['RegionID'] = employeePostedAds.regionID.toString();
request.fields['Itg_EndDate'] = employeePostedAds.endDate.toString();
request.fields['Channel'] = "31";
request.fields['isActive'] = "false";
request.fields['ItgIsActive'] = "false";
request.fields['LogInToken'] = loginTokenID!;
request.fields['Token'] = tokenID!;
request.fields['MobileNo'] = empMobNum!;
request.fields['EmployeeNumber'] = empNum!;
request.fields['employeeNumber'] = empNum;
// debugPrint(json.encode(request.fields.toString()));
var response = await request.send().catchError((e) {
Utils.hideLoading(context);
Utils.handleException(e, context, null);
});
print(response.statusCode);
Utils.hideLoading(context);
getAdsByEmployee();
}

@ -255,7 +255,6 @@ class _EndEmploymentScreenState extends State<EndEmploymentScreen> {
],
onSelected: (int popipIndex) async {
termColObject.selectedObjectValue = termColObject.objectValuesList![popipIndex];
print(termColObject.selectedObjectValue?.toJson());
setState(() {});
});
}

@ -88,7 +88,8 @@ class _ItemHistoryScreenState extends State<ItemHistoryScreen> {
children: [
if (moItemHistoryList.isNotEmpty) loadMoItemHistoryData(),
if (poItemHistoryList.isNotEmpty) loadPoItemHistoryData(),
if (quotationAnalysisList.isNotEmpty) loadQuotationAnalysisData()
if (quotationAnalysisList.isNotEmpty) loadQuotationAnalysisData(),
if (moItemHistoryList.isEmpty && poItemHistoryList.isEmpty && quotationAnalysisList.isEmpty) Utils.getNoDataWidget(context),
],
),
);

@ -352,7 +352,6 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
}
void handleFabAction(AllowedActions action) {
print(action.toJson());
switch (action.action) {
case "Delegate":
showMyBottomSheet(context,
@ -461,7 +460,6 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
}
void performAction(String actionMode) {
print(actionMode);
showDialog(
context: context,
builder: (cxt) => ITGCommentsDialog(
@ -535,7 +533,7 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
Utils.hideLoading(context);
Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr());
// Navigator.pop(context, "delegate_reload");
animationIndex=animationIndex+1;
animationIndex = animationIndex + 1;
AppState().requestAllList!.removeAt(AppState().itgWorkListIndex!);
if (AppState().requestAllList!.isEmpty) {
Navigator.pop(context, "delegate_reload");

@ -215,11 +215,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBarWidget(
context,
title: LocaleKeys.workList.tr(),
showNotificationButton: true,
),
appBar: AppBarWidget(context, title: LocaleKeys.workList.tr(), showWorkListSettingButton: true),
body: SizedBox(
width: double.infinity,
height: double.infinity,
@ -284,31 +280,33 @@ class _WorkListScreenState extends State<WorkListScreen> {
physics: const BouncingScrollPhysics(),
child: itgRequestTypeIndex != null
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 40,
child: ListView.separated(
itemBuilder: (context, index) {
RequestType type = itgFormsModel!.requestType![index];
return Container(
padding: const EdgeInsets.only(left: 21, right: 21, top: 8, bottom: 8),
alignment: Alignment.center,
decoration: BoxDecoration(borderRadius: BorderRadius.circular(30), color: itgRequestTypeIndex == index ? MyColors.darkIconColor : MyColors.lightGreyEAColor),
child: ("${type.requestTypeName}").toText12(color: itgRequestTypeIndex == index ? MyColors.white : MyColors.black),
).onPress(() {
if (itgRequestTypeIndex != index) {
itgRequestTypeIndex = index;
setState(() {});
}
});
},
separatorBuilder: (context, index) => 8.width,
shrinkWrap: true,
itemCount: itgFormsModel?.requestType?.length ?? 0,
scrollDirection: Axis.horizontal,
padding: const EdgeInsets.only(left: 21, right: 21),
),
).paddingOnly(top: 16, bottom: 16),
// todo this is commented for temporary purpose, have issue when selecting any itg category and click any item showing wrong details
// SizedBox(
// height: 40,
// child: ListView.separated(
// itemBuilder: (context, index) {
// RequestType type = itgFormsModel!.requestType![index];
// return Container(
// padding: const EdgeInsets.only(left: 21, right: 21, top: 8, bottom: 8),
// alignment: Alignment.center,
// decoration: BoxDecoration(borderRadius: BorderRadius.circular(30), color: itgRequestTypeIndex == index ? MyColors.darkIconColor : MyColors.lightGreyEAColor),
// child: ("${type.requestTypeName}").toText12(color: itgRequestTypeIndex == index ? MyColors.white : MyColors.black),
// ).onPress(() {
// if (itgRequestTypeIndex != index) {
// itgRequestTypeIndex = index;
// setState(() {});
// }
// });
// },
// separatorBuilder: (context, index) => 8.width,
// shrinkWrap: true,
// itemCount: itgFormsModel?.requestType?.length ?? 0,
// scrollDirection: Axis.horizontal,
// padding: const EdgeInsets.only(left: 21, right: 21),
// ),
// ).paddingOnly(top: 16, bottom: 16),
ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
@ -429,7 +427,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
void openBottomSheet(BuildContext context) {
showMyBottomSheet(
context,
callBackFunc: (){},
callBackFunc: () {},
child: WorkListAdvanceSearch((selectedViewID, selectedItemTypeID, searchByInput, searchByDate) async {
itgRequestTypeIndex = null;
pNotificationType = selectedViewID;

@ -25,6 +25,7 @@ import 'package:mohem_flutter_app/models/member_information_list_model.dart';
import 'package:mohem_flutter_app/models/notification_get_respond_attributes_list_model.dart';
import 'package:mohem_flutter_app/models/worklist/GetRFCEmployeeList.dart';
import 'package:mohem_flutter_app/models/worklist/hr/eit_otification_body_model.dart';
import 'package:mohem_flutter_app/models/worklist/hr/get_address_notification_body_list.dart';
import 'package:mohem_flutter_app/models/worklist/hr/get_basic_det_ntf_body_list_model.dart';
import 'package:mohem_flutter_app/models/worklist/hr/get_contact_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/worklist/hr/get_phones_notification_body_list_model.dart';
@ -78,6 +79,8 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
List<GetBasicDetNtfBodyList>? getBasicDetNtfBodyList = [];
List<GetAbsenceCollectionNotificationBodyList>? getAbsenceCollectionNotificationBodyList = [];
GetContactNotificationBodyList? getContactNotificationBodyList;
List<GetAddressNotificationBodyList>? getAddressNotificationBodyList = [];
GenericResponseModel? getBasicNTFBody;
GenericResponseModel? getICBody;
@ -106,6 +109,20 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
void getData() async {
// try {
// Utils.showLoading(context);
getEitCollectionNotificationBodyList!.clear();
getAbsenceCollectionNotificationBodyList!.clear();
getPrNotificationBody = null;
getStampMsNotifications.clear();
getStampNsNotifications.clear();
getPoNotificationBody?.pOHeader!.clear();
getItemCreationNtfBody?.itemCreationHeader!.clear();
getPhonesNotificationBodyList!.clear();
getBasicDetNtfBodyList!.clear();
getAbsenceCollectionNotificationBodyList!.clear();
getContactNotificationBodyList = null;
getAddressNotificationBodyList!.clear();
if (workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP") {
getUserInformation();
}
@ -126,6 +143,8 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
getAbsenceNotificationBody();
} else if (workListData!.rEQUESTTYPE == "CONTACT") {
getContactNotificationBody();
} else if (workListData!.rEQUESTTYPE == "ADDRESS") {
getAddressNotificationBody();
}
// getBasicNTFBody = await WorkListApiClient().getBasicDetNTFBody(workListData!.nOTIFICATIONID!, -999);
// getAbsenceCollectionNotifications = await WorkListApiClient().getAbsenceNotificationBody(workListData!.nOTIFICATIONID!, -999);
@ -258,6 +277,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
getEitCollectionNotificationBodyList: getEitCollectionNotificationBodyList,
getPhonesNotificationBodyList: getPhonesNotificationBodyList,
getBasicDetNtfBodyList: getBasicDetNtfBodyList,
getAddressNotificationBodyList: getAddressNotificationBodyList,
getAbsenceCollectionNotificationBodyList: getAbsenceCollectionNotificationBodyList,
getContactNotificationBodyList: getContactNotificationBodyList,
getPrNotificationBodyList: getPrNotificationBody,
@ -416,6 +436,12 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
case "DELEGATE":
returnActionImage = "assets/images/delegate.svg";
break;
case "APPROVE":
returnActionImage = "assets/images/worklist/approve.svg";
break;
case "REJECT":
returnActionImage = "assets/images/worklist/reject.svg";
break;
case "REQUEST_INFO":
returnActionImage = "assets/images/request_info.svg";
break;
@ -688,7 +714,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
GenericResponseModel model = await WorkListApiClient().postNotificationActions(payload);
Utils.hideLoading(context);
Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr());
animationIndex=animationIndex+1;
animationIndex = animationIndex + 1;
AppState().workList!.removeAt(AppState().workListIndex!);
if (AppState().workList!.isEmpty) {
Navigator.pop(context, "delegate_reload");
@ -725,6 +751,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getEitCollectionNotificationBodyList!.clear();
getEitCollectionNotificationBodyList = await WorkListApiClient().GetEitNotificationBody(workListData!.nOTIFICATIONID);
apiCallCount--;
if (apiCallCount == 0) {
@ -742,6 +769,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
memberInformationListModel = null;
memberInformationListModel = await WorkListApiClient().getUserInformation(-999, workListData!.sELECTEDEMPLOYEENUMBER!);
apiCallCount--;
if (apiCallCount == 0) {
@ -759,6 +787,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getPhonesNotificationBodyList!.clear();
getPhonesNotificationBodyList = await WorkListApiClient().getPhonesNotificationBodyList(workListData!.nOTIFICATIONID);
apiCallCount--;
if (apiCallCount == 0) {
@ -776,6 +805,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getBasicDetNtfBodyList!.clear();
getBasicDetNtfBodyList = await WorkListApiClient().getBasicDetNtfBodyList(workListData!.nOTIFICATIONID);
apiCallCount--;
if (apiCallCount == 0) {
@ -793,6 +823,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getAbsenceCollectionNotificationBodyList!.clear();
getAbsenceCollectionNotificationBodyList = await WorkListApiClient().getAbsenceNotificationBody(workListData!.nOTIFICATIONID);
apiCallCount--;
if (apiCallCount == 0) {
@ -823,6 +854,23 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
}
}
void getAddressNotificationBody() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getAddressNotificationBodyList = await WorkListApiClient().getAddressNotificationBodyList(workListData!.nOTIFICATIONID);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getStampNotificationBody() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
@ -916,6 +964,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getNotificationRespondAttributes.clear();
getNotificationRespondAttributes = await WorkListApiClient().notificationGetRespondAttributes(workListData!.nOTIFICATIONID!);
if (getNotificationRespondAttributes.isNotEmpty) {
notificationNoteInput = getNotificationRespondAttributes.first;
@ -936,6 +985,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
notificationButtonsList.clear();
notificationButtonsList = await WorkListApiClient().getNotificationButtons(workListData!.nOTIFICATIONID!);
if (notificationButtonsList.isNotEmpty) {
isCloseAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "CLOSE");

@ -13,6 +13,7 @@ import 'package:mohem_flutter_app/models/get_pr_notification_body_list_model.dar
import 'package:mohem_flutter_app/models/get_stamp_ms_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_stamp_ns_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/worklist/hr/eit_otification_body_model.dart';
import 'package:mohem_flutter_app/models/worklist/hr/get_address_notification_body_list.dart';
import 'package:mohem_flutter_app/models/worklist/hr/get_basic_det_ntf_body_list_model.dart';
import 'package:mohem_flutter_app/models/worklist/hr/get_contact_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/worklist/hr/get_phones_notification_body_list_model.dart';
@ -31,6 +32,7 @@ class InfoFragment extends StatelessWidget {
List<GetAbsenceCollectionNotificationBodyList>? getAbsenceCollectionNotificationBodyList;
GetContactNotificationBodyList? getContactNotificationBodyList;
GetPrNotificationBodyList? getPrNotificationBodyList;
List<GetAddressNotificationBodyList>? getAddressNotificationBodyList = [];
InfoFragment(
{this.workListData,
@ -43,7 +45,8 @@ class InfoFragment extends StatelessWidget {
this.getBasicDetNtfBodyList,
this.getAbsenceCollectionNotificationBodyList,
this.getContactNotificationBodyList,
this.getPrNotificationBodyList});
this.getPrNotificationBodyList,
this.getAddressNotificationBodyList});
double itemHeight = 0;
double itemWidth = 0;
@ -89,6 +92,7 @@ class InfoFragment extends StatelessWidget {
if (getBasicDetNtfBodyList?.isNotEmpty ?? false) getBasicDetNtfBodyListWidget(getBasicDetNtfBodyList ?? []).objectContainerView(title: "Basic Information"),
if (getAbsenceCollectionNotificationBodyList?.isNotEmpty ?? false) getAbsenceCollectionNotificationBodyListWidget(getAbsenceCollectionNotificationBodyList ?? []),
if (getContactNotificationBodyList != null) getContactNotificationBodyListWidget(getContactNotificationBodyList ?? GetContactNotificationBodyList()).objectContainerView(),
if (getAddressNotificationBodyList?.isNotEmpty ?? false) getAddressNotificationBodyListWidget(getAddressNotificationBodyList!),
];
return Container(
width: double.infinity,
@ -160,7 +164,7 @@ class InfoFragment extends StatelessWidget {
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.otherCharges.tr(), poHeaderList[index].oTHERCHARGES?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.totalPOAmountWithVAT.tr(), poHeaderList[index].qUOTATIONDATE ?? ""),
ItemDetailViewCol(LocaleKeys.totalPOAmountWithVAT.tr(), poHeaderList[index].tOTPOAMT.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.totalPOAmountInWords.tr(), poHeaderList[index].tOTPOAMTWORD ?? ""),
@ -465,6 +469,36 @@ class InfoFragment extends StatelessWidget {
);
}
Widget getAddressNotificationBodyListWidget(List<GetAddressNotificationBodyList> getAddressNotificationBodyList) {
bool isOdd = false;
try {
if (getAddressNotificationBodyList.length % 2 != 0) {
isOdd = true;
getAddressNotificationBodyList.add(GetAddressNotificationBodyList(sEGMENTPROMPT: "--", sEGMENTVALUEDSP: "--"));
}
} catch (e) {}
return GridView.builder(
itemCount: getAddressNotificationBodyList!.length,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) => ItemDetailViewGridItem(
index,
getAddressNotificationBodyList[index].sEGMENTPROMPT,
getAddressNotificationBodyList[index].sEGMENTVALUEDSP,
isNeedToShowEmptyDivider: (getAddressNotificationBodyList.length == index + 1)
? isOdd
? true
: false
: false,
),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
childAspectRatio: (itemWidth / itemHeight),
),
).objectContainerView();
}
List<Widget> getPRHeaderValues() {
List<Widget> pRHeaders = [];
getPrNotificationBodyList!.pRHeader!.forEach((element) {
@ -478,7 +512,7 @@ class InfoFragment extends StatelessWidget {
try {
if (data.contactNotificationBody!.length % 2 != 0) {
isOdd = true;
data.contactNotificationBody!.add(new ContactNotificationBody());
data.contactNotificationBody!.add(ContactNotificationBody(segmentPrompt: "--", segmentValueDsp: "--"));
}
} catch (e) {}

@ -58,10 +58,10 @@ class RequestFragment extends StatelessWidget {
children: [
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.code.tr(), poLinesList[index].iTEMCODE ?? ""),
ItemDetailViewCol(LocaleKeys.mfg.tr(), poLinesList[index].uOM ?? ""),
ItemDetailViewCol(LocaleKeys.mfg.tr(), poLinesList[index].mFG ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.lineType.tr(), poLinesList[index].qUANTITY?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.lineType.tr(), poLinesList[index].lINETYPE?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.unit.tr(), poLinesList[index].uOM ?? ""),
),
ItemDetailGrid(
@ -78,10 +78,10 @@ class RequestFragment extends StatelessWidget {
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.deliverToLocation.tr(), poLinesList[index].dELIVERTOLOCATION ?? ""),
ItemDetailViewCol(LocaleKeys.requisitionNumber.tr(), poLinesList[index].rEQUESTOR ?? ""),
ItemDetailViewCol(LocaleKeys.requisitionNumber.tr(), poLinesList[index].pRNUM ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.requester.tr(), poLinesList[index].pRNUM ?? ""),
ItemDetailViewCol(LocaleKeys.requester.tr(), poLinesList[index].rEQUESTOR ?? ""),
Container(),
),
12.height,

@ -5,25 +5,20 @@ import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/provider/chat_provider_model.dart';
import 'package:mohem_flutter_app/widgets/circular_avatar.dart';
import 'package:provider/provider.dart';
AppBar AppBarWidget(BuildContext context,
{required String title,
bool showHomeButton = true,
bool showNotificationButton = false,
bool showWorkListSettingButton = false,
bool showMemberButton = false,
String? image,
List<Widget>? actions,
void Function()? onHomeTapped,
void Function()? onBackTapped}) {
return AppBar(
leadingWidth: 0,
// leading: GestureDetector(
// behavior: HitTestBehavior.opaque,
// onTap: Feedback.wrapForTap(() => Navigator.maybePop(context), context),
// child: const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor),
// ),
//titleSpacing: -1.44,
title: Row(
children: [
GestureDetector(
@ -34,14 +29,6 @@ AppBar AppBarWidget(BuildContext context,
child: const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor),
),
4.width,
if (image != null)
CircularAvatar(
url: image,
height: 40,
width: 40,
isImageBase64: true,
),
if (image != null) 14.width,
title.toText24(color: MyColors.darkTextColor, isBold: true).expanded,
],
),
@ -56,12 +43,12 @@ AppBar AppBarWidget(BuildContext context,
},
icon: const Icon(Icons.home, color: MyColors.darkIconColor),
),
if (showNotificationButton)
if (showWorkListSettingButton)
IconButton(
onPressed: () {
Navigator.pushNamed(context, AppRoutes.worklistSettings);
},
icon: const Icon(Icons.notifications, color: MyColors.textMixColor),
icon: const Icon(Icons.settings_rounded, color: MyColors.darkIconColor),
),
if (showMemberButton)
IconButton(

@ -31,9 +31,10 @@ class BalancesDashboardWidget extends StatefulWidget {
final String title;
final List<PieChartModel> chartModelList;
final bool isLeaveBalance;
final String selectedEmp;
final String? selectedEmp;
final bool showLoading;
const BalancesDashboardWidget(this.title, this.isLeaveBalance, this.selectedEmp, {Key? key, this.chartModelList = const []}) : super(key: key);
const BalancesDashboardWidget(this.title, this.isLeaveBalance, {Key? key, this.selectedEmp, this.showLoading = true, this.chartModelList = const []}) : super(key: key);
@override
_BalancesDashboardWidgetState createState() {
@ -46,14 +47,12 @@ class _BalancesDashboardWidgetState extends State<BalancesDashboardWidget> {
late DateTime accrualDateTime;
GetAccrualBalancesList? leaveBalanceAccrual;
List<GetAccrualBalancesList>? ticketBalanceAccrualList;
dynamic dynamicParams;
String selectedEmp = "";
@override
void initState() {
super.initState();
accrualDateTime = DateTime.now();
changeAccrualDate();
changeAccrualDate(widget.showLoading);
}
@override
@ -61,9 +60,9 @@ class _BalancesDashboardWidgetState extends State<BalancesDashboardWidget> {
super.dispose();
}
void changeAccrualDate() async {
void changeAccrualDate(bool showLoading) async {
try {
// Utils.showLoading(context);
if (showLoading) Utils.showLoading(context);
List<GetAccrualBalancesList> accrualList = await DashboardApiClient().getAccrualBalances(DateFormat("MM/dd/yyyy").format(accrualDateTime), empID: widget.selectedEmp);
if (accrualList.isNotEmpty) {
if (widget.isLeaveBalance) {
@ -80,10 +79,10 @@ class _BalancesDashboardWidgetState extends State<BalancesDashboardWidget> {
];
}
}
// Utils.hideLoading(context);
if (showLoading) Utils.hideLoading(context);
setState(() {});
} catch (ex) {
Utils.hideLoading(context);
if (showLoading) Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
@ -125,7 +124,7 @@ class _BalancesDashboardWidgetState extends State<BalancesDashboardWidget> {
DateTime selectedDate = await Utils.selectDate(context, accrualDateTime);
if (selectedDate != accrualDateTime) {
accrualDateTime = selectedDate;
changeAccrualDate();
changeAccrualDate(true);
}
}),
],

@ -20,6 +20,7 @@ import 'package:mohem_flutter_app/models/chat/get_search_user_chat_model.dart';
import 'package:mohem_flutter_app/models/get_action_history_list_model.dart';
import 'package:mohem_flutter_app/models/worklist/get_favorite_replacements_model.dart';
import 'package:mohem_flutter_app/models/worklist/replacement_list_model.dart';
import 'package:mohem_flutter_app/ui/chat/chat_detailed_screen.dart';
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/circular_avatar.dart';
import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart';
@ -238,7 +239,7 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
Navigator.pushNamed(
context,
AppRoutes.chatDetailed,
arguments: {"targetUser": chatUsersList![index], "isNewChat": true},
arguments: ChatDetailedScreenParams(chatUsersList![index], true),
);
},
),

@ -0,0 +1,78 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/models/chat/get_search_user_chat_model.dart';
import 'package:mohem_flutter_app/provider/chat_provider_model.dart';
import 'package:mohem_flutter_app/widgets/circular_avatar.dart';
import 'package:provider/provider.dart';
AppBar ChatAppBarWidget(BuildContext context,
{required String title,
bool showHomeButton = true,
String? image,
ChatUser? chatUser,
bool showTyping = false,
List<Widget>? actions,
void Function()? onHomeTapped,
void Function()? onBackTapped}) {
return AppBar(
leadingWidth: 0,
title: Row(
children: [
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: Feedback.wrapForTap(() {
(onBackTapped == null ? Navigator.maybePop(context) : onBackTapped());
}, context),
child: const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor),
),
4.width,
if (image != null)
CircularAvatar(
url: image,
height: 40,
width: 40,
isImageBase64: true,
),
if (image != null) 14.width,
SizedBox(
height: 40,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
title.toText20(color: MyColors.darkTextColor, isBold: true).expanded,
if (showTyping)
Consumer<ChatProviderModel>(
builder: (BuildContext cxt, ChatProviderModel data, Widget? child) {
if (chatUser!.isTyping!) {
return ("Typing ...").toText10(color: MyColors.textMixColor);
} else {
return const SizedBox();
}
},
),
],
),
)
],
),
centerTitle: false,
elevation: 0,
backgroundColor: Colors.white,
actions: [
if (showHomeButton)
IconButton(
onPressed: () {
onHomeTapped == null ? Navigator.popUntil(context, ModalRoute.withName(AppRoutes.dashboard)) : onHomeTapped();
},
icon: const Icon(Icons.home, color: MyColors.darkIconColor),
),
...actions ?? []
],
);
}

@ -68,11 +68,7 @@ class DynamicTextFieldWidget extends StatelessWidget {
enabled: isEnable,
scrollPadding: EdgeInsets.zero,
readOnly: isReadOnly,
keyboardType: (isInputTypeNum)
? isInputTypeNumSigned
? const TextInputType.numberWithOptions(signed: true)
: TextInputType.number
: TextInputType.text,
keyboardType: (isInputTypeNum) ? (isInputTypeNumSigned ? const TextInputType.numberWithOptions(signed: true, decimal: true) : TextInputType.numberWithOptions(signed: true, decimal: true)) : TextInputType.text,
textInputAction: TextInputAction.done,
//controller: controller,
maxLines: lines,

@ -45,7 +45,7 @@ class ImageOptions {
onFilesTap: () async {
FilePickerResult? result = await FilePicker.platform.pickFiles(
type: FileType.custom,
allowedExtensions: ['jpg', 'jpeg ', 'pdf', 'txt', 'docx', 'doc', 'pptx', 'xlsx', 'png', 'rar', 'zip', 'xls'],
allowedExtensions: ['jpg', 'jpeg ', 'pdf', 'txt', 'docx', 'doc', 'pptx', 'xlsx', 'png', 'rar', 'zip',],
);
List<File> files = result!.paths.map((path) => File(path!)).toList();
image(result.files.first.path.toString(), files.first);

@ -36,10 +36,11 @@ class ItemDetailViewCol extends StatelessWidget {
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
"$title:".toText12(isBold: true, color: const Color(0xff2BB8A6), maxLine: 2),
4.width,
(value.isEmpty ? "--" : value).toText12(color: MyColors.normalTextColor, maxLine: 2),
(value.isEmpty ? "--" : value).toText12(color: MyColors.normalTextColor, maxLine: 5),
],
);
}

@ -46,12 +46,12 @@ class Location {
});
}
static void getCurrentLocation(Function(LatLng?) callback, BuildContext context) {
static void getCurrentLocation(Function(LatLng?, bool isMocked) callback, BuildContext context) {
void done(Position position) {
//AppStorage.sp.saveLocation(position);
bool isMocked = position.isMocked;
LatLng? myCurrentLocation = LatLng(position.latitude, position.longitude);
callback(myCurrentLocation);
callback(myCurrentLocation, isMocked);
}
AppPermissions.location((granted) {

@ -48,8 +48,6 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
bool isAvailable = await NfcManager.instance.isAvailable();
setState(() {
AppState().privilegeListModel!.forEach((element) {
print(element.serviceName.toString() + " " + element.previlege.toString()); // Check availability
if (element.serviceName == "enableNFC") {
if (isAvailable) if (element.previlege ?? false) isNfcEnabled = true;
} else if (element.serviceName == "enableQR") {
@ -76,7 +74,6 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
@override
Widget build(BuildContext context) {
print(MediaQuery.of(context).size.width);
return Container(
padding: EdgeInsets.only(left: 21, right: 21, bottom: 21, top: widget.topPadding),
decoration: const BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white),
@ -97,8 +94,12 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
// if (isNfcEnabled)
attendanceMethod("NFC", "assets/images/nfc.svg", isNfcEnabled, () {
if (isNfcLocationEnabled) {
Location.getCurrentLocation((LatLng? latlng) {
performNfcAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "");
Location.getCurrentLocation((LatLng? latlng, bool isMocked) {
if (isMocked) {
markFakeAttendance("NFC", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? "");
} else {
performNfcAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "");
}
}, context);
} else {
performNfcAttendance(widget.model);
@ -107,8 +108,12 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
if (isWifiEnabled)
attendanceMethod("Wifi", "assets/images/wufu.svg", isWifiEnabled, () {
if (isWifiLocationEnabled) {
Location.getCurrentLocation((LatLng? latlng) {
performWifiAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "");
Location.getCurrentLocation((LatLng? latlng, bool isMocked) {
if (isMocked) {
markFakeAttendance("WIFI", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? "");
} else {
performWifiAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "");
}
}, context);
} else {
performWifiAttendance(widget.model);
@ -118,8 +123,12 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
if (isQrEnabled)
attendanceMethod("QR", "assets/images/ic_qr.svg", isQrEnabled, () async {
if (isQrLocationEnabled) {
Location.getCurrentLocation((LatLng? latlng) {
performQrCodeAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "");
Location.getCurrentLocation((LatLng? latlng, bool isMocked) {
if (isMocked) {
markFakeAttendance("QR", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? "");
} else {
performQrCodeAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "");
}
}, context);
} else {
performQrCodeAttendance(widget.model);
@ -134,18 +143,12 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
}
Future<void> performNfcAttendance(DashboardProviderModel model, {String lat = "0", String lng = "0"}) async {
if (isNfcLocationEnabled) {
print("nfc location enabled");
} else {
print("nfc not location enabled");
}
if (Platform.isIOS) {
Utils.readNFc(onRead: (String nfcId) async {
Utils.showLoading(context);
try {
GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 2, nfcValue: nfcId, isGpsRequired: isNfcLocationEnabled, lat: lat, long: lng);
if(g?.messageStatus != 1) {
if (g?.messageStatus != 1) {
Utils.hideLoading(context);
showDialog(
context: context,
@ -166,7 +169,6 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
child: SuccessDialog(widget.isFromDashboard),
);
}
} catch (ex) {
print(ex);
Utils.hideLoading(context);
@ -177,11 +179,10 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
});
} else {
showNfcReader(context, onNcfScan: (String? nfcId) async {
print(nfcId);
Utils.showLoading(context);
try {
GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 2, nfcValue: nfcId ?? "", isGpsRequired: isNfcLocationEnabled, lat: lat, long: lng);
if(g?.messageStatus != 1) {
if (g?.messageStatus != 1) {
Utils.hideLoading(context);
showDialog(
context: context,
@ -214,12 +215,6 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
}
Future<void> performWifiAttendance(DashboardProviderModel model, {String lat = "0", String lng = "0"}) async {
if (isWifiLocationEnabled) {
print("wifi location enabled");
} else {
print("wifi not location enabled");
}
Utils.showLoading(context);
bool isConnected = await WiFiForIoTPlugin.connect(AppState().getMohemmWifiSSID ?? "",
password: AppState().getMohemmWifiPassword ?? "", joinOnce: Platform.isIOS ? false : true, security: NetworkSecurity.WPA, withInternet: false);
@ -271,7 +266,6 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
),
);
if (qrCodeValue != null) {
print("qrCode: " + qrCodeValue);
Utils.showLoading(context);
try {
GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 1, isGpsRequired: isQrLocationEnabled, lat: lat, long: lng, QRValue: qrCodeValue);
@ -293,6 +287,21 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
}
}
void markFakeAttendance(String sourceName, String lat, String long) async {
Utils.showLoading(context);
try {
await DashboardApiClient().markFakeLocation(sourceName: sourceName, lat: lat, long: long);
Utils.hideLoading(context);
Utils.confirmDialog(context, LocaleKeys.fakeLocation.tr());
} catch (ex) {
print(ex);
Utils.hideLoading(context);
Utils.handleException(ex, context, (msg) {
Utils.confirmDialog(context, msg);
});
}
}
Widget attendanceMethod(String title, String image, bool isEnabled, VoidCallback onPress) => Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),

@ -41,7 +41,6 @@ class _NfcLayoutState extends State<NfcLayout> {
super.initState();
NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async {
print(tag.data);
var f;
if (Platform.isAndroid) {
f = MifareUltralight(tag: tag, identifier: tag.data["nfca"]["identifier"], type: 2, maxTransceiveLength: 252, timeout: 22);

@ -68,7 +68,7 @@ dependencies:
month_picker_dialog_2: 0.5.5
open_file: ^3.2.1
wifi_iot: ^0.3.16
flutter_html: ^2.2.1
flutter_html: ^3.0.0-alpha.6
# flutter_barcode_scanner: ^2.0.0
qr_code_scanner: ^1.0.0
qr_flutter: ^4.0.0
@ -93,12 +93,18 @@ dependencies:
flutter_webrtc: ^0.9.16
camera: ^0.10.0+4
#Chat Voice Message Recoding & Play
# record: ^4.4.3
audio_waveforms: ^0.1.5+1
# animated_text_kit: ^4.2.2
#Encryption
flutter_des: ^2.1.0
video_player: ^2.4.7
just_audio: ^0.9.30
safe_device: ^1.1.2
flutter_layout_grid: ^2.0.1
dev_dependencies:
flutter_test:

Loading…
Cancel
Save